Commit 8f2e7068 authored by dickelbeck's avatar dickelbeck

const of GetZoom()

parent 57126e83
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/*******************************************************/ /*******************************************************/
/* Class BASE_SCREEN: classe de gestion d'un affichage */ /* Class BASE_SCREEN: classe de gestion d'un affichage */
/*******************************************************/ /*******************************************************/
BASE_SCREEN::BASE_SCREEN( int idscreen, KICAD_T aType ) : BASE_SCREEN::BASE_SCREEN( int idscreen, KICAD_T aType ) :
EDA_BaseStruct( aType ) EDA_BaseStruct( aType )
{ {
EEDrawList = NULL; /* Schematic items list */ EEDrawList = NULL; /* Schematic items list */
...@@ -37,10 +37,10 @@ BASE_SCREEN::~BASE_SCREEN() ...@@ -37,10 +37,10 @@ BASE_SCREEN::~BASE_SCREEN()
{ {
if( m_ZoomList ) if( m_ZoomList )
free( m_ZoomList ); free( m_ZoomList );
if( m_GridList ) if( m_GridList )
free( m_GridList ); free( m_GridList );
ClearUndoRedoList(); ClearUndoRedoList();
} }
...@@ -92,7 +92,7 @@ void BASE_SCREEN::InitDatas() ...@@ -92,7 +92,7 @@ void BASE_SCREEN::InitDatas()
} }
// DrawOrg est rendu multiple du zoom min : // DrawOrg est rendu multiple du zoom min :
m_DrawOrg.x -= m_DrawOrg.x % 256; m_DrawOrg.x -= m_DrawOrg.x % 256;
m_DrawOrg.y -= m_DrawOrg.y % 256; m_DrawOrg.y -= m_DrawOrg.y % 256;
m_O_Curseur = m_Curseur; m_O_Curseur = m_Curseur;
...@@ -113,7 +113,7 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos ) ...@@ -113,7 +113,7 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
wxPoint curpos; wxPoint 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 = ScreenPos.x * GetZoom();
curpos.y = ScreenPos.y * GetZoom(); curpos.y = ScreenPos.y * GetZoom();
...@@ -174,28 +174,30 @@ wxSize BASE_SCREEN::ReturnPageSize() ...@@ -174,28 +174,30 @@ wxSize BASE_SCREEN::ReturnPageSize()
} }
/********************************************/ /**************************************************/
void BASE_SCREEN::SetZoomList( int* zoomlist ) void BASE_SCREEN::SetZoomList( const int* zoomlist )
/********************************************/ /**************************************************/
/* init liste des zoom (NULL terminated) /* init liste des zoom (NULL terminated)
*/ */
{ {
int ii, nbitems, * zoom; int nbitems;
const int* zoom;
// Decompte des items // get list length
for( nbitems = 1, zoom = zoomlist; ; zoom++, nbitems++ ) for( nbitems = 1, zoom = zoomlist; ; zoom++, nbitems++ )
{ {
if( *zoom == 0 ) if( *zoom == 0 )
break; break;
} }
// Init liste // resize our list
if( m_ZoomList ) if( m_ZoomList )
free( m_ZoomList ); free( m_ZoomList );
m_ZoomList = (int*) MyZMalloc( nbitems * sizeof( int) );
m_ZoomList = (int*) MyZMalloc( nbitems * sizeof(int) );
int ii;
for( ii = 0, zoom = zoomlist; ii < nbitems; zoom++, ii++ ) for( ii = 0, zoom = zoomlist; ii < nbitems; zoom++, ii++ )
{ {
m_ZoomList[ii] = *zoom; m_ZoomList[ii] = *zoom;
...@@ -212,10 +214,9 @@ void BASE_SCREEN::SetFirstZoom() ...@@ -212,10 +214,9 @@ void BASE_SCREEN::SetFirstZoom()
} }
/****************************/ /******************************/
int BASE_SCREEN::GetZoom() int BASE_SCREEN::GetZoom() const
/****************************/ /******************************/
/* retourne le coeff de zoom */
{ {
return m_Zoom; return m_Zoom;
} }
...@@ -564,23 +565,23 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList() ...@@ -564,23 +565,23 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList()
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level * @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree. * of nesting of this object within the overall tree.
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) void BASE_SCREEN::Show( int nestLevel, std::ostream& os )
{ {
EDA_BaseStruct* item = EEDrawList; EDA_BaseStruct* item = EEDrawList;
// for now, make it look like XML, expand on this later. // for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
">\n"; ">\n";
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {
item->Show( nestLevel+1, os ); item->Show( nestLevel+1, os );
} }
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
} }
#endif #endif
......
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