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