Commit 0b41d484 authored by charras's avatar charras

code cleaning

parent c2ea4a0a
......@@ -37,11 +37,7 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
DrawPanel->m_PanelDefaultCursor ) );
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
KicadGraphicContext dc( DrawPanel );
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
DrawPanel->UnManageCursor( );
}
}
......
......@@ -12,6 +12,7 @@
#include "class_base_screen.h"
#include "wxstruct.h"
#include "kicad_device_context.h"
#define CURSOR_SIZE 12 // Cursor size in pixels
......@@ -69,6 +70,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE )
{
m_Parent = parent;
wxASSERT( m_Parent );
m_ScrollButt_unit = 40;
SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red,
......@@ -201,7 +203,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
{
#ifdef WX_ZOOM
wxCoord x, y;
KicadGraphicContext DC( this );
INSTALL_DC( DC, this );
x = DC.DeviceToLogicalX( ScreenPos.x );
y = DC.DeviceToLogicalY( ScreenPos.y );
......@@ -311,7 +313,7 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition()
{
#ifdef WX_ZOOM
wxCoord x, y;
KicadGraphicContext DC( this );
INSTALL_DC ( DC, this );
x = DC.LogicalToDeviceX( GetScreen()->m_Curseur.x );
y = DC.LogicalToDeviceY( GetScreen()->m_Curseur.y );
......@@ -339,7 +341,7 @@ wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void )
GetScreen()->Unscale( realpos );
#ifdef WX_ZOOM
// wxCoord x, y;
// KicadGraphicContext DC( this );
// INSTALL_DC( DC, this );
// realpos.x = DC.DeviceToLogicalX( realpos.x );
// realpos.y = DC.DeviceToLogicalY( realpos.y );
#else
......@@ -567,7 +569,11 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
// Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187
paintDC.GetGraphicsContext()->Translate(0.5, 0.5);
#else
#ifdef KICAD_USE_BUFFERED_DC
wxBufferedPaintDC paintDC( this );
#else
wxPaintDC paintDC( this );
#endif
#endif
EDA_Rect tmp;
wxRect PaintClipBox;
......@@ -1015,7 +1021,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
screen->m_MousePosition =
CursorRealPosition( screen->m_MousePositionInPixels );
KicadGraphicContext DC( this );
INSTALL_DC( DC, this );
int kbstat = 0;
......@@ -1264,7 +1270,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
if( event.ShiftDown() && (key > 256) )
localkey |= GR_KB_SHIFT;
KicadGraphicContext DC( this );
INSTALL_DC(DC, this );
BASE_SCREEN* Screen = GetScreen();
......@@ -1345,18 +1351,15 @@ void WinEDA_DrawPanel::OnPan( wxCommandEvent& event )
void WinEDA_DrawPanel::UnManageCursor( int id, int cursor,
const wxString& title )
{
wxClientDC dc( this );
if( ManageCurseur && ForceCloseManageCurseur )
{
INSTALL_DC( dc, this );
ForceCloseManageCurseur( this, &dc );
m_AutoPAN_Request = false;
if( id != -1 && cursor != -1 )
{
wxASSERT( cursor > wxCURSOR_NONE && cursor < wxCURSOR_MAX );
m_Parent->SetToolID( id, cursor, title );
}
}
if( id != -1 && cursor != -1 )
{
wxASSERT( cursor > wxCURSOR_NONE && cursor < wxCURSOR_MAX );
m_Parent->SetToolID( id, cursor, title );
}
}
......@@ -15,6 +15,7 @@
#include "class_base_screen.h"
#include "wxstruct.h"
#include "kicad_device_context.h"
/** Compute draw offset (scroll bars and draw parameters)
* in order to have the current graphic cursor position at the screen center
......@@ -27,7 +28,7 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse )
{
PutOnGrid( &(GetBaseScreen()->m_Curseur) );
AdjustScrollBars();
KicadGraphicContext dc( DrawPanel );
INSTALL_DC( dc, DrawPanel ) ;
DrawPanel->ReDraw( &dc );
/* Move the mouse cursor to the on grid graphic cursor position */
......@@ -130,7 +131,7 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
// DrawPanel->Refresh(); usually good,
// but does not work under linux, when called from here (wxGTK bug ?)
{
KicadGraphicContext dc( DrawPanel );
INSTALL_DC( dc, DrawPanel );
DrawPanel->ReDraw( &dc );
}
break;
......
......@@ -707,6 +707,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
chipnameTextCtrl->SetValue( m_Cmp->m_ChipName );
}
#include "kicad_device_context.h"
/* reinitialise components parametres to default values found in lib
*/
......@@ -722,7 +723,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
if( entry == NULL )
return;
KicadGraphicContext dc( m_Parent->DrawPanel );
INSTALL_DC( dc, m_Parent->DrawPanel );
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, g_XorMode );
......
......@@ -21,6 +21,8 @@
#include "protos.h"
#include "class_library.h"
#include "kicad_device_context.h"
#include <boost/foreach.hpp>
......@@ -179,7 +181,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
Recadre_Trace( mouseWarp );
else
{
KicadGraphicContext dc( DrawPanel );
INSTALL_DC( dc, DrawPanel );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc );
......@@ -354,7 +356,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
Recadre_Trace( TRUE );
else
{
KicadGraphicContext dc( DrawPanel );
INSTALL_DC( dc, DrawPanel );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc );
DrawPanel->MouseTo( curpos );
......@@ -577,7 +579,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( const wxString& pattern,
Recadre_Trace( mouseWarp );
else
{
KicadGraphicContext dc( DrawPanel );
INSTALL_DC( dc, DrawPanel );
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc );
......
......@@ -17,6 +17,8 @@
#include "libeditfrm.h"
#include "class_library.h"
#include "kicad_device_context.h"
#include <boost/foreach.hpp>
......@@ -604,8 +606,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
int id = event.GetId();
wxPoint pos;
KicadGraphicContext dc( DrawPanel );
DrawPanel->m_IgnoreMouseEvents = true;
wxGetMousePosition( &pos.x, &pos.y );
......@@ -621,7 +621,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
case ID_POPUP_LIBEDIT_CANCEL_EDITING:
case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_COPY_BLOCK:
......@@ -632,18 +631,23 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT:
break;
case ID_POPUP_LIBEDIT_DELETE_ITEM:
case ID_POPUP_LIBEDIT_CANCEL_EDITING:
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
DrawPanel->UnManageCursor( );
else
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
break;
case ID_POPUP_LIBEDIT_DELETE_ITEM:
DrawPanel->UnManageCursor( );
break;
default:
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW, wxEmptyString );
break;
}
INSTALL_DC( dc, DrawPanel );
switch( id )
{
case ID_LIBEDIT_SELECT_CURRENT_LIB:
......@@ -673,13 +677,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
}
break;
case ID_POPUP_LIBEDIT_CANCEL_EDITING:
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
else
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
case ID_NO_SELECT_BUTT:
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
......
......@@ -16,13 +16,13 @@
#include "eeschema_id.h"
#include "protos.h"
#include "class_library.h"
#include "kicad_device_context.h"
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
{
int id = event.GetId();
wxPoint pos;
KicadGraphicContext dc( DrawPanel );
SCH_SCREEN* screen = GetScreen();
pos = wxGetMousePosition();
......@@ -123,10 +123,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->
m_PanelDefaultCursor ) );
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
// Stop the current command (if any) but keep the current tool
DrawPanel->UnManageCursor( );
/* Should not be executed, except bug. */
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
......@@ -139,25 +137,19 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_DELETE_CMP:
case ID_POPUP_SCH_DELETE:
// Stop the current command but keep the current tool
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
// Stop the current command (if any) but keep the current tool
DrawPanel->UnManageCursor( );
break;
default:
// Stop the current command and deselect the current tool
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor =
wxCURSOR_ARROW;
SetToolID( 0, DrawPanel->m_PanelCursor, wxEmptyString );
DrawPanel->UnManageCursor( 0, DrawPanel->m_PanelCursor );
break;
}
INSTALL_DC( dc, DrawPanel );
switch( id )
{
case ID_HIERARCHY:
......
......@@ -287,7 +287,6 @@ void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
return;
int id = event.GetId();
KicadGraphicContext dc( DrawPanel );
switch( id )
{
......@@ -309,14 +308,13 @@ void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SELECT_CURSOR:
DrawPanel->CursorOff( &dc );
m_CursorShape = m_OptionsToolBar->GetToolState( id );
DrawPanel->CursorOn( &dc );
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_HIDDEN_PINS:
m_ShowAllPins = m_OptionsToolBar->GetToolState( id );
DrawPanel->ReDraw( &dc, TRUE );
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_BUS_WIRES_ORIENT:
......
......@@ -282,7 +282,16 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
LIB_ALIAS* alias = (LIB_ALIAS*) entry;
component = alias->GetComponent();
wxASSERT( component != NULL && component->isComponent() );
if( component == NULL ) // Should not occur
{
wxASSERT( component != NULL );
return;
}
if( ! component->isComponent() )
{
wxASSERT( component->isComponent() );
return;
}
msg = alias->GetName();
......
......@@ -464,7 +464,7 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems()
}
void WinEDA_GerberFrame::Liste_D_Codes( wxDC* DC )
void WinEDA_GerberFrame::Liste_D_Codes( )
{
int ii, jj;
D_CODE* pt_D_code;
......@@ -523,13 +523,4 @@ void WinEDA_GerberFrame::Liste_D_Codes( wxDC* DC )
List->Destroy();
if( ii < 0 )
return;
#if 0
// Highlight segment corresponding to dCode selected.
if( Etat_Surbrillance )
Hight_Light( DrawPanel, DC );
net_code_Surbrillance = (GetScreen()->m_Active_Layer << 16) + ii;
Hight_Light( DrawPanel, DC );
#endif
}
......@@ -12,6 +12,7 @@
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
#include "kicad_device_context.h"
/* Process the command triggered by the left button of the mouse when a tool
......@@ -61,7 +62,6 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
default:
DisplayError( this, wxT( "WinEDA_GerberFrame::ProcessCommand error" ) );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
}
}
......@@ -75,7 +75,6 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
int layer = GetScreen()->m_Active_Layer;
GERBER* gerber_layer = g_GERBER_List[layer];
wxPoint pos;
KicadGraphicContext dc( DrawPanel );
wxGetMousePosition( &pos.x, &pos.y );
......@@ -95,11 +94,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
DrawPanel->UnManageCursor( );
/* Should not be executed, except bug */
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
{
......@@ -114,15 +109,11 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
break;
default:
if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW, wxEmptyString );
break;
}
INSTALL_DC( dc, DrawPanel );
switch( id )
{
case ID_EXIT:
......@@ -194,7 +185,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_GERBVIEW_SHOW_LIST_DCODES:
Liste_D_Codes( &dc );
Liste_D_Codes( );
break;
case ID_GERBVIEW_SHOW_SOURCE:
......
......@@ -54,97 +54,6 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
}
void WinEDA_GerberFrame::Erase_Zones( bool query )
{
if( query && !IsOK( this, _( "Delete zones?" ) ) )
return;
GetBoard()->m_Zone.DeleteAll();
ScreenPcb->SetModify();
}
void WinEDA_GerberFrame::Erase_Segments_Pcb( bool all_layers, bool query )
{
int layer = GetScreen()->m_Active_Layer;
if( all_layers )
layer = -1;
BOARD_ITEM* next;
for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = next )
{
next = item->Next();
switch( item->Type() )
{
case TYPE_DRAWSEGMENT:
case TYPE_TEXTE:
case TYPE_COTATION:
case TYPE_MIRE:
if( item->GetLayer() == layer || layer < 0 )
GetBoard()->Delete( item );
break;
default:
DisplayError( this, wxT( "Draw type unknown." ) );
break;
}
}
ScreenPcb->SetModify();
}
/* Delete track segments.
* masque_type mask options selection:
* SEGM_FIXE, SEGM_AR
* If a bit is 1, segment is not erased.
*/
void WinEDA_GerberFrame::Erase_Pistes( int masque_type, bool query )
{
TRACK* pt_segm;
BOARD_ITEM* PtNext;
if( query && !IsOK( this, _( "Delete tracks?" ) ) )
return;
/* Mark tracks to clear. */
for( pt_segm = GetBoard()->m_Track;
pt_segm != NULL;
pt_segm = (TRACK*) PtNext )
{
PtNext = pt_segm->Next();
if( pt_segm->GetState( SEGM_FIXE | SEGM_AR ) & masque_type )
continue;
pt_segm->DeleteStructure();
}
ScreenPcb->SetModify();
}
void WinEDA_GerberFrame::Erase_Textes_Pcb( bool query )
{
BOARD_ITEM* PtStruct;
BOARD_ITEM* PtNext;
if( query && !IsOK( this, _( "Delete pcb text?" ) ) )
return;
PtStruct = GetBoard()->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtNext )
{
PtNext = PtStruct->Next();
if( PtStruct->Type() == TYPE_TEXTE )
PtStruct->DeleteStructure();
}
ScreenPcb->SetModify();
}
void WinEDA_GerberFrame::Erase_Current_Layer( bool query )
{
int layer = GetScreen()->m_Active_Layer;
......
......@@ -195,30 +195,15 @@ public:
*/
int Read_D_Code_File( const wxString& D_Code_FullFileName );
void CopyDCodesSizeToItems();
void Liste_D_Codes( wxDC* DC );
void Liste_D_Codes( );
void Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer );
// Copper texts
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
TEXTE_PCB* Create_Texte_Pcb( wxDC* DC );
void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC );
void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
// PCB handling
bool Clear_Pcb( bool query );
void Erase_Current_Layer( bool query );
void Erase_Zones( bool query );
void Erase_Segments_Pcb( bool is_edges, bool query );
void Erase_Pistes( int masque_type, bool query );
void Erase_Textes_Pcb( bool query );
void Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number );
TRACK* Begin_Route( TRACK* track, wxDC* DC );
void End_Route( TRACK* track, wxDC* DC );
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
int Edit_TrackSegm_Width( wxDC* DC, TRACK* segm );
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
// Conversion function
void ExportDataInPcbnewFormat( wxCommandEvent& event );
......
......@@ -180,12 +180,4 @@ public:
DECLARE_EVENT_TABLE()
};
// Helper class to handle the client Device Context
class KicadGraphicContext : public wxClientDC
{
public:
KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel );
~KicadGraphicContext();
};
#endif /* #ifndef PANEL_WXSTRUCT_H */
/**
* a helper to handle the real device context used in kicad
* @file kicad_device_context.h
*/
#ifndef __KICAD_DEVICE_CONTEXT_H__
#define __KICAD_DEVICE_CONTEXT_H__
// Comment this line to use the standard wxClientDC
// and uncomment to use buffered DC
// #define KICAD_USE_BUFFERED_DC // Currently for tests
#ifdef KICAD_USE_BUFFERED_DC
#include <wx/dcbuffer.h>
#endif
// Helper class to handle the client Device Context
class KicadGraphicContext : public wxClientDC
{
public:
KicadGraphicContext( WinEDA_DrawPanel * aDrawPanel );
~KicadGraphicContext();
};
// 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() );
#else
#define INSTALL_DC(name,parent) KicadGraphicContext name( parent );
#endif
#endif // __KICAD_DEVICE_CONTEXT_H__
......@@ -15,6 +15,7 @@
#include "pcbnew_id.h"
#include "protos.h"
#include "kicad_device_context.h"
typedef enum {
FIXE_MODULE,
......@@ -36,7 +37,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
{
int id = event.GetId();
wxPoint pos;
KicadGraphicContext dc( DrawPanel );
INSTALL_DC( dc, DrawPanel );
bool on_state;
if( m_HToolBar == NULL )
......@@ -59,12 +60,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
break;
default: // Abort a current command (if any)
if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
break;
}
......
......@@ -16,6 +16,8 @@
#include "autorout.h"
#include "protos.h"
#include "kicad_device_context.h"
#include "dialog_global_edit_tracks_and_vias.h"
// Uncomment following line to enable wxBell() command (which beeps speaker)
......@@ -32,7 +34,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
wxPoint pos;
int itmp;
KicadGraphicContext dc( DrawPanel );
INSTALL_DC( dc, DrawPanel );
BOARD_ITEM* DrawStruct = GetCurItem();
DrawPanel->CursorOff( &dc );
......
......@@ -91,8 +91,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
offsetX = m_Auxiliary_Axis_Position.x;
offsetY = m_Auxiliary_Axis_Position.y;
KicadGraphicContext dc( DrawPanel );
Compile_Ratsnest( &dc, TRUE );
Compile_Ratsnest( NULL, TRUE );
/* Temporary modification of footprints that are flipped (i.e. on bottom
* layer) to convert them to non flipped footprints.
......
......@@ -17,23 +17,16 @@
void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
{
wxString fn;
KicadGraphicContext dc( DrawPanel );
fn = GetFileFromHistory( event.GetId(), _( "Printed circuit board" ) );
if( fn != wxEmptyString )
{
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
LoadOnePcbFile( fn, false );
ReCreateAuxiliaryToolbar();
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc );
}
}
......@@ -49,12 +42,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
// If an edition is in progress, stop it
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
KicadGraphicContext dc( DrawPanel );
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
switch( id )
{
......
......@@ -17,6 +17,8 @@
#include "wxPcbStruct.h"
#include "protos.h"
#include "kicad_device_context.h"
#include "dialog_edit_module_for_Modedit.h"
#include "collectors.h"
......@@ -147,7 +149,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
wxPoint pos;
bool redraw = false;
KicadGraphicContext dc( DrawPanel );
INSTALL_DC( dc, DrawPanel );
wxGetMousePosition( &pos.x, &pos.y );
......
......@@ -10,6 +10,7 @@
#include "wxPcbStruct.h"
#include "pcbnew_id.h"
#include "kicad_device_context.h"
#include "protos.h"
......@@ -20,7 +21,7 @@ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
{
int id = event.GetId();
wxPoint pos;
KicadGraphicContext dc( DrawPanel );
INSTALL_DC( dc, DrawPanel );
wxGetMousePosition( &pos.x, &pos.y );
......@@ -32,12 +33,7 @@ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
break;
default: // End block command in progress.
if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
DrawPanel->UnManageCursor( );
break;
}
......
......@@ -12,6 +12,8 @@
#include "wxPcbStruct.h"
#include "collectors.h"
#include "kicad_device_context.h"
#define Pad_fill (Pad_Fill_Item.State == RUN)
......@@ -72,7 +74,7 @@ void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
if( found )
{
KicadGraphicContext dc( DrawPanel );
INSTALL_DC( dc, DrawPanel );
if( g_HightLigt_Status )
Hight_Light( &dc );
......
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