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
e6239e74
Commit
e6239e74
authored
Aug 22, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved m_Layer into EDA_BaseStruct
parent
755c3a1b
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1189 additions
and
971 deletions
+1189
-971
change_log.txt
change_log.txt
+14
-0
base_screen.cpp
common/base_screen.cpp
+5
-0
base_struct.cpp
common/base_struct.cpp
+1
-1
common.cpp
common/common.cpp
+308
-256
class_screen.h
eeschema/class_screen.h
+0
-1
program.h
eeschema/program.h
+0
-3
base_struct.h
include/base_struct.h
+1
-2
pcbstruct.h
include/pcbstruct.h
+1
-1
buildmnu.cpp
kicad/buildmnu.cpp
+1
-1
class_cotation.h
pcbnew/class_cotation.h
+0
-1
class_mire.h
pcbnew/class_mire.h
+0
-1
class_module.h
pcbnew/class_module.h
+0
-1
class_pcb_text.h
pcbnew/class_pcb_text.h
+12
-0
class_text_mod.h
pcbnew/class_text_mod.h
+0
-1
locate.cpp
pcbnew/locate.cpp
+12
-13
onrightclick.cpp
pcbnew/onrightclick.cpp
+2
-1
pcbframe.cpp
pcbnew/pcbframe.cpp
+69
-3
drawpanel.cpp
share/drawpanel.cpp
+761
-683
zoom.cpp
share/zoom.cpp
+2
-2
No files found.
change_log.txt
View file @
e6239e74
...
@@ -4,6 +4,19 @@ Started 2007-June-11
...
@@ -4,6 +4,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.
2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ eeschema & pcbnew
* Fixed a filename case sensitivity problem that would show up on Linux
but probably not on Windows: bitmap/Reload.xpm needed uppercase R.
* Since so many classes introduced m_Layer, I moved m_Layer into
EDA_BaseStruct so all classes can inherit it and that way we can test
layer using a general, polymorphic test, i.e. don't have to cast a
EDA_BaseStruct* to a class specific pointer to test layer. Could also have
used a virtual function but too many places use m_Layer directly.
2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
================================================================================
+ eeschema & pcbnew
+ eeschema & pcbnew
...
@@ -15,6 +28,7 @@ email address.
...
@@ -15,6 +28,7 @@ email address.
================================================================================
================================================================================
+ administrative
+ administrative
Added copyright.h as a proposed copyright header for Mr. Charras's review.
Added copyright.h as a proposed copyright header for Mr. Charras's review.
Added uncrustify.cfg the configuration program for "uncrustify" C++ beautifier.
2007-Aug-20 UPDATE Dick Hollenbeck <dick@softplc.com>
2007-Aug-20 UPDATE Dick Hollenbeck <dick@softplc.com>
...
...
common/base_screen.cpp
View file @
e6239e74
...
@@ -557,5 +557,10 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList( void )
...
@@ -557,5 +557,10 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList( void )
void
BASE_SCREEN
::
SetCurItem
(
EDA_BaseStruct
*
aCurItem
)
void
BASE_SCREEN
::
SetCurItem
(
EDA_BaseStruct
*
aCurItem
)
{
{
#if defined(DEBUG)
printf
(
"SetCurItem(%p)
\n
"
,
aCurItem
);
#endif
m_CurrentItem
=
aCurItem
;
m_CurrentItem
=
aCurItem
;
}
}
common/base_struct.cpp
View file @
e6239e74
...
@@ -106,6 +106,7 @@ void EDA_BaseStruct::InitVars( void )
...
@@ -106,6 +106,7 @@ void EDA_BaseStruct::InitVars( void )
m_TimeStamp
=
0
;
// Time stamp used for logical links
m_TimeStamp
=
0
;
// Time stamp used for logical links
m_Status
=
0
;
m_Status
=
0
;
m_Selected
=
0
;
/* Used by block commands, and selective editing */
m_Selected
=
0
;
/* Used by block commands, and selective editing */
m_Layer
=
0
;
}
}
...
@@ -297,7 +298,6 @@ EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStruct
...
@@ -297,7 +298,6 @@ EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStruct
/*********************************************************/
/*********************************************************/
EDA_TextStruct
::
EDA_TextStruct
(
const
wxString
&
text
)
EDA_TextStruct
::
EDA_TextStruct
(
const
wxString
&
text
)
{
{
m_Layer
=
0
;
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
/* XY size of font */
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
/* XY size of font */
m_Orient
=
0
;
/* Orient in 0.1 degrees */
m_Orient
=
0
;
/* Orient in 0.1 degrees */
m_Attributs
=
0
;
m_Attributs
=
0
;
...
...
common/common.cpp
View file @
e6239e74
/**********************************************************/
/**********************************************************/
/* Routines d'affichage de parametres et caracteristiques */
/* Routines d'affichage de parametres et caracteristiques */
/**********************************************************/
/**********************************************************/
/* Fichier common.cpp */
/* Fichier common.cpp */
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -14,38 +14,42 @@
...
@@ -14,38 +14,42 @@
#include "build_version.h"
#include "build_version.h"
/*****************************/
/*****************************/
wxString
GetBuildVersion
(
void
)
wxString
GetBuildVersion
(
void
)
/*****************************/
/*****************************/
/* Return the build date
/* Return the build date
*/
*/
{
{
return
g_BuildVersion
;
return
g_BuildVersion
;
}
}
/*********************************************************************************************/
/*********************************************************************************************/
Ki_PageDescr
::
Ki_PageDescr
(
const
wxSize
&
size
,
const
wxPoint
&
offset
,
const
wxString
&
name
)
Ki_PageDescr
::
Ki_PageDescr
(
const
wxSize
&
size
,
const
wxPoint
&
offset
,
const
wxString
&
name
)
/*********************************************************************************************/
/*********************************************************************************************/
{
{
// All sizes are in 1/1000 inch
// All sizes are in 1/1000 inch
m_Size
=
size
;
m_Offset
=
offset
,
m_Name
=
name
;
m_Size
=
size
;
m_Offset
=
offset
,
m_Name
=
name
;
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
m_LeftMargin
=
m_RightMargin
=
m_TopMargin
=
m_BottomMargin
=
400
;
m_LeftMargin
=
m_RightMargin
=
m_TopMargin
=
m_BottomMargin
=
400
;
}
}
/************************************/
/************************************/
wxString
ReturnUnitSymbol
(
int
Units
)
wxString
ReturnUnitSymbol
(
int
Units
)
/************************************/
/************************************/
{
{
wxString
label
;
wxString
label
;
switch
(
Units
)
switch
(
Units
)
{
{
case
INCHES
:
case
INCHES
:
label
=
_
(
" (
\"
):"
);
label
=
_
(
" (
\"
):"
);
break
;
break
;
case
MILLIMETRE
:
case
MILLIMETRE
:
label
=
_
(
" (mm):"
);
label
=
_
(
" (mm):"
);
break
;
break
;
default
:
default
:
...
@@ -55,229 +59,268 @@ wxString label;
...
@@ -55,229 +59,268 @@ wxString label;
return
label
;
return
label
;
}
}
/**************************************************/
/**************************************************/
void
AddUnitSymbol
(
wxStaticText
&
Stext
,
int
Units
)
void
AddUnitSymbol
(
wxStaticText
&
Stext
,
int
Units
)
/**************************************************/
/**************************************************/
/* Add string " (mm):" or " ("):" to the static text Stext.
/* Add string " (mm):" or " ("):" to the static text Stext.
Used in dialog boxes for entering values depending on selected units
*
Used in dialog boxes for entering values depending on selected units
*/
*/
{
{
wxString
msg
=
Stext
.
GetLabel
()
+
ReturnUnitSymbol
(
Units
);
wxString
msg
=
Stext
.
GetLabel
()
+
ReturnUnitSymbol
(
Units
);
Stext
.
SetLabel
(
msg
);
Stext
.
SetLabel
(
msg
);
}
}
/****************************************************************************/
/****************************************************************************/
void
PutValueInLocalUnits
(
wxTextCtrl
&
TextCtr
,
int
Value
,
int
Internal_Unit
)
void
PutValueInLocalUnits
(
wxTextCtrl
&
TextCtr
,
int
Value
,
int
Internal_Unit
)
/****************************************************************************/
/****************************************************************************/
/* Convert the number Value in a string according to the internal units
/* Convert the number Value in a string according to the internal units
and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl
*
and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl
*/
*/
{
{
wxString
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
Value
,
Internal_Unit
);
wxString
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
Value
,
Internal_Unit
);
TextCtr
.
SetValue
(
msg
);
TextCtr
.
SetValue
(
msg
);
}
}
/*******************************************************************/
/*******************************************************************/
int
ReturnValueFromTextCtrl
(
const
wxTextCtrl
&
TextCtr
,
int
Internal_Unit
)
int
ReturnValueFromTextCtrl
(
const
wxTextCtrl
&
TextCtr
,
int
Internal_Unit
)
/********************************************************************/
/********************************************************************/
/* Convert the Value in the wxTextCtrl TextCtrl in an integer,
/* Convert the Value in the wxTextCtrl TextCtrl in an integer,
according to the internal units and the selected unit (g_UnitMetric)
*
according to the internal units and the selected unit (g_UnitMetric)
*/
*/
{
{
int
value
;
int
value
;
wxString
msg
=
TextCtr
.
GetValue
();
wxString
msg
=
TextCtr
.
GetValue
();
value
=
ReturnValueFromString
(
g_UnitMetric
,
msg
,
Internal_Unit
);
value
=
ReturnValueFromString
(
g_UnitMetric
,
msg
,
Internal_Unit
);
return
value
;
return
value
;
}
}
/****************************************************************************/
/****************************************************************************/
wxString
ReturnStringFromValue
(
int
Units
,
int
Value
,
int
Internal_Unit
)
wxString
ReturnStringFromValue
(
int
Units
,
int
Value
,
int
Internal_Unit
)
/****************************************************************************/
/****************************************************************************/
/* Return the string from Value, according to units (inch, mm ...) for display,
/* Return the string from Value, according to units (inch, mm ...) for display,
and the initial unit for value
*
and the initial unit for value
Unit = display units (INCH, MM ..)
*
Unit = display units (INCH, MM ..)
Value = value in Internal_Unit
*
Value = value in Internal_Unit
Internal_Unit = units per inch for Value
*
Internal_Unit = units per inch for Value
*/
*/
{
{
wxString
StringValue
;
wxString
StringValue
;
double
value_to_print
;
double
value_to_print
;
if
(
Units
>=
CENTIMETRE
)
StringValue
<<
Value
;
if
(
Units
>=
CENTIMETRE
)
StringValue
<<
Value
;
else
else
{
{
value_to_print
=
To_User_Unit
(
Units
,
Value
,
Internal_Unit
);
value_to_print
=
To_User_Unit
(
Units
,
Value
,
Internal_Unit
);
StringValue
.
Printf
(
(
Internal_Unit
>
1000
)
?
wxT
(
"%.4f"
)
:
wxT
(
"%.3f"
),
StringValue
.
Printf
(
(
Internal_Unit
>
1000
)
?
wxT
(
"%.4f"
)
:
wxT
(
"%.3f"
),
value_to_print
);
value_to_print
);
}
}
return
StringValue
;
return
StringValue
;
}
}
/****************************************************************************/
/****************************************************************************/
int
ReturnValueFromString
(
int
Units
,
const
wxString
&
TextValue
,
int
Internal_Unit
)
int
ReturnValueFromString
(
int
Units
,
const
wxString
&
TextValue
,
int
Internal_Unit
)
/****************************************************************************/
/****************************************************************************/
/* Return the string from Value, according to units (inch, mm ...) for display,
/* Return the string from Value, according to units (inch, mm ...) for display,
and the initial unit for value
*
and the initial unit for value
Unit = display units (INCH, MM ..)
*
Unit = display units (INCH, MM ..)
Value = text
*
Value = text
Internal_Unit = units per inch for computed value
*
Internal_Unit = units per inch for computed value
*/
*/
{
{
int
Value
;
int
Value
;
double
dtmp
=
0
;
double
dtmp
=
0
;
TextValue
.
ToDouble
(
&
dtmp
);
TextValue
.
ToDouble
(
&
dtmp
);
if
(
Units
>=
CENTIMETRE
)
Value
=
(
int
)
round
(
dtmp
);
if
(
Units
>=
CENTIMETRE
)
else
Value
=
From_User_Unit
(
Units
,
dtmp
,
Internal_Unit
);
Value
=
(
int
)
round
(
dtmp
);
else
Value
=
From_User_Unit
(
Units
,
dtmp
,
Internal_Unit
);
return
Value
;
return
Value
;
}
}
/******************************************************************/
/******************************************************************/
double
To_User_Unit
(
bool
is_metric
,
int
val
,
int
internal_unit_value
)
double
To_User_Unit
(
bool
is_metric
,
int
val
,
int
internal_unit_value
)
/******************************************************************/
/******************************************************************/
/* Convert in inch or mm the variable "val" given in internal units
/* Convert in inch or mm the variable "val" given in internal units
*/
*/
{
{
double
value
;
double
value
;
if
(
is_metric
)
if
(
is_metric
)
value
=
(
double
)
(
val
)
*
25.4
/
internal_unit_value
;
value
=
(
double
)
(
val
)
*
25.4
/
internal_unit_value
;
else
value
=
(
double
)
(
val
)
/
internal_unit_value
;
else
value
=
(
double
)
(
val
)
/
internal_unit_value
;
return
value
;
return
value
;
}
}
/**********************************************************************/
/**********************************************************************/
int
From_User_Unit
(
bool
is_metric
,
double
val
,
int
internal_unit_value
)
int
From_User_Unit
(
bool
is_metric
,
double
val
,
int
internal_unit_value
)
/**********************************************************************/
/**********************************************************************/
/* Return in internal units the value "val" given in inch or mm
/* Return in internal units the value "val" given in inch or mm
*/
*/
{
{
double
value
;
double
value
;
if
(
is_metric
)
value
=
val
*
internal_unit_value
/
25.4
;
if
(
is_metric
)
else
value
=
val
*
internal_unit_value
;
value
=
val
*
internal_unit_value
/
25.4
;
else
value
=
val
*
internal_unit_value
;
return
(
int
)
round
(
value
);
return
(
int
)
round
(
value
);
}
}
/**********************/
/**********************/
wxString
GenDate
(
void
)
wxString
GenDate
(
void
)
/**********************/
/**********************/
/* Return the string date "day month year" like "23 jun 2005"
/* Return the string date "day month year" like "23 jun 2005"
*/
*/
{
{
wxString
mois
[
12
]
=
static
const
wxString
mois
[
12
]
=
{
{
wxT
(
"jan"
),
wxT
(
"feb"
),
wxT
(
"mar"
),
wxT
(
"apr"
),
wxT
(
"may"
),
wxT
(
"jun"
),
wxT
(
"jan"
),
wxT
(
"feb"
),
wxT
(
"mar"
),
wxT
(
"apr"
),
wxT
(
"may"
),
wxT
(
"jun"
),
wxT
(
"jul"
),
wxT
(
"aug"
),
wxT
(
"sep"
),
wxT
(
"oct"
),
wxT
(
"nov"
),
wxT
(
"dec"
)
wxT
(
"jul"
),
wxT
(
"aug"
),
wxT
(
"sep"
),
wxT
(
"oct"
),
wxT
(
"nov"
),
wxT
(
"dec"
)
};
};
time_t
buftime
;
time_t
buftime
;
struct
tm
*
Date
;
struct
tm
*
Date
;
wxString
string_date
;
wxString
string_date
;
time
(
&
buftime
);
time
(
&
buftime
);
Date
=
gmtime
(
&
buftime
);
Date
=
gmtime
(
&
buftime
);
string_date
.
Printf
(
wxT
(
"%d %s %d"
),
Date
->
tm_mday
,
string_date
.
Printf
(
wxT
(
"%d %s %d"
),
Date
->
tm_mday
,
mois
[
Date
->
tm_mon
].
GetData
(),
mois
[
Date
->
tm_mon
].
GetData
(),
Date
->
tm_year
+
1900
);
Date
->
tm_year
+
1900
);
return
(
string_date
)
;
return
string_date
;
}
}
/***********************************/
/***********************************/
void
*
MyMalloc
(
size_t
nb_octets
)
void
*
MyMalloc
(
size_t
nb_octets
)
/***********************************/
/***********************************/
/* My memory allocation */
/* My memory allocation */
{
{
void
*
pt_mem
;
void
*
pt_mem
;
if
(
nb_octets
==
0
)
if
(
nb_octets
==
0
)
{
{
DisplayError
(
NULL
,
wxT
(
"Allocate 0 bytes !!"
)
);
DisplayError
(
NULL
,
wxT
(
"Allocate 0 bytes !!"
)
);
return
(
NULL
)
;
return
NULL
;
}
}
pt_mem
=
malloc
(
nb_octets
);
pt_mem
=
malloc
(
nb_octets
);
if
(
pt_mem
==
NULL
)
if
(
pt_mem
==
NULL
)
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
wxT
(
"Out of memory: allocation %d bytes"
),
nb_octets
);
msg
.
Printf
(
wxT
(
"Out of memory: allocation %d bytes"
),
nb_octets
);
DisplayError
(
NULL
,
msg
);
DisplayError
(
NULL
,
msg
);
}
}
return
(
pt_mem
)
;
return
pt_mem
;
}
}
/************************************/
/************************************/
void
*
MyZMalloc
(
size_t
nb_octets
)
void
*
MyZMalloc
(
size_t
nb_octets
)
/************************************/
/************************************/
/* My memory allocation, memory space is cleared
/* My memory allocation, memory space is cleared
*/
*/
{
{
void
*
pt_mem
=
MyMalloc
(
nb_octets
);
void
*
pt_mem
=
MyMalloc
(
nb_octets
);
if
(
pt_mem
)
memset
(
pt_mem
,
0
,
nb_octets
);
return
(
pt_mem
);
if
(
pt_mem
)
memset
(
pt_mem
,
0
,
nb_octets
);
return
pt_mem
;
}
}
/*******************************/
/*******************************/
void
MyFree
(
void
*
pt_mem
)
void
MyFree
(
void
*
pt_mem
)
/*******************************/
/*******************************/
{
{
if
(
pt_mem
)
free
(
pt_mem
);
if
(
pt_mem
)
free
(
pt_mem
);
}
}
/**************************************************************/
/**************************************************************/
wxString
ReturnPcbLayerName
(
int
layer_number
,
bool
is_filename
,
bool
is_gui
)
wxString
ReturnPcbLayerName
(
int
layer_number
,
bool
is_filename
,
bool
is_gui
)
/**************************************************************/
/**************************************************************/
/* Return the name of the layer number "layer_number".
/* Return the name of the layer number "layer_number".
if "is_filefame" == TRUE, the name can be used for a file name
*
if "is_filefame" == TRUE, the name can be used for a file name
(not internatinalized, no space)
*
(not internatinalized, no space)
*/
*/
{
{
wxString
layer_name
;
wxString
layer_name
;
wxString
layer_name_list
[]
=
{
static
const
wxString
layer_name_list
[]
=
{
_
(
"Copper "
),
_
(
"Inner L1 "
),
_
(
"Inner L2 "
),
_
(
"Inner L3 "
),
_
(
"Copper "
),
_
(
"Inner L1 "
),
_
(
"Inner L2 "
),
_
(
"Inner L3 "
),
_
(
"Inner L4 "
),
_
(
"Inner L5 "
),
_
(
"Inner L6 "
),
_
(
"Inner L7 "
),
_
(
"Inner L4 "
),
_
(
"Inner L5 "
),
_
(
"Inner L6 "
),
_
(
"Inner L7 "
),
_
(
"Inner L8 "
),
_
(
"Inner L9 "
),
_
(
"Inner L10"
),
_
(
"Inner L11"
),
_
(
"Inner L8 "
),
_
(
"Inner L9 "
),
_
(
"Inner L10"
),
_
(
"Inner L11"
),
_
(
"Inner L12"
),
_
(
"Inner L13"
),
_
(
"Inner L14"
),
_
(
"Component"
),
_
(
"Inner L12"
),
_
(
"Inner L13"
),
_
(
"Inner L14"
),
_
(
"Component"
),
_
(
"Adhes Cop"
),
_
(
"Adhes Cmp"
),
_
(
"SoldP Cop"
),
_
(
"SoldP Cmp"
),
_
(
"Adhes Cop"
),
_
(
"Adhes Cmp"
),
_
(
"SoldP Cop"
),
_
(
"SoldP Cmp"
),
_
(
"SilkS Cop"
),
_
(
"SilkS Cmp"
),
_
(
"Mask Cop "
),
_
(
"Mask Cmp "
),
_
(
"SilkS Cop"
),
_
(
"SilkS Cmp"
),
_
(
"Mask Cop "
),
_
(
"Mask Cmp "
),
_
(
"Drawings "
),
_
(
"Comments "
),
_
(
"Eco1 "
),
_
(
"Eco2 "
),
_
(
"Drawings "
),
_
(
"Comments "
),
_
(
"Eco1 "
),
_
(
"Eco2 "
),
_
(
"Edges Pcb"
),
_
(
"--- "
),
_
(
"--- "
),
_
(
"--- "
)
_
(
"Edges Pcb"
),
_
(
"--- "
),
_
(
"--- "
),
_
(
"--- "
)
};
};
// Same as layer_name_list, without space, not internationalized
// Same as layer_name_list, without space, not internationalized
wxString
layer_name_list_for_filename
[]
=
{
static
const
wxString
layer_name_list_for_filename
[]
=
{
wxT
(
"Copper"
),
wxT
(
"InnerL1"
),
wxT
(
"InnerL2"
),
wxT
(
"InnerL3"
),
wxT
(
"Copper"
),
wxT
(
"InnerL1"
),
wxT
(
"InnerL2"
),
wxT
(
"InnerL3"
),
wxT
(
"InnerL4"
),
wxT
(
"InnerL5"
),
wxT
(
"InnerL6"
),
wxT
(
"InnerL7"
),
wxT
(
"InnerL4"
),
wxT
(
"InnerL5"
),
wxT
(
"InnerL6"
),
wxT
(
"InnerL7"
),
wxT
(
"InnerL8"
),
wxT
(
"InnerL9"
),
wxT
(
"InnerL10"
),
wxT
(
"InnerL11"
),
wxT
(
"InnerL8"
),
wxT
(
"InnerL9"
),
wxT
(
"InnerL10"
),
wxT
(
"InnerL11"
),
wxT
(
"InnerL12"
),
wxT
(
"InnerL13"
),
wxT
(
"InnerL14"
),
wxT
(
"Component"
),
wxT
(
"InnerL12"
),
wxT
(
"InnerL13"
),
wxT
(
"InnerL14"
),
wxT
(
"Component"
),
wxT
(
"AdhesCop"
),
wxT
(
"AdhesCmp"
),
wxT
(
"SoldPCop"
),
wxT
(
"SoldPCmp"
),
wxT
(
"AdhesCop"
),
wxT
(
"AdhesCmp"
),
wxT
(
"SoldPCop"
),
wxT
(
"SoldPCmp"
),
wxT
(
"SilkSCop"
),
wxT
(
"SilkSCmp"
),
wxT
(
"MaskCop"
),
wxT
(
"MaskCmp"
),
wxT
(
"SilkSCop"
),
wxT
(
"SilkSCmp"
),
wxT
(
"MaskCop"
),
wxT
(
"MaskCmp"
),
wxT
(
"Drawings"
),
wxT
(
"Comments"
),
wxT
(
"Eco1"
),
wxT
(
"Eco2"
),
wxT
(
"Drawings"
),
wxT
(
"Comments"
),
wxT
(
"Eco1"
),
wxT
(
"Eco2"
),
wxT
(
"EdgesPcb"
),
wxT
(
"---"
),
wxT
(
"---"
),
wxT
(
"---"
)
wxT
(
"EdgesPcb"
),
wxT
(
"---"
),
wxT
(
"---"
),
wxT
(
"---"
)
};
};
if
(
layer_number
>=
31
)
layer_number
=
31
;
if
(
layer_number
>=
31
)
if
(
is_filename
)
layer_name
=
layer_name_list_for_filename
[
layer_number
];
layer_number
=
31
;
else
layer_name
=
layer_name_list
[
layer_number
];
if
(
is_filename
)
if
(
is_gui
){
layer_name
=
layer_name_list_for_filename
[
layer_number
];
wxString
hotkey_list
[]
=
{
else
wxT
(
"(PgDn)"
),
wxT
(
"(F5)"
),
wxT
(
"(F6)"
),
wxT
(
"(F7)"
),
layer_name
=
layer_name_list
[
layer_number
];
wxT
(
"(F8)"
),
wxT
(
"(F9)"
),
wxT
(
"(F10)"
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
if
(
is_gui
)
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" (PgUp)"
),
{
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
static
const
wxString
hotkey_list
[]
=
{
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
"(PgDn)"
),
wxT
(
"(F5)"
),
wxT
(
"(F6)"
),
wxT
(
"(F7)"
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
"(F8)"
),
wxT
(
"(F9)"
),
wxT
(
"(F10)"
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
)
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" (PgUp)"
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
),
wxT
(
" "
)
};
};
layer_name
+=
wxT
(
" "
)
+
hotkey_list
[
layer_number
];
layer_name
+=
wxT
(
" "
)
+
hotkey_list
[
layer_number
];
}
}
return
layer_name
;
return
layer_name
;
}
}
...
@@ -285,131 +328,140 @@ enum textbox {
...
@@ -285,131 +328,140 @@ enum textbox {
ID_TEXTBOX_LIST
=
8010
ID_TEXTBOX_LIST
=
8010
};
};
BEGIN_EVENT_TABLE
(
WinEDA_TextFrame
,
wxDialog
)
BEGIN_EVENT_TABLE
(
WinEDA_TextFrame
,
wxDialog
)
EVT_LISTBOX_DCLICK
(
ID_TEXTBOX_LIST
,
WinEDA_TextFrame
::
D_ClickOnList
)
EVT_LISTBOX_DCLICK
(
ID_TEXTBOX_LIST
,
WinEDA_TextFrame
::
D_ClickOnList
)
EVT_LISTBOX
(
ID_TEXTBOX_LIST
,
WinEDA_TextFrame
::
D_ClickOnList
)
EVT_LISTBOX
(
ID_TEXTBOX_LIST
,
WinEDA_TextFrame
::
D_ClickOnList
)
EVT_CLOSE
(
WinEDA_TextFrame
::
OnClose
)
EVT_CLOSE
(
WinEDA_TextFrame
::
OnClose
)
END_EVENT_TABLE
()
END_EVENT_TABLE
()
/***************************************************************************/
/***************************************************************************/
WinEDA_TextFrame
::
WinEDA_TextFrame
(
wxWindow
*
parent
,
const
wxString
&
title
)
:
WinEDA_TextFrame
::
WinEDA_TextFrame
(
wxWindow
*
parent
,
const
wxString
&
title
)
:
wxDialog
(
parent
,
-
1
,
title
,
wxPoint
(
-
1
,
-
1
),
wxSize
(
250
,
350
),
wxDialog
(
parent
,
-
1
,
title
,
wxPoint
(
-
1
,
-
1
),
wxSize
(
250
,
350
),
wxDEFAULT_DIALOG_STYLE
|
wxFRAME_FLOAT_ON_PARENT
)
wxDEFAULT_DIALOG_STYLE
|
wxFRAME_FLOAT_ON_PARENT
)
/***************************************************************************/
/***************************************************************************/
{
{
wxSize
size
;
wxSize
size
;
m_Parent
=
parent
;
m_Parent
=
parent
;
CentreOnParent
();
CentreOnParent
();
size
=
GetClientSize
();
size
=
GetClientSize
();
m_List
=
new
wxListBox
(
this
,
ID_TEXTBOX_LIST
,
m_List
=
new
wxListBox
(
this
,
ID_TEXTBOX_LIST
,
wxPoint
(
0
,
0
),
size
,
wxPoint
(
0
,
0
),
size
,
0
,
NULL
,
0
,
NULL
,
wxLB_ALWAYS_SB
|
wxLB_SINGLE
);
wxLB_ALWAYS_SB
|
wxLB_SINGLE
);
m_List
->
SetBackgroundColour
(
wxColour
(
200
,
255
,
255
));
SetReturnCode
(
-
1
);
m_List
->
SetBackgroundColour
(
wxColour
(
200
,
255
,
255
)
);
SetReturnCode
(
-
1
);
}
}
/***************************************************/
/***************************************************/
void
WinEDA_TextFrame
::
Append
(
const
wxString
&
text
)
void
WinEDA_TextFrame
::
Append
(
const
wxString
&
text
)
/***************************************************/
/***************************************************/
{
{
m_List
->
Append
(
text
);
m_List
->
Append
(
text
);
}
}
/**********************************************************/
/**********************************************************/
void
WinEDA_TextFrame
::
D_ClickOnList
(
wxCommandEvent
&
event
)
void
WinEDA_TextFrame
::
D_ClickOnList
(
wxCommandEvent
&
event
)
/**********************************************************/
/**********************************************************/
{
{
int
ii
=
m_List
->
GetSelection
();
int
ii
=
m_List
->
GetSelection
();
EndModal
(
ii
);
EndModal
(
ii
);
}
}
/*************************************************/
/*************************************************/
void
WinEDA_TextFrame
::
OnClose
(
wxCloseEvent
&
event
)
void
WinEDA_TextFrame
::
OnClose
(
wxCloseEvent
&
event
)
/*************************************************/
/*************************************************/
{
{
EndModal
(
-
1
);
EndModal
(
-
1
);
}
}
/*****************************************************************************/
/*****************************************************************************/
void
Affiche_1_Parametre
(
WinEDA_DrawFrame
*
frame
,
int
pos_X
,
void
Affiche_1_Parametre
(
WinEDA_DrawFrame
*
frame
,
int
pos_X
,
const
wxString
&
texte_H
,
const
wxString
&
texte_L
,
int
color
)
const
wxString
&
texte_H
,
const
wxString
&
texte_L
,
int
color
)
/*****************************************************************************/
/*****************************************************************************/
/*
/*
Routine d'affichage d'un parametre.
*
Routine d'affichage d'un parametre.
pos_X = cadrage horizontal
*
pos_X = cadrage horizontal
si pos_X < 0 : la position horizontale est la derniere
*
si pos_X < 0 : la position horizontale est la derniere
valeur demandee >= 0
*
valeur demandee >= 0
texte_H = texte a afficher en ligne superieure.
*
texte_H = texte a afficher en ligne superieure.
si "", par d'affichage sur cette ligne
*
si "", par d'affichage sur cette ligne
texte_L = texte a afficher en ligne inferieure.
*
texte_L = texte a afficher en ligne inferieure.
si "", par d'affichage sur cette ligne
*
si "", par d'affichage sur cette ligne
color = couleur d'affichage
*
color = couleur d'affichage
*/
*/
{
{
frame
->
MsgPanel
->
Affiche_1_Parametre
(
pos_X
,
texte_H
,
texte_L
,
color
);
frame
->
MsgPanel
->
Affiche_1_Parametre
(
pos_X
,
texte_H
,
texte_L
,
color
);
}
}
/****************************************************************************/
/****************************************************************************/
void
AfficheDoc
(
WinEDA_DrawFrame
*
frame
,
const
wxString
&
Doc
,
const
wxString
&
KeyW
)
void
AfficheDoc
(
WinEDA_DrawFrame
*
frame
,
const
wxString
&
Doc
,
const
wxString
&
KeyW
)
/****************************************************************************/
/****************************************************************************/
/*
/*
Routine d'affichage de la documentation associee a un composant
*
Routine d'affichage de la documentation associee a un composant
*/
*/
{
{
wxString
Line1
(
wxT
(
"Doc: "
)),
Line2
(
wxT
(
"KeyW: "
));
wxString
Line1
(
wxT
(
"Doc: "
)
),
Line2
(
wxT
(
"KeyW: "
)
);
int
color
=
BLUE
;
if
(
frame
&&
frame
->
MsgPanel
)
int
color
=
BLUE
;
if
(
frame
&&
frame
->
MsgPanel
)
{
{
frame
->
MsgPanel
->
EraseMsgBox
();
frame
->
MsgPanel
->
EraseMsgBox
();
Line1
+=
Doc
;
Line1
+=
Doc
;
Line2
+=
KeyW
;
Line2
+=
KeyW
;
frame
->
MsgPanel
->
Affiche_1_Parametre
(
10
,
Line1
,
Line2
,
color
);
frame
->
MsgPanel
->
Affiche_1_Parametre
(
10
,
Line1
,
Line2
,
color
);
}
}
}
}
/***********************/
/***********************/
int
GetTimeStamp
(
void
)
int
GetTimeStamp
(
void
)
/***********************/
/***********************/
/*
/*
Retourne une identification temporelle (Time stamp) differente a chaque appel
*
Retourne une identification temporelle (Time stamp) differente a chaque appel
*/
*/
{
{
static
int
OldTimeStamp
,
NewTimeStamp
;
static
int
OldTimeStamp
,
NewTimeStamp
;
NewTimeStamp
=
time
(
NULL
);
NewTimeStamp
=
time
(
NULL
);
if
(
NewTimeStamp
<=
OldTimeStamp
)
NewTimeStamp
=
OldTimeStamp
+
1
;
if
(
NewTimeStamp
<=
OldTimeStamp
)
NewTimeStamp
=
OldTimeStamp
+
1
;
OldTimeStamp
=
NewTimeStamp
;
OldTimeStamp
=
NewTimeStamp
;
return
(
NewTimeStamp
)
;
return
NewTimeStamp
;
}
}
/*************************************************/
/*************************************************/
void
valeur_param
(
int
valeur
,
wxString
&
buf_texte
)
void
valeur_param
(
int
valeur
,
wxString
&
buf_texte
)
/*************************************************/
/*************************************************/
/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
entree : valeur en mils , buffer de texte
*
entree : valeur en mils , buffer de texte
retourne en buffer : texte : valeur exprimee en pouces ou millimetres
*
retourne en buffer : texte : valeur exprimee en pouces ou millimetres
suivie de " ou mm
*
suivie de " ou mm
*/
*/
{
{
if
(
g_UnitMetric
)
if
(
g_UnitMetric
)
{
{
buf_texte
.
Printf
(
wxT
(
"%3.3f "
),(
float
)
valeur
*
0.00254
);
buf_texte
.
Printf
(
wxT
(
"%3.3f "
),
(
float
)
valeur
*
0.00254
);
buf_texte
<<
wxT
(
"mm"
)
;
buf_texte
<<
wxT
(
"mm"
)
;
}
}
else
else
{
{
buf_texte
.
Printf
(
wxT
(
"%2.4f "
),(
float
)
valeur
*
0.0001
);
buf_texte
.
Printf
(
wxT
(
"%2.4f "
),
(
float
)
valeur
*
0.0001
);
buf_texte
<<
wxT
(
"
\"
"
);
buf_texte
<<
wxT
(
"
\"
"
);
}
}
}
}
eeschema/class_screen.h
View file @
e6239e74
...
@@ -141,7 +141,6 @@ public:
...
@@ -141,7 +141,6 @@ public:
int
m_FileNameSize
;
int
m_FileNameSize
;
wxPoint
m_Pos
;
wxPoint
m_Pos
;
wxSize
m_Size
;
/* Position and Size of sheet symbol */
wxSize
m_Size
;
/* Position and Size of sheet symbol */
int
m_Layer
;
DrawSheetLabelStruct
*
m_Label
;
/* Points de connection */
DrawSheetLabelStruct
*
m_Label
;
/* Points de connection */
int
m_NbLabel
;
/* Nombre de points de connexion */
int
m_NbLabel
;
/* Nombre de points de connexion */
...
...
eeschema/program.h
View file @
e6239e74
...
@@ -106,7 +106,6 @@ class DrawBusEntryStruct: public EDA_BaseStruct /* Struct de descr 1 raccord
...
@@ -106,7 +106,6 @@ class DrawBusEntryStruct: public EDA_BaseStruct /* Struct de descr 1 raccord
a 45 degres de BUS ou WIRE */
a 45 degres de BUS ou WIRE */
{
{
public
:
public
:
int
m_Layer
;
int
m_Width
;
int
m_Width
;
wxPoint
m_Pos
;
wxPoint
m_Pos
;
wxSize
m_Size
;
wxSize
m_Size
;
...
@@ -122,7 +121,6 @@ public:
...
@@ -122,7 +121,6 @@ public:
class
DrawPolylineStruct
:
public
EDA_BaseStruct
/* Polyligne (serie de segments) */
class
DrawPolylineStruct
:
public
EDA_BaseStruct
/* Polyligne (serie de segments) */
{
{
public
:
public
:
int
m_Layer
;
int
m_Width
;
int
m_Width
;
int
m_NumOfPoints
;
/* Number of XY pairs in Points array. */
int
m_NumOfPoints
;
/* Number of XY pairs in Points array. */
int
*
m_Points
;
/* XY pairs that forms the polyline. */
int
*
m_Points
;
/* XY pairs that forms the polyline. */
...
@@ -137,7 +135,6 @@ public:
...
@@ -137,7 +135,6 @@ public:
class
DrawJunctionStruct
:
public
EDA_BaseStruct
class
DrawJunctionStruct
:
public
EDA_BaseStruct
{
{
public
:
public
:
int
m_Layer
;
wxPoint
m_Pos
;
/* XY coordinates of connection. */
wxPoint
m_Pos
;
/* XY coordinates of connection. */
public
:
public
:
...
...
include/base_struct.h
View file @
e6239e74
...
@@ -154,6 +154,7 @@ public:
...
@@ -154,6 +154,7 @@ public:
unsigned
long
m_TimeStamp
;
// Time stamp used for logical links
unsigned
long
m_TimeStamp
;
// Time stamp used for logical links
int
m_Selected
;
/* Used by block commands, and selective editing */
int
m_Selected
;
/* Used by block commands, and selective editing */
int
m_Layer
;
///< used by many derived classes, so make common
private
:
private
:
int
m_Status
;
int
m_Status
;
...
@@ -347,7 +348,6 @@ class EDA_TextStruct
...
@@ -347,7 +348,6 @@ class EDA_TextStruct
{
{
public
:
public
:
wxString
m_Text
;
/* text! */
wxString
m_Text
;
/* text! */
int
m_Layer
;
/* couche d'appartenance */
wxPoint
m_Pos
;
/* XY position of anchor text. */
wxPoint
m_Pos
;
/* XY position of anchor text. */
wxSize
m_Size
;
/* XY size of text */
wxSize
m_Size
;
/* XY size of text */
int
m_Width
;
/* epaisseur du trait */
int
m_Width
;
/* epaisseur du trait */
...
@@ -389,7 +389,6 @@ public:
...
@@ -389,7 +389,6 @@ public:
class
EDA_BaseLineStruct
:
public
EDA_BaseStruct
class
EDA_BaseLineStruct
:
public
EDA_BaseStruct
{
{
public
:
public
:
int
m_Layer
;
// Layer number
int
m_Width
;
// 0 = line, > 0 = tracks, bus ...
int
m_Width
;
// 0 = line, > 0 = tracks, bus ...
wxPoint
m_Start
;
// Line start point
wxPoint
m_Start
;
// Line start point
wxPoint
m_End
;
// Line end point
wxPoint
m_End
;
// Line end point
...
...
include/pcbstruct.h
View file @
e6239e74
...
@@ -276,7 +276,7 @@ public:
...
@@ -276,7 +276,7 @@ public:
/**
/**
* Function FindNet
* Function FindNet
* searches for a net with the given netcode.
* searches for a net with the given netcode.
* @param anetcode
The
netcode to search for.
* @param anetcode
A
netcode to search for.
* @return EQUIPOT* - the net or NULL if not found.
* @return EQUIPOT* - the net or NULL if not found.
*/
*/
EQUIPOT
*
FindNet
(
int
anetcode
);
EQUIPOT
*
FindNet
(
int
anetcode
);
...
...
kicad/buildmnu.cpp
View file @
e6239e74
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include "New_Project.xpm"
#include "New_Project.xpm"
#include "Open_Project.xpm"
#include "Open_Project.xpm"
#include "../bitmaps/icon_python.xpm"
#include "../bitmaps/icon_python.xpm"
#include "../bitmaps/
r
eload.xpm"
#include "../bitmaps/
R
eload.xpm"
#include "id.h"
#include "id.h"
...
...
pcbnew/class_cotation.h
View file @
e6239e74
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
class
COTATION
:
public
EDA_BaseStruct
class
COTATION
:
public
EDA_BaseStruct
{
{
public
:
public
:
int
m_Layer
;
// 0.. 32 ( NON bit a bit)
int
m_Width
;
int
m_Width
;
wxPoint
m_Pos
;
wxPoint
m_Pos
;
int
m_Shape
;
int
m_Shape
;
...
...
pcbnew/class_mire.h
View file @
e6239e74
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
class
MIREPCB
:
public
EDA_BaseStruct
class
MIREPCB
:
public
EDA_BaseStruct
{
{
public
:
public
:
int
m_Layer
;
// 0.. 32 ( NON bit a bit)
int
m_Width
;
int
m_Width
;
wxPoint
m_Pos
;
wxPoint
m_Pos
;
int
m_Shape
;
// bit 0 : 0 = forme +, 1 = forme X
int
m_Shape
;
// bit 0 : 0 = forme +, 1 = forme X
...
...
pcbnew/class_module.h
View file @
e6239e74
...
@@ -38,7 +38,6 @@ enum Mod_Attribut /* Attributs d'un module */
...
@@ -38,7 +38,6 @@ enum Mod_Attribut /* Attributs d'un module */
class
MODULE
:
public
EDA_BaseStruct
class
MODULE
:
public
EDA_BaseStruct
{
{
public
:
public
:
int
m_Layer
;
// layer number
wxPoint
m_Pos
;
// Real coord on board
wxPoint
m_Pos
;
// Real coord on board
D_PAD
*
m_Pads
;
/* Pad list (linked list) */
D_PAD
*
m_Pads
;
/* Pad list (linked list) */
EDA_BaseStruct
*
m_Drawings
;
/* Graphic items list (linked list) */
EDA_BaseStruct
*
m_Drawings
;
/* Graphic items list (linked list) */
...
...
pcbnew/class_pcb_text.h
View file @
e6239e74
...
@@ -37,6 +37,18 @@ public:
...
@@ -37,6 +37,18 @@ public:
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool
HitTest
(
const
wxPoint
&
refPos
)
{
return
EDA_TextStruct
::
HitTest
(
refPos
);
}
#if defined(DEBUG)
#if defined(DEBUG)
/**
/**
* Function GetClass
* Function GetClass
...
...
pcbnew/class_text_mod.h
View file @
e6239e74
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
class
TEXTE_MODULE
:
public
EDA_BaseStruct
class
TEXTE_MODULE
:
public
EDA_BaseStruct
{
{
public
:
public
:
int
m_Layer
;
// layer number
int
m_Width
;
int
m_Width
;
wxPoint
m_Pos
;
// Real coord
wxPoint
m_Pos
;
// Real coord
wxPoint
m_Pos0
;
// coord du debut du texte /ancre, orient 0
wxPoint
m_Pos0
;
// coord du debut du texte /ancre, orient 0
...
...
pcbnew/locate.cpp
View file @
e6239e74
...
@@ -483,16 +483,18 @@ D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
...
@@ -483,16 +483,18 @@ D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
}
}
/********************************************************/
/**
MODULE
*
Locate_Prefered_Module
(
BOARD
*
Pcb
,
int
typeloc
)
* Function Locate_Prefered_Module
/********************************************************/
* locates a footprint by its bounding rectangle. If several footprints
* are possible, then the priority is: on the active layer, then smallest.
/*
* The current mouse or cursor coordinates are grabbed from the active window
* localisation d'une empreinte par son rectangle d'encadrement
* to performe hit-testing.
* Si plusieurs empreintes sont possibles, la priorite est:
*
* - sur la couche active
* @param Pcb The BOARD to search within.
* - la plus petite
* @param typeloc Flag bits, tuning the search, see pcbnew.h
* @return MODULE* - the best module or NULL if none.
*/
*/
MODULE
*
Locate_Prefered_Module
(
BOARD
*
Pcb
,
int
typeloc
)
{
{
MODULE
*
pt_module
;
MODULE
*
pt_module
;
int
lx
,
ly
;
/* dimensions du rectangle d'encadrement du module */
int
lx
,
ly
;
/* dimensions du rectangle d'encadrement du module */
...
@@ -898,10 +900,7 @@ TEXTE_PCB* Locate_Texte_Pcb( EDA_BaseStruct* PtStruct, int LayerSearch, int type
...
@@ -898,10 +900,7 @@ TEXTE_PCB* Locate_Texte_Pcb( EDA_BaseStruct* PtStruct, int LayerSearch, int type
if
(
pt_txt_pcb
->
m_Layer
==
LayerSearch
)
if
(
pt_txt_pcb
->
m_Layer
==
LayerSearch
)
{
{
// because HitTest() is present in both base classes of TEXTE_PCB
if
(
pt_txt_pcb
->
HitTest
(
ref
)
)
// use a clarifying cast to tell compiler which HitTest()
// to call.
if
(
static_cast
<
EDA_TextStruct
*>
(
pt_txt_pcb
)
->
HitTest
(
ref
)
)
{
{
return
pt_txt_pcb
;
return
pt_txt_pcb
;
}
}
...
...
pcbnew/onrightclick.cpp
View file @
e6239e74
...
@@ -202,6 +202,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
...
@@ -202,6 +202,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST
,
_
(
"Get and Move Footprint"
),
Move_Module_xpm
);
_
(
"Get and Move Footprint"
),
Move_Module_xpm
);
}
}
if
(
DrawStruct
)
if
(
DrawStruct
)
{
{
switch
(
DrawStruct
->
m_StructType
)
switch
(
DrawStruct
->
m_StructType
)
...
...
pcbnew/pcbframe.cpp
View file @
e6239e74
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
#include "id.h"
#include "id.h"
#if defined(DEBUG)
#if defined(DEBUG)
#include
<class_collector.h>
#include
"class_collector.h"
#endif
#endif
...
@@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, wxFrame )
...
@@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, wxFrame )
EVT_MENU
(
ID_CONFIG_REQ
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_CONFIG_REQ
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_COLORS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_COLORS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_OPTIONS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_OPTIONS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PREFERENCES_CREATE_CONFIG_HOTKEYS
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PREFERENCES_CREATE_CONFIG_HOTKEYS
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PREFERENCES_READ_CONFIG_HOTKEYS
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PREFERENCES_READ_CONFIG_HOTKEYS
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_TRACK_SIZE_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_TRACK_SIZE_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_DRAWINGS_WIDTHS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_DRAWINGS_WIDTHS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_PAD_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_PAD_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
...
@@ -172,11 +172,77 @@ END_EVENT_TABLE()
...
@@ -172,11 +172,77 @@ END_EVENT_TABLE()
#if defined(DEBUG)
#if defined(DEBUG)
class
RAT1COLLECTOR
:
public
COLLECTOR
class
RAT1COLLECTOR
:
public
COLLECTOR
{
{
;
};
};
class
ARROWCOLLECTOR
:
public
COLLECTOR
class
ARROWCOLLECTOR
:
public
COLLECTOR
{
{
const
KICAD_T
*
m_ScanTypes
;
/**
* A place to hold collected objects which don't match precisely the search
* criteria, but would be acceptable if nothing else is found.
* "2nd" choice, which will be appended to the end of COLLECTOR's prime
* "list" at the end of the search.
*/
std
::
vector
<
EDA_BaseStruct
*>
list2nd
;
public
:
ARROWCOLLECTOR
()
:
COLLECTOR
(
0
),
m_ScanTypes
(
0
)
{
}
~
ARROWCOLLECTOR
()
{
// empty list2nd so that ~list2nd() does not try and delete all
// the objects that it holds, it is not the owner of such objects
// and this prevents a double free()ing.
Empty2nd
();
}
void
Empty2nd
()
{
list2nd
.
clear
();
}
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function. It is used primarily for searching, but not limited to
* that. It can also collect or modify the scanned objects.
*
* @param testItem An EDA_BaseStruct to examine.
* @param testData is arbitrary data needed by the inspector to determine
* if the EDA_BaseStruct under test meets its match criteria.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT
Inspect
(
EDA_BaseStruct
*
testItem
,
const
void
*
testData
)
{
const
wxPoint
&
refPos
=
*
(
const
wxPoint
*
)
testData
;
switch
(
testItem
->
m_StructType
)
{
case
TYPEMODULE
:
if
(
testItem
->
HitTest
(
refPos
)
)
Append
(
testItem
);
break
;
}
return
SEARCH_CONTINUE
;
}
void
SetScanTypes
(
const
KICAD_T
*
scanTypes
)
{
m_ScanTypes
=
scanTypes
;
}
};
};
#endif
#endif
...
...
share/drawpanel.cpp
View file @
e6239e74
...
@@ -20,40 +20,40 @@
...
@@ -20,40 +20,40 @@
// table des evenements captes par un WinEDA_DrawPanel
// table des evenements captes par un WinEDA_DrawPanel
BEGIN_EVENT_TABLE
(
WinEDA_DrawPanel
,
EDA_DRAW_PANEL
)
BEGIN_EVENT_TABLE
(
WinEDA_DrawPanel
,
EDA_DRAW_PANEL
)
EVT_LEAVE_WINDOW
(
WinEDA_DrawPanel
::
OnMouseLeaving
)
EVT_LEAVE_WINDOW
(
WinEDA_DrawPanel
::
OnMouseLeaving
)
EVT_MOUSE_EVENTS
(
WinEDA_DrawPanel
::
OnMouseEvent
)
EVT_MOUSE_EVENTS
(
WinEDA_DrawPanel
::
OnMouseEvent
)
EVT_CHAR
(
WinEDA_DrawPanel
::
OnKeyEvent
)
EVT_CHAR
(
WinEDA_DrawPanel
::
OnKeyEvent
)
EVT_CHAR_HOOK
(
WinEDA_DrawPanel
::
OnKeyEvent
)
EVT_CHAR_HOOK
(
WinEDA_DrawPanel
::
OnKeyEvent
)
EVT_PAINT
(
WinEDA_DrawPanel
::
OnPaint
)
EVT_PAINT
(
WinEDA_DrawPanel
::
OnPaint
)
EVT_SIZE
(
WinEDA_DrawPanel
::
OnSize
)
EVT_SIZE
(
WinEDA_DrawPanel
::
OnSize
)
EVT_ERASE_BACKGROUND
(
WinEDA_DrawPanel
::
OnEraseBackground
)
EVT_ERASE_BACKGROUND
(
WinEDA_DrawPanel
::
OnEraseBackground
)
EVT_SCROLLWIN
(
WinEDA_DrawPanel
::
OnScroll
)
EVT_SCROLLWIN
(
WinEDA_DrawPanel
::
OnScroll
)
EVT_ACTIVATE
(
WinEDA_DrawPanel
::
OnActivate
)
EVT_ACTIVATE
(
WinEDA_DrawPanel
::
OnActivate
)
EVT_MENU_RANGE
(
ID_POPUP_ZOOM_START_RANGE
,
ID_POPUP_ZOOM_END_RANGE
,
EVT_MENU_RANGE
(
ID_POPUP_ZOOM_START_RANGE
,
ID_POPUP_ZOOM_END_RANGE
,
WinEDA_DrawPanel
::
Process_Popup_Zoom
)
WinEDA_DrawPanel
::
Process_Popup_Zoom
)
END_EVENT_TABLE
()
END_EVENT_TABLE
()
/***********************************************************/
/***********************************************************/
/* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */
/* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */
/***********************************************************/
/***********************************************************/
WinEDA_DrawPanel
::
WinEDA_DrawPanel
(
WinEDA_DrawFrame
*
parent
,
int
id
,
WinEDA_DrawPanel
::
WinEDA_DrawPanel
(
WinEDA_DrawFrame
*
parent
,
int
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
)
:
const
wxPoint
&
pos
,
const
wxSize
&
size
)
:
EDA_DRAW_PANEL
(
parent
,
id
,
pos
,
size
,
EDA_DRAW_PANEL
(
parent
,
id
,
pos
,
size
,
wxBORDER
|
wxNO_FULL_REPAINT_ON_RESIZE
)
wxBORDER
|
wxNO_FULL_REPAINT_ON_RESIZE
)
{
{
m_Parent
=
parent
;
m_Parent
=
parent
;
m_Ident
=
m_Parent
->
m_Ident
;
m_Ident
=
m_Parent
->
m_Ident
;
m_Scroll_unit
=
1
;
m_Scroll_unit
=
1
;
m_ScrollButt_unit
=
40
;
m_ScrollButt_unit
=
40
;
SetBackgroundColour
(
wxColour
(
ColorRefs
[
g_DrawBgColor
].
m_Red
,
SetBackgroundColour
(
wxColour
(
ColorRefs
[
g_DrawBgColor
].
m_Red
,
ColorRefs
[
g_DrawBgColor
].
m_Green
,
ColorRefs
[
g_DrawBgColor
].
m_Green
,
ColorRefs
[
g_DrawBgColor
].
m_Blue
)
);
ColorRefs
[
g_DrawBgColor
].
m_Blue
)
);
EnableScrolling
(
TRUE
,
TRUE
);
EnableScrolling
(
TRUE
,
TRUE
);
m_ClipBox
.
SetSize
(
size
);
m_ClipBox
.
SetSize
(
size
);
m_ClipBox
.
SetX
(
0
);
m_ClipBox
.
SetX
(
0
);
m_ClipBox
.
SetY
(
0
);
m_ClipBox
.
SetY
(
0
);
m_CanStartBlock
=
-
1
;
// Command block can start if >= 0
m_CanStartBlock
=
-
1
;
// Command block can start if >= 0
m_AbortEnable
=
m_AbortRequest
=
FALSE
;
m_AbortEnable
=
m_AbortRequest
=
FALSE
;
m_AutoPAN_Enable
=
TRUE
;
m_AutoPAN_Enable
=
TRUE
;
...
@@ -62,8 +62,8 @@ WinEDA_DrawPanel::WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id,
...
@@ -62,8 +62,8 @@ WinEDA_DrawPanel::WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id,
ManageCurseur
=
NULL
;
ManageCurseur
=
NULL
;
ForceCloseManageCurseur
=
NULL
;
ForceCloseManageCurseur
=
NULL
;
if
(
m_Parent
->
m_Parent
->
m_EDA_Config
)
if
(
m_Parent
->
m_Parent
->
m_EDA_Config
)
m_AutoPAN_Enable
=
m_Parent
->
m_Parent
->
m_EDA_Config
->
Read
(
wxT
(
"AutoPAN"
),
TRUE
);
m_AutoPAN_Enable
=
m_Parent
->
m_Parent
->
m_EDA_Config
->
Read
(
wxT
(
"AutoPAN"
),
TRUE
);
m_AutoPAN_Request
=
FALSE
;
m_AutoPAN_Request
=
FALSE
;
m_Block_Enable
=
FALSE
;
m_Block_Enable
=
FALSE
;
m_PanelDefaultCursor
=
m_PanelCursor
=
wxCURSOR_ARROW
;
m_PanelDefaultCursor
=
m_PanelCursor
=
wxCURSOR_ARROW
;
...
@@ -72,71 +72,78 @@ WinEDA_DrawPanel::WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id,
...
@@ -72,71 +72,78 @@ WinEDA_DrawPanel::WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id,
/*********************************************************************************/
/*********************************************************************************/
void
WinEDA_DrawPanel
::
Trace_Curseur
(
wxDC
*
DC
,
int
color
)
void
WinEDA_DrawPanel
::
Trace_Curseur
(
wxDC
*
DC
,
int
color
)
/*********************************************************************************/
/*********************************************************************************/
/*
/*
Trace Le curseur sur la zone PCB , se deplacant sur la grille
*
Trace Le curseur sur la zone PCB , se deplacant sur la grille
*/
*/
{
{
if
(
m_CursorLevel
!=
0
)
{
if
(
m_CursorLevel
!=
0
)
{
return
;
return
;
}
}
wxPoint
Cursor
=
GetScreen
()
->
m_Curseur
;
wxPoint
Cursor
=
GetScreen
()
->
m_Curseur
;
if
(
DC
==
NULL
)
return
;
if
(
DC
==
NULL
)
return
;
GRSetDrawMode
(
DC
,
GR_XOR
);
GRSetDrawMode
(
DC
,
GR_XOR
);
if
(
g_CursorShape
==
1
)
/* Trace d'un reticule */
if
(
g_CursorShape
==
1
)
/* Trace d'un reticule */
{
{
int
dx
=
m_ClipBox
.
GetWidth
()
*
GetZoom
();
int
dx
=
m_ClipBox
.
GetWidth
()
*
GetZoom
();
int
dy
=
m_ClipBox
.
GetHeight
()
*
GetZoom
();
GRLine
(
&
m_ClipBox
,
DC
,
Cursor
.
x
-
dx
,
Cursor
.
y
,
Cursor
.
x
+
dx
,
Cursor
.
y
,
0
,
color
);
// axe Y
GRLine
(
&
m_ClipBox
,
DC
,
Cursor
.
x
,
Cursor
.
y
-
dx
,
Cursor
.
x
,
Cursor
.
y
+
dy
,
0
,
color
);
// axe X
}
int
dy
=
m_ClipBox
.
GetHeight
()
*
GetZoom
();
GRLine
(
&
m_ClipBox
,
DC
,
Cursor
.
x
-
dx
,
Cursor
.
y
,
Cursor
.
x
+
dx
,
Cursor
.
y
,
0
,
color
);
// axe Y
GRLine
(
&
m_ClipBox
,
DC
,
Cursor
.
x
,
Cursor
.
y
-
dx
,
Cursor
.
x
,
Cursor
.
y
+
dy
,
0
,
color
);
// axe X
}
else
else
{
{
int
len
=
CURSOR_SIZE
*
GetZoom
();
int
len
=
CURSOR_SIZE
*
GetZoom
();
GRLine
(
&
m_ClipBox
,
DC
,
Cursor
.
x
-
len
,
Cursor
.
y
,
Cursor
.
x
+
len
,
Cursor
.
y
,
0
,
color
);
GRLine
(
&
m_ClipBox
,
DC
,
Cursor
.
x
-
len
,
Cursor
.
y
,
GRLine
(
&
m_ClipBox
,
DC
,
Cursor
.
x
,
Cursor
.
y
-
len
,
Cursor
.
x
+
len
,
Cursor
.
y
,
0
,
color
);
Cursor
.
x
,
Cursor
.
y
+
len
,
0
,
color
);
GRLine
(
&
m_ClipBox
,
DC
,
Cursor
.
x
,
Cursor
.
y
-
len
,
Cursor
.
x
,
Cursor
.
y
+
len
,
0
,
color
);
}
}
}
}
/*******************************************************************/
/*******************************************************************/
void
WinEDA_DrawPanel
::
CursorOff
(
wxDC
*
DC
)
void
WinEDA_DrawPanel
::
CursorOff
(
wxDC
*
DC
)
/*******************************************************************/
/*******************************************************************/
/*
/*
Remove the grid cursor from the display in preparation for other drawing operations
*
Remove the grid cursor from the display in preparation for other drawing operations
*/
*/
{
{
Trace_Curseur
(
DC
);
Trace_Curseur
(
DC
);
--
m_CursorLevel
;
--
m_CursorLevel
;
}
}
/*******************************************************************/
/*******************************************************************/
void
WinEDA_DrawPanel
::
CursorOn
(
wxDC
*
DC
)
void
WinEDA_DrawPanel
::
CursorOn
(
wxDC
*
DC
)
/*******************************************************************/
/*******************************************************************/
/*
/*
Display the grid cursor
*
Display the grid cursor
*/
*/
{
{
++
m_CursorLevel
;
++
m_CursorLevel
;
Trace_Curseur
(
DC
);
Trace_Curseur
(
DC
);
if
(
m_CursorLevel
>
0
)
// Shouldn't happen, but just in case ..
if
(
m_CursorLevel
>
0
)
// Shouldn't happen, but just in case ..
m_CursorLevel
=
0
;
m_CursorLevel
=
0
;
}
}
/***********************************/
/***********************************/
int
WinEDA_DrawPanel
::
GetZoom
(
void
)
int
WinEDA_DrawPanel
::
GetZoom
(
void
)
/***********************************/
/***********************************/
{
{
return
GetScreen
()
->
GetZoom
();
return
GetScreen
()
->
GetZoom
();
...
@@ -144,15 +151,15 @@ int WinEDA_DrawPanel::GetZoom(void)
...
@@ -144,15 +151,15 @@ int WinEDA_DrawPanel::GetZoom(void)
/***************************************/
/***************************************/
void
WinEDA_DrawPanel
::
SetZoom
(
int
zoom
)
void
WinEDA_DrawPanel
::
SetZoom
(
int
zoom
)
/***************************************/
/***************************************/
{
{
GetScreen
()
->
SetZoom
(
zoom
);
GetScreen
()
->
SetZoom
(
zoom
);
}
}
/************************************/
/************************************/
wxSize
WinEDA_DrawPanel
::
GetGrid
(
void
)
wxSize
WinEDA_DrawPanel
::
GetGrid
(
void
)
/************************************/
/************************************/
{
{
return
GetScreen
()
->
GetGrid
();
return
GetScreen
()
->
GetGrid
();
...
@@ -160,37 +167,38 @@ wxSize WinEDA_DrawPanel::GetGrid(void)
...
@@ -160,37 +167,38 @@ wxSize WinEDA_DrawPanel::GetGrid(void)
/******************************************************/
/******************************************************/
void
WinEDA_DrawPanel
::
PrepareGraphicContext
(
wxDC
*
DC
)
void
WinEDA_DrawPanel
::
PrepareGraphicContext
(
wxDC
*
DC
)
/******************************************************/
/******************************************************/
{
{
GRResetPenAndBrush
(
DC
);
GRResetPenAndBrush
(
DC
);
DC
->
SetBackgroundMode
(
wxTRANSPARENT
);
DC
->
SetBackgroundMode
(
wxTRANSPARENT
);
#ifdef WX_ZOOM
#ifdef WX_ZOOM
int
zoom
=
GetZoom
();
int
zoom
=
GetZoom
();
double
f_scale
=
1.0
/
(
double
)
zoom
;
double
f_scale
=
1.0
/
(
double
)
zoom
;
DC
->
SetUserScale
(
f_scale
,
f_scale
);
DC
->
SetUserScale
(
f_scale
,
f_scale
);
PrepareDC
(
*
DC
);
PrepareDC
(
*
DC
);
#endif
#endif
SetBoundaryBox
();
SetBoundaryBox
();
}
}
/*********************************************************************/
/*********************************************************************/
wxPoint
WinEDA_DrawPanel
::
CalcAbsolutePosition
(
const
wxPoint
&
rel_pos
)
wxPoint
WinEDA_DrawPanel
::
CalcAbsolutePosition
(
const
wxPoint
&
rel_pos
)
/*********************************************************************/
/*********************************************************************/
/* retourne la position absolue en pixels de la position rel_pos,
/* retourne la position absolue en pixels de la position rel_pos,
donne en position relative scrolle (en pixel)
*
donne en position relative scrolle (en pixel)
*/
*/
{
{
wxPoint
pos
;
wxPoint
pos
;
#ifdef WX_ZOOM
#ifdef WX_ZOOM
CalcUnscrolledPosition
(
rel_pos
.
x
,
rel_pos
.
y
,
&
pos
.
x
,
&
pos
.
y
);
CalcUnscrolledPosition
(
rel_pos
.
x
,
rel_pos
.
y
,
&
pos
.
x
,
&
pos
.
y
);
#else
#else
int
ii
,
jj
;
int
ii
,
jj
;
GetViewStart
(
&
pos
.
x
,
&
pos
.
y
);
GetViewStart
(
&
pos
.
x
,
&
pos
.
y
);
GetScrollPixelsPerUnit
(
&
ii
,
&
jj
);
GetScrollPixelsPerUnit
(
&
ii
,
&
jj
);
pos
.
x
*=
ii
;
pos
.
y
*=
jj
;
pos
.
x
*=
ii
;
pos
.
y
*=
jj
;
pos
.
x
+=
rel_pos
.
x
;
pos
.
x
+=
rel_pos
.
x
;
pos
.
y
+=
rel_pos
.
y
;
pos
.
y
+=
rel_pos
.
y
;
...
@@ -200,30 +208,32 @@ int ii, jj;
...
@@ -200,30 +208,32 @@ int ii, jj;
/**********************************************************************/
/**********************************************************************/
wxPoint
WinEDA_DrawPanel
::
CursorRealPosition
(
const
wxPoint
&
ScreenPos
)
wxPoint
WinEDA_DrawPanel
::
CursorRealPosition
(
const
wxPoint
&
ScreenPos
)
/**********************************************************************/
/**********************************************************************/
/* Retourne la position en unites utilisateur du pointeur souris
/* Retourne la position en unites utilisateur du pointeur souris
ScreenPos = position pointeur en coord absolue ecran
*
ScreenPos = position pointeur en coord absolue ecran
*/
*/
{
{
wxPoint
curpos
;
wxPoint
curpos
;
curpos
=
GetScreen
()
->
CursorRealPosition
(
ScreenPos
);
curpos
=
GetScreen
()
->
CursorRealPosition
(
ScreenPos
);
return
curpos
;
return
curpos
;
}
}
/********************************************************/
/********************************************************/
bool
WinEDA_DrawPanel
::
IsPointOnDisplay
(
wxPoint
ref_pos
)
bool
WinEDA_DrawPanel
::
IsPointOnDisplay
(
wxPoint
ref_pos
)
/********************************************************/
/********************************************************/
/* retourne TRUE si le point de coord physique ref_pos
/* retourne TRUE si le point de coord physique ref_pos
est visible sur l'ecran, c'est a dire:
*
est visible sur l'ecran, c'est a dire:
si ref_pos est sur la partie du schema ou pcb affichee a l'ecran
*
si ref_pos est sur la partie du schema ou pcb affichee a l'ecran
*/
*/
{
{
wxPoint
pos
;
wxPoint
pos
;
EDA_Rect
display_rect
;
EDA_Rect
display_rect
;
SetBoundaryBox
();
SetBoundaryBox
();
display_rect
=
m_ClipBox
;
display_rect
=
m_ClipBox
;
...
@@ -231,7 +241,7 @@ EDA_Rect display_rect;
...
@@ -231,7 +241,7 @@ EDA_Rect display_rect;
// Reduction legere des dimension de l'ecran utile pour eviter cadrage
// Reduction legere des dimension de l'ecran utile pour eviter cadrage
// en limite d'ecran
// en limite d'ecran
#define PIXEL_MARGIN 8
#define PIXEL_MARGIN 8
display_rect
.
Inflate
(
-
PIXEL_MARGIN
,
-
PIXEL_MARGIN
);
display_rect
.
Inflate
(
-
PIXEL_MARGIN
,
-
PIXEL_MARGIN
);
// Conversion en coord physiques
// Conversion en coord physiques
pos
=
CalcAbsolutePosition
(
display_rect
.
GetPosition
()
);
pos
=
CalcAbsolutePosition
(
display_rect
.
GetPosition
()
);
...
@@ -239,22 +249,23 @@ EDA_Rect display_rect;
...
@@ -239,22 +249,23 @@ EDA_Rect display_rect;
pos
.
y
*=
GetZoom
();
pos
.
y
*=
GetZoom
();
pos
.
x
+=
GetScreen
()
->
m_DrawOrg
.
x
;
pos
.
x
+=
GetScreen
()
->
m_DrawOrg
.
x
;
pos
.
y
+=
GetScreen
()
->
m_DrawOrg
.
y
;
pos
.
y
+=
GetScreen
()
->
m_DrawOrg
.
y
;
display_rect
.
SetX
(
pos
.
x
);
display_rect
.
SetY
(
pos
.
y
);
display_rect
.
SetX
(
pos
.
x
);
display_rect
.
SetY
(
pos
.
y
);
display_rect
.
SetWidth
(
display_rect
.
GetWidth
()
*
GetZoom
()
);
display_rect
.
SetWidth
(
display_rect
.
GetWidth
()
*
GetZoom
()
);
display_rect
.
SetHeight
(
display_rect
.
GetHeight
()
*
GetZoom
()
);
display_rect
.
SetHeight
(
display_rect
.
GetHeight
()
*
GetZoom
()
);
return
display_rect
.
Inside
(
ref_pos
);
return
display_rect
.
Inside
(
ref_pos
);
}
}
/********************************************************/
/********************************************************/
wxPoint
WinEDA_DrawPanel
::
CursorScreenPosition
(
void
)
wxPoint
WinEDA_DrawPanel
::
CursorScreenPosition
(
void
)
/********************************************************/
/********************************************************/
/* retourne la position sur l'ecran,en pixels, du curseur
/* retourne la position sur l'ecran,en pixels, du curseur
Orgine = coord absolue 0,0;
*
Orgine = coord absolue 0,0;
*/
*/
{
{
wxPoint
curpos
=
GetScreen
()
->
m_Curseur
;
wxPoint
curpos
=
GetScreen
()
->
m_Curseur
;
curpos
.
x
-=
GetScreen
()
->
m_DrawOrg
.
x
;
curpos
.
x
-=
GetScreen
()
->
m_DrawOrg
.
x
;
curpos
.
y
-=
GetScreen
()
->
m_DrawOrg
.
y
;
curpos
.
y
-=
GetScreen
()
->
m_DrawOrg
.
y
;
...
@@ -267,16 +278,16 @@ wxPoint curpos = GetScreen()->m_Curseur;
...
@@ -267,16 +278,16 @@ wxPoint curpos = GetScreen()->m_Curseur;
/*********************************************************/
/*********************************************************/
wxPoint
WinEDA_DrawPanel
::
GetScreenCenterRealPosition
(
void
)
wxPoint
WinEDA_DrawPanel
::
GetScreenCenterRealPosition
(
void
)
/*********************************************************/
/*********************************************************/
{
{
wxSize
size
;
wxSize
size
;
wxPoint
realpos
;
wxPoint
realpos
;
size
=
GetClientSize
();
size
=
GetClientSize
();
size
.
x
/=
2
;
size
.
y
/=
2
;
size
.
x
/=
2
;
size
.
y
/=
2
;
realpos
=
CalcAbsolutePosition
(
wxPoint
(
size
.
x
,
size
.
y
)
);
realpos
=
CalcAbsolutePosition
(
wxPoint
(
size
.
x
,
size
.
y
)
);
realpos
.
x
*=
GetZoom
();
realpos
.
x
*=
GetZoom
();
realpos
.
y
*=
GetZoom
();
realpos
.
y
*=
GetZoom
();
realpos
.
x
+=
GetScreen
()
->
m_DrawOrg
.
x
;
realpos
.
x
+=
GetScreen
()
->
m_DrawOrg
.
x
;
...
@@ -287,35 +298,40 @@ wxPoint realpos;
...
@@ -287,35 +298,40 @@ wxPoint realpos;
/**********************************************/
/**********************************************/
void
WinEDA_DrawPanel
::
MouseToCursorSchema
(
void
)
void
WinEDA_DrawPanel
::
MouseToCursorSchema
(
void
)
/**********************************************/
/**********************************************/
/* place le curseur souris sur la position du curseur schema
/* place le curseur souris sur la position du curseur schema
*/
*/
{
{
wxPoint
Mouse
=
CursorScreenPosition
();
wxPoint
Mouse
=
CursorScreenPosition
();
MouseTo
(
Mouse
);
MouseTo
(
Mouse
);
}
}
/****************************************************/
/****************************************************/
void
WinEDA_DrawPanel
::
MouseTo
(
const
wxPoint
&
Mouse
)
void
WinEDA_DrawPanel
::
MouseTo
(
const
wxPoint
&
Mouse
)
/****************************************************/
/****************************************************/
/* place le curseur souris sur la position Mouse
/* place le curseur souris sur la position Mouse
*/
*/
{
{
wxPoint
mouse
;
wxPoint
mouse
;
#ifdef WX_ZOOM
#ifdef WX_ZOOM
CalcScrolledPosition
(
Mouse
.
x
,
Mouse
.
y
,
&
mouse
.
x
,
&
mouse
.
y
);
CalcScrolledPosition
(
Mouse
.
x
,
Mouse
.
y
,
&
mouse
.
x
,
&
mouse
.
y
);
#else
#else
mouse
=
Mouse
;
mouse
=
Mouse
;
mouse
.
x
-=
GetScreen
()
->
m_StartVisu
.
x
;
mouse
.
x
-=
GetScreen
()
->
m_StartVisu
.
x
;
mouse
.
y
-=
GetScreen
()
->
m_StartVisu
.
y
;
mouse
.
y
-=
GetScreen
()
->
m_StartVisu
.
y
;
#endif
#endif
GRMouseWarp
(
this
,
mouse
);
GRMouseWarp
(
this
,
mouse
);
}
}
/********************************************************/
/********************************************************/
void
WinEDA_DrawPanel
::
OnActivate
(
wxActivateEvent
&
event
)
void
WinEDA_DrawPanel
::
OnActivate
(
wxActivateEvent
&
event
)
/********************************************************/
/********************************************************/
{
{
m_CanStartBlock
=
-
1
;
// Commande block can't start
m_CanStartBlock
=
-
1
;
// Commande block can't start
...
@@ -324,42 +340,46 @@ void WinEDA_DrawPanel::OnActivate(wxActivateEvent& event)
...
@@ -324,42 +340,46 @@ void WinEDA_DrawPanel::OnActivate(wxActivateEvent& event)
/***********************************************************/
/***********************************************************/
void
WinEDA_DrawPanel
::
OnEraseBackground
(
wxEraseEvent
&
event
)
void
WinEDA_DrawPanel
::
OnEraseBackground
(
wxEraseEvent
&
event
)
/***********************************************************/
/***********************************************************/
{
{
event
.
Skip
();
event
.
Skip
();
}
}
/*********************************************************/
/*********************************************************/
void
WinEDA_DrawPanel
::
OnScroll
(
wxScrollWinEvent
&
event
)
void
WinEDA_DrawPanel
::
OnScroll
(
wxScrollWinEvent
&
event
)
/*********************************************************/
/*********************************************************/
{
{
int
id
=
event
.
GetEventType
();
int
id
=
event
.
GetEventType
();
int
dir
,
value
=
0
;
int
dir
,
value
=
0
;
int
x
,
y
;
int
x
,
y
;
GetViewStart
(
&
x
,
&
y
);
GetViewStart
(
&
x
,
&
y
);
dir
=
event
.
GetOrientation
();
// wxHORIZONTAL ou wxVERTICAL
dir
=
event
.
GetOrientation
();
// wxHORIZONTAL ou wxVERTICAL
if
(
id
==
wxEVT_SCROLLWIN_LINEUP
)
value
=
-
m_ScrollButt_unit
;
if
(
id
==
wxEVT_SCROLLWIN_LINEUP
)
value
=
-
m_ScrollButt_unit
;
else
if
(
id
==
wxEVT_SCROLLWIN_LINEDOWN
)
value
=
m_ScrollButt_unit
;
else
if
(
id
==
wxEVT_SCROLLWIN_LINEDOWN
)
value
=
m_ScrollButt_unit
;
else
if
(
id
==
wxEVT_SCROLLWIN_THUMBTRACK
)
else
if
(
id
==
wxEVT_SCROLLWIN_THUMBTRACK
)
{
{
value
=
event
.
GetPosition
();
value
=
event
.
GetPosition
();
if
(
dir
==
wxHORIZONTAL
)
Scroll
(
value
,
-
1
);
if
(
dir
==
wxHORIZONTAL
)
else
Scroll
(
-
1
,
value
);
Scroll
(
value
,
-
1
);
else
Scroll
(
-
1
,
value
);
return
;
return
;
}
}
else
else
{
{
event
.
Skip
();
event
.
Skip
();
return
;
return
;
}
}
if
(
dir
==
wxHORIZONTAL
)
if
(
dir
==
wxHORIZONTAL
)
{
{
Scroll
(
x
+
value
,
-
1
);
Scroll
(
x
+
value
,
-
1
);
}
}
...
@@ -372,30 +392,32 @@ int x,y;
...
@@ -372,30 +392,32 @@ int x,y;
/*************************************************/
/*************************************************/
void
WinEDA_DrawPanel
::
OnSize
(
wxSizeEvent
&
event
)
void
WinEDA_DrawPanel
::
OnSize
(
wxSizeEvent
&
event
)
/*************************************************/
/*************************************************/
{
{
SetBoundaryBox
();
SetBoundaryBox
();
event
.
Skip
();
event
.
Skip
();
}
}
/******************************************/
/******************************************/
void
WinEDA_DrawPanel
::
SetBoundaryBox
(
void
)
void
WinEDA_DrawPanel
::
SetBoundaryBox
(
void
)
/******************************************/
/******************************************/
{
{
BASE_SCREEN
*
Screen
=
GetScreen
();;
BASE_SCREEN
*
Screen
=
GetScreen
();;
wxPoint
org
;
int
ii
,
jj
;
wxPoint
org
;
int
ii
,
jj
;
Screen
->
m_SizeVisu
=
GetClientSize
();
Screen
->
m_SizeVisu
=
GetClientSize
();
GetViewStart
(
&
org
.
x
,
&
org
.
y
);
GetViewStart
(
&
org
.
x
,
&
org
.
y
);
GetScrollPixelsPerUnit
(
&
ii
,
&
jj
);
GetScrollPixelsPerUnit
(
&
ii
,
&
jj
);
org
.
x
*=
ii
;
org
.
y
*=
jj
;
org
.
x
*=
ii
;
org
.
y
*=
jj
;
Screen
->
m_StartVisu
=
org
;
Screen
->
m_StartVisu
=
org
;
m_ClipBox
.
SetOrigin
(
org
);
m_ClipBox
.
SetOrigin
(
org
);
m_ClipBox
.
SetSize
(
GetClientSize
()
);
m_ClipBox
.
SetSize
(
GetClientSize
()
);
#ifdef WX_ZOOM
#ifdef WX_ZOOM
m_ClipBox
.
m_Pos
.
x
*=
GetZoom
();
m_ClipBox
.
m_Pos
.
x
*=
GetZoom
();
...
@@ -408,40 +430,42 @@ int ii, jj;
...
@@ -408,40 +430,42 @@ int ii, jj;
#endif
#endif
m_ScrollButt_unit
=
MIN
(
Screen
->
m_SizeVisu
.
x
,
Screen
->
m_SizeVisu
.
y
)
/
4
;
m_ScrollButt_unit
=
MIN
(
Screen
->
m_SizeVisu
.
x
,
Screen
->
m_SizeVisu
.
y
)
/
4
;
if
(
m_ScrollButt_unit
<
2
)
m_ScrollButt_unit
=
2
;
if
(
m_ScrollButt_unit
<
2
)
m_ScrollButt_unit
=
2
;
Screen
->
m_ScrollbarPos
.
x
=
GetScrollPos
(
wxHORIZONTAL
);
Screen
->
m_ScrollbarPos
.
x
=
GetScrollPos
(
wxHORIZONTAL
);
Screen
->
m_ScrollbarPos
.
y
=
GetScrollPos
(
wxVERTICAL
);
Screen
->
m_ScrollbarPos
.
y
=
GetScrollPos
(
wxVERTICAL
);
}
}
/*********************************************/
/*********************************************/
void
WinEDA_DrawPanel
::
EraseScreen
(
wxDC
*
DC
)
void
WinEDA_DrawPanel
::
EraseScreen
(
wxDC
*
DC
)
/*********************************************/
/*********************************************/
{
{
GRSetDrawMode
(
DC
,
GR_COPY
);
GRSetDrawMode
(
DC
,
GR_COPY
);
GRSFilledRect
(
&
m_ClipBox
,
DC
,
m_ClipBox
.
GetX
(),
m_ClipBox
.
GetY
(),
GRSFilledRect
(
&
m_ClipBox
,
DC
,
m_ClipBox
.
GetX
(),
m_ClipBox
.
GetY
(),
m_ClipBox
.
GetRight
(),
m_ClipBox
.
GetBottom
(),
m_ClipBox
.
GetRight
(),
m_ClipBox
.
GetBottom
(),
g_DrawBgColor
,
g_DrawBgColor
);
g_DrawBgColor
,
g_DrawBgColor
);
}
}
/***************************************************/
/***************************************************/
void
WinEDA_DrawPanel
::
OnPaint
(
wxPaintEvent
&
event
)
void
WinEDA_DrawPanel
::
OnPaint
(
wxPaintEvent
&
event
)
/***************************************************/
/***************************************************/
{
{
wxPaintDC
paintDC
(
this
);
wxPaintDC
paintDC
(
this
);
EDA_Rect
tmp
;
EDA_Rect
tmp
;
wxRect
PaintClipBox
;
wxRect
PaintClipBox
;
wxPoint
org
;
wxPoint
org
;
PrepareGraphicContext
(
&
paintDC
);
PrepareGraphicContext
(
&
paintDC
);
tmp
=
m_ClipBox
;
tmp
=
m_ClipBox
;
org
=
m_ClipBox
.
GetOrigin
();
org
=
m_ClipBox
.
GetOrigin
();
wxRegionIterator
upd
(
GetUpdateRegion
()
);
// get the update rect list
wxRegionIterator
upd
(
GetUpdateRegion
()
);
// get the update rect list
while
(
upd
)
while
(
upd
)
{
{
PaintClipBox
=
upd
.
GetRect
();
PaintClipBox
=
upd
.
GetRect
();
upd
++
;
upd
++
;
...
@@ -450,20 +474,24 @@ wxPoint org;
...
@@ -450,20 +474,24 @@ wxPoint org;
PaintClipBox
.
y
+=
org
.
y
;
PaintClipBox
.
y
+=
org
.
y
;
#ifdef WX_ZOOM
#ifdef WX_ZOOM
m_ClipBox
.
m_Pos
.
x
=
PaintClipBox
.
x
*
GetZoom
();
m_ClipBox
.
m_Pos
.
x
=
PaintClipBox
.
x
*
GetZoom
();
m_ClipBox
.
m_Pos
.
y
=
PaintClipBox
.
y
*
GetZoom
();
m_ClipBox
.
m_Size
.
x
=
PaintClipBox
.
m_Size
.
x
*
GetZoom
();
m_ClipBox
.
m_Pos
.
y
=
PaintClipBox
.
y
*
GetZoom
();
m_ClipBox
.
m_Size
.
y
=
PaintClipBox
.
m_Size
.
y
*
GetZoom
();
m_ClipBox
.
m_Size
.
x
=
PaintClipBox
.
m_Size
.
x
*
GetZoom
();
m_ClipBox
.
m_Size
.
y
=
PaintClipBox
.
m_Size
.
y
*
GetZoom
();
PaintClipBox
=
m_ClipBox
;
PaintClipBox
=
m_ClipBox
;
#else
#else
m_ClipBox
.
SetX
(
PaintClipBox
.
GetX
()
);
m_ClipBox
.
SetX
(
PaintClipBox
.
GetX
()
);
m_ClipBox
.
SetY
(
PaintClipBox
.
GetY
()
);
m_ClipBox
.
SetY
(
PaintClipBox
.
GetY
()
);
m_ClipBox
.
SetWidth
(
PaintClipBox
.
GetWidth
()
);
m_ClipBox
.
SetWidth
(
PaintClipBox
.
GetWidth
()
);
m_ClipBox
.
SetHeight
(
PaintClipBox
.
GetHeight
()
);
m_ClipBox
.
SetHeight
(
PaintClipBox
.
GetHeight
()
);
#endif
#endif
wxDCClipper
*
dcclip
=
new
wxDCClipper
(
paintDC
,
PaintClipBox
);
wxDCClipper
*
dcclip
=
new
wxDCClipper
(
paintDC
,
PaintClipBox
);
ReDraw
(
&
paintDC
,
TRUE
);
ReDraw
(
&
paintDC
,
TRUE
);
delete
dcclip
;
delete
dcclip
;
}
}
...
@@ -471,11 +499,12 @@ wxPoint org;
...
@@ -471,11 +499,12 @@ wxPoint org;
event
.
Skip
();
event
.
Skip
();
}
}
/****************************************************/
/****************************************************/
void
WinEDA_DrawPanel
::
ReDraw
(
wxDC
*
DC
,
bool
erasebg
)
void
WinEDA_DrawPanel
::
ReDraw
(
wxDC
*
DC
,
bool
erasebg
)
/****************************************************/
/****************************************************/
{
{
BASE_SCREEN
*
Screen
=
GetScreen
();
BASE_SCREEN
*
Screen
=
GetScreen
();
if
(
Screen
==
NULL
)
if
(
Screen
==
NULL
)
return
;
return
;
...
@@ -496,16 +525,16 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
...
@@ -496,16 +525,16 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
#ifdef WX_ZOOM
#ifdef WX_ZOOM
int
zoom
=
GetZoom
();
int
zoom
=
GetZoom
();
double
f_scale
=
1.0
/
(
double
)
zoom
;
double
f_scale
=
1.0
/
(
double
)
zoom
;
DC
->
SetUserScale
(
f_scale
,
f_scale
);
DC
->
SetUserScale
(
f_scale
,
f_scale
);
#endif
#endif
if
(
erasebg
)
if
(
erasebg
)
PrepareGraphicContext
(
DC
);
PrepareGraphicContext
(
DC
);
DC
->
SetFont
(
*
g_StdFont
);
DC
->
SetFont
(
*
g_StdFont
);
SetBackgroundColour
(
wxColour
(
ColorRefs
[
g_DrawBgColor
].
m_Red
,
SetBackgroundColour
(
wxColour
(
ColorRefs
[
g_DrawBgColor
].
m_Red
,
ColorRefs
[
g_DrawBgColor
].
m_Green
,
ColorRefs
[
g_DrawBgColor
].
m_Green
,
ColorRefs
[
g_DrawBgColor
].
m_Blue
)
);
ColorRefs
[
g_DrawBgColor
].
m_Blue
)
);
...
@@ -518,39 +547,48 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
...
@@ -518,39 +547,48 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
/***********************************************/
/***********************************************/
void
WinEDA_DrawPanel
::
DrawBackGround
(
wxDC
*
DC
)
void
WinEDA_DrawPanel
::
DrawBackGround
(
wxDC
*
DC
)
/***********************************************/
/***********************************************/
/* Trace les axes X et Y et la grille
/* Trace les axes X et Y et la grille
La grille n'est affichee que si elle peut etre facilement visible
*
La grille n'est affichee que si elle peut etre facilement visible
La grille passe toujours par le centre de l'ecran
*
La grille passe toujours par le centre de l'ecran
*/
*/
{
{
int
Color
=
BLUE
;
int
Color
=
BLUE
;
BASE_SCREEN
*
screen
=
GetScreen
();
BASE_SCREEN
*
screen
=
GetScreen
();
int
ii
,
jj
,
xg
,
yg
,
color
;
int
ii
,
jj
,
xg
,
yg
,
color
;
wxSize
pas_grille_affichee
;
wxSize
pas_grille_affichee
;
bool
drawgrid
=
FALSE
;
bool
drawgrid
=
FALSE
;
int
zoom
=
GetZoom
();
int
zoom
=
GetZoom
();
wxSize
size
;
wxSize
size
;
wxPoint
org
;
wxPoint
org
;
double
pasx
,
pasy
;
double
pasx
,
pasy
;
color
=
g_GridColor
;
color
=
g_GridColor
;
GRSetDrawMode
(
DC
,
GR_COPY
);
GRSetDrawMode
(
DC
,
GR_COPY
);
/* le pas d'affichage doit etre assez grand pour avoir une grille visible */
/* le pas d'affichage doit etre assez grand pour avoir une grille visible */
drawgrid
=
m_Parent
->
m_Draw_Grid
;
drawgrid
=
m_Parent
->
m_Draw_Grid
;
pas_grille_affichee
=
screen
->
GetGrid
();
pas_grille_affichee
=
screen
->
GetGrid
();
ii
=
pas_grille_affichee
.
x
/
zoom
;
ii
=
pas_grille_affichee
.
x
/
zoom
;
if
(
ii
<
5
)
{
pas_grille_affichee
.
x
*=
2
;
ii
*=
2
;
}
if
(
ii
<
5
)
if
(
ii
<
5
)
drawgrid
=
FALSE
;
// grille trop petite
{
pas_grille_affichee
.
x
*=
2
;
ii
*=
2
;
}
if
(
ii
<
5
)
drawgrid
=
FALSE
;
// grille trop petite
ii
=
pas_grille_affichee
.
y
/
zoom
;
ii
=
pas_grille_affichee
.
y
/
zoom
;
if
(
ii
<
5
)
{
pas_grille_affichee
.
y
*=
2
;
ii
*=
2
;
}
if
(
ii
<
5
)
if
(
ii
<
5
)
drawgrid
=
FALSE
;
// grille trop petite
{
pas_grille_affichee
.
y
*=
2
;
ii
*=
2
;
}
if
(
ii
<
5
)
drawgrid
=
FALSE
;
// grille trop petite
GetViewStart
(
&
org
.
x
,
&
org
.
y
);
GetViewStart
(
&
org
.
x
,
&
org
.
y
);
GetScrollPixelsPerUnit
(
&
ii
,
&
jj
);
GetScrollPixelsPerUnit
(
&
ii
,
&
jj
);
org
.
x
*=
ii
;
org
.
y
*=
jj
;
org
.
x
*=
ii
;
org
.
y
*=
jj
;
screen
->
m_StartVisu
=
org
;
screen
->
m_StartVisu
=
org
;
...
@@ -561,72 +599,76 @@ double pasx, pasy;
...
@@ -561,72 +599,76 @@ double pasx, pasy;
size
.
x
*=
zoom
;
size
.
y
*=
zoom
;
size
.
x
*=
zoom
;
size
.
y
*=
zoom
;
pasx
=
screen
->
m_UserGrid
.
x
*
m_Parent
->
m_InternalUnits
;
pasx
=
screen
->
m_UserGrid
.
x
*
m_Parent
->
m_InternalUnits
;
pasy
=
screen
->
m_UserGrid
.
y
*
m_Parent
->
m_InternalUnits
;
pasy
=
screen
->
m_UserGrid
.
y
*
m_Parent
->
m_InternalUnits
;
if
(
screen
->
m_UserGridUnit
!=
INCHES
)
if
(
screen
->
m_UserGridUnit
!=
INCHES
)
{
{
pasx
/=
25.4
;
pasy
/=
25.4
;
pasx
/=
25.4
;
pasy
/=
25.4
;
}
}
if
(
drawgrid
)
if
(
drawgrid
)
{
{
m_Parent
->
PutOnGrid
(
&
org
)
;
m_Parent
->
PutOnGrid
(
&
org
)
;
GRSetColorPen
(
DC
,
color
);
GRSetColorPen
(
DC
,
color
);
for
(
ii
=
0
;
;
ii
++
)
for
(
ii
=
0
;
;
ii
++
)
{
{
xg
=
screen
->
m_UserGridIsON
?
(
int
)(
(
ii
*
pasx
)
+
0.5
)
xg
=
screen
->
m_UserGridIsON
?
(
int
)
(
(
ii
*
pasx
)
+
0.5
)
:
ii
*
pas_grille_affichee
.
x
;
:
ii
*
pas_grille_affichee
.
x
;
int
xpos
=
org
.
x
+
xg
;
int
xpos
=
org
.
x
+
xg
;
for
(
jj
=
0
;
;
jj
++
)
for
(
jj
=
0
;
;
jj
++
)
{
{
yg
=
screen
->
m_UserGridIsON
?
(
int
)(
(
jj
*
pasy
)
+
0.5
)
yg
=
screen
->
m_UserGridIsON
?
(
int
)
(
(
jj
*
pasy
)
+
0.5
)
:
jj
*
pas_grille_affichee
.
y
;
:
jj
*
pas_grille_affichee
.
y
;
GRPutPixel
(
&
m_ClipBox
,
DC
,
xpos
,
org
.
y
+
yg
,
color
);
GRPutPixel
(
&
m_ClipBox
,
DC
,
xpos
,
org
.
y
+
yg
,
color
);
if
(
yg
>
size
.
y
)
break
;
if
(
yg
>
size
.
y
)
break
;
}
}
if
(
xg
>
size
.
x
)
break
;
if
(
xg
>
size
.
x
)
break
;
}
}
}
}
/* trace des axes principaux */
/* trace des axes principaux */
if
(
m_Parent
->
m_Draw_Axis
)
if
(
m_Parent
->
m_Draw_Axis
)
{
{
/* Trace de l'axe vertical */
/* Trace de l'axe vertical */
GRDashedLine
(
&
m_ClipBox
,
DC
,
0
,
-
screen
->
ReturnPageSize
().
y
,
GRDashedLine
(
&
m_ClipBox
,
DC
,
0
,
-
screen
->
ReturnPageSize
().
y
,
0
,
screen
->
ReturnPageSize
().
y
,
0
,
Color
);
0
,
screen
->
ReturnPageSize
().
y
,
0
,
Color
);
/* Trace de l'axe horizontal */
/* Trace de l'axe horizontal */
GRDashedLine
(
&
m_ClipBox
,
DC
,
-
screen
->
ReturnPageSize
().
x
,
0
,
GRDashedLine
(
&
m_ClipBox
,
DC
,
-
screen
->
ReturnPageSize
().
x
,
0
,
screen
->
ReturnPageSize
().
x
,
0
,
0
,
Color
);
screen
->
ReturnPageSize
().
x
,
0
,
0
,
Color
);
}
}
/* trace des axes auxiliaires */
/* trace des axes auxiliaires */
if
(
m_Parent
->
m_Draw_Auxiliary_Axis
)
if
(
m_Parent
->
m_Draw_Auxiliary_Axis
)
{
{
m_Draw_Auxiliary_Axis
(
DC
,
FALSE
);
m_Draw_Auxiliary_Axis
(
DC
,
FALSE
);
}
}
}
}
/********************************************************************/
/********************************************************************/
void
WinEDA_DrawPanel
::
m_Draw_Auxiliary_Axis
(
wxDC
*
DC
,
int
drawmode
)
void
WinEDA_DrawPanel
::
m_Draw_Auxiliary_Axis
(
wxDC
*
DC
,
int
drawmode
)
/********************************************************************/
/********************************************************************/
{
{
if
(
m_Parent
->
m_Auxiliary_Axis_Position
.
x
==
0
&&
if
(
m_Parent
->
m_Auxiliary_Axis_Position
.
x
==
0
m_Parent
->
m_Auxiliary_Axis_Position
.
y
==
0
)
&&
m_Parent
->
m_Auxiliary_Axis_Position
.
y
==
0
)
return
;
return
;
int
Color
=
DARKRED
;
int
Color
=
DARKRED
;
BASE_SCREEN
*
screen
=
GetScreen
();
BASE_SCREEN
*
screen
=
GetScreen
();
GRSetDrawMode
(
DC
,
drawmode
);
GRSetDrawMode
(
DC
,
drawmode
);
/* Trace de l'axe vertical */
/* Trace de l'axe vertical */
GRDashedLine
(
&
m_ClipBox
,
DC
,
GRDashedLine
(
&
m_ClipBox
,
DC
,
m_Parent
->
m_Auxiliary_Axis_Position
.
x
,
-
screen
->
ReturnPageSize
().
y
,
m_Parent
->
m_Auxiliary_Axis_Position
.
x
,
-
screen
->
ReturnPageSize
().
y
,
m_Parent
->
m_Auxiliary_Axis_Position
.
x
,
screen
->
ReturnPageSize
().
y
,
m_Parent
->
m_Auxiliary_Axis_Position
.
x
,
screen
->
ReturnPageSize
().
y
,
0
,
Color
);
0
,
Color
);
/* Trace de l'axe horizontal */
/* Trace de l'axe horizontal */
GRDashedLine
(
&
m_ClipBox
,
DC
,
GRDashedLine
(
&
m_ClipBox
,
DC
,
-
screen
->
ReturnPageSize
().
x
,
m_Parent
->
m_Auxiliary_Axis_Position
.
y
,
-
screen
->
ReturnPageSize
().
x
,
m_Parent
->
m_Auxiliary_Axis_Position
.
y
,
screen
->
ReturnPageSize
().
x
,
m_Parent
->
m_Auxiliary_Axis_Position
.
y
,
screen
->
ReturnPageSize
().
x
,
m_Parent
->
m_Auxiliary_Axis_Position
.
y
,
0
,
Color
);
0
,
Color
);
...
@@ -634,133 +676,161 @@ BASE_SCREEN * screen = GetScreen();
...
@@ -634,133 +676,161 @@ BASE_SCREEN * screen = GetScreen();
/*******************************************************/
/*******************************************************/
void
WinEDA_DrawPanel
::
OnRightClick
(
wxMouseEvent
&
event
)
void
WinEDA_DrawPanel
::
OnRightClick
(
wxMouseEvent
&
event
)
/*******************************************************/
/*******************************************************/
/* Construit et affiche un menu Popup lorsque on actionne le bouton droit
/* Construit et affiche un menu Popup lorsque on actionne le bouton droit
de la souris
*
de la souris
*/
*/
{
{
wxPoint
pos
;
wxPoint
pos
;
wxMenu
MasterMenu
;
wxMenu
MasterMenu
;
pos
.
x
=
event
.
GetX
();
pos
.
y
=
event
.
GetY
();
m_Parent
->
OnRightClick
(
pos
,
&
MasterMenu
);
AddMenuZoom
(
&
MasterMenu
);
pos
.
x
=
event
.
GetX
();
pos
.
y
=
event
.
GetY
();
m_Parent
->
OnRightClick
(
pos
,
&
MasterMenu
);
AddMenuZoom
(
&
MasterMenu
);
m_IgnoreMouseEvents
=
TRUE
;
m_IgnoreMouseEvents
=
TRUE
;
PopupMenu
(
&
MasterMenu
,
pos
);
PopupMenu
(
&
MasterMenu
,
pos
);
MouseToCursorSchema
();
MouseToCursorSchema
();
m_IgnoreMouseEvents
=
FALSE
;
m_IgnoreMouseEvents
=
FALSE
;
}
}
/******************************************************/
/******************************************************/
void
WinEDA_DrawPanel
::
OnMouseLeaving
(
wxMouseEvent
&
event
)
void
WinEDA_DrawPanel
::
OnMouseLeaving
(
wxMouseEvent
&
event
)
/*******************************************************/
/*******************************************************/
// Called when the canvas receives a mouse event leaving frame. //
// Called when the canvas receives a mouse event leaving frame. //
{
{
if
(
ManageCurseur
==
NULL
)
// Pas de commande encours
if
(
ManageCurseur
==
NULL
)
// Pas de commande encours
m_AutoPAN_Request
=
FALSE
;
m_AutoPAN_Request
=
FALSE
;
if
(
!
m_AutoPAN_Enable
||
!
m_AutoPAN_Request
||
m_IgnoreMouseEvents
)
if
(
!
m_AutoPAN_Enable
||
!
m_AutoPAN_Request
||
m_IgnoreMouseEvents
)
return
;
return
;
// Auto pan if mouse is leave working aera:
// Auto pan if mouse is leave working aera:
wxSize
size
=
GetClientSize
();
wxSize
size
=
GetClientSize
();
if
(
(
size
.
x
<
event
.
GetX
()
)
||
if
(
(
size
.
x
<
event
.
GetX
()
)
(
size
.
y
<
event
.
GetY
()
)
||
||
(
size
.
y
<
event
.
GetY
()
)
(
event
.
GetX
()
<=
0
)
||
(
event
.
GetY
()
<=
0
)
)
||
(
event
.
GetX
()
<=
0
)
||
(
event
.
GetY
()
<=
0
)
)
m_Parent
->
OnZoom
(
ID_POPUP_ZOOM_CENTER
);
m_Parent
->
OnZoom
(
ID_POPUP_ZOOM_CENTER
);
}
}
/******************************************************/
/******************************************************/
void
WinEDA_DrawPanel
::
OnMouseEvent
(
wxMouseEvent
&
event
)
void
WinEDA_DrawPanel
::
OnMouseEvent
(
wxMouseEvent
&
event
)
/*******************************************************/
/*******************************************************/
// Called when the canvas receives a mouse event. //
// Called when the canvas receives a mouse event. //
{
{
int
localrealbutt
=
0
,
localbutt
=
0
,
localkey
=
0
;
int
localrealbutt
=
0
,
localbutt
=
0
,
localkey
=
0
;
BASE_SCREEN
*
screen
=
GetScreen
();
BASE_SCREEN
*
screen
=
GetScreen
();
static
WinEDA_DrawPanel
*
LastPanel
;
static
WinEDA_DrawPanel
*
LastPanel
;
if
(
event
.
Leaving
()
||
event
.
Entering
()
)
if
(
event
.
Leaving
()
||
event
.
Entering
()
)
{
{
m_CanStartBlock
=
-
1
;
m_CanStartBlock
=
-
1
;
}
}
if
(
ManageCurseur
==
NULL
)
// Pas de commande en cours
if
(
ManageCurseur
==
NULL
)
// Pas de commande en cours
m_AutoPAN_Request
=
FALSE
;
m_AutoPAN_Request
=
FALSE
;
if
(
m_Parent
->
m_FrameIsActive
)
SetFocus
();
if
(
m_Parent
->
m_FrameIsActive
)
else
return
;
SetFocus
();
else
return
;
// Mouse Wheel is a zoom command:
// Mouse Wheel is a zoom command:
if
(
event
.
m_wheelRotation
)
if
(
event
.
m_wheelRotation
)
{
{
// This is a zoom in ou out command
// This is a zoom in ou out command
if
(
event
.
GetWheelRotation
()
>
0
)
if
(
event
.
GetWheelRotation
()
>
0
)
{
{
if
(
event
.
ShiftDown
()
)
localkey
=
EDA_PANNING_UP_KEY
;
if
(
event
.
ShiftDown
()
)
else
if
(
event
.
ControlDown
()
)
localkey
=
EDA_PANNING_LEFT_KEY
;
localkey
=
EDA_PANNING_UP_KEY
;
else
localkey
=
WXK_F1
;
else
if
(
event
.
ControlDown
()
)
localkey
=
EDA_PANNING_LEFT_KEY
;
else
localkey
=
WXK_F1
;
}
}
else
else
{
{
if
(
event
.
ShiftDown
()
)
localkey
=
EDA_PANNING_DOWN_KEY
;
if
(
event
.
ShiftDown
()
)
else
if
(
event
.
ControlDown
()
)
localkey
=
EDA_PANNING_RIGHT_KEY
;
localkey
=
EDA_PANNING_DOWN_KEY
;
else
localkey
=
WXK_F2
;
else
if
(
event
.
ControlDown
()
)
localkey
=
EDA_PANNING_RIGHT_KEY
;
else
localkey
=
WXK_F2
;
}
}
}
}
if
(
!
event
.
IsButton
()
&&
!
event
.
Moving
()
&&
if
(
!
event
.
IsButton
()
&&
!
event
.
Moving
()
!
event
.
Dragging
()
&&
!
localkey
)
&&
!
event
.
Dragging
()
&&
!
localkey
)
{
{
return
;
return
;
}
}
if
(
event
.
RightDown
()
)
if
(
event
.
RightDown
()
)
{
{
OnRightClick
(
event
);
return
;
OnRightClick
(
event
);
return
;
}
}
if
(
m_IgnoreMouseEvents
)
return
;
if
(
m_IgnoreMouseEvents
)
return
;
if
(
event
.
LeftIsDown
()
)
localrealbutt
|=
GR_M_LEFT_DOWN
;
if
(
event
.
LeftIsDown
()
)
if
(
event
.
MiddleIsDown
()
)
localrealbutt
|=
GR_M_MIDDLE_DOWN
;
localrealbutt
|=
GR_M_LEFT_DOWN
;
if
(
event
.
MiddleIsDown
()
)
localrealbutt
|=
GR_M_MIDDLE_DOWN
;
if
(
event
.
LeftDown
())
localbutt
=
GR_M_LEFT_DOWN
;
if
(
event
.
LeftDown
()
)
localbutt
=
GR_M_LEFT_DOWN
;
if
(
event
.
ButtonDClick
(
1
))
localbutt
=
GR_M_LEFT_DOWN
|
GR_M_DCLICK
;
if
(
event
.
ButtonDClick
(
1
)
)
if
(
event
.
MiddleDown
())
localbutt
=
GR_M_MIDDLE_DOWN
;
localbutt
=
GR_M_LEFT_DOWN
|
GR_M_DCLICK
;
if
(
event
.
ButtonDClick
(
2
))
{};
// Unused
if
(
event
.
MiddleDown
()
)
localbutt
=
GR_M_MIDDLE_DOWN
;
if
(
event
.
ButtonDClick
(
2
)
)
{
}
;
// Unused
localrealbutt
|=
localbutt
;
/* compensation defaut wxGTK */
localrealbutt
|=
localbutt
;
/* compensation defaut wxGTK */
/* Compute absolute m_MousePosition in pixel units: */
/* Compute absolute m_MousePosition in pixel units: */
screen
->
m_MousePositionInPixels
=
CalcAbsolutePosition
(
wxPoint
(
event
.
GetX
(),
event
.
GetY
())
);
screen
->
m_MousePositionInPixels
=
CalcAbsolutePosition
(
wxPoint
(
event
.
GetX
(),
event
.
GetY
()
)
);
/* Compute absolute m_MousePosition in user units: */
/* Compute absolute m_MousePosition in user units: */
screen
->
m_MousePosition
=
CursorRealPosition
(
screen
->
m_MousePositionInPixels
);
screen
->
m_MousePosition
=
CursorRealPosition
(
screen
->
m_MousePositionInPixels
);
wxClientDC
DC
(
this
);
wxClientDC
DC
(
this
);
int
kbstat
=
0
;
int
kbstat
=
0
;
DC
.
SetBackground
(
*
wxBLACK_BRUSH
);
DC
.
SetBackground
(
*
wxBLACK_BRUSH
);
PrepareGraphicContext
(
&
DC
);
PrepareGraphicContext
(
&
DC
);
g_KeyPressed
=
localkey
;
g_KeyPressed
=
localkey
;
if
(
event
.
ShiftDown
()
)
kbstat
|=
GR_KB_SHIFT
;
if
(
event
.
ShiftDown
()
)
if
(
event
.
ControlDown
()
)
kbstat
|=
GR_KB_CTRL
;
kbstat
|=
GR_KB_SHIFT
;
if
(
event
.
AltDown
()
)
kbstat
|=
GR_KB_ALT
;
if
(
event
.
ControlDown
()
)
kbstat
|=
GR_KB_CTRL
;
if
(
event
.
AltDown
()
)
kbstat
|=
GR_KB_ALT
;
g_MouseOldButtons
=
localrealbutt
;
g_MouseOldButtons
=
localrealbutt
;
// Appel des fonctions lies au Double Click ou au Click
// Appel des fonctions lies au Double Click ou au Click
if
(
localbutt
==
(
int
)(
GR_M_LEFT_DOWN
|
GR_M_DCLICK
)
)
if
(
localbutt
==
(
int
)
(
GR_M_LEFT_DOWN
|
GR_M_DCLICK
)
)
m_Parent
->
OnLeftDClick
(
&
DC
,
screen
->
m_MousePositionInPixels
);
m_Parent
->
OnLeftDClick
(
&
DC
,
screen
->
m_MousePositionInPixels
);
else
if
(
event
.
LeftDown
()
)
else
if
(
event
.
LeftDown
()
)
m_Parent
->
OnLeftClick
(
&
DC
,
screen
->
m_MousePositionInPixels
);
m_Parent
->
OnLeftClick
(
&
DC
,
screen
->
m_MousePositionInPixels
);
if
(
event
.
ButtonUp
(
2
)
&&
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
)
if
(
event
.
ButtonUp
(
2
)
&&
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
)
{
// The middle button has been relached, with no block command:
{
// The middle button has been relached, with no block command:
// We use it for a zoom center command
// We use it for a zoom center command
g_KeyPressed
=
localkey
=
WXK_F4
;
g_KeyPressed
=
localkey
=
WXK_F4
;
...
@@ -768,8 +838,8 @@ int kbstat = 0;
...
@@ -768,8 +838,8 @@ int kbstat = 0;
/* Appel de la fonction generale de gestion des mouvements souris
/* Appel de la fonction generale de gestion des mouvements souris
et commandes clavier */
*
et commandes clavier */
m_Parent
->
GeneralControle
(
&
DC
,
screen
->
m_MousePositionInPixels
);
m_Parent
->
GeneralControle
(
&
DC
,
screen
->
m_MousePositionInPixels
);
/*******************************/
/*******************************/
...
@@ -777,97 +847,101 @@ int kbstat = 0;
...
@@ -777,97 +847,101 @@ int kbstat = 0;
/*******************************/
/*******************************/
// Command block can't start if mouse is dragging a new panel
// Command block can't start if mouse is dragging a new panel
if
(
LastPanel
!=
this
)
m_CanStartBlock
=
-
1
;
if
(
LastPanel
!=
this
)
m_CanStartBlock
=
-
1
;
// A new command block can start after a release buttons
// A new command block can start after a release buttons
// Avoid a false start block when a dialog bos is demiss,
// Avoid a false start block when a dialog bos is demiss,
// or when changing panels in hierachy navigation
// or when changing panels in hierachy navigation
if
(
!
event
.
LeftIsDown
()
&&
!
event
.
MiddleIsDown
()
)
if
(
!
event
.
LeftIsDown
()
&&
!
event
.
MiddleIsDown
()
)
{
{
m_CanStartBlock
=
0
;
m_CanStartBlock
=
0
;
}
}
if
(
m_Block_Enable
&&
!
(
localbutt
&
GR_M_DCLICK
)
)
if
(
m_Block_Enable
&&
!
(
localbutt
&
GR_M_DCLICK
)
)
{
{
if
(
(
screen
->
BlockLocate
.
m_Command
==
BLOCK_IDLE
)
||
if
(
(
screen
->
BlockLocate
.
m_Command
==
BLOCK_IDLE
)
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
)
||
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
)
{
{
m_CursorStartPos
=
screen
->
m_Curseur
;
m_CursorStartPos
=
screen
->
m_Curseur
;
screen
->
BlockLocate
.
SetOrigin
(
m_CursorStartPos
);
screen
->
BlockLocate
.
SetOrigin
(
m_CursorStartPos
);
}
}
if
(
event
.
LeftDown
()
||
event
.
MiddleDown
()
)
if
(
event
.
LeftDown
()
||
event
.
MiddleDown
()
)
{
{
m_CursorStartPos
=
screen
->
m_Curseur
;
m_CursorStartPos
=
screen
->
m_Curseur
;
if
(
screen
->
BlockLocate
.
m_State
==
STATE_BLOCK_MOVE
)
if
(
screen
->
BlockLocate
.
m_State
==
STATE_BLOCK_MOVE
)
{
{
m_AutoPAN_Request
=
FALSE
;
m_AutoPAN_Request
=
FALSE
;
m_Parent
->
HandleBlockPlace
(
&
DC
);
m_Parent
->
HandleBlockPlace
(
&
DC
);
}
}
}
}
else
if
(
(
m_CanStartBlock
>=
0
)
&&
else
if
(
(
m_CanStartBlock
>=
0
)
(
event
.
LeftIsDown
()
||
event
.
MiddleIsDown
()
)
&&
(
event
.
LeftIsDown
()
||
event
.
MiddleIsDown
()
)
&&
ManageCurseur
==
NULL
&&
ManageCurseur
==
NULL
&&
ForceCloseManageCurseur
==
NULL
)
&&
ForceCloseManageCurseur
==
NULL
)
{
{
if
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
if
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
{
{
int
cmd_type
=
kbstat
;
int
cmd_type
=
kbstat
;
if
(
event
.
MiddleIsDown
()
)
cmd_type
|=
MOUSE_MIDDLE
;
if
(
event
.
MiddleIsDown
()
)
if
(
!
m_Parent
->
HandleBlockBegin
(
&
DC
,
cmd_type
,
m_CursorStartPos
)
)
cmd_type
|=
MOUSE_MIDDLE
;
if
(
!
m_Parent
->
HandleBlockBegin
(
&
DC
,
cmd_type
,
m_CursorStartPos
)
)
{
// error
{
// error
m_Parent
->
DisplayToolMsg
(
wxT
(
"WinEDA_DrawPanel::OnMouseEvent() Block Error"
)
);
m_Parent
->
DisplayToolMsg
(
wxT
(
"WinEDA_DrawPanel::OnMouseEvent() Block Error"
)
);
}
}
else
else
{
{
m_AutoPAN_Request
=
TRUE
;
m_AutoPAN_Request
=
TRUE
;
SetCursor
(
m_PanelCursor
=
wxCURSOR_SIZING
);
SetCursor
(
m_PanelCursor
=
wxCURSOR_SIZING
);
}
}
}
}
}
}
if
(
event
.
ButtonUp
(
1
)
||
event
.
ButtonUp
(
2
)
)
if
(
event
.
ButtonUp
(
1
)
||
event
.
ButtonUp
(
2
)
)
{
/* Relachement du bouton: fin de delimitation de block.
{
La commande peut etre terminee (DELETE) ou continuer par le placement
/* Relachement du bouton: fin de delimitation de block.
du block ainsi delimite (MOVE, COPY).
* La commande peut etre terminee (DELETE) ou continuer par le placement
Cependant bloc est annule si sa taille est trop petite*/
* du block ainsi delimite (MOVE, COPY).
* Cependant bloc est annule si sa taille est trop petite
*/
bool
BlockIsSmall
=
bool
BlockIsSmall
=
(
ABS
(
screen
->
BlockLocate
.
GetWidth
()
/
GetZoom
())
<
3
)
&&
(
ABS
(
screen
->
BlockLocate
.
GetWidth
()
/
GetZoom
()
)
<
3
)
(
ABS
(
screen
->
BlockLocate
.
GetHeight
()
/
GetZoom
()
)
<
3
);
&&
(
ABS
(
screen
->
BlockLocate
.
GetHeight
()
/
GetZoom
()
)
<
3
);
if
(
(
screen
->
BlockLocate
.
m_State
!=
STATE_NO_BLOCK
)
&&
BlockIsSmall
)
if
(
(
screen
->
BlockLocate
.
m_State
!=
STATE_NO_BLOCK
)
&&
BlockIsSmall
)
{
{
if
(
ForceCloseManageCurseur
)
if
(
ForceCloseManageCurseur
)
{
{
ForceCloseManageCurseur
(
this
,
&
DC
);
ForceCloseManageCurseur
(
this
,
&
DC
);
m_AutoPAN_Request
=
FALSE
;
m_AutoPAN_Request
=
FALSE
;
}
}
SetCursor
(
m_PanelCursor
=
m_PanelDefaultCursor
);
SetCursor
(
m_PanelCursor
=
m_PanelDefaultCursor
);
}
}
else
if
(
screen
->
BlockLocate
.
m_State
==
STATE_BLOCK_END
)
else
if
(
screen
->
BlockLocate
.
m_State
==
STATE_BLOCK_END
)
{
{
m_AutoPAN_Request
=
FALSE
;
m_AutoPAN_Request
=
FALSE
;
m_Parent
->
HandleBlockEnd
(
&
DC
);
m_Parent
->
HandleBlockEnd
(
&
DC
);
SetCursor
(
m_PanelCursor
=
m_PanelDefaultCursor
);
SetCursor
(
m_PanelCursor
=
m_PanelDefaultCursor
);
if
(
screen
->
BlockLocate
.
m_State
==
STATE_BLOCK_MOVE
)
if
(
screen
->
BlockLocate
.
m_State
==
STATE_BLOCK_MOVE
)
{
{
m_AutoPAN_Request
=
TRUE
;
m_AutoPAN_Request
=
TRUE
;
SetCursor
(
m_PanelCursor
=
wxCURSOR_HAND
);
SetCursor
(
m_PanelCursor
=
wxCURSOR_HAND
);
}
}
}
}
}
}
}
}
// Arret de block sur un double click ( qui peut provoquer un move block
// Arret de block sur un double click ( qui peut provoquer un move block
// si on dplace la souris dans ce double click
// si on dplace la souris dans ce double click
if
(
localbutt
==
(
int
)(
GR_M_LEFT_DOWN
|
GR_M_DCLICK
)
)
if
(
localbutt
==
(
int
)
(
GR_M_LEFT_DOWN
|
GR_M_DCLICK
)
)
{
{
if
(
screen
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
if
(
screen
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
{
{
if
(
ForceCloseManageCurseur
)
if
(
ForceCloseManageCurseur
)
{
{
ForceCloseManageCurseur
(
this
,
&
DC
);
ForceCloseManageCurseur
(
this
,
&
DC
);
m_AutoPAN_Request
=
FALSE
;
m_AutoPAN_Request
=
FALSE
;
}
}
}
}
...
@@ -876,21 +950,22 @@ int kbstat = 0;
...
@@ -876,21 +950,22 @@ int kbstat = 0;
#if 0
#if 0
wxString msg_debug;
wxString msg_debug;
msg_debug.Printf(
" block state %d, cmd %d",
msg_debug.Printf(
" block state %d, cmd %d",
screen->BlockLocate.m_State, screen->BlockLocate.m_Command
);
screen->BlockLocate.m_State, screen->BlockLocate.m_Command
);
m_Parent->PrintMsg(msg_debug
);
m_Parent->PrintMsg( msg_debug
);
#endif
#endif
LastPanel
=
this
;
LastPanel
=
this
;
m_Parent
->
SetToolbars
();
m_Parent
->
SetToolbars
();
}
}
/****************************************************/
/****************************************************/
void
WinEDA_DrawPanel
::
OnKeyEvent
(
wxKeyEvent
&
event
)
void
WinEDA_DrawPanel
::
OnKeyEvent
(
wxKeyEvent
&
event
)
/****************************************************/
/****************************************************/
{
{
long
key
,
localkey
;
long
key
,
localkey
;
bool
escape
=
FALSE
;
bool
escape
=
FALSE
;
key
=
localkey
=
event
.
GetKeyCode
();
key
=
localkey
=
event
.
GetKeyCode
();
...
@@ -910,33 +985,36 @@ bool escape = FALSE;
...
@@ -910,33 +985,36 @@ bool escape = FALSE;
break
;
break
;
}
}
if
(
event
.
ControlDown
()
)
localkey
|=
GR_KB_CTRL
;
if
(
event
.
ControlDown
()
)
if
(
event
.
AltDown
()
)
localkey
|=
GR_KB_ALT
;
localkey
|=
GR_KB_CTRL
;
if
(
event
.
ShiftDown
()
&&
(
key
>
256
)
)
localkey
|=
GR_KB_SHIFT
;
if
(
event
.
AltDown
()
)
localkey
|=
GR_KB_ALT
;
if
(
event
.
ShiftDown
()
&&
(
key
>
256
)
)
localkey
|=
GR_KB_SHIFT
;
wxClientDC
DC
(
this
);
wxClientDC
DC
(
this
);
BASE_SCREEN
*
Screen
=
GetScreen
();
BASE_SCREEN
*
Screen
=
GetScreen
();
PrepareGraphicContext
(
&
DC
);
PrepareGraphicContext
(
&
DC
);
g_KeyPressed
=
localkey
;
g_KeyPressed
=
localkey
;
if
(
escape
)
if
(
escape
)
{
{
if
(
ManageCurseur
&&
ForceCloseManageCurseur
)
if
(
ManageCurseur
&&
ForceCloseManageCurseur
)
{
{
SetCursor
(
m_PanelCursor
=
m_PanelDefaultCursor
);
SetCursor
(
m_PanelCursor
=
m_PanelDefaultCursor
);
ForceCloseManageCurseur
(
this
,
&
DC
);
ForceCloseManageCurseur
(
this
,
&
DC
);
SetCursor
(
m_PanelCursor
=
m_PanelDefaultCursor
);
SetCursor
(
m_PanelCursor
=
m_PanelDefaultCursor
);
}
}
else
else
{
{
m_PanelCursor
=
m_PanelDefaultCursor
=
wxCURSOR_ARROW
;
m_PanelCursor
=
m_PanelDefaultCursor
=
wxCURSOR_ARROW
;
m_Parent
->
SetToolID
(
0
,
m_PanelCursor
,
wxEmptyString
);
m_Parent
->
SetToolID
(
0
,
m_PanelCursor
,
wxEmptyString
);
}
}
}
}
m_Parent
->
GeneralControle
(
&
DC
,
Screen
->
m_MousePositionInPixels
);
m_Parent
->
GeneralControle
(
&
DC
,
Screen
->
m_MousePositionInPixels
);
#if 0
#if 0
event.Skip(); // Allow menu shortcut processing
event.Skip(); // Allow menu shortcut processing
...
...
share/zoom.cpp
View file @
e6239e74
...
@@ -329,7 +329,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
...
@@ -329,7 +329,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
int
ii
;
int
ii
;
wxString
line
;
wxString
line
;
grid_list_struct
grid_list_pcb
[]
=
static
const
grid_list_struct
grid_list_pcb
[]
=
{
{
{
1000
,
ID_POPUP_GRID_LEVEL_1000
,
wxT
(
" 100"
)
},
{
1000
,
ID_POPUP_GRID_LEVEL_1000
,
wxT
(
" 100"
)
},
{
500
,
ID_POPUP_GRID_LEVEL_500
,
wxT
(
" 50"
)
},
{
500
,
ID_POPUP_GRID_LEVEL_500
,
wxT
(
" 50"
)
},
...
@@ -346,7 +346,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
...
@@ -346,7 +346,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
{
0
,
ID_POPUP_GRID_USER
,
_
(
"grid user"
)
}
{
0
,
ID_POPUP_GRID_USER
,
_
(
"grid user"
)
}
};
};
grid_list_struct
grid_list_schematic
[]
=
static
const
grid_list_struct
grid_list_schematic
[]
=
{
{
{
50
,
ID_POPUP_GRID_LEVEL_50
,
wxT
(
" 50"
)
},
{
50
,
ID_POPUP_GRID_LEVEL_50
,
wxT
(
" 50"
)
},
{
25
,
ID_POPUP_GRID_LEVEL_25
,
wxT
(
" 25"
)
},
{
25
,
ID_POPUP_GRID_LEVEL_25
,
wxT
(
" 25"
)
},
...
...
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