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.
This commit is contained in:
parent
3f0a7f8deb
commit
3066c70559
|
@ -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()
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# - 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__ */
|
||||
|
|
37
TODO.txt
37
TODO.txt
|
@ -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;
|
||||
|
||||
scrollbar_pos.x -= panel_size.x / 2;
|
||||
scrollbar_pos.y -= panel_size.y / 2;
|
||||
posX -= clientSize.x / 2;
|
||||
posY -= clientSize.y / 2;
|
||||
|
||||
if( scrollbar_pos.x <= 0 )
|
||||
scrollbar_pos.x = 0;
|
||||
if( scrollbar_pos.y <= 0 )
|
||||
scrollbar_pos.y = 0;
|
||||
if( posX <= 0 )
|
||||
posX = 0;
|
||||
if( posY <= 0 )
|
||||
posY = 0;
|
||||
|
||||
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;
|
||||
#ifdef USE_WX_ZOOM
|
||||
posX = dc.LogicalToDeviceXRel( posX );
|
||||
posY = dc.LogicalToDeviceYRel( posY );
|
||||
#else
|
||||
posX = screen->Scale( posX );
|
||||
posY = screen->Scale( posY );
|
||||
#endif
|
||||
|
||||
DrawPanel->SetScrollbars( screen->m_ZoomScalar,
|
||||
screen->m_ZoomScalar,
|
||||
screen->m_ScrollbarPos = wxPoint( posX, posY );
|
||||
screen->m_ScrollbarNumber = wxSize( unitsX, unitsY );
|
||||
|
||||
#if 0
|
||||
wxLogDebug( wxT( "SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
|
||||
pixelsPerUnitX, pixelsPerUnitY, unitsX, unitsY, posX, posY );
|
||||
#endif
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,13 +24,20 @@ KicadGraphicContext::KicadGraphicContext( WinEDA_DrawPanel* aDrawPanel ) :
|
|||
{
|
||||
GRResetPenAndBrush( this );
|
||||
SetBackgroundMode( wxTRANSPARENT );
|
||||
#ifdef WX_ZOOM
|
||||
double scale = aDrawPanel->GetScreen()->GetScalingFactor();
|
||||
SetUserScale( scale, scale );
|
||||
wxPoint origin = aDrawPanel->GetScreen()->m_DrawOrg;
|
||||
SetLogicalOrigin( origin.x, origin.y );
|
||||
|
||||
#ifdef USE_WX_ZOOM
|
||||
if( aDrawPanel->GetScreen() != NULL )
|
||||
{
|
||||
double scale = aDrawPanel->GetScreen()->GetScalingFactor();
|
||||
|
||||
aDrawPanel->SetScale( scale, scale );
|
||||
aDrawPanel->DoPrepareDC( *this );
|
||||
wxPoint origin = aDrawPanel->GetScreen()->m_DrawOrg;
|
||||
SetLogicalOrigin( origin.x, origin.y );
|
||||
}
|
||||
#endif
|
||||
aDrawPanel->SetBoundaryBox();
|
||||
|
||||
aDrawPanel->SetBoundaryBox( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,16 +56,16 @@ static bool s_IgnoreNextLeftButtonRelease = false;
|
|||
|
||||
// Events used by WinEDA_DrawPanel
|
||||
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
|
||||
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
|
||||
EVT_MOUSEWHEEL( WinEDA_DrawPanel::OnMouseWheel )
|
||||
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
|
||||
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
|
||||
EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent )
|
||||
EVT_PAINT( WinEDA_DrawPanel::OnPaint )
|
||||
EVT_SIZE( WinEDA_DrawPanel::OnSize )
|
||||
EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
|
||||
EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
|
||||
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan )
|
||||
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
|
||||
EVT_MOUSEWHEEL( WinEDA_DrawPanel::OnMouseWheel )
|
||||
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
|
||||
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
|
||||
EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent )
|
||||
EVT_PAINT( WinEDA_DrawPanel::OnPaint )
|
||||
EVT_SIZE( WinEDA_DrawPanel::OnSize )
|
||||
EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
|
||||
EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
|
||||
EVT_MENU_RANGE( ID_PAN_UP, ID_PAN_RIGHT, WinEDA_DrawPanel::OnPan )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -72,7 +79,9 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
|
|||
{
|
||||
m_Parent = parent;
|
||||
wxASSERT( m_Parent );
|
||||
m_ScrollButt_unit = 40;
|
||||
|
||||
m_scrollIncrementX = MIN( size.x / 8, 10 );
|
||||
m_scrollIncrementY = MIN( size.y / 8, 10 );
|
||||
|
||||
SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
|
||||
ColorRefs[g_DrawBgColor].m_Green,
|
||||
|
@ -131,9 +140,13 @@ void WinEDA_DrawPanel::DrawCursor( wxDC* aDC, int aColor )
|
|||
GRSetDrawMode( aDC, GR_XOR );
|
||||
if( m_Parent->m_CursorShape == 1 ) /* Draws a crosshair. */
|
||||
{
|
||||
#ifdef USE_WX_ZOOM
|
||||
int dx = m_ClipBox.GetWidth();
|
||||
int dy = m_ClipBox.GetHeight();
|
||||
#else
|
||||
int dx = GetScreen()->Unscale( m_ClipBox.GetWidth() );
|
||||
int dy = GetScreen()->Unscale( m_ClipBox.GetHeight() );
|
||||
|
||||
#endif
|
||||
GRLine( &m_ClipBox, aDC, Cursor.x - dx, Cursor.y,
|
||||
Cursor.x + dx, Cursor.y, 0, aColor ); // Y axis
|
||||
GRLine( &m_ClipBox, aDC, Cursor.x, Cursor.y - dx,
|
||||
|
@ -141,7 +154,11 @@ void WinEDA_DrawPanel::DrawCursor( wxDC* aDC, int aColor )
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_WX_ZOOM
|
||||
int len = aDC->DeviceToLogicalXRel( CURSOR_SIZE );
|
||||
#else
|
||||
int len = GetScreen()->Unscale( CURSOR_SIZE );
|
||||
#endif
|
||||
|
||||
GRLine( &m_ClipBox, aDC, Cursor.x - len, Cursor.y,
|
||||
Cursor.x + len, Cursor.y, 0, aColor );
|
||||
|
@ -197,17 +214,17 @@ wxRealPoint WinEDA_DrawPanel::GetGrid()
|
|||
* @return position (in internal units)
|
||||
* @param ScreenPos = absolute position in pixels
|
||||
*/
|
||||
wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
|
||||
wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& aPosition )
|
||||
{
|
||||
#ifdef WX_ZOOM
|
||||
#ifdef USE_WX_ZOOM
|
||||
wxCoord x, y;
|
||||
INSTALL_DC( DC, this );
|
||||
|
||||
x = DC.DeviceToLogicalX( ScreenPos.x );
|
||||
y = DC.DeviceToLogicalY( ScreenPos.y );
|
||||
x = DC.DeviceToLogicalX( aPosition.x );
|
||||
y = DC.DeviceToLogicalY( aPosition.y );
|
||||
return wxPoint( x, y );
|
||||
#else
|
||||
return GetScreen()->CursorRealPosition( ScreenPos );
|
||||
return GetScreen()->CursorRealPosition( aPosition );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -222,7 +239,8 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
|
|||
wxPoint pos;
|
||||
EDA_Rect display_rect;
|
||||
|
||||
SetBoundaryBox();
|
||||
INSTALL_DC( dc, this ); // Refresh the boundary box.
|
||||
|
||||
display_rect = m_ClipBox;
|
||||
|
||||
// Slightly decreased the size of the useful screen area to avoid drawing
|
||||
|
@ -230,6 +248,7 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
|
|||
#define PIXEL_MARGIN 8
|
||||
display_rect.Inflate( -PIXEL_MARGIN );
|
||||
|
||||
#ifndef USE_WX_ZOOM
|
||||
// Convert physical coordinates.
|
||||
pos = CalcUnscrolledPosition( display_rect.GetPosition() );
|
||||
|
||||
|
@ -237,6 +256,7 @@ bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
|
|||
pos += GetScreen()->m_DrawOrg;
|
||||
display_rect.m_Pos = pos;
|
||||
GetScreen()->Unscale( display_rect.m_Size );
|
||||
#endif
|
||||
|
||||
return display_rect.Inside( ref_pos );
|
||||
}
|
||||
|
@ -263,6 +283,13 @@ void WinEDA_DrawPanel::PostDirtyRect( EDA_Rect aRect )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Scale and offset a rectangle in drawing units to device units.
|
||||
*
|
||||
* This is the equivalent of wxDC::LogicalToDevice.
|
||||
*
|
||||
* @param aRect - Rectangle to scale.
|
||||
*/
|
||||
void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect )
|
||||
{
|
||||
// Calculate the draw area origin in internal units:
|
||||
|
@ -270,13 +297,18 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( EDA_Rect* aRect )
|
|||
|
||||
ConvertPcbUnitsToPixelsUnits( &pos );
|
||||
aRect->SetOrigin( pos ); // rect origin in pixel units
|
||||
|
||||
#if USE_WX_ZOOM
|
||||
double scale = GetScreen()->GetScalingFactor();
|
||||
aRect->m_Size.x = wxRound( (double) aRect->m_Size.x * scale );
|
||||
aRect->m_Size.y = wxRound( (double) aRect->m_Size.y * scale );
|
||||
#else
|
||||
GetScreen()->Scale( aRect->m_Size );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition )
|
||||
/***************************************************************************/
|
||||
{
|
||||
// Calculate the draw area origin in internal units:
|
||||
wxPoint drwOrig;
|
||||
|
@ -290,6 +322,15 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition )
|
|||
drwOrig.x *= x_axis_scale;
|
||||
drwOrig.y *= y_axis_scale;
|
||||
|
||||
#if USE_WX_ZOOM
|
||||
INSTALL_DC( dc, this );
|
||||
|
||||
drwOrig.x = dc.DeviceToLogicalX( drwOrig.x );
|
||||
drwOrig.y = dc.DeviceToLogicalY( drwOrig.y );
|
||||
*aPosition -= drwOrig;
|
||||
aPosition->x = dc.LogicalToDeviceX( aPosition->x );
|
||||
aPosition->y = dc.LogicalToDeviceY( aPosition->y );
|
||||
#else
|
||||
// Origin in internal units
|
||||
GetScreen()->Unscale( drwOrig );
|
||||
|
||||
|
@ -301,6 +342,7 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition )
|
|||
|
||||
// position in pixels, relative to the visible draw area origin
|
||||
GetScreen()->Scale( *aPosition );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,18 +351,18 @@ void WinEDA_DrawPanel::ConvertPcbUnitsToPixelsUnits( wxPoint* aPosition )
|
|||
*/
|
||||
wxPoint WinEDA_DrawPanel::CursorScreenPosition()
|
||||
{
|
||||
#ifdef WX_ZOOM
|
||||
wxCoord x, y;
|
||||
wxPoint pos = GetScreen()->m_Curseur - GetScreen()->m_DrawOrg;
|
||||
|
||||
#ifdef USE_WX_ZOOM
|
||||
INSTALL_DC( DC, this );
|
||||
|
||||
x = DC.LogicalToDeviceX( GetScreen()->m_Curseur.x );
|
||||
y = DC.LogicalToDeviceY( GetScreen()->m_Curseur.y );
|
||||
return wxPoint( x, y );
|
||||
pos.x = DC.LogicalToDeviceXRel( pos.x );
|
||||
pos.y = DC.LogicalToDeviceYRel( pos.y );
|
||||
#else
|
||||
wxPoint pos = GetScreen()->m_Curseur - GetScreen()->m_DrawOrg;
|
||||
GetScreen()->Scale( pos );
|
||||
return pos;
|
||||
#endif
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
|
@ -333,19 +375,19 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void )
|
|||
wxSize size;
|
||||
wxPoint realpos;
|
||||
|
||||
size = GetClientSize() / 2;
|
||||
realpos = CalcUnscrolledPosition( wxPoint( size.x, size.y ) );
|
||||
size = GetClientSize() / 2;
|
||||
|
||||
GetScreen()->Unscale( realpos );
|
||||
#ifdef WX_ZOOM
|
||||
#ifdef USE_WX_ZOOM
|
||||
INSTALL_DC( DC, this );
|
||||
|
||||
// wxCoord x, y;
|
||||
// INSTALL_DC( DC, this );
|
||||
// realpos.x = DC.DeviceToLogicalX( realpos.x );
|
||||
// realpos.y = DC.DeviceToLogicalY( realpos.y );
|
||||
realpos.x = DC.DeviceToLogicalX( size.x );
|
||||
realpos.y = DC.DeviceToLogicalY( size.y );
|
||||
#else
|
||||
realpos = CalcUnscrolledPosition( wxPoint( size.x, size.y ) );
|
||||
GetScreen()->Unscale( realpos );
|
||||
realpos += GetScreen()->m_DrawOrg;
|
||||
#endif
|
||||
|
||||
return realpos;
|
||||
}
|
||||
|
||||
|
@ -369,7 +411,7 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
|
|||
wxPoint screenPos, drawingPos;
|
||||
wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() );
|
||||
|
||||
#ifdef WX_ZOOM
|
||||
#ifdef USE_WX_ZOOM
|
||||
CalcScrolledPosition( Mouse.x, Mouse.y, &screenPos.x, &screenPos.y );
|
||||
#else
|
||||
screenPos = Mouse - GetScreen()->m_StartVisu;
|
||||
|
@ -390,13 +432,13 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
|
|||
clientRect.width, clientRect.height, x, y );
|
||||
|
||||
if( screenPos.y < clientRect.GetTop() )
|
||||
y -= m_ScrollButt_unit * yPpu;
|
||||
y -= m_scrollIncrementY * yPpu;
|
||||
else if( screenPos.y > clientRect.GetBottom() )
|
||||
y += m_ScrollButt_unit * yPpu;
|
||||
y += m_scrollIncrementY * yPpu;
|
||||
else if( clientRect.GetRight() < screenPos.x )
|
||||
x += m_ScrollButt_unit * xPpu;
|
||||
x += m_scrollIncrementX * xPpu;
|
||||
else
|
||||
x -= m_ScrollButt_unit * xPpu;
|
||||
x -= m_scrollIncrementX * xPpu;
|
||||
|
||||
Scroll( x, y );
|
||||
CalcScrolledPosition( drawingPos.x, drawingPos.y,
|
||||
|
@ -434,10 +476,10 @@ void WinEDA_DrawPanel::OnScroll( wxScrollWinEvent& event )
|
|||
dir = event.GetOrientation(); // wxHORIZONTAL or wxVERTICAL
|
||||
|
||||
if( id == wxEVT_SCROLLWIN_LINEUP )
|
||||
value = -m_ScrollButt_unit;
|
||||
value = -m_scrollIncrementY;
|
||||
|
||||
else if( id == wxEVT_SCROLLWIN_LINEDOWN )
|
||||
value = m_ScrollButt_unit;
|
||||
value = m_scrollIncrementY;
|
||||
|
||||
else if( id == wxEVT_SCROLLWIN_THUMBTRACK )
|
||||
{
|
||||
|
@ -468,7 +510,9 @@ void WinEDA_DrawPanel::OnScroll( wxScrollWinEvent& event )
|
|||
|
||||
void WinEDA_DrawPanel::OnSize( wxSizeEvent& event )
|
||||
{
|
||||
SetBoundaryBox();
|
||||
#if !defined( USE_WX_GRAPHICS_CONTEXT ) // Crashes Cairo on initial size event.
|
||||
INSTALL_DC( dc, this ); // Update boundary box.
|
||||
#endif
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
@ -476,35 +520,41 @@ void WinEDA_DrawPanel::OnSize( wxSizeEvent& event )
|
|||
/** Function SetBoundaryBox()
|
||||
* set the m_ClipBox member to the current displayed rectangle dimensions
|
||||
*/
|
||||
void WinEDA_DrawPanel::SetBoundaryBox()
|
||||
void WinEDA_DrawPanel::SetBoundaryBox( wxDC* dc )
|
||||
{
|
||||
wxASSERT( dc != NULL );
|
||||
|
||||
BASE_SCREEN* Screen = GetScreen();;
|
||||
|
||||
if( !Screen )
|
||||
return;
|
||||
wxPoint org;
|
||||
int ii, jj;
|
||||
|
||||
GetViewStart( &org.x, &org.y );
|
||||
GetScrollPixelsPerUnit( &ii, &jj );
|
||||
org.x *= ii;
|
||||
org.y *= jj;
|
||||
|
||||
Screen->m_StartVisu = org;
|
||||
|
||||
m_ClipBox.SetOrigin( org );
|
||||
Screen->m_StartVisu = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
|
||||
m_ClipBox.SetOrigin( wxPoint( 0, 0 ) );
|
||||
m_ClipBox.SetSize( GetClientSize() );
|
||||
|
||||
#ifdef WX_ZOOM
|
||||
CalcUnscrolledPosition( m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y,
|
||||
&m_ClipBox.m_Pos.x, &m_ClipBox.m_Pos.y );
|
||||
int scrollX, scrollY;
|
||||
|
||||
#ifdef USE_WX_ZOOM
|
||||
scrollX = dc->LogicalToDeviceXRel( wxRound( Screen->GetGridSize().x ) );
|
||||
scrollY = dc->LogicalToDeviceYRel( wxRound( Screen->GetGridSize().y ) );
|
||||
#else
|
||||
m_ClipBox.m_Pos -= GetScreen()->m_StartVisu;
|
||||
scrollX = wxRound( Screen->Scale( Screen->GetGridSize().x ) );
|
||||
scrollY = wxRound( Screen->Scale( Screen->GetGridSize().y ) );
|
||||
#endif
|
||||
|
||||
m_ScrollButt_unit = MIN( Screen->m_SizeVisu.x, Screen->m_SizeVisu.y ) / 4;
|
||||
if( m_ScrollButt_unit < 2 )
|
||||
m_ScrollButt_unit = 2;
|
||||
m_scrollIncrementX = MAX( GetClientSize().x / 8, scrollX );
|
||||
m_scrollIncrementY = MAX( GetClientSize().y / 8, scrollY );
|
||||
|
||||
|
||||
#ifdef USE_WX_ZOOM
|
||||
/* Using wxDC scaling requires clipping in drawing (logical) units. */
|
||||
|
||||
m_ClipBox.m_Pos.x = dc->DeviceToLogicalX( 0 );
|
||||
m_ClipBox.m_Pos.y = dc->DeviceToLogicalY( 0 );
|
||||
m_ClipBox.m_Size.x = dc->DeviceToLogicalXRel( m_ClipBox.m_Size.x );
|
||||
m_ClipBox.m_Size.y = dc->DeviceToLogicalYRel( m_ClipBox.m_Size.y );
|
||||
#endif
|
||||
|
||||
Screen->m_ScrollbarPos.x = GetScrollPos( wxHORIZONTAL );
|
||||
Screen->m_ScrollbarPos.y = GetScrollPos( wxVERTICAL );
|
||||
|
@ -515,38 +565,31 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC )
|
|||
{
|
||||
GRSetDrawMode( DC, GR_COPY );
|
||||
|
||||
#ifndef WX_ZOOM
|
||||
GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
|
||||
m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
|
||||
0, g_DrawBgColor, g_DrawBgColor );
|
||||
#else
|
||||
EDA_Rect tmp = m_ClipBox;
|
||||
|
||||
m_ClipBox.m_Pos.x = DC->DeviceToLogicalX( m_ClipBox.m_Pos.x );
|
||||
m_ClipBox.m_Pos.y = DC->DeviceToLogicalY( m_ClipBox.m_Pos.y );
|
||||
m_ClipBox.m_Size.SetWidth(
|
||||
DC->DeviceToLogicalXRel( m_ClipBox.m_Size.GetWidth() ) );
|
||||
m_ClipBox.m_Size.SetHeight(
|
||||
DC->DeviceToLogicalYRel( m_ClipBox.m_Size.GetHeight() ) );
|
||||
|
||||
GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
|
||||
m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
|
||||
0, g_DrawBgColor, g_DrawBgColor );
|
||||
|
||||
m_ClipBox = tmp;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
void WinEDA_DrawPanel::DoPrepareDC(wxDC& dc)
|
||||
{
|
||||
#ifdef USE_WX_ZOOM
|
||||
if( GetScreen() != NULL )
|
||||
{
|
||||
double scale = GetScreen()->GetScalingFactor();
|
||||
|
||||
// note: wxUSE_GRAPHICS_CONTEXT must be set to 1 in wxWidgets
|
||||
// see setup.h in wx Widgets.
|
||||
// wxWidgets configure can need option --enable-graphics_ctx
|
||||
// Currently, **only for tests**
|
||||
//#define USE_GCDC_IN_KICAD // uncomment it to use wxGCDC
|
||||
SetScale( scale, scale );
|
||||
wxScrolledWindow::DoPrepareDC( dc );
|
||||
wxPoint origin = GetScreen()->m_DrawOrg;
|
||||
dc.SetLogicalOrigin( origin.x, origin.y );
|
||||
}
|
||||
#endif
|
||||
|
||||
GRResetPenAndBrush( &dc );
|
||||
dc.SetBackgroundMode( wxTRANSPARENT );
|
||||
SetBoundaryBox( &dc );
|
||||
}
|
||||
|
||||
|
||||
void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
|
||||
{
|
||||
|
@ -556,64 +599,45 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_GCDC_IN_KICAD
|
||||
wxPaintDC pDC( this );
|
||||
|
||||
// Following line should be disabled on MSW and OS X
|
||||
wxGCDC paintDC( pDC );
|
||||
|
||||
// Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187
|
||||
paintDC.GetGraphicsContext()->Translate( 0.5, 0.5 );
|
||||
#else
|
||||
INSTALL_PAINTDC( paintDC, this );
|
||||
#endif
|
||||
|
||||
/* wxAutoBufferedPaintDC does not work correctly by setting the user scale and
|
||||
* logcial offset. The bitmap coordinates and scaling are not effected by the
|
||||
* code below. It appears that the wxBufferPaintDC needs to be created with the
|
||||
* wxBUFFER_VIRTUAL_AREA set and the wirtual method wxWindow::PrepareDC() needs
|
||||
* to be overridden to set up the buffered paint DC properly. The bitmap grid
|
||||
* draw code ( see DrawGrid() below ) will have to be fixed before this can be
|
||||
* implemented.
|
||||
*/
|
||||
|
||||
EDA_Rect tmp;
|
||||
wxRect PaintClipBox;
|
||||
wxPoint org;
|
||||
|
||||
SetBoundaryBox();
|
||||
|
||||
tmp = m_ClipBox;
|
||||
|
||||
org = m_ClipBox.GetOrigin();
|
||||
|
||||
wxRegion upd = GetUpdateRegion(); // get the update rect list
|
||||
|
||||
// get the union of all rectangles in the update region, 'upd'
|
||||
PaintClipBox = upd.GetBox();
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
printf( "1) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) m_ClipBox=(%d, %d, %d, %d)\n",
|
||||
PaintClipBox.x,
|
||||
PaintClipBox.y,
|
||||
PaintClipBox.width,
|
||||
PaintClipBox.height,
|
||||
org.x, org.y,
|
||||
m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y,
|
||||
m_ClipBox.m_Size.x, m_ClipBox.m_Size.y
|
||||
);
|
||||
#if 0
|
||||
wxLogDebug( wxT( "1) PaintClipBox=(%d, %d, %d, %d), m_ClipBox=(%d, %d, %d, %d)" ),
|
||||
PaintClipBox.x, PaintClipBox.y, PaintClipBox.width, PaintClipBox.height,
|
||||
m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y, m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
|
||||
#endif
|
||||
|
||||
#ifdef WX_ZOOM
|
||||
wxLogDebug( wxT( "1) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) " \
|
||||
"m_ClipBox=(%d, %d, %d, %d)\n" ), PaintClipBox.x,
|
||||
PaintClipBox.y, PaintClipBox.width, PaintClipBox.height,
|
||||
org.x, org.y, m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y,
|
||||
m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
|
||||
|
||||
wxSize drawing_size = GetScreen()->ReturnPageSize() * 2;
|
||||
m_ClipBox.m_Pos.x = 0;
|
||||
m_ClipBox.m_Pos.y = 0;
|
||||
m_ClipBox.SetWidth( drawing_size.x );
|
||||
m_ClipBox.SetHeight( drawing_size.y );
|
||||
|
||||
wxLogDebug( wxT( "2) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) " \
|
||||
"m_ClipBox=(%d, %d, %d, %d)\n" ), PaintClipBox.x,
|
||||
PaintClipBox.y, PaintClipBox.width, PaintClipBox.height,
|
||||
org.x, org.y, m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y,
|
||||
m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
|
||||
#if defined( USE_WX_ZOOM )
|
||||
/* When using wxDC scaling the clipping region coordinates are in drawing
|
||||
* (logical) units.
|
||||
*/
|
||||
m_ClipBox.m_Pos.x = paintDC.DeviceToLogicalX( PaintClipBox.x );
|
||||
m_ClipBox.m_Pos.y = paintDC.DeviceToLogicalY( PaintClipBox.y );
|
||||
m_ClipBox.m_Size.x = paintDC.DeviceToLogicalXRel( PaintClipBox.width );
|
||||
m_ClipBox.m_Size.y = paintDC.DeviceToLogicalYRel( PaintClipBox.height );
|
||||
#else
|
||||
PaintClipBox.Offset( org );
|
||||
/* When using Kicads scaling the clipping region coordinates are in screen
|
||||
* (device) units.
|
||||
*/
|
||||
m_ClipBox.SetX( PaintClipBox.GetX() );
|
||||
m_ClipBox.SetY( PaintClipBox.GetY() );
|
||||
m_ClipBox.SetWidth( PaintClipBox.GetWidth() );
|
||||
|
@ -623,31 +647,19 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
|
|||
// Be sure the drawpanel clipbox is bigger than the region to repair:
|
||||
m_ClipBox.Inflate( 1 ); // Give it one pixel more in each direction
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
printf( "2) PaintClipBox=(%d, %d, %d, %d) org=(%d, %d) m_ClipBox=(%d, %d, %d, %d)\n",
|
||||
PaintClipBox.x,
|
||||
PaintClipBox.y,
|
||||
PaintClipBox.width,
|
||||
PaintClipBox.height,
|
||||
org.x, org.y,
|
||||
m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y,
|
||||
m_ClipBox.m_Size.x, m_ClipBox.m_Size.y
|
||||
);
|
||||
#if 0
|
||||
wxLogDebug( wxT( "2) PaintClipBox=(%d, %d, %d, %d), m_ClipBox=(%d, %d, %d, %d)" ),
|
||||
PaintClipBox.x, PaintClipBox.y, PaintClipBox.width, PaintClipBox.height,
|
||||
m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y, m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
|
||||
#endif
|
||||
|
||||
|
||||
#if defined( USE_WX_ZOOM ) && defined( KICAD_USE_BUFFERED_PAINTDC )
|
||||
PaintClipBox = m_ClipBox;
|
||||
|
||||
#endif
|
||||
// call ~wxDCClipper() before ~wxPaintDC()
|
||||
{
|
||||
#ifndef WX_ZOOM
|
||||
wxDCClipper dcclip( paintDC, PaintClipBox );
|
||||
#endif
|
||||
ReDraw( &paintDC, true );
|
||||
|
||||
#ifdef WX_ZOOM
|
||||
paintDC.SetUserScale( 1.0, 1.0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
m_ClipBox = tmp;
|
||||
|
@ -743,12 +755,25 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
|
|||
* and zoom value are sufficient
|
||||
*/
|
||||
screen_grid_size = screen->GetGridSize();
|
||||
org = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
|
||||
screen->m_StartVisu = org;
|
||||
size = GetClientSize();
|
||||
|
||||
#ifdef USE_WX_ZOOM
|
||||
if( DC->LogicalToDeviceXRel( wxRound( screen_grid_size.x ) ) < 5
|
||||
|| DC->LogicalToDeviceXRel( wxRound( screen_grid_size.y ) ) < 5 )
|
||||
return;
|
||||
|
||||
org.x = DC->DeviceToLogicalX( 0 );
|
||||
org.y = DC->DeviceToLogicalY( 0 );
|
||||
size.SetWidth( DC->DeviceToLogicalXRel( size.GetWidth() ) );
|
||||
size.SetHeight( DC->DeviceToLogicalYRel( size.GetHeight() ) );
|
||||
#else
|
||||
wxRealPoint dgrid = screen_grid_size;
|
||||
screen->Scale( dgrid ); // dgrid = grid size in pixels
|
||||
|
||||
// if the grid size is small ( < 5 pixels) do not display all points
|
||||
if( dgrid.x < 5 )
|
||||
if( dgrid.x < 5 )
|
||||
{
|
||||
screen_grid_size.x *= 2;
|
||||
dgrid.x *= 2;
|
||||
|
@ -765,29 +790,9 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
|
|||
return; // The grid is too small
|
||||
|
||||
|
||||
GetViewStart( &org.x, &org.y );
|
||||
GetScrollPixelsPerUnit( &ii, &jj );
|
||||
org.x *= ii;
|
||||
org.y *= jj;
|
||||
screen->m_StartVisu = org;
|
||||
screen->Unscale( org );
|
||||
|
||||
org += screen->m_DrawOrg;
|
||||
|
||||
size = GetClientSize();
|
||||
screen->Unscale( size );
|
||||
|
||||
#ifdef WX_ZOOM
|
||||
screen_grid_size = screen->GetGridSize();
|
||||
|
||||
if( DC->LogicalToDeviceXRel( (int) screen_grid_size.x ) < 5
|
||||
|| DC->LogicalToDeviceYRel( (int) screen_grid_size.y ) < 5 )
|
||||
drawgrid = false;
|
||||
|
||||
org.x = DC->DeviceToLogicalX( org.x );
|
||||
org.y = DC->DeviceToLogicalY( org.y );
|
||||
size.SetWidth( DC->DeviceToLogicalXRel( size.GetWidth() ) );
|
||||
size.SetHeight( DC->DeviceToLogicalYRel( size.GetHeight() ) );
|
||||
screen->Unscale( org );
|
||||
org += screen->m_DrawOrg;
|
||||
#endif
|
||||
|
||||
m_Parent->PutOnGrid( &org );
|
||||
|
@ -805,7 +810,12 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
|
|||
wxWindowUpdateLocker( this ); // under macOSX: drawings are faster with this
|
||||
#endif
|
||||
|
||||
#if defined( __WXMAC__ )
|
||||
|
||||
/* The bitmap grid drawing code below cannot be used when wxDC scaling is used
|
||||
* as it does not scale the grid bitmap properly. This needs to be fixed.
|
||||
*/
|
||||
|
||||
#if defined( __WXMAC__ ) || defined( USE_WX_ZOOM )
|
||||
// Use a pixel based draw to display grid
|
||||
// There is a lot of calls, so the cost is hight
|
||||
// and grid is slowly drawn on some platforms
|
||||
|
@ -840,7 +850,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
|
|||
|
||||
wxSize screenSize = GetClientSize();
|
||||
wxMemoryDC tmpDC;
|
||||
wxBitmap tmpBM(1, screenSize.y);
|
||||
wxBitmap tmpBM( 1, screenSize.y );
|
||||
tmpDC.SelectObject( tmpBM );
|
||||
GRSetColorPen( &tmpDC, g_DrawBgColor );
|
||||
tmpDC.DrawLine( 0, 0, 0, screenSize.y-1 ); // init background
|
||||
|
@ -978,8 +988,12 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_WX_ZOOM
|
||||
GetScreen()->m_Curseur = CursorRealPosition( event.GetPosition() );
|
||||
#else
|
||||
GetScreen()->m_Curseur =
|
||||
CursorRealPosition( CalcUnscrolledPosition( event.GetPosition() ) );
|
||||
#endif
|
||||
|
||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||
cmd.SetEventObject( this );
|
||||
|
@ -1078,13 +1092,20 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
|||
|
||||
localrealbutt |= localbutt; /* compensation default wxGTK */
|
||||
|
||||
/* Compute absolute m_MousePosition in pixel units: */
|
||||
screen->m_MousePositionInPixels =
|
||||
CalcUnscrolledPosition( event.GetPosition() );
|
||||
#ifdef USE_WX_ZOOM
|
||||
/* Compute the cursor position in screen (device) units. */
|
||||
screen->m_MousePositionInPixels = event.GetPosition();
|
||||
|
||||
/* Compute absolute m_MousePosition in user units: */
|
||||
/* Compute the cursor position in drawing (logical) units. */
|
||||
screen->m_MousePosition = CursorRealPosition( event.GetPosition() );
|
||||
#else
|
||||
/* Compute the cursor position in screen (device) units. */
|
||||
screen->m_MousePositionInPixels = CalcUnscrolledPosition( event.GetPosition() );
|
||||
|
||||
/* Compute the cursor position in drawing (logical) units. */
|
||||
screen->m_MousePosition =
|
||||
CursorRealPosition( screen->m_MousePositionInPixels );
|
||||
CursorRealPosition( CalcUnscrolledPosition( event.GetPosition() ) );
|
||||
#endif
|
||||
|
||||
INSTALL_DC( DC, this );
|
||||
|
||||
|
@ -1347,7 +1368,6 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
|
|||
|
||||
BASE_SCREEN* Screen = GetScreen();
|
||||
|
||||
|
||||
g_KeyPressed = localkey;
|
||||
|
||||
if( escape )
|
||||
|
@ -1366,17 +1386,18 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
|
|||
}
|
||||
|
||||
/* Some key commands use the current mouse position: refresh it */
|
||||
#ifdef WX_ZOOM
|
||||
pos = CalcUnscrolledPosition( wxGetMousePosition() );
|
||||
#ifdef USE_WX_ZOOM
|
||||
pos = wxGetMousePosition() - GetScreenPosition();
|
||||
#else
|
||||
pos = CalcUnscrolledPosition( wxGetMousePosition() - GetScreenPosition() );
|
||||
#endif
|
||||
|
||||
/* Compute absolute mouse position in pixel units (i.e. considering the
|
||||
* current scroll) : */
|
||||
/* Compute cursor position in screen units (pixel) including the
|
||||
* current scroll bar position. Also known as device units to wxDC. */
|
||||
Screen->m_MousePositionInPixels = pos;
|
||||
|
||||
/* Compute absolute mouse position in user units: */
|
||||
/* Compute the cursor position in drawing units. Also known as logical units
|
||||
* to wxDC. */
|
||||
Screen->m_MousePosition = CursorRealPosition( pos );
|
||||
|
||||
m_Parent->GeneralControle( &DC, pos );
|
||||
|
@ -1396,19 +1417,19 @@ void WinEDA_DrawPanel::OnPan( wxCommandEvent& event )
|
|||
switch( event.GetId() )
|
||||
{
|
||||
case ID_PAN_UP:
|
||||
y -= m_ScrollButt_unit;
|
||||
y -= m_scrollIncrementY;
|
||||
break;
|
||||
|
||||
case ID_PAN_DOWN:
|
||||
y += m_ScrollButt_unit;
|
||||
y += m_scrollIncrementY;
|
||||
break;
|
||||
|
||||
case ID_PAN_LEFT:
|
||||
x -= m_ScrollButt_unit;
|
||||
x -= m_scrollIncrementX;
|
||||
break;
|
||||
|
||||
case ID_PAN_RIGHT:
|
||||
x += m_ScrollButt_unit;
|
||||
x += m_scrollIncrementX;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -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:
|
||||
#ifdef KICAD_USE_BUFFERED_DC
|
||||
|
||||
#define INSTALL_DC(name,parent) \
|
||||
KicadGraphicContext _cDC( parent );\
|
||||
wxBufferedDC name(&_cDC, _cDC.GetSize() );
|
||||
#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
|
||||
#define INSTALL_DC(name,parent) KicadGraphicContext name( parent )
|
||||
#ifdef KICAD_USE_BUFFERED_DC
|
||||
#define INSTALL_DC(name,parent) \
|
||||
wxClientDC _cDC( parent ); \
|
||||
wxBufferedDC name(&_cDC, _cDC.GetSize() ); \
|
||||
parent->DoPrepareDC( name );
|
||||
#else
|
||||
#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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue