Commit 3066c705 authored by stambaughw's avatar stambaughw

Implement wxDC coordinate handling and wxGCDC.

* Implement code to allow wxDC to handle coordinate conversions between
  device and drawing units.
* Add build settings to enable wxGCDC for wxGraphicsContext testing.
* Remove wxAUI conditional build cruft as it is now required to build
  Kicad.
* Fix scroll increment size regression to prevent jumping around the
  zoom center position.
* Add find GDI+ cmake module for building on WXMSW when wxGraphicsContext
  is enabled.
parent 3f0a7f8d
......@@ -78,7 +78,6 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
// Make a Pcb3D_GLCanvas
m_Canvas = new Pcb3D_GLCanvas( this );
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
......@@ -101,7 +100,6 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.Update();
#endif
}
......
......@@ -21,10 +21,6 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar*) m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
wxBitmap( import3d_xpm ),
......
......@@ -192,10 +192,8 @@ public:
wxPoint m_FramePos;
wxSize m_FrameSize;
#if defined(KICAD_AUIMANAGER)
wxAuiManager m_auimgr;
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); };
#endif
private:
wxString m_FrameName; // name used for writing and reading setup
......
......@@ -18,10 +18,10 @@ option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON)
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")
# these are now mandatorily set to ON, and now done so in CMakeModules/config.h.cmake
#option(KICAD_AUIMANAGER "Enable use of wxAuiManager (default ON)" ON)
#option(KICAD_AUITOOLBAR "Enable use of wxAuiToolBar (default ON)" ON)
option(USE_WX_ZOOM "Use wxDC to perform zooming (default OFF). Warning, this is experimental" )
option(USE_WX_GRAPHICS_CONTEXT
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental")
# Comment this out if you don't want to build with Python support.
# OPTION(KICAD_PYTHON "enable/disable building with Python support (default OFF)")
......@@ -50,6 +50,16 @@ if(KICAD_GOST)
add_definitions(-DKICAD_GOST)
endif(KICAD_GOST)
if(USE_WX_ZOOM)
add_definitions(-DUSE_WX_ZOOM)
endif(USE_WX_ZOOM)
if(USE_WX_GRAPHICS_CONTEXT)
set( USE_WX_ZOOM ON )
add_definitions(-DUSE_WX_ZOOM)
add_definitions(-DUSE_WX_GRAPHICS_CONTEXT)
endif(USE_WX_GRAPHICS_CONTEXT)
# Locations for install targets.
set(KICAD_BIN bin
CACHE PATH "Location of KiCad binaries.")
......@@ -124,7 +134,7 @@ check_find_package_result(OPENGL_FOUND "OpenGL")
if(APPLE)
find_package(wxWidgets COMPONENTS gl adv html core net base QUIET)
else(APPLE)
find_package(wxWidgets COMPONENTS gl aui adv html core net base QUIET)
find_package(wxWidgets COMPONENTS gl aui adv html core net base QUIET)
endif(APPLE)
check_find_package_result(wxWidgets_FOUND "wxWidgets")
......@@ -135,11 +145,16 @@ include(${wxWidgets_USE_FILE})
# Include MinGW resource compiler.
include(MinGWResourceCompiler)
# Generate build system specific header file.
include(PerformFeatureChecks)
perform_feature_checks()
# Find GDI+ on windows if wxGraphicsContext is available.
if(WIN32 AND USE_WX_GRAPHICS_CONTEXT)
find_package(GdiPlus)
check_find_package_result(GDI_PLUS_FOUND "GDI+")
endif(WIN32 AND USE_WX_GRAPHICS_CONTEXT)
# Automagically create version header file.
include(CreateSVNVersionHeader)
create_svn_version_header()
......
# - Try to find Microsoft GDI+ build files.
# Once done this will define
#
# GDI_PLUS_FOUND - system has GDI+
# GDI_PLUS_INCLUDE_DIR - the GDI+ include directory
# GDI_PLUS_LIBRARIES - Link these to use GDI+
if(GDI_PLUS_INCLUDE_DIR AND GDI_PLUS_LIBRARIES)
set(GDI_PLUS_FIND_QUIETLY TRUE)
endif(GDI_PLUS_INCLUDE_DIR AND GDI_PLUS_LIBRARIES)
find_path(GDI_PLUS_INCLUDE_DIR GdiPlus.h )
find_library(GDI_PLUS_LIBRARIES gdiplus )
# handle the QUIETLY and REQUIRED arguments and set GDI_PLUS_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GDI_PLUS DEFAULT_MSG GDI_PLUS_LIBRARIES GDI_PLUS_INCLUDE_DIR)
mark_as_advanced(GDI_PLUS_INCLUDE_DIR GDI_PLUS_LIBRARIES)
......@@ -49,13 +49,10 @@
#define strnicmp _strnicmp
#endif
#if 1
// now mandatory, not configurable
#define KICAD_AUIMANAGER 1
#define KICAD_AUITOOLBAR 1
#else
#cmakedefine KICAD_AUIMANAGER 1
#cmakedefine KICAD_AUITOOLBAR 1
#endif
/* Warning!!! Using wxDC for zooming is experimental. */
#cmakedefine USE_WX_ZOOM 1
/* Warning!!! Using wxGraphicContext for rendering is experimental. */
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1
#endif /* __CONFIG_H__ */
......@@ -26,6 +26,11 @@ Common
* Integer/long/double input boxes should handle comma and dot separated values,
not only comma.
Wayne:
C1) Fix mouse wheel scrolling (ctrl + Mouse wheel) and (Shift + mouse wheel)
to move more than a single scroll increment.
CvPCB
-----
* Preview of the already assigned footprint.
......@@ -36,6 +41,11 @@ EESchema
* Use collector classes.
* Drag and drop between two EESchema windows.
Wayne:
E1) Relpace find dialog with wxFormBuilder version using a modeless dialog
and event driven design similar to wxFindReplaceDialog implementation.
GerbView
--------
* Need work as good as gerbv from gEDA
......@@ -119,3 +129,30 @@ L9) On board load, ReFill() is called, this should also update the Render
checkboxes and colors. Will need to extend the widget API.
L10)still thinking about background colors, easier now without wxformbuilder.
Use wxDC for coordinate scaling and offsetting fix. (Wayne)
------------------------------------------------------------
W1) Make wxAutoBufferedPaintDC function properly.
W2) Make bitmap grid drawing method function properly.
W3) Use one cursor position (preferrably logical (drawing) units) instead
of keeping track of both logical and device cursor positions at the same
time.
W4) Figure out why none of the apps render correctly using wxGCDC on Windows.
W5) Add instructions for building wxWidgets with GDI+ using MinGW/MSYS
on Windows so wxGraphicsContext is available without having to use
Visual Studio.
** After (if?) new code accepted as project default: **
W6) Remove all old coordinate scaling and offset code from Kicad.
W7) Remove conditional compilation pragmas and dead code paths.
W8) Remove redundant drawing helper functions from gr_basic.cpp.
W9) Remove all global variables used by old drawing code.
......@@ -104,9 +104,9 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
wxPoint curpos = ScreenPos;
Unscale( curpos );
//#ifndef WX_ZOOM
#ifndef USE_WX_ZOOM
curpos += m_DrawOrg;
//#endif
#endif
return curpos;
}
......@@ -143,7 +143,7 @@ void BASE_SCREEN::SetScalingFactor(double aScale )
*/
int BASE_SCREEN::Scale( int coord )
{
#ifdef WX_ZOOM
#ifdef USE_WX_ZOOM
return coord;
#else
if( !m_ZoomScalar || !m_Zoom )
......@@ -156,7 +156,7 @@ int BASE_SCREEN::Scale( int coord )
double BASE_SCREEN::Scale( double coord )
{
#ifdef WX_ZOOM
#ifdef USE_WX_ZOOM
return coord;
#else
if( !m_Zoom )
......@@ -179,7 +179,7 @@ void BASE_SCREEN::Scale( wxPoint& pt )
void BASE_SCREEN::Scale( wxRealPoint& pt )
{
#ifdef WX_ZOOM
#ifdef USE_WX_ZOOM
// No change
#else
if( !m_ZoomScalar || !m_Zoom )
......@@ -206,7 +206,7 @@ void BASE_SCREEN::Scale( wxSize& sz )
*/
int BASE_SCREEN::Unscale( int coord )
{
#ifdef WX_ZOOM
#ifdef USE_WX_ZOOM
return coord;
#else
if( !m_Zoom || !m_ZoomScalar )
......
......@@ -427,7 +427,13 @@ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
/* Draw text anchor, if allowed */
if( aAnchor_color != UNSPECIFIED_COLOR )
{
#if USE_WX_ZOOM
int anchor_size = aDC->DeviceToLogicalXRel( 2 );
#else
int anchor_size = aPanel->GetScreen()->Unscale( 2 );
#endif
aAnchor_color = (EDA_Colors) ( aAnchor_color & MASKCOLOR );
int cX = aPos.x + aOffset.x;
......
......@@ -101,6 +101,7 @@ void BLOCK_SELECTOR::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
int aDrawMode,
int aColor )
{
int w = aPanel->GetScreen()->Scale( GetWidth() );
int h = aPanel->GetScreen()->Scale( GetHeight() );
......
......@@ -17,6 +17,7 @@
#include "class_base_screen.h"
#include "wxstruct.h"
#include "confirm.h"
#include "kicad_device_context.h"
#include <wx/fontdlg.h>
......@@ -114,9 +115,7 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame()
if( m_CurrentScreen != NULL )
delete m_CurrentScreen;
#if defined(KICAD_AUIMANAGER)
m_auimgr.UnInit();
#endif
}
......@@ -299,10 +298,8 @@ void WinEDA_DrawFrame::SetToolbars()
{
DisplayUnitsMsg();
#if defined(KICAD_AUIMANAGER)
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
#endif
}
......@@ -344,61 +341,6 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
{
m_FrameSize = GetClientSize( );
#if !defined(KICAD_AUIMANAGER)
wxSize clientSize = m_FrameSize;
wxPoint clientPosition;
int default_value = -1;
// Ugly fix for a problem found in recent linux version
// where default value is broken
#ifdef __WXGTK__
if( GetToolBar() ) // use main tool bar dimension as default value
default_value = GetToolBar()->GetSize().y;
#endif
clientSize.y -= m_MsgFrameHeight;
if( MsgPanel ) // Resize the message panel.
{
MsgPanel->SetSize( 0, clientSize.y, clientSize.x, m_MsgFrameHeight );
}
if( m_AuxiliaryToolBar && m_AuxiliaryToolBar->IsShown() ) // Resize the auxilary horizontal tool bar.
{
m_AuxiliaryToolBar->SetSize( clientSize.x, default_value);
m_AuxiliaryToolBar->Move( 0, 0 );
clientSize.y -= m_AuxiliaryToolBar->GetDimension();
clientPosition.y = m_AuxiliaryToolBar->GetDimension();
}
if( m_VToolBar && m_VToolBar->IsShown() ) // Resize the main right vertical tool bar.
{
m_VToolBar->SetSize(default_value, clientSize.y );
clientSize.x -= m_VToolBar->GetDimension();
m_VToolBar->Move( clientSize.x, clientPosition.y );
}
if( m_AuxVToolBar && m_AuxVToolBar->IsShown() ) // Resize the auxiliary right vertical toolbar.
{
m_AuxVToolBar->SetSize( default_value, clientSize.y );
clientSize.x -= m_AuxVToolBar->GetDimension();
m_AuxVToolBar->Move( clientSize.x, clientPosition.y );
}
if( m_OptionsToolBar && m_OptionsToolBar->IsShown() ) // Resize the main left vertical tool bar.
{
m_OptionsToolBar->SetSize( default_value, clientSize.y );
clientSize.x -= m_OptionsToolBar->GetDimension( );
m_OptionsToolBar->Move( 0, clientPosition.y );
clientPosition.x += m_OptionsToolBar->GetDimension( );
}
if( DrawPanel )
{
DrawPanel->SetSize( clientPosition.x, clientPosition.y,
clientSize.x, clientSize.y );
}
#endif
SizeEv.Skip();
}
......@@ -500,101 +442,97 @@ int WinEDA_DrawFrame::HandleBlockEnd( wxDC* DC )
void WinEDA_DrawFrame::AdjustScrollBars()
{
int xUnit, yUnit;
wxSize draw_size, panel_size;
wxSize scrollbar_number;
wxPoint scrollbar_pos;
int pixelsPerUnitX, pixelsPerUnitY, unitsX, unitsY, posX, posY;
wxSize drawingSize, clientSize;
BASE_SCREEN* screen = GetBaseScreen();
if( screen == NULL || DrawPanel == NULL )
return;
// The drawing size is twice the current page size.
draw_size = screen->ReturnPageSize() * 2;
drawingSize = screen->ReturnPageSize() * 2;
// Calculate the portion of the drawing that can be displayed in the
// client area at the current zoom level.
panel_size = DrawPanel->GetClientSize();
screen->Unscale( panel_size );
clientSize = DrawPanel->GetClientSize();
#ifdef USE_WX_ZOOM
INSTALL_DC( dc, DrawPanel );
clientSize.x = dc.DeviceToLogicalXRel( clientSize.x );
clientSize.y = dc.DeviceToLogicalYRel( clientSize.y );
#else
screen->Unscale( clientSize );
#endif
/* Adjust drawing size when zooming way out to prevent centering around
* cursor problems. */
if( panel_size.x > draw_size.x || panel_size.y > draw_size.y )
draw_size = panel_size;
if( clientSize.x > drawingSize.x || clientSize.y > drawingSize.y )
drawingSize = clientSize;
draw_size += panel_size / 2;
drawingSize += clientSize / 2;
if( screen->m_Center )
{
screen->m_DrawOrg.x = -draw_size.x / 2;
screen->m_DrawOrg.y = -draw_size.y / 2;
screen->m_DrawOrg.x = -drawingSize.x / 2;
screen->m_DrawOrg.y = -drawingSize.y / 2;
}
else
{
screen->m_DrawOrg.x = -panel_size.x / 2;
screen->m_DrawOrg.y = -panel_size.y / 2;
screen->m_DrawOrg.x = -clientSize.x / 2;
screen->m_DrawOrg.y = -clientSize.y / 2;
}
#ifndef WX_ZOOM
/* Always set scrollbar pixels per unit to 1 unless you want the zoom
* around cursor to jump around. This reported problem occurs when the
* zoom point is not on a pixel per unit increment. If you set the
* pixels per unit to 10, you have potential for the zoom point to
* jump around +/-5 pixels from the nearest grid point.
*/
pixelsPerUnitX = pixelsPerUnitY = 1;
// Calculate the number of scroll bar units for the given zoom level. */
scrollbar_number.x =
wxRound( (double) draw_size.x /
(double) screen->Unscale( screen->m_ZoomScalar ) );
scrollbar_number.y =
wxRound( (double) draw_size.y /
(double) screen->Unscale( screen->m_ZoomScalar ) );
xUnit = yUnit = screen->m_ZoomScalar;
if( xUnit <= 1 )
xUnit = 1;
if( yUnit <= 1 )
yUnit = 1;
xUnit = screen->Unscale( xUnit );
yUnit = screen->Unscale( yUnit );
#ifdef USE_WX_ZOOM
unitsX = dc.LogicalToDeviceXRel( drawingSize.x );
unitsY = dc.LogicalToDeviceYRel( drawingSize.y );
#else
unitsX = screen->Scale( drawingSize.x );
unitsY = screen->Scale( drawingSize.y );
#endif
// Calculate the position, place the cursor at the center of screen.
scrollbar_pos = screen->m_Curseur - screen->m_DrawOrg;
posX = screen->m_Curseur.x - screen->m_DrawOrg.x;
posY = screen->m_Curseur.y - screen->m_DrawOrg.y;
posX -= clientSize.x / 2;
posY -= clientSize.y / 2;
scrollbar_pos.x -= panel_size.x / 2;
scrollbar_pos.y -= panel_size.y / 2;
if( posX <= 0 )
posX = 0;
if( posY <= 0 )
posY = 0;
if( scrollbar_pos.x <= 0 )
scrollbar_pos.x = 0;
if( scrollbar_pos.y <= 0 )
scrollbar_pos.y = 0;
#ifdef USE_WX_ZOOM
posX = dc.LogicalToDeviceXRel( posX );
posY = dc.LogicalToDeviceYRel( posY );
#else
posX = screen->Scale( posX );
posY = screen->Scale( posY );
#endif
screen->m_ScrollbarPos = wxPoint( posX, posY );
screen->m_ScrollbarNumber = wxSize( unitsX, unitsY );
scrollbar_pos.x = wxRound( (double) scrollbar_pos.x / (double) xUnit );
scrollbar_pos.y = wxRound( (double) scrollbar_pos.y / (double) yUnit );
screen->m_ScrollbarPos = scrollbar_pos;
screen->m_ScrollbarNumber = scrollbar_number;
#if 0
wxLogDebug( wxT( "SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
pixelsPerUnitX, pixelsPerUnitY, unitsX, unitsY, posX, posY );
#endif
DrawPanel->SetScrollbars( screen->m_ZoomScalar,
screen->m_ZoomScalar,
DrawPanel->SetScrollbars( pixelsPerUnitX,
pixelsPerUnitY,
screen->m_ScrollbarNumber.x,
screen->m_ScrollbarNumber.y,
screen->m_ScrollbarPos.x,
screen->m_ScrollbarPos.y, TRUE );
#else
int x, y, scroll_x, scroll_y;
double scale_x, scale_y;
DrawPanel DC( this );
x = DC.LogicalToDeviceXRel( draw_size.GetWidth() );
y = DC.LogicalToDeviceYRel( draw_size.GetHeight() );
scrollbar_pos = screen->m_Curseur - screen->m_DrawOrg;
scrollbar_pos.x -= panel_size.x / 2;
scrollbar_pos.y -= panel_size.y / 2;
scroll_x = DC.LogicalToDeviceXRel( scrollbar_pos.x );
scroll_y = DC.LogicalToDeviceYRel( scrollbar_pos.y );
wxLogDebug( wxT( "SetScrollbars(1, 1, %d, %d, %d, %d)" ),
x, y, scroll_x, scroll_y );
DrawPanel->SetScrollbars( 1, 1, x, y, scroll_x, scroll_y );
#endif
}
......
This diff is collapsed.
......@@ -89,7 +89,7 @@ static void GRSRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1,
static inline int USCALE( us arg, us num, us den )
{
#ifndef WX_ZOOM
#ifndef USE_WX_ZOOM
int ii;
ii = (int) ( ( (float) arg * num ) / den );
return ii;
......@@ -110,7 +110,7 @@ static int inline ZoomValue( int val )
/****************************************/
int GRMapX( int x )
{
#ifndef WX_ZOOM
#ifndef USE_WX_ZOOM
int coord = x - ActiveScreen->m_DrawOrg.x;
coord = ZoomValue( coord );
coord -= ActiveScreen->m_StartVisu.x;
......@@ -123,7 +123,7 @@ int GRMapX( int x )
int GRMapY( int y )
{
#ifndef WX_ZOOM
#ifndef USE_WX_ZOOM
int coord = y - ActiveScreen->m_DrawOrg.y;
coord = ZoomValue( coord );
coord -= ActiveScreen->m_StartVisu.y;
......@@ -373,28 +373,24 @@ void GRSetDrawMode( wxDC* DC, int draw_mode )
{
if( draw_mode & GR_OR )
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )
DC->SetLogicalFunction( wxCOPY );
#elif defined( USE_WX_GRAPHICS_CONTEXT )
DC->SetLogicalFunction( wxCOPY );
#else
DC->SetLogicalFunction( wxOR );
#endif
else if( draw_mode & GR_XOR )
#if defined( USE_WX_GRAPHICS_CONTEXT )
DC->SetLogicalFunction( wxCOPY );
#else
DC->SetLogicalFunction( wxXOR );
#endif
else if( draw_mode & GR_NXOR )
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )
DC->SetLogicalFunction( wxXOR );
#elif defined( USE_WX_GRAPHICS_CONTEXT )
DC->SetLogicalFunction( wxCOPY );
#else
DC->SetLogicalFunction( wxEQUIV );
#endif
else
......
......@@ -12,15 +12,10 @@
WinEDA_Toolbar::WinEDA_Toolbar( id_toolbar type, wxWindow * parent,
wxWindowID id, bool horizontal ):
#if defined(KICAD_AUITOOLBAR)
wxAuiToolBar( parent, id, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | ( ( horizontal ) ?
wxAUI_TB_HORZ_LAYOUT :
wxAUI_TB_VERTICAL ) )
#else
wxToolBar( parent, id, wxPoint( -1,-1 ), wxSize( -1,-1 ),
horizontal ? wxTB_HORIZONTAL : wxTB_VERTICAL )
#endif
{
m_Parent = parent;
m_Ident = type;
......
......@@ -35,7 +35,7 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse )
* TODO: see exactly how the mouse creates problems when moving during refresh
* use Refresh() and update() do not change problems
*/
INSTALL_DC(dc,DrawPanel);
INSTALL_DC( dc, DrawPanel );
DrawPanel->ReDraw( &dc );
/* Move the mouse cursor to the on grid graphic cursor position */
......
......@@ -72,7 +72,8 @@ if(APPLE)
set_target_properties(${CVPCB_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
endif(APPLE)
target_link_libraries(${CVPCB_NAME} 3d-viewer common pcbcommon polygon bitmaps kbool ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES})
target_link_libraries(${CVPCB_NAME} 3d-viewer common pcbcommon polygon bitmaps kbool
${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} ${GDI_PLUS_LIBRARIES})
install(TARGETS ${CVPCB_NAME}
DESTINATION ${KICAD_BIN}
......
......@@ -74,7 +74,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father,
ReCreateHToolbar();
ReCreateVToolbar();
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
......@@ -105,7 +104,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
Show( TRUE );
}
......@@ -219,7 +218,14 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* DC, wxPoint Mouse )
oldpos = GetScreen()->m_Curseur;
delta = GetScreen()->GetGridSize();
#ifdef USE_WX_ZOOM
delta.x = DC->LogicalToDeviceXRel( wxRound( delta.x ) );
delta.y = DC->LogicalToDeviceYRel( wxRound( delta.y ) );
Mouse = DrawPanel->CalcUnscrolledPosition( Mouse );
#else
GetScreen()->Scale( delta );
#endif
if( delta.x <= 0 )
delta.x = 1;
......
......@@ -157,27 +157,6 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
BuildCmpListBox();
BuildFOOTPRINTS_LISTBOX();
#if !defined(KICAD_AUIMANAGER)
/* Create size constraints of the component list window display. */
wxLayoutConstraints* linkpos = new wxLayoutConstraints;
linkpos->top.SameAs( this, wxTop );
linkpos->bottom.SameAs( this, wxBottom );
linkpos->left.SameAs( this, wxLeft );
linkpos->width.PercentOf( this, wxWidth, 66 );
if( m_ListCmp )
m_ListCmp->SetConstraints( linkpos );
/* Create size constraints for the footprint display window. */
linkpos = new wxLayoutConstraints;
linkpos->top.SameAs( m_ListCmp, wxTop );
linkpos->bottom.SameAs( m_ListCmp, wxBottom );
linkpos->right.SameAs( this, wxRight );
linkpos->left.SameAs( m_ListCmp, wxRight );
if( m_FootprintList )
m_FootprintList->SetConstraints( linkpos );
#endif
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
......@@ -204,7 +183,6 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
Right().BestSize( (int) ( m_FrameSize.x * 0.36 ), m_FrameSize.y ) );
m_auimgr.Update();
#endif
}
......@@ -219,9 +197,7 @@ WinEDA_CvpcbFrame::~WinEDA_CvpcbFrame()
config->Write( wxT( FILTERFOOTPRINTKEY ), state );
}
#if defined(KICAD_AUIMANAGER)
m_auimgr.UnInit();
#endif
}
......
......@@ -22,10 +22,6 @@ void WinEDA_CvpcbFrame::ReCreateHToolbar()
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar *)m_HToolBar );
#endif
m_HToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxEmptyString,
wxBitmap( open_xpm ),
_( "Open a net list file" ) );
......
......@@ -154,7 +154,7 @@ if(APPLE)
set_target_properties(eeschema PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
endif(APPLE)
target_link_libraries(eeschema common bitmaps ${wxWidgets_LIBRARIES})
target_link_libraries(eeschema common bitmaps ${wxWidgets_LIBRARIES} ${GDI_PLUS_LIBRARIES})
install(TARGETS eeschema
DESTINATION ${KICAD_BIN}
......
......@@ -267,7 +267,11 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDc,
/* Enable this to draw the anchor of the component. */
#if 0
#ifdef USE_WX_ZOOM
int len = aDc->DeviceToLogicalXRel( 3 );
#else
int len = aPanel->GetScreen()->Unscale( 3 );
#endif
GRLine( &aPanel->m_ClipBox, aDc, aOffset.x, aOffset.y - len, aOffset.x,
aOffset.y + len, 0, aColor );
GRLine( &aPanel->m_ClipBox, aDc, aOffset.x - len, aOffset.y, aOffset.x + len,
......
......@@ -230,7 +230,14 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC,
oldpos = screen->m_Curseur;
delta = screen->GetGridSize();
#ifdef USE_WX_ZOOM
delta.x = DC->LogicalToDeviceXRel( wxRound( delta.x ) );
delta.y = DC->LogicalToDeviceYRel( wxRound( delta.y ) );
MousePositionInPixels = DrawPanel->CalcUnscrolledPosition( MousePositionInPixels );
#else
screen->Scale( delta );
#endif
if( delta.x <= 0 )
delta.x = 1;
......@@ -324,7 +331,14 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC,
oldpos = screen->m_Curseur;
delta = screen->GetGridSize();
#ifdef USE_WX_ZOOM
delta.x = DC->LogicalToDeviceXRel( wxRound( delta.x ) );
delta.y = DC->LogicalToDeviceYRel( wxRound( delta.y ) );
MousePositionInPixels = DrawPanel->CalcUnscrolledPosition( MousePositionInPixels );
#else
screen->Scale( delta );
#endif
if( delta.x <= 0 )
delta.x = 1;
......@@ -417,7 +431,14 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
oldpos = screen->m_Curseur;
delta = screen->GetGridSize();
#ifdef USE_WX_ZOOM
delta.x = DC->LogicalToDeviceXRel( wxRound( delta.x ) );
delta.y = DC->LogicalToDeviceYRel( wxRound( delta.y ) );
MousePositionInPixels = DrawPanel->CalcUnscrolledPosition( MousePositionInPixels );
#else
screen->Scale( delta );
#endif
if( delta.x <= 0 )
delta.x = 1;
......
......@@ -192,10 +192,15 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
DisplayCmpDoc();
UpdateAliasSelectList();
UpdatePartSelectList();
#ifdef USE_WX_GRAPHICS_CONTEXT
GetScreen()->SetZoom( BestZoom() );
#else
Zoom_Automatique( false );
#endif
Show( true );
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
......@@ -224,7 +229,6 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
}
......
......@@ -194,7 +194,6 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_HIGH );
m_pageSetupData.GetPrintData().SetOrientation( wxLANDSCAPE );
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
......@@ -231,7 +230,6 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
}
......@@ -409,7 +407,7 @@ int WinEDA_SchematicFrame::BestZoom()
size = DrawPanel->GetClientSize();
zoom = MAX( (double) dx / (double) size.x,
(double) dy / (double) size.y );
(double) dy / (double) size.y );
GetScreen()->m_Curseur.x = dx / 2;
GetScreen()->m_Curseur.y = dy / 2;
......
......@@ -94,9 +94,7 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
return;
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
#if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar*)m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString,
wxBitmap( save_library_xpm ),
......
......@@ -25,10 +25,6 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
wxString msg;
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar*)m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, wxBitmap( new_xpm ),
_( "New schematic project" ) );
......
......@@ -28,10 +28,6 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR,
true );
#if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar*)m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_LIBVIEW_SELECT_LIB, wxEmptyString,
wxBitmap( library_xpm ),
......
......@@ -170,10 +170,15 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
if( DrawPanel )
DrawPanel->SetAcceleratorTable( table );
#ifdef USE_WX_GRAPHICS_CONTEXT
GetScreen()->SetZoom( BestZoom() );
#else
Zoom_Automatique( false );
#endif
Show( TRUE );
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
......@@ -225,12 +230,6 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
pane.MinSize(wxSize(m_CmpListSize.x, -1));
m_auimgr.Update();
#else
m_CmpListWindow->SetSize(m_CmpListSize);
if( m_LibListWindow )
m_LibListWindow->SetSize(m_LibListSize);
#endif
}
......@@ -262,29 +261,6 @@ void WinEDA_ViewlibFrame::OnSashDrag( wxSashEvent& event )
m_LibListSize.y = GetClientSize().y - m_MsgFrameHeight;
m_CmpListSize.y = m_LibListSize.y;
#ifndef KICAD_AUIMANAGER
switch( event.GetId() )
{
case ID_LIBVIEW_LIBWINDOW:
if( m_LibListWindow )
{
m_LibListSize.x = event.GetDragRect().width;
m_LibListWindow->SetSize( m_LibListSize );
m_CmpListWindow->SetPosition( wxPoint( m_LibListSize.x, 0 ) );
m_CmpListWindow->SetSize( m_CmpListSize );
}
break;
case ID_LIBVIEW_CMPWINDOW:
m_CmpListSize.x = event.GetDragRect().width;
m_CmpListWindow->SetSize( m_CmpListSize );
break;
}
// Now, we must recalculate the position and size of subwindows
wxSizeEvent SizeEv;
OnSize( SizeEv );
#else
switch( event.GetId() )
{
case ID_LIBVIEW_LIBWINDOW:
......@@ -306,57 +282,15 @@ void WinEDA_ViewlibFrame::OnSashDrag( wxSashEvent& event )
}
break;
}
#endif
}
void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
{
#ifndef KICAD_AUIMANAGER
wxSize clientsize = GetClientSize();
m_FrameSize = clientsize;
clientsize.y -= m_MsgFrameHeight;
if( MsgPanel )
{
MsgPanel->SetSize( 0, clientsize.y, clientsize.x, m_MsgFrameHeight );
}
if( DrawPanel )
{
int xpos = m_LibListSize.x + m_CmpListSize.x;
DrawPanel->SetSize( xpos, 0,
clientsize.x - xpos, clientsize.y );
}
if( m_LibList && m_LibListWindow )
{
m_LibListSize.y = clientsize.y - 2;
m_LibListWindow->SetSize( m_LibListSize );
m_LibList->SetSize( m_LibListWindow->GetClientSize() -
wxSize( EXTRA_BORDER_SIZE * 2, 0 ) );
}
if( m_CmpList && m_CmpListWindow )
{
m_CmpListSize.y = clientsize.y - 2;
m_CmpListWindow->SetSize( m_CmpListSize );
m_CmpListWindow->SetPosition( wxPoint( m_LibListSize.x, 0 ) );
m_CmpList->SetSize( m_CmpListWindow->GetClientSize() -
wxSize( EXTRA_BORDER_SIZE * 2, 0 ) );
}
SizeEv.Skip();
// Ensure the panel is always redrawn (sometimes some garbage remains):
DrawPanel->Refresh();
#else
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
SizeEv.Skip();
#endif
}
......
......@@ -79,7 +79,8 @@ if(APPLE)
set_target_properties(${GERBVIEW_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
endif(APPLE)
target_link_libraries(${GERBVIEW_NAME} common pcbcommon 3d-viewer polygon bitmaps kbool ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES})
target_link_libraries(${GERBVIEW_NAME} common pcbcommon 3d-viewer polygon bitmaps kbool
${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} ${GDI_PLUS_LIBRARIES})
install(TARGETS ${GERBVIEW_NAME}
DESTINATION ${KICAD_BIN}
......
......@@ -42,7 +42,14 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
oldpos = GetScreen()->m_Curseur;
delta = GetScreen()->GetGridSize();
#ifdef USE_WX_ZOOM
delta.x = DC->LogicalToDeviceXRel( delta.x );
delta.y = DC->LogicalToDeviceYRel( delta.y );
Mouse = DrawPanel->CalcUnscrolledPosition( Mouse );
#else
GetScreen()->Scale( delta );
#endif
if( delta.x == 0 )
delta.x = 1;
......
......@@ -283,7 +283,12 @@ void Trace_Segment( BOARD* aBrd, WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track
(double) (track->m_End.y - track->m_Start.y) );
halfPenWidth = track->m_Width >> 1;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( halfPenWidth ) < L_MIN_DESSIN )
#else
if( panel->GetScreen()->Scale( halfPenWidth ) < L_MIN_DESSIN )
#endif
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
track->m_Start.y, radius, 0, color );
......@@ -324,7 +329,12 @@ void Trace_Segment( BOARD* aBrd, WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track
radius = track->m_Width >> 1;
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( radius ) < L_MIN_DESSIN )
#else
if( panel->GetScreen()->Scale( radius ) < L_MIN_DESSIN )
#endif
{
GRCircle( &panel->m_ClipBox, DC, track->m_Start.x,
track->m_Start.y, radius, 0, color );
......@@ -347,7 +357,12 @@ void Trace_Segment( BOARD* aBrd, WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track
l_piste = track->m_Width >> 1;
fillopt = DisplayOpt.DisplayPadFill ? FILLED : SKETCH;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
#else
if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
#endif
{
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, 0, color );
......@@ -378,7 +393,11 @@ void Trace_Segment( BOARD* aBrd, WinEDA_DrawPanel* panel, wxDC* DC, TRACK* track
case S_SEGMENT:
l_piste = track->m_Width >> 1;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
#else
if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
#endif
{
GRLine( &panel->m_ClipBox, DC, track->m_Start.x, track->m_Start.y,
track->m_End.x, track->m_End.y, 0, color );
......
......@@ -26,7 +26,8 @@ public:
wxPoint m_CursorStartPos; // useful in testing the cursor
// movement
int m_ScrollButt_unit; // scroll bar pixels per unit value
int m_scrollIncrementX; // X axis scroll increment in pixels per unit.
int m_scrollIncrementY; // Y axis scroll increment in pixels per unit.
bool m_AbortRequest; // Flag to abort long commands
......@@ -59,7 +60,6 @@ public:
int m_CursorLevel; // Index for cursor redraw in XOR
// mode
/* Cursor management (used in editing functions) */
/* Mouse capture move callback function prototype. */
......@@ -124,6 +124,24 @@ public:
void OnActivate( wxActivateEvent& event );
/**
* Prepare the device context for drawing.
*
* This overrides wxScrolledWindow::DoPrepareDC() for drawing depending
* on the render mode selected a build time. If the old kicad coordinate
* scaling code is used then this code doesn't do any thing other than
* update the boundary box. If wxDC coordinate manipulation is used, then
* the scale factor and drawing logical offset is set. Then the base
* method is called to set the DC device origin and user scale. This
* connects everything together to acheive the appropiate coordinate
* manipulation using wxDC LogicalToDeviceXXX and DeviceToLogixalXXX
* methods. This gets called automatically for a paint event. If you do
* any drawing outside the paint event, you must call DoPrepareDC manually.
*
* @param dc - The device context to prepare.
*/
virtual void DoPrepareDC(wxDC& dc);
/* Mouse and keys events */
void OnMouseWheel( wxMouseEvent& event );
void OnMouseEvent( wxMouseEvent& event );
......@@ -146,7 +164,7 @@ public:
void Process_Special_Functions( wxCommandEvent& event );
bool IsPointOnDisplay( wxPoint ref_pos );
void SetBoundaryBox();
void SetBoundaryBox( wxDC* dc );
void ReDraw( wxDC* DC, bool erasebg = TRUE );
/** Function CursorRealPosition
......
......@@ -21,6 +21,10 @@
#include <wx/dcbuffer.h>
#endif
#if USE_WX_GRAPHICS_CONTEXT && USE_WX_ZOOM
#include <wx/dcgraph.h>
#endif
// Helper class to handle the client Device Context
class KicadGraphicContext : public wxClientDC
{
......@@ -31,19 +35,39 @@ public:
// Macro used to declare a device context in kicad:
#if USE_WX_GRAPHICS_CONTEXT && USE_WX_ZOOM
#define INSTALL_DC(name,parent) \
wxClientDC _cDC( parent ); \
wxGCDC name(_cDC); \
parent->DoPrepareDC( name ); \
name.GetGraphicsContext()->Translate( 0.5, 0.5 );
#else
#ifdef KICAD_USE_BUFFERED_DC
#define INSTALL_DC(name,parent) \
KicadGraphicContext _cDC( parent );\
wxBufferedDC name(&_cDC, _cDC.GetSize() );
#define INSTALL_DC(name,parent) \
wxClientDC _cDC( parent ); \
wxBufferedDC name(&_cDC, _cDC.GetSize() ); \
parent->DoPrepareDC( name );
#else
#define INSTALL_DC(name,parent) KicadGraphicContext name( parent )
#define INSTALL_DC(name,parent) \
wxClientDC name( parent ); \
parent->DoPrepareDC( name );
#endif
#endif
#ifdef KICAD_USE_BUFFERED_PAINTDC
#define INSTALL_PAINTDC(name,parent) wxAutoBufferedPaintDC name(parent )
#if USE_WX_GRAPHICS_CONTEXT
#define INSTALL_PAINTDC(name,parent) \
wxPaintDC _pDC(parent); \
wxGCDC name(_pDC); \
parent->DoPrepareDC( name ); \
name.GetGraphicsContext()->Translate( 0.5, 0.5);
#elif !defined( USE_WX_ZOOM ) && defined( KICAD_USE_BUFFERED_PAINTDC )
#define INSTALL_PAINTDC(name,parent) \
wxAutoBufferedPaintDC name(parent ); \
parent->DoPrepareDC( name );
#else
#define INSTALL_PAINTDC(name,parent) wxPaintDC name( parent )
#define INSTALL_PAINTDC(name,parent) \
wxPaintDC name( parent ); \
parent->DoPrepareDC( name );
#endif
#endif // __KICAD_DEVICE_CONTEXT_H__
......@@ -13,10 +13,7 @@
#include "wx/config.h"
#include <wx/wxhtml.h>
#include <wx/laywin.h>
#if defined(KICAD_AUIMANAGER) || defined(KICAD_AUITOOLBAR)
#include <wx/aui/aui.h>
#endif
#include "colors.h"
......@@ -103,9 +100,7 @@ public:
// It is "SchematicFrame", "PcbFrame" ....
wxString m_AboutTitle; // Name of program displayed in About.
#ifdef KICAD_AUIMANAGER
wxAuiManager m_auimgr;
#endif
public:
WinEDA_BasicFrame( wxWindow* father, int idtype,
......@@ -689,11 +684,7 @@ public:
/* class WinEDA_Toolbar */
/*************************/
#if defined(KICAD_AUITOOLBAR)
class WinEDA_Toolbar : public wxAuiToolBar
#else
class WinEDA_Toolbar : public wxToolBar
#endif
{
public:
wxWindow* m_Parent;
......@@ -704,7 +695,6 @@ public:
WinEDA_Toolbar( id_toolbar type, wxWindow* parent,
wxWindowID id, bool horizontal );
#if defined(KICAD_AUITOOLBAR)
bool GetToolState( int toolId ) { return GetToolToggled(toolId); };
void AddRadioTool( int toolid,
......@@ -721,7 +711,6 @@ public:
void SetToolNormalBitmap( int id, const wxBitmap& bitmap ) {};
void SetRows( int nRows ) {};
#endif
/** Function GetDimension
* @return the dimension of this toolbar (Height if horizontal, Width if vertical.
......
......@@ -49,7 +49,7 @@ install(TARGETS KiCad
DESTINATION ${KICAD_BIN}
COMPONENT binary)
else(APPLE)
target_link_libraries(kicad common bitmaps ${wxWidgets_LIBRARIES})
target_link_libraries(kicad common bitmaps ${wxWidgets_LIBRARIES} ${GDI_PLUS_LIBRARIES})
install(TARGETS kicad
DESTINATION ${KICAD_BIN}
COMPONENT binary)
......
......@@ -259,9 +259,7 @@ void WinEDA_MainFrame::RecreateBaseHToolbar()
// Allocate memory for m_HToolBar
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar*)m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString,
wxBitmap( new_project_xpm ),
......
......@@ -67,23 +67,6 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
// Bottom Window: box to display messages
m_RightWin = new RIGHT_KM_FRAME( this );
/* Setting the sash control interferes with wxAUIManager and prevents the
* right and left window panes from being resized.
*/
#ifndef KICAD_AUIMANAGER
m_LeftWin->SetDefaultSize( wxSize( m_LeftWin_Width, clientsize.y ) );
m_LeftWin->SetOrientation( wxLAYOUT_VERTICAL );
m_LeftWin->SetAlignment( wxLAYOUT_LEFT );
m_LeftWin->SetSashVisible( wxSASH_RIGHT, TRUE );
m_LeftWin->SetExtraBorderSize( 2 );
int rightWinWidth = clientsize.x - m_LeftWin_Width;
m_RightWin->SetDefaultSize( wxSize( rightWinWidth, clientsize.y ) );
m_RightWin->SetOrientation( wxLAYOUT_VERTICAL );
m_RightWin->SetAlignment( wxLAYOUT_RIGHT );
m_RightWin->SetExtraBorderSize( 2 );
#endif
msg = wxGetCwd();
line.Printf( _( "Ready\nWorking dir: %s\n" ), msg.GetData() );
PrintMsg( line );
......@@ -92,7 +75,6 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::LoadProject" ) );
#endif
#if defined(KICAD_AUIMANAGER)
RecreateBaseHToolbar();
m_auimgr.SetManagedWindow( this );
......@@ -121,15 +103,12 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
CloseButton( false ).Left().BestSize( m_LeftWin_Width, clientsize.y ).
Layer( 1 ).CaptionVisible( false ) );
m_auimgr.Update();
#endif
}
WinEDA_MainFrame::~WinEDA_MainFrame()
{
#if defined(KICAD_AUIMANAGER)
m_auimgr.UnInit();
#endif
}
......@@ -146,34 +125,15 @@ void WinEDA_MainFrame::PrintMsg( const wxString& text )
*/
void WinEDA_MainFrame::OnSashDrag( wxSashEvent& event )
{
#if defined(KICAD_AUIMANAGER)
#else
if( event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE )
return;
m_LeftWin_Width = event.GetDragRect().width;
m_LeftWin->SetDefaultSize( wxSize( m_LeftWin_Width, -1 ) );
wxLayoutAlgorithm layout;
layout.LayoutFrame( this );
#endif
event.Skip();
}
void WinEDA_MainFrame::OnSize( wxSizeEvent& event )
{
#if defined(KICAD_AUIMANAGER)
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
#else
wxLayoutAlgorithm layout;
layout.LayoutFrame( this );
#endif
event.Skip();
}
......
......@@ -222,7 +222,8 @@ if(APPLE)
set_target_properties(${PCBNEW_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
endif(APPLE)
target_link_libraries(${PCBNEW_NAME} 3d-viewer common pcbcommon polygon bitmaps kbool ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES})
target_link_libraries(${PCBNEW_NAME} 3d-viewer common pcbcommon polygon bitmaps kbool
${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} ${GDI_PLUS_LIBRARIES})
install(TARGETS ${PCBNEW_NAME}
DESTINATION ${KICAD_BIN}
......
......@@ -431,7 +431,11 @@ void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
typeaff = DisplayOpt.DisplayDrawItems;
width = m_Width;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( width ) < 2 )
#else
if( panel->GetScreen()->Scale( width ) < 2 )
#endif
typeaff = FILAIRE;
switch( typeaff )
......
......@@ -254,7 +254,12 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
mode = DisplayOpt.DisplayDrawItems;
if( m_Flags & FORCE_SKETCH )
mode = SKETCH;
#ifdef USE_WX_ZOOM
if( l_piste < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
#else
if( l_piste < panel->GetScreen()->Unscale( L_MIN_DESSIN ) )
#endif
mode = FILAIRE;
switch( m_Shape )
......
......@@ -191,7 +191,12 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( !typeaff )
typeaff = SKETCH;
}
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( m_Width ) < L_MIN_DESSIN )
#else
if( screen->Scale( m_Width ) < L_MIN_DESSIN )
#endif
typeaff = FILAIRE;
switch( type_trace )
......
......@@ -116,7 +116,12 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
GRSetDrawMode( DC, mode_color );
typeaff = DisplayOpt.DisplayDrawItems;
width = m_Width;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( width ) < 2 )
#else
if( panel->GetScreen()->Scale( width ) < 2 )
#endif
typeaff = FILAIRE;
rayon = m_Size / 4;
......
......@@ -66,7 +66,11 @@ MODULE::~MODULE()
void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int dim_ancre, int draw_mode )
{
#ifdef USE_WX_ZOOM
int anchor_size = DC->DeviceToLogicalXRel( dim_ancre );
#else
int anchor_size = panel->GetScreen()->Unscale( dim_ancre );
#endif
GRSetDrawMode( DC, draw_mode );
......
......@@ -432,8 +432,12 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
switch( m_DrillShape )
{
case PAD_CIRCLE:
if( screen->Scale( hole ) > 1 ) /* draw hole if its size is enought
*/
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( hole ) > 1 )
#else
if( screen->Scale( hole ) > 1 ) /* draw hole if its size is enough */
#endif
GRFilledCircle( &panel->m_ClipBox, DC, cx0, cy0, hole, 0,
color, color );
break;
......@@ -548,8 +552,12 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
tsize = min( AreaSize.y, AreaSize.x / numpad_len );
#define CHAR_SIZE_MIN 5
if( screen->Scale( tsize ) >= CHAR_SIZE_MIN ) // Not drawable when
// size too small.
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable when size too small.
#else
if( screen->Scale( tsize ) >= CHAR_SIZE_MIN ) // Not drawable when size too small.
#endif
{
tsize = (int) ( tsize * 0.8 ); // reserve room for
// marges and segments
......@@ -569,8 +577,11 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
shortname_len = MAX( shortname_len, MIN_CHAR_COUNT );
tsize = min( AreaSize.y, AreaSize.x / shortname_len );
if( screen->Scale( tsize ) >= CHAR_SIZE_MIN ) // Not drawable in size too
// small.
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable in size too small.
#else
if( screen->Scale( tsize ) >= CHAR_SIZE_MIN ) // Not drawable in size too small.
#endif
{
if( !( !IsOnLayer( screen->m_Active_Layer )
&& DisplayOpt.ContrastModeDisplay ) )
......
......@@ -356,7 +356,12 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
width = m_Width;
if( ( frame->m_DisplayModText == FILAIRE )
#ifdef USE_WX_ZOOM
|| ( DC->LogicalToDeviceXRel( width ) < L_MIN_DESSIN ) )
#else
|| ( screen->Scale( width ) < L_MIN_DESSIN ) )
#endif
width = 0;
else if( frame->m_DisplayModText == SKETCH )
width = -width;
......@@ -367,7 +372,12 @@ void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
{
color = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
#ifdef USE_WX_ZOOM
int anchor_size = DC->DeviceToLogicalXRel( 2 );
#else
int anchor_size = screen->Unscale( 2 );
#endif
GRLine( &panel->m_ClipBox, DC,
pos.x - anchor_size, pos.y,
pos.x + anchor_size, pos.y, 0, color );
......
......@@ -596,14 +596,24 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( m_Shape == S_CIRCLE )
{
rayon = (int) hypot( (double) ( m_End.x - m_Start.x ),
(double) ( m_End.y - m_Start.y ) );
(double) ( m_End.y - m_Start.y ) );
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
#else
if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
#endif
{
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
}
else
{
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( l_piste ) <= 1 ) /* Sketch mode if l_piste/zoom <= 1 */
#else
if( panel->GetScreen()->Scale( l_piste ) <= 1 ) /* Sketch mode if l_piste/zoom <= 1 */
#endif
{
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
}
......@@ -621,7 +631,11 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
return;
}
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
#else
if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
#endif
{
GRLine( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
m_End.x, m_End.y, 0, color );
......@@ -671,7 +685,11 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( len < THRESHOLD * m_Width )
return;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( m_Width ) < 6 ) // no room to display a text inside track
#else
if( panel->GetScreen()->Scale( m_Width ) < 6 ) // no room to display a text inside track
#endif
return;
if( GetNet() == 0 )
......@@ -693,7 +711,12 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
int angle = 0;
if( (m_End.x - m_Start.x) == 0 ) // Vertical segment
angle = 900; // angle is in 0.1 degree
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( tsize ) >= 6 )
#else
if( panel->GetScreen()->Scale( tsize ) >= 6 )
#endif
{
if( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay) )
{
......@@ -757,12 +780,24 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
rayon = m_Width >> 1;
// for small via size on screen (rayon < 4 pixels) draw a simplified shape
#ifdef USE_WX_ZOOM
int radius_in_pixels = DC->LogicalToDeviceXRel( rayon );
#else
int radius_in_pixels = panel->GetScreen()->Scale( rayon );
#endif
bool fast_draw = false;
// Vias are drawn as a filled circle or a double circle. The hole will be drawn later
int drill_rayon = GetDrillValue() / 2;
#ifdef USE_WX_ZOOM
int inner_rayon = rayon - DC->DeviceToLogicalXRel( 2 );
#else
int inner_rayon = rayon - panel->GetScreen()->Unscale( 2 );
#endif
if( radius_in_pixels < 3 )
{
fast_draw = true;
......@@ -804,7 +839,11 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
else
GRSetDrawMode( DC, GR_XOR );
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( drill_rayon ) > 1 ) /* draw hole if its size is enought */
#else
if( screen->Scale( drill_rayon ) > 1 ) /* draw hole if its size is enought */
#endif
GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x,
m_Start.y, drill_rayon, 0, color, color );
......@@ -893,7 +932,12 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
{
// calculate a good size for the text
int tsize = m_Width / len;
#ifdef USE_WX_ZOOM
if( DC->LogicalToDeviceXRel( tsize ) >= 6 )
#else
if( panel->GetScreen()->Scale( tsize ) >= 6 )
#endif
{
tsize = (tsize * 8) / 10; // small reduction to give a better look, inside via
DrawGraphicText( panel, DC, m_Start,
......
......@@ -262,7 +262,14 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
oldpos = GetScreen()->m_Curseur;
delta = GetScreen()->GetGridSize();
#ifdef USE_WX_ZOOM
delta.x = DC->LogicalToDeviceXRel( delta.x );
delta.y = DC->LogicalToDeviceYRel( delta.y );
Mouse = DrawPanel->CalcUnscrolledPosition( Mouse );
#else
GetScreen()->Scale( delta );
#endif
if( delta.x <= 0 )
delta.x = 1;
......
......@@ -188,7 +188,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
if( DrawPanel )
DrawPanel->m_Block_Enable = TRUE;
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
......@@ -226,7 +226,6 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
}
......@@ -408,10 +407,9 @@ void WinEDA_ModuleEditFrame::SetToolbars()
}
DisplayUnitsMsg();
#if defined(KICAD_AUIMANAGER)
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
#endif
}
......@@ -455,7 +453,14 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
oldpos = GetScreen()->m_Curseur;
delta = GetScreen()->GetGridSize();
#ifdef USE_WX_ZOOM
delta.x = DC->LogicalToDeviceXRel( wxRound( delta.x ) );
delta.y = DC->LogicalToDeviceYRel( wxRound( delta.y ) );
Mouse = DrawPanel->CalcUnscrolledPosition( Mouse );
#else
GetScreen()->Scale( delta );
#endif
if( delta.x == 0 )
delta.x = 1;
......
......@@ -311,7 +311,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
ReCreateAuxVToolbar();
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
......@@ -372,11 +371,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#else
if( m_AuxVToolBar )
m_AuxVToolBar->Show(m_show_microwave_tools);
#endif
SetToolbars();
ReFillLayerWidget(); // this is near end because contents establish size
......@@ -617,5 +611,3 @@ void WinEDA_PcbFrame::SetVisibleAlls( )
for( int ii = 0; ii < PCB_VISIBLE(END_PCB_VISIBLE_LIST); ii++ )
m_Layers->SetRenderState( ii, true );
}
......@@ -32,9 +32,7 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
wxString msg;
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar*) m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString,
wxBitmap( open_library_xpm ),
......
......@@ -192,9 +192,7 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
m_HToolBar->SetRows( 1 );
#if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar*)m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, wxBitmap( new_xpm ),
_( "New board" ) );
......
......@@ -265,13 +265,8 @@ void WinEDA_PcbFrame::SetToolbars()
_( "Normal contrast display mode" ) :
_( "High contrast display mode" ) );
#if !defined(KICAD_AUIMANAGER)
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
(m_AuxVToolBar && m_AuxVToolBar->IsShown()) ? true : false );
#else
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
m_auimgr.GetPane(wxT("m_AuxVToolBar")).IsShown() );
#endif
}
if( m_AuxiliaryToolBar )
......@@ -281,8 +276,7 @@ void WinEDA_PcbFrame::SetToolbars()
PrepareLayerIndicator();
DisplayUnitsMsg();
#if defined(KICAD_AUIMANAGER)
if(m_auimgr.GetManagedWindow())
m_auimgr.Update();
#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