Commit 6e80810b authored by charras's avatar charras

change best zoom calculation in viewlib. Minor others changes and fixes.

parent 2611a547
...@@ -13,11 +13,9 @@ ...@@ -13,11 +13,9 @@
int ReadDelimitedText( char* dest, char* source, int NbMaxChar ) int ReadDelimitedText( char* dest, char* source, int NbMaxChar )
/*********************************************************************/ /*********************************************************************/
/* lit et place dans dest la chaine de caractere trouvee dans source, /* read a double-qute delimited text in source and put in in dest,
* delimitee par " . * read NbMaxChar bytes max
* transfere NbMaxChar max * return the byte count read in source
* retourne le nombre de codes lus dans source
* dest est termine par NULL
*/ */
{ {
int ii, jj, flag = 0; int ii, jj, flag = 0;
...@@ -47,8 +45,8 @@ int ReadDelimitedText( char* dest, char* source, int NbMaxChar ) ...@@ -47,8 +45,8 @@ int ReadDelimitedText( char* dest, char* source, int NbMaxChar )
char* StrPurge( char* text ) char* StrPurge( char* text )
/********************************/ /********************************/
/* Remove training space in text /* Remove training spaces in text
* return a pointer on the first not space char in text * return a pointer on the first non space char in text
*/ */
{ {
char* ptspace; char* ptspace;
...@@ -113,7 +111,7 @@ char* DateAndTime( char* aBuffer ) ...@@ -113,7 +111,7 @@ char* DateAndTime( char* aBuffer )
wxString DateAndTime() wxString DateAndTime()
/*******************************/ /*******************************/
/* return a wxString filled with the date and time /* return the date and time in a wxString
* note: does the same thing than strftime() * note: does the same thing than strftime()
* time is the local time. * time is the local time.
*/ */
...@@ -248,12 +246,10 @@ bool WildCompareString( const wxString& pattern, const wxString& string_to_tst, ...@@ -248,12 +246,10 @@ bool WildCompareString( const wxString& pattern, const wxString& string_to_tst,
bool case_sensitive ) bool case_sensitive )
/***********************************************************************/ /***********************************************************************/
/* compare 2 noms de composants, selon regles usuelles /* compare a string to a pattern
* ( Jokers * , ? , autoriss). * ( usual chars * and ? allowed).
* la chaine de reference est "pattern" * if case_sensitive == true, comparison is case sensitive
* si case_sensitive == TRUE, comparaison exacte * return true if match else false
* retourne TRUE si match
* retourne FALSE si differences
*/ */
{ {
const wxChar* cp = NULL, * mp = NULL; const wxChar* cp = NULL, * mp = NULL;
......
...@@ -91,18 +91,17 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist() ...@@ -91,18 +91,17 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
wxString schematic_timestamp; /* buffer for component time stamp */ wxString schematic_timestamp; /* buffer for component time stamp */
wxString footprint_name; /* buffer for component footprint field */ wxString footprint_name; /* buffer for component footprint field */
wxString component_value; /* buffer for component values (470K, 22nF ...) */ wxString component_value; /* buffer for component values (470K, 22nF ...) */
char* ptchar; /* pointeur de service */ char* ptchar;
STORECMP* Cmp; STORECMP* Cmp;
modified = 0; modified = 0;
Rjustify = 0; Rjustify = 0;
g_FlagEESchema = FALSE; g_FlagEESchema = FALSE;
/* Raz buffer et variable de gestion */ /* Clear components buffer */
if( g_BaseListeCmp ) if( g_BaseListeCmp )
FreeMemoryComponants(); FreeMemoryComponants();
/* Ouverture du fichier source */
source = wxFopen( FFileName, wxT( "rt" ) ); source = wxFopen( FFileName, wxT( "rt" ) );
if( source == 0 ) if( source == 0 )
{ {
...@@ -437,7 +436,7 @@ int CmpCompare( void* mod1, void* mod2 ) ...@@ -437,7 +436,7 @@ int CmpCompare( void* mod1, void* mod2 )
/****************************************/ /****************************************/
/* /*
* Function compare() for qsort() : alphabetic sorting, with numbering order * Compare function for qsort() : alphabetic sorting, with numbering order
*/ */
{ {
int ii; int ii;
...@@ -446,7 +445,6 @@ int CmpCompare( void* mod1, void* mod2 ) ...@@ -446,7 +445,6 @@ int CmpCompare( void* mod1, void* mod2 )
pt1 = *( (STORECMP**) mod1 ); pt1 = *( (STORECMP**) mod1 );
pt2 = *( (STORECMP**) mod2 ); pt2 = *( (STORECMP**) mod2 );
//FIXME: ii = StrNumICmp( pt1->m_Reference.GetData(), pt2->m_Reference.GetData() );
ii = StrNumICmp( (const wxChar*) pt1->m_Reference, (const wxChar*) pt2->m_Reference );
return ii; return ii;
} }
...@@ -265,11 +265,10 @@ int WinEDA_LibeditFrame::BestZoom() ...@@ -265,11 +265,10 @@ int WinEDA_LibeditFrame::BestZoom()
} }
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
size.x -= 60; // Pour marges haut et bas size -= wxSize(100,100); // reserve 100 mils margin
ii = abs( dx / size.x ); ii = abs( dx / size.x );
jj = abs( dy / size.y ); jj = abs( dy / size.y );
/* determination du zoom existant le plus proche */
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
if( CurrentLibEntry ) if( CurrentLibEntry )
......
...@@ -41,9 +41,9 @@ END_EVENT_TABLE() ...@@ -41,9 +41,9 @@ END_EVENT_TABLE()
/******************************************************************************/ /******************************************************************************/
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
LibraryStruct* Library, LibraryStruct* Library,
wxSemaphore* semaphore ) : wxSemaphore* semaphore ) :
WinEDA_DrawFrame( father, VIEWER_FRAME, _( "Library browser" ), WinEDA_DrawFrame( father, VIEWER_FRAME, _( "Library browser" ),
wxDefaultPosition, wxDefaultSize ) wxDefaultPosition, wxDefaultSize )
/******************************************************************************/ /******************************************************************************/
...@@ -193,11 +193,11 @@ int WinEDA_ViewlibFrame::BestZoom() ...@@ -193,11 +193,11 @@ int WinEDA_ViewlibFrame::BestZoom()
EDA_Rect BoundaryBox = CurrentLibEntry->GetBoundaryBox( g_ViewUnit, g_ViewConvert ); EDA_Rect BoundaryBox = CurrentLibEntry->GetBoundaryBox( g_ViewUnit, g_ViewConvert );
itemsize = BoundaryBox.GetSize(); itemsize = BoundaryBox.GetSize();
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
size.x -= 60; // sub a margin size -= wxSize( 100, 100 ); // reserve a 100 mils margin
ii = itemsize.x / size.x; ii = (double) itemsize.x / size.x;
jj = itemsize.y / size.y; jj = itemsize.y / size.y;
bestzoom = MAX( ii, jj ); bestzoom = MAX( ii, jj ) + 1;
GetScreen()->m_Curseur = BoundaryBox.Centre(); GetScreen()->m_Curseur = BoundaryBox.Centre();
...@@ -207,7 +207,7 @@ int WinEDA_ViewlibFrame::BestZoom() ...@@ -207,7 +207,7 @@ int WinEDA_ViewlibFrame::BestZoom()
/******************************************/ /******************************************/
void WinEDA_ViewlibFrame::ReCreateListLib() void WinEDA_ViewlibFrame::ReCreateListLib()
/*******************************************/ /******************************************/
{ {
const wxChar** ListNames, ** names; const wxChar** ListNames, ** names;
int ii; int ii;
......
No preview for this file type
This diff is collapsed.
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