Commit 80e03c8c authored by stambaughw's avatar stambaughw

Build optimizations and cursor movement key bug fix.

parent 9f555dbd
...@@ -5,6 +5,20 @@ Started 2007-June-11 ...@@ -5,6 +5,20 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-Feb-05 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++All
* Change CMakeList.txt so that all PCB object classes that do not need built
separately for pcbnew, gerbview, and cvpcb only get built once and added
to the common library.
* Override all classes derived from WinEDA_BasePcbFrame so that the source
code file basepcbframe.cpp only gets compiled once and added to the common
library.
* Prevent cursor movement keys from moving outside of client area by
automatically scrolling the drawing.
2009-Feb-4 UPDATE Vesa Solonen <vesa.solonen@hut.fi> 2009-Feb-4 UPDATE Vesa Solonen <vesa.solonen@hut.fi>
================================================================================ ================================================================================
++pcbnew: ++pcbnew:
...@@ -19,6 +33,7 @@ email address. ...@@ -19,6 +33,7 @@ email address.
* Move sine and cosine look up tables from trigo.h to trigo.cpp to avoid * Move sine and cosine look up tables from trigo.h to trigo.cpp to avoid
multiple recompiles. multiple recompiles.
2009-feb-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2009-feb-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
++All: ++All:
......
include_directories(${CMAKE_CURRENT_SOURCE_DIR} include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${Boost_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
../pcbnew
../polygon
) )
set(COMMON_SRCS set(COMMON_SRCS
about_kicad.cpp about_kicad.cpp
base_screen.cpp base_screen.cpp
...@@ -37,6 +40,24 @@ set(COMMON_SRCS ...@@ -37,6 +40,24 @@ set(COMMON_SRCS
trigo.cpp trigo.cpp
worksheet.cpp worksheet.cpp
wxwineda.cpp wxwineda.cpp
zoom.cpp) zoom.cpp
../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp
../pcbnew/class_board_connected_item.cpp
../pcbnew/class_cotation.cpp
../pcbnew/class_drc_item.cpp
../pcbnew/class_marker.cpp
../pcbnew/class_mire.cpp
../pcbnew/class_pad.cpp
../pcbnew/class_pad_draw_functions.cpp
../pcbnew/class_pcb_text.cpp
../pcbnew/class_zone.cpp
../pcbnew/class_zone_setting.cpp
../pcbnew/classpcb.cpp
../pcbnew/collectors.cpp
../pcbnew/sel_layer.cpp
../pcbnew/dialog_print_using_printer_base.cpp
)
add_library(common ${COMMON_SRCS}) add_library(common ${COMMON_SRCS})
...@@ -364,13 +364,48 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse ) ...@@ -364,13 +364,48 @@ void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse )
* @param Mouse = new mouse cursor position * @param Mouse = new mouse cursor position
*/ */
{ {
wxPoint mouse; int x, y, xPpu, yPpu;
wxPoint screenPos, drawingPos;
wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() );
#ifdef WX_ZOOM #ifdef WX_ZOOM
CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y ); CalcScrolledPosition( Mouse.x, Mouse.y, &screenPos.x, &screenPos.y );
#else #else
mouse = Mouse - GetScreen()->m_StartVisu; screenPos = Mouse - GetScreen()->m_StartVisu;
#endif #endif
WarpPointer( mouse.x, mouse.y );
/* Scroll if the requested mouse position cursor is outside the drawing
* area. */
if( !clientRect.Contains( screenPos ) )
{
GetViewStart( &x, &y );
GetScrollPixelsPerUnit( &xPpu, &yPpu );
CalcUnscrolledPosition( screenPos.x, screenPos.y,
&drawingPos.x, &drawingPos.y );
wxLogDebug( wxT( "MouseTo() initial screen position(%d, %d) " \
"rectangle(%d, %d, %d, %d) view(%d, %d)" ),
screenPos.x, screenPos.y, clientRect.x, clientRect.y,
clientRect.width, clientRect.height, x, y );
if( screenPos.y < clientRect.GetTop() )
y -= m_ScrollButt_unit * yPpu;
else if( screenPos.y > clientRect.GetBottom() )
y += m_ScrollButt_unit * yPpu;
else if( clientRect.GetRight() < screenPos.x )
x += m_ScrollButt_unit * xPpu;
else
x -= m_ScrollButt_unit * xPpu;
Scroll( x, y );
CalcScrolledPosition( drawingPos.x, drawingPos.y,
&screenPos.x, &screenPos.y );
wxLogDebug( wxT( "MouseTo() scrolled screen position(%d, %d) " \
"view(%d, %d)" ), screenPos.x, screenPos.y, x, y );
}
WarpPointer( screenPos.x, screenPos.y );
} }
...@@ -1242,9 +1277,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) ...@@ -1242,9 +1277,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
void WinEDA_DrawPanel::OnPan( wxCommandEvent& event ) void WinEDA_DrawPanel::OnPan( wxCommandEvent& event )
{ {
int x, y; int x, y;
wxClientDC dc( this );
PrepareGraphicContext( &dc );
GetViewStart( &x, &y ); // x and y are in scroll units, not in pixels GetViewStart( &x, &y ); // x and y are in scroll units, not in pixels
switch( event.GetId() ) switch( event.GetId() )
......
...@@ -29,25 +29,13 @@ set(CVPCB_SRCS ...@@ -29,25 +29,13 @@ set(CVPCB_SRCS
writenetlistpcbnew.cpp) writenetlistpcbnew.cpp)
set(CVPCB_EXTRA_SRCS set(CVPCB_EXTRA_SRCS
../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp
../pcbnew/class_board_item.cpp ../pcbnew/class_board_item.cpp
../pcbnew/class_board_connected_item.cpp
../pcbnew/class_cotation.cpp
../pcbnew/class_drawsegment.cpp ../pcbnew/class_drawsegment.cpp
../pcbnew/class_edge_mod.cpp ../pcbnew/class_edge_mod.cpp
../pcbnew/class_equipot.cpp ../pcbnew/class_equipot.cpp
../pcbnew/class_mire.cpp
../pcbnew/class_module.cpp ../pcbnew/class_module.cpp
../pcbnew/class_pad.cpp
../pcbnew/class_pad_draw_functions.cpp
../pcbnew/class_pcb_text.cpp
../pcbnew/class_text_mod.cpp ../pcbnew/class_text_mod.cpp
../pcbnew/class_track.cpp ../pcbnew/class_track.cpp
../pcbnew/class_zone.cpp
../pcbnew/class_zone_setting.cpp
../pcbnew/classpcb.cpp
../pcbnew/collectors.cpp
../pcbnew/ioascii.cpp ../pcbnew/ioascii.cpp
../pcbnew/tracemod.cpp) ../pcbnew/tracemod.cpp)
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <wx/fontdlg.h> #include <wx/fontdlg.h>
#include "3d_viewer.h"
#include "cvpcb.h" #include "cvpcb.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "bitmaps.h" #include "bitmaps.h"
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "id.h" #include "id.h"
#include "confirm.h"
#include "3d_viewer.h"
#include "cvpcb.h" #include "cvpcb.h"
#include "bitmaps.h" #include "bitmaps.h"
...@@ -23,7 +26,7 @@ BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_DrawFrame ) ...@@ -23,7 +26,7 @@ BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_DrawFrame )
EVT_SIZE( WinEDA_DrawFrame::OnSize ) EVT_SIZE( WinEDA_DrawFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DisplayFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DisplayFrame::OnZoom )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay ) EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame ) EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_DisplayFrame::Show3D_Frame )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -196,69 +199,62 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -196,69 +199,62 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
if( delta.y <= 0 ) if( delta.y <= 0 )
delta.y = 1; delta.y = 1;
if( g_KeyPressed ) switch( g_KeyPressed )
{ {
switch( g_KeyPressed ) case WXK_F1:
{ cmd.SetId( ID_POPUP_ZOOM_IN );
case WXK_F1: GetEventHandler()->ProcessEvent( cmd );
cmd.SetId( ID_POPUP_ZOOM_IN ); flagcurseur = 2;
GetEventHandler()->ProcessEvent( cmd ); curpos = GetScreen()->m_Curseur;
flagcurseur = 2; break;
curpos = GetScreen()->m_Curseur;
break;
case WXK_F2: case WXK_F2:
cmd.SetId( ID_POPUP_ZOOM_OUT ); cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2; flagcurseur = 2;
curpos = GetScreen()->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case WXK_F3: case WXK_F3:
cmd.SetId( ID_ZOOM_REDRAW ); cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2; flagcurseur = 2;
break; break;
case WXK_F4: case WXK_F4:
cmd.SetId( ID_POPUP_ZOOM_CENTER ); cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2; flagcurseur = 2;
curpos = GetScreen()->m_Curseur; curpos = GetScreen()->m_Curseur;
break; break;
case ' ': case ' ':
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
break; break;
case WXK_NUMPAD8: /* cursor moved up */ case WXK_NUMPAD8: /* cursor moved up */
case WXK_UP: case WXK_UP:
DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y - delta.y, Mouse.y -= delta.y;
&Mouse.x, &Mouse.y ); DrawPanel->MouseTo( Mouse );
DrawPanel->MouseTo( Mouse ); break;
break;
case WXK_NUMPAD2: /* cursor moved down */
case WXK_NUMPAD2: /* cursor moved down */ case WXK_DOWN:
case WXK_DOWN: Mouse.y += delta.y;
DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y + delta.y, DrawPanel->MouseTo( Mouse );
&Mouse.x, &Mouse.y ); break;
DrawPanel->MouseTo( Mouse );
break; case WXK_NUMPAD4: /* cursor moved left */
case WXK_LEFT:
case WXK_NUMPAD4: /* cursor moved left */ Mouse.x -= delta.x;
case WXK_LEFT: DrawPanel->MouseTo( Mouse );
DrawPanel->CalcScrolledPosition( Mouse.x - delta.x, Mouse.y, break;
&Mouse.x, &Mouse.y );
DrawPanel->MouseTo( Mouse ); case WXK_NUMPAD6: /* cursor moved right */
break; case WXK_RIGHT:
Mouse.x += delta.x;
case WXK_NUMPAD6: /* cursor moved right */ DrawPanel->MouseTo( Mouse );
case WXK_RIGHT: break;
DrawPanel->CalcScrolledPosition( Mouse.x + delta.x, Mouse.y,
&Mouse.x, &Mouse.y );
DrawPanel->MouseTo( Mouse );
break;
}
} }
GetScreen()->m_Curseur = curpos; GetScreen()->m_Curseur = curpos;
...@@ -316,3 +312,20 @@ void WinEDA_DisplayFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -316,3 +312,20 @@ void WinEDA_DisplayFrame::Process_Special_Functions( wxCommandEvent& event )
SetToolbars(); SetToolbars();
} }
/**
* Display 3D frame of current footprint selection.
*/
void WinEDA_DisplayFrame::Show3D_Frame( wxCommandEvent& event )
{
if( m_Draw3DFrame )
{
DisplayInfo( this, _( "3D Frame already opened" ) );
return;
}
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ),
KICAD_DEFAULT_3D_DRAWFRAME_STYLE |
wxFRAME_FLOAT_ON_PARENT );
m_Draw3DFrame->Show( TRUE );
}
...@@ -36,25 +36,14 @@ set(GERBVIEW_SRCS ...@@ -36,25 +36,14 @@ set(GERBVIEW_SRCS
trpiste.cpp ) trpiste.cpp )
set(GERBVIEW_EXTRA_SRCS set(GERBVIEW_EXTRA_SRCS
../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp
../pcbnew/class_board_item.cpp ../pcbnew/class_board_item.cpp
../pcbnew/class_board_connected_item.cpp
../pcbnew/class_drawsegment.cpp ../pcbnew/class_drawsegment.cpp
../pcbnew/class_drc_item.cpp
../pcbnew/class_marker.cpp
../pcbnew/class_pcb_text.cpp
../pcbnew/class_track.cpp ../pcbnew/class_track.cpp
../pcbnew/class_zone.cpp
../pcbnew/class_zone_setting.cpp
../pcbnew/classpcb.cpp
../pcbnew/collectors.cpp
../pcbnew/sel_layer.cpp
../pcbnew/undelete.cpp ../pcbnew/undelete.cpp
../share/setpage.cpp ../share/setpage.cpp
../pcbnew/dialog_print_using_printer_base.cpp ../pcbnew/dialog_print_using_printer.cpp
../pcbnew/dialog_print_using_printer.cpp) )
if(WIN32) if(WIN32)
if(MINGW) if(MINGW)
......
...@@ -30,7 +30,7 @@ BOARD_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay() ...@@ -30,7 +30,7 @@ BOARD_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
/****************************************************************/ /****************************************************************/
void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/****************************************************************/ /****************************************************************/
/* traitement des touches de fonctions utilisees ds tous les menus /* traitement des touches de fonctions utilisees ds tous les menus
...@@ -107,8 +107,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -107,8 +107,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/* Placement sur la grille generale */ /* Placement sur la grille generale */
PutOnGrid( &GetScreen()->m_Curseur ); PutOnGrid( &GetScreen()->m_Curseur );
if( (oldpos.x != GetScreen()->m_Curseur.x) if( oldpos != GetScreen()->m_Curseur )
|| (oldpos.y != GetScreen()->m_Curseur.y) )
{ {
curpos = GetScreen()->m_Curseur; curpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = oldpos; GetScreen()->m_Curseur = oldpos;
......
...@@ -49,8 +49,6 @@ class GENERAL_COLLECTORS_GUIDE; ...@@ -49,8 +49,6 @@ class GENERAL_COLLECTORS_GUIDE;
class WinEDA_BasePcbFrame : public WinEDA_DrawFrame class WinEDA_BasePcbFrame : public WinEDA_DrawFrame
{ {
BOARD* m_Pcb;
public: public:
bool m_DisplayPadFill; // How show pads bool m_DisplayPadFill; // How show pads
...@@ -63,9 +61,9 @@ public: ...@@ -63,9 +61,9 @@ public:
WinEDA_ModuleEditFrame* m_ModuleEditFrame; WinEDA_ModuleEditFrame* m_ModuleEditFrame;
protected: protected:
BOARD* m_Pcb;
GENERAL_COLLECTOR* m_Collector; GENERAL_COLLECTOR* m_Collector;
public: public:
WinEDA_BasePcbFrame( wxWindow* father, int idtype, WinEDA_BasePcbFrame( wxWindow* father, int idtype,
const wxString& title, const wxString& title,
...@@ -109,9 +107,7 @@ public: ...@@ -109,9 +107,7 @@ public:
int BestZoom(); int BestZoom();
void Show3D_Frame( wxCommandEvent& event ); virtual void Show3D_Frame( wxCommandEvent& event );
virtual void GeneralControle( wxDC* DC, wxPoint Mouse );
// Undo and redo functions // Undo and redo functions
public: public:
...@@ -378,6 +374,9 @@ public: ...@@ -378,6 +374,9 @@ public:
void ReCreateMenuBar(); void ReCreateMenuBar();
WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent ); WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent );
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
/** /**
* Function UpdateToolbarLayerInfo * Function UpdateToolbarLayerInfo
* updates the currently selected layer in the layer listbox and * updates the currently selected layer in the layer listbox and
...@@ -821,6 +820,8 @@ public: ...@@ -821,6 +820,8 @@ public:
const wxString& D_Code_FullFileName ); const wxString& D_Code_FullFileName );
bool SaveGerberFile( const wxString& FileName, wxDC* DC ); bool SaveGerberFile( const wxString& FileName, wxDC* DC );
void GeneralControle( wxDC* DC, wxPoint Mouse );
/** /**
* Function Read_D_Code_File * Function Read_D_Code_File
...@@ -913,6 +914,8 @@ public: ...@@ -913,6 +914,8 @@ public:
void ToolOnRightClick( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
/* handlers for block commands */ /* handlers for block commands */
int ReturnBlockCommand( int key ); int ReturnBlockCommand( int key );
......
...@@ -12,32 +12,18 @@ set(PCBNEW_SRCS ...@@ -12,32 +12,18 @@ set(PCBNEW_SRCS
automove.cpp automove.cpp
autoplac.cpp autoplac.cpp
autorout.cpp autorout.cpp
basepcbframe.cpp
block.cpp block.cpp
block_module_editor.cpp block_module_editor.cpp
board.cpp board.cpp
class_board.cpp
class_board_item.cpp class_board_item.cpp
class_board_connected_item.cpp
class_cotation.cpp
class_drawsegment.cpp class_drawsegment.cpp
class_drc_item.cpp
class_edge_mod.cpp class_edge_mod.cpp
class_equipot.cpp class_equipot.cpp
class_marker.cpp
class_mire.cpp
class_module.cpp class_module.cpp
class_pad.cpp
class_pad_draw_functions.cpp
classpcb.cpp
class_pcb_text.cpp
class_text_mod.cpp class_text_mod.cpp
class_track.cpp class_track.cpp
class_zone.cpp
class_zone_setting.cpp
clean.cpp clean.cpp
# cleaningoptions_dialog.cpp # cleaningoptions_dialog.cpp
collectors.cpp
connect.cpp connect.cpp
controle.cpp controle.cpp
# copy_track.cpp <-- not used # copy_track.cpp <-- not used
...@@ -66,7 +52,6 @@ set(PCBNEW_SRCS ...@@ -66,7 +52,6 @@ set(PCBNEW_SRCS
dialog_pad_properties.cpp dialog_pad_properties.cpp
dialog_pad_properties_base.cpp dialog_pad_properties_base.cpp
dialog_print_using_printer.cpp dialog_print_using_printer.cpp
dialog_print_using_printer_base.cpp
dialog_setup_libs.cpp dialog_setup_libs.cpp
dialog_orient_footprints.cpp dialog_orient_footprints.cpp
# dialog_track_options.cpp # dialog_track_options.cpp
...@@ -131,7 +116,6 @@ set(PCBNEW_SRCS ...@@ -131,7 +116,6 @@ set(PCBNEW_SRCS
queue.cpp queue.cpp
ratsnest.cpp ratsnest.cpp
router.cpp router.cpp
sel_layer.cpp
set_color.cpp set_color.cpp
set_grid.cpp set_grid.cpp
solve.cpp solve.cpp
......
...@@ -144,65 +144,25 @@ void WinEDA_BasePcbFrame::ReCreateMenuBar( void ) ...@@ -144,65 +144,25 @@ void WinEDA_BasePcbFrame::ReCreateMenuBar( void )
{ {
} }
#ifdef CVPCB /* Virtual functions: Do nothing for WinEDA_BasePcbFrame window */
/********************************************************************/
void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/********************************************************************/
// Virtual function
{
}
#endif
#include "3d_viewer.h"
/***********************************************************/
void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event ) void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event )
/***********************************************************/
/* Creates and shows the 3D frame display
*/
{ {
#ifndef GERBVIEW
// Create the main frame window
if( m_Draw3DFrame )
{
DisplayInfo( this, _( "3D Frame already opened" ) );
return;
}
#ifdef CVPCB
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ),
KICAD_DEFAULT_3D_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
#else
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ) );
#endif
// Show the frame
m_Draw3DFrame->Show( TRUE );
#endif
} }
/* Virtual functions: Do nothing for WinEDA_BasePcbFrame window */ void WinEDA_BasePcbFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int flag )
/***********************************************************************************/
void WinEDA_BasePcbFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag )
/***********************************************************************************/
{ {
} }
/********************************************************/
void WinEDA_BasePcbFrame::GetComponentFromUndoList( void ) void WinEDA_BasePcbFrame::GetComponentFromUndoList( void )
/********************************************************/
{ {
} }
/********************************************************/
void WinEDA_BasePcbFrame::GetComponentFromRedoList( void ) void WinEDA_BasePcbFrame::GetComponentFromRedoList( void )
/********************************************************/
{ {
} }
......
...@@ -3,14 +3,8 @@ ...@@ -3,14 +3,8 @@
/*************************************************************************/ /*************************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h"
#include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#ifdef CVPCB
#include "cvpcb.h"
#endif
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) : BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_ITEM( aParent, idtype ) BOARD_ITEM( aParent, idtype )
......
...@@ -479,7 +479,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, ...@@ -479,7 +479,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
/****************************************************************/ /****************************************************************/
void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/*****************************************************************/ /*****************************************************************/
{ {
wxSize delta; wxSize delta;
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
#include "protos.h" #include "protos.h"
#include "id.h" #include "id.h"
#include "3d_viewer.h"
/********************************/ /********************************/
/* class WinEDA_ModuleEditFrame */ /* class WinEDA_ModuleEditFrame */
/********************************/ /********************************/
...@@ -378,3 +381,115 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -378,3 +381,115 @@ void WinEDA_ModuleEditFrame::SetToolbars()
DisplayUnitsMsg(); DisplayUnitsMsg();
} }
/**
* Display 3D frame of footprint (module) being edited.
*/
void WinEDA_ModuleEditFrame::Show3D_Frame( wxCommandEvent& event )
{
if( m_Draw3DFrame )
{
DisplayInfo( this, _( "3D Frame already opened" ) );
return;
}
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ) );
m_Draw3DFrame->Show( TRUE );
}
void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{
wxSize delta;
wxPoint curpos, oldpos;
int hotkey = 0;
if( GetScreen()->IsRefreshReq() )
{
RedrawActiveWindow( DC, TRUE );
// We must return here, instead of proceeding.
// If we let the cursor move during a refresh request,
// the cursor be displayed in the wrong place
// during delayed repaint events that occur when
// you move the mouse when a message dialog is on
// the screen, and then you dismiss the dialog by
// typing the Enter key.
return;
}
curpos = DrawPanel->CursorRealPosition( Mouse );
oldpos = GetScreen()->m_Curseur;
delta = GetScreen()->GetGrid();
GetScreen()->Scale( delta );
if( delta.x == 0 )
delta.x = 1;
if( delta.y == 0 )
delta.y = 1;
switch( g_KeyPressed )
{
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP:
Mouse.y -= delta.y;
DrawPanel->MouseTo( Mouse );
break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN:
Mouse.y += delta.y;
DrawPanel->MouseTo( Mouse );
break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
case WXK_LEFT:
Mouse.x -= delta.x;
DrawPanel->MouseTo( Mouse );
break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
case WXK_RIGHT:
Mouse.x += delta.x;
DrawPanel->MouseTo( Mouse );
break;
default:
hotkey = g_KeyPressed;
break;
}
/* Recalcul de la position du curseur schema */
GetScreen()->m_Curseur = curpos;
/* Placement sur la grille generale */
PutOnGrid( &GetScreen()->m_Curseur );
if( oldpos != GetScreen()->m_Curseur )
{
curpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = oldpos;
DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = curpos;
DrawPanel->CursorOn( DC );
if( DrawPanel->ManageCurseur )
{
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
}
}
if( hotkey )
{
OnHotKey( DC, hotkey, NULL );
}
if( GetScreen()->IsRefreshReq() )
{
RedrawActiveWindow( DC, TRUE );
}
SetToolbars();
Affiche_Status_Box(); /* Affichage des coord curseur */
}
...@@ -6,12 +6,14 @@ ...@@ -6,12 +6,14 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "collectors.h" #include "collectors.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "protos.h" #include "protos.h"
#include "id.h" #include "id.h"
#include "drc_stuff.h" #include "drc_stuff.h"
#include "3d_viewer.h"
#include "kbool/include/kbool/booleng.h" #include "kbool/include/kbool/booleng.h"
/*******************************/ /*******************************/
...@@ -572,3 +574,18 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -572,3 +574,18 @@ void WinEDA_PcbFrame::SetToolbars()
PrepareLayerIndicator(); PrepareLayerIndicator();
DisplayUnitsMsg(); DisplayUnitsMsg();
} }
/**
* Display 3D frame of current printed circuit board.
*/
void WinEDA_PcbFrame::Show3D_Frame( wxCommandEvent& event )
{
if( m_Draw3DFrame )
{
DisplayInfo( this, _( "3D Frame already opened" ) );
return;
}
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ) );
m_Draw3DFrame->Show( TRUE );
}
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