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

Modify my previous patch about zoom issues in eeschema (remove zoom limitations).

Also fix a minor zoom page issue in Libedit.
wxMSW, version 2.8.x must be patched.
Some zoom values smaller than 3 to 5 create artifacts on screen, mainly values < 1.
(corresponding to draw scale factor > 1 )

 * see http://trac.wxwidgets.org/ticket/9554
 
This is fixed in version 2.9.x
Workaround: ( that is not a full fix, but remaining artifacts are acceptable )
edit file  edit file <wxWidgets>/src/msw/dc.cpp
 >> search for line
    static const int VIEWPORT_EXTENT = 1000;
 >> and replace by
    static const int VIEWPORT_EXTENT = 10000;
parent 88118b75
......@@ -33,8 +33,12 @@ If windows, then try running g++ and make from within your msys bash shell.
Install or Build wxWidgets
--------------------------
WARNING:
see wxWidgets_patch_notes.txt for patches and issues in wxWidgets.
If on windows, download
http://sourceforge.net/projects/wxwindows/files/wxAll/2.8.10/wxWidgets-2.8.10.zip/download
http://sourceforge.net/projects/wxwindows/files/wxAll/2.8.10/wxWidgets-2.8.12.zip/download
or a newer version.
Start msys so you have a bash shell. Decide where your wxWidgets build directory
will be. It must be where you can access it from within the msys environment,
......@@ -121,7 +125,11 @@ command prompt.
Obtain Sources
--------------
You can use the subversion repository or a tar file for this. See the wiki.
You can use the Launchpad repository or a tar file for this. See the wiki.
Launchpad repository handle 2 branches:
- a testing branch (used by developers)
- a stable branch (a copy of the testing branch, when this testing branch is near a stable state))
Create Makefiles with CMake
......@@ -183,6 +191,16 @@ Fine-tune Build Process
-----------------------
These should be set from command line:
One of these 2 option *must* be set to ON:
KICAD_STABLE_VERSION or KICAD_TESTING_VERSION
** KICAD_STABLE_VERSION:
set this option to ON to build the stable version of KICAD. mainly used to set version ID
Usually set for kicad version downloaded from stable branch
** KICAD_TESTING_VERSION
set this option to ON to build the stable version of KICAD. mainly used to set version ID
Usually set for kicad version downloaded from testing branch
CMAKE_BUILD_TYPE Release/Debug (REQUIRED)
Choose build type: Release/Debug.
......
......@@ -20,6 +20,37 @@ So use a very recent version (>= 2.8.10 (that also solve other bugs)
wxWidgets patch:
wxMSW, version 2.8.x
Some zoom values smaller than 3 to 5 create artifacts on screen, mainly values < 1.
(corresponding to draw scale factor > 1 )
See http://trac.wxwidgets.org/ticket/9554 (and 11669).
This is fixed in version 2.9.x
This is a workaround that is not a full fix, but remaining artifacts are acceptable
edit file edit file <wxWidgets>/src/msw/dc.cpp
>> search for line
static const int VIEWPORT_EXTENT = 1000;
>> and replace by
static const int VIEWPORT_EXTENT = 10000;
wxWidgets 2.9.1 (all platforms)
Has a problem when using the built in string to double conversion:
In countries using a comm instead of a point as floating number separator
after calling this conversion function, the comma is changed in point.
(Happens after reading a parameter stored in a wxConfig structure, if this
parameter is a double)
Workaround:
Use a version > 2.9.2
Currently ( 2011, april 12 ) the 2.9.2 is not yet finalized
(and can be found only on the wxWidgets snv server)
can be fixed by replacing the file <wxWidgets-2.9.1>/src/common/xlocale.cpp
by the corresponding file from the 2.9.2 version (from wxWidgets svn server)
*************************************************************************************
wxGTK version: All
*************************************************************************************
......
......@@ -209,8 +209,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
UpdateAliasSelectList();
UpdatePartSelectList();
Show( true );
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
......@@ -243,6 +241,8 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
m_auimgr.Update();
Show( true );
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, ID_ZOOM_PAGE );
wxPostEvent( this, evt );
}
......@@ -344,7 +344,13 @@ void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
int LIB_EDIT_FRAME::BestZoom()
{
int dx, dy, ii, jj;
/* Please, note: wxMSW before version 2.9 seems have
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
* edit file <wxWidgets>/src/msw/dc.cpp
* search for line static const int VIEWPORT_EXTENT = 1000;
* and replace by static const int VIEWPORT_EXTENT = 10000;
*/
int dx, dy;
wxSize size;
EDA_RECT BoundaryBox;
......@@ -353,7 +359,8 @@ int LIB_EDIT_FRAME::BestZoom()
BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert );
dx = BoundaryBox.GetWidth();
dy = BoundaryBox.GetHeight();
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 )
);
}
else
{
......@@ -362,43 +369,22 @@ int LIB_EDIT_FRAME::BestZoom()
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
}
/*
* This fixes a bug where the client size of the drawing area is not
* correctly reported until after the window is shown. This is most
* likely due to the unmanaged windows ( vertical tool bars and message
* panel ) that are drawn in the main window which wxWidgets knows
* nothing about. When the library editor is reopened with a component
* already loading, the zoom will be calculated correctly.
*/
if( !IsShownOnScreen() )
{
if( m_clientSize != wxSize( -1, -1 ) )
size = m_clientSize;
else
size = DrawPanel->GetClientSize();
}
else
{
if( m_clientSize == wxSize( -1, -1 ) )
m_clientSize = DrawPanel->GetClientSize();
size = m_clientSize;
}
// Reserve a 10% margin around component bounding box.
double margin_scale_factor = 0.8;
double zx =(double) dx / ( margin_scale_factor * (double)size.x ) *
(double) GetScreen()->m_ZoomScalar;
double zy = (double) dx / ( margin_scale_factor * (double)size.y) *
(double) GetScreen()->m_ZoomScalar;
size -= wxSize( 25, 25 ); // reserve 100 mils margin
ii = wxRound( ( (double) dx / (double) size.x ) * (double) GetScreen()->m_ZoomScalar );
jj = wxRound( ( (double) dy / (double) size.y ) * (double) GetScreen()->m_ZoomScalar );
int bestzoom = wxRound( MAX( zx, zy ) );
// keep it >= minimal existing zoom (can happen for very small components
// for instance when starting a new component
if( bestzoom < GetScreen()->m_ZoomList[0] )
bestzoom = GetScreen()->m_ZoomList[0];
int bestzoom = MAX( ii + 1, jj + 1 );
#if defined( __WINDOWS__ ) && !wxCHECK_VERSION(2, 9, 1)
/* This is a workaround: wxWidgets (wxMSW) before version 2.9 seems have
* problems with scale values < 1
* corresponding to values < GetScreen()->m_ZoomScalar
* So we keep bestzoom >= GetScreen()->m_ZoomScalar
*/
if( bestzoom < GetScreen()->m_ZoomScalar )
bestzoom = GetScreen()->m_ZoomScalar;
#endif
return bestzoom;
}
......
......@@ -349,10 +349,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Hierarchical label
text = AddHotkeyName( _( "Hierarchical label" ), s_Schematic_Hokeys_Descr,
HK_ADD_HLABEL, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT, text,
HELP_PLACE_HIER_LABEL, wxITEM_NORMAL );
SET_BITMAP( add_hierarchical_label_xpm );
placeMenu->Append( item );
text = AddHotkeyName( _( "Hierarchical label" ), s_Schematic_Hokeys_Descr,
HK_ADD_HLABEL, false ); // add comment, not a shortcut
ADD_MENUITEM_WITH_HELP( placeMenu, ID_HIERLABEL_BUTT,
text, HELP_PLACE_HIER_LABEL,
add_hierarchical_label_xpm );
// Hierarchical sheet
text = AddHotkeyName( _( "Hierarchical sheet" ), s_Schematic_Hokeys_Descr,
......
......@@ -30,25 +30,18 @@
/* Default EESchema zoom values. Limited to 17 values to keep a decent size
* to menus
*/
#if defined( __WINDOWS__ ) && !wxCHECK_VERSION(2, 9, 1)
/* Please, note: wxWidgets (wxMSW) before version 2.9 seems have
* problems with scale values < 1
* because scale value is SchematicZoomList[x] / 10
* ( in fact is SchematicZoomList[x] / m_ZoomScalar )
* do not use values smaller than 10 without testing them under wxWidgets versions < 2.9
* value like 0.5 seems work
/* Please, note: wxMSW before version 2.9 seems have
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
* edit file <wxWidgets>/src/msw/dc.cpp
* search for line static const int VIEWPORT_EXTENT = 1000;
* and replace by static const int VIEWPORT_EXTENT = 10000;
* see http://trac.wxwidgets.org/ticket/9554
* This is a workaround that is not a full fix, but remaining artifacts are acceptable
*/
static int SchematicZoomList[] =
{
5, 10, 15, 20, 30, 40, 60, 80, 120, 160, 230, 320, 480, 640, 800, 1280
};
#else
static int SchematicZoomList[] =
{
5, 7, 10, 15, 20, 30, 40, 60, 80, 120, 160, 230, 320, 480, 640, 800, 1280
};
#endif
#define SCHEMATIC_ZOOM_LIST_CNT ( sizeof( SchematicZoomList ) / sizeof( int ) )
#define MM_TO_SCH_UNITS 1000.0 / 25.4 //schematic internal unites are mils
......
......@@ -242,6 +242,9 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
m_auimgr.AddPane( MsgPanel, wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
// Now Drawpanel is sized, we can use BestZoom to show the component (if any)
BestZoom();
}
......@@ -428,21 +431,18 @@ int SCH_EDIT_FRAME::BestZoom()
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
size = DrawPanel->GetClientSize();
int ii = wxRound( (double) dx / size.x * (double) GetScreen()->m_ZoomScalar );
int jj = wxRound( (double) dx / size.x * (double) GetScreen()->m_ZoomScalar );
int bestzoom = MAX( ii, jj );
GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
// Reserve no margin because best zoom shows the full page
// and margins are already included in function that draws the sheet refernces
double margin_scale_factor = 1.0;
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) GetScreen()->m_ZoomScalar;
#if defined( __WINDOWS__ ) && !wxCHECK_VERSION(2, 9, 1)
/* This is a workaround: wxWidgets (wxMSW) before version 2.9 seems have
* problems with scale values < 1
* corresponding to values < GetScreen()->m_ZoomScalar
* So we keep bestzoom >= GetScreen()->m_ZoomScalar
*/
if( bestzoom < GetScreen()->m_ZoomScalar )
bestzoom = GetScreen()->m_ZoomScalar;
#endif
int bestzoom = wxRound( MAX( zx, zy ) );
GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
return bestzoom;
}
......
......@@ -313,6 +313,12 @@ void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
int LIB_VIEW_FRAME::BestZoom()
{
/* Please, note: wxMSW before version 2.9 seems have
* problems with zoom values < 1 ( i.e. userscale > 1) and needs to be patched:
* edit file <wxWidgets>/src/msw/dc.cpp
* search for line static const int VIEWPORT_EXTENT = 1000;
* and replace by static const int VIEWPORT_EXTENT = 10000;
*/
LIB_COMPONENT* component = NULL;
CMP_LIBRARY* lib;
int bestzoom = 16; // default value for bestzoom
......@@ -333,21 +339,21 @@ int LIB_VIEW_FRAME::BestZoom()
EDA_RECT BoundaryBox = component->GetBoundingBox( m_unit, m_convert );
// Reserve a 10% margin around component bounding box.
double zx =(double) BoundaryBox.GetWidth() / ( 0.8 * (double)size.x ) *
double margin_scale_factor = 0.8;
double zx =(double) BoundaryBox.GetWidth() /
( margin_scale_factor * (double)size.x ) *
(double) GetScreen()->m_ZoomScalar;
double zy = (double) BoundaryBox.GetHeight() / ( 0.8 * (double)size.y) *
double zy = (double) BoundaryBox.GetHeight() /
( margin_scale_factor * (double)size.y) *
(double) GetScreen()->m_ZoomScalar;
// Calculates the best zoom
bestzoom = wxRound( MAX( zx, zy ) );
#if defined( __WINDOWS__ ) && !wxCHECK_VERSION(2, 9, 1)
/* This is a workaround: wxWidgets (wxMSW) before version 2.9 seems have
* problems with scale values < 1
* corresponding to values < GetScreen()->m_ZoomScalar
* So we keep bestzoom >= GetScreen()->m_ZoomScalar
*/
if( bestzoom < GetScreen()->m_ZoomScalar )
bestzoom = GetScreen()->m_ZoomScalar;
#endif
// keep it >= minimal existing zoom (can happen for very small components
// like small power symbols
if( bestzoom < GetScreen()->m_ZoomList[0] )
bestzoom = GetScreen()->m_ZoomList[0];
GetScreen()->SetScrollCenterPosition( BoundaryBox.Centre() );
......
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