2007-09-05 04:48:47 +00:00
|
|
|
/************************************************************************/
|
|
|
|
/* basepcbframe.cpp - fonctions des classes du type WinEDA_BasePcbFrame */
|
|
|
|
/************************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-01-29 14:26:20 +00:00
|
|
|
#include "wxstruct.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "confirm.h"
|
2009-04-05 20:49:15 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "protos.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "pcbnew_id.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
#include "collectors.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
/* Configuration entry names. */
|
|
|
|
static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) );
|
|
|
|
static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) );
|
|
|
|
static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) );
|
2009-04-23 15:02:18 +00:00
|
|
|
static const wxString DisplayPadFillEntry( wxT( "DiPadFi" ) );
|
2009-09-29 04:44:35 +00:00
|
|
|
static const wxString DisplayViaFillEntry( wxT( "DiViaFi" ) );
|
2009-04-23 15:02:18 +00:00
|
|
|
static const wxString DisplayPadNumberEntry( wxT( "DiPadNu" ) );
|
|
|
|
static const wxString DisplayModuleEdgeEntry( wxT( "DiModEd" ) );
|
|
|
|
static const wxString DisplayModuleTextEntry( wxT( "DiModTx" ) );
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
/*******************************/
|
|
|
|
/* class WinEDA_BasePcbFrame */
|
|
|
|
/*******************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame )
|
2008-12-08 15:27:13 +00:00
|
|
|
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
|
|
|
|
ID_POPUP_PCB_ITEM_SELECTION_END,
|
|
|
|
WinEDA_BasePcbFrame::ProcessItemSelection )
|
2007-10-07 18:24:15 +00:00
|
|
|
END_EVENT_TABLE()
|
2007-09-12 02:14:07 +00:00
|
|
|
|
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
/****************/
|
|
|
|
/* Constructeur */
|
|
|
|
/****************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-07 18:24:15 +00:00
|
|
|
WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
|
|
|
|
int idtype,
|
2007-09-05 04:48:47 +00:00
|
|
|
const wxString& title,
|
2007-10-07 18:24:15 +00:00
|
|
|
const wxPoint& pos,
|
2007-10-27 12:24:09 +00:00
|
|
|
const wxSize& size,
|
2008-02-08 00:16:59 +00:00
|
|
|
long style) :
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDA_DrawFrame( father, idtype, title, pos, size, style )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
m_InternalUnits = PCB_INTERNAL_UNIT; // Internal unit = 1/10000 inch
|
|
|
|
m_Pcb = NULL;
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2009-04-07 07:24:33 +00:00
|
|
|
m_DisplayPadFill = true; // How to draw pads
|
2009-09-29 04:44:35 +00:00
|
|
|
m_DisplayViaFill = true; // How to draw vias
|
2009-04-07 07:24:33 +00:00
|
|
|
m_DisplayPadNum = true; // show pads number
|
2007-09-05 04:48:47 +00:00
|
|
|
|
|
|
|
m_DisplayModEdge = FILLED; // How to show module drawings
|
|
|
|
m_DisplayModText = FILLED; // How to show module texts
|
2009-04-07 07:24:33 +00:00
|
|
|
m_DisplayPcbTrackFill = true; /* FALSE = sketch , true = filled */
|
2008-12-08 15:27:13 +00:00
|
|
|
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
|
|
|
|
m_ModuleEditFrame = NULL; // Frame for footprint edition
|
2007-10-07 18:24:15 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
m_UserGridSize = wxRealPoint( 100.0, 100.0 );
|
|
|
|
m_UserGridUnits = INCHES;
|
|
|
|
|
|
|
|
m_Collector = new GENERAL_COLLECTOR();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-09-05 04:48:47 +00:00
|
|
|
delete m_Collector;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
BASE_SCREEN* WinEDA_BasePcbFrame::GetBaseScreen() const
|
|
|
|
{
|
|
|
|
return GetScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
void WinEDA_BasePcbFrame::SetBoard( BOARD* aBoard )
|
2008-03-04 04:22:27 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
if( m_Pcb != g_ModuleEditor_Pcb )
|
2008-04-17 16:25:29 +00:00
|
|
|
delete m_Pcb;
|
2008-03-04 04:22:27 +00:00
|
|
|
m_Pcb = aBoard;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/**************************************/
|
2007-09-05 04:48:47 +00:00
|
|
|
int WinEDA_BasePcbFrame::BestZoom( void )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**************************************/
|
2007-10-27 18:05:50 +00:00
|
|
|
/**
|
2007-12-06 07:35:26 +00:00
|
|
|
* Return the "best" zoom, i.e. the zoom which shows the entire board on screen
|
2007-10-27 18:05:50 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-09-05 04:48:47 +00:00
|
|
|
int dx, dy, ii, jj;
|
|
|
|
int bestzoom;
|
|
|
|
wxSize size;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
if( m_Pcb == NULL )
|
2009-01-29 14:26:20 +00:00
|
|
|
return 32 * GetScreen()->m_ZoomScalar;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
m_Pcb->ComputeBoundaryBox();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
dx = m_Pcb->m_BoundaryBox.GetWidth();
|
|
|
|
dy = m_Pcb->m_BoundaryBox.GetHeight();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
size = DrawPanel->GetClientSize();
|
|
|
|
ii = ( dx + (size.x / 2) ) / size.x;
|
|
|
|
jj = ( dy + (size.y / 2) ) / size.y;
|
|
|
|
bestzoom = MAX( ii, jj ) + 1;
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
return bestzoom * GetScreen()->m_ZoomScalar;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-06 07:35:26 +00:00
|
|
|
/***********************************************************/
|
2007-12-04 07:04:53 +00:00
|
|
|
void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
|
2007-12-06 07:35:26 +00:00
|
|
|
/***********************************************************/
|
2007-12-04 07:04:53 +00:00
|
|
|
{
|
|
|
|
// factored out of pcbnew/find.cpp
|
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2007-12-04 07:04:53 +00:00
|
|
|
wxClientDC dc( DrawPanel );
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2007-12-04 07:04:53 +00:00
|
|
|
/* Il y a peut-etre necessite de recadrer le dessin: */
|
|
|
|
if( !DrawPanel->IsPointOnDisplay( aPos ) )
|
|
|
|
{
|
|
|
|
screen->m_Curseur = aPos;
|
2009-04-07 07:24:33 +00:00
|
|
|
Recadre_Trace( true );
|
2007-12-04 07:04:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-06 07:35:26 +00:00
|
|
|
// Put cursor on item position
|
2007-12-04 07:04:53 +00:00
|
|
|
DrawPanel->CursorOff( &dc );
|
|
|
|
screen->m_Curseur = aPos;
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
DrawPanel->CursorOn( &dc );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 16:16:48 +00:00
|
|
|
/*************************************************/
|
|
|
|
void WinEDA_BasePcbFrame::ReCreateMenuBar( void )
|
|
|
|
/*************************************************/
|
2007-10-07 18:24:15 +00:00
|
|
|
|
2007-10-06 16:16:48 +00:00
|
|
|
// Virtual function
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-02-05 20:53:08 +00:00
|
|
|
/* Virtual functions: Do nothing for WinEDA_BasePcbFrame window */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-06-15 12:04:24 +00:00
|
|
|
|
|
|
|
/****************************************************************/
|
2007-09-05 04:48:47 +00:00
|
|
|
void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
|
2007-06-15 12:04:24 +00:00
|
|
|
/*****************************************************************/
|
2007-10-07 18:24:15 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Note: virtual, overridden in WinEDA_PcbFrame;
|
2007-06-15 12:04:24 +00:00
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
int preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Check if the specified layer matches the present layer
|
|
|
|
if( layer == preslayer )
|
2007-09-05 04:48:47 +00:00
|
|
|
return;
|
2007-10-07 18:24:15 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Copper layers cannot be selected unconditionally; how many
|
|
|
|
// of those layers are currently enabled needs to be checked.
|
2007-11-01 05:27:31 +00:00
|
|
|
if( (layer >= FIRST_COPPER_LAYER) && (layer <= LAST_COPPER_LAYER) )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
|
|
|
// If only one copper layer is enabled, the only such layer
|
|
|
|
// that can be selected to is the "Copper" layer (so the
|
|
|
|
// selection of any other copper layer is disregarded).
|
|
|
|
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 )
|
|
|
|
{
|
|
|
|
if( layer != COPPER_LAYER_N )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If more than one copper layer is enabled, the "Copper"
|
|
|
|
// and "Component" layers can be selected, but the total
|
|
|
|
// number of copper layers determines which internal
|
|
|
|
// layers are also capable of being selected.
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( (layer != COPPER_LAYER_N) && (layer != LAYER_CMP_N)
|
|
|
|
&& (layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1) )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Is yet more checking required? E.g. when the layer to be selected
|
|
|
|
// is a non-copper layer, or when switching between a copper layer
|
|
|
|
// and a non-copper layer, or vice-versa?
|
|
|
|
// ...
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer = layer;
|
2007-09-05 04:48:47 +00:00
|
|
|
|
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
|
|
|
GetScreen()->SetRefreshReq();
|
2007-06-15 12:04:24 +00:00
|
|
|
}
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
|
2007-10-06 16:16:48 +00:00
|
|
|
/**********************************************************************/
|
2007-09-12 02:14:07 +00:00
|
|
|
void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event )
|
2007-10-06 16:16:48 +00:00
|
|
|
/**********************************************************************/
|
2007-09-12 02:14:07 +00:00
|
|
|
{
|
2007-10-07 18:24:15 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
// index into the collector list:
|
2007-10-07 18:24:15 +00:00
|
|
|
int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START;
|
|
|
|
|
2007-10-10 04:53:23 +00:00
|
|
|
if( id >= ID_POPUP_PCB_ITEM_SELECTION_START
|
|
|
|
&& id <= ID_POPUP_PCB_ITEM_SELECTION_END )
|
2007-10-07 18:24:15 +00:00
|
|
|
{
|
|
|
|
BOARD_ITEM* item = (*m_Collector)[itemNdx];
|
|
|
|
DrawPanel->m_AbortRequest = false;
|
2007-09-12 02:14:07 +00:00
|
|
|
|
2008-02-05 02:13:16 +00:00
|
|
|
#if 0 && defined (DEBUG)
|
2007-10-07 18:24:15 +00:00
|
|
|
item->Show( 0, std::cout );
|
2007-09-12 02:14:07 +00:00
|
|
|
#endif
|
2007-10-07 18:24:15 +00:00
|
|
|
|
|
|
|
SetCurItem( item );
|
|
|
|
}
|
2007-09-12 02:14:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem )
|
|
|
|
/*****************************************************************/
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->SetCurItem( aItem );
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
if( aItem )
|
2007-10-10 12:43:30 +00:00
|
|
|
{
|
2009-04-17 08:51:02 +00:00
|
|
|
aItem->DisplayInfo( this );
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
#if 0 && defined(DEBUG)
|
2007-10-10 12:43:30 +00:00
|
|
|
aItem->Show( 0, std::cout );
|
|
|
|
#endif
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2007-10-10 12:43:30 +00:00
|
|
|
}
|
2007-09-12 02:14:07 +00:00
|
|
|
else
|
|
|
|
{
|
2007-10-10 12:43:30 +00:00
|
|
|
// we can use either of these two:
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
//MsgPanel->EraseMsgBox();
|
2009-04-17 08:51:02 +00:00
|
|
|
m_Pcb->DisplayInfo( this ); // show the BOARD stuff
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2008-02-05 02:13:16 +00:00
|
|
|
#if 0 && defined(DEBUG)
|
2007-10-10 12:43:30 +00:00
|
|
|
std::cout << "SetCurItem(NULL)\n";
|
|
|
|
#endif
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem()
|
|
|
|
/*****************************************************************/
|
2007-10-07 18:24:15 +00:00
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
return GetScreen()->GetCurItem();
|
2007-09-12 02:14:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
/****************************************************************/
|
|
|
|
GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
|
|
|
|
/****************************************************************/
|
|
|
|
{
|
2007-10-07 18:24:15 +00:00
|
|
|
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->m_BoardSettings->GetVisibleLayers(),
|
2008-02-12 21:12:46 +00:00
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer );
|
2007-09-05 04:48:47 +00:00
|
|
|
|
|
|
|
// account for the globals
|
|
|
|
guide.SetIgnoreMTextsMarkedNoShow( g_ModuleTextNOVColor & ITEM_NOT_SHOW );
|
|
|
|
guide.SetIgnoreMTextsOnCopper( g_ModuleTextCUColor & ITEM_NOT_SHOW );
|
|
|
|
guide.SetIgnoreMTextsOnCmp( g_ModuleTextCMPColor & ITEM_NOT_SHOW );
|
|
|
|
guide.SetIgnoreModulesOnCu( !DisplayOpt.Show_Modules_Cu );
|
|
|
|
guide.SetIgnoreModulesOnCmp( !DisplayOpt.Show_Modules_Cmp );
|
|
|
|
|
|
|
|
return guide;
|
|
|
|
}
|
2008-12-19 13:51:48 +00:00
|
|
|
|
|
|
|
void WinEDA_BasePcbFrame::SetToolID( int id, int new_cursor_id,
|
|
|
|
const wxString& title )
|
|
|
|
{
|
|
|
|
bool redraw = false;
|
|
|
|
|
|
|
|
WinEDA_DrawFrame::SetToolID( id, new_cursor_id, title );
|
|
|
|
|
|
|
|
if( id < 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// handle color changes for transitions in and out of ID_TRACK_BUTT
|
|
|
|
if( ( m_ID_current_state == ID_TRACK_BUTT && id != ID_TRACK_BUTT )
|
|
|
|
|| ( m_ID_current_state != ID_TRACK_BUTT && id == ID_TRACK_BUTT ) )
|
|
|
|
{
|
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
|
|
|
redraw = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// must do this after the tool has been set, otherwise pad::Draw() does
|
|
|
|
// not show proper color when DisplayOpt.ContrastModeDisplay is true.
|
2008-12-20 13:12:57 +00:00
|
|
|
if( redraw && DrawPanel)
|
|
|
|
DrawPanel->Refresh();
|
2008-12-19 13:51:48 +00:00
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
void WinEDA_BasePcbFrame::UpdateStatusBar()
|
2009-01-31 10:05:16 +00:00
|
|
|
/*
|
|
|
|
* Update the status bar information.
|
|
|
|
*/
|
2008-12-19 13:51:48 +00:00
|
|
|
{
|
2009-04-09 18:16:16 +00:00
|
|
|
WinEDA_DrawFrame::UpdateStatusBar();
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2009-04-09 18:16:16 +00:00
|
|
|
if( DisplayOpt.DisplayPolarCood ) // display polar coordinates
|
|
|
|
{
|
|
|
|
BASE_SCREEN* screen = GetBaseScreen();
|
|
|
|
if( !screen )
|
|
|
|
return;
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2009-04-09 18:16:16 +00:00
|
|
|
wxString Line;
|
|
|
|
double theta, ro;
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2009-04-09 18:16:16 +00:00
|
|
|
int dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
|
|
|
|
int dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2009-04-09 18:16:16 +00:00
|
|
|
if( dx==0 && dy==0 )
|
2008-12-19 13:51:48 +00:00
|
|
|
theta = 0.0;
|
|
|
|
else
|
|
|
|
theta = atan2( (double) -dy, (double) dx );
|
|
|
|
|
|
|
|
theta = theta * 180.0 / M_PI;
|
|
|
|
|
|
|
|
ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
|
|
|
|
Line.Printf( g_UnitMetric ? wxT( "Ro %.3f Th %.1f" ) : wxT( "Ro %.4f Th %.1f" ),
|
2009-03-12 15:24:52 +00:00
|
|
|
To_User_Unit( g_UnitMetric, ro, m_InternalUnits ),
|
2008-12-19 13:51:48 +00:00
|
|
|
theta );
|
2009-04-09 18:16:16 +00:00
|
|
|
|
|
|
|
// overwrite the absolute cartesian coordinates
|
|
|
|
SetStatusText( Line, 2 );
|
2008-12-19 13:51:48 +00:00
|
|
|
}
|
|
|
|
|
2009-04-09 18:16:16 +00:00
|
|
|
/* not this, because status field no. 0 is reserved for actual fleeting
|
|
|
|
status information. If this is enabled, then that text is erased on
|
|
|
|
every DrawPanel redraw. Field no. 0 is set with Affiche_Message() and it
|
|
|
|
should persist until called again.
|
2008-12-19 13:51:48 +00:00
|
|
|
SetStatusText( Line, 0 );
|
2009-04-09 18:16:16 +00:00
|
|
|
*/
|
2008-12-19 13:51:48 +00:00
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load PCB base frame specific configuration settings.
|
|
|
|
*
|
|
|
|
* Don't forget to call this base method from any derived classes or the
|
|
|
|
* settings will not get loaded.
|
|
|
|
*/
|
|
|
|
void WinEDA_BasePcbFrame::LoadSettings()
|
|
|
|
{
|
|
|
|
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
|
|
|
|
|
|
|
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
|
|
|
|
|
|
|
WinEDA_DrawFrame::LoadSettings();
|
|
|
|
cfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
|
|
|
|
cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
|
|
|
|
cfg->Read( m_FrameName + UserGridUnitsEntry, &m_UserGridUnits,
|
|
|
|
( long )INCHES );
|
2009-04-23 15:02:18 +00:00
|
|
|
cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true );
|
2009-09-29 04:44:35 +00:00
|
|
|
cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true ); //TODO: Will adding this line break tha pcbnew file compatibility?
|
2009-04-23 15:02:18 +00:00
|
|
|
cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true );
|
|
|
|
cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge,
|
|
|
|
( long )FILLED );
|
|
|
|
if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH )
|
|
|
|
m_DisplayModEdge = FILLED;
|
|
|
|
cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText,
|
|
|
|
( long )FILLED );
|
|
|
|
if( m_DisplayModText < FILAIRE || m_DisplayModText > SKETCH )
|
|
|
|
m_DisplayModText = FILLED;
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save PCB base frame specific configuration settings.
|
|
|
|
*
|
|
|
|
* Don't forget to call this base method from any derived classes or the
|
|
|
|
* settings will not get saved.
|
|
|
|
*/
|
|
|
|
void WinEDA_BasePcbFrame::SaveSettings()
|
|
|
|
{
|
|
|
|
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
|
|
|
|
|
|
|
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
|
|
|
|
|
|
|
WinEDA_DrawFrame::SaveSettings();
|
|
|
|
cfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x );
|
|
|
|
cfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y );
|
|
|
|
cfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnits );
|
2009-04-23 15:02:18 +00:00
|
|
|
cfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayPadFill );
|
2009-09-29 04:44:35 +00:00
|
|
|
cfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayViaFill ); //TODO: Will adding this line break tha pcbnew file compatibility?
|
2009-04-23 15:02:18 +00:00
|
|
|
cfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayPadNum );
|
|
|
|
cfg->Write( m_FrameName + DisplayModuleEdgeEntry, ( long )m_DisplayModEdge );
|
|
|
|
cfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayModText );
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|