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"
|
|
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
|
|
#ifdef PCBNEW
|
|
|
|
|
#include "pcbnew.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef EESCHEMA
|
|
|
|
|
#include "program.h"
|
|
|
|
|
#include "libcmp.h"
|
|
|
|
|
#include "general.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef CVPCB
|
|
|
|
|
#include "pcbnew.h"
|
|
|
|
|
#include "cvpcb.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <wx/fontdlg.h>
|
|
|
|
|
|
|
|
|
|
#include "bitmaps.h"
|
|
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
#include "id.h"
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
WinEDA_App* parent, const wxString& title,
|
2007-10-27 12:24:09 +00:00
|
|
|
|
const wxPoint& pos, const wxSize& size, long style ) :
|
|
|
|
|
WinEDA_BasicFrame( father, idtype, parent, title, pos, size, style )
|
2007-08-15 02:43:57 +00:00
|
|
|
|
{
|
|
|
|
|
wxSize minsize;
|
|
|
|
|
|
|
|
|
|
m_VToolBar = NULL;
|
|
|
|
|
m_AuxVToolBar = NULL;
|
|
|
|
|
m_OptionsToolBar = NULL;
|
|
|
|
|
m_AuxiliaryToolBar = NULL;
|
|
|
|
|
m_SelGridBox = NULL;
|
|
|
|
|
m_SelZoomBox = NULL;
|
|
|
|
|
m_ZoomMaxValue = 128;
|
|
|
|
|
|
|
|
|
|
DrawPanel = NULL;
|
|
|
|
|
MsgPanel = NULL;
|
|
|
|
|
m_CurrentScreen = NULL;
|
2007-10-01 15:37:42 +00:00
|
|
|
|
m_MenuBar = NULL; // main meun frame
|
2007-08-15 02:43:57 +00:00
|
|
|
|
m_ID_current_state = 0;
|
|
|
|
|
m_HTOOL_current_state = 0;
|
|
|
|
|
m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines
|
|
|
|
|
m_Draw_Grid = FALSE; // TRUE pour avoir la axes dessinee
|
2008-02-12 21:12:46 +00:00
|
|
|
|
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin<69>
|
|
|
|
|
m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim<69>
|
2007-08-15 02:43:57 +00:00
|
|
|
|
m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines
|
|
|
|
|
m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch
|
|
|
|
|
|
2007-10-01 15:37:42 +00:00
|
|
|
|
// Internal units per inch
|
|
|
|
|
// = 1000 for schema, = 10000 for PCB
|
2007-08-15 02:43:57 +00:00
|
|
|
|
m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
|
|
|
|
|
if( (m_Ident == PCB_FRAME) || (m_Ident == GERBER_FRAME)
|
|
|
|
|
|| (m_Ident == CVPCB_DISPLAY_FRAME)
|
|
|
|
|
|| (m_Ident == MODULE_EDITOR_FRAME)
|
|
|
|
|
)
|
|
|
|
|
m_InternalUnits = PCB_INTERNAL_UNIT;
|
|
|
|
|
|
|
|
|
|
minsize.x = 470;
|
|
|
|
|
minsize.y = 350 + m_MsgFrameHeight;
|
|
|
|
|
SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );
|
|
|
|
|
|
|
|
|
|
/* Verification des parametres de creation */
|
|
|
|
|
if( (size.x < minsize.x) || (size.y < minsize.y) )
|
|
|
|
|
SetSize( 0, 0, minsize.x, minsize.y );
|
|
|
|
|
|
|
|
|
|
// Creation de la ligne de status
|
2007-10-31 17:47:44 +00:00
|
|
|
|
#define ZOOM_DISPLAY_SIZE 60
|
|
|
|
|
#define COORD_DISPLAY_SIZE 140
|
|
|
|
|
#define UNITS_DISPLAY_SIZE 50
|
|
|
|
|
#define FUNCTION_DISPLAY_SIZE 100
|
|
|
|
|
static const int dims[6] = { -1, ZOOM_DISPLAY_SIZE,
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
if( m_Ident != DISPLAY3D_FRAME )
|
|
|
|
|
{
|
|
|
|
|
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 ) );
|
|
|
|
|
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-10-01 15:37:42 +00:00
|
|
|
|
if( DrawPanel ) // Required: in WinEDA3D_DrawFrame, DrawPanel == NULL !
|
2007-08-15 02:43:57 +00:00
|
|
|
|
m_Parent->m_EDA_Config->Write( wxT( "AutoPAN" ), DrawPanel->m_AutoPAN_Enable );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
|
|
|
|
/* create the submenu for fonte selection and setup font size
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
|
wxMenu* fontmenu = new wxMenu();
|
|
|
|
|
|
|
|
|
|
ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_DIALOG, _( "font for dialog boxes" ),
|
|
|
|
|
fonts_xpm );
|
|
|
|
|
ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_INFOSCREEN, _( "font for info display" ),
|
|
|
|
|
fonts_xpm );
|
|
|
|
|
ADD_MENUITEM( fontmenu, ID_PREFERENCES_FONT_STATUS, _( "font for Status Line" ),
|
|
|
|
|
fonts_xpm );
|
|
|
|
|
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( main_menu, fontmenu,
|
2007-05-06 16:03:28 +00:00
|
|
|
|
ID_PREFERENCES_FONT, _("&Font selection"),
|
|
|
|
|
_("Choose font type and size for dialogs, infos and status box"),
|
2007-08-15 02:43:57 +00:00
|
|
|
|
fonts_xpm );
|
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::ProcessFontPreferences( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/********************************************************************/
|
|
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
|
int id = event.GetId();
|
|
|
|
|
wxFont font;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
switch( id )
|
|
|
|
|
{
|
|
|
|
|
case ID_PREFERENCES_FONT:
|
|
|
|
|
case ID_PREFERENCES_FONT_DIALOG:
|
|
|
|
|
case ID_PREFERENCES_FONT_STATUS:
|
|
|
|
|
WinEDA_BasicFrame::ProcessFontPreferences( id );
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
case ID_PREFERENCES_FONT_INFOSCREEN:
|
|
|
|
|
{
|
|
|
|
|
font = wxGetFontFromUser( this, *g_MsgFont );
|
|
|
|
|
if( font.Ok() )
|
|
|
|
|
{
|
|
|
|
|
int pointsize = font.GetPointSize();
|
|
|
|
|
*g_MsgFont = font;
|
|
|
|
|
g_MsgFontPointSize = pointsize;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
default:
|
|
|
|
|
DisplayError( this, wxT( "WinEDA_DrawFrame::ProcessFontPreferences Internal Error" ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
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::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
|
|
|
|
/*
|
2007-10-01 15:37:42 +00:00
|
|
|
|
* Dispaly the meesage on yhe bottomon the frame
|
2007-08-15 02:43:57 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
|
SetStatusText( 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
|
|
|
|
/****************************************/
|
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
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************/
|
2007-10-01 15:37:42 +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
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
int id = m_SelGridBox->GetChoice();
|
|
|
|
|
if( id < 0 )
|
|
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
|
|
|
|
wxSize grid = GetScreen()->GetGrid();
|
|
|
|
|
GetScreen()->SetGrid( g_GridList[id] );
|
|
|
|
|
wxSize newgrid = GetScreen()->GetGrid();
|
2007-08-15 02:43:57 +00:00
|
|
|
|
if( newgrid.x != grid.x || newgrid.y != grid.y )
|
|
|
|
|
Recadre_Trace( FALSE );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef EESCHEMA
|
|
|
|
|
/**************************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**************************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Fonction virtuelle
|
2007-08-15 02:43:57 +00:00
|
|
|
|
* traitement des touches de fonctions utilisees ds tous les menus
|
|
|
|
|
* Zoom
|
|
|
|
|
* Redessin d'ecran
|
|
|
|
|
* Cht Unites
|
|
|
|
|
* Cht couches
|
|
|
|
|
* Remise a 0 de l'origine des coordonnees relatives
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtuelle
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/********************************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +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
|
|
|
|
|
*/
|
|
|
|
|
{
|
|
|
|
|
if( m_SelZoomBox == NULL )
|
|
|
|
|
return; //Ne devrait pas se produire!
|
|
|
|
|
|
|
|
|
|
int id = m_SelZoomBox->GetChoice();
|
|
|
|
|
|
|
|
|
|
if( id < 0 )
|
|
|
|
|
return; // No selection
|
|
|
|
|
|
|
|
|
|
if( id == 0 ) // Auto zoom (Fit in Page)
|
|
|
|
|
{
|
|
|
|
|
Zoom_Automatique( TRUE );
|
|
|
|
|
}
|
|
|
|
|
else if( id == (int) (m_SelZoomBox->GetCount() - 1) ) // Dummy position: unlisted zoom
|
|
|
|
|
return;
|
|
|
|
|
else // zooml 1 to zoom max
|
|
|
|
|
{
|
|
|
|
|
id--;
|
|
|
|
|
int zoom = 1 << id;
|
|
|
|
|
if( zoom > m_ZoomMaxValue )
|
|
|
|
|
zoom = m_ZoomMaxValue;
|
2008-02-12 21:12:46 +00:00
|
|
|
|
if( GetScreen()->GetZoom() == zoom )
|
2007-08-15 02:43:57 +00:00
|
|
|
|
return;
|
2008-02-12 21:12:46 +00:00
|
|
|
|
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
|
|
|
|
GetScreen()->SetZoom( zoom );
|
2007-08-15 02:43:57 +00:00
|
|
|
|
Recadre_Trace( FALSE );
|
|
|
|
|
}
|
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-02-12 21:12:46 +00:00
|
|
|
|
return GetScreen()->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
|
|
|
|
/********************************************************/
|
2007-08-15 02:43:57 +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;
|
|
|
|
|
m_OptionsToolBar->SetSize( Auxtoolbar_size.x, 0, size.x, opt_size.y );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
opt_size.x = m_OptionsToolBar->GetSize().x;
|
|
|
|
|
opt_size.y = 0;
|
|
|
|
|
m_OptionsToolBar->SetSize( 0, Auxtoolbar_size.y, opt_size.x, size.y );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( DrawPanel )
|
|
|
|
|
{
|
|
|
|
|
DrawPanel->SetSize( size.x - Vtoolbar_size.x - opt_size.x, size.y - opt_size.y - 1 );
|
|
|
|
|
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
|
|
|
|
|
*/
|
|
|
|
|
{
|
2007-11-01 04:49:32 +00:00
|
|
|
|
bool redraw = false;
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
// Change Cursor
|
|
|
|
|
if( DrawPanel )
|
|
|
|
|
{
|
|
|
|
|
DrawPanel->m_PanelDefaultCursor = new_cursor_id;
|
|
|
|
|
DrawPanel->SetCursor( new_cursor_id );
|
|
|
|
|
}
|
|
|
|
|
SetCursor( wxCURSOR_ARROW );
|
|
|
|
|
DisplayToolMsg( title );
|
|
|
|
|
|
|
|
|
|
if( id < 0 )
|
|
|
|
|
return;
|
|
|
|
|
|
2007-10-12 13:56:22 +00:00
|
|
|
|
#ifdef PCBNEW
|
|
|
|
|
// 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 )
|
2007-11-01 04:49:32 +00:00
|
|
|
|
redraw = true;
|
2007-10-12 13:56:22 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
// 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 );
|
2007-10-12 13:56:22 +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 );
|
2007-10-12 13:56:22 +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 );
|
2007-10-12 13:56:22 +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-11-01 04:49:32 +00:00
|
|
|
|
|
|
|
|
|
// must do this after the tool has been set, otherwise pad::Draw() does
|
|
|
|
|
// not show proper color when DisplayOpt.ContrastModeDisplay is true.
|
|
|
|
|
if( redraw )
|
|
|
|
|
ReDrawPanel();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
void WinEDA_DrawFrame::OnZoom( int zoom_type )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/********************************************/
|
|
|
|
|
|
|
|
|
|
/* Fonction de traitement du zoom
|
2007-08-15 02:43:57 +00:00
|
|
|
|
* Modifie le facteur de zoom et reaffiche l'ecran
|
|
|
|
|
* Pour les commandes par menu Popup ou par le clavier, le curseur est
|
2008-02-12 21:12:46 +00:00
|
|
|
|
* replac<EFBFBD> au centre de l'ecran
|
2007-08-15 02:43:57 +00:00
|
|
|
|
*/
|
|
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
|
if( DrawPanel == NULL )
|
|
|
|
|
return;
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
|
|
|
|
bool move_mouse_cursor = FALSE;
|
|
|
|
|
int x, y;
|
|
|
|
|
wxPoint old_pos;
|
|
|
|
|
|
|
|
|
|
DrawPanel->GetViewStart( &x, &y );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
old_pos = GetScreen()->m_Curseur;
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
|
|
|
|
switch( zoom_type )
|
|
|
|
|
{
|
2008-02-17 21:19:13 +00:00
|
|
|
|
case ID_POPUP_ZOOM_IN:
|
|
|
|
|
case ID_ZOOM_IN_KEY:
|
2007-08-15 02:43:57 +00:00
|
|
|
|
move_mouse_cursor = TRUE;
|
2007-10-03 19:45:32 +00:00
|
|
|
|
// fall thru
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2008-02-17 21:19:13 +00:00
|
|
|
|
case ID_ZOOM_IN_BUTT:
|
|
|
|
|
if( zoom_type == ID_ZOOM_IN_BUTT )
|
2008-02-12 21:12:46 +00:00
|
|
|
|
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
2007-12-05 17:56:57 +00:00
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
GetScreen()->SetPreviousZoom();
|
2007-12-05 17:56:57 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
Recadre_Trace( move_mouse_cursor );
|
|
|
|
|
break;
|
|
|
|
|
|
2008-02-17 21:19:13 +00:00
|
|
|
|
case ID_POPUP_ZOOM_OUT:
|
|
|
|
|
case ID_ZOOM_OUT_KEY:
|
2007-08-15 02:43:57 +00:00
|
|
|
|
move_mouse_cursor = TRUE;
|
2007-10-03 19:45:32 +00:00
|
|
|
|
// fall thru
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2008-02-17 21:19:13 +00:00
|
|
|
|
case ID_ZOOM_OUT_BUTT:
|
|
|
|
|
if( zoom_type == ID_ZOOM_OUT_BUTT )
|
2008-02-12 21:12:46 +00:00
|
|
|
|
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
|
|
|
|
|
GetScreen()->SetNextZoom();
|
2007-08-15 02:43:57 +00:00
|
|
|
|
Recadre_Trace( move_mouse_cursor );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_REDRAW:
|
|
|
|
|
case ID_ZOOM_REDRAW_KEY:
|
|
|
|
|
case ID_ZOOM_REDRAW_BUTT:
|
|
|
|
|
ReDrawPanel();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_CENTER:
|
|
|
|
|
case ID_ZOOM_CENTER_KEY:
|
|
|
|
|
Recadre_Trace( TRUE );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_ZOOM_PAGE_BUTT:
|
|
|
|
|
case ID_ZOOM_AUTO:
|
|
|
|
|
case ID_POPUP_ZOOM_AUTO:
|
|
|
|
|
Zoom_Automatique( FALSE );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_ZOOM_PANNING_UP:
|
|
|
|
|
OnPanning( ID_ZOOM_PANNING_UP );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_ZOOM_PANNING_DOWN:
|
|
|
|
|
OnPanning( ID_ZOOM_PANNING_DOWN );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_ZOOM_PANNING_LEFT:
|
|
|
|
|
OnPanning( ID_ZOOM_PANNING_LEFT );
|
|
|
|
|
DrawPanel->CursorOn( NULL );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_ZOOM_PANNING_RIGHT:
|
|
|
|
|
OnPanning( ID_ZOOM_PANNING_RIGHT );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
wxMessageBox( wxT( "WinEDA_DrawFrame::OnZoom switch Error" ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Affiche_Status_Box();
|
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::OnPanning( int direction )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**********************************************/
|
|
|
|
|
|
|
|
|
|
/* Fonction de traitement du zoom
|
2007-08-15 02:43:57 +00:00
|
|
|
|
* Modifie le facteur de zoom et reaffiche l'ecran
|
|
|
|
|
* Pour les commandes par menu Popup ou par le clavier, le curseur est
|
2008-02-12 21:12:46 +00:00
|
|
|
|
* replac<EFBFBD> au centre de l'ecran
|
2007-08-15 02:43:57 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
|
if( DrawPanel == NULL )
|
|
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
int delta;
|
|
|
|
|
wxClientDC dc( DrawPanel );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
int x, y;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
DrawPanel->PrepareGraphicContext( &dc );
|
|
|
|
|
DrawPanel->GetViewStart( &x, &y ); // x and y are in scroll unit, not in pixels
|
|
|
|
|
delta = DrawPanel->m_ScrollButt_unit;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
switch( direction )
|
|
|
|
|
{
|
|
|
|
|
case ID_ZOOM_PANNING_UP:
|
|
|
|
|
y -= delta;
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
case ID_ZOOM_PANNING_DOWN:
|
|
|
|
|
y += delta;
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
case ID_ZOOM_PANNING_LEFT:
|
|
|
|
|
x -= delta;
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
case ID_ZOOM_PANNING_RIGHT:
|
|
|
|
|
x += delta;
|
|
|
|
|
break;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
default:
|
|
|
|
|
wxMessageBox( wxT( "WinEDA_DrawFrame::OnPanning Error" ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawPanel->Scroll( x, y );
|
|
|
|
|
|
|
|
|
|
/* Place le curseur souris sur le curseur SCHEMA*/
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
/*****************************/
|
|
|
|
|
/* default virtual fonctions */
|
|
|
|
|
/*****************************/
|
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()
|
|
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
|
GetScreen()->BlockLocate.m_BlockDrawStruct = NULL;
|
|
|
|
|
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
|
|
|
|
/*********************************************/
|
|
|
|
|
{
|
2007-08-15 02:43:57 +00:00
|
|
|
|
wxSize draw_size, panel_size;
|
|
|
|
|
wxSize scrollbar_number;
|
|
|
|
|
wxPoint scrollbar_pos;
|
2008-02-12 21:12:46 +00:00
|
|
|
|
int zoom = GetScreen()->GetZoom();
|
2007-08-15 02:43:57 +00:00
|
|
|
|
int xUnit, yUnit;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
if( GetScreen() == NULL )
|
2007-08-15 02:43:57 +00:00
|
|
|
|
return;
|
|
|
|
|
if( DrawPanel == NULL )
|
|
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
draw_size = GetScreen()->ReturnPageSize();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
// La zone d'affichage est reglee a une taille double de la feuille de travail:
|
|
|
|
|
draw_size.x *= 2; draw_size.y *= 2;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
// On utilise le centre de l'ecran comme position de reference, donc
|
|
|
|
|
// la surface de trace doit etre augmentee
|
|
|
|
|
panel_size = DrawPanel->GetClientSize();
|
|
|
|
|
panel_size.x *= zoom; panel_size.y *= zoom;
|
|
|
|
|
draw_size.x += panel_size.x / 2;
|
|
|
|
|
draw_size.y += panel_size.y / 2;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
if( GetScreen()->m_Center )
|
2007-08-15 02:43:57 +00:00
|
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
|
GetScreen()->m_DrawOrg.x = -draw_size.x / 2;
|
|
|
|
|
GetScreen()->m_DrawOrg.y = -draw_size.y / 2;
|
2007-08-15 02:43:57 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
|
GetScreen()->m_DrawOrg.x = -panel_size.x / 2;
|
|
|
|
|
GetScreen()->m_DrawOrg.y = -panel_size.y / 2;
|
2007-08-15 02:43:57 +00:00
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
// DrawOrg est rendu multiple du zoom min :
|
2008-02-12 21:12:46 +00:00
|
|
|
|
GetScreen()->m_DrawOrg.x -= GetScreen()->m_DrawOrg.x % 256;
|
|
|
|
|
GetScreen()->m_DrawOrg.y -= GetScreen()->m_DrawOrg.y % 256;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
// Calcul du nombre de scrolls (en unites de scrool )
|
|
|
|
|
scrollbar_number.x = draw_size.x / (DrawPanel->m_Scroll_unit * zoom);
|
|
|
|
|
scrollbar_number.y = draw_size.y / (DrawPanel->m_Scroll_unit * zoom);
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
xUnit = yUnit = DrawPanel->m_Scroll_unit;
|
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;
|
|
|
|
|
xUnit *= zoom; yUnit *= zoom;
|
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
|
2008-02-12 21:12:46 +00:00
|
|
|
|
scrollbar_pos = GetScreen()->m_Curseur;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
scrollbar_pos.x -= GetScreen()->m_DrawOrg.x;
|
|
|
|
|
scrollbar_pos.y -= GetScreen()->m_DrawOrg.y;
|
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
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
if( scrollbar_pos.x < 0 )
|
|
|
|
|
scrollbar_pos.x = 0;
|
|
|
|
|
if( scrollbar_pos.y < 0 )
|
|
|
|
|
scrollbar_pos.y = 0;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
scrollbar_pos.x /= xUnit;
|
|
|
|
|
scrollbar_pos.y /= yUnit;
|
2008-02-12 21:12:46 +00:00
|
|
|
|
GetScreen()->m_ScrollbarPos = scrollbar_pos;
|
|
|
|
|
GetScreen()->m_ScrollbarNumber = scrollbar_number;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
DrawPanel->SetScrollbars( DrawPanel->m_Scroll_unit,
|
|
|
|
|
DrawPanel->m_Scroll_unit,
|
2008-02-12 21:12:46 +00:00
|
|
|
|
GetScreen()->m_ScrollbarNumber.x,
|
|
|
|
|
GetScreen()->m_ScrollbarNumber.y,
|
|
|
|
|
GetScreen()->m_ScrollbarPos.x,
|
|
|
|
|
GetScreen()->m_ScrollbarPos.y, TRUE );
|
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
|
|
|
|
|
*/
|
|
|
|
|
{
|
|
|
|
|
if( (color_num != WHITE) && (color_num != BLACK) )
|
|
|
|
|
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
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
m_Parent->SetLanguageIdentifier( id );
|
|
|
|
|
m_Parent->SetLanguage();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
|
void WinEDA_DrawFrame::Affiche_Status_Box()
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/***********************************************/
|
2007-08-15 02:43:57 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Routine d'affichage du zoom et des coord curseur.
|
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 Line;
|
|
|
|
|
int dx, dy;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
if( GetScreen() == NULL )
|
|
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
/* affichage Zoom et coordonnees absolues */
|
|
|
|
|
Line.Printf( wxT( "Z %d" ), GetScreen()->GetZoom() );
|
|
|
|
|
SetStatusText( Line, 1 );
|
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" ),
|
|
|
|
|
To_User_Unit( g_UnitMetric, GetScreen()->m_Curseur.x,
|
|
|
|
|
m_InternalUnits ),
|
|
|
|
|
To_User_Unit( g_UnitMetric, GetScreen()->m_Curseur.y,
|
|
|
|
|
m_InternalUnits ) );
|
|
|
|
|
SetStatusText( Line, 2 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-15 02:43:57 +00:00
|
|
|
|
/* affichage des coordonnees relatives */
|
|
|
|
|
dx = GetScreen()->m_Curseur.x - GetScreen()->m_O_Curseur.x;
|
|
|
|
|
dy = GetScreen()->m_Curseur.y - GetScreen()->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" ),
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
#ifdef PCBNEW
|
2007-08-15 02:43:57 +00:00
|
|
|
|
if( DisplayOpt.DisplayPolarCood ) /* Display coordonnee polaire */
|
|
|
|
|
{
|
|
|
|
|
double theta, ro;
|
|
|
|
|
if( (dx == 0) && (dy == 0) )
|
|
|
|
|
theta = 0.0;
|
|
|
|
|
else
|
|
|
|
|
theta = atan2( (double) -dy, (double) dx );
|
|
|
|
|
theta = theta * 180 / M_PI;
|
|
|
|
|
|
|
|
|
|
ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
|
|
|
|
|
Line.Printf( g_UnitMetric ? wxT( "Ro %.3f Th %.1f" ) : wxT( "Ro %.4f Th %.1f" ),
|
|
|
|
|
To_User_Unit( g_UnitMetric, (int) round( ro ), m_InternalUnits ),
|
|
|
|
|
theta );
|
|
|
|
|
SetStatusText( Line, 0 );
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|