Commit f00696e8 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix bug 804780.

All: use double instead of int to store zoom values.
parent bcfac4b4
...@@ -222,9 +222,9 @@ void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos, ...@@ -222,9 +222,9 @@ void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos,
} }
int WinEDA3D_DrawFrame::BestZoom() double WinEDA3D_DrawFrame::BestZoom()
{ {
return 1; return 1.0;
} }
......
...@@ -246,7 +246,7 @@ public: ...@@ -246,7 +246,7 @@ public:
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnKeyEvent( wxKeyEvent& event ); void OnKeyEvent( wxKeyEvent& event );
int BestZoom(); double BestZoom();
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void Process_Zoom( wxCommandEvent& event ); void Process_Zoom( wxCommandEvent& event );
......
...@@ -24,8 +24,7 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType ) ...@@ -24,8 +24,7 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
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_ZoomScalar = 10; m_Zoom = 32.0;
m_Zoom = 32 * m_ZoomScalar;
m_Grid.m_Size = wxRealPoint( 50, 50 ); /* Default grid size */ m_Grid.m_Size = wxRealPoint( 50, 50 ); /* Default grid size */
m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50; m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50;
m_Center = true; m_Center = true;
...@@ -106,7 +105,7 @@ void BASE_SCREEN::SetPageSize( wxSize& aPageSize ) ...@@ -106,7 +105,7 @@ void BASE_SCREEN::SetPageSize( wxSize& aPageSize )
*/ */
double BASE_SCREEN::GetScalingFactor() const double BASE_SCREEN::GetScalingFactor() const
{ {
double scale = (double) m_ZoomScalar / (double) GetZoom(); double scale = 1.0 / GetZoom();
return scale; return scale;
} }
...@@ -118,7 +117,7 @@ double BASE_SCREEN::GetScalingFactor() const ...@@ -118,7 +117,7 @@ double BASE_SCREEN::GetScalingFactor() const
*/ */
void BASE_SCREEN::SetScalingFactor(double aScale ) void BASE_SCREEN::SetScalingFactor(double aScale )
{ {
int zoom = static_cast<int>( ceil(aScale * m_ZoomScalar) ); double zoom = aScale;
// Limit zoom to max and min allowed values: // Limit zoom to max and min allowed values:
if (zoom < m_ZoomList[0]) if (zoom < m_ZoomList[0])
...@@ -132,7 +131,7 @@ void BASE_SCREEN::SetScalingFactor(double aScale ) ...@@ -132,7 +131,7 @@ void BASE_SCREEN::SetScalingFactor(double aScale )
SetZoom( zoom ); SetZoom( zoom );
} }
void BASE_SCREEN::SetZoomList( const wxArrayInt& zoomlist ) void BASE_SCREEN::SetZoomList( const wxArrayDouble& zoomlist )
{ {
if( !m_ZoomList.IsEmpty() ) if( !m_ZoomList.IsEmpty() )
m_ZoomList.Empty(); m_ZoomList.Empty();
...@@ -145,9 +144,9 @@ bool BASE_SCREEN::SetFirstZoom() ...@@ -145,9 +144,9 @@ bool BASE_SCREEN::SetFirstZoom()
{ {
if( m_ZoomList.IsEmpty() ) if( m_ZoomList.IsEmpty() )
{ {
if( m_Zoom != m_ZoomScalar ) if( m_Zoom != 1.0 )
{ {
m_Zoom = m_ZoomScalar; m_Zoom = 1.0;
return true; return true;
} }
} }
...@@ -161,22 +160,19 @@ bool BASE_SCREEN::SetFirstZoom() ...@@ -161,22 +160,19 @@ bool BASE_SCREEN::SetFirstZoom()
} }
int BASE_SCREEN::GetZoom() const double BASE_SCREEN::GetZoom() const
{ {
return m_Zoom; return m_Zoom;
} }
bool BASE_SCREEN::SetZoom( int coeff ) bool BASE_SCREEN::SetZoom( double coeff )
{ {
if( coeff == m_Zoom ) if( coeff == m_Zoom )
return false; return false;
m_Zoom = coeff; m_Zoom = coeff;
if( m_Zoom < 1 )
m_Zoom = 1;
return true; return true;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#endif #endif
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2011-07-03)" #define KICAD_BUILD_VERSION "(2011-07-04)"
#endif #endif
......
...@@ -384,7 +384,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event ) ...@@ -384,7 +384,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
/* Return the current zoom level */ /* Return the current zoom level */
int EDA_DRAW_FRAME::GetZoom( void ) double EDA_DRAW_FRAME::GetZoom( void )
{ {
return GetScreen()->GetZoom(); return GetScreen()->GetZoom();
} }
...@@ -658,10 +658,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar() ...@@ -658,10 +658,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
return; return;
/* Display Zoom level: zoom = zoom_coeff/ZoomScalar */ /* Display Zoom level: zoom = zoom_coeff/ZoomScalar */
if ( (screen->GetZoom() % screen->m_ZoomScalar) == 0 ) Line.Printf( wxT( "Z %g" ), screen->GetZoom() );
Line.Printf( wxT( "Z %d" ), screen->GetZoom() / screen->m_ZoomScalar );
else
Line.Printf( wxT( "Z %.1f" ), (float)screen->GetZoom() / screen->m_ZoomScalar );
SetStatusText( Line, 1 ); SetStatusText( Line, 1 );
......
...@@ -177,12 +177,7 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu ) ...@@ -177,12 +177,7 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
/* Populate zoom submenu. */ /* Populate zoom submenu. */
for( int i = 0; i < maxZoomIds; i++ ) for( int i = 0; i < maxZoomIds; i++ )
{ {
if( ( screen->m_ZoomList[i] % screen->m_ZoomScalar ) == 0 ) msg.Printf( wxT( "%g" ), screen->m_ZoomList[i] );
msg.Printf( wxT( "%u" ),
screen->m_ZoomList[i] / screen->m_ZoomScalar );
else
msg.Printf( wxT( "%.1f" ),
(float) screen->m_ZoomList[i] / screen->m_ZoomScalar );
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg, zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
wxEmptyString, wxITEM_CHECK ); wxEmptyString, wxITEM_CHECK );
......
...@@ -346,7 +346,7 @@ void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -346,7 +346,7 @@ void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
} }
int LIB_EDIT_FRAME::BestZoom() double LIB_EDIT_FRAME::BestZoom()
{ {
/* Please, note: wxMSW before version 2.9 seems have /* Please, note: wxMSW before version 2.9 seems have
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched: * problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
...@@ -377,12 +377,10 @@ int LIB_EDIT_FRAME::BestZoom() ...@@ -377,12 +377,10 @@ int LIB_EDIT_FRAME::BestZoom()
// Reserve a 10% margin around component bounding box. // Reserve a 10% margin around component bounding box.
double margin_scale_factor = 0.8; double margin_scale_factor = 0.8;
double zx =(double) dx / ( margin_scale_factor * (double)size.x ) * double zx =(double) dx / (margin_scale_factor * (double)size.x );
(double) GetScreen()->m_ZoomScalar; double zy = (double) dy / ( margin_scale_factor * (double)size.y );
double zy = (double) dy / ( margin_scale_factor * (double)size.y) *
(double) GetScreen()->m_ZoomScalar;
int bestzoom = wxRound( MAX( zx, zy ) ); double bestzoom = MAX( zx, zy );
// keep it >= minimal existing zoom (can happen for very small components // keep it >= minimal existing zoom (can happen for very small components
// for instance when starting a new component // for instance when starting a new component
......
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
void CreateOptionToolbar(); void CreateOptionToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); // Returns the best zoom double BestZoom(); // Returns the best zoom
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
......
...@@ -39,12 +39,13 @@ ...@@ -39,12 +39,13 @@
* see http://trac.wxwidgets.org/ticket/9554 * see http://trac.wxwidgets.org/ticket/9554
* This is a workaround that is not a full fix, but remaining artifacts are acceptable * This is a workaround that is not a full fix, but remaining artifacts are acceptable
*/ */
static int SchematicZoomList[] = static double SchematicZoomList[] =
{ {
5, 7, 10, 15, 20, 30, 40, 60, 80, 120, 160, 230, 320, 480, 640, 800, 1280 0.5, 0.7, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 8.0,
12.0, 16.0, 23.0, 32.0, 48.0, 64.0, 80.0, 128.0
}; };
#define SCHEMATIC_ZOOM_LIST_CNT ( sizeof( SchematicZoomList ) / sizeof( int ) ) #define SCHEMATIC_ZOOM_LIST_CNT ( sizeof( SchematicZoomList ) / sizeof( SchematicZoomList[0] ) )
#define MM_TO_SCH_UNITS 1000.0 / 25.4 //schematic internal unites are mils #define MM_TO_SCH_UNITS 1000.0 / 25.4 //schematic internal unites are mils
......
...@@ -246,7 +246,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father, ...@@ -246,7 +246,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
m_auimgr.Update(); m_auimgr.Update();
// Now Drawpanel is sized, we can use BestZoom to show the component (if any) // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
BestZoom(); GetScreen()->SetZoom( BestZoom() );
} }
...@@ -345,7 +345,7 @@ void SCH_EDIT_FRAME::CreateScreens() ...@@ -345,7 +345,7 @@ void SCH_EDIT_FRAME::CreateScreens()
if( GetScreen() == NULL ) if( GetScreen() == NULL )
SetScreen( new SCH_SCREEN() ); SetScreen( new SCH_SCREEN() );
GetScreen()->SetZoom( 4 * GetScreen()->m_ZoomScalar ); GetScreen()->SetZoom( 32.0 );
GetScreen()->m_UndoRedoCountMax = 10; GetScreen()->m_UndoRedoCountMax = 10;
} }
...@@ -432,7 +432,7 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -432,7 +432,7 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
} }
int SCH_EDIT_FRAME::BestZoom() double SCH_EDIT_FRAME::BestZoom()
{ {
int dx, dy; int dx, dy;
wxSize size; wxSize size;
...@@ -445,12 +445,10 @@ int SCH_EDIT_FRAME::BestZoom() ...@@ -445,12 +445,10 @@ int SCH_EDIT_FRAME::BestZoom()
// Reserve no margin because best zoom shows the full page // Reserve no margin because best zoom shows the full page
// and margins are already included in function that draws the sheet refernces // and margins are already included in function that draws the sheet refernces
double margin_scale_factor = 1.0; double margin_scale_factor = 1.0;
double zx =(double) dx / ( margin_scale_factor * (double)size.x ) * double zx =(double) dx / ( margin_scale_factor * (double)size.x );
(double) GetScreen()->m_ZoomScalar; double zy = (double) dy / ( margin_scale_factor * (double)size.y );
double zy = (double) dy / ( margin_scale_factor * (double)size.y) *
(double) GetScreen()->m_ZoomScalar;
int bestzoom = wxRound( MAX( zx, zy ) ); double bestzoom = MAX( zx, zy );
GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) ); GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
......
...@@ -309,7 +309,7 @@ void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) ...@@ -309,7 +309,7 @@ void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
} }
int LIB_VIEW_FRAME::BestZoom() double LIB_VIEW_FRAME::BestZoom()
{ {
/* Please, note: wxMSW before version 2.9 seems have /* Please, note: wxMSW before version 2.9 seems have
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched: * problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
...@@ -319,7 +319,7 @@ int LIB_VIEW_FRAME::BestZoom() ...@@ -319,7 +319,7 @@ int LIB_VIEW_FRAME::BestZoom()
*/ */
LIB_COMPONENT* component = NULL; LIB_COMPONENT* component = NULL;
CMP_LIBRARY* lib; CMP_LIBRARY* lib;
int bestzoom = 16; // default value for bestzoom double bestzoom = 16.0; // default value for bestzoom
lib = CMP_LIBRARY::FindLibrary( m_libraryName ); lib = CMP_LIBRARY::FindLibrary( m_libraryName );
...@@ -339,14 +339,12 @@ int LIB_VIEW_FRAME::BestZoom() ...@@ -339,14 +339,12 @@ int LIB_VIEW_FRAME::BestZoom()
// Reserve a 10% margin around component bounding box. // Reserve a 10% margin around component bounding box.
double margin_scale_factor = 0.8; double margin_scale_factor = 0.8;
double zx =(double) BoundaryBox.GetWidth() / double zx =(double) BoundaryBox.GetWidth() /
( margin_scale_factor * (double)size.x ) * ( margin_scale_factor * (double)size.x );
(double) GetScreen()->m_ZoomScalar;
double zy = (double) BoundaryBox.GetHeight() / double zy = (double) BoundaryBox.GetHeight() /
( margin_scale_factor * (double)size.y) * ( margin_scale_factor * (double)size.y);
(double) GetScreen()->m_ZoomScalar;
// Calculates the best zoom // Calculates the best zoom
bestzoom = wxRound( MAX( zx, zy ) ); bestzoom = MAX( zx, zy );
// keep it >= minimal existing zoom (can happen for very small components // keep it >= minimal existing zoom (can happen for very small components
// like small power symbols // like small power symbols
......
...@@ -60,7 +60,7 @@ public: ...@@ -60,7 +60,7 @@ public:
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
int BestZoom(); double BestZoom();
void ClickOnLibList( wxCommandEvent& event ); void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event ); void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event ); void OnSetRelativeOffset( wxCommandEvent& event );
......
...@@ -148,13 +148,12 @@ void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -148,13 +148,12 @@ void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
} }
int GERBVIEW_FRAME::BestZoom() double GERBVIEW_FRAME::BestZoom()
{ {
// gives a minimal value to zoom, if no item in list // gives a minimal value to zoom, if no item in list
if( GetBoard()->m_Drawings == NULL ) if( GetBoard()->m_Drawings == NULL )
return 16 * GetScreen()->m_ZoomScalar; return 160.0;
double x, y;
EDA_RECT bbox; EDA_RECT bbox;
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;
...@@ -168,11 +167,11 @@ int GERBVIEW_FRAME::BestZoom() ...@@ -168,11 +167,11 @@ int GERBVIEW_FRAME::BestZoom()
wxSize size = DrawPanel->GetClientSize(); wxSize size = DrawPanel->GetClientSize();
x = (double) bbox.GetWidth() / (double) size.x; double x = (double) bbox.GetWidth() / (double) size.x;
y = (double) bbox.GetHeight() / (double) size.y; double y = (double) bbox.GetHeight() / (double) size.y;
GetScreen()->SetScrollCenterPosition( bbox.Centre() ); GetScreen()->SetScrollCenterPosition( bbox.Centre() );
int best_zoom = wxRound( MAX( x, y ) * (double) GetScreen()->m_ZoomScalar ); double best_zoom = MAX( x, y );
return best_zoom; return best_zoom;
} }
......
...@@ -68,7 +68,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title, ...@@ -68,7 +68,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); double BestZoom();
/** /**
* Function ReportMessage * Function ReportMessage
......
...@@ -122,9 +122,8 @@ public: ...@@ -122,9 +122,8 @@ public:
/* Grid and zoom values. */ /* Grid and zoom values. */
wxPoint m_GridOrigin; wxPoint m_GridOrigin;
wxArrayInt m_ZoomList; /* Array of standard zoom coefficients. */ wxArrayDouble m_ZoomList; /* Array of standard zoom (i.e. scale) coefficients. */
int m_Zoom; /* Current zoom coefficient. */ double m_Zoom; /* Current zoom coefficient. */
int m_ZoomScalar; /* Allow zooming to non-integer increments. */
bool m_IsPrinting; bool m_IsPrinting;
public: public:
...@@ -278,21 +277,21 @@ public: ...@@ -278,21 +277,21 @@ public:
* Note: the zoom factor is NOT the scaling factor * Note: the zoom factor is NOT the scaling factor
* the scaling factor is m_ZoomScalar * GetZoom() * the scaling factor is m_ZoomScalar * GetZoom()
*/ */
int GetZoom() const; double GetZoom() const;
/** /**
* Function SetZoom * Function SetZoom
* adjusts the current zoom factor * adjusts the current zoom factor
* @param coeff - Zoom coefficient. * @param coeff - Zoom coefficient.
*/ */
bool SetZoom( int coeff ); bool SetZoom( double 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 wxArrayInt& aZoomList ); void SetZoomList( const wxArrayDouble& aZoomList );
bool SetNextZoom(); bool SetNextZoom();
bool SetPreviousZoom(); bool SetPreviousZoom();
......
...@@ -114,7 +114,7 @@ public: ...@@ -114,7 +114,7 @@ public:
return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen(); return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen();
} }
int BestZoom(); virtual double BestZoom();
virtual void Show3D_Frame( wxCommandEvent& event ); virtual void Show3D_Frame( wxCommandEvent& event );
......
...@@ -225,7 +225,7 @@ public: ...@@ -225,7 +225,7 @@ public:
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ); void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition );
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
int BestZoom(); double BestZoom();
/** /**
* Function LocateAndShowItem * Function LocateAndShowItem
......
...@@ -468,10 +468,10 @@ public: ...@@ -468,10 +468,10 @@ public:
void Window_Zoom( EDA_RECT& Rect ); void Window_Zoom( EDA_RECT& Rect );
/* Return the zoom level which displays the full page on screen */ /* Return the zoom level which displays the full page on screen */
virtual int BestZoom() = 0; virtual double BestZoom() = 0;
/* Return the current zoom level */ /* Return the current zoom level */
int GetZoom( void ); double GetZoom( void );
void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ); void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width );
void PlotWorkSheet( PLOTTER *plotter, BASE_SCREEN* screen ); void PlotWorkSheet( PLOTTER *plotter, BASE_SCREEN* screen );
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
; General Product Description Definitions ; General Product Description Definitions
!define PRODUCT_NAME "KiCad" !define PRODUCT_NAME "KiCad"
!define PRODUCT_VERSION "2011.07.03" !define PRODUCT_VERSION "2011.07.04"
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" !define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/" !define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
!define COMPANY_NAME "" !define COMPANY_NAME ""
......
...@@ -99,14 +99,14 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard ) ...@@ -99,14 +99,14 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
/** /**
* Return the "best" zoom, i.e. the zoom which shows the entire board on screen * Return the "best" zoom, i.e. the zoom which shows the entire board on screen
*/ */
int PCB_BASE_FRAME::BestZoom( void ) double PCB_BASE_FRAME::BestZoom( void )
{ {
int dx, dy, ii, jj; int dx, dy;
int bestzoom; double ii, jj;
wxSize size; wxSize size;
if( m_Pcb == NULL ) if( m_Pcb == NULL )
return 32 * GetScreen()->m_ZoomScalar; return 32.0;
m_Pcb->ComputeBoundingBox(); m_Pcb->ComputeBoundingBox();
...@@ -115,19 +115,19 @@ int PCB_BASE_FRAME::BestZoom( void ) ...@@ -115,19 +115,19 @@ int PCB_BASE_FRAME::BestZoom( void )
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
if( size.x ) if( size.x )
ii = wxRound( ( (double) dx + ((double) size.x / 2.0) ) / (double) size.x ); ii = (double)(dx + ( size.x / 2) ) / (double) size.x;
else else
ii = 31; ii = 32.0;
if ( size.y ) if ( size.y )
jj = wxRound( ( (double) dy + ((double) size.y / 2.0) ) / (double) size.y ); jj = (double)( dy + (size.y / 2) ) / (double) size.y;
else else
jj = 31; jj = 32.0;
bestzoom = MAX( ii, jj ) + 1; double bestzoom = MAX( ii, jj );
GetScreen()->SetScrollCenterPosition( m_Pcb->m_BoundaryBox.Centre() ); GetScreen()->SetScrollCenterPosition( m_Pcb->m_BoundaryBox.Centre() );
return bestzoom * GetScreen()->m_ZoomScalar; return bestzoom ;
} }
...@@ -614,15 +614,9 @@ void PCB_BASE_FRAME::updateZoomSelectBox() ...@@ -614,15 +614,9 @@ void PCB_BASE_FRAME::updateZoomSelectBox()
{ {
msg = _( "Zoom " ); msg = _( "Zoom " );
if ( ( GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar ) == 0 ) wxString value;
msg << GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar; value.Printf( wxT( "%g" ), GetScreen()->m_ZoomList[i]);
else msg += value;
{
wxString value;
value.Printf( wxT( "%.1f" ),
(float)GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar );
msg += value;
}
m_SelZoomBox->Append( msg ); m_SelZoomBox->Append( msg );
......
...@@ -22,13 +22,14 @@ ...@@ -22,13 +22,14 @@
* Also useful in Gerbview for this reason. * Also useful in Gerbview for this reason.
* Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic functions ) * Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic functions )
*/ */
static const int PcbZoomList[] = static const double PcbZoomList[] =
{ {
5, 10, 15, 20, 30, 45, 70, 100, 150, 220, 350, 500, 800, 1200, 0.5, 1.0, 1.5, 2.0, 3.0, 4.5, 7.0,
2000, 3500, 5000, 10000, 20000 10.0, 15.0, 22.0, 35.0, 50.0, 80.0, 120.0,
200.0, 350.0, 500.0, 1000.0, 2000.0
}; };
#define PCB_ZOOM_LIST_CNT ( sizeof( PcbZoomList ) / sizeof( int ) ) #define PCB_ZOOM_LIST_CNT ( sizeof( PcbZoomList ) / sizeof( PcbZoomList[0] ) )
#define MM_TO_PCB_UNITS 10000.0 / 25.4 #define MM_TO_PCB_UNITS 10000.0 / 25.4
......
...@@ -506,6 +506,9 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibName, ...@@ -506,6 +506,9 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibName,
FILE* lib_module, * dest; FILE* lib_module, * dest;
bool added = true; bool added = true;
if( aModule == NULL )
return false;
aModule->DisplayInfo( this ); aModule->DisplayInfo( this );
if( !wxFileExists( aLibName ) ) if( !wxFileExists( aLibName ) )
......
...@@ -260,6 +260,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -260,6 +260,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
} }
case ID_MODEDIT_SAVE_LIBMODULE: case ID_MODEDIT_SAVE_LIBMODULE:
if( GetBoard()->m_Modules == NULL )
break;
{ {
wxFileName fn; wxFileName fn;
fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension ); fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
......
...@@ -93,7 +93,6 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, PCB_BASE_FRAME ) ...@@ -93,7 +93,6 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, PCB_BASE_FRAME )
// Menu 3D Frame // Menu 3D Frame
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame ) EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame )
EVT_UPDATE_UI( ID_MODEDIT_SAVE_LIBMODULE, WinEDA_ModuleEditFrame::OnUpdateLibSelected )
EVT_UPDATE_UI( ID_MODEDIT_DELETE_PART, WinEDA_ModuleEditFrame::OnUpdateLibSelected ) EVT_UPDATE_UI( ID_MODEDIT_DELETE_PART, WinEDA_ModuleEditFrame::OnUpdateLibSelected )
EVT_UPDATE_UI( ID_MODEDIT_EXPORT_PART, WinEDA_ModuleEditFrame::OnUpdateModuleSelected ) EVT_UPDATE_UI( ID_MODEDIT_EXPORT_PART, WinEDA_ModuleEditFrame::OnUpdateModuleSelected )
EVT_UPDATE_UI( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, EVT_UPDATE_UI( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
......
release version: release version:
2011 jul 03 2011 jul 04
files (.zip,.tgz): files (.zip,.tgz):
kicad-2011-07-03 kicad-2011-07-04
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