Commit 2e5a57e1 authored by stambaughw's avatar stambaughw

New zoom implementation and some build optimizations.

parent f1a37af8
...@@ -5,6 +5,15 @@ Started 2007-June-11 ...@@ -5,6 +5,15 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-Jan-29 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++All
* Replace zoom implementation with a more flexible ( and hopefully useful )
design.
* Removed gr_basic.h from fctsys.h so that the entire project doesn't get
rebuilt unnecessarily.
2009-Jan-29 UPDATE Dick Hollenbeck <dick@softplc.com> 2009-Jan-29 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
++eeschema ++eeschema
......
...@@ -25,14 +25,14 @@ WX_DEFINE_OBJARRAY( GridArray ); ...@@ -25,14 +25,14 @@ WX_DEFINE_OBJARRAY( GridArray );
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
{ {
EEDrawList = NULL; /* Schematic items list */ EEDrawList = NULL; /* Schematic items list */
m_ZoomList = NULL;
m_UndoList = NULL; m_UndoList = NULL;
m_RedoList = NULL; m_RedoList = NULL;
m_UndoRedoCountMax = 1; m_UndoRedoCountMax = 1;
m_FirstRedraw = TRUE; m_FirstRedraw = TRUE;
m_ScreenNumber = 1; m_ScreenNumber = 1;
m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */ m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
m_Zoom = 32; m_ZoomScalar = 10;
m_Zoom = 32 * m_ZoomScalar;
m_Grid = wxSize( 50, 50 ); /* Default grid size */ m_Grid = wxSize( 50, 50 ); /* Default grid size */
m_UserGridIsON = FALSE; m_UserGridIsON = FALSE;
m_Diviseur_Grille = 1; m_Diviseur_Grille = 1;
...@@ -47,9 +47,6 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) ...@@ -47,9 +47,6 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
BASE_SCREEN::~BASE_SCREEN() BASE_SCREEN::~BASE_SCREEN()
/******************************/ /******************************/
{ {
if( m_ZoomList )
free( m_ZoomList );
ClearUndoRedoList(); ClearUndoRedoList();
} }
...@@ -101,131 +98,174 @@ wxSize BASE_SCREEN::ReturnPageSize( void ) ...@@ -101,131 +98,174 @@ wxSize BASE_SCREEN::ReturnPageSize( void )
{ {
int internal_units = GetInternalUnits(); int internal_units = GetInternalUnits();
return wxSize( m_CurrentSheetDesc->m_Size.x * (internal_units / 1000), return wxSize( ( m_CurrentSheetDesc->m_Size.x * internal_units ) / 1000,
m_CurrentSheetDesc->m_Size.y * (internal_units / 1000) ); ( m_CurrentSheetDesc->m_Size.y * internal_units ) / 1000 );
} }
/******************************************************************/ /******************************************************************/
wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos ) wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
/******************************************************************/ /******************************************************************/
{ {
wxPoint curpos; wxPoint curpos = ScreenPos;
Unscale( curpos );
// D(printf("curpos=%d,%d GetZoom=%d, mDrawOrg=%d,%d\n", curpos.x, curpos.y, GetZoom(), m_DrawOrg.x, m_DrawOrg.y );) // D(printf("curpos=%d,%d GetZoom=%d, mDrawOrg=%d,%d\n", curpos.x, curpos.y, GetZoom(), m_DrawOrg.x, m_DrawOrg.y );)
curpos.x = ScreenPos.x * GetZoom(); // curpos.x = Unscale( ScreenPos.x );
curpos.y = ScreenPos.y * GetZoom(); // curpos.y = Unscale( ScreenPos.y );
curpos.x += m_DrawOrg.x; curpos += m_DrawOrg;
curpos.y += m_DrawOrg.y;
return curpos; return curpos;
} }
/**
* Calculate coordinate value for zooming.
*
* Call this method when drawing on the device context. It scales the
* coordinate using the current zoom settings. Zooming in Kicad occurs
* by actually scaling the entire drawing using the zoom setting.
*
* FIXME: We should probably use wxCoord instead of int here but that would
* require using wxCoord in all of the other code that makes device
* context calls as well.
*/
int BASE_SCREEN::Scale( int coord )
{
#ifdef WX_ZOOM
return coord;
#else
if( !m_Zoom )
return 0;
/**************************************************/ if( !m_ZoomScalar || !m_Zoom )
void BASE_SCREEN::SetZoomList( const int* zoomlist ) return 0;
/**************************************************/
/* init liste des zoom (NULL terminated) return wxRound( (double) ( coord * m_ZoomScalar ) / (double) m_Zoom );
#endif
}
void BASE_SCREEN::Scale( wxPoint& pt )
{
pt.x = Scale( pt.x );
pt.y = Scale( pt.y );
}
void BASE_SCREEN::Scale( wxSize& sz )
{
sz.SetHeight( Scale( sz.GetHeight() ) );
sz.SetWidth( Scale( sz.GetWidth() ) );
}
/**
* Calculate the physical (unzoomed) location of a coordinate.
*
* Call this method when you want to find the unzoomed (physical) location
* of a coordinate on the drawing.
*/ */
int BASE_SCREEN::Unscale( int coord )
{ {
int nbitems; #ifdef WX_ZOOM
const int* zoom; return coord;
#else
if( !m_Zoom || !m_ZoomScalar )
return 0;
// get list length return wxRound( (double) ( coord * m_Zoom ) / (double) m_ZoomScalar );
for( nbitems = 1, zoom = zoomlist; ; zoom++, nbitems++ ) #endif
{ }
if( *zoom == 0 )
break;
}
// resize our list void BASE_SCREEN::Unscale( wxPoint& pt )
if( m_ZoomList ) {
free( m_ZoomList ); pt.x = Unscale( pt.x );
pt.y = Unscale( pt.y );
}
m_ZoomList = (int*) MyZMalloc( nbitems * sizeof(int) );
int ii; void BASE_SCREEN::Unscale( wxSize& sz )
for( ii = 0, zoom = zoomlist; ii < nbitems; zoom++, ii++ ) {
{ sz.SetHeight( Unscale( sz.GetHeight() ) );
m_ZoomList[ii] = *zoom; sz.SetWidth( Unscale( sz.GetWidth() ) );
} }
void BASE_SCREEN::SetZoomList( const wxArrayInt& zoomlist )
{
if( !m_ZoomList.IsEmpty() )
m_ZoomList.Empty();
m_ZoomList = zoomlist;
} }
/***********************************/
void BASE_SCREEN::SetFirstZoom() void BASE_SCREEN::SetFirstZoom()
/***********************************/
{ {
m_Zoom = 1; if( m_ZoomList.IsEmpty() )
m_Zoom = m_ZoomScalar;
else
m_Zoom = m_ZoomList[0];
} }
/******************************/
int BASE_SCREEN::GetZoom() const int BASE_SCREEN::GetZoom() const
/******************************/
{ {
return m_Zoom; return m_Zoom;
} }
/***********************************/
void BASE_SCREEN::SetZoom( int coeff ) void BASE_SCREEN::SetZoom( int coeff )
/***********************************/
{ {
m_Zoom = coeff; m_Zoom = coeff;
if( m_Zoom < 1 ) if( m_Zoom < 1 )
m_Zoom = 1; m_Zoom = 1;
} }
/********************************/
void BASE_SCREEN::SetNextZoom() void BASE_SCREEN::SetNextZoom()
/********************************/
/* Selectionne le prochain coeff de zoom
*/
{ {
m_Zoom *= 2; size_t i;
if( m_ZoomList == NULL ) if( m_ZoomList.IsEmpty() || m_Zoom >= m_ZoomList.Last() )
return; return;
int ii, zoom_max = 512; for( i = 0; i < m_ZoomList.GetCount(); i++ )
for( ii = 0; m_ZoomList[ii] != 0; ii++ ) {
zoom_max = m_ZoomList[ii]; if( m_Zoom < m_ZoomList[i] )
{
if( m_Zoom > zoom_max ) m_Zoom = m_ZoomList[i];
m_Zoom = zoom_max; break;
}
}
} }
/*************************************/
void BASE_SCREEN::SetPreviousZoom() void BASE_SCREEN::SetPreviousZoom()
/*************************************/
/* Selectionne le precedent coeff de zoom
*/
{ {
m_Zoom /= 2; size_t i;
if( m_Zoom < 1 )
m_Zoom = 1; if( m_ZoomList.IsEmpty() || m_Zoom <= m_ZoomList[0] )
return;
for( i = m_ZoomList.GetCount(); i != 0; i-- )
{
if( m_Zoom > m_ZoomList[i - 1] )
{
m_Zoom = m_ZoomList[i - 1];
break;
}
}
} }
/**********************************/
void BASE_SCREEN::SetLastZoom() void BASE_SCREEN::SetLastZoom()
/**********************************/
/* ajuste le coeff de zoom au max
*/
{ {
if( m_ZoomList == NULL ) if( m_ZoomList.IsEmpty() )
return; return;
int ii;
for( ii = 0; m_ZoomList[ii] != 0; ii++ ) m_Zoom = m_ZoomList.Last();
m_Zoom = m_ZoomList[ii];
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
/* Fichier base_struct.cpp */ /* Fichier base_struct.cpp */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "trigo.h" #include "trigo.h"
#include "common.h" #include "common.h"
#include "wxstruct.h" #include "wxstruct.h"
...@@ -272,10 +273,8 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -272,10 +273,8 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
*/ */
{ {
int zoom;
int width; int width;
zoom = aPanel->GetZoom();
width = m_Width; width = m_Width;
if( aDisplayMode == FILAIRE ) if( aDisplayMode == FILAIRE )
width = 0; width = 0;
...@@ -286,7 +285,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -286,7 +285,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
/* Draw text anchor, if allowed */ /* Draw text anchor, if allowed */
if( aAnchor_color != UNSPECIFIED_COLOR ) if( aAnchor_color != UNSPECIFIED_COLOR )
{ {
int anchor_size = 2 * zoom; int anchor_size = aPanel->GetScreen()->Unscale( 2 );
aAnchor_color = (EDA_Colors) (aAnchor_color & MASKCOLOR); aAnchor_color = (EDA_Colors) (aAnchor_color & MASKCOLOR);
int cX = m_Pos.x + aOffset.x; int cX = m_Pos.x + aOffset.x;
......
...@@ -209,6 +209,7 @@ wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId, ...@@ -209,6 +209,7 @@ wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/**************************************************************/ /**************************************************************/
{ {
wxString msg;
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
if( wxGetApp().m_HtmlCtrl == NULL ) if( wxGetApp().m_HtmlCtrl == NULL )
{ {
...@@ -223,19 +224,28 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) ...@@ -223,19 +224,28 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
} }
else else
{ {
wxString msg;
msg.Printf( _( "Help file %s not found" ), wxGetApp().m_HelpFileName.GetData() ); msg.Printf( _( "Help file %s not found" ), wxGetApp().m_HelpFileName.GetData() );
DisplayError( this, msg ); DisplayError( this, msg );
} }
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
wxString fullfilename = FindKicadHelpPath() + wxGetApp().m_HelpFileName; // wxString fullfilename = FindKicadHelpPath() + wxGetApp().m_HelpFileName;
if ( wxFileExists(fullfilename) ) // if ( wxFileExists(fullfilename) )
GetAssociatedDocument( this, wxEmptyString, fullfilename ); // GetAssociatedDocument( this, wxEmptyString, fullfilename );
else // Try to find file in English format: // else // Try to find file in English format:
// {
// fullfilename = FindKicadHelpPath() + wxT("../en/") + wxGetApp().m_HelpFileName;;
// GetAssociatedDocument( this, wxEmptyString, fullfilename );
// }
wxString helpFile = wxGetApp().GetHelpFile();
if( !helpFile )
{ {
fullfilename = FindKicadHelpPath() + wxT("../en/") + wxGetApp().m_HelpFileName;; msg.Printf( _( "Help file %s could not be found." ),
GetAssociatedDocument( this, wxEmptyString, fullfilename ); wxGetApp().m_HelpFileName.c_str() );
DisplayError( this, msg );
} }
else
GetAssociatedDocument( this, wxEmptyString, helpFile );
#else #else
#error Help files format not defined #error Help files format not defined
......
...@@ -110,8 +110,8 @@ void DrawBlockStruct::SetMessageBlock( WinEDA_DrawFrame* frame ) ...@@ -110,8 +110,8 @@ void DrawBlockStruct::SetMessageBlock( WinEDA_DrawFrame* frame )
void DrawBlockStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC ) void DrawBlockStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC )
/**************************************************************/ /**************************************************************/
{ {
int w = GetWidth() / panel->GetZoom(); int w = panel->GetScreen()->Scale( GetWidth() );
int h = GetHeight() / panel->GetZoom(); int h = panel->GetScreen()->Scale( GetHeight() );
if( w == 0 || h == 0 ) if( w == 0 || h == 0 )
GRLine( &panel->m_ClipBox, DC, GetX(), GetY(), GRLine( &panel->m_ClipBox, DC, GetX(), GetY(),
...@@ -133,8 +133,8 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key, ...@@ -133,8 +133,8 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
{ {
DrawBlockStruct* Block = & GetBaseScreen()->BlockLocate; DrawBlockStruct* Block = & GetBaseScreen()->BlockLocate;
if( (Block->m_Command != BLOCK_IDLE) if( ( Block->m_Command != BLOCK_IDLE )
|| ( Block->m_State != STATE_NO_BLOCK) ) || ( Block->m_State != STATE_NO_BLOCK ) )
return FALSE; return FALSE;
Block->m_Flags = 0; Block->m_Flags = 0;
...@@ -177,7 +177,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key, ...@@ -177,7 +177,7 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
{ {
Block->m_BlockDrawStruct = NULL; Block->m_BlockDrawStruct = NULL;
DisplayError( this, DisplayError( this,
wxT( "WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL" ) ); wxT( "WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL" ) );
return TRUE; return TRUE;
} }
Block->m_State = STATE_BLOCK_MOVE; Block->m_State = STATE_BLOCK_MOVE;
......
...@@ -5,21 +5,9 @@ ...@@ -5,21 +5,9 @@
// Created: 18 aug 2006 // Created: 18 aug 2006
// Licence: License GNU // Licence: License GNU
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <ctype.h>
#include "wx/metafile.h" #include "wx/metafile.h"
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "id.h" #include "id.h"
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "macros.h" #include "macros.h"
...@@ -36,32 +37,30 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -36,32 +37,30 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
{ {
wxSize minsize; wxSize minsize;
m_VToolBar = NULL; m_VToolBar = NULL;
m_AuxVToolBar = NULL; m_AuxVToolBar = NULL;
m_OptionsToolBar = NULL; m_OptionsToolBar = NULL;
m_AuxiliaryToolBar = NULL; m_AuxiliaryToolBar = NULL;
m_SelGridBox = NULL; m_SelGridBox = NULL;
m_SelZoomBox = NULL; m_SelZoomBox = NULL;
m_ZoomMaxValue = 128;
DrawPanel = NULL;
DrawPanel = NULL; MsgPanel = NULL;
MsgPanel = NULL; m_CurrentScreen = NULL;
m_CurrentScreen = NULL;
m_ID_current_state = 0; m_ID_current_state = 0;
m_HTOOL_current_state = 0; m_HTOOL_current_state = 0;
m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines
m_Draw_Grid = FALSE; // TRUE pour avoir la axes dessinee m_Draw_Grid = FALSE; // TRUE pour avoir la axes dessinee
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin� m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin�
m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim� m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim�
m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines
m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch
// Internal units per inch // Internal units per inch: = 1000 for schema, = 10000 for PCB
// = 1000 for schema, = 10000 for PCB m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
m_InternalUnits = EESCHEMA_INTERNAL_UNIT; minsize.x = 470;
minsize.y = 350 + m_MsgFrameHeight;
minsize.x = 470;
minsize.y = 350 + m_MsgFrameHeight;
SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 ); SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );
/* Verification des parametres de creation */ /* Verification des parametres de creation */
...@@ -267,42 +266,37 @@ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) ...@@ -267,42 +266,37 @@ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
} }
/********************************************************/ /**
void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event ) // fonction virtuelle * Set the zoom when selected by the Zoom List Box
/********************************************************/
/* Set the zoom when selected by the Zoom List Box
* Note: * Note:
* position 0 = Fit in Page * position 0 = Fit in Page
* position >= 1 = zoom (1 to zoom max) * position >= 1 = zoom (1 to zoom max)
* last position : special zoom * last position : special zoom
* virtual function
*/ */
void WinEDA_DrawFrame::OnSelectZoom( wxCommandEvent& event )
{ {
if( m_SelZoomBox == NULL ) if( m_SelZoomBox == NULL )
return; //Ne devrait pas se produire! return; //Ne devrait pas se produire!
int id = m_SelZoomBox->GetChoice(); int id = m_SelZoomBox->GetChoice();
if( id < 0 ) if( id < 0 || !( id < (int)m_SelZoomBox->GetCount() ) )
return; // No selection return;
if( id == 0 ) // Auto zoom (Fit in Page) if( id == 0 ) // Auto zoom (Fit in Page)
{ {
Zoom_Automatique( TRUE ); Zoom_Automatique( true );
} }
else if( id == (int) (m_SelZoomBox->GetCount() - 1) ) // Dummy position: unlisted zoom else
return;
else // zooml 1 to zoom max
{ {
id--; id--;
int zoom = 1 << id; int selectedZoom = GetBaseScreen()->m_ZoomList[id];
if( zoom > m_ZoomMaxValue ) if( GetBaseScreen()->GetZoom() == selectedZoom )
zoom = m_ZoomMaxValue;
if( GetBaseScreen()->GetZoom() == zoom )
return; return;
GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); GetBaseScreen()->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
GetBaseScreen()->SetZoom( zoom ); GetBaseScreen()->SetZoom( selectedZoom );
Recadre_Trace( FALSE ); Recadre_Trace( false );
} }
} }
...@@ -569,14 +563,11 @@ int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC ) ...@@ -569,14 +563,11 @@ int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC )
void WinEDA_DrawFrame::AdjustScrollBars() void WinEDA_DrawFrame::AdjustScrollBars()
/*********************************************/ /*********************************************/
{ {
int xUnit, yUnit;
wxSize draw_size, panel_size; wxSize draw_size, panel_size;
wxSize scrollbar_number; wxSize scrollbar_number;
wxPoint scrollbar_pos; wxPoint scrollbar_pos;
BASE_SCREEN* screen = GetBaseScreen();
BASE_SCREEN* screen = GetBaseScreen();
int zoom = screen->GetZoom();
int xUnit, yUnit;
if( screen == NULL || DrawPanel == NULL ) if( screen == NULL || DrawPanel == NULL )
return; return;
...@@ -586,7 +577,8 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -586,7 +577,8 @@ void WinEDA_DrawFrame::AdjustScrollBars()
// On utilise le centre de l'ecran comme position de reference, donc // On utilise le centre de l'ecran comme position de reference, donc
// la surface de trace doit etre augmentee // la surface de trace doit etre augmentee
panel_size = DrawPanel->GetClientSize() * zoom; panel_size = DrawPanel->GetClientSize();
screen->Unscale( panel_size );
draw_size += panel_size / 2; draw_size += panel_size / 2;
...@@ -606,20 +598,18 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -606,20 +598,18 @@ void WinEDA_DrawFrame::AdjustScrollBars()
screen->m_DrawOrg.y -= screen->m_DrawOrg.y % 256; screen->m_DrawOrg.y -= screen->m_DrawOrg.y % 256;
// Calcul du nombre de scrolls (en unites de scrool ) // Calcul du nombre de scrolls (en unites de scrool )
scrollbar_number = draw_size / (DrawPanel->m_Scroll_unit * zoom); scrollbar_number = draw_size / screen->Unscale( screen->m_ZoomScalar );
xUnit = yUnit = screen->m_ZoomScalar;
xUnit = yUnit = DrawPanel->m_Scroll_unit;
if( xUnit <= 1 ) if( xUnit <= 1 )
xUnit = 1; xUnit = 1;
if( yUnit <= 1 ) if( yUnit <= 1 )
yUnit = 1; yUnit = 1;
xUnit *= zoom; xUnit = screen->Unscale( xUnit );
yUnit *= zoom; yUnit = screen->Unscale( yUnit );
// Calcul de la position, curseur place au centre d'ecran // Calcul de la position, curseur place au centre d'ecran
scrollbar_pos = screen->m_Curseur; scrollbar_pos = screen->m_Curseur - screen->m_DrawOrg;
scrollbar_pos -= screen->m_DrawOrg;
scrollbar_pos.x -= panel_size.x / 2; scrollbar_pos.x -= panel_size.x / 2;
scrollbar_pos.y -= panel_size.y / 2; scrollbar_pos.y -= panel_size.y / 2;
...@@ -634,8 +624,8 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -634,8 +624,8 @@ void WinEDA_DrawFrame::AdjustScrollBars()
screen->m_ScrollbarPos = scrollbar_pos; screen->m_ScrollbarPos = scrollbar_pos;
screen->m_ScrollbarNumber = scrollbar_number; screen->m_ScrollbarNumber = scrollbar_number;
DrawPanel->SetScrollbars( DrawPanel->m_Scroll_unit, DrawPanel->SetScrollbars( screen->m_ZoomScalar,
DrawPanel->m_Scroll_unit, screen->m_ZoomScalar,
screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.x,
screen->m_ScrollbarNumber.y, screen->m_ScrollbarNumber.y,
screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.x,
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* drawpanel.cpp - WinEDA_DrawPanel class */ /* drawpanel.cpp - WinEDA_DrawPanel class */
/******************************************/ /******************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h" #include "macros.h"
...@@ -48,7 +49,6 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, ...@@ -48,7 +49,6 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE ) wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE )
{ {
m_Parent = parent; m_Parent = parent;
m_Scroll_unit = 1;
m_ScrollButt_unit = 40; m_ScrollButt_unit = 40;
SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
...@@ -89,13 +89,12 @@ BASE_SCREEN* WinEDA_DrawPanel::GetScreen() ...@@ -89,13 +89,12 @@ BASE_SCREEN* WinEDA_DrawPanel::GetScreen()
} }
/*********************************************************************************/ /*****************************************************************************
void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color ) *
/*********************************************************************************/
/*
* Draw the schematic cursor which is usually on grid * Draw the schematic cursor which is usually on grid
*/ *
*****************************************************************************/
void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
{ {
if( m_CursorLevel != 0 || DC == NULL ) if( m_CursorLevel != 0 || DC == NULL )
return; return;
...@@ -105,9 +104,8 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color ) ...@@ -105,9 +104,8 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
GRSetDrawMode( DC, GR_XOR ); GRSetDrawMode( DC, GR_XOR );
if( g_CursorShape == 1 ) /* Trace d'un reticule */ if( g_CursorShape == 1 ) /* Trace d'un reticule */
{ {
int dx = m_ClipBox.GetWidth() * GetZoom(); int dx = GetScreen()->Unscale( m_ClipBox.GetWidth() );
int dy = GetScreen()->Unscale( m_ClipBox.GetHeight() );
int dy = m_ClipBox.GetHeight() * GetZoom();
GRLine( &m_ClipBox, DC, Cursor.x - dx, Cursor.y, GRLine( &m_ClipBox, DC, Cursor.x - dx, Cursor.y,
Cursor.x + dx, Cursor.y, 0, color ); // axe Y Cursor.x + dx, Cursor.y, 0, color ); // axe Y
...@@ -116,7 +114,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color ) ...@@ -116,7 +114,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
} }
else else
{ {
int len = CURSOR_SIZE * GetZoom(); int len = GetScreen()->Unscale( CURSOR_SIZE );
GRLine( &m_ClipBox, DC, Cursor.x - len, Cursor.y, GRLine( &m_ClipBox, DC, Cursor.x - len, Cursor.y,
Cursor.x + len, Cursor.y, 0, color ); Cursor.x + len, Cursor.y, 0, color );
...@@ -186,11 +184,9 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC ) ...@@ -186,11 +184,9 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC )
GRResetPenAndBrush( DC ); GRResetPenAndBrush( DC );
DC->SetBackgroundMode( wxTRANSPARENT ); DC->SetBackgroundMode( wxTRANSPARENT );
#ifdef WX_ZOOM #ifdef WX_ZOOM
int zoom = GetZoom(); double scale = 1.0 / (double) GetZoom();
double f_scale = 1.0 / (double) zoom; DC->SetUserScale( scale, scale );
DoPrepareDC( *DC );
DC->SetUserScale( f_scale, f_scale );
PrepareDC( *DC );
#endif #endif
SetBoundaryBox(); SetBoundaryBox();
} }
...@@ -233,16 +229,10 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos ) ...@@ -233,16 +229,10 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
// Conversion en coord physiques // Conversion en coord physiques
pos = CalcUnscrolledPosition( display_rect.GetPosition() ); pos = CalcUnscrolledPosition( display_rect.GetPosition() );
pos.x *= GetZoom(); GetScreen()->Unscale( pos );
pos.y *= GetZoom();
pos += GetScreen()->m_DrawOrg; pos += GetScreen()->m_DrawOrg;
display_rect.m_Pos = pos;
display_rect.SetX( pos.x ); GetScreen()->Unscale( display_rect.m_Size );
display_rect.SetY( pos.y );
display_rect.SetWidth( display_rect.GetWidth() * GetZoom() );
display_rect.SetHeight( display_rect.GetHeight() * GetZoom() );
return display_rect.Inside( ref_pos ); return display_rect.Inside( ref_pos );
} }
...@@ -277,11 +267,8 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect ) ...@@ -277,11 +267,8 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect )
wxPoint pos = aRect->GetPosition(); wxPoint pos = aRect->GetPosition();
ConvertPcbUnitsToPixelsUnits( &pos ); ConvertPcbUnitsToPixelsUnits( &pos );
aRect->SetOrigin( pos ); // rect origin in pixel units aRect->SetOrigin( pos ); // rect origin in pixel units
GetScreen()->Scale( aRect->m_Size );
aRect->m_Size.x /= GetZoom();
aRect->m_Size.y /= GetZoom(); // size in pixel units
} }
...@@ -302,8 +289,7 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition ) ...@@ -302,8 +289,7 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition )
drwOrig.y *= y_axis_scale; drwOrig.y *= y_axis_scale;
// Origin in internal units // Origin in internal units
drwOrig.x *= GetZoom(); GetScreen()->Unscale( drwOrig );
drwOrig.y *= GetZoom();
// Real origin, according to the "plot" origin // Real origin, according to the "plot" origin
drwOrig += GetScreen()->m_DrawOrg; drwOrig += GetScreen()->m_DrawOrg;
...@@ -312,8 +298,7 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition ) ...@@ -312,8 +298,7 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition )
*aPosition -= drwOrig; *aPosition -= drwOrig;
// position in pixels, relative to the visible draw area origin // position in pixels, relative to the visible draw area origin
aPosition->x /= GetZoom(); GetScreen()->Scale( *aPosition );
aPosition->y /= GetZoom();
} }
...@@ -325,14 +310,10 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition() ...@@ -325,14 +310,10 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition()
* @return the curseur position in pixels in the panel draw area on screen ) * @return the curseur position in pixels in the panel draw area on screen )
*/ */
{ {
wxPoint curpos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
pos -= GetScreen()->m_DrawOrg;
curpos -= GetScreen()->m_DrawOrg; GetScreen()->Scale( pos );
return pos;
curpos.x /= GetZoom();
curpos.y /= GetZoom();
return curpos;
} }
...@@ -350,9 +331,7 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void ) ...@@ -350,9 +331,7 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void )
size = GetClientSize() / 2; size = GetClientSize() / 2;
realpos = CalcUnscrolledPosition( wxPoint( size.x, size.y ) ); realpos = CalcUnscrolledPosition( wxPoint( size.x, size.y ) );
realpos.x *= GetZoom(); GetScreen()->Unscale( realpos );
realpos.y *= GetZoom();
realpos += GetScreen()->m_DrawOrg; realpos += GetScreen()->m_DrawOrg;
return realpos; return realpos;
...@@ -381,7 +360,6 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse ) ...@@ -381,7 +360,6 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
*/ */
{ {
wxPoint mouse; wxPoint mouse;
#ifdef WX_ZOOM #ifdef WX_ZOOM
CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y ); CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y );
#else #else
...@@ -483,9 +461,7 @@ void WinEDA_DrawPanel::SetBoundaryBox() ...@@ -483,9 +461,7 @@ void WinEDA_DrawPanel::SetBoundaryBox()
wxPoint org; wxPoint org;
int ii, jj; int ii, jj;
Screen->m_SizeVisu = GetClientSize();
GetViewStart( &org.x, &org.y ); GetViewStart( &org.x, &org.y );
GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj );
org.x *= ii; org.x *= ii;
org.y *= jj; org.y *= jj;
...@@ -496,9 +472,8 @@ void WinEDA_DrawPanel::SetBoundaryBox() ...@@ -496,9 +472,8 @@ void WinEDA_DrawPanel::SetBoundaryBox()
m_ClipBox.SetSize( GetClientSize() ); m_ClipBox.SetSize( GetClientSize() );
#ifdef WX_ZOOM #ifdef WX_ZOOM
m_ClipBox.m_Pos.x *= GetZoom(); CalcUnscrolledPosition( m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y,
m_ClipBox.m_Pos.y *= GetZoom(); &m_ClipBox.m_Pos.x, &m_ClipBox.m_Pos.y );
m_ClipBox.m_Size *= GetZoom();
#else #else
m_ClipBox.m_Pos -= GetScreen()->m_StartVisu; m_ClipBox.m_Pos -= GetScreen()->m_StartVisu;
#endif #endif
...@@ -569,14 +544,12 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event ) ...@@ -569,14 +544,12 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
); );
#endif #endif
PaintClipBox.x += org.x; PaintClipBox.Offset( org );
PaintClipBox.y += org.y;
#ifdef WX_ZOOM #ifdef WX_ZOOM
m_ClipBox.m_Pos.x = PaintClipBox.x * GetZoom(); BASE_SCREEN* screen = GetScreen();
m_ClipBox.m_Pos.y = PaintClipBox.y * GetZoom(); screen->Unscale( m_ClipBox.m_Pos );
m_ClipBox.m_Size.x = PaintClipBox.width * GetZoom(); screen->Unscale( m_ClipBox.m_Size );
m_ClipBox.m_Size.y = PaintClipBox.height * GetZoom();
#else #else
m_ClipBox.SetX( PaintClipBox.GetX() ); m_ClipBox.SetX( PaintClipBox.GetX() );
m_ClipBox.SetY( PaintClipBox.GetY() ); m_ClipBox.SetY( PaintClipBox.GetY() );
...@@ -636,9 +609,8 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg ) ...@@ -636,9 +609,8 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
} }
#ifdef WX_ZOOM #ifdef WX_ZOOM
int zoom = GetZoom(); double scale = 1.0 / (double) GetZoom();
double f_scale = 1.0 / (double) zoom; DC->SetUserScale( scale, scale );
DC->SetUserScale( f_scale, f_scale );
#endif #endif
if( erasebg ) if( erasebg )
...@@ -675,7 +647,6 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -675,7 +647,6 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
int ii, jj, xg, yg, color; int ii, jj, xg, yg, color;
wxSize pas_grille_affichee; wxSize pas_grille_affichee;
bool drawgrid = FALSE; bool drawgrid = FALSE;
int zoom = GetZoom();
wxSize size; wxSize size;
wxPoint org; wxPoint org;
double pasx, pasy; double pasx, pasy;
...@@ -691,7 +662,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -691,7 +662,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
pas_grille_affichee = screen->GetGrid(); pas_grille_affichee = screen->GetGrid();
ii = pas_grille_affichee.x / zoom; ii = screen->Scale( pas_grille_affichee.x );
if( ii < 5 ) if( ii < 5 )
{ {
pas_grille_affichee.x *= 2; pas_grille_affichee.x *= 2;
...@@ -700,7 +671,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -700,7 +671,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
if( ii < 5 ) if( ii < 5 )
drawgrid = FALSE; // The gris is small drawgrid = FALSE; // The gris is small
ii = pas_grille_affichee.y / zoom; ii = screen->Scale( pas_grille_affichee.y );
if( ii < 5 ) if( ii < 5 )
{ {
pas_grille_affichee.y *= 2; pas_grille_affichee.y *= 2;
...@@ -711,18 +682,18 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -711,18 +682,18 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
GetViewStart( &org.x, &org.y ); GetViewStart( &org.x, &org.y );
GetScrollPixelsPerUnit( &ii, &jj ); GetScrollPixelsPerUnit( &ii, &jj );
wxLogDebug( _T( "View start: %d, %d, scroll bar PPI: %d, %d" ),
org.x, org.y, ii, jj );
org.x *= ii; org.x *= ii;
org.y *= jj; org.y *= jj;
screen->m_StartVisu = org; screen->m_StartVisu = org;
wxLogDebug( _T( "Scroll bar drawing position: %d. %d" ), org.x, org.y );
org.x *= zoom; screen->Unscale( org );
org.y *= zoom;
org += screen->m_DrawOrg; org += screen->m_DrawOrg;
size = GetClientSize() * zoom; size = GetClientSize();
screen->Unscale( size );
pasx = screen->m_Grid.x * m_Parent->m_InternalUnits; pasx = screen->m_Grid.x * m_Parent->m_InternalUnits;
pasy = screen->m_Grid.y * m_Parent->m_InternalUnits; pasy = screen->m_Grid.y * m_Parent->m_InternalUnits;
...@@ -1139,8 +1110,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) ...@@ -1139,8 +1110,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
*/ */
#define BLOCK_MINSIZE_LIMIT 1 #define BLOCK_MINSIZE_LIMIT 1
bool BlockIsSmall = bool BlockIsSmall =
( ABS( screen->BlockLocate.GetWidth() / GetZoom() ) < BLOCK_MINSIZE_LIMIT) ( ABS( screen->Scale( screen->BlockLocate.GetWidth() ) ) < BLOCK_MINSIZE_LIMIT)
&& ( ABS( screen->BlockLocate.GetHeight() / GetZoom() ) < BLOCK_MINSIZE_LIMIT); && ( ABS( screen->Scale( screen->BlockLocate.GetHeight() ) ) < BLOCK_MINSIZE_LIMIT);
if( (screen->BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall ) if( (screen->BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall )
{ {
......
...@@ -51,7 +51,6 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC, ...@@ -51,7 +51,6 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
{ {
int ii, kk, char_count, AsciiCode, endcar; int ii, kk, char_count, AsciiCode, endcar;
int x0, y0; int x0, y0;
int zoom;
int size_h, size_v, pitch; int size_h, size_v, pitch;
SH_CODE f_cod, plume = 'U'; SH_CODE f_cod, plume = 'U';
const SH_CODE* ptcar; const SH_CODE* ptcar;
...@@ -63,11 +62,6 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC, ...@@ -63,11 +62,6 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
bool sketch_mode = false; bool sketch_mode = false;
bool italic_reverse = false; // true for mirrored texts with m_Size.x < 0 bool italic_reverse = false; // true for mirrored texts with m_Size.x < 0
if ( aPanel )
zoom = aPanel->GetZoom();
else
zoom = 1;
size_h = aSize.x; size_h = aSize.x;
size_v = aSize.y; size_v = aSize.y;
...@@ -101,7 +95,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC, ...@@ -101,7 +95,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
{ {
int xm, ym, ll, xc, yc; int xm, ym, ll, xc, yc;
int textsize = ABS( pitch ); int textsize = ABS( pitch );
ll = (textsize * char_count) / zoom; ll = aPanel->GetScreen()->Scale( textsize * char_count );
xc = GRMapX( cX ); xc = GRMapX( cX );
yc = GRMapY( cY ); yc = GRMapY( cY );
...@@ -195,10 +189,10 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC, ...@@ -195,10 +189,10 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
ox = cX - dx; ox = cX - dx;
oy = cY + dy; oy = cY + dy;
if( (aSize.x / zoom) == 0 ) if( aPanel->GetScreen()->Scale( aSize.x ) == 0 )
return; return;
if( ABS( (aSize.x / zoom) ) < 3 ) /* shapes are too small: connot be drawn */ if( ABS( (aPanel->GetScreen()->Scale( aSize.x ) ) ) < 3 ) /* shapes are too small: connot be drawn */
{ /* insteed the text is drawn as a line */ { /* insteed the text is drawn as a line */
dx = (pitch * char_count) / 2; dx = (pitch * char_count) / 2;
dy = size_v / 2; /* line is always centered */ dy = size_v / 2; /* line is always centered */
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "wx/html/htmlwin.h" #include "wx/html/htmlwin.h"
#include "wx/fs_zip.h" #include "wx/fs_zip.h"
#include <wx/dir.h> #include <wx/dir.h>
...@@ -221,8 +222,8 @@ WinEDA_App::WinEDA_App() ...@@ -221,8 +222,8 @@ WinEDA_App::WinEDA_App()
m_EDA_Config = NULL; m_EDA_Config = NULL;
m_Env_Defined = FALSE; m_Env_Defined = FALSE;
m_LanguageId = wxLANGUAGE_DEFAULT; m_LanguageId = wxLANGUAGE_DEFAULT;
m_Locale = NULL;
m_PdfBrowserIsDefault = TRUE; m_PdfBrowserIsDefault = TRUE;
m_Locale = NULL;
} }
...@@ -317,6 +318,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) ...@@ -317,6 +318,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
// Analyse the command line & init binary path // Analyse the command line & init binary path
SetBinDir(); SetBinDir();
SetDefaultSearchPaths(); SetDefaultSearchPaths();
SetLanguagePath();
ReadPdfBrowserInfos(); ReadPdfBrowserInfos();
// Internationalisation: loading the kicad suitable Dictionnary // Internationalisation: loading the kicad suitable Dictionnary
...@@ -441,6 +443,10 @@ bool WinEDA_App::SetBinDir() ...@@ -441,6 +443,10 @@ bool WinEDA_App::SetBinDir()
while( m_BinDir.Last() != '/' ) while( m_BinDir.Last() != '/' )
m_BinDir.RemoveLast(); m_BinDir.RemoveLast();
wxFileName pfn( wxT( "/posix/path/specification" ), wxT( "filename" ) );
wxFileName wfn( wxT( "\\windows\\path\\specification" ), wxT( "filename" ) );
wxLogDebug( wxT( "Posix path: " ) + pfn.GetFullPath() );
wxLogDebug( wxT( "Windows path: " ) + wfn.GetFullPath() );
wxLogDebug( wxT( "Executable path the Kicad way: " ) + m_BinDir ); wxLogDebug( wxT( "Executable path the Kicad way: " ) + m_BinDir );
wxLogDebug( wxT( "Executable path the wxWidgets way: " ) + wxLogDebug( wxT( "Executable path the wxWidgets way: " ) +
GetTraits()->GetStandardPaths().GetExecutablePath() ); GetTraits()->GetStandardPaths().GetExecutablePath() );
...@@ -457,24 +463,22 @@ void WinEDA_App::SetDefaultSearchPaths( void ) ...@@ -457,24 +463,22 @@ void WinEDA_App::SetDefaultSearchPaths( void )
wxString path; wxString path;
wxFileName fn( m_BinDir, wxEmptyString ); wxFileName fn( m_BinDir, wxEmptyString );
/* User environment variable path. */ /* User environment variable path is the first search path. Chances are
if( ::wxGetEnv( wxT( "KICAD_SEARCH_PATH" ), NULL ) ) * if the user is savvy enough to set an environment variable they know
m_searchPaths.AddEnvList( wxT( "KICAD_SEARCH_PATH" ) ); * what they are doing. */
if( ::wxGetEnv( wxT( "KICAD" ), NULL ) )
m_searchPaths.AddEnvList( wxT( "KICAD" ) );
/* Hard coded path defined by the application. */ /* Add the user's home path. */
m_searchPaths.Add( ReturnKicadDatasPath() ); m_searchPaths.Add( GetTraits()->GetStandardPaths().GetUserDataDir() );
/* Standard application data path if it is different from the binary /* Standard application data path if it is different from the binary
* path. */ * path. */
if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() ) if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() )
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() ); m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
/* Up on level relative to binary path with "share" appended. */ /* Up on level relative to binary path with "share" appended for Windows. */
fn.RemoveLastDir(); fn.RemoveLastDir();
fn.AppendDir( wxT( "share" ) );
#ifndef __WXMSW__
fn.AppendDir( wxT( "kicad" ) );
#endif
m_searchPaths.Add( fn.GetPath() ); m_searchPaths.Add( fn.GetPath() );
/* Remove all non-existant paths from the list. */ /* Remove all non-existant paths from the list. */
...@@ -657,38 +661,23 @@ void WinEDA_App::SaveSettings() ...@@ -657,38 +661,23 @@ void WinEDA_App::SaveSettings()
bool WinEDA_App::SetLanguage( bool first_time ) bool WinEDA_App::SetLanguage( bool first_time )
/*********************************************/ /*********************************************/
{ {
size_t i;
wxString path;
bool retv = true; bool retv = true;
// dictionary file name without extend (full name is kicad.mo) // dictionary file name without extend (full name is kicad.mo)
wxString DictionaryName( wxT( "kicad" ) ); wxString DictionaryName( wxT( "kicad" ) );
if( m_Locale != NULL ) if( m_Locale )
delete m_Locale; delete m_Locale;
m_Locale = new wxLocale(); m_Locale = new wxLocale;
/* Add defined search paths to locale paths */
if( !m_searchPaths.IsEmpty() )
{
for( i = 0; i < m_searchPaths.GetCount(); i++ )
{
wxFileName fn( m_searchPaths[i], wxEmptyString );
fn.AppendDir( wxT( "internat" ) );
path = fn.GetPath();
wxLogDebug( wxT( "Adding locale lookup path: " ) + path );
m_Locale->AddCatalogLookupPathPrefix( path );
}
}
if( !m_Locale->Init( m_LanguageId, wxLOCALE_CONV_ENCODING ) ) if( !m_Locale->Init( m_LanguageId, wxLOCALE_CONV_ENCODING ) )
{ {
wxLogDebug( wxT( "Failed to initialize " ) + wxLogDebug( wxT( "Failed to initialize " ) +
wxLocale::GetLanguageInfo( m_LanguageId )->Description ); wxLocale::GetLanguageInfo( m_LanguageId )->Description );
delete m_Locale;
m_Locale = new wxLocale();
m_LanguageId = wxLANGUAGE_DEFAULT; m_LanguageId = wxLANGUAGE_DEFAULT;
delete m_Locale;
m_Locale = new wxLocale;
m_Locale->Init(); m_Locale->Init();
retv = false; retv = false;
} }
...@@ -732,6 +721,35 @@ void WinEDA_App::SetLanguageIdentifier( int menu_id ) ...@@ -732,6 +721,35 @@ void WinEDA_App::SetLanguageIdentifier( int menu_id )
} }
void WinEDA_App::SetLanguagePath( void )
{
size_t i;
/* Add defined search paths to locale paths */
if( !m_searchPaths.IsEmpty() )
{
for( i = 0; i < m_searchPaths.GetCount(); i++ )
{
wxFileName fn( m_searchPaths[i], wxEmptyString );
fn.AppendDir( wxT( "share" ) );
#ifndef __WXMSW__
/* Up on level relative to binary path with "share/kicad" appended
* for all other platforms. */
fn.AppendDir( wxT( "kicad" ) );
#endif
fn.AppendDir( wxT( "internat" ) );
if( fn.DirExists() )
{
wxLogDebug( wxT( "Adding locale lookup path: " ) +
fn.GetPath() );
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
}
}
}
}
/** Function AddMenuLanguageList /** Function AddMenuLanguageList
* Create menu list for language choice, and add it as submenu to a main menu * Create menu list for language choice, and add it as submenu to a main menu
* @param MasterMenu : The main menu. The sub menu list will be accessible from the menu item with id ID_LANGUAGE_CHOICE * @param MasterMenu : The main menu. The sub menu list will be accessible from the menu item with id ID_LANGUAGE_CHOICE
...@@ -782,6 +800,93 @@ void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu ) ...@@ -782,6 +800,93 @@ void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu )
} }
/**
* Look in search paths for requested file.
*
*/
wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename,
const wxArrayString* subdirs )
{
size_t i, j;
wxFileName fn;
wxPathList paths;
for( i = 0; i < m_searchPaths.GetCount(); i++ )
{
fn = wxFileName( m_searchPaths[i], wxEmptyString );
if( subdirs )
{
for( j = 0; j < subdirs->GetCount(); j++ )
fn.AppendDir( subdirs->Item( j ) );
}
if( fn.DirExists() )
{
wxLogDebug( _T( "Adding <" ) + fn.GetPath() + _T( "> to " ) +
_T( "file \"" ) + filename + _T( "\" search path." ) );
paths.Add( fn.GetPath() );
}
}
return paths.FindValidPath( filename );
}
/**
* Get the help file path.
*
* Return the Kicad help file with path. The base paths defined in
* m_searchPaths are tested for a valid file. The path returned can
* be relative depending on the paths added to m_searchPaths. See the
* documentation for wxPathList for more information. If the help file
* for the current locale is not found, an attempt to find the English
* version of the help file is made. wxEmptyString is returned if the
* help file is not found.
*/
wxString WinEDA_App::GetHelpFile( void )
{
wxString fn;
wxArrayString subdirs;
/* FIXME: This is not the ideal way to handle this. Unfortunely, the
* CMake install paths seem to be a moving target so this crude
* hack solve the problem of install path differences between
* Windows and non-Windows platforms. */
#ifndef __WXMSW__
subdirs.Add( wxT( "share" ) );
#endif
subdirs.Add( _T( "doc" ) );
#ifndef __WXMSW__
subdirs.Add( wxT( "kicad" ) );
#endif
subdirs.Add( _T( "help" ) );
subdirs.Add( m_Locale->GetCanonicalName() );
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
if( !fn && m_Locale->GetCanonicalName() != wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH )->CanonicalName )
{
subdirs.RemoveAt( subdirs.GetCount() - 1 );
subdirs.Add( _T( "en" ) );
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
}
return fn;
}
wxString WinEDA_App::GetLibraryFile( const wxString& filename )
{
wxArrayString subdirs;
subdirs.Add( wxT( "share" ) );
#ifndef __WXMSW__
/* Up on level relative to binary path with "share/kicad" appended for
* all other platforms. */
subdirs.Add( wxT( "kicad" ) );
#endif
return FindFileInSearchPaths( filename, &subdirs );
}
/** /**
* Run init scripts * Run init scripts
* @return the defualt OnRun() value (exit codes not used in kicad, so value has no special mening) * @return the defualt OnRun() value (exit codes not used in kicad, so value has no special mening)
......
...@@ -18,21 +18,21 @@ ...@@ -18,21 +18,21 @@
extern BASE_SCREEN* ActiveScreen; extern BASE_SCREEN* ActiveScreen;
/* Variables locales */ /* Variables locales */
static int GRLastMoveToX, GRLastMoveToY; static int GRLastMoveToX, GRLastMoveToY;
static int Text_Color = LIGHTGRAY; static int Text_Color = LIGHTGRAY;
static int PenMinWidth = 1;/* largeur minimum de la plume (DOIT etre > 0) static int PenMinWidth = 1; /* largeur minimum de la plume (DOIT etre > 0)
* (utile pour trace sur imprimante) */ * (utile pour trace sur imprimante) */
static int ForceBlackPen;/* si != 0 : traces en noir (utilise pour trace static int ForceBlackPen; /* si != 0 : traces en noir (utilise pour trace
* sur imprimante */ * sur imprimante */
static int xcliplo = 0, static int xcliplo = 0,
ycliplo = 0, ycliplo = 0,
xcliphi = 2000, xcliphi = 2000,
ycliphi = 2000;/* coord de la surface de trace */ ycliphi = 2000; /* coord de la surface de trace */
static int lastcolor = -1; static int lastcolor = -1;
static int lastwidth = -1; static int lastwidth = -1;
static int s_Last_Pen_Style = -1; static int s_Last_Pen_Style = -1;
static wxDC* lastDC = NULL; static wxDC* lastDC = NULL;
/* /*
* Macro de clipping du trace d'une ligne: * Macro de clipping du trace d'une ligne:
...@@ -47,27 +47,18 @@ static wxDC* lastDC = NULL; ...@@ -47,27 +47,18 @@ static wxDC* lastDC = NULL;
static inline int USCALE( us arg, us num, us den ) static inline int USCALE( us arg, us num, us den )
{ {
#ifndef WX_ZOOM
int ii; int ii;
ii = (int) ( ( (float) arg * num ) / den ); ii = (int) ( ( (float) arg * num ) / den );
return ii; return ii;
}
#ifdef WX_ZOOM
#define GET_ZOOM 1
#else #else
#define GET_ZOOM ActiveScreen->GetZoom() return arg;
#endif #endif
}
static int inline ZoomValue( int value_to_zoom ) { static int inline ZoomValue( int val )
int zoom = GET_ZOOM; {
if( !zoom ) return 0; return ActiveScreen->Scale( val );
if( value_to_zoom >= 0 )
return ( value_to_zoom + (zoom >> 1 ) ) / zoom;
else
return ( value_to_zoom - (zoom >> 1 ) ) / zoom;
} }
/****************************************/ /****************************************/
...@@ -75,27 +66,27 @@ static int inline ZoomValue( int value_to_zoom ) { ...@@ -75,27 +66,27 @@ static int inline ZoomValue( int value_to_zoom ) {
/****************************************/ /****************************************/
int GRMapX( int x ) int GRMapX( int x )
{ {
int coord = x - ActiveScreen->m_DrawOrg.x;
#ifndef WX_ZOOM #ifndef WX_ZOOM
int coord = x - ActiveScreen->m_DrawOrg.x;
coord = ZoomValue( coord ); coord = ZoomValue( coord );
coord -= ActiveScreen->m_StartVisu.x; coord -= ActiveScreen->m_StartVisu.x;
#endif
return coord; return coord;
#else
return x;
#endif
} }
int GRMapY( int y ) int GRMapY( int y )
{ {
int coord = y - ActiveScreen->m_DrawOrg.y;
#ifndef WX_ZOOM #ifndef WX_ZOOM
int coord = y - ActiveScreen->m_DrawOrg.y;
coord = ZoomValue( coord ); coord = ZoomValue( coord );
coord -= ActiveScreen->m_StartVisu.y; coord -= ActiveScreen->m_StartVisu.y;
#endif
return coord; return coord;
#else
return y;
#endif
} }
......
...@@ -30,9 +30,7 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse ) ...@@ -30,9 +30,7 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse )
*/ */
{ {
PutOnGrid( &(GetBaseScreen()->m_Curseur) ); PutOnGrid( &(GetBaseScreen()->m_Curseur) );
AdjustScrollBars(); AdjustScrollBars();
ReDrawPanel(); ReDrawPanel();
/* Move the mouse cursor to the on grid graphic cursor position */ /* Move the mouse cursor to the on grid graphic cursor position */
...@@ -69,10 +67,7 @@ void WinEDA_DrawFrame::Zoom_Automatique( bool move_mouse_cursor ) ...@@ -69,10 +67,7 @@ void WinEDA_DrawFrame::Zoom_Automatique( bool move_mouse_cursor )
/** Redraw the screen with the zoom level which shows all the page or the board /** Redraw the screen with the zoom level which shows all the page or the board
*/ */
{ {
int bestzoom; GetBaseScreen()->SetZoom( BestZoom() );
bestzoom = BestZoom();
GetBaseScreen()->SetZoom( bestzoom );
Recadre_Trace( move_mouse_cursor ); Recadre_Trace( move_mouse_cursor );
} }
...@@ -100,8 +95,7 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect ) ...@@ -100,8 +95,7 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect )
if( bestzoom <= 0 ) if( bestzoom <= 0 )
bestzoom = 1; bestzoom = 1;
GetBaseScreen()->SetZoom( bestzoom ); GetBaseScreen()->SetZoom( bestzoom * GetBaseScreen()->m_ZoomScalar );
GetBaseScreen()->m_Curseur = Rect.Centre(); GetBaseScreen()->m_Curseur = Rect.Centre();
Recadre_Trace( TRUE ); Recadre_Trace( TRUE );
} }
...@@ -112,13 +106,14 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event ) ...@@ -112,13 +106,14 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
{ {
if( DrawPanel == NULL ) if( DrawPanel == NULL )
{ {
wxLogDebug( wxT( "No DrawPanel object definedin " \ wxLogDebug( wxT( "No DrawPanel object defined in " \
"WinEDA_DrawFrame::OnZoom()." ) ); "WinEDA_DrawFrame::OnZoom()." ) );
return; return;
} }
bool zoom_at_cursor = false; int i;
int id = event.GetId(); int id = event.GetId();
bool zoom_at_cursor = false;
BASE_SCREEN* screen = GetBaseScreen(); BASE_SCREEN* screen = GetBaseScreen();
switch( id ) switch( id )
...@@ -164,69 +159,22 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event ) ...@@ -164,69 +159,22 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_ZOOM_LEVEL_1: default:
screen->SetZoom( 1 ); i = id - ID_POPUP_ZOOM_LEVEL_START;
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_2:
screen->SetZoom( 2 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_4:
screen->SetZoom( 4 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_8:
screen->SetZoom( 8 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_16:
screen->SetZoom( 16 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_32:
screen->SetZoom( 32 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_64:
screen->SetZoom( 64 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_128:
screen->SetZoom( 128 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_256:
screen->SetZoom( 256 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_512:
screen->SetZoom( 512 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_1024:
screen->SetZoom( 1024 );
Recadre_Trace( true );
break;
case ID_POPUP_ZOOM_LEVEL_2048: if( i < 0 )
screen->SetZoom( 2048 ); {
wxLogDebug( wxT( "WinEDA_DrawFram::OnZoom() invalid ID %d" ), id );
return;
}
if( !( (size_t) i < screen->m_ZoomList.GetCount()) )
{
wxLogDebug( _T( "Requested index %d is outside the bounds of " \
"the zoom list." ), i );
return;
}
screen->SetZoom( screen->m_ZoomList[i] );
Recadre_Trace( true ); Recadre_Trace( true );
break;
default:
wxLogDebug( wxT( "WinEDA_DrawFram::OnZoom() unhandled ID %d" ), id );
return;
} }
Affiche_Status_Box(); Affiche_Status_Box();
...@@ -246,14 +194,14 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) ...@@ -246,14 +194,14 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
* used in OnRightClick(wxMouseEvent& event) * used in OnRightClick(wxMouseEvent& event)
*/ */
{ {
size_t i; size_t i;
int zoom; int maxZoomIds;
wxSize grid; int zoom;
int zoom_value; wxSize grid;
wxString msg; wxString msg;
int ii; GRID_TYPE tmp;
wxString line; wxMenu* gridMenu;
GRID_TYPE tmp; double gridValue;
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_CENTER, _( "Center" ), ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_CENTER, _( "Center" ),
zoom_center_xpm ); zoom_center_xpm );
...@@ -269,23 +217,27 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) ...@@ -269,23 +217,27 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
ADD_MENUITEM( MasterMenu, ID_ZOOM_REDRAW, _( "Redraw view" ), ADD_MENUITEM( MasterMenu, ID_ZOOM_REDRAW, _( "Redraw view" ),
zoom_redraw_xpm ); zoom_redraw_xpm );
/* Create the basic zoom list: */
zoom = GetScreen()->GetZoom(); zoom = GetScreen()->GetZoom();
zoom_value = 1; maxZoomIds = ID_POPUP_ZOOM_LEVEL_END - ID_POPUP_ZOOM_LEVEL_START;
for( ii = 0; zoom_value <= m_Parent->m_ZoomMaxValue; zoom_value <<= 1, ii++ ) // Create zoom choice 1 .. zoom max maxZoomIds = ( (size_t) maxZoomIds < GetScreen()->m_ZoomList.GetCount() ) ?
maxZoomIds : GetScreen()->m_ZoomList.GetCount();
wxLogDebug( _T( "%d zoom IDs used." ), maxZoomIds );
/* Populate zoom submenu. */
for( i = 0; i < (size_t) maxZoomIds; i++ )
{ {
line.Printf( wxT( "%u" ), zoom_value ); msg.Printf( wxT( "%u" ), GetScreen()->m_ZoomList[i] );
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_1 + ii, zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
_( "Zoom: " ) + line, wxEmptyString, TRUE ); wxEmptyString, wxITEM_CHECK );
if( zoom == zoom_value ) if( zoom == GetScreen()->m_ZoomList[i] )
zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_1 + ii, TRUE ); zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_START + i, true );
} }
/* Create grid submenu as required. */ /* Create grid submenu as required. */
if( !GetScreen()->m_GridList.IsEmpty() ) if( !GetScreen()->m_GridList.IsEmpty() )
{ {
wxMenu* grid_choice = new wxMenu; gridMenu = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, grid_choice, ADD_MENUITEM_WITH_SUBMENU( MasterMenu, gridMenu,
ID_POPUP_GRID_SELECT, _( "Grid Select" ), ID_POPUP_GRID_SELECT, _( "Grid Select" ),
grid_select_xpm ); grid_select_xpm );
...@@ -294,9 +246,8 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) ...@@ -294,9 +246,8 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ ) for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{ {
tmp = GetScreen()->m_GridList[i]; tmp = GetScreen()->m_GridList[i];
double grid_value = To_User_Unit( g_UnitMetric, gridValue = To_User_Unit( g_UnitMetric, tmp.m_Size.x,
tmp.m_Size.x, ( (WinEDA_DrawFrame*)m_Parent )->m_InternalUnits );
( (WinEDA_DrawFrame*)m_Parent )->m_InternalUnits );
if( tmp.m_Id == ID_POPUP_GRID_USER ) if( tmp.m_Id == ID_POPUP_GRID_USER )
{ {
msg = _( "User Grid" ); msg = _( "User Grid" );
...@@ -304,14 +255,14 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) ...@@ -304,14 +255,14 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
else else
{ {
if ( g_UnitMetric == 0 ) // inches if ( g_UnitMetric == 0 ) // inches
line.Printf( wxT( "%g mils" ), grid_value*1000 ); msg.Printf( wxT( "%g mils" ), gridValue * 1000 );
else else
line.Printf( wxT( "%g mm" ), grid_value ); msg.Printf( wxT( "%g mm" ), gridValue );
msg = _( "Grid: " ) + line; msg = _( "Grid: " ) + msg;
} }
grid_choice->Append( tmp.m_Id, msg, wxEmptyString, true ); gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true );
if( grid == tmp.m_Size ) if( grid == tmp.m_Size )
grid_choice->Check( tmp.m_Id, true ); gridMenu->Check( tmp.m_Id, true );
} }
} }
......
...@@ -179,7 +179,6 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -179,7 +179,6 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{ {
wxSize delta; wxSize delta;
int flagcurseur = 0; int flagcurseur = 0;
int zoom = GetScreen()->GetZoom();
wxPoint curpos, oldpos; wxPoint curpos, oldpos;
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
...@@ -187,7 +186,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -187,7 +186,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
curpos = DrawPanel->CursorRealPosition( Mouse ); curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->m_Curseur;
delta = GetScreen()->GetGrid() / zoom; delta = GetScreen()->GetGrid();
GetScreen()->Scale( delta );
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
/****************************************************/ /****************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
......
...@@ -11,18 +11,8 @@ ...@@ -11,18 +11,8 @@
// Licence: License GNU // Licence: License GNU
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
......
...@@ -11,17 +11,6 @@ ...@@ -11,17 +11,6 @@
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/*****************/ /*****************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
......
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
...@@ -78,7 +78,13 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -78,7 +78,13 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/***********************************************************************/ /***********************************************************************/
/* Class SCH_SCREEN: classe de gestion d'un affichage pour schematique */ /* Class SCH_SCREEN: classe de gestion d'un affichage pour schematique */
/***********************************************************************/ /***********************************************************************/
static int table_zoom[] = { 1, 2, 4, 8, 16, 32, 64, 128, 0 }; /* Valeurs standards du zoom */
/* Default EESchema zoom values. */
static int SchematicZoomList[] = { 10, 15, 20, 40, 80, 160, 320, 640, 1280 };
#define SCHEMATIC_ZOOM_LIST_CNT ( sizeof( SchematicZoomList ) / \
sizeof( int ) )
/* Default grid sizes for the schematic editor. */ /* Default grid sizes for the schematic editor. */
static GRID_TYPE SchematicGridList[] = { static GRID_TYPE SchematicGridList[] = {
...@@ -101,7 +107,9 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type ) ...@@ -101,7 +107,9 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
EEDrawList = NULL; /* Schematic items list */ EEDrawList = NULL; /* Schematic items list */
m_Zoom = 32; m_Zoom = 32;
SetZoomList( table_zoom );
for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ )
m_ZoomList.Add( SchematicZoomList[i] );
for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ ) for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ )
AddGrid( SchematicGridList[i] ); AddGrid( SchematicGridList[i] );
......
...@@ -222,7 +222,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi ...@@ -222,7 +222,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
{ {
wxSize delta; wxSize delta;
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
int zoom = screen->GetZoom();
wxPoint curpos, oldpos; wxPoint curpos, oldpos;
int hotkey = 0; int hotkey = 0;
...@@ -231,7 +230,8 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi ...@@ -231,7 +230,8 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
curpos = screen->m_MousePosition; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur; oldpos = screen->m_Curseur;
delta = screen->GetGrid() / zoom; delta = screen->GetGrid();
screen->Scale( delta );
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -316,7 +316,6 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -316,7 +316,6 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
{ {
wxSize delta; wxSize delta;
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
int zoom = screen->GetZoom();
wxPoint curpos, oldpos; wxPoint curpos, oldpos;
int hotkey = 0; int hotkey = 0;
...@@ -325,7 +324,8 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -325,7 +324,8 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
curpos = screen->m_MousePosition; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur; oldpos = screen->m_Curseur;
delta = screen->GetGrid() / zoom; delta = screen->GetGrid();
screen->Scale( delta );
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
...@@ -403,13 +403,12 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -403,13 +403,12 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
SetToolbars(); SetToolbars();
} }
/*************************************************************************************/ /*****************************************************************************/
void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ) void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
/*************************************************************************************/ wxPoint MousePositionInPixels )
{ {
wxSize delta; wxSize delta;
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
int zoom = screen->GetZoom();
wxPoint curpos, oldpos; wxPoint curpos, oldpos;
int hotkey = 0; int hotkey = 0;
...@@ -418,7 +417,8 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe ...@@ -418,7 +417,8 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
curpos = screen->m_MousePosition; curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur; oldpos = screen->m_Curseur;
delta = screen->GetGrid() / zoom; delta = screen->GetGrid();
screen->Scale( delta );
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "dialog_SVG_print_base.h" #include "dialog_SVG_print_base.h"
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
// Set this to 1 if you want to test PostScript printing under MSW. // Set this to 1 if you want to test PostScript printing under MSW.
#define wxTEST_POSTSCRIPT_IN_MSW 1 #define wxTEST_POSTSCRIPT_IN_MSW 1
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/*******************************************************/ /*******************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "libcmp.h"
......
...@@ -167,7 +167,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -167,7 +167,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
} }
// Trace de l'ancre // Trace de l'ancre
int len = 3 * panel->GetZoom(); int len = panel->GetScreen()->Unscale( 3 );
GRLine( &panel->m_ClipBox, DC, aOffset.x, aOffset.y - len, aOffset.x, aOffset.y + len, 0, color ); GRLine( &panel->m_ClipBox, DC, aOffset.x, aOffset.y - len, aOffset.x, aOffset.y + len, 0, color );
GRLine( &panel->m_ClipBox, DC, aOffset.x - len, aOffset.y, aOffset.x + len, aOffset.y, 0, color ); GRLine( &panel->m_ClipBox, DC, aOffset.x - len, aOffset.y, aOffset.x + len, aOffset.y, 0, color );
} }
......
...@@ -211,14 +211,13 @@ void RedrawOneStruct( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -211,14 +211,13 @@ void RedrawOneStruct( WinEDA_DrawPanel* panel, wxDC* DC,
} }
/*****************************************************************************************/ /****************************************************************************/
void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
/*****************************************************************************************/
/* Draw wires, Bus, and dashed liges.. */ /* Draw wires, Bus, and dashed liges.. */
/****************************************************************************/
void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode, int Color )
{ {
int color; int color;
int zoom = panel->GetZoom();
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 ) if( Color >= 0 )
...@@ -227,15 +226,19 @@ void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& ...@@ -227,15 +226,19 @@ void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
if( (m_Layer == LAYER_BUS) && (zoom <= 16) )
// FIXME: Not compatable with new zoom.
if( (m_Layer == LAYER_BUS) && panel->GetScreen()->Scale( width ) <= 1 )
width *= 3; width *= 3;
if( m_Layer == LAYER_NOTES ) if( m_Layer == LAYER_NOTES )
GRDashedLine( &panel->m_ClipBox, DC, m_Start.x + offset.x, m_Start.y + offset.y, GRDashedLine( &panel->m_ClipBox, DC, m_Start.x + offset.x,
m_End.x + offset.x, m_End.y + offset.y, width, color ); m_Start.y + offset.y, m_End.x + offset.x,
m_End.y + offset.y, width, color );
else else
GRLine( &panel->m_ClipBox, DC, m_Start.x + offset.x, m_Start.y + offset.y, GRLine( &panel->m_ClipBox, DC, m_Start.x + offset.x,
m_End.x + offset.x, m_End.y + offset.y, width, color ); m_Start.y + offset.y, m_End.x + offset.x, m_End.y + offset.y,
width, color );
if( m_StartIsDangling ) if( m_StartIsDangling )
DrawDanglingSymbol( panel, DC, m_Start + offset, color ); DrawDanglingSymbol( panel, DC, m_Start + offset, color );
...@@ -310,7 +313,6 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& ...@@ -310,7 +313,6 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
{ {
int color; int color;
int zoom = panel->GetZoom();
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 ) if( Color >= 0 )
...@@ -319,7 +321,7 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& ...@@ -319,7 +321,7 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
if( (m_Layer == LAYER_BUS) && (zoom <= 16) ) if( m_Layer == LAYER_BUS )
width *= 3; width *= 3;
GRLine( &panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y, GRLine( &panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y,
...@@ -345,7 +347,6 @@ void DrawPolylineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& ...@@ -345,7 +347,6 @@ void DrawPolylineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
int DrawMode, int Color ) int DrawMode, int Color )
{ {
int color; int color;
int zoom = panel->GetZoom();
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 ) if( Color >= 0 )
...@@ -355,7 +356,7 @@ void DrawPolylineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& ...@@ -355,7 +356,7 @@ void DrawPolylineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
if( (m_Layer == LAYER_BUS) && (zoom <= 16) ) if( m_Layer == LAYER_BUS )
{ {
width *= 3; width *= 3;
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/**************************************************/ /**************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/*************************************************/ /*************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
......
...@@ -326,12 +326,12 @@ static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame ) ...@@ -326,12 +326,12 @@ static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
// Reinit des parametres d'affichage du nouvel ecran // Reinit des parametres d'affichage du nouvel ecran
// assumes m_CurrentSheet has already been updated. // assumes m_CurrentSheet has already been updated.
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
frame->DrawPanel->SetScrollbars( frame->DrawPanel->m_Scroll_unit, frame->DrawPanel->SetScrollbars( NewScreen->m_ZoomScalar,
frame->DrawPanel->m_Scroll_unit, NewScreen->m_ZoomScalar,
NewScreen->m_ScrollbarNumber.x, NewScreen->m_ScrollbarNumber.x,
NewScreen->m_ScrollbarNumber.y, NewScreen->m_ScrollbarNumber.y,
NewScreen->m_ScrollbarPos.x, NewScreen->m_ScrollbarPos.x,
NewScreen->m_ScrollbarPos.y, TRUE ); NewScreen->m_ScrollbarPos.y, TRUE );
//update the References //update the References
frame->m_CurrentSheet->UpdateAllScreenReferences(); frame->m_CurrentSheet->UpdateAllScreenReferences();
......
This diff is collapsed.
...@@ -281,7 +281,7 @@ int WinEDA_LibeditFrame::BestZoom() ...@@ -281,7 +281,7 @@ int WinEDA_LibeditFrame::BestZoom()
GetScreen()->m_Curseur.y = 0; GetScreen()->m_Curseur.y = 0;
} }
return bestzoom; return bestzoom * GetScreen()->m_ZoomScalar;
} }
......
...@@ -280,7 +280,7 @@ void WinEDA_SchematicFrame::CreateScreens() ...@@ -280,7 +280,7 @@ void WinEDA_SchematicFrame::CreateScreens()
if( g_ScreenLib == NULL ) if( g_ScreenLib == NULL )
g_ScreenLib = new SCH_SCREEN(); g_ScreenLib = new SCH_SCREEN();
g_ScreenLib->SetZoom( 4 ); g_ScreenLib->SetZoom( 4 * g_ScreenLib->m_ZoomScalar );
g_ScreenLib->m_UndoRedoCountMax = 10; g_ScreenLib->m_UndoRedoCountMax = 10;
} }
...@@ -450,11 +450,10 @@ int WinEDA_SchematicFrame::BestZoom() ...@@ -450,11 +450,10 @@ int WinEDA_SchematicFrame::BestZoom()
jj = dy / size.y; jj = dy / size.y;
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
GetScreen()->SetZoom( ii );
GetScreen()->m_Curseur.x = dx / 2; GetScreen()->m_Curseur.x = dx / 2;
GetScreen()->m_Curseur.y = dy / 2; GetScreen()->m_Curseur.y = dy / 2;
return bestzoom; return bestzoom * GetScreen()->m_ZoomScalar;
} }
/*******************************************************************/ /*******************************************************************/
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
......
...@@ -223,7 +223,7 @@ int WinEDA_ViewlibFrame::BestZoom() ...@@ -223,7 +223,7 @@ int WinEDA_ViewlibFrame::BestZoom()
GetScreen()->m_Curseur = BoundaryBox.Centre(); GetScreen()->m_Curseur = BoundaryBox.Centre();
return bestzoom; return bestzoom * GetScreen()->m_ZoomScalar;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/****************************/ /****************************/
#include "fctsys.h" #include "fctsys.h"
//#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
......
...@@ -62,8 +62,9 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -62,8 +62,9 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
curpos = DrawPanel->CursorRealPosition( Mouse ); curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->m_Curseur;
delta.x = GetScreen()->GetGrid().x / GetScreen()->GetZoom(); delta = GetScreen()->GetGrid();
delta.y = GetScreen()->GetGrid().y / GetScreen()->GetZoom(); GetScreen()->Scale( delta );
if( delta.x == 0 ) if( delta.x == 0 )
delta.x = 1; delta.x = 1;
if( delta.y == 0 ) if( delta.y == 0 )
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h"
#include "common.h" #include "common.h"
#include "gerbview.h" #include "gerbview.h"
...@@ -137,7 +138,6 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, ...@@ -137,7 +138,6 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin� m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin�
m_Ident = GERBER_FRAME; m_Ident = GERBER_FRAME;
m_ZoomMaxValue = 1024;
if( DrawPanel ) if( DrawPanel )
DrawPanel->m_Block_Enable = TRUE; DrawPanel->m_Block_Enable = TRUE;
...@@ -305,27 +305,17 @@ void WinEDA_GerberFrame::SetToolbars() ...@@ -305,27 +305,17 @@ void WinEDA_GerberFrame::SetToolbars()
int WinEDA_GerberFrame::BestZoom() int WinEDA_GerberFrame::BestZoom()
/*************************************/ /*************************************/
{ {
int ii, jj; int ii, jj, gridX, gridY;
int bestzoom; int bestzoom;
wxSize size; wxSize size;
/* calcul du zoom montrant tout le dessim */
GetBoard()->ComputeBoundaryBox(); GetBoard()->ComputeBoundaryBox();
gridX = GetScreen()->GetGrid().GetWidth() / 2;
gridY = GetScreen()->GetGrid().GetHeight() / 2;
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
ii = GetBoard()->m_BoundaryBox.GetWidth() / size.x; ii = ( GetBoard()->m_BoundaryBox.GetWidth() + gridX ) / size.x;
jj = GetBoard()->m_BoundaryBox.GetHeight() / size.y; jj = ( GetBoard()->m_BoundaryBox.GetHeight() + gridY ) / size.y;
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
/* determination du zoom existant le plus proche */
for( ii = 1; ii < 2048; ii <<= 1 )
{
if( ii >= bestzoom )
break;
}
bestzoom = ii;
GetScreen()->m_Curseur = GetBoard()->m_BoundaryBox.Centre(); GetScreen()->m_Curseur = GetBoard()->m_BoundaryBox.Centre();
return bestzoom * GetScreen()->m_ZoomScalar;
return bestzoom;
} }
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "gerbview.h" #include "gerbview.h"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/*****************************************************************/ /*****************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "gerbview.h" #include "gerbview.h"
...@@ -65,8 +66,9 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo ...@@ -65,8 +66,9 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
{ {
int l_piste; int l_piste;
int color; int color;
int zoom;
int fillopt; int fillopt;
int radius;
int halfPenWidth;
static bool show_err; static bool show_err;
if( track->m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview if( track->m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview
...@@ -92,37 +94,34 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo ...@@ -92,37 +94,34 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
zoom = panel->GetZoom();
fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH; fillopt = DisplayOpt.DisplayPcbTrackFill ? FILLED : SKETCH;
switch( track->m_Shape ) switch( track->m_Shape )
{ {
case S_CIRCLE: case S_CIRCLE:
radius = (int) hypot( (double) (track->m_End.x - track->m_Start.x),
(double) (track->m_End.y - track->m_Start.y) );
halfPenWidth = track->m_Width >> 1;
if( panel->GetScreen()->Scale( halfPenWidth ) < L_MIN_DESSIN )
{ {
int radius = (int) hypot( (double) (track->m_End.x - track->m_Start.x), GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
(double) (track->m_End.y - track->m_Start.y) ); track->m_Start.y, radius, 0, color );
}
int halfPenWidth = track->m_Width >> 1;
if( (halfPenWidth / zoom) < L_MIN_DESSIN ) if( fillopt == SKETCH )
{ {
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, // draw the border of the pen's path using two circles, each as narrow as possible
radius, 0, color ); GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
} radius - halfPenWidth, 0, color );
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
if( fillopt == SKETCH ) radius + halfPenWidth, 0, color );
{ }
// draw the border of the pen's path using two circles, each as narrow as possible else
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, {
radius - halfPenWidth, 0, color ); GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, radius, track->m_Width, color );
radius + halfPenWidth, 0, color );
}
else
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
radius, track->m_Width, color );
}
} }
break; break;
...@@ -143,25 +142,23 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo ...@@ -143,25 +142,23 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
break; break;
case S_SPOT_CIRCLE: case S_SPOT_CIRCLE:
radius = track->m_Width >> 1;
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
if( panel->GetScreen()->Scale( radius ) < L_MIN_DESSIN )
{ {
int radius = track->m_Width >> 1; GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
track->m_Start.y, radius, 0, color );
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH; }
if( (radius / zoom) < L_MIN_DESSIN ) else if( fillopt == SKETCH )
{ {
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
radius, 0, color ); track->m_Start.y, radius, 0, color );
} }
else if( fillopt == SKETCH ) else
{ {
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRFilledCircle( &panel->m_ClipBox, DC, track->m_Start.x,
radius, 0, color ); track->m_Start.y, radius, 0, color, color );
}
else
{
GRFilledCircle( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
radius, 0, color, color );
}
} }
break; break;
...@@ -171,7 +168,7 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo ...@@ -171,7 +168,7 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
l_piste = track->m_Width >> 1; l_piste = track->m_Width >> 1;
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH; fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
if( (l_piste / zoom) < L_MIN_DESSIN ) if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
{ {
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, 0, color ); track->m_End.x, track->m_End.y, 0, color );
...@@ -202,7 +199,7 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo ...@@ -202,7 +199,7 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
case S_SEGMENT: case S_SEGMENT:
l_piste = track->m_Width >> 1; l_piste = track->m_Width >> 1;
if( (l_piste / zoom) < L_MIN_DESSIN ) if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
{ {
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, 0, color ); track->m_End.x, track->m_End.y, 0, color );
...@@ -212,13 +209,12 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo ...@@ -212,13 +209,12 @@ void Trace_Segment( WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track, int draw_mo
if( fillopt == SKETCH ) if( fillopt == SKETCH )
{ {
GRCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, track->m_End.x, track->m_End.y, track->m_Width, color );
track->m_Width, color );
} }
else else
{ {
GRFillCSegm( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y, GRFillCSegm( &panel->m_ClipBox, DC, track->m_Start.x,
track->m_End.x, track->m_End.y, track->m_Start.y, track->m_End.x, track->m_End.y,
track->m_Width, color ); track->m_Width, color );
} }
break; break;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
/* Use wxFileHistory for most recently used file handling. */ /* Use wxFileHistory for most recently used file handling. */
#include <wx/docview.h> #include <wx/docview.h>
class PARAM_CFG_BASE;
/**********************************************/ /**********************************************/
/* Class representing the entire Application */ /* Class representing the entire Application */
...@@ -70,6 +71,7 @@ public: ...@@ -70,6 +71,7 @@ public:
*/ */
void AddMenuLanguageList( wxMenu* MasterMenu ); void AddMenuLanguageList( wxMenu* MasterMenu );
void SetLanguageIdentifier( int menu_id ); void SetLanguageIdentifier( int menu_id );
void SetLanguagePath( void );
void InitOnLineHelp(); void InitOnLineHelp();
// Sauvegarde de configurations et options: // Sauvegarde de configurations et options:
...@@ -85,6 +87,12 @@ public: ...@@ -85,6 +87,12 @@ public:
void ReadPdfBrowserInfos(); void ReadPdfBrowserInfos();
void WritePdfBrowserInfos(); void WritePdfBrowserInfos();
wxString FindFileInSearchPaths( const wxString& filename,
const wxArrayString* subdirs = NULL );
wxString GetHelpFile( void );
wxString GetLibraryFile( const wxString& filename );
}; };
/* /*
......
...@@ -93,7 +93,7 @@ class EDA_BaseStruct; ...@@ -93,7 +93,7 @@ class EDA_BaseStruct;
class WinEDA_DrawFrame; class WinEDA_DrawFrame;
class BOARD; class BOARD;
class EDA_Rect; class EDA_Rect;
class WinEDA_DrawPanel;
/** /**
* Class INSPECTOR * Class INSPECTOR
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include "colors.h" #include "colors.h"
class SCH_ITEM; class SCH_ITEM;
class BASE_SCREEN;
class Ki_PageDescr;
/* Simple class for handling grid arrays. */ /* Simple class for handling grid arrays. */
class GRID_TYPE class GRID_TYPE
...@@ -43,7 +45,6 @@ public: ...@@ -43,7 +45,6 @@ public:
WinEDA_DrawFrame* m_Parent; WinEDA_DrawFrame* m_Parent;
EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the visible area in internal units) EDA_Rect m_ClipBox; // the clipbox used in screen redraw (usually gives the visible area in internal units)
wxPoint m_CursorStartPos; // utile dans controles du mouvement curseur wxPoint m_CursorStartPos; // utile dans controles du mouvement curseur
int m_Scroll_unit; // Valeur de l'unite de scroll en pixels pour les barres de scroll
int m_ScrollButt_unit; // Valeur de l'unite de scroll en pixels pour les boutons de scroll int m_ScrollButt_unit; // Valeur de l'unite de scroll en pixels pour les boutons de scroll
bool m_AbortRequest; // Flag d'arret de commandes longues bool m_AbortRequest; // Flag d'arret de commandes longues
...@@ -265,20 +266,21 @@ public: ...@@ -265,20 +266,21 @@ public:
private: private:
/* indicateurs divers */ /* indicateurs divers */
char m_FlagRefreshReq; /* indique que l'ecran doit redessine */ char m_FlagRefreshReq; /* indique que l'ecran doit redessine */
char m_FlagModified; // indique modif du PCB,utilise pour eviter une sortie sans sauvegarde char m_FlagModified; // indique modif du PCB,utilise pour eviter une sortie sans sauvegarde
char m_FlagSave; // indique sauvegarde auto faite char m_FlagSave; // indique sauvegarde auto faite
EDA_BaseStruct* m_CurrentItem; ///< Currently selected object EDA_BaseStruct* m_CurrentItem; ///< Currently selected object
/* Valeurs du pas de grille et du zoom */ /* Valeurs du pas de grille et du zoom */
public: public:
wxSize m_Grid; /* Current grid. */ wxSize m_Grid; /* Current grid. */
GridArray m_GridList; GridArray m_GridList;
bool m_UserGridIsON; bool m_UserGridIsON;
int m_Diviseur_Grille; int m_Diviseur_Grille;
int* m_ZoomList; /* Liste des coefficients standard de zoom */ wxArrayInt m_ZoomList; /* Array of standard zoom coefficients. */
int m_Zoom; /* coeff de ZOOM */ int m_Zoom; /* Current zoom coefficient. */
int m_ZoomScalar; /* Allow zooming to non-integer increments. */
public: public:
BASE_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE ); BASE_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE );
...@@ -328,34 +330,41 @@ public: ...@@ -328,34 +330,41 @@ public:
* Function GetZoom * Function GetZoom
* returns the current zoom factor * returns the current zoom factor
*/ */
int GetZoom() const; int GetZoom() const;
/** /**
* Function SetZoom * Function SetZoom
* adjusts the current zoom factor * adjusts the current zoom factor
*/ */
void SetZoom( int coeff ); void SetZoom( int coeff );
/** /**
* Function SetZoomList * Function SetZoomList
* sets the list of zoom factors. * sets the list of zoom factors.
* @param aZoomList An array of zoom factors in ascending order, zero terminated * @param aZoomList An array of zoom factors in ascending order, zero terminated
*/ */
void SetZoomList( const int* zoomlist ); void SetZoomList( const wxArrayInt& zoomlist );
void SetNextZoom(); /* ajuste le prochain coeff de zoom */ int Scale( int coord );
void SetPreviousZoom(); /* ajuste le precedent coeff de zoom */ void Scale( wxPoint& pt );
void SetFirstZoom(); /* ajuste le coeff de zoom a 1*/ void Scale( wxSize& sz );
void SetLastZoom(); /* ajuste le coeff de zoom au max */ int Unscale( int coord );
void Unscale( wxPoint& pt );
void Unscale( wxSize& sz );
void SetNextZoom(); /* ajuste le prochain coeff de zoom */
void SetPreviousZoom(); /* ajuste le precedent coeff de zoom */
void SetFirstZoom(); /* ajuste le coeff de zoom a 1*/
void SetLastZoom(); /* ajuste le coeff de zoom au max */
//----<grid stuff>---------------------------------------------------------- //----<grid stuff>----------------------------------------------------------
wxSize GetGrid(); /* retourne la grille */ wxSize GetGrid(); /* retourne la grille */
void SetGrid( const wxSize& size ); void SetGrid( const wxSize& size );
void SetGrid( int ); void SetGrid( int );
void SetGridList( GridArray& sizelist ); void SetGridList( GridArray& sizelist );
void AddGrid( const GRID_TYPE& grid ); void AddGrid( const GRID_TYPE& grid );
void AddGrid( const wxSize& size, int id ); void AddGrid( const wxSize& size, int id );
void AddGrid( const wxRealPoint& size, int units, int id ); void AddGrid( const wxRealPoint& size, int units, int id );
/** /**
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#define EESCHEMA_INTERNAL_UNIT 1000 // EESCHEMA internal unit = 1/1000 inch #define EESCHEMA_INTERNAL_UNIT 1000 // EESCHEMA internal unit = 1/1000 inch
#include "wxstruct.h" #include "wxstruct.h"
#include "gr_basic.h"
// Old wxWidget compatibility (prior to wxWidget 2.7): // Old wxWidget compatibility (prior to wxWidget 2.7):
#if !wxCHECK_VERSION( 2, 7, 0 ) #if !wxCHECK_VERSION( 2, 7, 0 )
......
...@@ -212,20 +212,15 @@ enum main_id { ...@@ -212,20 +212,15 @@ enum main_id {
ID_POPUP_ZOOM_OUT, ID_POPUP_ZOOM_OUT,
ID_POPUP_ZOOM_SELECT, ID_POPUP_ZOOM_SELECT,
ID_POPUP_ZOOM_CENTER, ID_POPUP_ZOOM_CENTER,
ID_POPUP_ZOOM_LEVEL_1,
ID_POPUP_ZOOM_LEVEL_2, /* Reserve IDs for popup menu zoom levels. If you need more than 15
ID_POPUP_ZOOM_LEVEL_4, * levels of zoom, change ID_POPUP_ZOOM_LEVEL_END. Note that more
ID_POPUP_ZOOM_LEVEL_8, * than 15 entries in a context submenu may get too large to display
ID_POPUP_ZOOM_LEVEL_16, * cleanly. Add any additional popup zoom IDs above here or the
ID_POPUP_ZOOM_LEVEL_32, * zoom event handler will not work properly.
ID_POPUP_ZOOM_LEVEL_64, */
ID_POPUP_ZOOM_LEVEL_128, ID_POPUP_ZOOM_LEVEL_START,
ID_POPUP_ZOOM_LEVEL_256, ID_POPUP_ZOOM_LEVEL_END = ID_POPUP_ZOOM_LEVEL_START + 15,
ID_POPUP_ZOOM_LEVEL_512,
ID_POPUP_ZOOM_LEVEL_1024,
ID_POPUP_ZOOM_LEVEL_2048,
ID_POPUP_ZOOM_UNUSED0,
ID_POPUP_ZOOM_UNUSED1,
ID_POPUP_ZOOM_END_RANGE, // last zoom id ID_POPUP_ZOOM_END_RANGE, // last zoom id
ID_POPUP_GRID_PLUS, ID_POPUP_GRID_PLUS,
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#define eda_global extern #define eda_global extern
#endif #endif
#include <vector>
#include <wx/socket.h> #include <wx/socket.h>
#include "wx/log.h" #include "wx/log.h"
#include "wx/config.h" #include "wx/config.h"
...@@ -18,7 +20,10 @@ ...@@ -18,7 +20,10 @@
#include <wx/laywin.h> #include <wx/laywin.h>
#include <wx/snglinst.h> #include <wx/snglinst.h>
#include <vector> #include "base_struct.h"
#include "appl_wxstruct.h"
#include "drawpanel_wxstruct.h"
#ifndef SAFE_DELETE #ifndef SAFE_DELETE
#define SAFE_DELETE(p) delete (p); (p) = NULL; //C++ guarantees that operator delete checks its argument for null-ness #define SAFE_DELETE(p) delete (p); (p) = NULL; //C++ guarantees that operator delete checks its argument for null-ness
...@@ -32,9 +37,10 @@ ...@@ -32,9 +37,10 @@
// Option for dialog boxes // Option for dialog boxes
// #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP // #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP
#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | \
MAYBE_RESIZE_BORDER
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS #define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
class wxMyDialogModalData; class wxMyDialogModalData;
...@@ -42,8 +48,6 @@ class wxMyDialogModalData; ...@@ -42,8 +48,6 @@ class wxMyDialogModalData;
class WinEDA_DrawPanel; class WinEDA_DrawPanel;
class WinEDA_DrawFrame; class WinEDA_DrawFrame;
#include "base_struct.h"
class WinEDA_App; class WinEDA_App;
class WinEDA_MsgPanel; class WinEDA_MsgPanel;
class COMMAND; class COMMAND;
...@@ -108,11 +112,6 @@ enum id_toolbar { ...@@ -108,11 +112,6 @@ enum id_toolbar {
#define MSG_PANEL_DEFAULT_HEIGHT ( 28 ) // height of the infos display window #define MSG_PANEL_DEFAULT_HEIGHT ( 28 ) // height of the infos display window
/**********************************************/
/* Class representing the entire Application */
/**********************************************/
#include "appl_wxstruct.h"
/******************************************************************/ /******************************************************************/
/* Basic frame for kicad, eeschema, pcbnew and gerbview. */ /* Basic frame for kicad, eeschema, pcbnew and gerbview. */
...@@ -183,7 +182,6 @@ public: ...@@ -183,7 +182,6 @@ public:
WinEDAChoiceBox* m_SelGridBox; // Dialog box to choose the grid size WinEDAChoiceBox* m_SelGridBox; // Dialog box to choose the grid size
WinEDAChoiceBox* m_SelZoomBox; // Dialog box to choose the Zoom value WinEDAChoiceBox* m_SelZoomBox; // Dialog box to choose the Zoom value
int m_ZoomMaxValue; // Max zoom value: Draw min scale is 1/m_ZoomMaxValue
int m_CurrentCursorShape; // shape for cursor (0 = default cursor) int m_CurrentCursorShape; // shape for cursor (0 = default cursor)
int m_ID_current_state; // Id of active button on the vertical toolbar int m_ID_current_state; // Id of active button on the vertical toolbar
...@@ -279,7 +277,7 @@ public: ...@@ -279,7 +277,7 @@ public:
void ReDrawPanel(); void ReDrawPanel();
void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ); void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width );
void PlotWorkSheet( int format_plot, BASE_SCREEN* screen ); void PlotWorkSheet( int format_plot, BASE_SCREEN* screen );
/** Function GetXYSheetReferences /** Function GetXYSheetReferences
* Return the X,Y sheet references where the point position is located * Return the X,Y sheet references where the point position is located
* @param aScreen = screen to use * @param aScreen = screen to use
...@@ -322,9 +320,6 @@ public: ...@@ -322,9 +320,6 @@ public:
/* classe representant un ecran graphique de dessin */ /* classe representant un ecran graphique de dessin */
/****************************************************/ /****************************************************/
#include "drawpanel_wxstruct.h"
/********************************************************* /*********************************************************
class WinEDA_MsgPanel : this is a panel to display various infos class WinEDA_MsgPanel : this is a panel to display various infos
and messages on items in eeschema an pcbnew and messages on items in eeschema an pcbnew
......
...@@ -406,9 +406,8 @@ bool WinEDA_App::OnInit() ...@@ -406,9 +406,8 @@ bool WinEDA_App::OnInit()
/* Splash screen logo */ /* Splash screen logo */
#ifdef USE_SPLASH_IMAGE #ifdef USE_SPLASH_IMAGE
wxString logoname( wxString( m_BinDir ) + _T( "logokicad.png" ) ); wxBitmap bmp;
wxBitmap splash_screen; if( bmp.LoadFile( m_BinDir + _T( "logokicad.png" ), wxBITMAP_TYPE_PNG ) )
if( splash_screen.LoadFile( logoname, wxBITMAP_TYPE_PNG ) )
{ {
wxSplashScreen* splash = new wxSplashScreen( splash_screen, wxSplashScreen* splash = new wxSplashScreen( splash_screen,
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT,
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -89,7 +90,7 @@ int WinEDA_BasePcbFrame::BestZoom( void ) ...@@ -89,7 +90,7 @@ int WinEDA_BasePcbFrame::BestZoom( void )
wxSize size; wxSize size;
if( m_Pcb == NULL ) if( m_Pcb == NULL )
return 32; return 32 * GetScreen()->m_ZoomScalar;
m_Pcb->ComputeBoundaryBox(); m_Pcb->ComputeBoundaryBox();
...@@ -100,10 +101,9 @@ int WinEDA_BasePcbFrame::BestZoom( void ) ...@@ -100,10 +101,9 @@ int WinEDA_BasePcbFrame::BestZoom( void )
ii = ( dx + (size.x / 2) ) / size.x; ii = ( dx + (size.x / 2) ) / size.x;
jj = ( dy + (size.y / 2) ) / size.y; jj = ( dy + (size.y / 2) ) / size.y;
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre();
return bestzoom; return bestzoom * GetScreen()->m_ZoomScalar;
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
/****************************************************/ /****************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
......
...@@ -379,7 +379,6 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -379,7 +379,6 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
*/ */
{ {
int ox, oy, typeaff, width, gcolor; int ox, oy, typeaff, width, gcolor;
int zoom = panel->GetScreen()->GetZoom();
ox = offset.x; ox = offset.x;
oy = offset.y; oy = offset.y;
...@@ -392,9 +391,9 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -392,9 +391,9 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
GRSetDrawMode( DC, mode_color ); GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems; typeaff = DisplayOpt.DisplayDrawItems;
width = m_Width; width = m_Width;
if( width / zoom < 2 )
if( panel->GetScreen()->Scale( width ) < 2 )
typeaff = FILAIRE; typeaff = FILAIRE;
switch( typeaff ) switch( typeaff )
......
...@@ -132,19 +132,19 @@ wxPoint DRAWSEGMENT::GetStart() const ...@@ -132,19 +132,19 @@ wxPoint DRAWSEGMENT::GetStart() const
wxPoint DRAWSEGMENT::GetEnd() const wxPoint DRAWSEGMENT::GetEnd() const
{ {
wxPoint center; // center point of the arc
wxPoint start; // start of arc
switch( m_Shape ) switch( m_Shape )
{ {
case S_ARC: case S_ARC:
{ // rotate the starting point of the arc, given by m_End, through the
// rotate the starting point of the arc, given by m_End, through the angle m_Angle // angle m_Angle to get the ending point of the arc.
// to get the ending point of the arc. center = m_Start; // center point of the arc
wxPoint center = m_Start; // center point of the arc start = m_End; // start of arc
wxPoint start = m_End; // start of arc RotatePoint( &start.x, &start.y, center.x, center.y, -m_Angle );
RotatePoint( &start.x, &start.y, center.x, center.y, -m_Angle ); return start; // after rotation, the end of the arc.
return start; // after rotation, the end of the arc.
}
break; break;
case S_SEGMENT: case S_SEGMENT:
...@@ -156,23 +156,17 @@ wxPoint DRAWSEGMENT::GetEnd() const ...@@ -156,23 +156,17 @@ wxPoint DRAWSEGMENT::GetEnd() const
void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int draw_mode, const wxPoint& notUsed ) int draw_mode, const wxPoint& notUsed )
{ {
int ux0, uy0, dx, dy; int ux0, uy0, dx, dy;
int l_piste; int l_piste;
int color, mode; int color, mode;
int zoom;
int rayon; int rayon;
color = g_DesignSettings.m_LayerColor[GetLayer()]; color = g_DesignSettings.m_LayerColor[GetLayer()];
if( color & ITEM_NOT_SHOW ) if( color & ITEM_NOT_SHOW )
return; return;
if( panel )
zoom = panel->GetZoom();
else
zoom = ActiveScreen->GetZoom();
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
l_piste = m_Width >> 1; /* l_piste = demi largeur piste */ l_piste = m_Width >> 1; /* l_piste = demi largeur piste */
...@@ -187,7 +181,7 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -187,7 +181,7 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
mode = DisplayOpt.DisplayDrawItems; mode = DisplayOpt.DisplayDrawItems;
if( m_Flags & FORCE_SKETCH ) if( m_Flags & FORCE_SKETCH )
mode = SKETCH; mode = SKETCH;
if( l_piste < (L_MIN_DESSIN * zoom) ) if( l_piste < panel->GetScreen()->Unscale( L_MIN_DESSIN ) )
mode = FILAIRE; mode = FILAIRE;
switch( m_Shape ) switch( m_Shape )
...@@ -210,39 +204,38 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -210,39 +204,38 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
break; break;
case S_ARC: case S_ARC:
{ int StAngle, EndAngle;
int StAngle, EndAngle; rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) );
rayon = (int) hypot( (double) (dx - ux0), (double) (dy - uy0) ); StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
StAngle = (int) ArcTangente( dy - uy0, dx - ux0 ); EndAngle = StAngle + m_Angle;
EndAngle = StAngle + m_Angle;
if ( ! panel->m_PrintIsMirrored) if ( ! panel->m_PrintIsMirrored)
{ {
if( StAngle > EndAngle ) if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle ); EXCHG( StAngle, EndAngle );
} }
else //Mirrored mode: arc orientation is reversed else //Mirrored mode: arc orientation is reversed
{ {
if( StAngle < EndAngle ) if( StAngle < EndAngle )
EXCHG( StAngle, EndAngle ); EXCHG( StAngle, EndAngle );
} }
if( mode == FILAIRE ) if( mode == FILAIRE )
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, color ); GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon, color );
else if( mode == SKETCH ) else if( mode == SKETCH )
{ {
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon - l_piste, color ); rayon - l_piste, color );
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon + l_piste, color ); rayon + l_piste, color );
} }
else else
{ {
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon, m_Width, color ); rayon, m_Width, color );
}
} }
break; break;
...@@ -339,7 +332,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos ) ...@@ -339,7 +332,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
rayon = (int) hypot( (double) (dx), (double) (dy) ); rayon = (int) hypot( (double) (dx), (double) (dy) );
dist = (int) hypot( (double) (spot_cX), (double) (spot_cY) ); dist = (int) hypot( (double) (spot_cX), (double) (spot_cY) );
if( abs( rayon - dist ) <= (m_Width / 2) ) if( abs( rayon - dist ) <= ( m_Width / 2 ) )
{ {
if( m_Shape == S_CIRCLE ) if( m_Shape == S_CIRCLE )
return true; return true;
...@@ -355,7 +348,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos ) ...@@ -355,7 +348,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
endAngle -= 3600; endAngle -= 3600;
} }
if( mouseAngle >= stAngle && mouseAngle <= endAngle ) if( mouseAngle >= stAngle && mouseAngle <= endAngle )
return true; return true;
} }
} }
......
...@@ -98,7 +98,6 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -98,7 +98,6 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
int ux0, uy0, dx, dy, rayon, StAngle, EndAngle; int ux0, uy0, dx, dy, rayon, StAngle, EndAngle;
int color, type_trace; int color, type_trace;
int zoom;
int typeaff; int typeaff;
PCB_SCREEN* screen; PCB_SCREEN* screen;
WinEDA_BasePcbFrame* frame; WinEDA_BasePcbFrame* frame;
...@@ -115,8 +114,6 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -115,8 +114,6 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
screen = frame->GetScreen(); screen = frame->GetScreen();
zoom = screen->GetZoom();
type_trace = m_Shape; type_trace = m_Shape;
ux0 = m_Start.x - offset.x; ux0 = m_Start.x - offset.x;
...@@ -133,7 +130,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -133,7 +130,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( !typeaff ) if( !typeaff )
typeaff = SKETCH; typeaff = SKETCH;
} }
if( (m_Width / zoom) < L_MIN_DESSIN ) if( panel->GetScreen()->Scale( m_Width ) < L_MIN_DESSIN )
typeaff = FILAIRE; typeaff = FILAIRE;
switch( type_trace ) switch( type_trace )
...@@ -158,12 +155,15 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -158,12 +155,15 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
if( typeaff == FILLED ) if( typeaff == FILLED )
{ {
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon, m_Width, color ); GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon,
m_Width, color );
} }
else // SKETCH Mode else // SKETCH Mode
{ {
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon + (m_Width / 2), color ); GRCircle( &panel->m_ClipBox, DC, ux0, uy0,
GRCircle( &panel->m_ClipBox, DC, ux0, uy0, rayon - (m_Width / 2), color ); rayon + (m_Width / 2), color );
GRCircle( &panel->m_ClipBox, DC, ux0, uy0,
rayon - (m_Width / 2), color );
} }
} }
break; break;
...@@ -176,7 +176,8 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -176,7 +176,8 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
EXCHG( StAngle, EndAngle ); EXCHG( StAngle, EndAngle );
if( typeaff == FILAIRE ) if( typeaff == FILAIRE )
{ {
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, color ); GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle,
rayon, color );
} }
else if( typeaff == FILLED ) else if( typeaff == FILLED )
{ {
...@@ -193,30 +194,28 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -193,30 +194,28 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
break; break;
case S_POLYGON: case S_POLYGON:
{ // We must compute true coordinates from m_PolyPoints
// We must compute true coordinates from m_PolyPoints // which are relative to module position, orientation 0
// which are relative to module position, orientation 0
std::vector<wxPoint> points = m_PolyPoints; std::vector<wxPoint> points = m_PolyPoints;
for( unsigned ii = 0; ii < points.size(); ii++ )
{
wxPoint& pt = points[ii];
if( Module ) for( unsigned ii = 0; ii < points.size(); ii++ )
{ {
RotatePoint( &pt.x, &pt.y, Module->m_Orient ); wxPoint& pt = points[ii];
pt.x += Module->m_Pos.x;
pt.y += Module->m_Pos.y;
}
pt.x += m_Start0.x - offset.x; if( Module )
pt.y += m_Start0.y - offset.y; {
RotatePoint( &pt.x, &pt.y, Module->m_Orient );
pt.x += Module->m_Pos.x;
pt.y += Module->m_Pos.y;
} }
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0], pt.x += m_Start0.x - offset.x;
TRUE, m_Width, color, color ); pt.y += m_Start0.y - offset.y;
} }
GRPoly( &panel->m_ClipBox, DC, points.size(), &points[0],
TRUE, m_Width, color, color );
break; break;
} }
} }
......
...@@ -161,8 +161,7 @@ bool MARKER::HitTest( const wxPoint& refPos ) ...@@ -161,8 +161,7 @@ bool MARKER::HitTest( const wxPoint& refPos )
wxSize TrueSize = m_Size; wxSize TrueSize = m_Size;
if ( ActiveScreen ) if ( ActiveScreen )
{ {
TrueSize.x *= ActiveScreen->GetZoom(); ActiveScreen->Unscale( TrueSize );
TrueSize.y *= ActiveScreen->GetZoom();
} }
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
......
...@@ -106,7 +106,6 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -106,7 +106,6 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int rayon, ox, oy, gcolor, width; int rayon, ox, oy, gcolor, width;
int dx1, dx2, dy1, dy2; int dx1, dx2, dy1, dy2;
int typeaff; int typeaff;
int zoom;
ox = m_Pos.x + offset.x; ox = m_Pos.x + offset.x;
oy = m_Pos.y + offset.y; oy = m_Pos.y + offset.y;
...@@ -115,12 +114,10 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -115,12 +114,10 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( (gcolor & ITEM_NOT_SHOW) != 0 ) if( (gcolor & ITEM_NOT_SHOW) != 0 )
return; return;
zoom = panel->GetZoom();
GRSetDrawMode( DC, mode_color ); GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems; typeaff = DisplayOpt.DisplayDrawItems;
width = m_Width; width = m_Width;
if( width / zoom < 2 ) if( panel->GetScreen()->Scale( width ) < 2 )
typeaff = FILAIRE; typeaff = FILAIRE;
/* Trace du cercle: */ /* Trace du cercle: */
......
...@@ -32,8 +32,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset ...@@ -32,8 +32,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
* (doit etre fait apres les pads, * (doit etre fait apres les pads,
* car le trace du trou efface tout donc peut etre l'ancre */ * car le trace du trou efface tout donc peut etre l'ancre */
{ {
int zoom = panel->GetZoom(); int anchor_size = panel->GetScreen()->Unscale( dim_ancre );
int anchor_size = dim_ancre * zoom;
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
......
...@@ -30,7 +30,6 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -30,7 +30,6 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
xc, yc; xc, yc;
int angle; int angle;
wxPoint coord[4]; wxPoint coord[4];
int zoom;
int fillpad = 0; int fillpad = 0;
wxPoint shape_pos; wxPoint shape_pos;
...@@ -39,7 +38,6 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -39,7 +38,6 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
wxASSERT( panel ); wxASSERT( panel );
zoom = panel->GetZoom();
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
PCB_SCREEN* screen = frame->GetScreen(); PCB_SCREEN* screen = frame->GetScreen();
...@@ -341,7 +339,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -341,7 +339,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
switch( m_DrillShape ) switch( m_DrillShape )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
if( (hole / zoom) > 1 ) /* draw hole if its size is enought */ if( screen->Scale( hole ) > 1 ) /* draw hole if its size is enought */
GRFilledCircle( &panel->m_ClipBox, DC, cx0, cy0, hole, 0, color, color ); GRFilledCircle( &panel->m_ClipBox, DC, cx0, cy0, hole, 0, color, color );
break; break;
...@@ -435,7 +433,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -435,7 +433,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
int tsize = min( AreaSize.y, AreaSize.x / numpad_len ); int tsize = min( AreaSize.y, AreaSize.x / numpad_len );
#define CHAR_SIZE_MIN 5 #define CHAR_SIZE_MIN 5
if( (tsize / zoom) >= CHAR_SIZE_MIN ) // Not drawable when size too small. if( screen->Scale( tsize ) >= CHAR_SIZE_MIN ) // Not drawable when size too small.
{ {
tsize = (int) (tsize * 0.8); // reserve room for marges and segments thickness tsize = (int) (tsize * 0.8); // reserve room for marges and segments thickness
...@@ -450,7 +448,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -450,7 +448,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
shortname_len = MAX( shortname_len, MIN_CHAR_COUNT); shortname_len = MAX( shortname_len, MIN_CHAR_COUNT);
tsize = min( AreaSize.y, AreaSize.x / shortname_len ); tsize = min( AreaSize.y, AreaSize.x / shortname_len );
if( (tsize / zoom) >= CHAR_SIZE_MIN ) // Not drawable in size too small. if( screen->Scale( tsize ) >= CHAR_SIZE_MIN ) // Not drawable in size too small.
{ {
tpos = tpos0; tpos = tpos0;
tpos.y += AreaSize.y / 2; tpos.y += AreaSize.y / 2;
......
...@@ -353,7 +353,6 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const ...@@ -353,7 +353,6 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
* @param draw_mode = GR_OR, GR_XOR.. * @param draw_mode = GR_OR, GR_XOR..
*/ */
{ {
int zoom;
int width, color, orient; int width, color, orient;
wxSize size; wxSize size;
wxPoint pos; // Centre du texte wxPoint pos; // Centre du texte
...@@ -367,7 +366,6 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const ...@@ -367,7 +366,6 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
screen = (PCB_SCREEN*) panel->GetScreen(); screen = (PCB_SCREEN*) panel->GetScreen();
frame = (WinEDA_BasePcbFrame*) panel->m_Parent; frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
zoom = screen->GetZoom();
pos.x = m_Pos.x - offset.x; pos.x = m_Pos.x - offset.x;
pos.y = m_Pos.y - offset.y; pos.y = m_Pos.y - offset.y;
...@@ -376,7 +374,8 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const ...@@ -376,7 +374,8 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
orient = GetDrawRotation(); orient = GetDrawRotation();
width = m_Width; width = m_Width;
if( (frame->m_DisplayModText == FILAIRE) || ( (width / zoom) < L_MIN_DESSIN ) ) if( (frame->m_DisplayModText == FILAIRE)
|| ( screen->Scale( width ) < L_MIN_DESSIN ) )
width = 0; width = 0;
else if( frame->m_DisplayModText == SKETCH ) else if( frame->m_DisplayModText == SKETCH )
width = -width; width = -width;
...@@ -386,13 +385,13 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const ...@@ -386,13 +385,13 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
/* trace du centre du texte */ /* trace du centre du texte */
if( (g_AnchorColor & ITEM_NOT_SHOW) == 0 ) if( (g_AnchorColor & ITEM_NOT_SHOW) == 0 )
{ {
int anchor_size = 2 * zoom; int anchor_size = screen->Unscale( 2 );
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
pos.x - anchor_size, pos.y, pos.x - anchor_size, pos.y,
pos.x + anchor_size, pos.y, 0, g_AnchorColor ); pos.x + anchor_size, pos.y, 0, g_AnchorColor );
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
pos.x, pos.y - anchor_size, pos.x, pos.y - anchor_size,
pos.x, pos.y + anchor_size, 0, g_AnchorColor ); pos.x, pos.y + anchor_size, 0, g_AnchorColor );
} }
color = g_DesignSettings.m_LayerColor[Module->GetLayer()]; color = g_DesignSettings.m_LayerColor[Module->GetLayer()];
...@@ -418,7 +417,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const ...@@ -418,7 +417,7 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const
/* Trace du texte */ /* Trace du texte */
DrawGraphicText( panel, DC, pos, (enum EDA_Colors) color, m_Text, DrawGraphicText( panel, DC, pos, (enum EDA_Colors) color, m_Text,
orient, size, m_HJustify, m_VJustify, width, m_Italic ); orient, size, m_HJustify, m_VJustify, width, m_Italic );
} }
......
...@@ -535,7 +535,6 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -535,7 +535,6 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
{ {
int l_piste; int l_piste;
int color; int color;
int zoom;
int rayon; int rayon;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
...@@ -545,7 +544,8 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -545,7 +544,8 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview if( m_Flags & DRAW_ERASED ) // draw in background color, used by classs TRACK in gerbview
{ {
color = g_DrawBgColor; color = g_DrawBgColor;
D( printf( "DRAW_ERASED in Track::Draw, g_DrawBgColor=%04X\n", g_DrawBgColor ); ) D( printf( "DRAW_ERASED in Track::Draw, g_DrawBgColor=%04X\n",
g_DrawBgColor ); )
} }
else else
{ {
...@@ -579,7 +579,6 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -579,7 +579,6 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
zoom = panel->GetZoom();
l_piste = m_Width >> 1; l_piste = m_Width >> 1;
...@@ -587,13 +586,13 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -587,13 +586,13 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
{ {
rayon = (int) hypot( (double) ( m_End.x - m_Start.x ), rayon = (int) hypot( (double) ( m_End.x - m_Start.x ),
(double) ( m_End.y - m_Start.y ) ); (double) ( m_End.y - m_Start.y ) );
if( (l_piste / zoom) < L_MIN_DESSIN ) if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
{ {
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color ); GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
} }
else else
{ {
if( l_piste <= zoom ) /* Sketch mode if l_piste/zoom <= 1 */ if( panel->GetScreen()->Scale( l_piste ) <= 1 ) /* Sketch mode if l_piste/zoom <= 1 */
{ {
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color ); GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
} }
...@@ -611,7 +610,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -611,7 +610,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
return; return;
} }
if( (l_piste / zoom) < L_MIN_DESSIN ) if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
{ {
GRLine( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRLine( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
m_End.x, m_End.y, 0, color ); m_End.x, m_End.y, 0, color );
...@@ -658,7 +657,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -658,7 +657,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( len < THRESHOLD * m_Width ) if( len < THRESHOLD * m_Width )
return; return;
if( ( m_Width / zoom) < 6 ) // no room to display a text inside track if( panel->GetScreen()->Scale( m_Width ) < 6 ) // no room to display a text inside track
return; return;
if( GetNet() == 0 ) if( GetNet() == 0 )
...@@ -680,7 +679,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin ...@@ -680,7 +679,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
int angle = 0; int angle = 0;
if ( (m_End.x - m_Start.x) == 0 ) // Vertical segment if ( (m_End.x - m_Start.x) == 0 ) // Vertical segment
angle = 900; // angle is in 0.1 degree angle = 900; // angle is in 0.1 degree
if( ( tsize / zoom) >= 6 ) if( panel->GetScreen()->Scale( tsize ) >= 6 )
{ {
tsize = (tsize * 8) / 10; // small reduction to give a better look tsize = (tsize * 8) / 10; // small reduction to give a better look
DrawGraphicText( panel, DC, tpos, DrawGraphicText( panel, DC, tpos,
...@@ -696,7 +695,6 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi ...@@ -696,7 +695,6 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
/*******************************************************************************************/ /*******************************************************************************************/
{ {
int color; int color;
int zoom;
int rayon; int rayon;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
...@@ -729,21 +727,21 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi ...@@ -729,21 +727,21 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
SetAlpha( &color, 150 ); SetAlpha( &color, 150 );
zoom = panel->GetZoom();
rayon = m_Width >> 1; rayon = m_Width >> 1;
if( rayon < zoom ) if( panel->GetScreen()->Scale( rayon ) <= 4 )
rayon = zoom; {
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
return;
}
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color ); GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
if( rayon <= (4 * zoom) ) // Size too small: cannot be drawn
return;
int drill_rayon = GetDrillValue() / 2; int drill_rayon = GetDrillValue() / 2;
int inner_rayon = rayon - (2 * zoom); int inner_rayon = rayon - panel->GetScreen()->Unscale( 2 );
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
inner_rayon, color ); inner_rayon, color );
// Draw the via hole if the display option allows it // Draw the via hole if the display option allows it
if( DisplayOpt.m_DisplayViaMode != VIA_HOLE_NOT_SHOW ) if( DisplayOpt.m_DisplayViaMode != VIA_HOLE_NOT_SHOW )
...@@ -830,7 +828,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi ...@@ -830,7 +828,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
{ {
// calculate a good size for the text // calculate a good size for the text
int tsize = m_Width / len; int tsize = m_Width / len;
if( ( tsize / zoom) >= 6 ) if( panel->GetScreen()->Scale( tsize ) >= 6 )
{ {
tsize = (tsize * 8) / 10; // small reduction to give a better look, inside via tsize = (tsize * 8) / 10; // small reduction to give a better look, inside via
DrawGraphicText( panel, DC, m_Start, DrawGraphicText( panel, DC, m_Start,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define CLASS_ZONE_H #define CLASS_ZONE_H
#include <vector> #include <vector>
#include "gr_basic.h"
#include "PolyLine.h" #include "PolyLine.h"
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
/**********************************************************************/ /**********************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -13,6 +12,13 @@ ...@@ -13,6 +12,13 @@
#include "id.h" #include "id.h"
/* Default PCB zoom coefficients. */
static const int PcbZoomList[] = { 5, 10, 15, 20, 40, 80, 160, 320, 640, 1280,
2560, 5120, 10240, 20480 };
#define PCB_ZOOM_LIST_CNT ( sizeof( PcbZoomList ) / sizeof( int ) )
/* Default grid sizes for PCB editor screens. */ /* Default grid sizes for PCB editor screens. */
static GRID_TYPE PcbGridList[] = { static GRID_TYPE PcbGridList[] = {
{ ID_POPUP_GRID_LEVEL_1000, wxSize( 1000, 1000 ) }, { ID_POPUP_GRID_LEVEL_1000, wxSize( 1000, 1000 ) },
...@@ -40,15 +46,13 @@ PCB_SCREEN::PCB_SCREEN( ) : BASE_SCREEN( TYPE_SCREEN ) ...@@ -40,15 +46,13 @@ PCB_SCREEN::PCB_SCREEN( ) : BASE_SCREEN( TYPE_SCREEN )
{ {
size_t i; size_t i;
// a zero terminated list for( i = 0; i < PCB_ZOOM_LIST_CNT; i++ )
static const int zoom_list[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, m_ZoomList.Add( PcbZoomList[i] );
512, 1024, 2048, 0 };
for( i = 0; i < PCB_GRID_LIST_CNT; i++ ) for( i = 0; i < PCB_GRID_LIST_CNT; i++ )
AddGrid( PcbGridList[i] ); AddGrid( PcbGridList[i] );
SetGrid( wxSize( 500, 500 ) ); /* pas de la grille en 1/10000 "*/ SetGrid( wxSize( 500, 500 ) ); /* pas de la grille en 1/10000 "*/
SetZoomList( zoom_list );
Init(); Init();
} }
......
...@@ -482,7 +482,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -482,7 +482,6 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/*****************************************************************/ /*****************************************************************/
{ {
wxSize delta; wxSize delta;
int zoom = GetScreen()->GetZoom();
wxPoint curpos, oldpos; wxPoint curpos, oldpos;
int hotkey = 0; int hotkey = 0;
...@@ -517,7 +516,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -517,7 +516,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
curpos = DrawPanel->CursorRealPosition( Mouse ); curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->m_Curseur;
delta = GetScreen()->GetGrid() / zoom; delta = GetScreen()->GetGrid();
GetScreen()->Scale( delta );
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
......
...@@ -157,7 +157,6 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, ...@@ -157,7 +157,6 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin� m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessin�
m_ZoomMaxValue = 1024;
// Give an icon // Give an icon
SetIcon( wxICON( icon_modedit ) ); SetIcon( wxICON( icon_modedit ) );
...@@ -351,17 +350,15 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -351,17 +350,15 @@ void WinEDA_ModuleEditFrame::SetToolbars()
if( m_SelZoomBox ) if( m_SelZoomBox )
{ {
int old_choice = m_SelZoomBox->GetChoice(); int old_choice = m_SelZoomBox->GetChoice();
int new_choice = 1;
int zoom; for( jj = 0; jj < GetScreen()->m_ZoomList.GetCount(); jj++ )
for( jj = 1, zoom = 1; zoom <= m_ZoomMaxValue; zoom <<= 1, jj++ )
{ {
if( GetScreen() && (GetScreen()->GetZoom() == zoom) ) if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[jj] )
{
m_SelZoomBox->SetSelection( jj + 1 );
break; break;
new_choice++; }
} }
if( old_choice != new_choice )
m_SelZoomBox->SetSelection( new_choice );
} }
if( m_SelGridBox && GetScreen() ) if( m_SelGridBox && GetScreen() )
......
...@@ -207,7 +207,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -207,7 +207,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_SelTrackWidthBox = NULL; m_SelTrackWidthBox = NULL;
m_SelViaSizeBox = NULL; m_SelViaSizeBox = NULL;
m_SelLayerBox = NULL; m_SelLayerBox = NULL;
m_ZoomMaxValue = 2048;
m_SelTrackWidthBox_Changed = FALSE; m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE; m_SelViaSizeBox_Changed = FALSE;
...@@ -542,19 +541,14 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -542,19 +541,14 @@ void WinEDA_PcbFrame::SetToolbars()
if( m_SelZoomBox ) if( m_SelZoomBox )
{ {
int old_choice = m_SelZoomBox->GetChoice(); for( jj = 0; jj < (int)GetScreen()->m_ZoomList.GetCount(); jj++ )
int new_choice = 1;
int zoom;
for( jj = 1, zoom = 1; zoom <= m_ZoomMaxValue; zoom <<= 1, jj++ )
{ {
if( GetScreen() && (GetScreen()->GetZoom() == zoom) ) if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[jj] )
{
m_SelZoomBox->SetSelection( jj + 1 );
break; break;
new_choice++; }
} }
if( old_choice != new_choice )
m_SelZoomBox->SetSelection( new_choice );
} }
if( m_SelGridBox && GetScreen() ) if( m_SelGridBox && GetScreen() )
...@@ -575,8 +569,6 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -575,8 +569,6 @@ void WinEDA_PcbFrame::SetToolbars()
} }
UpdateToolbarLayerInfo(); UpdateToolbarLayerInfo();
PrepareLayerIndicator(); PrepareLayerIndicator();
DisplayUnitsMsg(); DisplayUnitsMsg();
} }
...@@ -284,9 +284,9 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar() ...@@ -284,9 +284,9 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
wxSize( LISTBOX_WIDTH, -1 ) ); wxSize( LISTBOX_WIDTH, -1 ) );
msg = _( "Auto" ); msg = _( "Auto" );
m_SelZoomBox->Append( msg ); m_SelZoomBox->Append( msg );
for( int jj = 0, ii = 1; ii <= m_ZoomMaxValue; ii <<= 1, jj++ ) for( int i = 0; i < (int)GetScreen()->m_ZoomList.GetCount(); i++ )
{ {
msg.Printf( _( "Zoom %d" ), ii ); msg.Printf( _( "Zoom %d" ), GetScreen()->m_ZoomList[i] );
m_SelZoomBox->Append( msg ); m_SelZoomBox->Append( msg );
} }
......
...@@ -589,9 +589,10 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar() ...@@ -589,9 +589,10 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
wxSize( LISTBOX_WIDTH, -1 ) ); wxSize( LISTBOX_WIDTH, -1 ) );
msg = _( "Auto" ); msg = _( "Auto" );
m_SelZoomBox->Append( msg ); m_SelZoomBox->Append( msg );
for( int jj = 0, ii = 1; ii <= m_ZoomMaxValue; ii <<= 1, jj++ ) for( int i = 0; i < (int)GetScreen()->m_ZoomList.GetCount(); i++ )
{ {
msg = _( "Zoom " ); msg << ii; msg = _( "Zoom " );
msg << GetScreen()->m_ZoomList[i];
m_SelZoomBox->Append( msg ); m_SelZoomBox->Append( msg );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment