2007-08-15 02:43:57 +00:00
|
|
|
|
/******************************************************************/
|
|
|
|
|
/* drawframe.cpp - fonctions des classes du type WinEDA_DrawFrame */
|
|
|
|
|
/******************************************************************/
|
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"
|
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
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
/* Configuration entry names. */
|
|
|
|
|
static const wxString CursorShapeEntry( wxT( "CuShape" ) );
|
|
|
|
|
static const wxString ShowGridEntry( wxT( "ShGrid" ) );
|
|
|
|
|
|
|
|
|
|
|
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 )
|
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
/*******************************************************/
|
|
|
|
|
/* Constructeur de WinEDA_DrawFrame: la fenetre generale */
|
|
|
|
|
/*******************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
DrawPanel = NULL;
|
|
|
|
|
MsgPanel = NULL;
|
|
|
|
|
m_CurrentScreen = NULL;
|
2007-08-15 02:43:57 +00:00
|
|
|
|
m_ID_current_state = 0;
|
|
|
|
|
m_HTOOL_current_state = 0;
|
2009-01-29 14:26:20 +00:00
|
|
|
|
m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines
|
|
|
|
|
m_Draw_Grid = FALSE; // TRUE pour avoir la axes dessinee
|
|
|
|
|
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin<69>
|
|
|
|
|
m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim<69>
|
|
|
|
|
m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines
|
|
|
|
|
m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch
|
2009-04-05 20:49:15 +00:00
|
|
|
|
m_CursorShape = 0;
|
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 );
|
|
|
|
|
|
|
|
|
|
/* Verification des parametres de creation */
|
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 );
|
|
|
|
|
|
|
|
|
|
// Creation de la ligne de status
|
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.
|
|
|
|
|
GetClientSize( &m_FrameSize.x, &m_FrameSize.y );/* dimx, dimy = dimensions utiles de la
|
|
|
|
|
* zone utilisateur de la fenetre principale */
|
|
|
|
|
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-05-06 16:03:28 +00:00
|
|
|
|
/****************************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
|
WinEDA_DrawFrame::~WinEDA_DrawFrame()
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/****************************************/
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
void WinEDA_DrawFrame::Affiche_Message( const wxString& message )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**************************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*
|
2009-04-05 20:49:15 +00:00
|
|
|
|
* Display the message on the bottom the frame
|
2007-08-15 02:43:57 +00:00
|
|
|
|
*/
|
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-05-06 16:03:28 +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
|
|
|
|
void WinEDA_DrawFrame::ReCreateAuxiliaryToolbar()
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*******************************************************/
|
2007-10-01 15:37:42 +00:00
|
|
|
|
// Virtual function
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/********************************************/
|
2007-10-01 15:37:42 +00:00
|
|
|
|
void WinEDA_DrawFrame::ReCreateMenuBar()
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/********************************************/
|
2007-10-01 15:37:42 +00:00
|
|
|
|
// Virtual function
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
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::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
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**************************************************************/
|
2007-10-01 15:37:42 +00:00
|
|
|
|
// Virtual function
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/********************************************************/
|
2007-10-01 15:37:42 +00:00
|
|
|
|
void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/********************************************************/
|
2007-10-01 15:37:42 +00:00
|
|
|
|
// Virtual function
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
|
if( m_SelGridBox == NULL )
|
2007-10-01 15:37:42 +00:00
|
|
|
|
return; // Should not occurs
|
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
|
|
|
|
|
|
|
|
|
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
2009-02-07 08:33:25 +00:00
|
|
|
|
wxRealPoint current_grid = screen->GetGrid();
|
2008-12-05 16:03:05 +00:00
|
|
|
|
screen->SetGrid( event.GetSelection() + ID_POPUP_GRID_LEVEL_1000 );
|
2009-02-07 08:33:25 +00:00
|
|
|
|
wxRealPoint selected_grid = screen->GetGrid();
|
2008-12-05 16:03:05 +00:00
|
|
|
|
|
|
|
|
|
if( selected_grid != current_grid )
|
2007-08-15 02:43:57 +00:00
|
|
|
|
Recadre_Trace( FALSE );
|
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 )
|
|
|
|
|
return; //Ne devrait pas se produire!
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
if( id == 0 ) // Auto zoom (Fit in Page)
|
|
|
|
|
{
|
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
|
|
|
|
}
|
|
|
|
|
|
2007-10-26 06:08:19 +00:00
|
|
|
|
/***********************************/
|
|
|
|
|
int WinEDA_DrawFrame::GetZoom(void)
|
|
|
|
|
/***********************************/
|
|
|
|
|
/* Return the current zoom level */
|
|
|
|
|
{
|
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
|
|
|
|
|
2007-05-06 16:03:28 +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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
// Virtuelle
|
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-05-06 16:03:28 +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();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +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
|
|
|
|
/*******************************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
|
void WinEDA_DrawFrame::DisplayUnitsMsg()
|
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
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
|
|
switch( g_UnitMetric )
|
|
|
|
|
{
|
|
|
|
|
case INCHES:
|
|
|
|
|
msg = _( "Inch" );
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
case MILLIMETRE:
|
|
|
|
|
msg += _( "mm" );
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
default:
|
|
|
|
|
msg += _( "??" );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetStatusText( msg, 4 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/***************************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
|
void WinEDA_DrawFrame::ReDrawPanel()
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/***************************************/
|
|
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
|
if( DrawPanel == NULL )
|
|
|
|
|
return;
|
2007-12-03 21:28:56 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
wxClientDC dc( DrawPanel );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
DrawPanel->PrepareGraphicContext( &dc );
|
|
|
|
|
DrawPanel->ReDraw( &dc );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
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::OnSize( wxSizeEvent& SizeEv )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* recalcule les dimensions des toolbars et du panel d'affichage
|
2007-08-15 02:43:57 +00:00
|
|
|
|
*/
|
|
|
|
|
{
|
|
|
|
|
wxSize size;
|
|
|
|
|
wxSize opt_size;
|
|
|
|
|
wxSize Vtoolbar_size;
|
|
|
|
|
wxSize Auxtoolbar_size;
|
|
|
|
|
|
|
|
|
|
GetClientSize( &size.x, &size.y );
|
|
|
|
|
m_FrameSize = size;
|
|
|
|
|
size.y -= m_MsgFrameHeight;
|
|
|
|
|
|
|
|
|
|
if( MsgPanel ) // Positionnement en bas d'ecran
|
|
|
|
|
{
|
|
|
|
|
MsgPanel->SetSize( 0, size.y, size.x, m_MsgFrameHeight );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( m_AuxiliaryToolBar ) // est sous le m_HToolBar
|
|
|
|
|
{
|
|
|
|
|
Auxtoolbar_size.x = size.x; // = Largeur de la frame
|
|
|
|
|
Auxtoolbar_size.y = m_AuxiliaryToolBar->GetSize().y;
|
|
|
|
|
m_AuxiliaryToolBar->SetSize( Auxtoolbar_size );
|
|
|
|
|
m_AuxiliaryToolBar->Move( 0, 0 );
|
|
|
|
|
size.y -= Auxtoolbar_size.y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( m_VToolBar ) // Toolbar de droite: hauteur = hauteur utile de la frame-Auxtoolbar
|
|
|
|
|
{
|
|
|
|
|
Vtoolbar_size.x = m_VToolBar->GetSize().x;
|
|
|
|
|
Vtoolbar_size.y = size.y;
|
|
|
|
|
m_VToolBar->SetSize( Vtoolbar_size );
|
|
|
|
|
m_VToolBar->Move( size.x - Vtoolbar_size.x, Auxtoolbar_size.y );
|
|
|
|
|
m_VToolBar->Refresh();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( m_AuxVToolBar ) // auxiliary vertical right toolbar, showing tools fo microwave applications
|
|
|
|
|
{
|
|
|
|
|
Vtoolbar_size.x += m_AuxVToolBar->GetSize().x;
|
|
|
|
|
Vtoolbar_size.y = size.y;
|
|
|
|
|
m_AuxVToolBar->SetSize( m_AuxVToolBar->GetSize().x, Vtoolbar_size.y );
|
|
|
|
|
m_AuxVToolBar->Move( size.x - Vtoolbar_size.x, Auxtoolbar_size.y );
|
|
|
|
|
m_AuxVToolBar->Refresh();
|
|
|
|
|
}
|
|
|
|
|
if( m_OptionsToolBar )
|
|
|
|
|
{
|
|
|
|
|
if( m_OptionsToolBar->m_Horizontal )
|
|
|
|
|
{
|
|
|
|
|
opt_size.x = 0;
|
|
|
|
|
opt_size.y = m_OptionsToolBar->GetSize().y;
|
2008-12-05 16:03:05 +00:00
|
|
|
|
m_OptionsToolBar->SetSize( Auxtoolbar_size.x, 0,
|
|
|
|
|
size.x, opt_size.y );
|
2007-08-15 02:43:57 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
opt_size.x = m_OptionsToolBar->GetSize().x;
|
|
|
|
|
opt_size.y = 0;
|
2008-12-05 16:03:05 +00:00
|
|
|
|
m_OptionsToolBar->SetSize( 0, Auxtoolbar_size.y,
|
|
|
|
|
opt_size.x, size.y );
|
2007-08-15 02:43:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( DrawPanel )
|
|
|
|
|
{
|
2008-12-05 16:03:05 +00:00
|
|
|
|
DrawPanel->SetSize( size.x - Vtoolbar_size.x - opt_size.x,
|
|
|
|
|
size.y - opt_size.y - 1 );
|
2007-08-15 02:43:57 +00:00
|
|
|
|
DrawPanel->Move( opt_size.x, opt_size.y + Auxtoolbar_size.y + 1 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SizeEv.Skip();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
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::SetToolID( int id, int new_cursor_id,
|
|
|
|
|
const wxString& title )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*************************************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*
|
2007-08-15 02:43:57 +00:00
|
|
|
|
* Active l'icone de l'outil selectionne dans le toolbar Vertical
|
|
|
|
|
* ( ou l'outil par defaut ID_NO_SELECT_BUTT si pas de nouvelle selection )
|
|
|
|
|
* if ( id >= 0 )
|
|
|
|
|
* Met a jour toutes les variables associees:
|
|
|
|
|
* message, m_ID_current_state, curseur
|
|
|
|
|
* si ( id < 0 )
|
|
|
|
|
* Met a jour seulement les variables message et curseur
|
|
|
|
|
*/
|
|
|
|
|
{
|
|
|
|
|
// Change Cursor
|
|
|
|
|
if( DrawPanel )
|
|
|
|
|
{
|
|
|
|
|
DrawPanel->m_PanelDefaultCursor = new_cursor_id;
|
|
|
|
|
DrawPanel->SetCursor( new_cursor_id );
|
|
|
|
|
}
|
|
|
|
|
SetCursor( wxCURSOR_ARROW );
|
|
|
|
|
DisplayToolMsg( title );
|
|
|
|
|
|
|
|
|
|
if( id < 0 )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Old Tool Inactif ou ID_NO_SELECT_BUTT actif si pas de nouveau Tool
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
if( id )
|
|
|
|
|
{
|
|
|
|
|
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 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// New Tool Actif
|
|
|
|
|
if( id )
|
|
|
|
|
{
|
|
|
|
|
if( m_VToolBar )
|
|
|
|
|
m_VToolBar->ToggleTool( id, TRUE );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
if( m_AuxVToolBar )
|
|
|
|
|
m_AuxVToolBar->ToggleTool( id, TRUE );
|
|
|
|
|
}
|
|
|
|
|
else if( m_VToolBar )
|
|
|
|
|
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
|
|
|
|
|
|
|
|
|
|
m_ID_current_state = id;
|
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()
|
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetBaseScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
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
|
|
|
|
/*********************************************/
|
|
|
|
|
{
|
2009-04-09 18:39:39 +00:00
|
|
|
|
#ifndef WX_ZOOM
|
2009-01-29 14:26:20 +00:00
|
|
|
|
int xUnit, yUnit;
|
2007-08-15 02:43:57 +00:00
|
|
|
|
wxSize draw_size, panel_size;
|
|
|
|
|
wxSize scrollbar_number;
|
|
|
|
|
wxPoint scrollbar_pos;
|
2009-01-29 14:26:20 +00:00
|
|
|
|
BASE_SCREEN* screen = GetBaseScreen();
|
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.
|
2009-01-17 20:31:19 +00:00
|
|
|
|
draw_size = 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.
|
2009-01-29 14:26:20 +00:00
|
|
|
|
panel_size = DrawPanel->GetClientSize();
|
|
|
|
|
screen->Unscale( panel_size );
|
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. */
|
|
|
|
|
if( panel_size.x > draw_size.x || panel_size.y > draw_size.y )
|
|
|
|
|
draw_size = panel_size;
|
|
|
|
|
|
|
|
|
|
draw_size += panel_size / 2;
|
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
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
|
screen->m_DrawOrg.x = -draw_size.x / 2;
|
|
|
|
|
screen->m_DrawOrg.y = -draw_size.y / 2;
|
2007-08-15 02:43:57 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
|
screen->m_DrawOrg.x = -panel_size.x / 2;
|
|
|
|
|
screen->m_DrawOrg.y = -panel_size.y / 2;
|
2007-08-15 02:43:57 +00:00
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
// Calculate the number of scroll bar units for the given zoom level. */
|
|
|
|
|
scrollbar_number.x =
|
|
|
|
|
wxRound( (double) draw_size.x /
|
|
|
|
|
(double) screen->Unscale( screen->m_ZoomScalar ) );
|
|
|
|
|
scrollbar_number.y =
|
|
|
|
|
wxRound( (double) draw_size.y /
|
|
|
|
|
(double) screen->Unscale( screen->m_ZoomScalar ) );
|
|
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
|
xUnit = yUnit = screen->m_ZoomScalar;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
if( xUnit <= 1 )
|
|
|
|
|
xUnit = 1;
|
|
|
|
|
if( yUnit <= 1 )
|
|
|
|
|
yUnit = 1;
|
2009-01-29 14:26:20 +00:00
|
|
|
|
xUnit = screen->Unscale( xUnit );
|
|
|
|
|
yUnit = screen->Unscale( yUnit );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
// Calcul de la position, curseur place au centre d'ecran
|
2009-01-29 14:26:20 +00:00
|
|
|
|
scrollbar_pos = screen->m_Curseur - screen->m_DrawOrg;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
scrollbar_pos.x -= panel_size.x / 2;
|
|
|
|
|
scrollbar_pos.y -= panel_size.y / 2;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
if( scrollbar_pos.x <= 0 )
|
2007-08-15 02:43:57 +00:00
|
|
|
|
scrollbar_pos.x = 0;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
if( scrollbar_pos.y <= 0 )
|
2007-08-15 02:43:57 +00:00
|
|
|
|
scrollbar_pos.y = 0;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
scrollbar_pos.x = wxRound( (double) scrollbar_pos.x / (double) xUnit );
|
|
|
|
|
scrollbar_pos.y = wxRound( (double) scrollbar_pos.y / (double) yUnit );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
screen->m_ScrollbarPos = scrollbar_pos;
|
|
|
|
|
screen->m_ScrollbarNumber = scrollbar_number;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
wxLogDebug( wxT( "SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
|
|
|
|
|
screen->m_ZoomScalar, screen->m_ZoomScalar,
|
|
|
|
|
screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
|
|
|
|
|
screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
|
|
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
|
DrawPanel->SetScrollbars( screen->m_ZoomScalar,
|
|
|
|
|
screen->m_ZoomScalar,
|
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,
|
|
|
|
|
screen->m_ScrollbarPos.y, TRUE );
|
2009-05-21 17:42:42 +00:00
|
|
|
|
// #else
|
|
|
|
|
// BASE_SCREEN* screen = GetBaseScreen();
|
|
|
|
|
// wxSize drawingSize = screen->ReturnPageSize() * 2;
|
|
|
|
|
// wxCoord x, y;
|
|
|
|
|
// wxClientDC DC( this );
|
|
|
|
|
// DrawPanel->PrepareGraphicContext( &DC );
|
|
|
|
|
// x = DC.LogicalToDeviceXRel( drawingSize.GetWidth() );
|
|
|
|
|
// y = DC.LogicalToDeviceYRel( drawingSize.GetHeight() );
|
|
|
|
|
// DrawPanel->SetScrollbars( 1, 1, x, y,
|
|
|
|
|
// DC.LogicalToDeviceX( screen->m_Curseur.x ),
|
|
|
|
|
// DC.LogicalToDeviceY( screen->m_Curseur.y ),
|
|
|
|
|
// true );
|
2009-04-09 18:39:39 +00:00
|
|
|
|
#endif
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
void WinEDA_DrawFrame::SetDrawBgColor( int color_num )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/****************************************************/
|
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
/* met a jour la couleur de fond pour les trac<61>s
|
|
|
|
|
* seules les couleurs BLACK ou WHITE sont autoris<EFBFBD>es
|
2007-08-15 02:43:57 +00:00
|
|
|
|
* le parametre XorMode est mis a jour selon la couleur du fond
|
|
|
|
|
*/
|
|
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
|
if( ( color_num != WHITE ) && ( color_num != BLACK ) )
|
2007-08-15 02:43:57 +00:00
|
|
|
|
color_num = BLACK;
|
|
|
|
|
g_DrawBgColor = color_num;
|
|
|
|
|
if( color_num == WHITE )
|
|
|
|
|
{
|
|
|
|
|
g_XorMode = GR_NXOR;
|
|
|
|
|
g_GhostColor = BLACK;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_XorMode = GR_XOR;
|
|
|
|
|
g_GhostColor = WHITE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( DrawPanel )
|
|
|
|
|
DrawPanel->SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
|
|
|
|
|
ColorRefs[g_DrawBgColor].m_Green,
|
|
|
|
|
ColorRefs[g_DrawBgColor].m_Blue ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/********************************************************/
|
|
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
|
int id = event.GetId();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
|
wxGetApp().SetLanguageIdentifier( id );
|
2009-01-17 20:31:19 +00:00
|
|
|
|
if ( wxGetApp().SetLanguage() )
|
|
|
|
|
{
|
|
|
|
|
wxLogDebug( wxT( "Recreating menu bar due to language change." ) );
|
|
|
|
|
ReCreateMenuBar();
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
2007-05-06 16:03:28 +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
|
|
|
|
|
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: */
|
2007-08-15 02:43:57 +00:00
|
|
|
|
Line.Printf( g_UnitMetric ? wxT( "X %.3f Y %.3f" ) : wxT( "X %.4f Y %.4f" ),
|
2008-12-19 13:51:48 +00:00
|
|
|
|
To_User_Unit( g_UnitMetric, screen->m_Curseur.x,
|
|
|
|
|
m_InternalUnits ),
|
|
|
|
|
To_User_Unit( g_UnitMetric, screen->m_Curseur.y,
|
|
|
|
|
m_InternalUnits ) );
|
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;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
Line.Printf( g_UnitMetric ? wxT( "x %.3f y %.3f" ) : wxT( "x %.4f y %.4f" ),
|
2008-12-19 13:51:48 +00:00
|
|
|
|
To_User_Unit( g_UnitMetric, dx, m_InternalUnits ),
|
|
|
|
|
To_User_Unit( g_UnitMetric, dy, m_InternalUnits ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
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();
|
|
|
|
|
cfg->Read( m_FrameName + CursorShapeEntry, &m_CursorShape, ( long )0 );
|
|
|
|
|
cfg->Read( m_FrameName + ShowGridEntry, &m_Draw_Grid, true );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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();
|
|
|
|
|
cfg->Write( m_FrameName + CursorShapeEntry, m_CursorShape );
|
|
|
|
|
cfg->Write( m_FrameName + ShowGridEntry, m_Draw_Grid );
|
|
|
|
|
}
|