Commit dd091fc6 authored by Dick Hollenbeck's avatar Dick Hollenbeck

merge in mainline into KICAD_PLUGIN work, which is for the PCBNEW nanometer support

parents 90bb27ca 152b8d91
......@@ -49,13 +49,20 @@ int S3D_MASTER::ReadData()
return 1;
}
if( wxFileName::FileExists( m_Shape3DName ) )
wxString shape3DNname = m_Shape3DName;
#ifdef __WINDOWS__
shape3DNname.Replace( wxT("/"), wxT("\\") );
#else
shape3DNname.Replace( wxT("\\"), wxT("/") );
#endif
if( wxFileName::FileExists( shape3DNname ) )
{
FullFilename = m_Shape3DName;
FullFilename = shape3DNname;
}
else
{
fn = m_Shape3DName;
fn = shape3DNname;
FullFilename = wxGetApp().FindLibraryPath( fn );
if( FullFilename.IsEmpty() )
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -478,18 +478,21 @@ PICKED_ITEMS_LIST* BASE_SCREEN::PopCommandFromRedoList( )
}
void BASE_SCREEN::AddItem( EDA_ITEM* aItem )
#if defined(DEBUG)
void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) const
{
wxCHECK_RET( aItem != NULL, wxT( "Attempt to add NULL item pointer to " ) + GetClass() +
wxT( "item list" ) );
m_items.push_back( aItem );
}
// for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
/* this class will eventually go away, but here's a place holder until then.
for( EDA_ITEM* item = m_drawList; item; item = item->Next() )
{
item->Show( nestLevel+1, os );
}
*/
void BASE_SCREEN::InsertItem( EDA_ITEMS::iterator aIter, EDA_ITEM* aItem )
{
wxCHECK_RET( aItem != NULL, wxT( "Attempt to insert NULL item pointer to " ) + GetClass() +
wxT( "item list" ) );
m_items.insert( aIter, aItem );
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif
......@@ -427,7 +427,7 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
EDA_Colors aColor, int aDrawMode,
GRTraceMode aFillMode, EDA_Colors aAnchor_color )
EDA_DRAW_MODE_T aFillMode, EDA_Colors aAnchor_color )
{
if( m_MultilineAllowed )
{
......@@ -471,13 +471,13 @@ void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,
int aDrawMode, GRTraceMode aFillMode,
int aDrawMode, EDA_DRAW_MODE_T aFillMode,
EDA_Colors aAnchor_color,
wxString& aText, wxPoint aPos )
{
int width = m_Thickness;
if( aFillMode == FILAIRE )
if( aFillMode == LINE )
width = 0;
if( aDrawMode != -1 )
......@@ -494,10 +494,10 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
int cX = aPos.x + aOffset.x;
int cY = aPos.y + aOffset.y;
GRLine( &aPanel->m_ClipBox, aDC, cX - anchor_size, cY,
GRLine( aPanel->GetClipBox(), aDC, cX - anchor_size, cY,
cX + anchor_size, cY, 0, aAnchor_color );
GRLine( &aPanel->m_ClipBox, aDC, cX, cY - anchor_size,
GRLine( aPanel->GetClipBox(), aDC, cX, cY - anchor_size,
cX, cY + anchor_size, 0, aAnchor_color );
}
......
......@@ -131,10 +131,10 @@ void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
GRSetDrawMode( aDC, aDrawMode );
if( w == 0 || h == 0 )
GRLine( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y,
GRLine( aPanel->GetClipBox(), aDC, GetX() + aOffset.x, GetY() + aOffset.y,
GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );
else
GRRect( &aPanel->m_ClipBox, aDC, GetX() + aOffset.x, GetY() + aOffset.y,
GRRect( aPanel->GetClipBox(), aDC, GetX() + aOffset.x, GetY() + aOffset.y,
GetRight() + aOffset.x, GetBottom() + aOffset.y, 0, aColor );
}
......@@ -241,7 +241,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
{
DisplayError( this, wxT( "No Block to paste" ), 20 );
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
m_canvas->m_mouseCaptureCallback = NULL;
m_canvas->SetMouseCaptureCallback( NULL );
return true;
}
......@@ -254,7 +254,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
}
Block->m_State = STATE_BLOCK_MOVE;
m_canvas->m_mouseCaptureCallback( m_canvas, DC, startpos, false );
m_canvas->CallMouseCapture( DC, startpos, false );
break;
default:
......@@ -314,7 +314,7 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Panel->IsMouseCaptured() ) /* Erase current drawing on screen */
{
/* Clear block outline. */
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false );
Panel->CallMouseCapture( DC, wxDefaultPosition, false );
Panel->SetMouseCapture( NULL, NULL );
screen->SetCurItem( NULL );
......
......@@ -162,7 +162,7 @@ void MARKER_BASE::DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
corners[ii] += m_Pos + aOffset;
}
GRClosedPoly( &aPanel->m_ClipBox, aDC, CORNERS_COUNT, corners,
GRClosedPoly( aPanel->GetClipBox(), aDC, CORNERS_COUNT, corners,
true, // = Filled
0, // outline width
m_Color, // outline color
......
......@@ -252,7 +252,7 @@ void PLOTTER::marker( const wxPoint& position, int diametre, int aShapeId )
/* Convert a thick segment and plot it as an oval */
void PLOTTER::segment_as_oval( wxPoint start, wxPoint end, int width,
GRTraceMode tracemode )
EDA_DRAW_MODE_T tracemode )
{
wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 );
wxSize size( end.x - start.x, end.y - start.y );
......@@ -326,12 +326,12 @@ void PLOTTER::sketch_oval( wxPoint pos, wxSize size, int orient,
/* Plot 1 segment like a track segment
*/
void PLOTTER::thick_segment( wxPoint start, wxPoint end, int width,
GRTraceMode tracemode )
EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case FILLED:
case FILAIRE:
case LINE:
set_current_line_width( tracemode==FILLED ? width : -1 );
move_to( start );
finish_to( end );
......@@ -346,11 +346,11 @@ void PLOTTER::thick_segment( wxPoint start, wxPoint end, int width,
void PLOTTER::thick_arc( wxPoint centre, int StAngle, int EndAngle, int radius,
int width, GRTraceMode tracemode )
int width, EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case FILAIRE:
case LINE:
set_current_line_width( -1 );
arc( centre, StAngle, EndAngle, radius, NO_FILL, -1 );
break;
......@@ -371,11 +371,11 @@ void PLOTTER::thick_arc( wxPoint centre, int StAngle, int EndAngle, int radius,
void PLOTTER::thick_rect( wxPoint p1, wxPoint p2, int width,
GRTraceMode tracemode )
EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case FILAIRE:
case LINE:
rect( p1, p2, NO_FILL, -1 );
break;
......@@ -401,11 +401,11 @@ void PLOTTER::thick_rect( wxPoint p1, wxPoint p2, int width,
void PLOTTER::thick_circle( wxPoint pos, int diametre, int width,
GRTraceMode tracemode )
EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
case FILAIRE:
case LINE:
circle( pos, diametre, NO_FILL, -1 );
break;
......
......@@ -213,15 +213,17 @@ void DXF_PLOTTER::set_dash( bool dashed )
* @param aPlotMode = FILLED, SKETCH ..
*/
void DXF_PLOTTER::thick_segment( wxPoint aStart, wxPoint aEnd, int aWidth,
GRTraceMode aPlotMode )
EDA_DRAW_MODE_T aPlotMode )
{
if( aPlotMode == FILAIRE ) /* just a line is Ok */
if( aPlotMode == LINE ) /* just a line is Ok */
{
move_to( aStart );
finish_to( aEnd );
}
else
{
segment_as_oval( aStart, aEnd, aWidth, aPlotMode );
}
}
......@@ -253,7 +255,7 @@ void DXF_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius,
/* Plot oval pad at position. */
void DXF_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode trace_mode )
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
......@@ -272,7 +274,7 @@ void DXF_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
/* Plot round pad or via. */
void DXF_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode trace_mode )
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
circle( pos, diametre, NO_FILL );
......@@ -283,7 +285,7 @@ void DXF_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
* Plot rectangular pad vertical or horizontal (rectangular Pad)
*/
void DXF_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
int orient, GRTraceMode trace_mode )
int orient, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
wxSize size;
......@@ -353,7 +355,7 @@ void DXF_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
* Plot mode = FILLED, SKETCH (unused)
*/
void DXF_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, GRTraceMode aTrace_Mode )
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
wxASSERT( output_file );
wxPoint coord[4]; /* coord actual corners of a trapezoidal trace */
......
......@@ -369,14 +369,14 @@ void GERBER_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFac
/* Function flash_pad_circle
* Plot a circular pad or via at the user position pos
*/
void GERBER_PLOTTER::flash_pad_circle( wxPoint pos, int diametre, GRTraceMode trace_mode )
void GERBER_PLOTTER::flash_pad_circle( wxPoint pos, int diametre, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
wxSize size( diametre, diametre );
switch( trace_mode )
{
case FILAIRE:
case LINE:
case SKETCH:
set_current_line_width( -1 );
circle( pos, diametre - current_pen_width, NO_FILL );
......@@ -398,7 +398,7 @@ void GERBER_PLOTTER::flash_pad_circle( wxPoint pos, int diametre, GRTraceMode tr
* For any orientation the shape is drawn as a segment
*/
void GERBER_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode trace_mode )
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
int x0, y0, x1, y1, delta;
......@@ -455,7 +455,7 @@ void GERBER_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
* For others shape the direction is plotted as a polygon.
*/
void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode )
int orient, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
......@@ -472,7 +472,7 @@ void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size,
case 1800:
switch( trace_mode )
{
case FILAIRE:
case LINE:
case SKETCH:
set_current_line_width( -1 );
rect( wxPoint( pos.x - (size.x - current_pen_width) / 2,
......@@ -522,7 +522,7 @@ void GERBER_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size,
* Plot mode = FILLED or SKETCH
*/
void GERBER_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, GRTraceMode aTrace_Mode )
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
// polygon corners list
......
......@@ -204,13 +204,13 @@ void HPGL_PLOTTER::set_dash( bool dashed )
* @param width = segment width (thickness)
* @param tracemode = FILLED, SKETCH ..
*/
void HPGL_PLOTTER::thick_segment( wxPoint start, wxPoint end, int width, GRTraceMode tracemode )
void HPGL_PLOTTER::thick_segment( wxPoint start, wxPoint end, int width, EDA_DRAW_MODE_T tracemode )
{
wxASSERT( output_file );
wxPoint center;
wxSize size;
if( (pen_diameter >= width) || (tracemode == FILAIRE) ) /* just a line is
if( (pen_diameter >= width) || (tracemode == LINE) ) /* just a line is
* Ok */
{
move_to( start );
......@@ -267,7 +267,7 @@ void HPGL_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
/* Plot oval pad.
*/
void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode trace_mode )
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
int deltaxy, cx, cy;
......@@ -306,7 +306,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
/* Plot round pad or via.
*/
void HPGL_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode trace_mode )
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
int rayon, delta;
......@@ -315,7 +315,8 @@ void HPGL_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
delta = wxRound( pen_diameter - pen_overlap );
rayon = diametre / 2;
if( trace_mode != FILAIRE )
if( trace_mode != LINE )
{
rayon = ( diametre - wxRound( pen_diameter ) ) / 2;
}
......@@ -357,7 +358,7 @@ void HPGL_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
* Units are user units
*/
void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
int orient, GRTraceMode trace_mode )
int orient, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( output_file );
wxSize size;
......@@ -367,7 +368,7 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
size.x = padsize.x / 2;
size.y = padsize.y / 2;
if( trace_mode != FILAIRE )
if( trace_mode != LINE )
{
size.x = (padsize.x - (int) pen_diameter) / 2;
size.y = (padsize.y - (int) pen_diameter) / 2;
......@@ -475,7 +476,7 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
* Plot mode FILLED or SKETCH
*/
void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, GRTraceMode aTrace_Mode )
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
wxASSERT( output_file );
wxPoint polygone[4]; // coordinates of corners relatives to the pad
......
......@@ -456,7 +456,7 @@ bool PS_PLOTTER::end_plot()
* The shape is drawn as a segment
*/
void PS_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
GRTraceMode modetrace )
EDA_DRAW_MODE_T modetrace )
{
wxASSERT( output_file );
int x0, y0, x1, y1, delta;
......@@ -489,7 +489,7 @@ void PS_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
/* Plot round pad or via.
*/
void PS_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode modetrace )
EDA_DRAW_MODE_T modetrace )
{
wxASSERT( output_file );
......@@ -509,7 +509,7 @@ void PS_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
/* Plot rectangular pad in any orientation.
*/
void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size,
int orient, GRTraceMode trace_mode )
int orient, EDA_DRAW_MODE_T trace_mode )
{
static std::vector< wxPoint > cornerList;
cornerList.clear();
......@@ -557,7 +557,7 @@ void PS_PLOTTER::flash_pad_rect( wxPoint pos, wxSize size,
* Plot mode FILLED or SKETCH
*/
void PS_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
int aPadOrient, GRTraceMode aTrace_Mode )
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
static std::vector< wxPoint > cornerList;
cornerList.clear();
......
/////////////////////////////////////////////////////////////////////////////
// Name: copy_to_clipboard.cpp
// Author: jean-pierre Charras
// Created: 18 aug 2006
// Licence: License GNU
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file copy_to_clipboard.cpp
*/
#include "wx/metafile.h"
#include "fctsys.h"
......@@ -73,7 +94,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
wxMetafileDC dc;
EDA_RECT tmp = aFrame->GetCanvas()->m_ClipBox;
EDA_RECT tmp = *aFrame->GetCanvas()->GetClipBox();
GRResetPenAndBrush( &dc );
const bool plotBlackAndWhite = false;
GRForceBlackPen( plotBlackAndWhite );
......@@ -81,10 +102,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
dc.SetUserScale( scale, scale );
ClipboardSizeX = dc.MaxX() + 10;
ClipboardSizeY = dc.MaxY() + 10;
aFrame->GetCanvas()->m_ClipBox.SetX( 0 );
aFrame->GetCanvas()->m_ClipBox.SetY( 0 );
aFrame->GetCanvas()->m_ClipBox.SetWidth( 0x7FFFFF0 );
aFrame->GetCanvas()->m_ClipBox.SetHeight( 0x7FFFFF0 );
aFrame->GetCanvas()->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) );
if( DrawBlock )
{
......@@ -94,7 +112,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
const int maskLayer = 0xFFFFFFFF;
aFrame->PrintPage( &dc, maskLayer, false );
screen->m_IsPrinting = false;
aFrame->GetCanvas()->m_ClipBox = tmp;
aFrame->GetCanvas()->SetClipBox( tmp );
wxMetafile* mf = dc.Close();
if( mf )
......
This diff is collapsed.
......@@ -28,10 +28,7 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "class_bitmap_base.h"
#include "dialog_image_editor.h"
......
......@@ -183,7 +183,7 @@ void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event )
m_FrameIsActive = event.GetActive();
if( m_canvas )
m_canvas->m_CanStartBlock = -1;
m_canvas->SetCanStartBlock( -1 );
event.Skip(); // required under wxMAC
}
......@@ -192,7 +192,7 @@ void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event )
void EDA_DRAW_FRAME::OnMenuOpen( wxMenuEvent& event )
{
if( m_canvas )
m_canvas->m_CanStartBlock = -1;
m_canvas->SetCanStartBlock( -1 );
event.Skip();
}
......@@ -486,7 +486,7 @@ int EDA_DRAW_FRAME::ReturnBlockCommand( int key )
void EDA_DRAW_FRAME::InitBlockPasteInfos()
{
GetScreen()->m_BlockLocate.ClearItemsList();
m_canvas->m_mouseCaptureCallback = NULL;
m_canvas->SetMouseCaptureCallback( NULL );
}
......
......@@ -94,19 +94,19 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_ClipBox.SetSize( size );
m_ClipBox.SetX( 0 );
m_ClipBox.SetY( 0 );
m_CanStartBlock = -1; // Command block can start if >= 0
m_AbortEnable = m_AbortRequest = false;
m_AutoPAN_Enable = true;
m_IgnoreMouseEvents = 0;
m_canStartBlock = -1; // Command block can start if >= 0
m_abortRequest = false;
m_enableAutoPan = true;
m_ignoreMouseEvents = false;
m_mouseCaptureCallback = NULL;
m_endMouseCaptureCallback = NULL;
if( wxGetApp().GetSettings() )
wxGetApp().GetSettings()->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable, true );
wxGetApp().GetSettings()->Read( wxT( "AutoPAN" ), &m_enableAutoPan, true );
m_AutoPAN_Request = false;
m_Block_Enable = false;
m_requestAutoPan = false;
m_enableBlockCommands = false;
#ifdef __WXMAC__
m_defaultCursor = m_currentCursor = wxCURSOR_CROSS;
......@@ -116,14 +116,14 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_showCrossHair = true;
#endif
m_cursorLevel = 0;
m_cursorLevel = 0;
m_PrintIsMirrored = false;
}
EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
{
wxGetApp().GetSettings()->Write( wxT( "AutoPAN" ), m_AutoPAN_Enable );
wxGetApp().GetSettings()->Write( wxT( "AutoPAN" ), m_enableAutoPan );
}
......@@ -306,7 +306,7 @@ void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition )
void EDA_DRAW_PANEL::OnActivate( wxActivateEvent& event )
{
m_CanStartBlock = -1; // Block Command can't start
m_canStartBlock = -1; // Block Command can't start
event.Skip();
}
......@@ -751,10 +751,10 @@ bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
GetParent()->AddMenuZoomAndGrid( &MasterMenu );
pos = event.GetPosition();
m_IgnoreMouseEvents = true;
m_ignoreMouseEvents = true;
PopupMenu( &MasterMenu, pos );
MoveCursorToCrossHair();
m_IgnoreMouseEvents = false;
m_ignoreMouseEvents = false;
return true;
}
......@@ -763,9 +763,9 @@ bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
{
if( m_mouseCaptureCallback == NULL ) // No command in progress.
m_AutoPAN_Request = false;
m_requestAutoPan = false;
if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents )
if( !m_enableAutoPan || !m_requestAutoPan || m_ignoreMouseEvents )
return;
// Auto pan if mouse is leave working area:
......@@ -785,7 +785,7 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
{
if( m_IgnoreMouseEvents )
if( m_ignoreMouseEvents )
return;
wxRect rect = wxRect( wxPoint( 0, 0 ), GetClientSize() );
......@@ -857,18 +857,18 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
/* Count the drag events. Used to filter mouse moves before starting a
* block command. A block command can be started only if
* MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND
* and m_CanStartBlock >= 0
* and m_canStartBlock >= 0
* in order to avoid spurious block commands.
*/
static int MinDragEventCount;
if( event.Leaving() )
{
m_CanStartBlock = -1;
m_canStartBlock = -1;
}
if( !IsMouseCaptured() ) // No mouse capture in progress.
m_AutoPAN_Request = false;
m_requestAutoPan = false;
if( GetParent()->IsActive() )
SetFocus();
......@@ -886,7 +886,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
return;
}
if( m_IgnoreMouseEvents )
if( m_ignoreMouseEvents )
return;
if( event.LeftIsDown() )
......@@ -973,7 +973,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
if( LastPanel != this )
{
MinDragEventCount = 0;
m_CanStartBlock = -1;
m_canStartBlock = -1;
}
/* A new command block can start after a release buttons
......@@ -985,7 +985,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
if( !event.LeftIsDown() && !event.MiddleIsDown() )
{
MinDragEventCount = 0;
m_CanStartBlock = 0;
m_canStartBlock = 0;
/* Remember the last cursor position when a drag mouse starts
* this is the last position ** before ** clicking a button
......@@ -997,7 +997,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
m_CursorStartPos = screen->GetCrossHairPosition();
}
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) )
{
if( !screen->IsBlockActive() )
{
......@@ -1008,12 +1008,12 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
{
m_AutoPAN_Request = false;
m_requestAutoPan = false;
GetParent()->HandleBlockPlace( &DC );
ignoreNextLeftButtonRelease = true;
}
}
else if( ( m_CanStartBlock >= 0 )
else if( ( m_canStartBlock >= 0 )
&& ( event.LeftIsDown() || event.MiddleIsDown() )
&& !IsMouseCaptured() )
{
......@@ -1042,7 +1042,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
}
else
{
m_AutoPAN_Request = true;
m_requestAutoPan = true;
SetCursor( wxCURSOR_SIZING );
}
}
......@@ -1068,19 +1068,19 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
if( m_endMouseCaptureCallback )
{
m_endMouseCaptureCallback( this, &DC );
m_AutoPAN_Request = false;
m_requestAutoPan = false;
}
SetCursor( m_currentCursor );
}
else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END )
{
m_AutoPAN_Request = false;
m_requestAutoPan = false;
GetParent()->HandleBlockEnd( &DC );
SetCursor( m_currentCursor );
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
{
m_AutoPAN_Request = true;
m_requestAutoPan = true;
SetCursor( wxCURSOR_HAND );
}
}
......@@ -1128,7 +1128,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
break;
case WXK_ESCAPE:
m_AbortRequest = true;
m_abortRequest = true;
if( IsMouseCaptured() )
EndMouseCapture();
......@@ -1231,7 +1231,7 @@ void EDA_DRAW_PANEL::EndMouseCapture( int id, int cursor, const wxString& title,
m_mouseCaptureCallback = NULL;
m_endMouseCaptureCallback = NULL;
m_AutoPAN_Request = false;
m_requestAutoPan = false;
if( id != -1 && cursor != -1 )
{
......@@ -1239,3 +1239,21 @@ void EDA_DRAW_PANEL::EndMouseCapture( int id, int cursor, const wxString& title,
GetParent()->SetToolID( id, cursor, title );
}
}
void EDA_DRAW_PANEL::CallMouseCapture( wxDC* aDC, const wxPoint& aPosition, bool aErase )
{
wxCHECK_RET( aDC != NULL, wxT( "Invalid device context." ) );
wxCHECK_RET( m_mouseCaptureCallback != NULL, wxT( "Mouse capture callback not set." ) );
m_mouseCaptureCallback( this, aDC, aPosition, aErase );
}
void EDA_DRAW_PANEL::CallEndMouseCapture( wxDC* aDC )
{
wxCHECK_RET( aDC != NULL, wxT( "Invalid device context." ) );
wxCHECK_RET( m_endMouseCaptureCallback != NULL, wxT( "End mouse capture callback not set." ) );
m_endMouseCaptureCallback( this, aDC );
}
......@@ -230,8 +230,8 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
const wxString& aText,
int aOrient,
const wxSize& aSize,
enum GRTextHorizJustifyType aH_justify,
enum GRTextVertJustifyType aV_justify,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold,
......@@ -249,7 +249,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
int overbar_italic_comp; // Italic compensation for overbar
EDA_RECT* clipBox; // Clip box used in basic draw functions
clipBox = aPanel ? &aPanel->m_ClipBox : NULL;
clipBox = aPanel ? aPanel->GetClipBox() : NULL;
#define BUF_SIZE 100
wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape)
bool sketch_mode = false;
......@@ -292,10 +292,10 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
xc = current_char_pos.x;
yc = current_char_pos.y;
x0 = aPanel->m_ClipBox.GetX() - ll;
y0 = aPanel->m_ClipBox.GetY() - ll;
xm = aPanel->m_ClipBox.GetRight() + ll;
ym = aPanel->m_ClipBox.GetBottom() + ll;
x0 = aPanel->GetClipBox()->GetX() - ll;
y0 = aPanel->GetClipBox()->GetY() - ll;
xm = aPanel->GetClipBox()->GetRight() + ll;
ym = aPanel->GetClipBox()->GetBottom() + ll;
if( xc < x0 )
return;
......@@ -366,7 +366,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y );
}
else
GRLine( &aPanel->m_ClipBox, aDC,
GRLine( aPanel->GetClipBox(), aDC,
current_char_pos.x, current_char_pos.y, end.x, end.y, aWidth, aColor );
return;
......@@ -521,8 +521,8 @@ void PLOTTER::text( const wxPoint& aPos,
const wxString& aText,
int aOrient,
const wxSize& aSize,
enum GRTextHorizJustifyType aH_justify,
enum GRTextVertJustifyType aV_justify,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold )
......
......@@ -24,7 +24,7 @@
*/
/**
* @file edaapl.cpp
* @file edaappl.cpp
*
* @brief For the main application: init functions, and language selection
* (locale handling)
......
......@@ -80,37 +80,6 @@ SCH_ITEM::~SCH_ITEM()
}
void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC )
{
SCH_SCREEN* screen = aFrame->GetScreen();
if( IsNew() )
{
if( !screen->CheckIfOnDrawList( this ) ) // don't want a loop!
screen->AddToDrawList( this );
aFrame->SetRepeatItem( this );
aFrame->SaveCopyInUndoList( this, UR_NEW );
}
else
{
aFrame->SaveUndoItemInUndoList( this );
}
m_Flags = 0;
screen->SetModify();
screen->SetCurItem( NULL );
aFrame->GetCanvas()->SetMouseCapture( NULL, NULL );
aFrame->GetCanvas()->EndMouseCapture();
if( aDC )
{
EDA_CROSS_HAIR_MANAGER( aFrame->GetCanvas(), aDC ); // Erase schematic cursor
Draw( aFrame->GetCanvas(), aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
}
}
bool SCH_ITEM::IsConnected( const wxPoint& aPosition ) const
{
if( m_Flags & STRUCT_DELETED || m_Flags & SKIP_STRUCT )
......
......@@ -1034,7 +1034,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( !screen->m_IsPrinting & g_ShowPageLimits )
{
GRSetDrawMode( DC, GR_COPY );
GRRect( &m_canvas->m_ClipBox, DC, 0, 0,
GRRect( m_canvas->GetClipBox(), DC, 0, 0,
pageSize.x * scale, pageSize.y * scale, width,
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
}
......@@ -1052,13 +1052,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
yg = pageSize.y - pageInfo.GetBottomMarginMils();
#if defined(KICAD_GOST)
GRRect( &m_canvas->m_ClipBox, DC, refx * scale, refy * scale,
GRRect( m_canvas->GetClipBox(), DC, refx * scale, refy * scale,
xg * scale, yg * scale, width, Color );
#else
for( ii = 0; ii < 2; ii++ )
{
GRRect( &m_canvas->m_ClipBox, DC, refx * scale, refy * scale,
GRRect( m_canvas->GetClipBox(), DC, refx * scale, refy * scale,
xg * scale, yg * scale, width, Color );
refx += GRID_REF_W; refy += GRID_REF_W;
......@@ -1094,7 +1094,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_SEGMENT_LU:
xg = pageInfo.GetLeftMargin() - WsItem->m_Endx;
yg = pageSize.y - pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y,
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
......@@ -1111,7 +1111,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_SEGMENT_LT:
xg = pageInfo.GetLeftMarginMils() + WsItem->m_Endx;
yg = pageInfo.GetBottomMarginMils() + WsItem->m_Endy;
GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y,
GRLine( &m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
......@@ -1134,7 +1134,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( ii < xg - PAS_REF / 2 )
{
GRLine( &m_canvas->m_ClipBox, DC, ii * scale, refy * scale,
GRLine( m_canvas->GetClipBox(), DC, ii * scale, refy * scale,
ii * scale, ( refy + GRID_REF_W ) * scale, width, Color );
}
DrawGraphicText( m_canvas, DC,
......@@ -1146,7 +1146,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( ii < xg - PAS_REF / 2 )
{
GRLine( &m_canvas->m_ClipBox, DC, ii * scale, yg * scale,
GRLine( m_canvas->GetClipBox(), DC, ii * scale, yg * scale,
ii * scale, ( yg - GRID_REF_W ) * scale, width, Color );
}
DrawGraphicText( m_canvas, DC,
......@@ -1169,7 +1169,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( ii < yg - PAS_REF / 2 )
{
GRLine( &m_canvas->m_ClipBox, DC, refx * scale, ii * scale,
GRLine( m_canvas->GetClipBox(), DC, refx * scale, ii * scale,
( refx + GRID_REF_W ) * scale, ii * scale, width, Color );
}
......@@ -1182,7 +1182,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
if( ii < yg - PAS_REF / 2 )
{
GRLine( &m_canvas->m_ClipBox, DC, xg * scale, ii * scale,
GRLine( m_canvas->GetClipBox(), DC, xg * scale, ii * scale,
( xg - GRID_REF_W ) * scale, ii * scale, width, Color );
}
DrawGraphicText( m_canvas, DC,
......@@ -1336,7 +1336,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pageInfo.GetRightMarginMils() - WsItem->m_Endx;
yg = pageSize.y -
pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y,
GRLine( &m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
......@@ -1400,7 +1400,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pageInfo.GetRightMarginMils() - WsItem->m_Endx;
yg = pageSize.y -
pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y,
GRLine( &m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
......@@ -1597,7 +1597,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
GRID_REF_W - pageInfo.GetRightMarginMils() - WsItem->m_Endx;
yg = pageSize.y -
GRID_REF_W - pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( &m_canvas->m_ClipBox, DC, pos.x, pos.y,
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
......
......@@ -415,7 +415,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
if( m_canvas->IsMouseCaptured() )
{
m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, 0 );
m_canvas->CallMouseCapture( aDC, aPosition, 0 );
}
}
......
......@@ -105,7 +105,7 @@ void SCH_EDIT_FRAME::InitBlockPasteInfos()
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
block->m_ItemsSelection.CopyList( m_blockItems.m_ItemsSelection );
m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines;
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
}
......@@ -139,7 +139,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector );
MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector );
......@@ -149,7 +149,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_COPY: /* Copy */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector );
......@@ -161,7 +161,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_PASTE:
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
PasteListOfItems( DC );
block->ClearItemsList();
......@@ -206,8 +206,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
BlockState state = block->m_State;
CmdBlockType command = block->m_Command;
if( m_canvas->m_endMouseCaptureCallback )
m_canvas->m_endMouseCaptureCallback( m_canvas, DC );
m_canvas->CallEndMouseCapture( DC );
block->m_State = state;
block->m_Command = command;
......@@ -243,14 +242,14 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{
nextcmd = true;
GetScreen()->SelectBlockItems();
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines;
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
block->m_State = STATE_BLOCK_MOVE;
}
else
{
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
m_canvas->SetMouseCapture( NULL, NULL );
}
break;
......@@ -352,7 +351,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_DRAG: /* move to Drag */
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
// Clear list of items to move, and rebuild it with items to drag:
block->ClearItemsList();
......@@ -366,7 +365,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
GetScreen()->SelectBlockItems();
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
block->m_State = STATE_BLOCK_MOVE;
}
......@@ -374,7 +373,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_DELETE: /* move to Delete */
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......@@ -388,7 +387,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_SAVE: /* Save list in paste buffer*/
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......@@ -399,7 +398,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
break;
case BLOCK_ZOOM: /* Window Zoom */
m_canvas->m_endMouseCaptureCallback( m_canvas, DC );
m_canvas->CallEndMouseCapture( DC );
m_canvas->SetCursor( m_canvas->GetDefaultCursor() );
Window_Zoom( GetScreen()->m_BlockLocate );
break;
......@@ -407,7 +406,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_ROTATE:
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......@@ -426,7 +425,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_MIRROR_X:
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......@@ -444,7 +443,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_MIRROR_Y:
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......
......@@ -92,7 +92,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{
BlockState state = GetScreen()->m_BlockLocate.m_State;
CmdBlockType command = GetScreen()->m_BlockLocate.m_Command;
m_canvas->m_endMouseCaptureCallback( m_canvas, DC );
m_canvas->CallEndMouseCapture( DC );
GetScreen()->m_BlockLocate.m_State = state;
GetScreen()->m_BlockLocate.m_Command = command;
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
......@@ -120,9 +120,9 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( m_canvas->IsMouseCaptured() )
{
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines;
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
......@@ -132,7 +132,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
nextCmd = true;
m_canvas->m_mouseCaptureCallback = DrawMovingBlockOutlines;
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
break;
......
......@@ -181,7 +181,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
return;
}
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
/* Creates the new segment, or terminates the command
* if the end point is on a pin, junction or an other wire or bus */
......@@ -218,7 +218,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
oldsegment->SetFlags( SELECTED );
newsegment->SetFlags( IS_NEW );
GetScreen()->SetCurItem( newsegment );
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
/* This is the first segment: Now we know the start segment position.
* Create a junction if needed. Note: a junction can be needed later,
......@@ -444,7 +444,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
}
screen->RemoveFromDrawList( screen->GetCurItem() );
m_canvas->m_mouseCaptureCallback = NULL;
m_canvas->SetMouseCaptureCallback( NULL );
screen->SetCurItem( NULL );
}
......
......@@ -43,15 +43,17 @@
static int s_LastShape = '\\';
SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* DC, int entry_type )
SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* aDC, int aType )
{
SCH_SCREEN* screen = GetScreen();
// Create and place a new bus entry at cursor position
SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->GetCrossHairPosition(), s_LastShape,
entry_type );
BusEntry->SetFlags( IS_NEW );
BusEntry->Place( this, DC );
OnModify();
return BusEntry;
SCH_BUS_ENTRY* busEntry = new SCH_BUS_ENTRY( screen->GetCrossHairPosition(), s_LastShape,
aType );
busEntry->SetFlags( IS_NEW );
GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( aDC );
return busEntry;
}
......
......@@ -362,9 +362,9 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
#if 0
int len = aDc->DeviceToLogicalXRel( 3 );
GRLine( &aPanel->m_ClipBox, aDc, aOffset.x, aOffset.y - len, aOffset.x,
GRLine( aPanel->GetClipBox(), 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,
GRLine( aPanel->GetClipBox(), aDc, aOffset.x - len, aOffset.y, aOffset.x + len,
aOffset.y, 0, aColor );
#endif
......@@ -372,7 +372,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
* the bounding box calculations. */
#if 0
EDA_RECT bBox = GetBoundingBox( aMulti, aConvert );
GRRect( &aPanel->m_ClipBox, aDc, bBox.GetOrigin().x, bBox.GetOrigin().y,
GRRect( aPanel->GetClipBox(), aDc, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
}
......@@ -756,7 +756,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'P' )
m_options = ENTRY_POWER;
/* Read next lines */
// Read next lines, until "ENDDEF" is found
while( aLineReader.ReadLine() )
{
line = aLineReader.Line();
......@@ -766,11 +766,14 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
/* This is the error flag ( if an error occurs, Res = FALSE) */
Res = true;
if( *line == '#' ) // a comment
continue;
if( (*line == 'T') && (*(line + 1) == 'i') )
Res = LoadDateAndTime( aLineReader );
else if( *line == 'F' )
Res = LoadField( aLineReader, Msg );
else if( strcmp( p, "ENDDEF" ) == 0 )
else if( strcmp( p, "ENDDEF" ) == 0 ) // End of component description
break;
else if( strcmp( p, "DRAW" ) == 0 )
Res = LoadDrawEntries( aLineReader, Msg );
......
......@@ -62,9 +62,9 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
// If the user aborted the clarification context menu, don't show it again at the
// off grid position.
if( !item && m_canvas->m_AbortRequest )
if( !item && m_canvas->GetAbortRequest() )
{
m_canvas->m_AbortRequest = false;
m_canvas->SetAbortRequest( false );
return NULL;
}
......@@ -73,7 +73,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
if( !item )
{
m_canvas->m_AbortRequest = false; // Just in case the user aborted the context menu.
m_canvas->SetAbortRequest( false ); // Just in case the user aborted the context menu.
return NULL;
}
......@@ -171,7 +171,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF
// Set to NULL in case user aborts the clarification context menu.
GetScreen()->SetCurItem( NULL );
m_canvas->m_AbortRequest = true; // Changed to false if an item is selected
m_canvas->SetAbortRequest( true ); // Changed to false if an item is selected
PopupMenu( &selectMenu );
m_canvas->MoveCursorToCrossHair();
item = GetScreen()->GetCurItem();
......@@ -247,16 +247,18 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( m_canvas->IsMouseCaptured() )
{
#ifdef USE_WX_OVERLAY
wxDCOverlay oDC( m_canvas->m_overlay, (wxWindowDC*)aDC );
wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC );
oDC.Clear();
m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, false );
m_canvas->CallMouseCapture( aDC, aPosition, false );
#else
m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true );
m_canvas->CallMouseCapture( aDC, aPosition, true );
#endif
}
#ifdef USE_WX_OVERLAY
else
m_canvas->m_overlay.Reset();
{
m_overlay.Reset();
}
#endif
}
......@@ -330,16 +332,18 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( m_canvas->IsMouseCaptured() )
{
#ifdef USE_WX_OVERLAY
wxDCOverlay oDC( m_canvas->m_overlay, (wxWindowDC*)aDC );
wxDCOverlay oDC( m_overlay, (wxWindowDC*)aDC );
oDC.Clear();
m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, false );
m_canvas->CallMouseCapture( aDC, aPosition, false );
#else
m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true );
m_canvas->CallMouseCapture( aDC, aPosition, true );
#endif
}
#ifdef USE_WX_OVERLAY
else
m_canvas->m_overlay.Reset();
{
m_overlay.Reset();
}
#endif
}
......@@ -409,7 +413,7 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( m_canvas->IsMouseCaptured() )
{
m_canvas->m_mouseCaptureCallback( m_canvas, aDC, aPosition, true );
m_canvas->CallMouseCapture( aDC, aPosition, true );
}
}
......
......@@ -219,15 +219,13 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
float dpi = (float) frame->GetInternalUnits();
wxSVGFileDC dc( FullFileName, sheetSize.x, sheetSize.y, dpi );
EDA_RECT tmp = panel->m_ClipBox;
EDA_RECT tmp = *panel->GetClipBox();
GRResetPenAndBrush( &dc );
GRForceBlackPen( aPrintBlackAndWhite );
panel->m_ClipBox.SetX( -0x3FFFFF0 );
panel->m_ClipBox.SetY( -0x3FFFFF0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 );
panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
panel->SetClipBox( EDA_RECT( wxPoint( -0x3FFFFF0, -0x3FFFFF0 ),
wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) );
screen->m_IsPrinting = true;
screen->Draw( panel, &dc, GR_COPY );
......@@ -236,7 +234,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness );
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;
panel->SetClipBox( tmp );
GRForceBlackPen( false );
......
......@@ -29,7 +29,7 @@ void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent )
wxCHECK_RET( aComponent != NULL && aComponent->Type() == SCH_COMPONENT_T,
wxT( "Invalid component object pointer. Bad Programmer!" ) );
m_canvas->m_IgnoreMouseEvents = true;
m_canvas->SetIgnoreMouseEvents( true );
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC* dlg = new DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( this );
......@@ -55,7 +55,7 @@ void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent )
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dlg->GetSize();
m_canvas->MoveCursorToCrossHair();
m_canvas->m_IgnoreMouseEvents = false;
m_canvas->SetIgnoreMouseEvents( false );
dlg->Destroy();
}
......@@ -685,12 +685,12 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT );
// Copy the text justification
GRTextHorizJustifyType hjustify[3] = {
EDA_TEXT_HJUSTIFY_T hjustify[3] = {
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_HJUSTIFY_RIGHT
};
GRTextVertJustifyType vjustify[3] = {
EDA_TEXT_VJUSTIFY_T vjustify[3] = {
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP
};
......
......@@ -712,12 +712,12 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
field.m_Orient = TEXT_ORIENT_HORIZ;
// Copy the text justification
static const GRTextHorizJustifyType hjustify[3] = {
static const EDA_TEXT_HJUSTIFY_T hjustify[3] = {
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_HJUSTIFY_RIGHT
};
static const GRTextVertJustifyType vjustify[3] = {
static const EDA_TEXT_VJUSTIFY_T vjustify[3] = {
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP
};
......
......@@ -324,19 +324,20 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
tmp_startvisu = aScreen->m_StartVisu;
oldZoom = aScreen->GetZoom();
old_org = aScreen->m_DrawOrg;
oldClipBox = panel->m_ClipBox;
// Change scale factor, offsets, and clip box to print the whole page.
panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) );
panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) );
oldClipBox = *panel->GetClipBox();
// Change clip box to print the whole page.
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
// and that allows calculations without overflow
panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) );
// Change scale factor and offset to print the whole page.
bool printReference = parent->GetPrintSheetReference();
if( printReference )
{
/* Draw the page to a memory and let the dc calculate the drawing
* limits.
*/
// Draw the page to a memory and let the dc calculate the drawing limits.
wxBitmap psuedoBitmap( 1, 1 );
wxMemoryDC memDC;
memDC.SelectObject( psuedoBitmap );
......@@ -379,7 +380,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
g_DrawBgColor = bg_color;
aScreen->m_IsPrinting = false;
panel->m_ClipBox = oldClipBox;
panel->SetClipBox( oldClipBox );
GRForceBlackPen( false );
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -117,14 +117,13 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con
rightSizer->Add( m_buttonReplaceAll, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 6 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
rightSizer->Add( m_buttonCancel, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 6 );
mainSizer->Add( rightSizer, 0, wxALL|wxEXPAND, 6 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_schematic_find_base__
#define __dialog_schematic_find_base__
#ifndef __DIALOG_SCHEMATIC_FIND_BASE_H__
#define __DIALOG_SCHEMATIC_FIND_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
......@@ -69,9 +70,9 @@ class DIALOG_SCH_FIND_BASE : public wxDialog
public:
DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 334,225 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_FIND_BASE();
};
#endif //__dialog_schematic_find_base__
#endif //__DIALOG_SCHEMATIC_FIND_BASE_H__
......@@ -74,7 +74,7 @@ create a new power component with the new value." ), GetChars( entry->GetName()
// Don't use GetText() here. If the field is the reference designator and it's parent
// component has multiple parts, we don't want the part suffix added to the field.
wxString newtext = aField->m_Text;
m_canvas->m_IgnoreMouseEvents = true;
m_canvas->SetIgnoreMouseEvents( true );
wxString title;
title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) );
......@@ -83,7 +83,7 @@ create a new power component with the new value." ), GetChars( entry->GetName()
int response = dlg.ShowModal();
m_canvas->MoveCursorToCrossHair();
m_canvas->m_IgnoreMouseEvents = false;
m_canvas->SetIgnoreMouseEvents( false );
newtext = dlg.GetValue( );
newtext.Trim( true );
newtext.Trim( false );
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2009-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file eeredraw.cpp
*/
......@@ -29,7 +54,7 @@ void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, in
if( !screen->m_IsPrinting ) /* Draw but do not print the Dangling Symbol */
{
GRRect( &panel->m_ClipBox, DC,
GRRect( panel->GetClipBox(), DC,
pos.x - DANGLING_SYMBOL_SIZE, pos.y - DANGLING_SYMBOL_SIZE,
pos.x + DANGLING_SYMBOL_SIZE, pos.y + DANGLING_SYMBOL_SIZE,
0, Color );
......@@ -54,7 +79,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness );
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, FALSE );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, FALSE );
m_canvas->DrawCrossHair( DC );
......
......@@ -191,7 +191,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 );
dlg.SetShowGrid( IsGridVisible() );
dlg.SetShowHiddenPins( m_showAllPins );
dlg.SetEnableAutoPan( m_canvas->m_AutoPAN_Enable );
dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() );
dlg.SetEnableHVBusOrientation( g_HVLines );
dlg.SetShowPageLimits( g_ShowPageLimits );
dlg.Layout();
......@@ -222,7 +222,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 );
SetGridVisibility( dlg.GetShowGrid() );
m_showAllPins = dlg.GetShowHiddenPins();
m_canvas->m_AutoPAN_Enable = dlg.GetEnableAutoPan();
m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() );
g_HVLines = dlg.GetEnableHVBusOrientation();
g_ShowPageLimits = dlg.GetShowPageLimits();
......
......@@ -403,6 +403,7 @@ void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
if( m_foundItems.ReplaceItem() )
{
OnModify();
SaveUndoItemInUndoList( undoItem );
RedrawScreen( data.GetPosition(), warpCursor );
}
......@@ -411,9 +412,7 @@ void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL )
{
item = (SCH_ITEM*) m_foundItems.GetItem( data );
while( item != NULL )
while( ( item = (SCH_ITEM*) m_foundItems.GetItem( data ) ) != NULL )
{
wxLogTrace( traceFindReplace, wxT( "Replacing %s with %s in item %s" ),
GetChars( aEvent.GetFindString() ), GetChars( aEvent.GetReplaceString() ),
......@@ -429,6 +428,7 @@ void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
if( m_foundItems.ReplaceItem() )
{
OnModify();
SaveUndoItemInUndoList( undoItem );
RedrawScreen( data.GetPosition(), warpCursor );
}
......
......@@ -96,7 +96,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
static wxString lastCommponentName;
m_itemToRepeat = NULL;
m_canvas->m_IgnoreMouseEvents = true;
m_canvas->SetIgnoreMouseEvents( true );
if( !libname.IsEmpty() )
{
......@@ -122,7 +122,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if ( dlg.ShowModal() == wxID_CANCEL )
{
m_canvas->m_IgnoreMouseEvents = false;
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->MoveCursorToCrossHair();
return NULL;
}
......@@ -140,7 +140,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Name.IsEmpty() )
{
m_canvas->m_IgnoreMouseEvents = false;
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->MoveCursorToCrossHair();
return NULL;
}
......@@ -157,7 +157,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Name.IsEmpty() )
{
m_canvas->m_IgnoreMouseEvents = false;
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->MoveCursorToCrossHair();
return NULL;
}
......@@ -168,7 +168,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( GetNameOfPartToLoad( this, Library, Name ) == 0 )
{
m_canvas->m_IgnoreMouseEvents = false;
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->MoveCursorToCrossHair();
return NULL;
}
......@@ -180,7 +180,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Name.IsEmpty() )
{
m_canvas->m_IgnoreMouseEvents = false;
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->MoveCursorToCrossHair();
return NULL;
}
......@@ -200,13 +200,13 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Entry == NULL )
{
m_canvas->m_IgnoreMouseEvents = false;
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->MoveCursorToCrossHair();
return NULL;
}
}
m_canvas->m_IgnoreMouseEvents = false;
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->MoveCursorToCrossHair();
if( Entry == NULL )
......
......@@ -280,7 +280,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
// update the References
m_CurrentSheet->UpdateAllScreenReferences();
SetSheetNumberAndCount();
m_canvas->m_CanStartBlock = -1;
m_canvas->SetCanStartBlock( -1 );
if( screen->m_FirstRedraw )
{
......
......@@ -416,21 +416,27 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
fill = NO_FILL;
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
{
GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2,
m_Radius, GetPenSize( ),
(m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ),
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
}
else if( fill == FILLED_SHAPE && !aData )
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, m_Radius, color, color );
{
GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius,
color, color );
}
else
{
#ifdef DRAW_ARC_WITH_ANGLE
GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, m_Radius, GetPenSize(), color );
GRArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius,
GetPenSize(), color );
#else
GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
GRArc1( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y,
posc.x, posc.y, GetPenSize(), color );
#endif
}
......@@ -439,7 +445,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
* calculation. */
#if 0
EDA_RECT bBox = GetBoundingBox();
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
}
......
......@@ -332,15 +332,15 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
GRSetDrawMode( aDC, aDrawMode );
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 1, GetPenSize(),
(m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ),
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 1, GetPenSize(), color, color );
else
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(),
&PolyPointsTraslated[0], 0, GetPenSize(), color, color );
/* Set to one (1) to draw bounding box around bezier curve to validate
......@@ -348,7 +348,7 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
#if 0
EDA_RECT bBox = GetBoundingBox();
bBox.Inflate( m_Thickness + 1, m_Thickness + 1 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
}
......
......@@ -244,19 +244,19 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
fill = NO_FILL;
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, m_Radius, GetPenSize(),
GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, GetPenSize(),
(m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ),
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE )
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, m_Radius, 0, color, color );
GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, 0, color, color );
else
GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, m_Radius, GetPenSize(), color );
GRCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, GetPenSize(), color );
/* Set to one (1) to draw bounding box around circle to validate bounding
* box calculation. */
#if 0
EDA_RECT bBox = GetBoundingBox();
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
}
......
......@@ -140,7 +140,7 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
if( m_eraseLastDrawItem )
{
GRSetDrawMode( aDC, g_XorMode );
drawEditGraphics( &aPanel->m_ClipBox, aDC, color );
drawEditGraphics( aPanel->GetClipBox(), aDC, color );
drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData, aTransform );
}
......@@ -148,7 +148,7 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
calcEdit( aOffset );
// Draw the items using the new attributes.
drawEditGraphics( &aPanel->m_ClipBox, aDC, color );
drawEditGraphics( aPanel->GetClipBox(), aDC, color );
drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData, aTransform );
m_Fill = fillMode;
......
......@@ -325,7 +325,7 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) );
grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) );
grBox.Move( aOffset );
GRRect( &aPanel->m_ClipBox, aDC, grBox, 0, LIGHTMAGENTA );
GRRect( aPanel->GetClipBox(), aDC, grBox, 0, LIGHTMAGENTA );
#endif
}
......
......@@ -853,7 +853,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
/* Set to one (1) to draw bounding box around pin to validate bounding
* box calculation. */
#if 0
EDA_RECT* clipbox = aPanel ? &aPanel->m_ClipBox : NULL;
EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
TRANSFORM transform = DefaultTransform;
DefaultTransform = aTransform;
EDA_RECT bBox = GetBoundingBox();
......@@ -876,7 +876,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
int color;
int width = GetPenSize();
int posX = aPinPos.x, posY = aPinPos.y, len = m_length;
EDA_RECT* clipbox = aPanel ? &aPanel->m_ClipBox : NULL;
EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
color = ReturnLayerColor( LAYER_PIN );
......
......@@ -305,14 +305,14 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
GRSetDrawMode( aDC, aDrawMode );
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(),
GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(),
(m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ),
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( fill == FILLED_SHAPE )
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(),
GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(),
color, color );
else
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(), buffer, 0, GetPenSize(),
GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), buffer, 0, GetPenSize(),
color, color );
delete[] buffer;
......@@ -322,7 +322,7 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
#if 0
EDA_RECT bBox = GetBoundingBox();
bBox.Inflate( m_Thickness + 1, m_Thickness + 1 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
}
......
......@@ -233,21 +233,21 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRSetDrawMode( aDC, aDrawMode );
if( fill == FILLED_WITH_BG_BODYCOLOR && !aData )
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize( ),
GRFilledRect( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize( ),
(m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ),
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
else if( m_Fill == FILLED_SHAPE && !aData )
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
GRFilledRect( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y,
GetPenSize(), color, color );
else
GRRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize(), color );
GRRect( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize(), color );
/* Set to one (1) to draw bounding box around rectangle to validate
* bounding box calculation. */
#if 0
EDA_RECT bBox = GetBoundingBox();
bBox.Inflate( m_Thickness + 1, m_Thickness + 1 );
GRRect( &aPanel->m_ClipBox, aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y,
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
#endif
}
......
......@@ -403,7 +403,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) );
grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) );
grBox.Move( aOffset );
GRRect( &aPanel->m_ClipBox, aDC, grBox, 0, LIGHTMAGENTA );
GRRect( aPanel->GetClipBox(), aDC, grBox, 0, LIGHTMAGENTA );
#endif
}
......
......@@ -252,7 +252,7 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
}
if( m_canvas->IsMouseCaptured() )
m_canvas->m_mouseCaptureCallback( m_canvas, DC, wxDefaultPosition, false );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
m_canvas->DrawCrossHair( DC );
......@@ -322,7 +322,8 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
if( libFileName.FileExists() )
{
backupFileName.SetExt( wxT( "bak" ) );
wxRemoveFile( backupFileName.GetFullPath() );
if( backupFileName.FileExists() )
wxRemoveFile( backupFileName.GetFullPath() );
if( !wxRenameFile( libFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{
......@@ -361,7 +362,8 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
if( docFileName.FileExists() )
{
backupFileName.SetExt( wxT( "bck" ) );
wxRemoveFile( backupFileName.GetFullPath() );
if( backupFileName.FileExists() )
wxRemoveFile( backupFileName.GetFullPath() );
if( !wxRenameFile( docFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -190,7 +190,7 @@ void SCH_BITMAP::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset
wxSize size = m_Image->GetSize();
pos.x -= size.x / 2;
pos.y -= size.y / 2;
GRRect( &aPanel->m_ClipBox, aDC, pos.x, pos.y,
GRRect( aPanel->GetClipBox(), aDC, pos.x, pos.y,
pos.x + size.x, pos.y + size.y, 0, aColor );
}
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment