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
8bb93b8d
Commit
8bb93b8d
authored
Aug 04, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
beautified
parent
ede37ecf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
362 additions
and
336 deletions
+362
-336
controle.cpp
pcbnew/controle.cpp
+362
-336
No files found.
pcbnew/controle.cpp
View file @
8bb93b8d
/********************************************************/
/********************************************************/
/* Routines generales de gestion des commandes usuelles */
/* Routines generales de gestion des commandes usuelles */
/********************************************************/
/********************************************************/
/* fichier controle.cpp */
/* fichier controle.cpp */
/*
/*
Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
*
Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
*/
*/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -21,351 +22,376 @@
...
@@ -21,351 +22,376 @@
/* Variables Locales */
/* Variables Locales */
/**********************************/
/**********************************/
void
RemoteCommand
(
char
*
cmdline
)
void
RemoteCommand
(
char
*
cmdline
)
/**********************************/
/**********************************/
/* Read a remote command send by eeschema via a socket,
/* Read a remote command send by eeschema via a socket,
port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
*
port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
*/
*/
{
{
char
Line
[
1024
];
char
Line
[
1024
];
wxString
msg
;
wxString
msg
;
char
*
idcmd
,
*
text
;
char
*
idcmd
,
*
text
;
WinEDA_PcbFrame
*
frame
=
EDA_Appl
->
m_PcbFrame
;
WinEDA_PcbFrame
*
frame
=
EDA_Appl
->
m_PcbFrame
;
strncpy
(
Line
,
cmdline
,
sizeof
(
Line
)
-
1
);
strncpy
(
Line
,
cmdline
,
sizeof
(
Line
)
-
1
);
msg
=
CONV_FROM_UTF8
(
Line
);
msg
=
CONV_FROM_UTF8
(
Line
);
idcmd
=
strtok
(
Line
,
"
\n\r
"
);
idcmd
=
strtok
(
Line
,
"
\n\r
"
);
text
=
strtok
(
NULL
,
"
\n\r
"
);
text
=
strtok
(
NULL
,
"
\n\r
"
);
if
(
(
idcmd
==
NULL
)
||
(
text
==
NULL
)
)
return
;
if
(
(
idcmd
==
NULL
)
||
(
text
==
NULL
)
)
return
;
if
(
strcmp
(
idcmd
,
"$PART:"
)
==
0
)
{
if
(
strcmp
(
idcmd
,
"$PART:"
)
==
0
)
MODULE
*
Module
;
{
msg
=
CONV_FROM_UTF8
(
text
);
MODULE
*
Module
;
Module
=
ReturnModule
(
frame
->
m_Pcb
,
msg
);
msg
=
CONV_FROM_UTF8
(
text
);
msg
.
Printf
(
_
(
"Locate module %s %s"
),
msg
.
GetData
(),
Module
?
wxT
(
"Ok"
)
:
wxT
(
"not found"
));
Module
=
ReturnModule
(
frame
->
m_Pcb
,
msg
);
frame
->
Affiche_Message
(
msg
);
msg
.
Printf
(
_
(
"Locate module %s %s"
),
msg
.
GetData
(),
if
(
Module
)
Module
?
wxT
(
"Ok"
)
:
wxT
(
"not found"
)
);
{
frame
->
Affiche_Message
(
msg
);
wxClientDC
dc
(
frame
->
DrawPanel
);
if
(
Module
)
frame
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
{
frame
->
DrawPanel
->
CursorOff
(
&
dc
);
wxClientDC
dc
(
frame
->
DrawPanel
);
frame
->
GetScreen
()
->
m_Curseur
=
Module
->
m_Pos
;
frame
->
DrawPanel
->
CursorOn
(
&
dc
);
frame
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
}
frame
->
DrawPanel
->
CursorOff
(
&
dc
);
}
frame
->
GetScreen
()
->
m_Curseur
=
Module
->
m_Pos
;
frame
->
DrawPanel
->
CursorOn
(
&
dc
);
if
(
idcmd
&&
strcmp
(
idcmd
,
"$PIN:"
)
==
0
)
}
{
}
wxString
PinName
,
ModName
;
MODULE
*
Module
;
if
(
idcmd
&&
strcmp
(
idcmd
,
"$PIN:"
)
==
0
)
D_PAD
*
Pad
=
NULL
;
{
int
netcode
=
-
1
;
wxString
PinName
,
ModName
;
PinName
=
CONV_FROM_UTF8
(
text
);
MODULE
*
Module
;
text
=
strtok
(
NULL
,
"
\n\r
"
);
D_PAD
*
Pad
=
NULL
;
if
(
text
&&
strcmp
(
text
,
"$PART:"
)
==
0
)
text
=
strtok
(
NULL
,
"
\n\r
"
);
int
netcode
=
-
1
;
PinName
=
CONV_FROM_UTF8
(
text
);
wxClientDC
dc
(
frame
->
DrawPanel
);
text
=
strtok
(
NULL
,
"
\n\r
"
);
frame
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
if
(
text
&&
strcmp
(
text
,
"$PART:"
)
==
0
)
text
=
strtok
(
NULL
,
"
\n\r
"
);
ModName
=
CONV_FROM_UTF8
(
text
);
Module
=
ReturnModule
(
frame
->
m_Pcb
,
ModName
);
wxClientDC
dc
(
frame
->
DrawPanel
);
if
(
Module
)
Pad
=
ReturnPad
(
Module
,
PinName
);
if
(
Pad
)
netcode
=
Pad
->
m_NetCode
;
frame
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
if
(
netcode
>
0
)
{
ModName
=
CONV_FROM_UTF8
(
text
);
/* effacement surbrillance ancienne */
Module
=
ReturnModule
(
frame
->
m_Pcb
,
ModName
);
if
(
g_HightLigt_Status
)
frame
->
Hight_Light
(
&
dc
);
if
(
Module
)
g_HightLigth_NetCode
=
netcode
;
Pad
=
ReturnPad
(
Module
,
PinName
);
frame
->
Hight_Light
(
&
dc
);
if
(
Pad
)
frame
->
DrawPanel
->
CursorOff
(
&
dc
);
netcode
=
Pad
->
m_NetCode
;
frame
->
GetScreen
()
->
m_Curseur
=
Pad
->
m_Pos
;
if
(
netcode
>
0
)
frame
->
DrawPanel
->
CursorOn
(
&
dc
);
{
}
/* effacement surbrillance ancienne */
if
(
g_HightLigt_Status
)
if
(
Module
==
NULL
)
frame
->
Hight_Light
(
&
dc
);
msg
.
Printf
(
_
(
"module %s not found"
),
text
);
g_HightLigth_NetCode
=
netcode
;
else
if
(
Pad
==
NULL
)
frame
->
Hight_Light
(
&
dc
);
msg
.
Printf
(
_
(
"Pin %s (module %s) not found"
),
PinName
.
GetData
(),
ModName
.
GetData
());
frame
->
DrawPanel
->
CursorOff
(
&
dc
);
else
frame
->
GetScreen
()
->
m_Curseur
=
Pad
->
m_Pos
;
msg
.
Printf
(
_
(
"Locate Pin %s (module %s)"
),
PinName
.
GetData
(),
ModName
.
GetData
());
frame
->
DrawPanel
->
CursorOn
(
&
dc
);
frame
->
Affiche_Message
(
msg
);
}
}
if
(
Module
==
NULL
)
msg
.
Printf
(
_
(
"module %s not found"
),
text
);
else
if
(
Pad
==
NULL
)
msg
.
Printf
(
_
(
"Pin %s (module %s) not found"
),
PinName
.
GetData
(),
ModName
.
GetData
()
);
else
msg
.
Printf
(
_
(
"Locate Pin %s (module %s)"
),
PinName
.
GetData
(),
ModName
.
GetData
()
);
frame
->
Affiche_Message
(
msg
);
}
}
}
/***********************************************************************/
/***********************************************************************/
EDA_BaseStruct
*
WinEDA_BasePcbFrame
::
PcbGeneralLocateAndDisplay
(
void
)
EDA_BaseStruct
*
WinEDA_BasePcbFrame
::
PcbGeneralLocateAndDisplay
(
void
)
/***********************************************************************/
/***********************************************************************/
/* Search an item under the mouse cursor.
/* Search an item under the mouse cursor.
items are searched first on the current working layer.
*
items are searched first on the current working layer.
if nothing found, an item will be searched without layer restriction
*
if nothing found, an item will be searched without layer restriction
*/
*/
{
{
EDA_BaseStruct
*
item
;
EDA_BaseStruct
*
item
;
item
=
Locate
(
CURSEUR_OFF_GRILLE
,
GetScreen
()
->
m_Active_Layer
);
if
(
item
==
NULL
)
item
=
Locate
(
CURSEUR_OFF_GRILLE
,
GetScreen
()
->
m_Active_Layer
);
item
=
Locate
(
CURSEUR_OFF_GRILLE
,
-
1
);
if
(
item
==
NULL
)
return
item
;
item
=
Locate
(
CURSEUR_OFF_GRILLE
,
-
1
);
return
item
;
}
}
/****************************************************************/
/****************************************************************/
void
WinEDA_BasePcbFrame
::
GeneralControle
(
wxDC
*
DC
,
wxPoint
Mouse
)
void
WinEDA_BasePcbFrame
::
GeneralControle
(
wxDC
*
DC
,
wxPoint
Mouse
)
/*****************************************************************/
/*****************************************************************/
{
{
int
ll
;
int
ll
;
wxSize
delta
;
wxSize
delta
;
int
zoom
=
GetScreen
()
->
GetZoom
();
int
zoom
=
GetScreen
()
->
GetZoom
();
wxPoint
curpos
,
oldpos
;
wxPoint
curpos
,
oldpos
;
int
hotkey
=
0
;
int
hotkey
=
0
;
ActiveScreen
=
GetScreen
();
ActiveScreen
=
GetScreen
();
// Save the board after the time out :
// Save the board after the time out :
int
CurrentTime
=
time
(
NULL
);
int
CurrentTime
=
time
(
NULL
);
if
(
!
GetScreen
()
->
IsModify
()
||
GetScreen
()
->
IsSave
()
)
if
(
!
GetScreen
()
->
IsModify
()
||
GetScreen
()
->
IsSave
()
)
{
/* If no change, reset the time out */
{
/* If no change, reset the time out */
g_SaveTime
=
CurrentTime
;
g_SaveTime
=
CurrentTime
;
}
}
if
(
(
CurrentTime
-
g_SaveTime
)
>
g_TimeOut
)
if
(
(
CurrentTime
-
g_SaveTime
)
>
g_TimeOut
)
{
{
wxString
tmpFileName
=
GetScreen
()
->
m_FileName
;
wxString
tmpFileName
=
GetScreen
()
->
m_FileName
;
wxString
filename
=
g_SaveFileName
+
PcbExtBuffer
;
wxString
filename
=
g_SaveFileName
+
PcbExtBuffer
;
bool
flgmodify
=
GetScreen
()
->
IsModify
();
bool
flgmodify
=
GetScreen
()
->
IsModify
();
((
WinEDA_PcbFrame
*
)
this
)
->
SavePcbFile
(
filename
);
(
(
WinEDA_PcbFrame
*
)
this
)
->
SavePcbFile
(
filename
);
if
(
flgmodify
)
// Set the flags m_Modify cleared by SavePcbFile()
if
(
flgmodify
)
// Set the flags m_Modify cleared by SavePcbFile()
{
{
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetSave
();
// Set the flags m_FlagSave cleared by SetModify()
GetScreen
()
->
SetSave
();
// Set the flags m_FlagSave cleared by SetModify()
}
}
GetScreen
()
->
m_FileName
=
tmpFileName
;
GetScreen
()
->
m_FileName
=
tmpFileName
;
SetTitle
(
GetScreen
()
->
m_FileName
);
SetTitle
(
GetScreen
()
->
m_FileName
);
}
}
curpos
=
DrawPanel
->
CursorRealPosition
(
Mouse
);
curpos
=
DrawPanel
->
CursorRealPosition
(
Mouse
);
oldpos
=
GetScreen
()
->
m_Curseur
;
oldpos
=
GetScreen
()
->
m_Curseur
;
delta
.
x
=
(
int
)
round
((
double
)
GetScreen
()
->
GetGrid
().
x
/
zoom
);
delta
.
x
=
(
int
)
round
(
(
double
)
GetScreen
()
->
GetGrid
().
x
/
zoom
);
delta
.
y
=
(
int
)
round
((
double
)
GetScreen
()
->
GetGrid
().
y
/
zoom
);
delta
.
y
=
(
int
)
round
(
(
double
)
GetScreen
()
->
GetGrid
().
y
/
zoom
);
if
(
delta
.
x
<=
0
)
delta
.
x
=
1
;
if
(
delta
.
x
<=
0
)
if
(
delta
.
y
<=
0
)
delta
.
y
=
1
;
delta
.
x
=
1
;
if
(
delta
.
y
<=
0
)
switch
(
g_KeyPressed
)
delta
.
y
=
1
;
{
case
WXK_NUMPAD_SUBTRACT
:
switch
(
g_KeyPressed
)
case
WXK_SUBTRACT
:
{
case
'-'
:
case
WXK_NUMPAD_SUBTRACT
:
ll
=
GetScreen
()
->
m_Active_Layer
;
case
WXK_SUBTRACT
:
if
(
ll
>
CMP_N
)
break
;
case
'-'
:
if
(
ll
<=
CUIVRE_N
)
break
;
ll
=
GetScreen
()
->
m_Active_Layer
;
if
(
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
<=
1
)
// Single layer
if
(
ll
>
CMP_N
)
ll
=
CUIVRE_N
;
break
;
if
(
ll
==
CMP_N
)
if
(
ll
<=
CUIVRE_N
)
ll
=
MAX
(
CUIVRE_N
,
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
-
2
);
break
;
else
if
(
ll
>
CUIVRE_N
)
ll
--
;
if
(
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
<=
1
)
// Single layer
GetScreen
()
->
m_Active_Layer
=
ll
;
ll
=
CUIVRE_N
;
if
(
DisplayOpt
.
ContrastModeDisplay
)
DrawPanel
->
Refresh
(
TRUE
);
if
(
ll
==
CMP_N
)
break
;
ll
=
MAX
(
CUIVRE_N
,
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
-
2
);
else
if
(
ll
>
CUIVRE_N
)
case
WXK_NUMPAD_ADD
:
ll
--
;
case
WXK_ADD
:
GetScreen
()
->
m_Active_Layer
=
ll
;
case
'+'
:
if
(
DisplayOpt
.
ContrastModeDisplay
)
ll
=
GetScreen
()
->
m_Active_Layer
;
DrawPanel
->
Refresh
(
TRUE
);
if
(
ll
>=
CMP_N
)
break
;
break
;
ll
++
;
if
(
ll
>=
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
-
1
)
case
WXK_NUMPAD_ADD
:
ll
=
CMP_N
;
case
WXK_ADD
:
if
(
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
<=
1
)
// Single layer
case
'+'
:
ll
=
CUIVRE_N
;
ll
=
GetScreen
()
->
m_Active_Layer
;
GetScreen
()
->
m_Active_Layer
=
ll
;
if
(
ll
>=
CMP_N
)
if
(
DisplayOpt
.
ContrastModeDisplay
)
DrawPanel
->
Refresh
(
TRUE
);
break
;
break
;
ll
++
;
case
WXK_NUMPAD0
:
if
(
ll
>=
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
-
1
)
case
WXK_PAGEUP
:
ll
=
CMP_N
;
SwitchLayer
(
DC
,
CMP_N
);
if
(
m_Pcb
->
m_BoardSettings
->
m_CopperLayerCount
<=
1
)
// Single layer
break
;
ll
=
CUIVRE_N
;
GetScreen
()
->
m_Active_Layer
=
ll
;
case
WXK_NUMPAD9
:
if
(
DisplayOpt
.
ContrastModeDisplay
)
case
WXK_PAGEDOWN
:
DrawPanel
->
Refresh
(
TRUE
);
SwitchLayer
(
DC
,
CUIVRE_N
);
break
;
break
;
case
WXK_NUMPAD0
:
case
'F'
|
GR_KB_CTRL
:
case
WXK_PAGEUP
:
case
'f'
|
GR_KB_CTRL
:
SwitchLayer
(
DC
,
CMP_N
);
DisplayOpt
.
DisplayPcbTrackFill
^=
1
;
DisplayOpt
.
DisplayPcbTrackFill
&=
1
;
break
;
GetScreen
()
->
SetRefreshReq
();
break
;
case
WXK_NUMPAD9
:
case
WXK_PAGEDOWN
:
case
' '
:
/* Mise a jour de l'origine des coord relatives */
SwitchLayer
(
DC
,
CUIVRE_N
);
GetScreen
()
->
m_O_Curseur
=
GetScreen
()
->
m_Curseur
;
break
;
break
;
case
'F'
|
GR_KB_CTRL
:
case
'f'
|
GR_KB_CTRL
:
case
'U'
|
GR_KB_CTRL
:
DisplayOpt
.
DisplayPcbTrackFill
^=
1
;
DisplayOpt
.
DisplayPcbTrackFill
&=
1
;
case
'u'
|
GR_KB_CTRL
:
GetScreen
()
->
SetRefreshReq
();
g_UnitMetric
=
(
g_UnitMetric
==
INCHES
)
?
MILLIMETRE
:
INCHES
;
break
;
break
;
case
' '
:
/* Mise a jour de l'origine des coord relatives */
case
EDA_PANNING_UP_KEY
:
GetScreen
()
->
m_O_Curseur
=
GetScreen
()
->
m_Curseur
;
OnZoom
(
ID_ZOOM_PANNING_UP
);
break
;
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
'U'
|
GR_KB_CTRL
:
case
EDA_PANNING_DOWN_KEY
:
case
'u'
|
GR_KB_CTRL
:
OnZoom
(
ID_ZOOM_PANNING_DOWN
);
g_UnitMetric
=
(
g_UnitMetric
==
INCHES
)
?
MILLIMETRE
:
INCHES
;
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
break
;
case
EDA_PANNING_UP_KEY
:
case
EDA_PANNING_LEFT_KEY
:
OnZoom
(
ID_ZOOM_PANNING_UP
);
OnZoom
(
ID_ZOOM_PANNING_LEFT
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
break
;
case
EDA_PANNING_DOWN_KEY
:
case
EDA_PANNING_RIGHT_KEY
:
OnZoom
(
ID_ZOOM_PANNING_DOWN
);
OnZoom
(
ID_ZOOM_PANNING_RIGHT
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
break
;
case
EDA_PANNING_LEFT_KEY
:
case
WXK_F1
:
OnZoom
(
ID_ZOOM_PANNING_LEFT
);
OnZoom
(
ID_ZOOM_PLUS_KEY
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
oldpos
=
curpos
=
GetScreen
()
->
m_Curseur
;
break
;
break
;
case
EDA_PANNING_RIGHT_KEY
:
case
WXK_F2
:
OnZoom
(
ID_ZOOM_PANNING_RIGHT
);
OnZoom
(
ID_ZOOM_MOINS_KEY
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
oldpos
=
curpos
=
GetScreen
()
->
m_Curseur
;
break
;
break
;
case
WXK_F1
:
case
WXK_F3
:
OnZoom
(
ID_ZOOM_PLUS_KEY
);
OnZoom
(
ID_ZOOM_REDRAW_KEY
);
oldpos
=
curpos
=
GetScreen
()
->
m_Curseur
;
break
;
break
;
case
WXK_F4
:
case
WXK_F2
:
OnZoom
(
ID_ZOOM_CENTER_KEY
);
OnZoom
(
ID_ZOOM_MOINS_KEY
);
oldpos
=
curpos
=
GetScreen
()
->
m_Curseur
;
oldpos
=
curpos
=
GetScreen
()
->
m_Curseur
;
break
;
break
;
case
WXK_F5
:
case
WXK_F3
:
SwitchLayer
(
DC
,
LAYER_N_2
);
OnZoom
(
ID_ZOOM_REDRAW_KEY
);
break
;
break
;
case
WXK_F6
:
case
WXK_F4
:
SwitchLayer
(
DC
,
LAYER_N_3
);
OnZoom
(
ID_ZOOM_CENTER_KEY
);
break
;
oldpos
=
curpos
=
GetScreen
()
->
m_Curseur
;
break
;
case
WXK_F7
:
SwitchLayer
(
DC
,
LAYER_N_4
);
case
WXK_F5
:
break
;
SwitchLayer
(
DC
,
LAYER_N_2
);
break
;
case
WXK_F8
:
SwitchLayer
(
DC
,
LAYER_N_5
);
case
WXK_F6
:
break
;
SwitchLayer
(
DC
,
LAYER_N_3
);
break
;
case
WXK_F9
:
SwitchLayer
(
DC
,
LAYER_N_6
);
case
WXK_F7
:
break
;
SwitchLayer
(
DC
,
LAYER_N_4
);
break
;
case
WXK_F10
:
SwitchLayer
(
DC
,
LAYER_N_7
);
case
WXK_F8
:
break
;
SwitchLayer
(
DC
,
LAYER_N_5
);
break
;
case
WXK_NUMPAD8
:
/* Deplacement curseur vers le haut */
case
WXK_UP
:
case
WXK_F9
:
Mouse
.
y
-=
delta
.
y
;
SwitchLayer
(
DC
,
LAYER_N_6
);
DrawPanel
->
MouseTo
(
Mouse
);
break
;
break
;
case
WXK_F10
:
case
WXK_NUMPAD2
:
/* Deplacement curseur vers le bas */
SwitchLayer
(
DC
,
LAYER_N_7
);
case
WXK_DOWN
:
break
;
Mouse
.
y
+=
delta
.
y
;
DrawPanel
->
MouseTo
(
Mouse
);
case
WXK_NUMPAD8
:
/* Deplacement curseur vers le haut */
break
;
case
WXK_UP
:
Mouse
.
y
-=
delta
.
y
;
case
WXK_NUMPAD4
:
/* Deplacement curseur vers la gauche */
DrawPanel
->
MouseTo
(
Mouse
);
case
WXK_LEFT
:
break
;
Mouse
.
x
-=
delta
.
x
;
DrawPanel
->
MouseTo
(
Mouse
);
case
WXK_NUMPAD2
:
/* Deplacement curseur vers le bas */
break
;
case
WXK_DOWN
:
Mouse
.
y
+=
delta
.
y
;
case
WXK_NUMPAD6
:
/* Deplacement curseur vers la droite */
DrawPanel
->
MouseTo
(
Mouse
);
case
WXK_RIGHT
:
break
;
Mouse
.
x
+=
delta
.
x
;
DrawPanel
->
MouseTo
(
Mouse
);
case
WXK_NUMPAD4
:
/* Deplacement curseur vers la gauche */
break
;
case
WXK_LEFT
:
Mouse
.
x
-=
delta
.
x
;
default
:
hotkey
=
g_KeyPressed
;
DrawPanel
->
MouseTo
(
Mouse
);
break
;
break
;
}
case
WXK_NUMPAD6
:
/* Deplacement curseur vers la droite */
/* Put cursor in new position, according to the zoom keys (if any) */
case
WXK_RIGHT
:
GetScreen
()
->
m_Curseur
=
curpos
;
Mouse
.
x
+=
delta
.
x
;
DrawPanel
->
MouseTo
(
Mouse
);
/* Put cursor on grid or a pad centre if requested
break
;
But if the tool DELETE is active the cursor is left off grid
this is better to reach items to delete off grid
default
:
*/
hotkey
=
g_KeyPressed
;
D_PAD
*
pad
;
break
;
bool
keep_on_grid
=
TRUE
;
}
if
(
m_ID_current_state
==
ID_PCB_DELETE_ITEM_BUTT
)
keep_on_grid
=
FALSE
;
/* Cursor is left off grid if no block in progress and no moving object */
/* Put cursor in new position, according to the zoom keys (if any) */
if
(
GetScreen
()
->
BlockLocate
.
m_State
!=
STATE_NO_BLOCK
)
GetScreen
()
->
m_Curseur
=
curpos
;
keep_on_grid
=
TRUE
;
EDA_BaseStruct
*
DrawStruct
=
GetScreen
()
->
m_CurrentItem
;
/* Put cursor on grid or a pad centre if requested
if
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
keep_on_grid
=
TRUE
;
* But if the tool DELETE is active the cursor is left off grid
* this is better to reach items to delete off grid
switch
(
g_MagneticPadOption
)
*/
{
D_PAD
*
pad
;
case
capture_cursor_in_track_tool
:
bool
keep_on_grid
=
TRUE
;
case
capture_always
:
if
(
m_ID_current_state
==
ID_PCB_DELETE_ITEM_BUTT
)
pad
=
Locate_Any_Pad
(
m_Pcb
,
CURSEUR_OFF_GRILLE
,
TRUE
);
keep_on_grid
=
FALSE
;
if
(
(
m_ID_current_state
!=
ID_TRACK_BUTT
)
&&
/* Cursor is left off grid if no block in progress and no moving object */
(
g_MagneticPadOption
==
capture_cursor_in_track_tool
)
)
if
(
GetScreen
()
->
BlockLocate
.
m_State
!=
STATE_NO_BLOCK
)
pad
=
NULL
;
keep_on_grid
=
TRUE
;
if
(
keep_on_grid
)
EDA_BaseStruct
*
DrawStruct
=
GetScreen
()
->
m_CurrentItem
;
{
if
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
if
(
pad
)
// Put cursor on the pad
keep_on_grid
=
TRUE
;
GetScreen
()
->
m_Curseur
=
curpos
=
pad
->
m_Pos
;
else
// Put cursor on grid
switch
(
g_MagneticPadOption
)
PutOnGrid
(
&
GetScreen
()
->
m_Curseur
);
{
}
case
capture_cursor_in_track_tool
:
break
;
case
capture_always
:
pad
=
Locate_Any_Pad
(
m_Pcb
,
CURSEUR_OFF_GRILLE
,
TRUE
);
case
no_effect
:
if
(
(
m_ID_current_state
!=
ID_TRACK_BUTT
)
default
:
&&
(
g_MagneticPadOption
==
capture_cursor_in_track_tool
)
)
// If we are not in delete function, put cursor on grid
pad
=
NULL
;
if
(
keep_on_grid
)
if
(
keep_on_grid
)
PutOnGrid
(
&
GetScreen
()
->
m_Curseur
);
{
break
;
if
(
pad
)
// Put cursor on the pad
}
GetScreen
()
->
m_Curseur
=
curpos
=
pad
->
m_Pos
;
else
if
(
oldpos
!=
GetScreen
()
->
m_Curseur
)
// Put cursor on grid
{
PutOnGrid
(
&
GetScreen
()
->
m_Curseur
);
curpos
=
GetScreen
()
->
m_Curseur
;
}
GetScreen
()
->
m_Curseur
=
oldpos
;
break
;
DrawPanel
->
CursorOff
(
DC
);
case
no_effect
:
GetScreen
()
->
m_Curseur
=
curpos
;
default
:
DrawPanel
->
CursorOn
(
DC
);
// If we are not in delete function, put cursor on grid
if
(
DrawPanel
->
ManageCurseur
)
if
(
keep_on_grid
)
{
PutOnGrid
(
&
GetScreen
()
->
m_Curseur
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
TRUE
);
break
;
}
}
}
if
(
oldpos
!=
GetScreen
()
->
m_Curseur
)
if
(
GetScreen
()
->
IsRefreshReq
()
)
{
{
curpos
=
GetScreen
()
->
m_Curseur
;
RedrawActiveWindow
(
DC
,
TRUE
);
GetScreen
()
->
m_Curseur
=
oldpos
;
}
DrawPanel
->
CursorOff
(
DC
);
SetToolbars
();
GetScreen
()
->
m_Curseur
=
curpos
;
Affiche_Status_Box
();
/* Affichage des coord curseur */
DrawPanel
->
CursorOn
(
DC
);
if
(
hotkey
)
if
(
DrawPanel
->
ManageCurseur
)
{
{
OnHotKey
(
DC
,
hotkey
,
NULL
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
TRUE
);
}
}
}
if
(
GetScreen
()
->
IsRefreshReq
()
)
{
RedrawActiveWindow
(
DC
,
TRUE
);
}
SetToolbars
();
Affiche_Status_Box
();
/* Affichage des coord curseur */
if
(
hotkey
)
{
OnHotKey
(
DC
,
hotkey
,
NULL
);
}
}
}
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