2009-11-23 15:16:50 +00:00
|
|
|
/*****************/
|
|
|
|
/* drawframe.cpp */
|
|
|
|
/*****************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2009-01-29 14:26:20 +00:00
|
|
|
#include "gr_basic.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "common.h"
|
|
|
|
#include "bitmaps.h"
|
2008-12-19 13:51:48 +00:00
|
|
|
#include "macros.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "id.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "class_base_screen.h"
|
|
|
|
#include "wxstruct.h"
|
|
|
|
#include "confirm.h"
|
2010-02-08 18:15:42 +00:00
|
|
|
#include "kicad_device_context.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-12-19 13:51:48 +00:00
|
|
|
#include <wx/fontdlg.h>
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-02-22 16:45:35 +00:00
|
|
|
/* Definitions for enabling and disabling extra debugging output. Please
|
|
|
|
* remember to set these to 0 before committing changes to SVN.
|
|
|
|
*/
|
|
|
|
#define DEBUG_DUMP_SCROLLBAR_SETTINGS 0 // Set to 1 to print scroll bar settings.
|
|
|
|
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
/* Configuration entry names. */
|
2010-02-01 21:23:27 +00:00
|
|
|
static const wxString CursorShapeEntryKeyword( wxT( "CursorShape" ) );
|
|
|
|
static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
|
|
|
|
static const wxString GridColorEntryKeyword( wxT( "GridColor" ) );
|
2009-10-14 19:43:31 +00:00
|
|
|
static const wxString LastGridSizeId( wxT( "_LastGridSize" ) );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
BEGIN_EVENT_TABLE( WinEDA_DrawFrame, WinEDA_BasicFrame )
|
|
|
|
EVT_MOUSEWHEEL( WinEDA_DrawFrame::OnMouseEvent )
|
|
|
|
EVT_MENU_OPEN( WinEDA_DrawFrame::OnMenuOpen )
|
|
|
|
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
|
|
|
|
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
|
|
|
|
WinEDA_DrawFrame::OnZoom )
|
2009-10-14 19:43:31 +00:00
|
|
|
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
|
|
|
|
WinEDA_DrawFrame::OnSelectGrid )
|
2009-01-07 15:59:49 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
|
2008-12-08 15:27:13 +00:00
|
|
|
const wxString& title,
|
2008-12-05 16:03:05 +00:00
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
long style ) :
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDA_BasicFrame( father, idtype, title, pos, size, style )
|
2007-08-15 02:43:57 +00:00
|
|
|
{
|
|
|
|
wxSize minsize;
|
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
m_VToolBar = NULL;
|
|
|
|
m_AuxVToolBar = NULL;
|
|
|
|
m_OptionsToolBar = NULL;
|
|
|
|
m_AuxiliaryToolBar = NULL;
|
|
|
|
m_SelGridBox = NULL;
|
|
|
|
m_SelZoomBox = NULL;
|
2010-02-14 18:14:33 +00:00
|
|
|
m_HotkeysZoomAndGridList = NULL;
|
2009-01-29 14:26:20 +00:00
|
|
|
|
|
|
|
DrawPanel = NULL;
|
|
|
|
MsgPanel = NULL;
|
|
|
|
m_CurrentScreen = NULL;
|
2007-08-15 02:43:57 +00:00
|
|
|
m_ID_current_state = 0;
|
2009-09-25 18:49:04 +00:00
|
|
|
m_ID_last_state = 0;
|
2007-08-15 02:43:57 +00:00
|
|
|
m_HTOOL_current_state = 0;
|
2009-11-23 15:16:50 +00:00
|
|
|
m_Draw_Axis = FALSE; // TRUE to draw axis.
|
|
|
|
m_Draw_Sheet_Ref = FALSE; // TRUE to display reference sheet.
|
|
|
|
m_Print_Sheet_Ref = TRUE; // TRUE to print reference sheet.
|
|
|
|
m_Draw_Auxiliary_Axis = FALSE; // TRUE draw auxilary axis.
|
2010-07-13 10:42:32 +00:00
|
|
|
m_Draw_Grid_Axis = FALSE; // TRUE to draw the grid axis
|
2009-04-05 20:49:15 +00:00
|
|
|
m_CursorShape = 0;
|
2009-10-14 19:43:31 +00:00
|
|
|
m_LastGridSizeId = 0;
|
2010-02-01 21:23:27 +00:00
|
|
|
m_DrawGrid = true; // hide/Show grid. default = show
|
|
|
|
m_GridColor = DARKGRAY; // Grid color
|
2009-01-29 14:26:20 +00:00
|
|
|
|
|
|
|
// Internal units per inch: = 1000 for schema, = 10000 for PCB
|
|
|
|
m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
|
|
|
|
minsize.x = 470;
|
|
|
|
minsize.y = 350 + m_MsgFrameHeight;
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Make sure window has a sane minimum size. */
|
2008-12-19 13:51:48 +00:00
|
|
|
if( ( size.x < minsize.x ) || ( size.y < minsize.y ) )
|
2007-08-15 02:43:57 +00:00
|
|
|
SetSize( 0, 0, minsize.x, minsize.y );
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
// Pane sizes for status bar.
|
2009-04-09 18:23:28 +00:00
|
|
|
#define ZOOM_DISPLAY_SIZE 60
|
|
|
|
#define COORD_DISPLAY_SIZE 156
|
|
|
|
#define UNITS_DISPLAY_SIZE 50
|
|
|
|
#define FUNCTION_DISPLAY_SIZE 100
|
|
|
|
|
2007-10-31 17:47:44 +00:00
|
|
|
static const int dims[6] = { -1, ZOOM_DISPLAY_SIZE,
|
2008-04-17 16:25:29 +00:00
|
|
|
COORD_DISPLAY_SIZE, COORD_DISPLAY_SIZE,
|
|
|
|
UNITS_DISPLAY_SIZE, FUNCTION_DISPLAY_SIZE };
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
|
|
CreateStatusBar( 6 );
|
|
|
|
SetStatusWidths( 6, dims );
|
|
|
|
|
|
|
|
// Create child subwindows.
|
2009-11-23 15:16:50 +00:00
|
|
|
GetClientSize( &m_FrameSize.x, &m_FrameSize.y );
|
2007-08-15 02:43:57 +00:00
|
|
|
m_FramePos.x = m_FramePos.y = 0;
|
|
|
|
m_FrameSize.y -= m_MsgFrameHeight;
|
|
|
|
|
2009-01-17 20:31:19 +00:00
|
|
|
DrawPanel = new WinEDA_DrawPanel( this, -1, wxPoint( 0, 0 ), m_FrameSize );
|
|
|
|
MsgPanel = new WinEDA_MsgPanel( this, -1, wxPoint( 0, m_FrameSize.y ),
|
|
|
|
wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
|
2009-04-09 18:23:28 +00:00
|
|
|
|
2009-01-17 20:31:19 +00:00
|
|
|
MsgPanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red,
|
|
|
|
ColorRefs[LIGHTGRAY].m_Green,
|
|
|
|
ColorRefs[LIGHTGRAY].m_Blue ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
WinEDA_DrawFrame::~WinEDA_DrawFrame()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
if( m_CurrentScreen != NULL )
|
|
|
|
delete m_CurrentScreen;
|
2009-11-05 08:52:41 +00:00
|
|
|
|
2009-11-02 22:24:55 +00:00
|
|
|
m_auimgr.UnInit();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2009-11-23 15:16:50 +00:00
|
|
|
* Display the message in the first pane of the status bar.
|
2007-08-15 02:43:57 +00:00
|
|
|
*/
|
2009-11-23 15:16:50 +00:00
|
|
|
void WinEDA_DrawFrame::Affiche_Message( const wxString& message )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-09 18:16:16 +00:00
|
|
|
SetStatusText( message, 0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
void WinEDA_DrawFrame::EraseMsgBox()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
if( MsgPanel )
|
|
|
|
MsgPanel->EraseMsgBox();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
void WinEDA_DrawFrame::OnActivate( wxActivateEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
m_FrameIsActive = event.GetActive();
|
|
|
|
if( DrawPanel )
|
|
|
|
DrawPanel->m_CanStartBlock = -1;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
event.Skip(); // required under wxMAC
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
void WinEDA_DrawFrame::OnMenuOpen( wxMenuEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
if( DrawPanel )
|
|
|
|
DrawPanel->m_CanStartBlock = -1;
|
|
|
|
event.Skip();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-01 15:37:42 +00:00
|
|
|
// Virtual function
|
2009-11-23 15:16:50 +00:00
|
|
|
void WinEDA_DrawFrame::ReCreateAuxiliaryToolbar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2007-10-01 15:37:42 +00:00
|
|
|
// Virtual function
|
2009-11-23 15:16:50 +00:00
|
|
|
void WinEDA_DrawFrame::ReCreateMenuBar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
// Virtual function
|
2007-08-15 02:43:57 +00:00
|
|
|
void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey,
|
2007-10-01 15:37:42 +00:00
|
|
|
EDA_BaseStruct* DrawStruct )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-01 15:37:42 +00:00
|
|
|
// Virtual function
|
2009-11-23 15:16:50 +00:00
|
|
|
void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-03-18 20:35:29 +00:00
|
|
|
/** Virtual function PrintPage
|
|
|
|
* used to print a page
|
|
|
|
* this basic function must be derived to be used for printing
|
|
|
|
* because WinEDA_DrawFrame does not know how to print a page
|
|
|
|
* This is the reason it is a virtual function
|
|
|
|
*/
|
|
|
|
void WinEDA_DrawFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
|
|
|
|
int aPrintMask, bool aPrintMirrorMode,
|
|
|
|
void * aData)
|
|
|
|
{
|
|
|
|
wxMessageBox( wxT("WinEDA_DrawFrame::PrintPage() error"));
|
|
|
|
}
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2007-10-01 15:37:42 +00:00
|
|
|
// Virtual function
|
2009-10-14 19:43:31 +00:00
|
|
|
void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-10-14 19:43:31 +00:00
|
|
|
int* clientData;
|
|
|
|
int id = ID_POPUP_GRID_LEVEL_100;
|
|
|
|
|
|
|
|
if( event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED )
|
|
|
|
{
|
|
|
|
if( m_SelGridBox == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't use wxCommandEvent::GetClientData() here. It always
|
|
|
|
* returns NULL in GTK. This solution is not as elegant but
|
|
|
|
* it works.
|
|
|
|
*/
|
|
|
|
int index = m_SelGridBox->GetSelection();
|
|
|
|
wxASSERT( index != wxNOT_FOUND );
|
2010-02-12 23:12:00 +00:00
|
|
|
clientData = (int*) m_SelGridBox->wxItemContainer::GetClientData( index );
|
2009-10-14 19:43:31 +00:00
|
|
|
|
|
|
|
if( clientData != NULL )
|
|
|
|
id = *clientData;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
id = event.GetId();
|
|
|
|
|
|
|
|
/* Update the grid select combobox if the grid size was changed
|
|
|
|
* by menu event.
|
|
|
|
*/
|
|
|
|
if( m_SelGridBox != NULL )
|
|
|
|
{
|
|
|
|
for( size_t i = 0; i < m_SelGridBox->GetCount(); i++ )
|
|
|
|
{
|
2010-02-12 23:12:00 +00:00
|
|
|
clientData = (int*) m_SelGridBox->wxItemContainer::GetClientData( i );
|
2009-10-14 19:43:31 +00:00
|
|
|
|
|
|
|
if( clientData && id == *clientData )
|
|
|
|
{
|
|
|
|
m_SelGridBox->SetSelection( i );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
BASE_SCREEN* screen = GetBaseScreen();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
if( screen->GetGridId() == id )
|
|
|
|
return;
|
2008-12-05 16:03:05 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
/*
|
|
|
|
* This allows for saving non-sequential command ID offsets used that
|
|
|
|
* may be used in the grid size combobox. Do not use the selection
|
|
|
|
* index returned by GetSelection().
|
|
|
|
*/
|
|
|
|
m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000;
|
|
|
|
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
2009-10-15 11:35:53 +00:00
|
|
|
screen->SetGrid( id );
|
2009-10-14 19:43:31 +00:00
|
|
|
Refresh();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
/**
|
|
|
|
* Set the zoom when selected by the Zoom List Box
|
2007-08-15 02:43:57 +00:00
|
|
|
* Note:
|
|
|
|
* position 0 = Fit in Page
|
|
|
|
* position >= 1 = zoom (1 to zoom max)
|
|
|
|
* last position : special zoom
|
2009-01-29 14:26:20 +00:00
|
|
|
* virtual function
|
2007-08-15 02:43:57 +00:00
|
|
|
*/
|
2009-01-29 14:26:20 +00:00
|
|
|
void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event )
|
2007-08-15 02:43:57 +00:00
|
|
|
{
|
|
|
|
if( m_SelZoomBox == NULL )
|
2009-11-23 15:16:50 +00:00
|
|
|
return; // Should not happen!
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
|
|
int id = m_SelZoomBox->GetChoice();
|
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
if( id < 0 || !( id < (int)m_SelZoomBox->GetCount() ) )
|
|
|
|
return;
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
if( id == 0 ) // Auto zoom (Fit in Page)
|
2007-08-15 02:43:57 +00:00
|
|
|
{
|
2009-01-29 14:26:20 +00:00
|
|
|
Zoom_Automatique( true );
|
2007-08-15 02:43:57 +00:00
|
|
|
}
|
2009-01-29 14:26:20 +00:00
|
|
|
else
|
2007-08-15 02:43:57 +00:00
|
|
|
{
|
|
|
|
id--;
|
2009-01-29 14:26:20 +00:00
|
|
|
int selectedZoom = GetBaseScreen()->m_ZoomList[id];
|
|
|
|
if( GetBaseScreen()->GetZoom() == selectedZoom )
|
2007-08-15 02:43:57 +00:00
|
|
|
return;
|
2008-04-17 16:25:29 +00:00
|
|
|
GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
2009-01-29 14:26:20 +00:00
|
|
|
GetBaseScreen()->SetZoom( selectedZoom );
|
|
|
|
Recadre_Trace( false );
|
2007-08-15 02:43:57 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2007-10-26 06:08:19 +00:00
|
|
|
/* Return the current zoom level */
|
2009-11-23 15:16:50 +00:00
|
|
|
int WinEDA_DrawFrame::GetZoom(void)
|
2007-10-26 06:08:19 +00:00
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
return GetBaseScreen()->GetZoom();
|
2007-10-26 06:08:19 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
|
|
void WinEDA_DrawFrame::OnMouseEvent( wxMouseEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
event.Skip();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
// Virtual
|
2007-08-15 02:43:57 +00:00
|
|
|
void WinEDA_DrawFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
void WinEDA_DrawFrame::SetToolbars()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
DisplayUnitsMsg();
|
2009-11-05 08:52:41 +00:00
|
|
|
|
|
|
|
if( m_auimgr.GetManagedWindow() )
|
|
|
|
m_auimgr.Update();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2009-01-31 10:05:16 +00:00
|
|
|
void WinEDA_DrawFrame::DisplayToolMsg( const wxString& msg )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
SetStatusText( msg, 5 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/* Display current unit Selection on Statusbar
|
2007-08-15 02:43:57 +00:00
|
|
|
*/
|
2009-11-23 15:16:50 +00:00
|
|
|
void WinEDA_DrawFrame::DisplayUnitsMsg()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
wxString msg;
|
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
switch( g_UserUnit )
|
2007-08-15 02:43:57 +00:00
|
|
|
{
|
|
|
|
case INCHES:
|
2010-07-12 14:07:09 +00:00
|
|
|
msg = _( "Inches" );
|
2007-08-15 02:43:57 +00:00
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
case MILLIMETRES:
|
2007-08-15 02:43:57 +00:00
|
|
|
msg += _( "mm" );
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
default:
|
2010-07-12 14:07:09 +00:00
|
|
|
msg += _( "Units" );
|
2007-08-15 02:43:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetStatusText( msg, 4 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Recalculate the size of toolbars and display panel.
|
2007-08-15 02:43:57 +00:00
|
|
|
*/
|
2009-11-23 15:16:50 +00:00
|
|
|
void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
|
2007-08-15 02:43:57 +00:00
|
|
|
{
|
2010-01-14 20:20:59 +00:00
|
|
|
m_FrameSize = GetClientSize( );
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
|
|
SizeEv.Skip();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2010-07-27 16:49:38 +00:00
|
|
|
/** Function SetToolID
|
2009-11-23 15:16:50 +00:00
|
|
|
* Enables the icon of the selected tool in the vertical toolbar.
|
|
|
|
* (Or tool ID_NO_SELECT_BUTT default if no new selection)
|
2010-07-27 16:49:38 +00:00
|
|
|
* @param aId = new m_ID_current_state value (if aId >= 0)
|
|
|
|
* @param aCursor = the new cursor shape (0 = default cursor)
|
|
|
|
* @param aTitle = tool message in status bar
|
|
|
|
* if (aId >= 0)
|
2009-11-23 15:16:50 +00:00
|
|
|
* Updates all variables related:
|
2010-07-27 16:49:38 +00:00
|
|
|
* m_ID_current_state, cursor shape and message in status bar
|
|
|
|
* If (aId < 0)
|
|
|
|
* Only updates the cursor shape and message in status bar
|
|
|
|
* (does not the current m_ID_current_state value
|
2007-08-15 02:43:57 +00:00
|
|
|
*/
|
2010-07-27 16:49:38 +00:00
|
|
|
void WinEDA_DrawFrame::SetToolID( int aId, int aCursor,
|
|
|
|
const wxString& aToolMsg )
|
2007-08-15 02:43:57 +00:00
|
|
|
{
|
2010-07-27 09:01:26 +00:00
|
|
|
// Keep default cursor in toolbars
|
|
|
|
SetCursor( wxNullCursor );
|
|
|
|
// Change Cursor in DrawPanel only
|
2007-08-15 02:43:57 +00:00
|
|
|
if( DrawPanel )
|
|
|
|
{
|
2010-07-27 16:49:38 +00:00
|
|
|
DrawPanel->m_PanelDefaultCursor = aCursor;
|
|
|
|
DrawPanel->SetCursor( aCursor );
|
2007-08-15 02:43:57 +00:00
|
|
|
}
|
2010-07-27 16:49:38 +00:00
|
|
|
DisplayToolMsg( aToolMsg );
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2010-07-27 16:49:38 +00:00
|
|
|
if( aId < 0 )
|
2007-08-15 02:43:57 +00:00
|
|
|
return;
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
// Old Tool ID_NO_SELECT_BUTT active or inactive if no new tool.
|
2007-08-15 02:43:57 +00:00
|
|
|
if( m_ID_current_state )
|
|
|
|
{
|
|
|
|
if( m_VToolBar )
|
|
|
|
m_VToolBar->ToggleTool( m_ID_current_state, FALSE );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
if( m_AuxVToolBar )
|
|
|
|
m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-07-27 16:49:38 +00:00
|
|
|
if( aId )
|
2007-08-15 02:43:57 +00:00
|
|
|
{
|
|
|
|
if( m_VToolBar )
|
|
|
|
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, FALSE );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
if( m_AuxVToolBar )
|
|
|
|
m_AuxVToolBar->ToggleTool( m_ID_current_state, FALSE );
|
|
|
|
}
|
|
|
|
else if( m_VToolBar )
|
|
|
|
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
|
|
|
|
}
|
|
|
|
|
2010-07-27 16:49:38 +00:00
|
|
|
if( aId )
|
2007-08-15 02:43:57 +00:00
|
|
|
{
|
|
|
|
if( m_VToolBar )
|
2010-07-27 16:49:38 +00:00
|
|
|
m_VToolBar->ToggleTool( aId, TRUE );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
if( m_AuxVToolBar )
|
2010-07-27 16:49:38 +00:00
|
|
|
m_AuxVToolBar->ToggleTool( aId, TRUE );
|
2007-08-15 02:43:57 +00:00
|
|
|
}
|
|
|
|
else if( m_VToolBar )
|
|
|
|
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
|
|
|
|
|
2010-07-27 16:49:38 +00:00
|
|
|
m_ID_current_state = aId;
|
2010-07-17 12:04:42 +00:00
|
|
|
if( m_VToolBar )
|
|
|
|
m_VToolBar->Refresh( );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
/*****************************/
|
2009-04-05 20:49:15 +00:00
|
|
|
/* default virtual functions */
|
2007-08-15 02:43:57 +00:00
|
|
|
/*****************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
void WinEDA_DrawFrame::OnGrid( int grid_type )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
|
|
int WinEDA_DrawFrame::ReturnBlockCommand( int key )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
return 0;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
void WinEDA_DrawFrame::InitBlockPasteInfos()
|
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
GetBaseScreen()->m_BlockLocate.ClearItemsList();
|
2007-08-15 02:43:57 +00:00
|
|
|
DrawPanel->ManageCurseur = NULL;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
void WinEDA_DrawFrame::HandleBlockPlace( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
void WinEDA_DrawFrame::AdjustScrollBars()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-02-14 18:14:33 +00:00
|
|
|
int unitsX, unitsY, posX, posY;
|
2010-02-08 18:15:42 +00:00
|
|
|
wxSize drawingSize, clientSize;
|
2009-01-29 14:26:20 +00:00
|
|
|
BASE_SCREEN* screen = GetBaseScreen();
|
2010-02-22 16:45:35 +00:00
|
|
|
bool noRefresh = true;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-17 20:31:19 +00:00
|
|
|
if( screen == NULL || DrawPanel == NULL )
|
2007-08-15 02:43:57 +00:00
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
// The drawing size is twice the current page size.
|
2010-02-08 18:15:42 +00:00
|
|
|
drawingSize = screen->ReturnPageSize() * 2;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
// Calculate the portion of the drawing that can be displayed in the
|
|
|
|
// client area at the current zoom level.
|
2010-02-08 18:15:42 +00:00
|
|
|
clientSize = DrawPanel->GetClientSize();
|
|
|
|
|
2010-02-22 16:45:35 +00:00
|
|
|
double scalar = screen->GetScalingFactor();
|
|
|
|
clientSize.x = wxRound( (double) clientSize.x / scalar );
|
|
|
|
clientSize.y = wxRound( (double) clientSize.y / scalar );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-02-11 19:39:55 +00:00
|
|
|
/* Adjust drawing size when zooming way out to prevent centering around
|
|
|
|
* cursor problems. */
|
2010-02-08 18:15:42 +00:00
|
|
|
if( clientSize.x > drawingSize.x || clientSize.y > drawingSize.y )
|
|
|
|
drawingSize = clientSize;
|
2009-02-11 19:39:55 +00:00
|
|
|
|
2010-02-22 16:45:35 +00:00
|
|
|
drawingSize.x += wxRound( (double) clientSize.x / 2.0 );
|
|
|
|
drawingSize.y += wxRound( (double) clientSize.y / 2.0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( screen->m_Center )
|
2007-08-15 02:43:57 +00:00
|
|
|
{
|
2010-02-22 16:45:35 +00:00
|
|
|
screen->m_DrawOrg.x = -wxRound( (double) drawingSize.x / 2.0 );
|
|
|
|
screen->m_DrawOrg.y = -wxRound( (double) drawingSize.y / 2.0 );
|
2007-08-15 02:43:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-02-22 16:45:35 +00:00
|
|
|
screen->m_DrawOrg.x = -wxRound( (double) clientSize.x / 2.0 );
|
|
|
|
screen->m_DrawOrg.y = -wxRound( (double) clientSize.y / 2.0 );
|
2007-08-15 02:43:57 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-02-08 18:15:42 +00:00
|
|
|
/* Always set scrollbar pixels per unit to 1 unless you want the zoom
|
|
|
|
* around cursor to jump around. This reported problem occurs when the
|
|
|
|
* zoom point is not on a pixel per unit increment. If you set the
|
|
|
|
* pixels per unit to 10, you have potential for the zoom point to
|
|
|
|
* jump around +/-5 pixels from the nearest grid point.
|
|
|
|
*/
|
2010-02-14 18:14:33 +00:00
|
|
|
screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
|
2010-02-08 18:15:42 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
// Calculate the number of scroll bar units for the given zoom level. */
|
2010-02-22 16:45:35 +00:00
|
|
|
unitsX = wxRound( (double) drawingSize.x * scalar );
|
|
|
|
unitsY = wxRound( (double) drawingSize.y * scalar );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
// Calculate the position, place the cursor at the center of screen.
|
2010-02-08 18:15:42 +00:00
|
|
|
posX = screen->m_Curseur.x - screen->m_DrawOrg.x;
|
|
|
|
posY = screen->m_Curseur.y - screen->m_DrawOrg.y;
|
|
|
|
|
2010-02-22 16:45:35 +00:00
|
|
|
posX -= wxRound( (double) clientSize.x / 2.0 );
|
|
|
|
posY -= wxRound( (double) clientSize.y / 2.0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-02-22 16:45:35 +00:00
|
|
|
if( posX < 0 )
|
2010-02-08 18:15:42 +00:00
|
|
|
posX = 0;
|
2010-02-22 16:45:35 +00:00
|
|
|
if( posY < 0 )
|
2010-02-08 18:15:42 +00:00
|
|
|
posY = 0;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-02-22 16:45:35 +00:00
|
|
|
posX = wxRound( (double) posX * scalar );
|
|
|
|
posY = wxRound( (double) posY * scalar );
|
2010-02-08 18:15:42 +00:00
|
|
|
|
|
|
|
screen->m_ScrollbarPos = wxPoint( posX, posY );
|
|
|
|
screen->m_ScrollbarNumber = wxSize( unitsX, unitsY );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-02-22 16:45:35 +00:00
|
|
|
#if DEBUG_DUMP_SCROLLBAR_SETTINGS
|
2010-02-08 18:15:42 +00:00
|
|
|
wxLogDebug( wxT( "SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
|
2010-02-22 16:45:35 +00:00
|
|
|
screen->m_ScrollPixelsPerUnitX, screen->m_ScrollPixelsPerUnitY,
|
|
|
|
screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
|
|
|
|
screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
|
2010-02-08 18:15:42 +00:00
|
|
|
#endif
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-02-14 18:14:33 +00:00
|
|
|
DrawPanel->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
|
|
|
|
screen->m_ScrollPixelsPerUnitY,
|
2008-04-17 16:25:29 +00:00
|
|
|
screen->m_ScrollbarNumber.x,
|
2008-12-05 16:03:05 +00:00
|
|
|
screen->m_ScrollbarNumber.y,
|
|
|
|
screen->m_ScrollbarPos.x,
|
2010-02-22 16:45:35 +00:00
|
|
|
screen->m_ScrollbarPos.y, noRefresh );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-26 15:39:10 +00:00
|
|
|
/** function SetLanguage
|
|
|
|
* called on a language menu selection
|
|
|
|
* when using a derived function, do not forget to call this one
|
|
|
|
*/
|
2007-08-15 02:43:57 +00:00
|
|
|
void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-02-26 15:39:10 +00:00
|
|
|
WinEDA_BasicFrame::SetLanguage( event );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
/**
|
|
|
|
* Round to the nearest precision.
|
|
|
|
*
|
|
|
|
* Try to approximate a coordinate using a given precision to prevent
|
|
|
|
* rounding errors when converting from inches to mm.
|
|
|
|
*
|
2009-07-25 04:53:39 +00:00
|
|
|
* ie round the unit value to 0 if unit is 1 or 2, or 8 or 9
|
|
|
|
*/
|
2009-10-14 19:43:31 +00:00
|
|
|
double RoundTo0( double x, double precision )
|
2009-07-25 04:53:39 +00:00
|
|
|
{
|
2009-10-14 19:43:31 +00:00
|
|
|
assert( precision != 0 );
|
|
|
|
|
|
|
|
long long ix = wxRound( x * precision );
|
|
|
|
if ( x < 0.0 )
|
|
|
|
NEGATE( ix );
|
|
|
|
|
|
|
|
int remainder = ix % 10; // remainder is in precision mm
|
2009-07-25 04:53:39 +00:00
|
|
|
|
|
|
|
if ( remainder <= 2 )
|
2009-10-14 19:43:31 +00:00
|
|
|
ix -= remainder; // truncate to the near number
|
2009-07-25 04:53:39 +00:00
|
|
|
else if (remainder >= 8 )
|
2009-10-14 19:43:31 +00:00
|
|
|
ix += 10 - remainder; // round to near number
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
if ( x < 0 )
|
|
|
|
NEGATE( ix );
|
|
|
|
|
|
|
|
return (double) ix / precision;
|
2009-07-25 04:53:39 +00:00
|
|
|
}
|
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
/**
|
|
|
|
* Function UpdateStatusBar()
|
2009-07-25 04:53:39 +00:00
|
|
|
* Displays in the bottom of the main window a stust:
|
|
|
|
* - Absolute Cursor coordinates
|
2009-10-14 19:43:31 +00:00
|
|
|
* - Relative Cursor coordinates (relative to the last coordinate stored
|
|
|
|
* when actiavte the space bar)
|
|
|
|
* ( in this status is also displayed the zoom level, but this is not made
|
|
|
|
* by this function )
|
2009-07-25 04:53:39 +00:00
|
|
|
*/
|
2009-04-05 20:49:15 +00:00
|
|
|
void WinEDA_DrawFrame::UpdateStatusBar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
wxString Line;
|
|
|
|
int dx, dy;
|
|
|
|
BASE_SCREEN* screen = GetBaseScreen();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( !screen )
|
2007-08-15 02:43:57 +00:00
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-31 10:05:16 +00:00
|
|
|
/* Display Zoom level: zoom = zoom_coeff/ZoomScalar */
|
|
|
|
if ( (screen->GetZoom() % screen->m_ZoomScalar) == 0 )
|
2009-04-05 20:49:15 +00:00
|
|
|
Line.Printf( wxT( "Z %d" ), screen->GetZoom() / screen->m_ZoomScalar );
|
2009-01-31 10:05:16 +00:00
|
|
|
else
|
2009-10-14 19:43:31 +00:00
|
|
|
Line.Printf( wxT( "Z %.1f" ),
|
|
|
|
(float)screen->GetZoom() / screen->m_ZoomScalar );
|
2007-08-15 02:43:57 +00:00
|
|
|
SetStatusText( Line, 1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-31 10:05:16 +00:00
|
|
|
/* Display absolute coordinates: */
|
2010-07-12 14:07:09 +00:00
|
|
|
double dXpos = To_User_Unit( g_UserUnit, screen->m_Curseur.x,
|
2009-10-14 19:43:31 +00:00
|
|
|
m_InternalUnits );
|
2010-07-12 14:07:09 +00:00
|
|
|
double dYpos = To_User_Unit( g_UserUnit, screen->m_Curseur.y,
|
2009-10-14 19:43:31 +00:00
|
|
|
m_InternalUnits );
|
|
|
|
/*
|
|
|
|
* Converting from inches to mm can give some coordinates due to
|
|
|
|
* float point precision rounding errors, like 1.999 or 2.001 so
|
|
|
|
* round to the nearest drawing precision required by the application.
|
2009-07-25 04:53:39 +00:00
|
|
|
*/
|
2010-07-12 14:07:09 +00:00
|
|
|
if ( g_UserUnit == MILLIMETRES )
|
2009-07-25 04:53:39 +00:00
|
|
|
{
|
2009-10-14 19:43:31 +00:00
|
|
|
dXpos = RoundTo0( dXpos, (double)( m_InternalUnits / 10 ) );
|
|
|
|
dYpos = RoundTo0( dYpos, (double)( m_InternalUnits / 10 ) );
|
2009-07-25 04:53:39 +00:00
|
|
|
}
|
2010-07-12 14:07:09 +00:00
|
|
|
|
|
|
|
/* The following sadly is an if eeschema/if pcbnew */
|
2010-10-30 10:03:41 +00:00
|
|
|
wxString absformatter;
|
|
|
|
wxString locformatter;
|
2010-07-12 14:07:09 +00:00
|
|
|
switch( g_UserUnit )
|
|
|
|
{
|
|
|
|
case INCHES:
|
|
|
|
if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT )
|
|
|
|
{
|
2010-10-30 10:03:41 +00:00
|
|
|
absformatter = wxT( "X %.3f Y %.3f" );
|
|
|
|
locformatter = wxT( "dx %.3f dy %.3f" );
|
2010-07-12 14:07:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-30 10:03:41 +00:00
|
|
|
absformatter = wxT( "X %.4f Y %.4f" );
|
|
|
|
locformatter = wxT( "dx %.4f dy %.4f" );
|
2010-07-12 14:07:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MILLIMETRES:
|
|
|
|
if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT )
|
|
|
|
{
|
2010-10-30 10:03:41 +00:00
|
|
|
absformatter = wxT( "X %.2f Y %.2f" );
|
|
|
|
locformatter = wxT( "dx %.2f dy %.2f" );
|
2010-07-12 14:07:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-30 10:03:41 +00:00
|
|
|
absformatter = wxT( "X %.3f Y %.3f" );
|
|
|
|
locformatter = wxT( "dx %.3f dy %.3f" );
|
2010-07-12 14:07:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UNSCALED_UNITS:
|
2010-10-30 10:03:41 +00:00
|
|
|
absformatter = wxT( "X %f Y %f" );
|
|
|
|
locformatter = wxT( "dx %f dy %f" );
|
2010-07-12 14:07:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-10-30 10:03:41 +00:00
|
|
|
Line.Printf( absformatter, dXpos, dYpos );
|
2007-08-15 02:43:57 +00:00
|
|
|
SetStatusText( Line, 2 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-31 10:05:16 +00:00
|
|
|
/* Display relative coordinates: */
|
2008-04-17 16:25:29 +00:00
|
|
|
dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
|
|
|
|
dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
|
2010-07-12 14:07:09 +00:00
|
|
|
dXpos = To_User_Unit( g_UserUnit, dx, m_InternalUnits );
|
|
|
|
dYpos = To_User_Unit( g_UserUnit, dy, m_InternalUnits );
|
|
|
|
if( g_UserUnit == MILLIMETRES )
|
2009-07-25 04:53:39 +00:00
|
|
|
{
|
2010-07-12 14:07:09 +00:00
|
|
|
dXpos = RoundTo0( dXpos, (double) ( m_InternalUnits / 10 ) );
|
|
|
|
dYpos = RoundTo0( dYpos, (double) ( m_InternalUnits / 10 ) );
|
2009-07-25 04:53:39 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
/* We already decided the formatter above */
|
2010-10-30 10:03:41 +00:00
|
|
|
Line.Printf( locformatter, dXpos, dYpos );
|
2007-08-15 02:43:57 +00:00
|
|
|
SetStatusText( Line, 3 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Load draw 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_DrawFrame::LoadSettings()
|
|
|
|
{
|
|
|
|
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
|
|
|
|
|
|
|
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
|
|
|
|
|
|
|
WinEDA_BasicFrame::LoadSettings();
|
2010-02-01 21:23:27 +00:00
|
|
|
cfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_CursorShape, ( long )0 );
|
|
|
|
bool btmp;
|
|
|
|
if ( cfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) )
|
|
|
|
SetGridVisibility( btmp);
|
|
|
|
int itmp;
|
|
|
|
if( cfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) )
|
|
|
|
SetGridColor(itmp);
|
2009-10-14 19:43:31 +00:00
|
|
|
cfg->Read( m_FrameName + LastGridSizeId, &m_LastGridSizeId, 0L );
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save draw 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_DrawFrame::SaveSettings()
|
|
|
|
{
|
|
|
|
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
|
|
|
|
|
|
|
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
|
|
|
|
|
|
|
WinEDA_BasicFrame::SaveSettings();
|
2010-02-01 21:23:27 +00:00
|
|
|
cfg->Write( m_FrameName + CursorShapeEntryKeyword, m_CursorShape );
|
|
|
|
cfg->Write( m_FrameName + ShowGridEntryKeyword, IsGridVisible() );
|
|
|
|
cfg->Write( m_FrameName + GridColorEntryKeyword, GetGridColor() );
|
2009-10-14 19:43:31 +00:00
|
|
|
cfg->Write( m_FrameName + LastGridSizeId, ( long ) m_LastGridSizeId );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WinEDA_DrawFrame::AppendMsgPanel( const wxString& textUpper,
|
|
|
|
const wxString& textLower,
|
|
|
|
int color, int pad )
|
|
|
|
{
|
|
|
|
if( MsgPanel == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
MsgPanel->AppendMessage( textUpper, textLower, color, pad );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WinEDA_DrawFrame::ClearMsgPanel( void )
|
|
|
|
{
|
|
|
|
if( MsgPanel == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
MsgPanel->EraseMsgBox();
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|