eeschema: solved: incorrect draw origin setup for viewlib and libedit
This commit is contained in:
parent
e29d89c7c7
commit
ceeb27cfd5
|
@ -110,7 +110,7 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
|
||||||
SetGrid( wxSize( 50, 50 ) ); /* pas de la grille */
|
SetGrid( wxSize( 50, 50 ) ); /* pas de la grille */
|
||||||
m_UndoRedoCountMax = 10;
|
m_UndoRedoCountMax = 10;
|
||||||
m_RefCount = 0;
|
m_RefCount = 0;
|
||||||
m_Center = false;
|
m_Center = false; // Suitable for schematic only. for libedit and viewlib, must be set to true
|
||||||
InitDatas();
|
InitDatas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
|
||||||
// Give an icon
|
// Give an icon
|
||||||
SetIcon( wxIcon( libedit_xpm ) );
|
SetIcon( wxIcon( libedit_xpm ) );
|
||||||
SetBaseScreen( g_ScreenLib );
|
SetBaseScreen( g_ScreenLib );
|
||||||
|
GetScreen()->m_Center = true; // set to true to have the coordinates origine -0,0) centered on screen
|
||||||
GetSettings();
|
GetSettings();
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
if( DrawPanel )
|
if( DrawPanel )
|
||||||
|
@ -79,6 +80,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
|
||||||
ReCreateHToolbar();
|
ReCreateHToolbar();
|
||||||
ReCreateVToolbar();
|
ReCreateVToolbar();
|
||||||
DisplayLibInfos();
|
DisplayLibInfos();
|
||||||
|
BestZoom();
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
/* viewlib_frame.cpp - fonctions des classes du type WinEDA_ViewlibFrame */
|
/* viewlib_frame.cpp - fonctions des classes du type WinEDA_ViewlibFrame */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#ifdef __GNUG__
|
|
||||||
#pragma implementation
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -23,8 +19,7 @@
|
||||||
/* class WinEDA_ViewlibFrame */
|
/* class WinEDA_ViewlibFrame */
|
||||||
/*****************************/
|
/*****************************/
|
||||||
BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, wxFrame )
|
BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, wxFrame )
|
||||||
COMMON_EVENTS_DRAWFRAME
|
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow )
|
||||||
EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow )
|
|
||||||
EVT_SIZE( WinEDA_ViewlibFrame::OnSize )
|
EVT_SIZE( WinEDA_ViewlibFrame::OnSize )
|
||||||
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
|
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
|
||||||
|
|
||||||
|
@ -45,19 +40,18 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, wxFrame )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/****************/
|
/******************************************************************************/
|
||||||
/* Constructeur */
|
|
||||||
/****************/
|
|
||||||
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
|
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
|
||||||
LibraryStruct* Library,
|
LibraryStruct* Library,
|
||||||
wxSemaphore* semaphore ) :
|
wxSemaphore* semaphore ) :
|
||||||
WinEDA_DrawFrame( father, VIEWER_FRAME, parent, _( "Library browser" ),
|
WinEDA_DrawFrame( father, VIEWER_FRAME, parent, _( "Library browser" ),
|
||||||
wxDefaultPosition, wxDefaultSize )
|
wxDefaultPosition, wxDefaultSize )
|
||||||
|
/******************************************************************************/
|
||||||
{
|
{
|
||||||
m_FrameName = wxT( "ViewlibFrame" );
|
m_FrameName = wxT( "ViewlibFrame" );
|
||||||
|
|
||||||
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
|
m_Draw_Axis = TRUE; // TRUE to dispaly Axis
|
||||||
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
|
m_Draw_Grid = TRUE; // TRUE to display grid
|
||||||
|
|
||||||
// Give an icon
|
// Give an icon
|
||||||
SetIcon( wxIcon( library_browse_xpm ) );
|
SetIcon( wxIcon( library_browse_xpm ) );
|
||||||
|
@ -69,7 +63,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
|
||||||
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
|
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
|
||||||
|
|
||||||
SetBaseScreen( new SCH_SCREEN() );
|
SetBaseScreen( new SCH_SCREEN() );
|
||||||
GetScreen()->SetZoom( 16 );
|
GetScreen()->m_Center = true; // set to true to have the coordinates origine -0,0) centered on screen
|
||||||
|
|
||||||
if( Library == NULL )
|
if( Library == NULL )
|
||||||
{
|
{
|
||||||
|
@ -99,15 +93,14 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
|
||||||
if( m_LibList )
|
if( m_LibList )
|
||||||
ReCreateListLib();
|
ReCreateListLib();
|
||||||
DisplayLibInfos();
|
DisplayLibInfos();
|
||||||
|
BestZoom();
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************/
|
/*******************************************/
|
||||||
/* Destructeur */
|
|
||||||
/***************/
|
|
||||||
|
|
||||||
WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
|
WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
|
||||||
|
/*******************************************/
|
||||||
{
|
{
|
||||||
delete GetScreen();
|
delete GetScreen();
|
||||||
SetBaseScreen( 0 );
|
SetBaseScreen( 0 );
|
||||||
|
@ -176,9 +169,9 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/***********************************/
|
||||||
int WinEDA_ViewlibFrame::BestZoom()
|
int WinEDA_ViewlibFrame::BestZoom()
|
||||||
/*******************************************/
|
/***********************************/
|
||||||
{
|
{
|
||||||
int bestzoom, ii, jj;
|
int bestzoom, ii, jj;
|
||||||
wxSize size, itemsize;
|
wxSize size, itemsize;
|
||||||
|
@ -199,17 +192,10 @@ int WinEDA_ViewlibFrame::BestZoom()
|
||||||
itemsize = BoundaryBox.GetSize();
|
itemsize = BoundaryBox.GetSize();
|
||||||
|
|
||||||
size = DrawPanel->GetClientSize();
|
size = DrawPanel->GetClientSize();
|
||||||
size.x -= 60; // Pour marges haut et bas
|
size.x -= 60; // sub a margin
|
||||||
ii = itemsize.x / size.x;
|
ii = itemsize.x / size.x;
|
||||||
jj = itemsize.y / size.y;
|
jj = itemsize.y / size.y;
|
||||||
ii = MAX( ii, jj );
|
bestzoom = MAX( ii, jj );
|
||||||
|
|
||||||
/* determination du zoom existant le plus proche */
|
|
||||||
for( bestzoom = 1; bestzoom < 512; bestzoom <<= 1 )
|
|
||||||
{
|
|
||||||
if( bestzoom > ii )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetScreen()->m_Curseur = BoundaryBox.Centre();
|
GetScreen()->m_Curseur = BoundaryBox.Centre();
|
||||||
|
|
||||||
|
@ -217,9 +203,9 @@ int WinEDA_ViewlibFrame::BestZoom()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
/******************************************/
|
||||||
void WinEDA_ViewlibFrame::ReCreateListLib()
|
void WinEDA_ViewlibFrame::ReCreateListLib()
|
||||||
/***************************************************/
|
/*******************************************/
|
||||||
{
|
{
|
||||||
const wxChar** ListNames, ** names;
|
const wxChar** ListNames, ** names;
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -243,8 +229,8 @@ void WinEDA_ViewlibFrame::ReCreateListLib()
|
||||||
|
|
||||||
free( ListNames );
|
free( ListNames );
|
||||||
|
|
||||||
/* Librairie courante peut etre non retrouv<75>e en liste
|
/* Clear current library because it can be deleted after a config change
|
||||||
* (peut etre effac<EFBFBD>e lors d'une modification de configuration) */
|
*/
|
||||||
if( !found )
|
if( !found )
|
||||||
{
|
{
|
||||||
g_CurrentViewLibraryName.Empty();
|
g_CurrentViewLibraryName.Empty();
|
||||||
|
@ -269,8 +255,8 @@ void WinEDA_ViewlibFrame::ReCreateListCmp()
|
||||||
m_CmpList->Clear();
|
m_CmpList->Clear();
|
||||||
ii = 0;
|
ii = 0;
|
||||||
g_CurrentViewComponentName.Empty();
|
g_CurrentViewComponentName.Empty();
|
||||||
g_ViewConvert = 1; /* Vue normal / convert */
|
g_ViewConvert = 1; /* Select normal/"de morgan" shape */
|
||||||
g_ViewUnit = 1; /* unit<EFBFBD> a afficher (A, B ..) */
|
g_ViewUnit = 1; /* Selec unit to display for multiple parts per package */
|
||||||
if( Library )
|
if( Library )
|
||||||
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Library->m_Entries, FALSE );
|
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Library->m_Entries, FALSE );
|
||||||
while( LibEntry )
|
while( LibEntry )
|
||||||
|
@ -325,7 +311,7 @@ void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event )
|
||||||
void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event )
|
void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/* Export to schematic the current viewed component, and close the library browser
|
/* Export the current component to schematic and close the library browser
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ii = m_CmpList->GetSelection();
|
int ii = m_CmpList->GetSelection();
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -170,7 +170,6 @@ typedef enum { /* definition de l'etat du block */
|
||||||
STATE_BLOCK_END, /* Block initialise: 2eme point defini */
|
STATE_BLOCK_END, /* Block initialise: 2eme point defini */
|
||||||
STATE_BLOCK_MOVE, /* Block en deplacement */
|
STATE_BLOCK_MOVE, /* Block en deplacement */
|
||||||
STATE_BLOCK_STOP /* Block fixe (fin de deplacement) */
|
STATE_BLOCK_STOP /* Block fixe (fin de deplacement) */
|
||||||
|
|
||||||
} BlockState;
|
} BlockState;
|
||||||
|
|
||||||
/* codes des differentes commandes sur block: */
|
/* codes des differentes commandes sur block: */
|
||||||
|
@ -190,7 +189,6 @@ typedef enum {
|
||||||
BLOCK_SELECT_ITEMS_ONLY,
|
BLOCK_SELECT_ITEMS_ONLY,
|
||||||
BLOCK_MIRROR_X,
|
BLOCK_MIRROR_X,
|
||||||
BLOCK_MIRROR_Y
|
BLOCK_MIRROR_Y
|
||||||
|
|
||||||
} CmdBlockType;
|
} CmdBlockType;
|
||||||
|
|
||||||
|
|
||||||
|
@ -235,7 +233,10 @@ public:
|
||||||
wxSize m_SizeVisu; /* taille en pixels de l'ecran (fenetre de visu
|
wxSize m_SizeVisu; /* taille en pixels de l'ecran (fenetre de visu
|
||||||
* Utile pour recadrer les affichages lors de la
|
* Utile pour recadrer les affichages lors de la
|
||||||
* navigation dans la hierarchie */
|
* navigation dans la hierarchie */
|
||||||
bool m_Center; // TRUE: coord algebriques, FALSE: coord >= 0
|
bool m_Center; /* fix the coordinate (0,0) position on screen : if TRUE (0,0) in centered on screen
|
||||||
|
* TRUE: when coordiantaes can be < 0 and > 0 all but schematic
|
||||||
|
* FALSE: when coordinates can be only >= 0 Schematic
|
||||||
|
*/
|
||||||
bool m_FirstRedraw;
|
bool m_FirstRedraw;
|
||||||
|
|
||||||
/* Gestion des editions */
|
/* Gestion des editions */
|
||||||
|
@ -322,6 +323,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
//----<zoom stuff>----------------------------------------------------------
|
//----<zoom stuff>----------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetZoom
|
* Function GetZoom
|
||||||
* returns the current zoom factor
|
* returns the current zoom factor
|
||||||
|
@ -380,7 +382,9 @@ public:
|
||||||
return wxT( "BASE_SCREEN" );
|
return wxT( "BASE_SCREEN" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
@ -389,8 +393,8 @@ public:
|
||||||
* @param os The ostream& to output to.
|
* @param os The ostream& to output to.
|
||||||
*/
|
*/
|
||||||
void Show( int nestLevel, std::ostream& os );
|
void Show( int nestLevel, std::ostream& os );
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue