Commit ee68d20e authored by CHARRAS's avatar CHARRAS

create new file cross-probing.cpp Move RemoteCommand() and SendMessageToEESCHEMA() to it

parent a97b0dab
...@@ -4,6 +4,13 @@ Started 2007-June-11 ...@@ -4,6 +4,13 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Oct-6 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ pcbnew
create new file cross-probing.cpp
move RemoteCommand() and SendMessageToEESCHEMA() to cross-probing.cpp
2007-Oct-3 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Oct-3 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
......
...@@ -26,8 +26,7 @@ class WinEDA_DrawPanel : public EDA_DRAW_PANEL ...@@ -26,8 +26,7 @@ class WinEDA_DrawPanel : public EDA_DRAW_PANEL
public: public:
int m_Ident; int m_Ident;
WinEDA_DrawFrame* m_Parent; WinEDA_DrawFrame* m_Parent;
EDA_Rect m_ClipBox; /* position et taille de la fenetre de trace EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the visible area in internal units)
* pour les "RePaint" d'ecran */
wxPoint m_CursorStartPos; // utile dans controles du mouvement curseur wxPoint m_CursorStartPos; // utile dans controles du mouvement curseur
int m_Scroll_unit; // Valeur de l'unite de scroll en pixels pour les barres de scroll int m_Scroll_unit; // Valeur de l'unite de scroll en pixels pour les barres de scroll
int m_ScrollButt_unit; // Valeur de l'unite de scroll en pixels pour les boutons de scroll int m_ScrollButt_unit; // Valeur de l'unite de scroll en pixels pour les boutons de scroll
...@@ -35,14 +34,14 @@ public: ...@@ -35,14 +34,14 @@ public:
bool m_AbortRequest; // Flag d'arret de commandes longues bool m_AbortRequest; // Flag d'arret de commandes longues
bool m_AbortEnable; // TRUE si menu ou bouton Abort doit etre affiche bool m_AbortEnable; // TRUE si menu ou bouton Abort doit etre affiche
bool m_AutoPAN_Enable; // TRUE pour autoriser auto pan (autorisation g��ale) bool m_AutoPAN_Enable; // TRUE to allow auto pan
bool m_AutoPAN_Request; // TRUE pour auto pan (lorsque auto pan n�essaire) bool m_AutoPAN_Request; // TRUE to request an auto pan (will be made only if m_AutoPAN_Enable = true)
int m_IgnoreMouseEvents; ///< when non-zero, then ignore mouse events int m_IgnoreMouseEvents; // when non-zero (true), then ignore mouse events
bool m_Block_Enable; // TRUE pour autoriser Bloc Commandes (autorisation g��ale) bool m_Block_Enable; // TRUE to accept Block Commands
int m_CanStartBlock; // >= 0 (ou >= n) si un bloc peut demarrer int m_CanStartBlock; // >= 0 (or >= n) if a block can start
// (filtrage des commandes de debut de bloc ) // usefull ot avoid false start block in certain cases (like switch from a sheet to an other scheet
int m_PanelDefaultCursor; // Current mouse cursor default shape id for this window int m_PanelDefaultCursor; // Current mouse cursor default shape id for this window
int m_PanelCursor; // Current mouse cursor shape id for this window int m_PanelCursor; // Current mouse cursor shape id for this window
int m_CursorLevel; // Index for cursor redraw in XOR mode int m_CursorLevel; // Index for cursor redraw in XOR mode
......
...@@ -359,13 +359,13 @@ public: ...@@ -359,13 +359,13 @@ public:
class DRAWSEGMENT : public BOARD_ITEM class DRAWSEGMENT : public BOARD_ITEM
{ {
public: public:
int m_Width; // 0 = line, > 0 = tracks, bus ... int m_Width; // 0 = line. if > 0 = tracks, bus ...
wxPoint m_Start; // Line start point wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point wxPoint m_End; // Line end point
int m_Shape; // forme: Segment , Cercle.. int m_Shape; // Shape: line, Circle, Arc
int m_Type; // numero de sous type ( cotation.. ) int m_Type; // Used in complex associations ( Dimensions.. )
int m_Angle; // pour les arcs: "longueur" de l'arc en 1/10 deg int m_Angle; // Used only for Arcs: Arc angle in 1/10 deg
public: public:
DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype = TYPEDRAWSEGMENT ); DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype = TYPEDRAWSEGMENT );
...@@ -375,7 +375,7 @@ public: ...@@ -375,7 +375,7 @@ public:
bool WriteDrawSegmentDescr( FILE* File ); bool WriteDrawSegmentDescr( FILE* File );
bool ReadDrawSegmentDescr( FILE* File, int* LineNum ); bool ReadDrawSegmentDescr( FILE* File, int* LineNum );
/* supprime du chainage la structure Struct */ /* remove this from the linked list */
void UnLink(); void UnLink();
void Copy( DRAWSEGMENT* source ); void Copy( DRAWSEGMENT* source );
...@@ -429,18 +429,17 @@ public: ...@@ -429,18 +429,17 @@ public:
}; };
/************************************/ /***************************************/
/* Gestion des marqueurs sur le PCB */ /* Markers: used to show a drc problem */
/************************************/ /***************************************/
class MARQUEUR : public BOARD_ITEM class MARQUEUR : public BOARD_ITEM
{ {
/* Description d'un marqueur */
public: public:
wxPoint m_Pos; wxPoint m_Pos;
char* m_Bitmap; /* Shape (bitmap) */ char* m_Bitmap; /* Shape (bitmap) */
int m_Type; int m_Type;
int m_Color; /* couleur */ int m_Color; /* color */
wxString m_Diag; /* Associated text (comment) */ wxString m_Diag; /* Associated text (comment) */
public: public:
......
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -43,10 +43,11 @@ endif ...@@ -43,10 +43,11 @@ endif
SYSWXLIB = `$(WXWIN)/wx-config --libs gl`\ SYSWXLIB = `$(WXWIN)/wx-config --libs gl`\
-lwxpng-$(LIBVERSION) -lwxjpeg-$(LIBVERSION) -lwxzlib-$(LIBVERSION) $(PYLIBS) -lwxpng-$(LIBVERSION) -lwxjpeg-$(LIBVERSION) -lwxzlib-$(LIBVERSION) $(PYLIBS)
CC = gcc
.cpp.o: .cpp.o:
gcc -c -Wall $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS) -o $@ $*.cpp gcc -c -Wall $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS) -o $@ $*.cpp
# Settings for Cyginw/Mingw32 # Settings for Cyginw/Mingw32
# Some versions of windres cannot cope with the --preprocessor # Some versions of windres cannot cope with the --preprocessor
# option. Uncomment the RCPREPROCESSOR line below if yours can. # option. Uncomment the RCPREPROCESSOR line below if yours can.
......
...@@ -95,7 +95,10 @@ int WinEDA_BasePcbFrame::BestZoom( void ) ...@@ -95,7 +95,10 @@ int WinEDA_BasePcbFrame::BestZoom( void )
} }
void WinEDA_BasePcbFrame::ReCreateMenuBar( void ) // fonction virtuelle /*************************************************/
void WinEDA_BasePcbFrame::ReCreateMenuBar( void )
/*************************************************/
// Virtual function
{ {
} }
...@@ -106,7 +109,7 @@ void WinEDA_BasePcbFrame::ReCreateMenuBar( void ) // fonction virtuelle ...@@ -106,7 +109,7 @@ void WinEDA_BasePcbFrame::ReCreateMenuBar( void ) // fonction virtuelle
void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event ) void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event )
/***********************************************************/ /***********************************************************/
/* Ouvre la frame d'affichage 3D /* Creat and show the 3D frame display
*/ */
{ {
#ifndef GERBVIEW #ifndef GERBVIEW
...@@ -151,8 +154,8 @@ void WinEDA_BasePcbFrame::GetComponentFromRedoList( void ) ...@@ -151,8 +154,8 @@ void WinEDA_BasePcbFrame::GetComponentFromRedoList( void )
/****************************************************************/ /****************************************************************/
void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer ) void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
/*****************************************************************/ /*****************************************************************/
//Note: virtual, overridden in WinEDA_PcbFrame;
{ {
//Note: virtual, overridden in WinEDA_PcbFrame;
int preslayer = GetScreen()->m_Active_Layer; int preslayer = GetScreen()->m_Active_Layer;
//if there is only one layer, don't switch. //if there is only one layer, don't switch.
...@@ -174,9 +177,9 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer ) ...@@ -174,9 +177,9 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
/*****************************************************************/ /**********************************************************************/
void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event ) void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event )
/*****************************************************************/ /**********************************************************************/
{ {
int id = event.GetId(); int id = event.GetId();
......
...@@ -16,113 +16,15 @@ ...@@ -16,113 +16,15 @@
#include "bitmaps.h" #include "bitmaps.h"
/*************************************************************************************/
/*******************************************/ static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aCollector )
void RemoteCommand( const char* cmdline ) /*************************************************************************************/
/*******************************************/
/** Read a remote command send by eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
* @param cmdline = received command from eeschema
* Commands are
* $PART: "reference" put cursor on component
* $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
*/
{
char line[1024];
wxString msg;
char* idcmd;
char* text;
MODULE* module = 0;
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
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 )
{
msg = CONV_FROM_UTF8( text );
module = ReturnModule( frame->m_Pcb, msg );
msg.Printf( _( "Locate module %s %s" ), msg.GetData(),
module ? wxT( "Ok" ) : wxT( "not found" ) );
frame->Affiche_Message( msg );
if( module )
{
wxClientDC dc( frame->DrawPanel );
frame->DrawPanel->PrepareGraphicContext( &dc );
frame->DrawPanel->CursorOff( &dc );
frame->GetScreen()->m_Curseur = module->m_Pos;
frame->DrawPanel->CursorOn( &dc );
}
}
if( idcmd && strcmp( idcmd, "$PIN:" ) == 0 )
{
wxString pinName, modName;
D_PAD* pad = NULL;
int netcode = -1;
pinName = CONV_FROM_UTF8( text );
text = strtok( NULL, " \n\r" );
if( text && strcmp( text, "$PART:" ) == 0 )
text = strtok( NULL, "\n\r" );
wxClientDC dc( frame->DrawPanel );
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;
if( netcode > 0 ) /* hightlighted the net selected net*/
{
if( g_HightLigt_Status ) /* erase the old hightlighted net */
frame->Hight_Light( &dc );
g_HightLigth_NetCode = netcode;
frame->Hight_Light( &dc ); /* hightlighted the new one */
frame->DrawPanel->CursorOff( &dc );
frame->GetScreen()->m_Curseur = pad->m_Pos;
frame->DrawPanel->CursorOn( &dc );
}
if( module == NULL )
msg.Printf( _( "module %s not found" ), text );
else if( pad == NULL )
msg.Printf( _( "Pin %s (module %s) not found" ), pinName.GetData(), modName.GetData() );
else
msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() );
frame->Affiche_Message( msg );
}
if( module ) // if found, center the module on screen.
frame->Recadre_Trace( false );
}
/** /**
* Function AllAreModulesAndReturnSmallestIfSo * Function AllAreModulesAndReturnSmallestIfSo
* tests that all items in the collection are MODULEs and if so, returns the * tests that all items in the collection are MODULEs and if so, returns the
* smallest MODULE. * smallest MODULE.
* @return BOARD_ITEM* - The smallest or NULL. * @return BOARD_ITEM* - The smallest or NULL.
*/ */
static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aCollector )
{ {
int count = aCollector->GetCount(); int count = aCollector->GetCount();
......
/*****************************************************************/
/* Cross probing function: handle communication to/from eeschema */
/*****************************************************************/
/* cross-probing.cpp */
#include "fctsys.h"
#include "common.h"
#include "pcbnew.h"
#include "eda_dde.h"
#include "id.h"
#include "collectors.h"
#include "protos.h"
/*******************************************/
void RemoteCommand( const char* cmdline )
/*******************************************/
/** Read a remote command send by eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
* @param cmdline = received command from eeschema
* Commands are
* $PART: "reference" put cursor on component
* $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
*/
{
char line[1024];
wxString msg;
char* idcmd;
char* text;
MODULE* module = 0;
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
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 )
{
msg = CONV_FROM_UTF8( text );
module = ReturnModule( frame->m_Pcb, msg );
msg.Printf( _( "Locate module %s %s" ), msg.GetData(),
module ? wxT( "Ok" ) : wxT( "not found" ) );
frame->Affiche_Message( msg );
if( module )
{
wxClientDC dc( frame->DrawPanel );
frame->DrawPanel->PrepareGraphicContext( &dc );
frame->DrawPanel->CursorOff( &dc );
frame->GetScreen()->m_Curseur = module->m_Pos;
frame->DrawPanel->CursorOn( &dc );
}
}
if( idcmd && strcmp( idcmd, "$PIN:" ) == 0 )
{
wxString pinName, modName;
D_PAD* pad = NULL;
int netcode = -1;
pinName = CONV_FROM_UTF8( text );
text = strtok( NULL, " \n\r" );
if( text && strcmp( text, "$PART:" ) == 0 )
text = strtok( NULL, "\n\r" );
wxClientDC dc( frame->DrawPanel );
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;
if( netcode > 0 ) /* hightlighted the net selected net*/
{
if( g_HightLigt_Status ) /* erase the old hightlighted net */
frame->Hight_Light( &dc );
g_HightLigth_NetCode = netcode;
frame->Hight_Light( &dc ); /* hightlighted the new one */
frame->DrawPanel->CursorOff( &dc );
frame->GetScreen()->m_Curseur = pad->m_Pos;
frame->DrawPanel->CursorOn( &dc );
}
if( module == NULL )
msg.Printf( _( "module %s not found" ), text );
else if( pad == NULL )
msg.Printf( _( "Pin %s (module %s) not found" ), pinName.GetData(), modName.GetData() );
else
msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() );
frame->Affiche_Message( msg );
}
if( module ) // if found, center the module on screen.
frame->Recadre_Trace( false );
}
// see wxstruct.h
/**************************************************************************/
void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
/**************************************************************************/
/** Send a remote command to eeschema via a socket,
* @param objectToSync = item to be located on schematic (module, pin or text)
* Commands are
* $PART: "reference" put cursor on component anchor
* $PART: "reference" $PAD: "pad number" put cursor on the component pin
* $PART: "reference" $REF: "reference" put cursor on the component ref
* $PART: "reference" $VAL: "value" put cursor on the component value
*/
{
char cmd[1024];
const char* text_key;
MODULE* module = NULL;
D_PAD* pad;
TEXTE_MODULE* text_mod;
wxString msg;
if( objectToSync == NULL )
return;
switch( objectToSync->Type() )
{
case TYPEMODULE:
module = (MODULE*) objectToSync;
sprintf( cmd, "$PART: \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ) );
break;
case TYPEPAD:
module = (MODULE*) objectToSync->m_Parent;
pad = (D_PAD*) objectToSync;
msg = pad->ReturnStringPadName();
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ),
CONV_TO_UTF8( msg ) );
break;
case TYPETEXTEMODULE:
#define REFERENCE 0
#define VALUE 1
module = (MODULE*) objectToSync->m_Parent;
text_mod = (TEXTE_MODULE*) objectToSync;
if( text_mod->m_Type == REFERENCE )
text_key = "$REF:";
else if( text_mod->m_Type == VALUE )
text_key = "$VAL:";
else
break;
sprintf( cmd, "$PART: \"%s\" %s \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ),
text_key,
CONV_TO_UTF8( text_mod->m_Text ) );
break;
default:
break;
}
if( module )
{
SendCommand( MSG_TO_SCH, cmd );
}
}
...@@ -12,80 +12,11 @@ ...@@ -12,80 +12,11 @@
#include "id.h" #include "id.h"
#include "protos.h" #include "protos.h"
#include "eda_dde.h"
static void Process_Move_Item( WinEDA_PcbFrame* frame, static void Process_Move_Item( WinEDA_PcbFrame* frame,
EDA_BaseStruct* DrawStruct, wxDC* DC ); EDA_BaseStruct* DrawStruct, wxDC* DC );
// see wxstruct.h
/**************************************************************************/
void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
/**************************************************************************/
/** Send a remote command to eeschema via a socket,
* @param objectToSync = item to be located on schematic (module, pin or text)
* Commands are
* $PART: "reference" put cursor on component anchor
* $PART: "reference" $PAD: "pad number" put cursor on the component pin
* $PART: "reference" $REF: "reference" put cursor on the component ref
* $PART: "reference" $VAL: "value" put cursor on the component value
*/
{
char cmd[1024];
const char* text_key;
MODULE* module = NULL;
D_PAD* pad;
TEXTE_MODULE* text_mod;
wxString msg;
if( objectToSync == NULL )
return;
switch( objectToSync->Type() )
{
case TYPEMODULE:
module = (MODULE*) objectToSync;
sprintf( cmd, "$PART: \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ) );
break;
case TYPEPAD:
module = (MODULE*) objectToSync->m_Parent;
pad = (D_PAD*) objectToSync;
msg = pad->ReturnStringPadName();
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ),
CONV_TO_UTF8( msg ) );
break;
case TYPETEXTEMODULE:
#define REFERENCE 0
#define VALUE 1
module = (MODULE*) objectToSync->m_Parent;
text_mod = (TEXTE_MODULE*) objectToSync;
if( text_mod->m_Type == REFERENCE )
text_key = "$REF:";
else if( text_mod->m_Type == VALUE )
text_key = "$VAL:";
else
break;
sprintf( cmd, "$PART: \"%s\" %s \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ),
text_key,
CONV_TO_UTF8( text_mod->m_Text ) );
break;
default:
break;
}
if( module )
{
SendCommand( MSG_TO_SCH, cmd );
}
}
/*********************************************************************/ /*********************************************************************/
void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
......
...@@ -243,7 +243,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC ) ...@@ -243,7 +243,7 @@ void WinEDA_PcbFrame::Other_Layer_Route( TRACK* track, wxDC* DC )
Via->SetLayerPair( old_layer, GetScreen()->m_Active_Layer ); Via->SetLayerPair( old_layer, GetScreen()->m_Active_Layer );
} }
else // @todo: why have this override behaviour? why does the user even need to tell us what kind of via, when we know which two layers are in play? else
{ {
// Usual via is from copper to component; layer pair is 0 and 0x0F. // Usual via is from copper to component; layer pair is 0 and 0x0F.
Via->SetLayerPair( LAYER_CUIVRE_N, LAYER_CMP_N ); Via->SetLayerPair( LAYER_CUIVRE_N, LAYER_CMP_N );
......
...@@ -13,6 +13,7 @@ OBJECTS= $(TARGET).o classpcb.o\ ...@@ -13,6 +13,7 @@ OBJECTS= $(TARGET).o classpcb.o\
onrightclick.o\ onrightclick.o\
onleftclick.o\ onleftclick.o\
modedit_onclick.o\ modedit_onclick.o\
cross-probing.o\
via_edit.o\ via_edit.o\
wxprint.o \ wxprint.o \
cursors.o\ cursors.o\
......
/////////////////////////////////////////////////////////////////////////////
// Name: win_eda_cleaningoptionsframe.cpp
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 25/05/2007 13:39:29
// RCS-ID:
// Copyright: GNU License
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 25/05/2007 13:39:29
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "win_eda_cleaningoptionsframe.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
////@begin includes
////@end includes
#include "win_eda_cleaningoptionsframe.h"
////@begin XPM images
////@end XPM images
/*!
* Win_EDA_CleaningOptionsFrame type definition
*/
IMPLEMENT_DYNAMIC_CLASS( Win_EDA_CleaningOptionsFrame, wxDialog )
/*!
* Win_EDA_CleaningOptionsFrame event table definition
*/
BEGIN_EVENT_TABLE( Win_EDA_CleaningOptionsFrame, wxDialog )
////@begin Win_EDA_CleaningOptionsFrame event table entries
////@end Win_EDA_CleaningOptionsFrame event table entries
END_EVENT_TABLE()
/*!
* Win_EDA_CleaningOptionsFrame constructors
*/
Win_EDA_CleaningOptionsFrame::Win_EDA_CleaningOptionsFrame()
{
Init();
}
Win_EDA_CleaningOptionsFrame::Win_EDA_CleaningOptionsFrame( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
Init();
Create(parent, id, caption, pos, size, style);
}
/*!
* Win_EDA_CleaningOptionsFrame creator
*/
bool Win_EDA_CleaningOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin Win_EDA_CleaningOptionsFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
Centre();
////@end Win_EDA_CleaningOptionsFrame creation
return true;
}
/*!
* Win_EDA_CleaningOptionsFrame destructor
*/
Win_EDA_CleaningOptionsFrame::~Win_EDA_CleaningOptionsFrame()
{
////@begin Win_EDA_CleaningOptionsFrame destruction
////@end Win_EDA_CleaningOptionsFrame destruction
}
/*!
* Member initialisation
*/
void Win_EDA_CleaningOptionsFrame::Init()
{
////@begin Win_EDA_CleaningOptionsFrame member initialisation
m_CleanViasOpt = NULL;
m_MergetSegmOpt = NULL;
m_DeleteNullSegmOpt = NULL;
m_DeleteunconnectedOpt = NULL;
m_ConnectToPadsOpt = NULL;
////@end Win_EDA_CleaningOptionsFrame member initialisation
}
/*!
* Control creation for Win_EDA_CleaningOptionsFrame
*/
void Win_EDA_CleaningOptionsFrame::CreateControls()
{
////@begin Win_EDA_CleaningOptionsFrame content construction
// Generated by DialogBlocks, 25/05/2007 13:58:52 (unregistered)
Win_EDA_CleaningOptionsFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Static"));
wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer(itemStaticBoxSizer4Static, wxVERTICAL);
itemBoxSizer3->Add(itemStaticBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_CleanViasOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX_CLEAN_VIAS, _("Delete redundant vias"), wxDefaultPosition, wxDefaultSize, 0 );
m_CleanViasOpt->SetValue(true);
itemStaticBoxSizer4->Add(m_CleanViasOpt, 0, wxALIGN_LEFT|wxALL, 5);
m_MergetSegmOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX_MERGE_SEGMENTS, _("Merge segments"), wxDefaultPosition, wxDefaultSize, 0 );
m_MergetSegmOpt->SetValue(true);
itemStaticBoxSizer4->Add(m_MergetSegmOpt, 0, wxALIGN_LEFT|wxALL, 5);
m_DeleteNullSegmOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX_DELETE_NULL_SEGM, _("Delete 0 lenght segments"), wxDefaultPosition, wxDefaultSize, 0 );
m_DeleteNullSegmOpt->SetValue(true);
itemStaticBoxSizer4->Add(m_DeleteNullSegmOpt, 0, wxALIGN_LEFT|wxALL, 5);
m_DeleteunconnectedOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Delete unconnected tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_DeleteunconnectedOpt->SetValue(true);
itemStaticBoxSizer4->Add(m_DeleteunconnectedOpt, 0, wxALIGN_LEFT|wxALL, 5);
m_ConnectToPadsOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Connect to Pads"), wxDefaultPosition, wxDefaultSize, 0 );
m_ConnectToPadsOpt->SetValue(false);
itemStaticBoxSizer4->Add(m_ConnectToPadsOpt, 0, wxALIGN_LEFT|wxALL, 5);
wxStaticBox* itemStaticBoxSizer10Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Static"));
wxStaticBoxSizer* itemStaticBoxSizer10 = new wxStaticBoxSizer(itemStaticBoxSizer10Static, wxVERTICAL);
itemBoxSizer3->Add(itemStaticBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton* itemButton11 = new wxButton( itemDialog1, ID_BUTTON_EXECUTE, _("Clean pcb"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton11->SetDefault();
itemStaticBoxSizer10->Add(itemButton11, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
itemBoxSizer2->Add(5, 5, 0, wxGROW|wxALL, 5);
wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("Infos:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxTextCtrl* itemTextCtrl14 = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxSize(-1, 120), wxTE_MULTILINE );
itemBoxSizer2->Add(itemTextCtrl14, 0, wxGROW|wxALL, 5);
// Set validators
m_CleanViasOpt->SetValidator( wxGenericValidator(& s_CleanVias) );
m_MergetSegmOpt->SetValidator( wxGenericValidator(& s_MergeSegments) );
m_DeleteNullSegmOpt->SetValidator( wxGenericValidator(& s_Delete0lenSegm) );
m_DeleteunconnectedOpt->SetValidator( wxGenericValidator(& s_DeleteUnconnectedSegm) );
////@end Win_EDA_CleaningOptionsFrame content construction
}
/*!
* Should we show tooltips?
*/
bool Win_EDA_CleaningOptionsFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap Win_EDA_CleaningOptionsFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin Win_EDA_CleaningOptionsFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end Win_EDA_CleaningOptionsFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon Win_EDA_CleaningOptionsFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin Win_EDA_CleaningOptionsFrame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end Win_EDA_CleaningOptionsFrame icon retrieval
}
/////////////////////////////////////////////////////////////////////////////
// Name: win_eda_cleaningoptionsframe.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 25/05/2007 13:39:29
// RCS-ID:
// Copyright: GNU License
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 25/05/2007 13:39:29
#ifndef _WIN_EDA_CLEANINGOPTIONSFRAME_H_
#define _WIN_EDA_CLEANINGOPTIONSFRAME_H_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "win_eda_cleaningoptionsframe.h"
#endif
/*!
* Includes
*/
////@begin includes
#include "wx/valgen.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_WIN_EDA_CLEANINGOPTIONSFRAME 10000
#define ID_CHECKBOX_CLEAN_VIAS 10001
#define ID_CHECKBOX_MERGE_SEGMENTS 10003
#define ID_CHECKBOX_DELETE_NULL_SEGM 10002
#define ID_CHECKBOX1 10005
#define ID_CHECKBOX 10004
#define ID_BUTTON_EXECUTE 10006
#define ID_TEXTCTRL1 10007
#define SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_TITLE _("Cleaning options")
#define SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_IDNAME ID_WIN_EDA_CLEANINGOPTIONSFRAME
#define SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Win_EDA_CleaningOptionsFrame class declaration
*/
class Win_EDA_CleaningOptionsFrame: public wxDialog
{
DECLARE_DYNAMIC_CLASS( Win_EDA_CleaningOptionsFrame )
DECLARE_EVENT_TABLE()
public:
/// Constructors
Win_EDA_CleaningOptionsFrame();
Win_EDA_CleaningOptionsFrame( wxWindow* parent, wxWindowID id = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_IDNAME, const wxString& caption = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_TITLE, const wxPoint& pos = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_POSITION, const wxSize& size = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_SIZE, long style = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_STYLE );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_IDNAME, const wxString& caption = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_TITLE, const wxPoint& pos = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_POSITION, const wxSize& size = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_SIZE, long style = SYMBOL_WIN_EDA_CLEANINGOPTIONSFRAME_STYLE );
/// Destructor
~Win_EDA_CleaningOptionsFrame();
/// Initialises member variables
void Init();
/// Creates the controls and sizers
void CreateControls();
////@begin Win_EDA_CleaningOptionsFrame event handler declarations
////@end Win_EDA_CleaningOptionsFrame event handler declarations
////@begin Win_EDA_CleaningOptionsFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end Win_EDA_CleaningOptionsFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin Win_EDA_CleaningOptionsFrame member variables
wxCheckBox* m_CleanViasOpt;
wxCheckBox* m_MergetSegmOpt;
wxCheckBox* m_DeleteNullSegmOpt;
wxCheckBox* m_DeleteunconnectedOpt;
wxCheckBox* m_ConnectToPadsOpt;
////@end Win_EDA_CleaningOptionsFrame member variables
};
#endif
// _WIN_EDA_CLEANINGOPTIONSFRAME_H_
/******************************************************************/ /******************************************/
/* drawpanel.cpp - fonctions des classes du type WinEDA_DrawPanel */ /* drawpanel.cpp - WinEDA_DrawPanel class */
/******************************************************************/ /******************************************/
#ifdef __GNUG__ #ifdef __GNUG__
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
#include "id.h" #include "id.h"
// defines locaux // defines locaux
#define CURSOR_SIZE 12 // taille de la croix du curseur PCB #define CURSOR_SIZE 12 // Cursor size in pixels
// Variables locales
// table des evenements captes par un WinEDA_DrawPanel // table des evenements captes par un WinEDA_DrawPanel
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL )
...@@ -76,7 +74,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color ) ...@@ -76,7 +74,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
/*********************************************************************************/ /*********************************************************************************/
/* /*
* Trace Le curseur sur la zone PCB , se deplacant sur la grille * Draw the schematic cursor which is usually on grid
*/ */
{ {
if( m_CursorLevel != 0 ) if( m_CursorLevel != 0 )
...@@ -84,11 +82,11 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color ) ...@@ -84,11 +82,11 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
return; return;
} }
wxPoint Cursor = GetScreen()->m_Curseur;
if( DC == NULL ) if( DC == NULL )
return; return;
wxPoint Cursor = GetScreen()->m_Curseur;
GRSetDrawMode( DC, GR_XOR ); GRSetDrawMode( DC, GR_XOR );
if( g_CursorShape == 1 ) /* Trace d'un reticule */ if( g_CursorShape == 1 ) /* Trace d'un reticule */
{ {
...@@ -301,7 +299,7 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition() ...@@ -301,7 +299,7 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition()
void WinEDA_DrawPanel::MouseToCursorSchema() void WinEDA_DrawPanel::MouseToCursorSchema()
/**********************************************/ /**********************************************/
/* place le curseur souris sur la position du curseur schema /* Move the mouse cursor to the current schematic cursor
*/ */
{ {
wxPoint Mouse = CursorScreenPosition(); wxPoint Mouse = CursorScreenPosition();
...@@ -314,7 +312,8 @@ void WinEDA_DrawPanel::MouseToCursorSchema() ...@@ -314,7 +312,8 @@ void WinEDA_DrawPanel::MouseToCursorSchema()
void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse ) void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
/****************************************************/ /****************************************************/
/* place le curseur souris sur la position Mouse /** Move the mouse cursor to the position "Mouse"
* @param Mouse = new mouse cursor position
*/ */
{ {
wxPoint mouse; wxPoint mouse;
...@@ -334,7 +333,7 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse ) ...@@ -334,7 +333,7 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
void WinEDA_DrawPanel::OnActivate( wxActivateEvent& event ) void WinEDA_DrawPanel::OnActivate( wxActivateEvent& event )
/********************************************************/ /********************************************************/
{ {
m_CanStartBlock = -1; // Commande block can't start m_CanStartBlock = -1; // Block Command can't start
event.Skip(); event.Skip();
} }
...@@ -356,7 +355,7 @@ void WinEDA_DrawPanel::OnScroll( wxScrollWinEvent& event ) ...@@ -356,7 +355,7 @@ void WinEDA_DrawPanel::OnScroll( wxScrollWinEvent& event )
int x, y; int x, y;
GetViewStart( &x, &y ); GetViewStart( &x, &y );
dir = event.GetOrientation(); // wxHORIZONTAL ou wxVERTICAL dir = event.GetOrientation(); // wxHORIZONTAL or wxVERTICAL
if( id == wxEVT_SCROLLWIN_LINEUP ) if( id == wxEVT_SCROLLWIN_LINEUP )
value = -m_ScrollButt_unit; value = -m_ScrollButt_unit;
...@@ -641,19 +640,19 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -641,19 +640,19 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
} }
} }
/* trace des axes principaux */ /* Draw axis */
if( m_Parent->m_Draw_Axis ) if( m_Parent->m_Draw_Axis )
{ {
/* Trace de l'axe vertical */ /* Draw the Y axis */
GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y, GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
0, screen->ReturnPageSize().y, 0, Color ); 0, screen->ReturnPageSize().y, 0, Color );
/* Trace de l'axe horizontal */ /* Draw the X axis */
GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0, GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
screen->ReturnPageSize().x, 0, 0, Color ); screen->ReturnPageSize().x, 0, 0, Color );
} }
/* trace des axes auxiliaires */ /* Draw auxiliary axis */
if( m_Parent->m_Draw_Auxiliary_Axis ) if( m_Parent->m_Draw_Auxiliary_Axis )
{ {
m_Draw_Auxiliary_Axis( DC, FALSE ); m_Draw_Auxiliary_Axis( DC, FALSE );
...@@ -674,13 +673,13 @@ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode ) ...@@ -674,13 +673,13 @@ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode )
GRSetDrawMode( DC, drawmode ); GRSetDrawMode( DC, drawmode );
/* Trace de l'axe vertical */ /* Draw the Y axis */
GRDashedLine( &m_ClipBox, DC, GRDashedLine( &m_ClipBox, DC,
m_Parent->m_Auxiliary_Axis_Position.x, -screen->ReturnPageSize().y, m_Parent->m_Auxiliary_Axis_Position.x, -screen->ReturnPageSize().y,
m_Parent->m_Auxiliary_Axis_Position.x, screen->ReturnPageSize().y, m_Parent->m_Auxiliary_Axis_Position.x, screen->ReturnPageSize().y,
0, Color ); 0, Color );
/* Trace de l'axe horizontal */ /* Draw the X axis */
GRDashedLine( &m_ClipBox, DC, GRDashedLine( &m_ClipBox, DC,
-screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y, -screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y,
screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y, screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y,
...@@ -692,8 +691,7 @@ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode ) ...@@ -692,8 +691,7 @@ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode )
void WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event ) void WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event )
/*******************************************************/ /*******************************************************/
/* Construit et affiche un menu Popup lorsque on actionne le bouton droit /* Build and display a Popup menu on a right mouse button click
* de la souris
*/ */
{ {
wxPoint pos; wxPoint pos;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment