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
51fc26e1
Commit
51fc26e1
authored
Aug 14, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mouse synchronization from PCBNEW to EESCHEMA
parent
b0b3a6d5
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1436 additions
and
1250 deletions
+1436
-1250
eda_dde.cpp
common/eda_dde.cpp
+153
-146
controle.cpp
eeschema/controle.cpp
+362
-323
eeschema.cpp
eeschema/eeschema.cpp
+9
-2
find.cpp
eeschema/find.cpp
+496
-431
protos.h
eeschema/protos.h
+4
-0
schframe.cpp
eeschema/schframe.cpp
+3
-0
appl_wxstruct.h
include/appl_wxstruct.h
+70
-72
common.h
include/common.h
+235
-238
eda_dde.h
include/eda_dde.h
+11
-8
wxstruct.h
include/wxstruct.h
+19
-1
class_text_mod.h
pcbnew/class_text_mod.h
+8
-0
controle.cpp
pcbnew/controle.cpp
+34
-26
edit.cpp
pcbnew/edit.cpp
+28
-1
files.cpp
pcbnew/files.cpp
+3
-1
protos.h
pcbnew/protos.h
+1
-1
No files found.
common/eda_dde.cpp
View file @
51fc26e1
///////////////////////
// Name: eda_dde.cpp //
///////////////////////
///////////////////////
// Name: eda_dde.cpp //
///////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#pragma hdrstop
#endif
// for all others, include the necessary headers
...
...
@@ -23,186 +23,193 @@
#include "common.h"
#include "macros.h"
#define ID_CONN "CAO_COM"
wxString
HOSTNAME
(
wxT
(
"localhost"
));
wxString
HOSTNAME
(
wxT
(
"localhost"
)
);
/* variables locales */
// buffers for read and write data in socket connections
#define IPC_BUF_SIZE 4096
char
client_ipc_buffer
[
IPC_BUF_SIZE
];
char
server_ipc_buffer
[
IPC_BUF_SIZE
];
char
client_ipc_buffer
[
IPC_BUF_SIZE
];
char
server_ipc_buffer
[
IPC_BUF_SIZE
];
wxServer
*
server
;
wxServer
*
server
;
void
(
*
RemoteFct
)(
char
*
cmd
);
void
(
*
RemoteFct
)(
const
char
*
cmd
);
char
buffcar
[
1024
];
char
buffcar
[
1024
];
void
SetupServerFunction
(
void
(
*
remotefct
)(
char
*
remotecmd
)
)
void
SetupServerFunction
(
void
(
*
remotefct
)(
const
char
*
remotecmd
)
)
{
RemoteFct
=
remotefct
;
RemoteFct
=
remotefct
;
}
/*****************************/
/* Routines liees au SERVEUR */
/*****************************/
/*****************************/
/* Routines liees au SERVEUR */
/*****************************/
/* Fonction d'initialisation d'un serveur socket
*/
WinEDA_Server
*
CreateServer
(
wxWindow
*
window
,
int
service
)
*/
WinEDA_Server
*
CreateServer
(
wxWindow
*
window
,
int
service
)
{
wxIPV4address
addr
;
wxIPV4address
addr
;
// Create a new server
addr
.
Service
(
service
);
// Create a new server
addr
.
Service
(
service
);
server
=
new
wxServer
(
addr
);
if
(
server
)
{
server
->
SetNotify
(
wxSOCKET_CONNECTION_FLAG
);
server
->
SetEventHandler
(
*
window
,
ID_EDA_SOCKET_EVENT_SERV
);
server
->
Notify
(
TRUE
);
}
server
=
new
wxServer
(
addr
);
if
(
server
)
{
server
->
SetNotify
(
wxSOCKET_CONNECTION_FLAG
);
server
->
SetEventHandler
(
*
window
,
ID_EDA_SOCKET_EVENT_SERV
);
server
->
Notify
(
TRUE
);
}
return
server
;
return
server
;
}
/********************************************************/
void
WinEDA_DrawFrame
::
OnSockRequest
(
wxSocketEvent
&
evt
)
void
WinEDA_DrawFrame
::
OnSockRequest
(
wxSocketEvent
&
evt
)
/********************************************************/
/* Fonction appelee a chaque demande d'un client
*/
*/
{
size_t
len
;
wxSocketBase
*
sock
=
evt
.
GetSocket
();
switch
(
evt
.
GetSocketEvent
())
{
case
wxSOCKET_INPUT
:
sock
->
Read
(
server_ipc_buffer
,
1
);
if
(
sock
->
LastCount
()
==
0
)
break
;
// No data: Occurs on open connection
sock
->
Read
(
server_ipc_buffer
+
1
,
IPC_BUF_SIZE
-
2
);
len
=
1
+
sock
->
LastCount
();
server_ipc_buffer
[
len
]
=
0
;
if
(
RemoteFct
)
RemoteFct
(
server_ipc_buffer
);
break
;
case
wxSOCKET_LOST
:
return
;
break
;
default
:
wxPrintf
(
wxT
(
"WinEDA_DrawFrame::OnSockRequest() error: Invalid event !"
));
break
;
}
size_t
len
;
wxSocketBase
*
sock
=
evt
.
GetSocket
();
switch
(
evt
.
GetSocketEvent
()
)
{
case
wxSOCKET_INPUT
:
sock
->
Read
(
server_ipc_buffer
,
1
);
if
(
sock
->
LastCount
()
==
0
)
break
;
// No data: Occurs on open connection
sock
->
Read
(
server_ipc_buffer
+
1
,
IPC_BUF_SIZE
-
2
);
len
=
1
+
sock
->
LastCount
();
server_ipc_buffer
[
len
]
=
0
;
if
(
RemoteFct
)
RemoteFct
(
server_ipc_buffer
);
break
;
case
wxSOCKET_LOST
:
return
;
break
;
default
:
wxPrintf
(
wxT
(
"WinEDA_DrawFrame::OnSockRequest() error: Invalid event !"
)
);
break
;
}
}
/**************************************************************/
void
WinEDA_DrawFrame
::
OnSockRequestServer
(
wxSocketEvent
&
evt
)
void
WinEDA_DrawFrame
::
OnSockRequestServer
(
wxSocketEvent
&
evt
)
/**************************************************************/
/* fonction appele lors d'une demande de connexion d'un client
*/
*/
{
wxSocketBase
*
sock2
;
wxSocketServer
*
server
=
(
wxSocketServer
*
)
evt
.
GetSocket
();
wxSocketBase
*
sock2
;
wxSocketServer
*
server
=
(
wxSocketServer
*
)
evt
.
GetSocket
();
sock2
=
server
->
Accept
();
if
(
sock2
==
NULL
)
return
;
if
(
sock2
==
NULL
)
return
;
sock2
->
Notify
(
TRUE
);
sock2
->
SetEventHandler
(
*
this
,
ID_EDA_SOCKET_EVENT
);
sock2
->
SetNotify
(
wxSOCKET_INPUT_FLAG
|
wxSOCKET_LOST_FLAG
);
sock2
->
Notify
(
TRUE
);
sock2
->
SetEventHandler
(
*
this
,
ID_EDA_SOCKET_EVENT
);
sock2
->
SetNotify
(
wxSOCKET_INPUT_FLAG
|
wxSOCKET_LOST_FLAG
);
}
/****************************/
/* Routines liees au CLIENT */
/*****************************/
/****************************/
/* Routines liees au CLIENT */
/*****************************/
/********************************************/
bool
SendCommand
(
int
service
,
char
*
cmdline
)
/********************************************/
/* Used by a client to sent (by a socket connection) a data to a server.
- Open a Socket Client connection
- Send the buffer cmdline
- Close the socket connection
/**************************************************/
bool
SendCommand
(
int
service
,
const
char
*
cmdline
)
/**************************************************/
service is the service number for the TC/IP connection
*/
/* Used by a client to sent (by a socket connection) a data to a server.
* - Open a Socket Client connection
* - Send the buffer cmdline
* - Close the socket connection
*
* service is the service number for the TC/IP connection
*/
{
wxSocketClient
*
sock_client
;
bool
success
=
FALSE
;
wxIPV4address
addr
;
// Create a connexion
addr
.
Hostname
(
HOSTNAME
);
addr
.
Service
(
service
);
// Mini-tutorial for Connect() :-) (JP CHARRAS Note: see wxWidgets: sockets/client.cpp sample)
// ---------------------------
//
// There are two ways to use Connect(): blocking and non-blocking,
// depending on the value passed as the 'wait' (2nd) parameter.
//
// Connect(addr, true) will wait until the connection completes,
// returning true on success and false on failure. This call blocks
// the GUI (this might be changed in future releases to honour the
// wxSOCKET_BLOCK flag).
//
// Connect(addr, false) will issue a nonblocking connection request
// and return immediately. If the return value is true, then the
// connection has been already successfully established. If it is
// false, you must wait for the request to complete, either with
// WaitOnConnect() or by watching wxSOCKET_CONNECTION / LOST
// events (please read the documentation).
//
// WaitOnConnect() itself never blocks the GUI (this might change
// in the future to honour the wxSOCKET_BLOCK flag). This call will
// return false on timeout, or true if the connection request
// completes, which in turn might mean:
//
// a) That the connection was successfully established
// b) That the connection request failed (for example, because
// it was refused by the peer.
//
// Use IsConnected() to distinguish between these two.
//
// So, in a brief, you should do one of the following things:
//
// For blocking Connect:
//
// bool success = client->Connect(addr, true);
//
// For nonblocking Connect:
//
// client->Connect(addr, false);
//
// bool waitmore = true;
// while (! client->WaitOnConnect(seconds, millis) && waitmore )
// {
// // possibly give some feedback to the user,
// // update waitmore if needed.
// }
// bool success = client->IsConnected();
//
// And that's all :-)
sock_client
=
new
wxSocketClient
();
sock_client
->
SetTimeout
(
2
);
// Time out in Seconds
sock_client
->
Connect
(
addr
,
FALSE
);
sock_client
->
WaitOnConnect
(
0
,
100
);
if
(
sock_client
->
Ok
()
&&
sock_client
->
IsConnected
())
{
success
=
TRUE
;
sock_client
->
SetFlags
(
wxSOCKET_NOWAIT
/*wxSOCKET_WAITALL*/
);
sock_client
->
Write
(
cmdline
,
strlen
(
cmdline
));
}
sock_client
->
Close
();
sock_client
->
Destroy
();
return
success
;
wxSocketClient
*
sock_client
;
bool
success
=
FALSE
;
wxIPV4address
addr
;
// Create a connexion
addr
.
Hostname
(
HOSTNAME
);
addr
.
Service
(
service
);
// Mini-tutorial for Connect() :-) (JP CHARRAS Note: see wxWidgets: sockets/client.cpp sample)
// ---------------------------
//
// There are two ways to use Connect(): blocking and non-blocking,
// depending on the value passed as the 'wait' (2nd) parameter.
//
// Connect(addr, true) will wait until the connection completes,
// returning true on success and false on failure. This call blocks
// the GUI (this might be changed in future releases to honour the
// wxSOCKET_BLOCK flag).
//
// Connect(addr, false) will issue a nonblocking connection request
// and return immediately. If the return value is true, then the
// connection has been already successfully established. If it is
// false, you must wait for the request to complete, either with
// WaitOnConnect() or by watching wxSOCKET_CONNECTION / LOST
// events (please read the documentation).
//
// WaitOnConnect() itself never blocks the GUI (this might change
// in the future to honour the wxSOCKET_BLOCK flag). This call will
// return false on timeout, or true if the connection request
// completes, which in turn might mean:
//
// a) That the connection was successfully established
// b) That the connection request failed (for example, because
// it was refused by the peer.
//
// Use IsConnected() to distinguish between these two.
//
// So, in a brief, you should do one of the following things:
//
// For blocking Connect:
//
// bool success = client->Connect(addr, true);
//
// For nonblocking Connect:
//
// client->Connect(addr, false);
//
// bool waitmore = true;
// while (! client->WaitOnConnect(seconds, millis) && waitmore )
// {
// // possibly give some feedback to the user,
// // update waitmore if needed.
// }
// bool success = client->IsConnected();
//
// And that's all :-)
sock_client
=
new
wxSocketClient
();
sock_client
->
SetTimeout
(
2
);
// Time out in Seconds
sock_client
->
Connect
(
addr
,
FALSE
);
sock_client
->
WaitOnConnect
(
0
,
100
);
if
(
sock_client
->
Ok
()
&&
sock_client
->
IsConnected
()
)
{
success
=
TRUE
;
sock_client
->
SetFlags
(
wxSOCKET_NOWAIT
/*wxSOCKET_WAITALL*/
);
sock_client
->
Write
(
cmdline
,
strlen
(
cmdline
)
);
}
sock_client
->
Close
();
sock_client
->
Destroy
();
return
success
;
}
eeschema/controle.cpp
View file @
51fc26e1
/****************/
/* controle.cpp */
/****************/
/****************/
/* controle.cpp */
/****************/
#include "fctsys.h"
...
...
@@ -21,345 +21,384 @@
/* variables externes */
#define MSG_TO_PCB KICAD_PCB_PORT_SERVICE_NUMBER
/**********************************/
void
RemoteCommand
(
const
char
*
cmdline
)
/**********************************/
/* Read a remote command sent from pcbnew, so when user selects a module
* or pin in pcbnew, eeschema shows that same component or pin.
*/
{
char
line
[
1024
];
char
*
idcmd
;
char
*
text
;
strncpy
(
line
,
cmdline
,
sizeof
(
line
)
-
1
);
idcmd
=
strtok
(
line
,
"
\n\r
"
);
text
=
strtok
(
NULL
,
"
\n\r
"
);
if
(
(
idcmd
==
NULL
)
||
(
text
==
NULL
)
)
return
;
if
(
strcmp
(
idcmd
,
"$PART:"
)
==
0
)
{
WinEDA_SchematicFrame
*
frame
=
EDA_Appl
->
SchematicFrame
;
wxString
msg
=
CONV_FROM_UTF8
(
text
);
frame
->
FindSchematicItem
(
msg
,
1
,
false
);
}
}
/**************************************************************/
EDA_BaseStruct
*
WinEDA_SchematicFrame
::
SchematicGeneralLocateAndDisplay
(
bool
IncludePin
)
EDA_BaseStruct
*
WinEDA_SchematicFrame
::
SchematicGeneralLocateAndDisplay
(
bool
IncludePin
)
/**************************************************************/
/* Routine de localisation et d'affichage des caract (si utile )
de l'element pointe par la souris ou par le curseur pcb
- marqueur
- noconnect
- jonction
- wire/bus/entry
- label
- composant
- pin
retourne
un pointeur sur le composant
Null sinon
*/
*
de l'element pointe par la souris ou par le curseur pcb
*
- marqueur
*
- noconnect
*
- jonction
*
- wire/bus/entry
*
- label
*
- composant
*
- pin
*
retourne
*
un pointeur sur le composant
*
Null sinon
*/
{
EDA_BaseStruct
*
DrawStruct
;
wxString
msg
;
wxPoint
mouse_position
=
GetScreen
()
->
m_MousePosition
;
LibDrawPin
*
Pin
=
NULL
;
EDA_SchComponentStruct
*
LibItem
=
NULL
;
char
Line
[
1024
];
DrawStruct
=
SchematicGeneralLocateAndDisplay
(
mouse_position
,
IncludePin
);
if
(
!
DrawStruct
&&
(
mouse_position
!=
GetScreen
()
->
m_Curseur
)
)
{
DrawStruct
=
SchematicGeneralLocateAndDisplay
(
GetScreen
()
->
m_Curseur
,
IncludePin
);
}
if
(
!
DrawStruct
)
return
NULL
;
/* Cross probing to pcbnew if a pin or a component is found */
switch
(
DrawStruct
->
m_StructType
)
{
case
COMPONENT_FIELD_DRAW_TYPE
:
{
PartTextStruct
*
Field
=
(
PartTextStruct
*
)
DrawStruct
;
LibItem
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
));
SendCommand
(
MSG_TO_PCB
,
Line
);
}
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
Pin
=
LocateAnyPin
(
m_CurrentScreen
->
EEDrawList
,
GetScreen
()
->
m_Curseur
,
&
LibItem
);
if
(
Pin
)
break
;
// Priority is probing a pin first
LibItem
=
(
EDA_SchComponentStruct
*
)
DrawStruct
;
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
break
;
default
:
Pin
=
LocateAnyPin
(
m_CurrentScreen
->
EEDrawList
,
GetScreen
()
->
m_Curseur
,
&
LibItem
);
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
Pin
=
(
LibDrawPin
*
)
DrawStruct
;
break
;
}
if
(
Pin
)
{
/* Force display pin infos (the previous display could be a component info) */
Pin
->
Display_Infos
(
this
);
if
(
LibItem
)
Affiche_1_Parametre
(
this
,
1
,
LibItem
->
m_Field
[
REFERENCE
].
m_Text
,
LibItem
->
m_Field
[
VALUE
].
m_Text
,
CYAN
);
// Cross probing:2 - pin found, and send a locate pin command to pcbnew (hightlight net)
if
(
Pin
->
m_PinNum
)
{
wxString
pinnum
;
Pin
->
ReturnPinStringNum
(
pinnum
);
sprintf
(
Line
,
"$PIN: %s $PART: %s"
,
CONV_TO_UTF8
(
pinnum
),
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
));
SendCommand
(
MSG_TO_PCB
,
Line
);
}
}
return
DrawStruct
;
EDA_BaseStruct
*
DrawStruct
;
wxString
msg
;
wxPoint
mouse_position
=
GetScreen
()
->
m_MousePosition
;
LibDrawPin
*
Pin
=
NULL
;
EDA_SchComponentStruct
*
LibItem
=
NULL
;
char
Line
[
1024
];
DrawStruct
=
SchematicGeneralLocateAndDisplay
(
mouse_position
,
IncludePin
);
if
(
!
DrawStruct
&&
(
mouse_position
!=
GetScreen
()
->
m_Curseur
)
)
{
DrawStruct
=
SchematicGeneralLocateAndDisplay
(
GetScreen
()
->
m_Curseur
,
IncludePin
);
}
if
(
!
DrawStruct
)
return
NULL
;
/* Cross probing to pcbnew if a pin or a component is found */
switch
(
DrawStruct
->
m_StructType
)
{
case
COMPONENT_FIELD_DRAW_TYPE
:
{
PartTextStruct
*
Field
=
(
PartTextStruct
*
)
DrawStruct
;
LibItem
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
}
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
Pin
=
LocateAnyPin
(
m_CurrentScreen
->
EEDrawList
,
GetScreen
()
->
m_Curseur
,
&
LibItem
);
if
(
Pin
)
break
;
// Priority is probing a pin first
LibItem
=
(
EDA_SchComponentStruct
*
)
DrawStruct
;
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
break
;
default
:
Pin
=
LocateAnyPin
(
m_CurrentScreen
->
EEDrawList
,
GetScreen
()
->
m_Curseur
,
&
LibItem
);
break
;
case
COMPONENT_PIN_DRAW_TYPE
:
Pin
=
(
LibDrawPin
*
)
DrawStruct
;
break
;
}
if
(
Pin
)
{
/* Force display pin infos (the previous display could be a component info) */
Pin
->
Display_Infos
(
this
);
if
(
LibItem
)
Affiche_1_Parametre
(
this
,
1
,
LibItem
->
m_Field
[
REFERENCE
].
m_Text
,
LibItem
->
m_Field
[
VALUE
].
m_Text
,
CYAN
);
// Cross probing:2 - pin found, and send a locate pin command to pcbnew (hightlight net)
if
(
Pin
->
m_PinNum
)
{
wxString
pinnum
;
Pin
->
ReturnPinStringNum
(
pinnum
);
sprintf
(
Line
,
"$PIN: %s $PART: %s"
,
CONV_TO_UTF8
(
pinnum
),
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
}
}
return
DrawStruct
;
}
/************************************************************************************/
EDA_BaseStruct
*
WinEDA_SchematicFrame
::
SchematicGeneralLocateAndDisplay
(
const
wxPoint
&
refpoint
,
bool
IncludePin
)
EDA_BaseStruct
*
WinEDA_SchematicFrame
::
SchematicGeneralLocateAndDisplay
(
const
wxPoint
&
refpoint
,
bool
IncludePin
)
/************************************************************************************/
/* Find the schematic item at position "refpoint"
the priority order is:
- marker
- noconnect
- junction
- wire/bus/entry
- label
- pin
- component
return:
an EDA_BaseStruct pointer on the item
a Null pointer if no item found
For some items, caracteristics are displayed on the screen.
*/
*
the priority order is:
*
- marker
*
- noconnect
*
- junction
*
- wire/bus/entry
*
- label
*
- pin
*
- component
*
return:
*
an EDA_BaseStruct pointer on the item
*
a Null pointer if no item found
*
*
For some items, caracteristics are displayed on the screen.
*/
{
EDA_BaseStruct
*
DrawStruct
;
LibDrawPin
*
Pin
;
EDA_SchComponentStruct
*
LibItem
;
wxString
Text
;
wxString
msg
;
int
ii
;
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
MARKERITEM
);
if
(
DrawStruct
)
{
DrawMarkerStruct
*
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
ii
=
Marker
->
m_Type
;
Text
=
Marker
->
GetComment
();
if
(
Text
.
IsEmpty
()
)
Text
=
wxT
(
"NoComment"
);
msg
=
NameMarqueurType
[
ii
];
msg
<<
wxT
(
" << "
)
<<
Text
;
Affiche_Message
(
msg
);
return
(
DrawStruct
);
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
NOCONNECTITEM
);
if
(
DrawStruct
)
{
MsgPanel
->
EraseMsgBox
();
return
(
DrawStruct
);
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
JUNCTIONITEM
);
if
(
DrawStruct
)
{
MsgPanel
->
EraseMsgBox
();
return
(
DrawStruct
);
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
WIREITEM
|
BUSITEM
|
RACCORDITEM
);
if
(
DrawStruct
)
// Search for a pin
{
Pin
=
LocateAnyPin
(
m_CurrentScreen
->
EEDrawList
,
refpoint
,
&
LibItem
);
if
(
Pin
)
{
Pin
->
Display_Infos
(
this
);
if
(
LibItem
)
Affiche_1_Parametre
(
this
,
1
,
LibItem
->
m_Field
[
REFERENCE
].
m_Text
,
LibItem
->
m_Field
[
VALUE
].
m_Text
,
CYAN
);
}
else
MsgPanel
->
EraseMsgBox
();
return
(
DrawStruct
);
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
FIELDCMPITEM
);
if
(
DrawStruct
)
{
PartTextStruct
*
Field
=
(
PartTextStruct
*
)
DrawStruct
;
LibItem
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
LibItem
->
Display_Infos
(
this
);
return
(
DrawStruct
);
}
/* search for a pin */
Pin
=
LocateAnyPin
(
m_CurrentScreen
->
EEDrawList
,
refpoint
,
&
LibItem
);
if
(
Pin
)
{
Pin
->
Display_Infos
(
this
);
if
(
LibItem
)
Affiche_1_Parametre
(
this
,
1
,
LibItem
->
m_Field
[
REFERENCE
].
m_Text
,
LibItem
->
m_Field
[
VALUE
].
m_Text
,
CYAN
);
if
(
IncludePin
==
TRUE
)
return
(
LibItem
);
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
LIBITEM
);
if
(
DrawStruct
)
{
DrawStruct
=
LocateSmallestComponent
(
GetScreen
()
);
LibItem
=
(
EDA_SchComponentStruct
*
)
DrawStruct
;
LibItem
->
Display_Infos
(
this
);
return
(
DrawStruct
);
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
SHEETITEM
);
if
(
DrawStruct
)
{
((
DrawSheetStruct
*
)
DrawStruct
)
->
Display_Infos
(
this
);
return
(
DrawStruct
);
}
// Recherche des autres elements
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
SEARCHALL
);
if
(
DrawStruct
)
{
return
(
DrawStruct
);
}
MsgPanel
->
EraseMsgBox
();
return
(
NULL
);
EDA_BaseStruct
*
DrawStruct
;
LibDrawPin
*
Pin
;
EDA_SchComponentStruct
*
LibItem
;
wxString
Text
;
wxString
msg
;
int
ii
;
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
MARKERITEM
);
if
(
DrawStruct
)
{
DrawMarkerStruct
*
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
ii
=
Marker
->
m_Type
;
Text
=
Marker
->
GetComment
();
if
(
Text
.
IsEmpty
()
)
Text
=
wxT
(
"NoComment"
);
msg
=
NameMarqueurType
[
ii
];
msg
<<
wxT
(
" << "
)
<<
Text
;
Affiche_Message
(
msg
);
return
DrawStruct
;
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
NOCONNECTITEM
);
if
(
DrawStruct
)
{
MsgPanel
->
EraseMsgBox
();
return
DrawStruct
;
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
JUNCTIONITEM
);
if
(
DrawStruct
)
{
MsgPanel
->
EraseMsgBox
();
return
DrawStruct
;
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
WIREITEM
|
BUSITEM
|
RACCORDITEM
);
if
(
DrawStruct
)
// Search for a pin
{
Pin
=
LocateAnyPin
(
m_CurrentScreen
->
EEDrawList
,
refpoint
,
&
LibItem
);
if
(
Pin
)
{
Pin
->
Display_Infos
(
this
);
if
(
LibItem
)
Affiche_1_Parametre
(
this
,
1
,
LibItem
->
m_Field
[
REFERENCE
].
m_Text
,
LibItem
->
m_Field
[
VALUE
].
m_Text
,
CYAN
);
}
else
MsgPanel
->
EraseMsgBox
();
return
DrawStruct
;
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
FIELDCMPITEM
);
if
(
DrawStruct
)
{
PartTextStruct
*
Field
=
(
PartTextStruct
*
)
DrawStruct
;
LibItem
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
LibItem
->
Display_Infos
(
this
);
return
DrawStruct
;
}
/* search for a pin */
Pin
=
LocateAnyPin
(
m_CurrentScreen
->
EEDrawList
,
refpoint
,
&
LibItem
);
if
(
Pin
)
{
Pin
->
Display_Infos
(
this
);
if
(
LibItem
)
Affiche_1_Parametre
(
this
,
1
,
LibItem
->
m_Field
[
REFERENCE
].
m_Text
,
LibItem
->
m_Field
[
VALUE
].
m_Text
,
CYAN
);
if
(
IncludePin
==
TRUE
)
return
LibItem
;
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
LIBITEM
);
if
(
DrawStruct
)
{
DrawStruct
=
LocateSmallestComponent
(
GetScreen
()
);
LibItem
=
(
EDA_SchComponentStruct
*
)
DrawStruct
;
LibItem
->
Display_Infos
(
this
);
return
DrawStruct
;
}
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
SHEETITEM
);
if
(
DrawStruct
)
{
(
(
DrawSheetStruct
*
)
DrawStruct
)
->
Display_Infos
(
this
);
return
DrawStruct
;
}
// Recherche des autres elements
DrawStruct
=
PickStruct
(
refpoint
,
GetScreen
()
->
EEDrawList
,
SEARCHALL
);
if
(
DrawStruct
)
{
return
DrawStruct
;
}
MsgPanel
->
EraseMsgBox
();
return
NULL
;
}
/***********************************************************************/
void
WinEDA_DrawFrame
::
GeneralControle
(
wxDC
*
DC
,
wxPoint
MousePositionInPixels
)
void
WinEDA_DrawFrame
::
GeneralControle
(
wxDC
*
DC
,
wxPoint
MousePositionInPixels
)
/***********************************************************************/
{
wxSize
delta
;
int
zoom
=
m_CurrentScreen
->
GetZoom
();
wxPoint
curpos
,
oldpos
;
int
hotkey
=
0
;
ActiveScreen
=
(
SCH_SCREEN
*
)
m_CurrentScreen
;
curpos
=
m_CurrentScreen
->
m_MousePosition
;
oldpos
=
m_CurrentScreen
->
m_Curseur
;
delta
.
x
=
m_CurrentScreen
->
GetGrid
().
x
/
zoom
;
delta
.
y
=
m_CurrentScreen
->
GetGrid
().
y
/
zoom
;
if
(
delta
.
x
<=
0
)
delta
.
x
=
1
;
if
(
delta
.
y
<=
0
)
delta
.
y
=
1
;
switch
(
g_KeyPressed
)
{
case
EDA_PANNING_UP_KEY
:
OnZoom
(
ID_ZOOM_PANNING_UP
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
EDA_PANNING_DOWN_KEY
:
OnZoom
(
ID_ZOOM_PANNING_DOWN
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
EDA_PANNING_LEFT_KEY
:
OnZoom
(
ID_ZOOM_PANNING_LEFT
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
EDA_PANNING_RIGHT_KEY
:
OnZoom
(
ID_ZOOM_PANNING_RIGHT
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
WXK_F1
:
OnZoom
(
ID_ZOOM_PLUS_KEY
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
WXK_F2
:
OnZoom
(
ID_ZOOM_MOINS_KEY
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
WXK_F3
:
OnZoom
(
ID_ZOOM_REDRAW_KEY
);
break
;
case
WXK_F4
:
OnZoom
(
ID_ZOOM_CENTER_KEY
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
' '
:
// Remise a zero coord relatives
m_CurrentScreen
->
m_O_Curseur
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
WXK_NUMPAD8
:
/* Deplacement curseur vers le haut */
case
WXK_UP
:
MousePositionInPixels
.
y
-=
delta
.
y
;
DrawPanel
->
MouseTo
(
MousePositionInPixels
);
break
;
case
WXK_NUMPAD2
:
/* Deplacement curseur vers le bas */
case
WXK_DOWN
:
MousePositionInPixels
.
y
+=
delta
.
y
;
DrawPanel
->
MouseTo
(
MousePositionInPixels
);
break
;
case
WXK_NUMPAD4
:
/* Deplacement curseur vers la gauche */
case
WXK_LEFT
:
MousePositionInPixels
.
x
-=
delta
.
x
;
DrawPanel
->
MouseTo
(
MousePositionInPixels
);
break
;
case
WXK_NUMPAD6
:
/* Deplacement curseur vers la droite */
case
WXK_RIGHT
:
MousePositionInPixels
.
x
+=
delta
.
x
;
DrawPanel
->
MouseTo
(
MousePositionInPixels
);
break
;
default
:
hotkey
=
g_KeyPressed
;
break
;
}
/* Recalcul de la position du curseur schema */
m_CurrentScreen
->
m_Curseur
=
curpos
;
/* Placement sur la grille generale */
PutOnGrid
(
&
m_CurrentScreen
->
m_Curseur
);
if
(
m_CurrentScreen
->
IsRefreshReq
()
)
{
RedrawActiveWindow
(
DC
,
TRUE
);
}
if
(
oldpos
!=
m_CurrentScreen
->
m_Curseur
)
{
curpos
=
m_CurrentScreen
->
m_Curseur
;
m_CurrentScreen
->
m_Curseur
=
oldpos
;
DrawPanel
->
CursorOff
(
DC
);
m_CurrentScreen
->
m_Curseur
=
curpos
;
DrawPanel
->
CursorOn
(
DC
);
if
(
DrawPanel
->
ManageCurseur
)
{
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
TRUE
);
}
}
Affiche_Status_Box
();
/* Affichage des coord curseur */
if
(
hotkey
)
{
if
(
m_CurrentScreen
->
m_CurrentItem
&&
m_CurrentScreen
->
m_CurrentItem
->
m_Flags
)
OnHotKey
(
DC
,
hotkey
,
m_CurrentScreen
->
m_CurrentItem
);
else
OnHotKey
(
DC
,
hotkey
,
NULL
);
}
wxSize
delta
;
int
zoom
=
m_CurrentScreen
->
GetZoom
();
wxPoint
curpos
,
oldpos
;
int
hotkey
=
0
;
ActiveScreen
=
(
SCH_SCREEN
*
)
m_CurrentScreen
;
curpos
=
m_CurrentScreen
->
m_MousePosition
;
oldpos
=
m_CurrentScreen
->
m_Curseur
;
delta
.
x
=
m_CurrentScreen
->
GetGrid
().
x
/
zoom
;
delta
.
y
=
m_CurrentScreen
->
GetGrid
().
y
/
zoom
;
if
(
delta
.
x
<=
0
)
delta
.
x
=
1
;
if
(
delta
.
y
<=
0
)
delta
.
y
=
1
;
switch
(
g_KeyPressed
)
{
case
EDA_PANNING_UP_KEY
:
OnZoom
(
ID_ZOOM_PANNING_UP
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
EDA_PANNING_DOWN_KEY
:
OnZoom
(
ID_ZOOM_PANNING_DOWN
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
EDA_PANNING_LEFT_KEY
:
OnZoom
(
ID_ZOOM_PANNING_LEFT
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
EDA_PANNING_RIGHT_KEY
:
OnZoom
(
ID_ZOOM_PANNING_RIGHT
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
WXK_F1
:
OnZoom
(
ID_ZOOM_PLUS_KEY
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
WXK_F2
:
OnZoom
(
ID_ZOOM_MOINS_KEY
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
WXK_F3
:
OnZoom
(
ID_ZOOM_REDRAW_KEY
);
break
;
case
WXK_F4
:
OnZoom
(
ID_ZOOM_CENTER_KEY
);
curpos
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
' '
:
// Remise a zero coord relatives
m_CurrentScreen
->
m_O_Curseur
=
m_CurrentScreen
->
m_Curseur
;
break
;
case
WXK_NUMPAD8
:
/* Deplacement curseur vers le haut */
case
WXK_UP
:
MousePositionInPixels
.
y
-=
delta
.
y
;
DrawPanel
->
MouseTo
(
MousePositionInPixels
);
break
;
case
WXK_NUMPAD2
:
/* Deplacement curseur vers le bas */
case
WXK_DOWN
:
MousePositionInPixels
.
y
+=
delta
.
y
;
DrawPanel
->
MouseTo
(
MousePositionInPixels
);
break
;
case
WXK_NUMPAD4
:
/* Deplacement curseur vers la gauche */
case
WXK_LEFT
:
MousePositionInPixels
.
x
-=
delta
.
x
;
DrawPanel
->
MouseTo
(
MousePositionInPixels
);
break
;
case
WXK_NUMPAD6
:
/* Deplacement curseur vers la droite */
case
WXK_RIGHT
:
MousePositionInPixels
.
x
+=
delta
.
x
;
DrawPanel
->
MouseTo
(
MousePositionInPixels
);
break
;
default
:
hotkey
=
g_KeyPressed
;
break
;
}
/* Recalcul de la position du curseur schema */
m_CurrentScreen
->
m_Curseur
=
curpos
;
/* Placement sur la grille generale */
PutOnGrid
(
&
m_CurrentScreen
->
m_Curseur
);
if
(
m_CurrentScreen
->
IsRefreshReq
()
)
{
RedrawActiveWindow
(
DC
,
TRUE
);
}
if
(
oldpos
!=
m_CurrentScreen
->
m_Curseur
)
{
curpos
=
m_CurrentScreen
->
m_Curseur
;
m_CurrentScreen
->
m_Curseur
=
oldpos
;
DrawPanel
->
CursorOff
(
DC
);
m_CurrentScreen
->
m_Curseur
=
curpos
;
DrawPanel
->
CursorOn
(
DC
);
if
(
DrawPanel
->
ManageCurseur
)
{
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
TRUE
);
}
}
Affiche_Status_Box
();
/* Affichage des coord curseur */
if
(
hotkey
)
{
if
(
m_CurrentScreen
->
m_CurrentItem
&&
m_CurrentScreen
->
m_CurrentItem
->
m_Flags
)
OnHotKey
(
DC
,
hotkey
,
m_CurrentScreen
->
m_CurrentItem
);
else
OnHotKey
(
DC
,
hotkey
,
NULL
);
}
}
eeschema/eeschema.cpp
View file @
51fc26e1
...
...
@@ -20,10 +20,10 @@
#include "netlist.h"
#include "worksheet.h"
#include "trigo.h"
#include "protos.h"
#include "bitmaps.h"
#include "eda_dde.h"
/* Routines locales */
static
void
CreateScreens
(
void
);
...
...
@@ -72,6 +72,13 @@ wxString FFileName;
SetTopWindow
(
SchematicFrame
);
SchematicFrame
->
Show
(
TRUE
);
if
(
CreateServer
(
SchematicFrame
,
KICAD_SCH_PORT_SERVICE_NUMBER
)
)
{
// RemoteCommand is in controle.cpp and is called when PCBNEW
// sends EESCHEMA a command
SetupServerFunction
(
RemoteCommand
);
}
SchematicFrame
->
Zoom_Automatique
(
TRUE
);
/* Load file specified in the command line. */
...
...
eeschema/find.cpp
View file @
51fc26e1
/****************************************************************/
/* EESchema: find.cpp (functions for seraching a schematic item */
/****************************************************************/
/****************************************************************/
/* EESchema: find.cpp (functions for seraching a schematic item */
/****************************************************************/
/*
Search a text (text, value, reference) withing e composent or
search a composant in libraries, a marker ...,
in current sheet or whole the project
*/
*
Search a text (text, value, reference) withing e composent or
*
search a composant in libraries, a marker ...,
*
in current sheet or whole the project
*/
#include "fctsys.h"
#include "gr_basic.h"
...
...
@@ -15,7 +16,7 @@
#include "general.h"
/* Variables Locales */
static
int
s_ItemsCount
,
s_MarkerCount
;
static
int
s_ItemsCount
,
s_MarkerCount
;
static
wxString
s_OldStringFound
;
#include "dialog_find.cpp"
...
...
@@ -24,470 +25,534 @@ static wxString s_OldStringFound;
#include "protos.h"
/**************************************************************/
void
InstallFindFrame
(
WinEDA_SchematicFrame
*
parent
,
wxPoint
&
pos
)
void
InstallFindFrame
(
WinEDA_SchematicFrame
*
parent
,
wxPoint
&
pos
)
/**************************************************************/
{
parent
->
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
WinEDA_FindFrame
*
frame
=
new
WinEDA_FindFrame
(
parent
);
frame
->
ShowModal
();
frame
->
Destroy
();
parent
->
DrawPanel
->
m_IgnoreMouseEvents
=
FALSE
;
parent
->
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
WinEDA_FindFrame
*
frame
=
new
WinEDA_FindFrame
(
parent
);
frame
->
ShowModal
();
frame
->
Destroy
();
parent
->
DrawPanel
->
m_IgnoreMouseEvents
=
FALSE
;
}
/**************************************************************/
void
WinEDA_FindFrame
::
FindMarker
(
wxCommandEvent
&
event
)
void
WinEDA_FindFrame
::
FindMarker
(
wxCommandEvent
&
event
)
/**************************************************************/
/* Search de markers in whole the hierarchy.
Mouse cursor is put on the marker
search the first marker, or next marker
*/
*
Mouse cursor is put on the marker
*
search the first marker, or next marker
*/
{
int
id
=
event
.
GetId
();
if
(
id
!=
FIND_NEXT_MARKER
)
m_Parent
->
FindMarker
(
0
);
else
m_Parent
->
FindMarker
(
1
);
int
id
=
event
.
GetId
();
if
(
id
!=
FIND_NEXT_MARKER
)
m_Parent
->
FindMarker
(
0
);
else
m_Parent
->
FindMarker
(
1
);
Close
();
Close
();
}
/*****************************************************************/
EDA_BaseStruct
*
WinEDA_SchematicFrame
::
FindMarker
(
int
SearchType
)
EDA_BaseStruct
*
WinEDA_SchematicFrame
::
FindMarker
(
int
SearchType
)
/*****************************************************************/
/* Search markers in whole the hierarchy.
Mouse cursor is put on the marker
SearchType = 0: search the first marker, else search next marker
*/
*
Mouse cursor is put on the marker
*
SearchType = 0: search the first marker, else search next marker
*/
{
SCH_SCREEN
*
Screen
,
*
FirstScreen
=
NULL
;
EDA_BaseStruct
*
DrawList
,
*
FirstStruct
=
NULL
,
*
Struct
=
NULL
;
DrawMarkerStruct
*
Marker
=
NULL
;
int
StartCount
;
bool
NotFound
;
wxPoint
firstpos
,
pos
;
wxSize
size
=
DrawPanel
->
GetClientSize
();
wxPoint
curpos
,
old_cursor_position
;
bool
force_recadre
=
FALSE
;
wxString
msg
,
WildText
;
g_LastSearchIsMarker
=
TRUE
;
/* Set s_MarkerCount to 0 if we are look for the first marker */
if
(
SearchType
==
0
)
s_MarkerCount
=
0
;
EDA_ScreenList
ScreenList
(
NULL
);
NotFound
=
TRUE
;
StartCount
=
0
;
/* Search for s_MarkerCount markers */
for
(
Screen
=
ScreenList
.
GetFirst
();
Screen
!=
NULL
;
Screen
=
ScreenList
.
GetNext
()
)
{
DrawList
=
Screen
->
EEDrawList
;
while
(
DrawList
&&
NotFound
)
{
if
(
DrawList
->
m_StructType
==
DRAW_MARKER_STRUCT_TYPE
)
{
Marker
=
(
DrawMarkerStruct
*
)
DrawList
;
NotFound
=
FALSE
;
pos
=
Marker
->
m_Pos
;
if
(
FirstScreen
==
NULL
)
/* First item found */
{
FirstScreen
=
Screen
;
firstpos
=
pos
;
FirstStruct
=
DrawList
;
}
StartCount
++
;
if
(
s_MarkerCount
>=
StartCount
)
{
NotFound
=
TRUE
;
/* Search for other markers */
}
else
/* We have found s_MarkerCount markers -> Ok */
{
Struct
=
DrawList
;
s_MarkerCount
++
;
break
;
}
}
DrawList
=
DrawList
->
Pnext
;
}
if
(
NotFound
==
FALSE
)
break
;
}
if
(
NotFound
&&
FirstScreen
)
// markers are found, but we have reach the last marker */
{
// After the last marker, the first marker is used */
NotFound
=
FALSE
;
Screen
=
FirstScreen
;
Struct
=
FirstStruct
;
pos
=
firstpos
;
s_MarkerCount
=
1
;
}
if
(
NotFound
==
FALSE
)
{
if
(
Screen
!=
GetScreen
()
)
{
Screen
->
SetZoom
(
GetScreen
()
->
GetZoom
()
);
m_CurrentScreen
=
ActiveScreen
=
Screen
;
force_recadre
=
TRUE
;
}
old_cursor_position
=
Screen
->
m_Curseur
;
Screen
->
m_Curseur
=
pos
;
curpos
=
DrawPanel
->
CursorScreenPosition
();
// calcul des coord curseur avec origine = screen
DrawPanel
->
GetViewStart
(
&
m_CurrentScreen
->
m_StartVisu
.
x
,
&
m_CurrentScreen
->
m_StartVisu
.
y
);
curpos
.
x
-=
m_CurrentScreen
->
m_StartVisu
.
x
;
curpos
.
y
-=
m_CurrentScreen
->
m_StartVisu
.
y
;
/* Il y a peut-etre necessite de recadrer le dessin: */
if
(
(
curpos
.
x
<=
0
)
||
(
curpos
.
x
>=
size
.
x
-
1
)
||
(
curpos
.
y
<=
0
)
||
(
curpos
.
y
>=
size
.
y
)
||
force_recadre
)
{
Recadre_Trace
(
TRUE
);
}
else
{
wxClientDC
dc
(
DrawPanel
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
EXCHG
(
old_cursor_position
,
Screen
->
m_Curseur
);
DrawPanel
->
CursorOff
(
&
dc
);
GRMouseWarp
(
DrawPanel
,
curpos
);
EXCHG
(
old_cursor_position
,
Screen
->
m_Curseur
);
DrawPanel
->
CursorOn
(
&
dc
);
}
msg
.
Printf
(
_
(
"Marker %d found in %s"
),
s_MarkerCount
,
Screen
->
m_FileName
.
GetData
());
Affiche_Message
(
msg
);
}
else
{
Affiche_Message
(
wxEmptyString
);
msg
=
_
(
"Marker Not Found"
);
DisplayError
(
this
,
msg
,
10
);
}
return
Marker
;
SCH_SCREEN
*
Screen
,
*
FirstScreen
=
NULL
;
EDA_BaseStruct
*
DrawList
,
*
FirstStruct
=
NULL
,
*
Struct
=
NULL
;
DrawMarkerStruct
*
Marker
=
NULL
;
int
StartCount
;
bool
NotFound
;
wxPoint
firstpos
,
pos
;
wxSize
size
=
DrawPanel
->
GetClientSize
();
wxPoint
curpos
,
old_cursor_position
;
bool
force_recadre
=
FALSE
;
wxString
msg
,
WildText
;
g_LastSearchIsMarker
=
TRUE
;
/* Set s_MarkerCount to 0 if we are look for the first marker */
if
(
SearchType
==
0
)
s_MarkerCount
=
0
;
EDA_ScreenList
ScreenList
(
NULL
);
NotFound
=
TRUE
;
StartCount
=
0
;
/* Search for s_MarkerCount markers */
for
(
Screen
=
ScreenList
.
GetFirst
();
Screen
!=
NULL
;
Screen
=
ScreenList
.
GetNext
()
)
{
DrawList
=
Screen
->
EEDrawList
;
while
(
DrawList
&&
NotFound
)
{
if
(
DrawList
->
m_StructType
==
DRAW_MARKER_STRUCT_TYPE
)
{
Marker
=
(
DrawMarkerStruct
*
)
DrawList
;
NotFound
=
FALSE
;
pos
=
Marker
->
m_Pos
;
if
(
FirstScreen
==
NULL
)
/* First item found */
{
FirstScreen
=
Screen
;
firstpos
=
pos
;
FirstStruct
=
DrawList
;
}
StartCount
++
;
if
(
s_MarkerCount
>=
StartCount
)
{
NotFound
=
TRUE
;
/* Search for other markers */
}
else
/* We have found s_MarkerCount markers -> Ok */
{
Struct
=
DrawList
;
s_MarkerCount
++
;
break
;
}
}
DrawList
=
DrawList
->
Pnext
;
}
if
(
NotFound
==
FALSE
)
break
;
}
if
(
NotFound
&&
FirstScreen
)
// markers are found, but we have reach the last marker */
{
// After the last marker, the first marker is used */
NotFound
=
FALSE
;
Screen
=
FirstScreen
;
Struct
=
FirstStruct
;
pos
=
firstpos
;
s_MarkerCount
=
1
;
}
if
(
NotFound
==
FALSE
)
{
if
(
Screen
!=
GetScreen
()
)
{
Screen
->
SetZoom
(
GetScreen
()
->
GetZoom
()
);
m_CurrentScreen
=
ActiveScreen
=
Screen
;
force_recadre
=
TRUE
;
}
old_cursor_position
=
Screen
->
m_Curseur
;
Screen
->
m_Curseur
=
pos
;
curpos
=
DrawPanel
->
CursorScreenPosition
();
// calcul des coord curseur avec origine = screen
DrawPanel
->
GetViewStart
(
&
m_CurrentScreen
->
m_StartVisu
.
x
,
&
m_CurrentScreen
->
m_StartVisu
.
y
);
curpos
.
x
-=
m_CurrentScreen
->
m_StartVisu
.
x
;
curpos
.
y
-=
m_CurrentScreen
->
m_StartVisu
.
y
;
/* Il y a peut-etre necessite de recadrer le dessin: */
if
(
(
curpos
.
x
<=
0
)
||
(
curpos
.
x
>=
size
.
x
-
1
)
||
(
curpos
.
y
<=
0
)
||
(
curpos
.
y
>=
size
.
y
)
||
force_recadre
)
{
Recadre_Trace
(
TRUE
);
}
else
{
wxClientDC
dc
(
DrawPanel
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
EXCHG
(
old_cursor_position
,
Screen
->
m_Curseur
);
DrawPanel
->
CursorOff
(
&
dc
);
GRMouseWarp
(
DrawPanel
,
curpos
);
EXCHG
(
old_cursor_position
,
Screen
->
m_Curseur
);
DrawPanel
->
CursorOn
(
&
dc
);
}
msg
.
Printf
(
_
(
"Marker %d found in %s"
),
s_MarkerCount
,
Screen
->
m_FileName
.
GetData
()
);
Affiche_Message
(
msg
);
}
else
{
Affiche_Message
(
wxEmptyString
);
msg
=
_
(
"Marker Not Found"
);
DisplayError
(
this
,
msg
,
10
);
}
return
Marker
;
}
/**************************************************************/
void
WinEDA_FindFrame
::
FindSchematicItem
(
wxCommandEvent
&
event
)
void
WinEDA_FindFrame
::
FindSchematicItem
(
wxCommandEvent
&
event
)
/**************************************************************/
/* Find a string in schematic.
Call to WinEDA_SchematicFrame::FindSchematicItem()
*/
*
Call to WinEDA_SchematicFrame::FindSchematicItem()
*/
{
int
id
=
event
.
GetId
();
int
id
=
event
.
GetId
();
if
(
id
==
FIND_SHEET
)
m_Parent
->
FindSchematicItem
(
m_NewTextCtrl
->
GetValue
(),
0
);
else
if
(
id
==
FIND_HIERARCHY
)
m_Parent
->
FindSchematicItem
(
m_NewTextCtrl
->
GetValue
(),
1
);
else
if
(
id
==
FIND_NEXT
)
m_Parent
->
FindSchematicItem
(
wxEmptyString
,
2
);
if
(
id
==
FIND_SHEET
)
m_Parent
->
FindSchematicItem
(
m_NewTextCtrl
->
GetValue
(),
0
);
else
if
(
id
==
FIND_HIERARCHY
)
m_Parent
->
FindSchematicItem
(
m_NewTextCtrl
->
GetValue
(),
1
);
else
if
(
id
==
FIND_NEXT
)
m_Parent
->
FindSchematicItem
(
wxEmptyString
,
2
);
Close
();
Close
();
}
/************************************************************************/
EDA_BaseStruct
*
WinEDA_SchematicFrame
::
FindSchematicItem
(
const
wxString
&
pattern
,
int
SearchType
)
EDA_BaseStruct
*
WinEDA_SchematicFrame
::
FindSchematicItem
(
const
wxString
&
pattern
,
int
SearchType
,
bool
mouseWarp
)
/************************************************************************/
/* Find a string in schematic.
Search is made in current sheet (SearchType = 0),
or the whole hierarchy (SearchType = 1),
or for the next item (SearchType = 2).
Mouse cursor is put on item
*/
/**
* Function FindSchematicItem
* finds a string in the schematic.
* @param pattern The text to search for, either in value, reference or elsewhere.
* @param SearchType: 0 => Search is made in current sheet
* 1 => the whole hierarchy
* 2 => or for the next item
* @param mouseWarp If true, then move the mouse cursor to the item.
*/
{
SCH_SCREEN
*
Screen
,
*
FirstScreen
=
NULL
;
EDA_BaseStruct
*
DrawList
=
NULL
,
*
FirstStruct
=
NULL
,
*
Struct
=
NULL
;
int
StartCount
,
ii
,
jj
;
bool
NotFound
;
wxPoint
firstpos
,
pos
,
old_cursor_position
;
static
int
Find_in_hierarchy
;
wxSize
size
=
DrawPanel
->
GetClientSize
();
wxPoint
curpos
;
bool
force_recadre
=
FALSE
;
wxString
msg
,
WildText
;
g_LastSearchIsMarker
=
FALSE
;
if
(
SearchType
==
0
)
{
s_OldStringFound
=
pattern
;
Find_in_hierarchy
=
FALSE
;
}
if
(
SearchType
==
1
)
{
s_OldStringFound
=
pattern
;
Find_in_hierarchy
=
TRUE
;
}
if
(
SearchType
!=
2
)
s_ItemsCount
=
0
;
WildText
=
s_OldStringFound
;
NotFound
=
TRUE
;
StartCount
=
0
;
EDA_ScreenList
ScreenList
(
NULL
);
Screen
=
ScreenList
.
GetFirst
();
if
(
!
Find_in_hierarchy
)
Screen
=
(
SCH_SCREEN
*
)
m_CurrentScreen
;
for
(
;
Screen
!=
NULL
;
Screen
=
ScreenList
.
GetNext
()
)
{
DrawList
=
Screen
->
EEDrawList
;
while
(
DrawList
)
{
switch
(
DrawList
->
m_StructType
)
{
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((EDA_SchComponentStruct*)DrawList)
if
(
WildCompareString
(
WildText
,
STRUCT
->
m_Field
[
REFERENCE
].
m_Text
,
FALSE
)
)
{
NotFound
=
FALSE
;
pos
=
STRUCT
->
m_Field
[
REFERENCE
].
m_Pos
;
break
;
}
if
(
WildCompareString
(
WildText
,
STRUCT
->
m_Field
[
VALUE
].
m_Text
,
FALSE
)
)
{
NotFound
=
FALSE
;
pos
=
STRUCT
->
m_Field
[
VALUE
].
m_Pos
;
}
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawTextStruct*)DrawList)
if
(
WildCompareString
(
WildText
,
STRUCT
->
m_Text
,
FALSE
)
)
{
NotFound
=
FALSE
;
pos
=
STRUCT
->
m_Pos
;
}
break
;
default
:
break
;
}
if
(
NotFound
==
FALSE
)
/* Element trouve */
{
if
(
FirstScreen
==
NULL
)
/* 1er element trouve */
{
FirstScreen
=
Screen
;
firstpos
=
pos
;
FirstStruct
=
DrawList
;
}
StartCount
++
;
if
(
s_ItemsCount
>=
StartCount
)
{
NotFound
=
TRUE
;
/* Continue recherche de l'element suivant */
}
else
{
Struct
=
DrawList
;
s_ItemsCount
++
;
break
;
}
}
if
(
NotFound
==
FALSE
)
break
;
DrawList
=
DrawList
->
Pnext
;
}
if
(
NotFound
==
FALSE
)
break
;
if
(
Find_in_hierarchy
==
FALSE
)
break
;
}
if
(
NotFound
&&
FirstScreen
)
{
NotFound
=
FALSE
;
Screen
=
FirstScreen
;
Struct
=
FirstStruct
;
pos
=
firstpos
;
s_ItemsCount
=
1
;
}
if
(
NotFound
==
FALSE
)
{
if
(
Screen
!=
GetScreen
()
)
{
Screen
->
SetZoom
(
GetScreen
()
->
GetZoom
()
);
m_CurrentScreen
=
ActiveScreen
=
Screen
;
force_recadre
=
TRUE
;
}
/* Si la struct localisee est du type DRAW_LIB_ITEM_STRUCT_TYPE,
Les coordonnes sont a recalculer en fonction de la matrice
d'orientation */
if
(
Struct
->
m_StructType
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
{
#undef STRUCT
#define STRUCT ((EDA_SchComponentStruct*)Struct)
pos
.
x
-=
STRUCT
->
m_Pos
.
x
;
pos
.
y
-=
STRUCT
->
m_Pos
.
y
;
ii
=
STRUCT
->
m_Transform
[
0
][
0
]
*
pos
.
x
+
STRUCT
->
m_Transform
[
0
][
1
]
*
pos
.
y
;
jj
=
STRUCT
->
m_Transform
[
1
][
0
]
*
pos
.
x
+
STRUCT
->
m_Transform
[
1
][
1
]
*
pos
.
y
;
pos
.
x
=
ii
+
STRUCT
->
m_Pos
.
x
;
pos
.
y
=
jj
+
STRUCT
->
m_Pos
.
y
;
}
old_cursor_position
=
Screen
->
m_Curseur
;
Screen
->
m_Curseur
=
pos
;
curpos
=
DrawPanel
->
CursorScreenPosition
();
DrawPanel
->
GetViewStart
(
&
m_CurrentScreen
->
m_StartVisu
.
x
,
&
m_CurrentScreen
->
m_StartVisu
.
y
);
// calcul des coord curseur avec origine = screen
curpos
.
x
-=
m_CurrentScreen
->
m_StartVisu
.
x
;
curpos
.
y
-=
m_CurrentScreen
->
m_StartVisu
.
y
;
/* Il y a peut-etre necessite de recadrer le dessin: */
if
(
(
curpos
.
x
<=
0
)
||
(
curpos
.
x
>=
size
.
x
-
1
)
||
(
curpos
.
y
<=
0
)
||
(
curpos
.
y
>=
size
.
y
)
||
force_recadre
)
{
Recadre_Trace
(
TRUE
);
}
else
{
wxClientDC
dc
(
DrawPanel
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
EXCHG
(
old_cursor_position
,
Screen
->
m_Curseur
);
DrawPanel
->
CursorOff
(
&
dc
);
GRMouseWarp
(
DrawPanel
,
curpos
);
EXCHG
(
old_cursor_position
,
Screen
->
m_Curseur
);
DrawPanel
->
CursorOn
(
&
dc
);
}
msg
=
WildText
+
_
(
" Found in "
)
+
Screen
->
m_FileName
;
Affiche_Message
(
msg
);
}
else
{
Affiche_Message
(
wxEmptyString
);
msg
=
WildText
+
_
(
" Not Found"
);
DisplayError
(
this
,
msg
,
10
);
}
return
DrawList
;
SCH_SCREEN
*
Screen
,
*
FirstScreen
=
NULL
;
EDA_BaseStruct
*
DrawList
=
NULL
,
*
FirstStruct
=
NULL
,
*
Struct
=
NULL
;
int
StartCount
,
ii
,
jj
;
bool
NotFound
;
wxPoint
firstpos
,
pos
,
old_cursor_position
;
static
int
Find_in_hierarchy
;
wxSize
size
=
DrawPanel
->
GetClientSize
();
wxPoint
curpos
;
bool
force_recadre
=
FALSE
;
wxString
msg
,
WildText
;
g_LastSearchIsMarker
=
FALSE
;
if
(
SearchType
==
0
)
{
s_OldStringFound
=
pattern
;
Find_in_hierarchy
=
FALSE
;
}
if
(
SearchType
==
1
)
{
s_OldStringFound
=
pattern
;
Find_in_hierarchy
=
TRUE
;
}
if
(
SearchType
!=
2
)
s_ItemsCount
=
0
;
WildText
=
s_OldStringFound
;
NotFound
=
TRUE
;
StartCount
=
0
;
EDA_ScreenList
ScreenList
(
NULL
);
Screen
=
ScreenList
.
GetFirst
();
if
(
!
Find_in_hierarchy
)
Screen
=
(
SCH_SCREEN
*
)
m_CurrentScreen
;
for
(
;
Screen
!=
NULL
;
Screen
=
ScreenList
.
GetNext
()
)
{
DrawList
=
Screen
->
EEDrawList
;
while
(
DrawList
)
{
switch
(
DrawList
->
m_StructType
)
{
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
EDA_SchComponentStruct
*
pSch
;
pSch
=
(
EDA_SchComponentStruct
*
)
DrawList
;
if
(
WildCompareString
(
WildText
,
pSch
->
m_Field
[
REFERENCE
].
m_Text
,
FALSE
)
)
{
NotFound
=
FALSE
;
pos
=
pSch
->
m_Field
[
REFERENCE
].
m_Pos
;
break
;
}
if
(
WildCompareString
(
WildText
,
pSch
->
m_Field
[
VALUE
].
m_Text
,
FALSE
)
)
{
NotFound
=
FALSE
;
pos
=
pSch
->
m_Field
[
VALUE
].
m_Pos
;
}
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
DrawTextStruct
*
pDraw
;
pDraw
=
(
DrawTextStruct
*
)
DrawList
;
if
(
WildCompareString
(
WildText
,
pDraw
->
m_Text
,
FALSE
)
)
{
NotFound
=
FALSE
;
pos
=
pDraw
->
m_Pos
;
}
break
;
default
:
break
;
}
if
(
NotFound
==
FALSE
)
/* Element trouve */
{
if
(
FirstScreen
==
NULL
)
/* 1er element trouve */
{
FirstScreen
=
Screen
;
firstpos
=
pos
;
FirstStruct
=
DrawList
;
}
StartCount
++
;
if
(
s_ItemsCount
>=
StartCount
)
{
NotFound
=
TRUE
;
/* Continue recherche de l'element suivant */
}
else
{
Struct
=
DrawList
;
s_ItemsCount
++
;
break
;
}
}
if
(
NotFound
==
FALSE
)
break
;
DrawList
=
DrawList
->
Pnext
;
}
if
(
NotFound
==
FALSE
)
break
;
if
(
Find_in_hierarchy
==
FALSE
)
break
;
}
if
(
NotFound
&&
FirstScreen
)
{
NotFound
=
FALSE
;
Screen
=
FirstScreen
;
Struct
=
FirstStruct
;
pos
=
firstpos
;
s_ItemsCount
=
1
;
}
if
(
NotFound
==
FALSE
)
{
if
(
Screen
!=
GetScreen
()
)
{
Screen
->
SetZoom
(
GetScreen
()
->
GetZoom
()
);
m_CurrentScreen
=
ActiveScreen
=
Screen
;
force_recadre
=
TRUE
;
}
/* Si la struct localisee est du type DRAW_LIB_ITEM_STRUCT_TYPE,
* Les coordonnes sont a recalculer en fonction de la matrice
* d'orientation */
if
(
Struct
->
m_StructType
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
{
EDA_SchComponentStruct
*
pSch
=
(
EDA_SchComponentStruct
*
)
Struct
;
pos
.
x
-=
pSch
->
m_Pos
.
x
;
pos
.
y
-=
pSch
->
m_Pos
.
y
;
ii
=
pSch
->
m_Transform
[
0
][
0
]
*
pos
.
x
+
pSch
->
m_Transform
[
0
][
1
]
*
pos
.
y
;
jj
=
pSch
->
m_Transform
[
1
][
0
]
*
pos
.
x
+
pSch
->
m_Transform
[
1
][
1
]
*
pos
.
y
;
pos
.
x
=
ii
+
pSch
->
m_Pos
.
x
;
pos
.
y
=
jj
+
pSch
->
m_Pos
.
y
;
}
old_cursor_position
=
Screen
->
m_Curseur
;
Screen
->
m_Curseur
=
pos
;
curpos
=
DrawPanel
->
CursorScreenPosition
();
DrawPanel
->
GetViewStart
(
&
m_CurrentScreen
->
m_StartVisu
.
x
,
&
m_CurrentScreen
->
m_StartVisu
.
y
);
// calcul des coord curseur avec origine = screen
curpos
.
x
-=
m_CurrentScreen
->
m_StartVisu
.
x
;
curpos
.
y
-=
m_CurrentScreen
->
m_StartVisu
.
y
;
/* Il y a peut-etre necessite de recadrer le dessin: */
if
(
(
curpos
.
x
<=
0
)
||
(
curpos
.
x
>=
size
.
x
-
1
)
||
(
curpos
.
y
<=
0
)
||
(
curpos
.
y
>=
size
.
y
)
||
force_recadre
)
{
Recadre_Trace
(
mouseWarp
);
}
else
{
wxClientDC
dc
(
DrawPanel
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
EXCHG
(
old_cursor_position
,
Screen
->
m_Curseur
);
DrawPanel
->
CursorOff
(
&
dc
);
if
(
mouseWarp
)
GRMouseWarp
(
DrawPanel
,
curpos
);
EXCHG
(
old_cursor_position
,
Screen
->
m_Curseur
);
DrawPanel
->
CursorOn
(
&
dc
);
}
msg
=
WildText
+
_
(
" Found in "
)
+
Screen
->
m_FileName
;
Affiche_Message
(
msg
);
}
else
{
Affiche_Message
(
wxEmptyString
);
if
(
!
mouseWarp
)
{
// if called from RemoteCommand() don't popup the dialog which
// needs to be dismissed, user is in PCBNEW, and does'nt want to
// bother with dismissing the dialog in EESCHEMA.
msg
=
WildText
+
_
(
" Not Found"
);
DisplayError
(
this
,
msg
,
10
);
}
}
return
DrawList
;
}
/*************************************************************/
void
WinEDA_FindFrame
::
LocatePartInLibs
(
wxCommandEvent
&
event
)
void
WinEDA_FindFrame
::
LocatePartInLibs
(
wxCommandEvent
&
event
)
/*************************************************************/
/* Recherche exhaustive d'un composant en librairies, meme non chargees
*/
*/
{
wxString
Text
,
FindList
;
const
wxChar
**
ListNames
;
LibraryStruct
*
Lib
=
NULL
;
EDA_LibComponentStruct
*
LibEntry
;
bool
FoundInLib
=
FALSE
;
// True si reference trouvee ailleurs qu'en cache
Text
=
m_NewTextCtrl
->
GetValue
();
if
(
Text
.
IsEmpty
()
)
{
Close
();
return
;
}
s_OldStringFound
=
Text
;
int
ii
,
nbitems
,
NumOfLibs
=
NumOfLibraries
();
if
(
NumOfLibs
==
0
)
{
DisplayError
(
this
,
_
(
"No libraries are loaded"
));
Close
();
return
;
}
ListNames
=
GetLibNames
();
nbitems
=
0
;
for
(
ii
=
0
;
ii
<
NumOfLibs
;
ii
++
)
/* Recherche de la librairie */
{
bool
IsLibCache
;
Lib
=
FindLibrary
(
ListNames
[
ii
]);
if
(
Lib
==
NULL
)
break
;
if
(
Lib
->
m_Name
.
Contains
(
wxT
(
".cache"
))
)
IsLibCache
=
TRUE
;
else
IsLibCache
=
FALSE
;
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
Lib
->
m_Entries
,
FALSE
);
while
(
LibEntry
)
{
if
(
WildCompareString
(
Text
,
LibEntry
->
m_Name
.
m_Text
,
FALSE
)
)
{
nbitems
++
;
if
(
!
IsLibCache
)
FoundInLib
=
TRUE
;
if
(
!
FindList
.
IsEmpty
()
)
FindList
+=
wxT
(
"
\n
"
);
FindList
<<
_
(
"Found "
)
+
LibEntry
->
m_Name
.
m_Text
+
_
(
" in lib "
)
+
Lib
->
m_Name
;
}
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQNext
(
Lib
->
m_Entries
,
LibEntry
,
NULL
);
}
}
free
(
ListNames
);
if
(
!
FoundInLib
)
{
if
(
nbitems
)
FindList
=
wxT
(
"
\n
"
)
+
Text
+
_
(
" found only in cache"
);
else
FindList
=
Text
+
_
(
" not found"
);
FindList
+=
_
(
"
\n
Explore All Libraries?"
);
if
(
IsOK
(
this
,
FindList
)
)
{
FindList
.
Empty
();
ExploreAllLibraries
(
Text
,
FindList
);
if
(
FindList
.
IsEmpty
()
)
DisplayInfo
(
this
,
_
(
"Nothing found"
)
);
else
DisplayInfo
(
this
,
FindList
);
}
}
else
DisplayInfo
(
this
,
FindList
);
Close
();
wxString
Text
,
FindList
;
const
wxChar
**
ListNames
;
LibraryStruct
*
Lib
=
NULL
;
EDA_LibComponentStruct
*
LibEntry
;
bool
FoundInLib
=
FALSE
;
// True si reference trouvee ailleurs qu'en cache
Text
=
m_NewTextCtrl
->
GetValue
();
if
(
Text
.
IsEmpty
()
)
{
Close
();
return
;
}
s_OldStringFound
=
Text
;
int
ii
,
nbitems
,
NumOfLibs
=
NumOfLibraries
();
if
(
NumOfLibs
==
0
)
{
DisplayError
(
this
,
_
(
"No libraries are loaded"
)
);
Close
();
return
;
}
ListNames
=
GetLibNames
();
nbitems
=
0
;
for
(
ii
=
0
;
ii
<
NumOfLibs
;
ii
++
)
/* Recherche de la librairie */
{
bool
IsLibCache
;
Lib
=
FindLibrary
(
ListNames
[
ii
]
);
if
(
Lib
==
NULL
)
break
;
if
(
Lib
->
m_Name
.
Contains
(
wxT
(
".cache"
)
)
)
IsLibCache
=
TRUE
;
else
IsLibCache
=
FALSE
;
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQFirst
(
&
Lib
->
m_Entries
,
FALSE
);
while
(
LibEntry
)
{
if
(
WildCompareString
(
Text
,
LibEntry
->
m_Name
.
m_Text
,
FALSE
)
)
{
nbitems
++
;
if
(
!
IsLibCache
)
FoundInLib
=
TRUE
;
if
(
!
FindList
.
IsEmpty
()
)
FindList
+=
wxT
(
"
\n
"
);
FindList
<<
_
(
"Found "
)
+
LibEntry
->
m_Name
.
m_Text
+
_
(
" in lib "
)
+
Lib
->
m_Name
;
}
LibEntry
=
(
EDA_LibComponentStruct
*
)
PQNext
(
Lib
->
m_Entries
,
LibEntry
,
NULL
);
}
}
free
(
ListNames
);
if
(
!
FoundInLib
)
{
if
(
nbitems
)
FindList
=
wxT
(
"
\n
"
)
+
Text
+
_
(
" found only in cache"
);
else
FindList
=
Text
+
_
(
" not found"
);
FindList
+=
_
(
"
\n
Explore All Libraries?"
);
if
(
IsOK
(
this
,
FindList
)
)
{
FindList
.
Empty
();
ExploreAllLibraries
(
Text
,
FindList
);
if
(
FindList
.
IsEmpty
()
)
DisplayInfo
(
this
,
_
(
"Nothing found"
)
);
else
DisplayInfo
(
this
,
FindList
);
}
}
else
DisplayInfo
(
this
,
FindList
);
Close
();
}
/***************************************************************************************/
int
WinEDA_FindFrame
::
ExploreAllLibraries
(
const
wxString
&
wildmask
,
wxString
&
FindList
)
int
WinEDA_FindFrame
::
ExploreAllLibraries
(
const
wxString
&
wildmask
,
wxString
&
FindList
)
/***************************************************************************************/
{
wxString
FullFileName
;
FILE
*
file
;
int
nbitems
=
0
,
LineNum
=
0
;
char
Line
[
2048
],
*
name
;
FullFileName
=
MakeFileName
(
g_RealLibDirBuffer
,
wxT
(
"*"
),
g_LibExtBuffer
);
FullFileName
=
wxFindFirstFile
(
FullFileName
);
while
(
!
FullFileName
.
IsEmpty
()
)
{
file
=
wxFopen
(
FullFileName
,
wxT
(
"rt"
));
if
(
file
==
NULL
)
continue
;
while
(
GetLine
(
file
,
Line
,
&
LineNum
,
sizeof
(
Line
))
)
{
if
(
strnicmp
(
Line
,
"DEF"
,
3
)
==
0
)
{
/* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */
strtok
(
Line
,
"
\t\r\n
"
);
name
=
strtok
(
NULL
,
"
\t\r\n
"
);
wxString
st_name
=
CONV_FROM_UTF8
(
name
);
if
(
WildCompareString
(
wildmask
,
st_name
,
FALSE
)
)
{
nbitems
++
;
if
(
!
FindList
.
IsEmpty
()
)
FindList
+=
wxT
(
"
\n
"
);
FindList
<<
_
(
"Found "
)
<<
CONV_FROM_UTF8
(
name
)
<<
_
(
" in lib "
)
<<
FullFileName
;
}
}
else
if
(
strnicmp
(
Line
,
"ALIAS"
,
5
)
==
0
)
{
/* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */
strtok
(
Line
,
"
\t\r\n
"
);
while
(
(
name
=
strtok
(
NULL
,
"
\t\r\n
"
))
!=
NULL
)
{
wxString
st_name
=
CONV_FROM_UTF8
(
name
);
if
(
WildCompareString
(
wildmask
,
st_name
,
FALSE
)
)
{
nbitems
++
;
if
(
!
FindList
.
IsEmpty
()
)
FindList
+=
wxT
(
"
\n
"
);
FindList
<<
_
(
"Found "
)
<<
CONV_FROM_UTF8
(
name
)
<<
_
(
" in lib "
)
<<
FullFileName
;
}
}
}
}
fclose
(
file
);
FullFileName
=
wxFindNextFile
();
}
return
nbitems
;
wxString
FullFileName
;
FILE
*
file
;
int
nbitems
=
0
,
LineNum
=
0
;
char
Line
[
2048
],
*
name
;
FullFileName
=
MakeFileName
(
g_RealLibDirBuffer
,
wxT
(
"*"
),
g_LibExtBuffer
);
FullFileName
=
wxFindFirstFile
(
FullFileName
);
while
(
!
FullFileName
.
IsEmpty
()
)
{
file
=
wxFopen
(
FullFileName
,
wxT
(
"rt"
)
);
if
(
file
==
NULL
)
continue
;
while
(
GetLine
(
file
,
Line
,
&
LineNum
,
sizeof
(
Line
)
)
)
{
if
(
strnicmp
(
Line
,
"DEF"
,
3
)
==
0
)
{
/* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */
strtok
(
Line
,
"
\t\r\n
"
);
name
=
strtok
(
NULL
,
"
\t\r\n
"
);
wxString
st_name
=
CONV_FROM_UTF8
(
name
);
if
(
WildCompareString
(
wildmask
,
st_name
,
FALSE
)
)
{
nbitems
++
;
if
(
!
FindList
.
IsEmpty
()
)
FindList
+=
wxT
(
"
\n
"
);
FindList
<<
_
(
"Found "
)
<<
CONV_FROM_UTF8
(
name
)
<<
_
(
" in lib "
)
<<
FullFileName
;
}
}
else
if
(
strnicmp
(
Line
,
"ALIAS"
,
5
)
==
0
)
{
/* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */
strtok
(
Line
,
"
\t\r\n
"
);
while
(
(
name
=
strtok
(
NULL
,
"
\t\r\n
"
)
)
!=
NULL
)
{
wxString
st_name
=
CONV_FROM_UTF8
(
name
);
if
(
WildCompareString
(
wildmask
,
st_name
,
FALSE
)
)
{
nbitems
++
;
if
(
!
FindList
.
IsEmpty
()
)
FindList
+=
wxT
(
"
\n
"
);
FindList
<<
_
(
"Found "
)
<<
CONV_FROM_UTF8
(
name
)
<<
_
(
" in lib "
)
<<
FullFileName
;
}
}
}
}
fclose
(
file
);
FullFileName
=
wxFindNextFile
();
}
return
nbitems
;
}
eeschema/protos.h
View file @
51fc26e1
...
...
@@ -456,4 +456,8 @@ void InstallFindFrame(WinEDA_SchematicFrame *parent, wxPoint &pos);
/***************/
void
DisplayOptionFrame
(
WinEDA_DrawFrame
*
parent
,
const
wxPoint
&
framepos
);
/****************/
/* CONTROLE.CPP */
/****************/
void
RemoteCommand
(
const
char
*
cmdline
);
eeschema/schframe.cpp
View file @
51fc26e1
...
...
@@ -26,6 +26,9 @@
BEGIN_EVENT_TABLE
(
WinEDA_SchematicFrame
,
wxFrame
)
COMMON_EVENTS_DRAWFRAME
EVT_SOCKET
(
ID_EDA_SOCKET_EVENT_SERV
,
WinEDA_DrawFrame
::
OnSockRequestServer
)
EVT_SOCKET
(
ID_EDA_SOCKET_EVENT
,
WinEDA_DrawFrame
::
OnSockRequest
)
EVT_CLOSE
(
WinEDA_SchematicFrame
::
OnCloseWindow
)
EVT_SIZE
(
WinEDA_SchematicFrame
::
OnSize
)
...
...
include/appl_wxstruct.h
View file @
51fc26e1
/************************************************************/
/* appl_wxstruct.h: */
/* descriptions des principales classes derivees utilisees: */
/* Class "EDA_Appl: classe de l'application generale */
/************************************************************/
/************************************************************/
/* appl_wxstruct.h: */
/* descriptions des principales classes derivees utilisees: */
/* Class "EDA_Appl: classe de l'application generale */
/************************************************************/
/* Ce fichier doit etre inclus dans "wxstruct.h"
*/
*/
#ifndef APPL_WXSTRUCT_H
#define APPL_WXSTRUCT_H
...
...
@@ -15,79 +15,77 @@
#endif
/**********************************************/
/* Class representing the entire Application */
/**********************************************/
eda_global
WinEDA_App
*
EDA_Appl
;
/* application representant le programme */
/**********************************************/
/* Class representing the entire Application */
/**********************************************/
eda_global
WinEDA_App
*
EDA_Appl
;
/* application representant le programme */
class
WinEDA_App
:
public
wxApp
class
WinEDA_App
:
public
wxApp
{
public
:
wxString
m_Project
;
wxSingleInstanceChecker
*
m_Checker
;
WinEDA_MainFrame
*
m_MainFrame
;
WinEDA_PcbFrame
*
m_PcbFrame
;
WinEDA_ModuleEditFrame
*
m_ModuleEditFrame
;
WinEDA_GerberFrame
*
m_GerberFrame
;
WinEDA_SchematicFrame
*
SchematicFrame
;
// Edition des Schemas
WinEDA_LibeditFrame
*
LibeditFrame
;
// Edition des composants
WinEDA_ViewlibFrame
*
ViewlibFrame
;
// Visualisation des composants
WinEDA_CvpcbFrame
*
m_CvpcbFrame
;
wxPoint
m_HelpPos
;
wxSize
m_HelpSize
;
wxHtmlHelpController
*
m_HtmlCtrl
;
wxConfig
*
m_EDA_Config
;
// Config courante (tailles et positions fenetres ...*/
wxConfig
*
m_EDA_CommonConfig
;
// common setup (language ...) */
wxString
m_HelpFileName
;
wxString
m_CurrentOptionFile
;
// dernier fichier .cnf utilis
wxString
m_CurrentOptionFileDateAndTime
;
wxString
m_BinDir
;
/* Chemin ou reside l'executable
(utilis si KICAD non dfini)*/
wxArrayString
m_LastProject
;
/* liste des derniers projets chargs */
unsigned
int
m_LastProjectMaxCount
;
/* Max histhory file length */
wxString
m_KicadEnv
;
/* Chemin de kicad dfini dans la variable
d'environnement KICAD,
typiquement /usr/local/kicad ou c:\kicad */
bool
m_Env_Defined
;
// TRUE si variable d'environnement KICAD definie
wxLocale
*
m_Locale
;
// Gestion de la localisation
int
m_LanguageId
;
// indicateur de choix du langage ( 0 = defaut)
wxMenu
*
m_Language_Menu
;
// List menu for languages
wxString
m_PdfBrowser
;
// Name of the selected browser, for browsing pdf datasheets
bool
m_PdfBrowserIsDefault
;
// True if the pdf browser is the default (m_PdfBrowser not used)
wxString
m_Project
;
wxSingleInstanceChecker
*
m_Checker
;
WinEDA_MainFrame
*
m_MainFrame
;
WinEDA_PcbFrame
*
m_PcbFrame
;
WinEDA_ModuleEditFrame
*
m_ModuleEditFrame
;
WinEDA_GerberFrame
*
m_GerberFrame
;
WinEDA_SchematicFrame
*
SchematicFrame
;
// Edition des Schemas
WinEDA_LibeditFrame
*
LibeditFrame
;
// Edition des composants
WinEDA_ViewlibFrame
*
ViewlibFrame
;
// Visualisation des composants
WinEDA_CvpcbFrame
*
m_CvpcbFrame
;
wxPoint
m_HelpPos
;
wxSize
m_HelpSize
;
wxHtmlHelpController
*
m_HtmlCtrl
;
wxConfig
*
m_EDA_Config
;
// Config courante (tailles et positions fenetres ...*/
wxConfig
*
m_EDA_CommonConfig
;
// common setup (language ...) */
wxString
m_HelpFileName
;
wxString
m_CurrentOptionFile
;
// dernier fichier .cnf utilis
wxString
m_CurrentOptionFileDateAndTime
;
wxString
m_BinDir
;
/* Chemin ou reside l'executable
*
(utilis si KICAD non dfini)*/
wxArrayString
m_LastProject
;
/* liste des derniers projets chargs */
unsigned
int
m_LastProjectMaxCount
;
/* Max histhory file length */
wxString
m_KicadEnv
;
/* Chemin de kicad dfini dans la variable
*
d'environnement KICAD,
*
typiquement /usr/local/kicad ou c:\kicad */
bool
m_Env_Defined
;
// TRUE si variable d'environnement KICAD definie
wxLocale
*
m_Locale
;
// Gestion de la localisation
int
m_LanguageId
;
// indicateur de choix du langage ( 0 = defaut)
wxMenu
*
m_Language_Menu
;
// List menu for languages
wxString
m_PdfBrowser
;
// Name of the selected browser, for browsing pdf datasheets
bool
m_PdfBrowserIsDefault
;
// True if the pdf browser is the default (m_PdfBrowser not used)
public
:
WinEDA_App
(
void
);
~
WinEDA_App
(
void
);
bool
OnInit
(
void
);
int
OnRun
(
void
);
bool
SetBinDir
(
void
);
void
InitEDA_Appl
(
const
wxString
&
name
);
bool
SetLanguage
(
bool
first_time
=
FALSE
);
wxMenu
*
SetLanguageList
(
wxMenu
*
MasterMenu
);
void
SetLanguageIdentifier
(
int
menu_id
);
void
InitOnLineHelp
(
void
);
// Sauvegarde de configurations et options:
void
GetSettings
(
void
);
void
SaveSettings
(
void
);
void
SetLastProject
(
const
wxString
&
FullFileName
);
void
WriteProjectConfig
(
const
wxString
&
local_config_filename
,
const
wxString
&
GroupName
,
PARAM_CFG_BASE
**
List
);
bool
ReadProjectConfig
(
const
wxString
&
local_config_filename
,
const
wxString
&
GroupName
,
PARAM_CFG_BASE
**
List
,
bool
Load_Only_if_New
);
void
ReadPdfBrowserInfos
(
void
);
void
WritePdfBrowserInfos
(
void
);
WinEDA_App
(
void
);
~
WinEDA_App
(
void
);
bool
OnInit
(
void
);
int
OnRun
(
void
);
bool
SetBinDir
(
void
);
void
InitEDA_Appl
(
const
wxString
&
name
);
bool
SetLanguage
(
bool
first_time
=
FALSE
);
wxMenu
*
SetLanguageList
(
wxMenu
*
MasterMenu
);
void
SetLanguageIdentifier
(
int
menu_id
);
void
InitOnLineHelp
(
void
);
// Sauvegarde de configurations et options:
void
GetSettings
(
void
);
void
SaveSettings
(
void
);
void
SetLastProject
(
const
wxString
&
FullFileName
);
void
WriteProjectConfig
(
const
wxString
&
local_config_filename
,
const
wxString
&
GroupName
,
PARAM_CFG_BASE
**
List
);
bool
ReadProjectConfig
(
const
wxString
&
local_config_filename
,
const
wxString
&
GroupName
,
PARAM_CFG_BASE
**
List
,
bool
Load_Only_if_New
);
void
ReadPdfBrowserInfos
(
void
);
void
WritePdfBrowserInfos
(
void
);
};
#endif
/* APPL_WXSTRUCT_H */
include/common.h
View file @
51fc26e1
/****************************/
/* common.h
*/
/****************************/
/****************************/
/* common.h
*/
/****************************/
#ifndef COMMON_H
#define COMMON_H
...
...
@@ -12,27 +12,24 @@
#define COMMON_GLOBL extern
#endif
/* Numero de ports TCP/IP utilis�s par KICAD */
#define KICAD_PCB_PORT_SERVICE_NUMBER 4242
/* Etat des touches speciales du clavier */
#define GR_KB_RIGHTSHIFT
0x10000000
/* Keybd states: right shift key depressed */
#define GR_KB_LEFTSHIFT
0x20000000
/* left shift key depressed */
#define GR_KB_CTRL
0x40000000
/* CTRL depressed */
#define GR_KB_ALT
0x80000000
/* ALT depressed */
#define GR_KB_SHIFT
(GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT)
#define GR_KB_SHIFTCTRL
(GR_KB_SHIFT | GR_KB_CTRL)
#define MOUSE_MIDDLE
0x10000
/* flag indiquant bouton central souris */
#define GR_KB_RIGHTSHIFT
0x10000000
/* Keybd states: right shift key depressed */
#define GR_KB_LEFTSHIFT
0x20000000
/* left shift key depressed */
#define GR_KB_CTRL
0x40000000
/* CTRL depressed */
#define GR_KB_ALT
0x80000000
/* ALT depressed */
#define GR_KB_SHIFT
(GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT)
#define GR_KB_SHIFTCTRL
(GR_KB_SHIFT | GR_KB_CTRL)
#define MOUSE_MIDDLE
0x10000
/* flag indiquant bouton central souris */
/* Pseudo key codes for commands liske panning */
enum
pseudokeys
{
EDA_PANNING_UP_KEY
=
2000
,
EDA_PANNING_DOWN_KEY
,
EDA_PANNING_LEFT_KEY
,
EDA_PANNING_RIGHT_KEY
EDA_PANNING_UP_KEY
=
2000
,
EDA_PANNING_DOWN_KEY
,
EDA_PANNING_LEFT_KEY
,
EDA_PANNING_RIGHT_KEY
};
#define ESC 27
...
...
@@ -65,8 +62,8 @@ enum pseudokeys {
#define TEXT_ORIENT_VERT 900
/* Affichage ou Effacement d'Item */
#define ON 1
/* Affichage */
#define OFF 0
/* Effacement */
#define ON 1
/* Affichage */
#define OFF 0
/* Effacement */
/* unites d'affichage sur ecran et autres */
#define INCHES 0
...
...
@@ -77,15 +74,15 @@ enum pseudokeys {
class
LibNameList
;
/* definifition des types de parametre des files de configuration */
enum
paramcfg_id
/* type du parametre dans la structure ParamConfig */
enum
paramcfg_id
/* type du parametre dans la structure ParamConfig */
{
PARAM_INT
,
PARAM_SETCOLOR
,
PARAM_DOUBLE
,
PARAM_BOOL
,
PARAM_LIBNAME_LIST
,
PARAM_WXSTRING
,
PARAM_COMMAND_ERASE
PARAM_INT
,
PARAM_SETCOLOR
,
PARAM_DOUBLE
,
PARAM_BOOL
,
PARAM_LIBNAME_LIST
,
PARAM_WXSTRING
,
PARAM_COMMAND_ERASE
};
#define MAX_COLOR 0x8001F
...
...
@@ -95,112 +92,112 @@ enum paramcfg_id /* type du parametre dans la structure ParamConfig */
class
PARAM_CFG_BASE
{
public
:
const
wxChar
*
m_Ident
;
/* Abreviation de reperage des debuts de lignes */
paramcfg_id
m_Type
;
/* flag type des parametres */
const
wxChar
*
m_Group
;
/* Nom du groupe (rubrique) de classement */
bool
m_Setup
;
/* TRUE -> inscription en setup (registration base)*/
const
wxChar
*
m_Ident
;
/* Abreviation de reperage des debuts de lignes */
paramcfg_id
m_Type
;
/* flag type des parametres */
const
wxChar
*
m_Group
;
/* Nom du groupe (rubrique) de classement */
bool
m_Setup
;
/* TRUE -> inscription en setup (registration base)*/
public
:
PARAM_CFG_BASE
(
const
wxChar
*
ident
,
const
paramcfg_id
type
,
const
wxChar
*
group
=
NULL
);
~
PARAM_CFG_BASE
()
{};
PARAM_CFG_BASE
(
const
wxChar
*
ident
,
const
paramcfg_id
type
,
const
wxChar
*
group
=
NULL
);
~
PARAM_CFG_BASE
()
{};
};
class
PARAM_CFG_INT
:
public
PARAM_CFG_BASE
{
public
:
int
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
int
m_Min
,
m_Max
;
/* valeurs extremes du parametre */
int
m_Default
;
/* valeur par defaut */
int
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
int
m_Min
,
m_Max
;
/* valeurs extremes du parametre */
int
m_Default
;
/* valeur par defaut */
public
:
PARAM_CFG_INT
(
const
wxChar
*
ident
,
int
*
ptparam
,
int
default_val
=
0
,
int
min
=
INT_MINVAL
,
int
max
=
INT_MAXVAL
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_INT
(
bool
Insetup
,
const
wxChar
*
ident
,
int
*
ptparam
,
int
default_val
=
0
,
int
min
=
INT_MINVAL
,
int
max
=
INT_MAXVAL
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_INT
(
const
wxChar
*
ident
,
int
*
ptparam
,
int
default_val
=
0
,
int
min
=
INT_MINVAL
,
int
max
=
INT_MAXVAL
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_INT
(
bool
Insetup
,
const
wxChar
*
ident
,
int
*
ptparam
,
int
default_val
=
0
,
int
min
=
INT_MINVAL
,
int
max
=
INT_MAXVAL
,
const
wxChar
*
group
=
NULL
);
};
class
PARAM_CFG_SETCOLOR
:
public
PARAM_CFG_BASE
{
public
:
int
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
int
m_Default
;
/* valeur par defaut */
int
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
int
m_Default
;
/* valeur par defaut */
public
:
PARAM_CFG_SETCOLOR
(
const
wxChar
*
ident
,
int
*
ptparam
,
int
default_val
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_SETCOLOR
(
bool
Insetup
,
const
wxChar
*
ident
,
int
*
ptparam
,
int
default_val
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_SETCOLOR
(
const
wxChar
*
ident
,
int
*
ptparam
,
int
default_val
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_SETCOLOR
(
bool
Insetup
,
const
wxChar
*
ident
,
int
*
ptparam
,
int
default_val
,
const
wxChar
*
group
=
NULL
);
};
class
PARAM_CFG_DOUBLE
:
public
PARAM_CFG_BASE
{
public
:
double
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
double
m_Default
;
/* valeur par defaut */
double
m_Min
,
m_Max
;
/* valeurs extremes du parametre */
double
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
double
m_Default
;
/* valeur par defaut */
double
m_Min
,
m_Max
;
/* valeurs extremes du parametre */
public
:
PARAM_CFG_DOUBLE
(
const
wxChar
*
ident
,
double
*
ptparam
,
double
default_val
=
0
.
0
,
double
min
=
0
.
0
,
double
max
=
10000
.
0
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_DOUBLE
(
bool
Insetup
,
const
wxChar
*
ident
,
double
*
ptparam
,
double
default_val
=
0
.
0
,
double
min
=
0
.
0
,
double
max
=
10000
.
0
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_DOUBLE
(
const
wxChar
*
ident
,
double
*
ptparam
,
double
default_val
=
0
.
0
,
double
min
=
0
.
0
,
double
max
=
10000
.
0
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_DOUBLE
(
bool
Insetup
,
const
wxChar
*
ident
,
double
*
ptparam
,
double
default_val
=
0
.
0
,
double
min
=
0
.
0
,
double
max
=
10000
.
0
,
const
wxChar
*
group
=
NULL
);
};
class
PARAM_CFG_BOOL
:
public
PARAM_CFG_BASE
{
public
:
bool
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
int
m_Default
;
/* valeur par defaut */
bool
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
int
m_Default
;
/* valeur par defaut */
public
:
PARAM_CFG_BOOL
(
const
wxChar
*
ident
,
bool
*
ptparam
,
int
default_val
=
FALSE
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_BOOL
(
bool
Insetup
,
const
wxChar
*
ident
,
bool
*
ptparam
,
int
default_val
=
FALSE
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_BOOL
(
const
wxChar
*
ident
,
bool
*
ptparam
,
int
default_val
=
FALSE
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_BOOL
(
bool
Insetup
,
const
wxChar
*
ident
,
bool
*
ptparam
,
int
default_val
=
FALSE
,
const
wxChar
*
group
=
NULL
);
};
class
PARAM_CFG_WXSTRING
:
public
PARAM_CFG_BASE
{
public
:
wxString
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
wxString
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
public
:
PARAM_CFG_WXSTRING
(
const
wxChar
*
ident
,
wxString
*
ptparam
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_WXSTRING
(
bool
Insetup
,
const
wxChar
*
ident
,
wxString
*
ptparam
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_WXSTRING
(
const
wxChar
*
ident
,
wxString
*
ptparam
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_WXSTRING
(
bool
Insetup
,
const
wxChar
*
ident
,
wxString
*
ptparam
,
const
wxChar
*
group
=
NULL
);
};
class
PARAM_CFG_LIBNAME_LIST
:
public
PARAM_CFG_BASE
{
public
:
wxArrayString
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
wxArrayString
*
m_Pt_param
;
/* pointeur sur le parametre a configurer */
public
:
PARAM_CFG_LIBNAME_LIST
(
const
wxChar
*
ident
,
wxArrayString
*
ptparam
,
const
wxChar
*
group
=
NULL
);
PARAM_CFG_LIBNAME_LIST
(
const
wxChar
*
ident
,
wxArrayString
*
ptparam
,
const
wxChar
*
group
=
NULL
);
};
/***********************************/
/* Classe pour affichage de textes */
/***********************************/
/***********************************/
/* Classe pour affichage de textes */
/***********************************/
class
WinEDA_TextFrame
:
public
wxDialog
{
private
:
wxWindow
*
m_Parent
;
wxListBox
*
m_List
;
wxWindow
*
m_Parent
;
wxListBox
*
m_List
;
public
:
WinEDA_TextFrame
(
wxWindow
*
parent
,
const
wxString
&
title
);
void
Append
(
const
wxString
&
text
);
WinEDA_TextFrame
(
wxWindow
*
parent
,
const
wxString
&
title
);
void
Append
(
const
wxString
&
text
);
private
:
void
D_ClickOnList
(
wxCommandEvent
&
event
);
void
OnClose
(
wxCloseEvent
&
event
);
void
D_ClickOnList
(
wxCommandEvent
&
event
);
void
OnClose
(
wxCloseEvent
&
event
);
DECLARE_EVENT_TABLE
()
DECLARE_EVENT_TABLE
()
};
...
...
@@ -210,16 +207,16 @@ class Ki_PageDescr
{
// All sizes are in 1/1000 inch
public
:
wxSize
m_Size
;
/* page size in 1/1000 inch */
wxPoint
m_Offset
;
/* plot offset in 1/1000 inch */
wxString
m_Name
;
int
m_LeftMargin
;
int
m_RightMargin
;
int
m_TopMargin
;
int
m_BottomMargin
;
wxSize
m_Size
;
/* page size in 1/1000 inch */
wxPoint
m_Offset
;
/* plot offset in 1/1000 inch */
wxString
m_Name
;
int
m_LeftMargin
;
int
m_RightMargin
;
int
m_TopMargin
;
int
m_BottomMargin
;
public
:
Ki_PageDescr
(
const
wxSize
&
size
,
const
wxPoint
&
offset
,
const
wxString
&
name
);
Ki_PageDescr
(
const
wxSize
&
size
,
const
wxPoint
&
offset
,
const
wxString
&
name
);
};
...
...
@@ -253,7 +250,7 @@ extern Ki_PageDescr g_Sheet_user ;
#endif
COMMON_GLOBL
int
g_LastKey
;
/* code de la derniere touche actionn�� */
COMMON_GLOBL
int
g_LastKey
;
/* code de la derniere touche actionn�� */
COMMON_GLOBL
wxString
g_ProductName
#ifdef EDA_BASE
=
wxT
(
"KiCad E.D.A. "
)
...
...
@@ -261,33 +258,33 @@ COMMON_GLOBL wxString g_ProductName
;
/* Gestion des librairies */
COMMON_GLOBL
wxString
g_RealLibDirBuffer
;
// Chemin reel des librairies de module
// = UserLibDirBuffer si non vide
// = chemin par defaut sinon
COMMON_GLOBL
wxString
g_UserLibDirBuffer
;
// Chemin des librairies de module donne par
// le file de config
COMMON_GLOBL
wxString
g_RealLibDirBuffer
;
// Chemin reel des librairies de module
// = UserLibDirBuffer si non vide
// = chemin par defaut sinon
COMMON_GLOBL
wxString
g_UserLibDirBuffer
;
// Chemin des librairies de module donne par
// le file de config
/* variables globales generales */
COMMON_GLOBL
int
g_DebugLevel
;
// 0= Pas de debug */
COMMON_GLOBL
int
g_DebugLevel
;
// 0= Pas de debug */
COMMON_GLOBL
int
g_MouseOldButtons
;
COMMON_GLOBL
int
g_KeyPressed
;
// Font used by kicad.
// these font have a size which do not depend on default size system font
COMMON_GLOBL
wxFont
*
g_StdFont
;
/* Standard font used for status display ,in message panel */
COMMON_GLOBL
wxFont
*
g_DialogFont
;
/* Normal font used in dialog box */
COMMON_GLOBL
wxFont
*
g_ItalicFont
;
/* Italic font used in dialog box */
COMMON_GLOBL
wxFont
*
g_MsgFont
;
/* Italic font used in msg panel (lower window) */
COMMON_GLOBL
wxFont
*
g_FixedFont
;
/* Affichage de Texte en fenetres de dialogue,
fonte a pas fixe)*/
COMMON_GLOBL
int
g_StdFontPointSize
;
/* taille de la fonte */
COMMON_GLOBL
int
g_DialogFontPointSize
;
/* taille de la fonte */
COMMON_GLOBL
int
g_FixedFontPointSize
;
/* taille de la fonte */
COMMON_GLOBL
int
g_MsgFontPointSize
;
/* taille de la fonte */
COMMON_GLOBL
int
g_FontMinPointSize
;
/* taille minimum des fontes */
COMMON_GLOBL
bool
g_IsPrinting
;
// TRUE si impression au lieu de trace a l'ecran
COMMON_GLOBL
bool
g_ShowPageLimits
// TRUE to display the page limits
COMMON_GLOBL
wxFont
*
g_StdFont
;
/* Standard font used for status display ,in message panel */
COMMON_GLOBL
wxFont
*
g_DialogFont
;
/* Normal font used in dialog box */
COMMON_GLOBL
wxFont
*
g_ItalicFont
;
/* Italic font used in dialog box */
COMMON_GLOBL
wxFont
*
g_MsgFont
;
/* Italic font used in msg panel (lower window) */
COMMON_GLOBL
wxFont
*
g_FixedFont
;
/* Affichage de Texte en fenetres de dialogue,
fonte a pas fixe)*/
COMMON_GLOBL
int
g_StdFontPointSize
;
/* taille de la fonte */
COMMON_GLOBL
int
g_DialogFontPointSize
;
/* taille de la fonte */
COMMON_GLOBL
int
g_FixedFontPointSize
;
/* taille de la fonte */
COMMON_GLOBL
int
g_MsgFontPointSize
;
/* taille de la fonte */
COMMON_GLOBL
int
g_FontMinPointSize
;
/* taille minimum des fontes */
COMMON_GLOBL
bool
g_IsPrinting
;
// TRUE si impression au lieu de trace a l'ecran
COMMON_GLOBL
bool
g_ShowPageLimits
// TRUE to display the page limits
#ifdef EDA_BASE
=
TRUE
#endif
...
...
@@ -299,9 +296,9 @@ COMMON_GLOBL wxString g_Prj_Config_Filename_ext
=
wxT
(
".pro"
)
#endif
;
COMMON_GLOBL
wxFileConfig
*
g_Prj_Config
;
// Configuration locale, propre au projet
COMMON_GLOBL
wxString
g_Prj_Default_Config_FullFilename
;
// Nom (full file name) du file Configuration par defaut (kicad.pro)
COMMON_GLOBL
wxString
g_Prj_Config_LocalFilename
;
// Nom du file Configuration local (<curr projet>.pro)
COMMON_GLOBL
wxFileConfig
*
g_Prj_Config
;
// Configuration locale, propre au projet
COMMON_GLOBL
wxString
g_Prj_Default_Config_FullFilename
;
// Nom (full file name) du file Configuration par defaut (kicad.pro)
COMMON_GLOBL
wxString
g_Prj_Config_LocalFilename
;
// Nom du file Configuration local (<curr projet>.pro)
// Handle the preferd editor for browsing report files:
COMMON_GLOBL
wxString
g_EditorName
;
...
...
@@ -316,7 +313,7 @@ extern wxRealPoint g_UserGrid;
extern
int
g_UserGrid_Unit
;
#endif
COMMON_GLOBL
int
g_UnitMetric
;
// display units mm = 1, inches = 0, cm = 2
COMMON_GLOBL
int
g_UnitMetric
;
// display units mm = 1, inches = 0, cm = 2
// shape selector for cursor screen
...
...
@@ -328,7 +325,7 @@ COMMON_GLOBL int g_GhostColor;
/* Draw color for grid: */
COMMON_GLOBL
int
g_GridColor
#ifdef EDA_BASE
=
DARKGRAY
=
DARKGRAY
#endif
;
...
...
@@ -349,8 +346,8 @@ class WinEDA_DrawPanel;
/* COMMON.CPP */
wxString
ReturnPcbLayerName
(
int
layer_number
,
bool
is_filename
=
FALSE
,
bool
is_gui
=
FALSE
);
/* Return the name of the layer number "layer_number".
if "is_filename" == TRUE, the name can be used for a file name
(not internatinalized, no space)*/
if "is_filename" == TRUE, the name can be used for a file name
(not internatinalized, no space)*/
/*********************/
...
...
@@ -361,109 +358,109 @@ wxString ReturnPcbLayerName(int layer_number, bool is_filename = FALSE, bool is
/* DRAWTXT.CPP */
/**************/
void
DrawGraphicText
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
pos
,
int
mode_color
,
const
wxString
&
Text
,
int
orient
,
const
wxSize
&
char_size
,
int
h_justify
,
int
v_justify
,
int
width
=
0
);
int
mode_color
,
const
wxString
&
Text
,
int
orient
,
const
wxSize
&
char_size
,
int
h_justify
,
int
v_justify
,
int
width
=
0
);
void
PlotGraphicText
(
int
format_plot
,
const
wxPoint
&
Pos
,
int
gcolor
,
const
wxString
&
Text
,
int
orient
,
const
wxSize
&
Size
,
int
h_justify
,
int
v_justify
);
const
wxString
&
Text
,
int
orient
,
const
wxSize
&
Size
,
int
h_justify
,
int
v_justify
);
/***************/
/* CONFIRM.CPP */
/***************/
void
DisplayError
(
wxWindow
*
parent
,
const
wxString
&
msg
,
int
displaytime
=
0
);
void
DisplayInfo
(
wxWindow
*
parent
,
const
wxString
&
msg
,
int
displaytime
=
0
);
/* Routines d'affichage messages ( disparait au bout de displaytime 0.1 secondes) */
/* Routines d'affichage messages ( disparait au bout de displaytime 0.1 secondes) */
bool
IsOK
(
wxWindow
*
parent
,
const
wxString
&
msg
)
;
/* Routine affichant la fenetre "CONFIRMATION"
Retourne 1 ou 0 selon reponse Yes / No */
/* Routine affichant la fenetre "CONFIRMATION"
Retourne 1 ou 0 selon reponse Yes / No */
int
Get_Message
(
const
wxString
&
titre
,
wxString
&
buffer
,
wxWindow
*
frame
)
;
/* Fonction d'installation du menu de Dialogue
entree: titre = titre a afficher
entree/sortie :buffer : contient la reponse
si a l'appel buffer n'est pas vide, son contenu est aussi
affiche, mais disparait a la 1ere correction */
/* Fonction d'installation du menu de Dialogue
entree: titre = titre a afficher
entree/sortie :buffer : contient la reponse
si a l'appel buffer n'est pas vide, son contenu est aussi
affiche, mais disparait a la 1ere correction */
/************************/
/* file GESTFICH.CPP */
/************************/
wxString
GetEditorName
(
void
);
// Return the prefered editor name
wxString
GetEditorName
(
void
);
// Return the prefered editor name
void
OpenPDF
(
const
wxString
&
file
);
void
OpenFile
(
const
wxString
&
file
);
bool
EDA_DirectorySelector
(
const
wxString
&
Title
,
/* Titre de la fenetre */
wxString
&
Path
,
/* Chemin par defaut */
int
flag
,
/* reserve */
wxWindow
*
Frame
,
/* parent frame */
const
wxPoint
&
Pos
);
bool
EDA_DirectorySelector
(
const
wxString
&
Title
,
/* Titre de la fenetre */
wxString
&
Path
,
/* Chemin par defaut */
int
flag
,
/* reserve */
wxWindow
*
Frame
,
/* parent frame */
const
wxPoint
&
Pos
);
wxString
EDA_FileSelector
(
const
wxString
&
Title
,
/* Window title */
const
wxString
&
Path
,
/* default path */
const
wxString
&
FileName
,
/* default filename */
const
wxString
&
Ext
,
/* default extension */
const
wxString
&
Mask
,
/* Display filename mask */
wxWindow
*
Frame
,
/* parent frame */
int
flag
,
/* wxSAVE, wxOPEN ..*/
const
bool
keep_working_directory
,
/* true = do not change the C.W.D. */
const
wxPoint
&
Pos
=
wxPoint
(
-
1
,
-
1
)
);
wxString
EDA_FileSelector
(
const
wxString
&
Title
,
/* Window title */
const
wxString
&
Path
,
/* default path */
const
wxString
&
FileName
,
/* default filename */
const
wxString
&
Ext
,
/* default extension */
const
wxString
&
Mask
,
/* Display filename mask */
wxWindow
*
Frame
,
/* parent frame */
int
flag
,
/* wxSAVE, wxOPEN ..*/
const
bool
keep_working_directory
,
/* true = do not change the C.W.D. */
const
wxPoint
&
Pos
=
wxPoint
(
-
1
,
-
1
)
);
wxString
MakeFileName
(
const
wxString
&
dir
,
const
wxString
&
shortname
,
const
wxString
&
ext
);
const
wxString
&
shortname
,
const
wxString
&
ext
);
/* Calcule le nom complet d'un file d'apres les chaines
dir = prefixe (chemin)
shortname = nom avec ou sans chemin ou extension
ext = extension
dir = prefixe (chemin)
shortname = nom avec ou sans chemin ou extension
ext = extension
si la chaine name possede deja un chemin ou une extension, elles
ne seront pas modifiees
si la chaine name possede deja un chemin ou une extension, elles
ne seront pas modifiees
retourne la chaine calculee */
retourne la chaine calculee */
wxString
MakeReducedFileName
(
const
wxString
&
fullfilename
,
const
wxString
&
default_path
,
const
wxString
&
default_ext
);
const
wxString
&
default_path
,
const
wxString
&
default_ext
);
/* Calcule le nom "reduit" d'un file d'apres les chaines
fullfilename = nom complet
default_path = prefixe (chemin) par defaut
default_ext = extension
par defaut
fullfilename = nom complet
default_path = prefixe (chemin) par defaut
default_ext = extension
par defaut
retourne le nom reduit, c'est a dire:
sans le chemin si le chemin est default_path
avec ./ si si le chemin est le chemin courant
sans l'extension si l'extension est default_ext
retourne le nom reduit, c'est a dire:
sans le chemin si le chemin est default_path
avec ./ si si le chemin est le chemin courant
sans l'extension si l'extension est default_ext
Renvoie un chemin en notation unix ('/' en separateur de repertoire)
Renvoie un chemin en notation unix ('/' en separateur de repertoire)
*/
WinEDAListBox
*
GetFileNames
(
char
*
Directory
,
char
*
Mask
);
void
ChangeFileNameExt
(
wxString
&
FullFileName
,
const
wxString
&
NewExt
);
/* Change l'extension du "filename FullFileName" en NewExt.
Retourne FullFileName */
/* Change l'extension du "filename FullFileName" en NewExt.
Retourne FullFileName */
int
ExecuteFile
(
wxWindow
*
frame
,
const
wxString
&
ExecFile
,
const
wxString
&
param
=
wxEmptyString
);
const
wxString
&
param
=
wxEmptyString
);
void
AddDelimiterString
(
wxString
&
string
);
void
SetRealLibraryPath
(
const
wxString
&
shortlibname
);
/* met a jour
le chemin des librairies RealLibDirBuffer (global)
a partir de UserLibDirBuffer (global):
Si UserLibDirBuffer non vide RealLibDirBuffer = UserLibDirBuffer.
Sinon si variable d'environnement KICAD definie (KICAD = chemin pour kicad),
UserLibDirBuffer = <KICAD>/shortlibname;
Sinon UserLibDirBuffer = <Chemin des binaires>../shortlibname/
Si UserLibDirBuffer non vide RealLibDirBuffer = UserLibDirBuffer.
Sinon si variable d'environnement KICAD definie (KICAD = chemin pour kicad),
UserLibDirBuffer = <KICAD>/shortlibname;
Sinon UserLibDirBuffer = <Chemin des binaires>../shortlibname/
*/
wxString
FindKicadHelpPath
(
void
);
/* Find absolute path for kicad/help (or kicad/help/<language>) */
wxString
ReturnKicadDatasPath
(
void
);
/* Retourne le chemin des donnees communes de kicad. */
/* Retourne le chemin des donnees communes de kicad. */
wxString
FindKicadFile
(
const
wxString
&
shortname
);
/* Search the executable file shortname in kicad binary path and return
...
...
@@ -476,53 +473,53 @@ full file name if found or shortname */
char
*
strupper
(
char
*
Text
);
int
ReadDelimitedText
(
char
*
dest
,
char
*
source
,
int
NbMaxChar
);
/* lit et place dans dest la chaine de caractere trouvee dans source,
delimitee par " .
transfere NbMaxChar max
retourne le nombre de codes lus dans source
dest est termine par NULL */
/* lit et place dans dest la chaine de caractere trouvee dans source,
delimitee par " .
transfere NbMaxChar max
retourne le nombre de codes lus dans source
dest est termine par NULL */
char
*
GetLine
(
FILE
*
File
,
char
*
Line
,
int
*
LineNum
=
NULL
,
int
SizeLine
=
255
);
/* Routine de lecture de 1 ligne utile
retourne la 1ere ligne utile lue.
elimine lignes vides et commentaires */
/* Routine de lecture de 1 ligne utile
retourne la 1ere ligne utile lue.
elimine lignes vides et commentaires */
char
*
StrPurge
(
char
*
text
);
/* Supprime les caracteres Space en debut de la ligne text
retourne un pointeur sur le 1er caractere non Space de text */
/* Supprime les caracteres Space en debut de la ligne text
retourne un pointeur sur le 1er caractere non Space de text */
char
*
DateAndTime
(
char
*
line
);
wxString
DateAndTime
(
void
);
/* Retourne la chaine de caractere donnant date+heure */
/* Retourne la chaine de caractere donnant date+heure */
int
StrLenNumCmp
(
const
wxChar
*
str1
,
const
wxChar
*
str2
,
int
NbMax
);
/*
routine (compatible qsort() ) de comparaision pour classement alphab�tique
Analogue a strncmp() mais les nombres sont compar�s selon leur valeur num�rique
et non pas par leur code ascii */
/*
routine (compatible qsort() ) de comparaision pour classement alphab�tique
Analogue a strncmp() mais les nombres sont compar�s selon leur valeur num�rique
et non pas par leur code ascii */
int
StrNumICmp
(
const
wxChar
*
str1
,
const
wxChar
*
str2
);
/* routine (compatible qsort() ) de comparaison pour classement alphab�tique,
avec lower case == upper case.
Analogue a stricmp() mais les nombres sont compar�s selon leur valeur num�rique
et non pas par leur code ascii */
/* routine (compatible qsort() ) de comparaison pour classement alphab�tique,
avec lower case == upper case.
Analogue a stricmp() mais les nombres sont compar�s selon leur valeur num�rique
et non pas par leur code ascii */
int
StrLenNumICmp
(
const
wxChar
*
str1
,
const
wxChar
*
str2
,
int
NbMax
);
/* routine (compatible qsort() ) de comparaison pour classement alphab�tique,
avec lower case == upper case.
Analogue a stricmp() mais les nombres sont compar�s selon leur valeur num�rique
et non pas par leur code ascii */
/* routine (compatible qsort() ) de comparaison pour classement alphab�tique,
avec lower case == upper case.
Analogue a stricmp() mais les nombres sont compar�s selon leur valeur num�rique
et non pas par leur code ascii */
bool
WildCompareString
(
const
wxString
&
pattern
,
const
wxString
&
string_to_tst
,
bool
case_sensitive
=
TRUE
);
/* compare 2 noms de composants, selon regles usuelles
( Jokers * , ? , autoris�s).
la chaine de reference est "pattern"
si case_sensitive == TRUE (default), comparaison exacte
retourne TRUE si match FALSE si differences */
bool
case_sensitive
=
TRUE
);
/* compare 2 noms de composants, selon regles usuelles
( Jokers * , ? , autoris�s).
la chaine de reference est "pattern"
si case_sensitive == TRUE (default), comparaison exacte
retourne TRUE si match FALSE si differences */
char
*
to_point
(
char
*
Text
);
/* convertit les , en . dans une chaine. utilis� pour compenser la fct printf
qui genere les flottants avec une virgule au lieu du point en mode international */
/* convertit les , en . dans une chaine. utilis� pour compenser la fct printf
qui genere les flottants avec une virgule au lieu du point en mode international */
/****************/
/* infospgm.cpp */
...
...
@@ -532,51 +529,51 @@ void Print_Kicad_Infos(wxWindow * frame);
/**************/
/* common.cpp */
/**************/
wxString
GetBuildVersion
(
void
);
/* Return the build date */
wxString
GetBuildVersion
(
void
);
/* Return the build date */
void
Affiche_1_Parametre
(
WinEDA_DrawFrame
*
frame
,
int
pos_X
,
const
wxString
&
texte_H
,
const
wxString
&
texte_L
,
int
color
);
int
pos_X
,
const
wxString
&
texte_H
,
const
wxString
&
texte_L
,
int
color
);
/*
Routine d'affichage d'un parametre.
pos_X = cadrage horizontal
si pos_X < 0 : la position horizontale est la derniere
valeur demandee >= 0
texte_H = texte a afficher en ligne superieure.
si "", par d'affichage sur cette ligne
texte_L = texte a afficher en ligne inferieure.
si "", par d'affichage sur cette ligne
color = couleur d'affichage
pos_X = cadrage horizontal
si pos_X < 0 : la position horizontale est la derniere
valeur demandee >= 0
texte_H = texte a afficher en ligne superieure.
si "", par d'affichage sur cette ligne
texte_L = texte a afficher en ligne inferieure.
si "", par d'affichage sur cette ligne
color = couleur d'affichage
*/
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 */
int
GetTimeStamp
(
void
);
/* Retoure une identification temporelle (Time stamp) differente a chaque appel */
/* Retoure une identification temporelle (Time stamp) differente a chaque appel */
int
DisplayColorFrame
(
wxWindow
*
parent
);
int
GetCommandOptions
(
const
int
argc
,
const
char
**
argv
,
const
char
*
stringtst
,
const
char
**
optarg
,
int
*
optind
);
const
char
**
optarg
,
int
*
optind
);
void
valeur_param
(
int
valeur
,
wxString
&
buf_texte
);
/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
entree : valeur en mils , buffer de texte
retourne en buffer : texte : valeur exprimee en pouces ou millimetres
suivie de " ou mm
entree : valeur en mils , buffer de texte
retourne en buffer : texte : valeur exprimee en pouces ou millimetres
suivie de " ou mm
*/
wxString
ReturnUnitSymbol
(
int
Units
=
g_UnitMetric
);
int
ReturnValueFromString
(
int
Units
,
const
wxString
&
TextValue
,
int
Internal_Unit
);
wxString
ReturnStringFromValue
(
int
Units
,
int
Value
,
int
Internal_Unit
);
void
AddUnitSymbol
(
wxStaticText
&
Stext
,
int
Units
=
g_UnitMetric
);
/* Add string " (mm):" or " ("):" to the static text Stext.
Used in dialog boxes for entering values depending on selected units */
/* Add string " (mm):" or " ("):" to the static text Stext.
Used in dialog boxes for entering values depending on selected units */
void
PutValueInLocalUnits
(
wxTextCtrl
&
TextCtr
,
int
Value
,
int
Internal_Unit
);
/* 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 */
/* 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 */
int
ReturnValueFromTextCtrl
(
const
wxTextCtrl
&
TextCtr
,
int
Internal_Unit
);
/* Convert the Value in the wxTextCtrl TextCtrl in an integer,
according to the internal units and the selected unit (g_UnitMetric) */
/* Convert the Value in the wxTextCtrl TextCtrl in an integer,
according to the internal units and the selected unit (g_UnitMetric) */
double
To_User_Unit
(
bool
is_metric
,
int
val
,
int
internal_unit_value
);
int
From_User_Unit
(
bool
is_metric
,
double
val
,
int
internal_unit_value
);
...
...
@@ -591,42 +588,42 @@ void * MyMalloc (size_t nb_octets);
/****************/
int
KeyWordOk
(
const
wxString
&
KeyList
,
const
wxString
&
Database
);
/* Recherche si dans le texte Database on retrouve tous les mots
cles donnes dans KeyList ( KeyList = suite de mots cles
separes par des espaces
Retourne:
0 si aucun mot cle trouv�
1 si mot cle trouv�
cles donnes dans KeyList ( KeyList = suite de mots cles
separes par des espaces
Retourne:
0 si aucun mot cle trouv�
1 si mot cle trouv�
*/
bool
GetAssociatedDocument
(
wxFrame
*
frame
,
const
wxString
&
LibPath
,
const
wxString
&
DocName
);
const
wxString
&
DocName
);
/****************************/
/* get_component_dialog.cpp */
/****************************/
wxString
GetComponentName
(
WinEDA_DrawFrame
*
frame
,
wxArrayString
&
HistoryList
,
const
wxString
&
Title
,
wxString
(
*
AuxTool
)(
WinEDA_DrawFrame
*
parent
)
);
/* Dialog frame to choose a component name */
wxArrayString
&
HistoryList
,
const
wxString
&
Title
,
wxString
(
*
AuxTool
)(
WinEDA_DrawFrame
*
parent
)
);
/* Dialog frame to choose a component name */
void
AddHistoryComponentName
(
wxArrayString
&
HistoryList
,
const
wxString
&
Name
);
/* Add the string "Name" to the history list */
/* Add the string "Name" to the history list */
/**********************/
/* block_commande.cpp */
/**********************/
void
AbortBlockCurrentCommand
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
/* Cancel Current block operation. */
/* Cancel Current block operation. */
void
InitBlockLocateDatas
(
WinEDA_DrawPanel
*
Panel
,
const
wxPoint
&
startpos
);
/* Init the initial values of a BlockLocate, before starting a block command */
/* Init the initial values of a BlockLocate, before starting a block command */
void
DrawAndSizingBlockOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
/* Redraw the outlines of the block which shows the search area for block commands
The first point of the rectangle showing the area is initialised
by InitBlockLocateDatas().
The other point of the rectangle is the mouse cursor */
/* Redraw the outlines of the block which shows the search area for block commands
The first point of the rectangle showing the area is initialised
by InitBlockLocateDatas().
The other point of the rectangle is the mouse cursor */
#endif
// COMMON_H
#endif
// COMMON_H
include/eda_dde.h
View file @
51fc26e1
...
...
@@ -11,17 +11,20 @@
#define WinEDA_Server wxSocketServer
/********************/
/* autres fonctions */
/********************/
WinEDA_Server
*
CreateServer
(
wxWindow
*
window
,
int
service
);
bool
SendCommand
(
int
service
,
char
*
cmdline
);
void
SetupServerFunction
(
void
(
*
remotefct
)(
char
*
remotecmd
)
);
// TCP/IP ports used by PCBNEW and EESCHEMA respectively.
#define KICAD_PCB_PORT_SERVICE_NUMBER 4242 ///< PCBNEW listens on this port for commands from EESCHEMA
#define KICAD_SCH_PORT_SERVICE_NUMBER 4243 ///< EESCHEMA listens on this port for commands from PCBNEW
#define MSG_TO_PCB KICAD_PCB_PORT_SERVICE_NUMBER
#define MSG_TO_SCH KICAD_SCH_PORT_SERVICE_NUMBER
/********************/
/* autres fonctions */
/********************/
WinEDA_Server
*
CreateServer
(
wxWindow
*
window
,
int
port
);
bool
SendCommand
(
int
port
,
const
char
*
cmdline
);
void
SetupServerFunction
(
void
(
*
remotefct
)
(
const
char
*
remotecmd
)
);
include/wxstruct.h
View file @
51fc26e1
...
...
@@ -700,6 +700,14 @@ public:
// divers
void
InstallFindFrame
(
const
wxPoint
&
pos
,
wxDC
*
DC
);
/**
* Function SendMessageToEESCHEMA
* sends a message to the schematic editor so that it may move its cursor
* to a part with the same reference as the objectToSync
* @param objectToSync The object whose reference is used to syncronize eeschema.
*/
void
SendMessageToEESCHEMA
(
EDA_BaseStruct
*
objectToSync
);
/* Special micro_ondes */
void
Edit_Gap
(
wxDC
*
DC
,
MODULE
*
Module
);
MODULE
*
Create_MuWaveBasicShape
(
wxDC
*
DC
,
const
wxString
&
name
,
int
pad_count
);
...
...
@@ -974,7 +982,17 @@ public:
bool
LoadOneSheet
(
SCH_SCREEN
*
screen
,
const
wxString
&
FullFileName
);
// General search:
EDA_BaseStruct
*
FindSchematicItem
(
const
wxString
&
pattern
,
int
SearchType
);
/**
* Function FindSchematicItem
* finds a string in the schematic.
* @param pattern The text to search for, either in value, reference or elsewhere.
* @param SearchType: 0 => Search is made in current sheet
* 1 => the whole hierarchy
* 2 => or for the next item
* @param mouseWarp If true, then move the mouse cursor to the item.
*/
EDA_BaseStruct
*
FindSchematicItem
(
const
wxString
&
pattern
,
int
SearchType
,
bool
mouseWarp
=
true
);
EDA_BaseStruct
*
FindMarker
(
int
SearchType
);
private
:
...
...
pcbnew/class_text_mod.h
View file @
51fc26e1
...
...
@@ -2,6 +2,11 @@
/* class_text_module.h : texts module description */
/***************************************************/
#ifndef TEXT_MODULE_H
#define TEXT_MODULE_H
/* Description des Textes sur Modules : */
#define TEXT_is_REFERENCE 0
#define TEXT_is_VALUE 1
...
...
@@ -80,3 +85,6 @@ public:
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
#endif // TEXT_MODULE_H
pcbnew/controle.cpp
View file @
51fc26e1
...
...
@@ -22,53 +22,57 @@
/* Variables Locales */
/**********************************/
void
RemoteCommand
(
char
*
cmdline
)
void
RemoteCommand
(
c
onst
c
har
*
cmdline
)
/**********************************/
/* Read a remote command send by eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
*/
{
char
L
ine
[
1024
];
char
l
ine
[
1024
];
wxString
msg
;
char
*
idcmd
,
*
text
;
WinEDA_PcbFrame
*
frame
=
EDA_Appl
->
m_PcbFrame
;
strncpy
(
Line
,
cmdline
,
sizeof
(
L
ine
)
-
1
);
msg
=
CONV_FROM_UTF8
(
L
ine
);
strncpy
(
line
,
cmdline
,
sizeof
(
l
ine
)
-
1
);
msg
=
CONV_FROM_UTF8
(
l
ine
);
idcmd
=
strtok
(
L
ine
,
"
\n\r
"
);
idcmd
=
strtok
(
l
ine
,
"
\n\r
"
);
text
=
strtok
(
NULL
,
"
\n\r
"
);
if
(
(
idcmd
==
NULL
)
||
(
text
==
NULL
)
)
return
;
if
(
strcmp
(
idcmd
,
"$PART:"
)
==
0
)
{
MODULE
*
Module
;
msg
=
CONV_FROM_UTF8
(
text
);
Module
=
ReturnModule
(
frame
->
m_Pcb
,
msg
);
MODULE
*
module
=
ReturnModule
(
frame
->
m_Pcb
,
msg
);
msg
.
Printf
(
_
(
"Locate module %s %s"
),
msg
.
GetData
(),
Module
?
wxT
(
"Ok"
)
:
wxT
(
"not found"
)
);
module
?
wxT
(
"Ok"
)
:
wxT
(
"not found"
)
);
frame
->
Affiche_Message
(
msg
);
if
(
M
odule
)
if
(
m
odule
)
{
wxClientDC
dc
(
frame
->
DrawPanel
);
frame
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
frame
->
DrawPanel
->
CursorOff
(
&
dc
);
frame
->
GetScreen
()
->
m_Curseur
=
M
odule
->
m_Pos
;
frame
->
GetScreen
()
->
m_Curseur
=
m
odule
->
m_Pos
;
frame
->
DrawPanel
->
CursorOn
(
&
dc
);
}
}
if
(
idcmd
&&
strcmp
(
idcmd
,
"$PIN:"
)
==
0
)
{
wxString
PinName
,
M
odName
;
MODULE
*
M
odule
;
D_PAD
*
Pad
=
NULL
;
wxString
pinName
,
m
odName
;
MODULE
*
m
odule
;
D_PAD
*
pad
=
NULL
;
int
netcode
=
-
1
;
PinName
=
CONV_FROM_UTF8
(
text
);
text
=
strtok
(
NULL
,
"
\n\r
"
);
pinName
=
CONV_FROM_UTF8
(
text
);
text
=
strtok
(
NULL
,
"
\n\r
"
);
if
(
text
&&
strcmp
(
text
,
"$PART:"
)
==
0
)
text
=
strtok
(
NULL
,
"
\n\r
"
);
...
...
@@ -76,30 +80,34 @@ void RemoteCommand( char* cmdline )
frame
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
ModName
=
CONV_FROM_UTF8
(
text
);
Module
=
ReturnModule
(
frame
->
m_Pcb
,
ModName
);
if
(
Module
)
Pad
=
ReturnPad
(
Module
,
PinName
);
if
(
Pad
)
netcode
=
Pad
->
m_NetCode
;
modName
=
CONV_FROM_UTF8
(
text
);
module
=
ReturnModule
(
frame
->
m_Pcb
,
modName
);
if
(
module
)
pad
=
ReturnPad
(
module
,
pinName
);
if
(
pad
)
netcode
=
pad
->
m_NetCode
;
if
(
netcode
>
0
)
{
/* effacement surbrillance ancienne */
if
(
g_HightLigt_Status
)
frame
->
Hight_Light
(
&
dc
);
g_HightLigth_NetCode
=
netcode
;
frame
->
Hight_Light
(
&
dc
);
frame
->
DrawPanel
->
CursorOff
(
&
dc
);
frame
->
GetScreen
()
->
m_Curseur
=
P
ad
->
m_Pos
;
frame
->
GetScreen
()
->
m_Curseur
=
p
ad
->
m_Pos
;
frame
->
DrawPanel
->
CursorOn
(
&
dc
);
}
if
(
M
odule
==
NULL
)
if
(
m
odule
==
NULL
)
msg
.
Printf
(
_
(
"module %s not found"
),
text
);
else
if
(
P
ad
==
NULL
)
msg
.
Printf
(
_
(
"Pin %s (module %s) not found"
),
PinName
.
GetData
(),
M
odName
.
GetData
()
);
else
if
(
p
ad
==
NULL
)
msg
.
Printf
(
_
(
"Pin %s (module %s) not found"
),
pinName
.
GetData
(),
m
odName
.
GetData
()
);
else
msg
.
Printf
(
_
(
"Locate Pin %s (module %s)"
),
PinName
.
GetData
(),
M
odName
.
GetData
()
);
msg
.
Printf
(
_
(
"Locate Pin %s (module %s)"
),
pinName
.
GetData
(),
m
odName
.
GetData
()
);
frame
->
Affiche_Message
(
msg
);
}
}
...
...
pcbnew/edit.cpp
View file @
51fc26e1
...
...
@@ -11,8 +11,9 @@
#include "autorout.h"
#include "id.h"
#include "protos.h"
#include "eda_dde.h"
#define CURRENT_ITEM (GetScreen()->m_CurrentItem)
...
...
@@ -94,6 +95,8 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
else
{
DrawStruct
=
PcbGeneralLocateAndDisplay
();
if
(
DrawStruct
)
SendMessageToEESCHEMA
(
DrawStruct
);
}
}
...
...
@@ -128,6 +131,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct
=
m_Pcb
->
FindPadOrModule
(
GetScreen
()
->
RefPos
(
true
),
GetScreen
()
->
m_Active_Layer
);
Show_1_Ratsnest
(
DrawStruct
,
DC
);
if
(
DrawStruct
)
SendMessageToEESCHEMA
(
DrawStruct
);
break
;
case
ID_PCB_MIRE_BUTT
:
...
...
@@ -311,6 +317,27 @@ out:
}
// see wxstruct.h
void
WinEDA_PcbFrame
::
SendMessageToEESCHEMA
(
EDA_BaseStruct
*
objectToSync
)
{
char
cmd
[
1024
];
MODULE
*
module
=
NULL
;
if
(
objectToSync
->
m_StructType
==
TYPEMODULE
)
module
=
(
MODULE
*
)
objectToSync
;
else
if
(
objectToSync
->
m_StructType
==
TYPEPAD
)
module
=
(
MODULE
*
)((
D_PAD
*
)
objectToSync
)
->
m_Parent
;
// ask only for the reference for now, maybe pins later.
if
(
module
)
{
sprintf
(
cmd
,
"$PART: %s"
,
CONV_TO_UTF8
(
module
->
m_Reference
->
m_Text
)
);
SendCommand
(
MSG_TO_SCH
,
cmd
);
}
}
/*********************************************************************/
void
WinEDA_PcbFrame
::
Process_Special_Functions
(
wxCommandEvent
&
event
)
/*********************************************************************/
...
...
pcbnew/files.cpp
View file @
51fc26e1
...
...
@@ -235,7 +235,9 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo
g_SaveTime
=
time
(
NULL
);
#if defined(DEBUG)
#if 0 && defined(DEBUG)
// note this seems to freeze up pcbnew when run under the kicad project
// manager. runs fine from command prompt.
// output the board object tree to stdout:
m_Pcb->Show( 0, std::cout );
#endif
...
...
pcbnew/protos.h
View file @
51fc26e1
...
...
@@ -394,7 +394,7 @@ TRACK * CreateLockPoint(int *pX, int *pY, TRACK * ptsegm, TRACK * refsegm);
/****************/
/* CONTROLE.CPP */
/****************/
void
RemoteCommand
(
char
*
cmdline
);
void
RemoteCommand
(
const
char
*
cmdline
);
/*************/
/* STRUCT.CPP */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment