Commit c02d90e9 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Use wxUpdateUIEvent in CVPcb and other minor changes.

* CVPcb now uses wxUpdateUIEvent instead of set toolbars.
* Removed duplicate event handlers in CVPcb that were factored into
  EDA_DRAW_FRAME.
* Fix definition of GeneralControle() in CVPcb that prevented it from being
  called.
* Remove rarely used and scary refresh code GeneralControle() method in all
  main frame windows.
* Factor zoom menu and tool bar command IDs down to EDA_DRAW_FRAME.
parent cbee2477
......@@ -62,11 +62,11 @@ void BASE_SCREEN::InitDatas()
SetCurItem( NULL );
m_FlagRefreshReq = 0; /* Redraw screen request flag */
m_FlagModified = 0; // Set when any change is made on broad
m_FlagSave = 1; // Used in auto save: set when an auto save is made
}
/**
* Get screen units scalar.
*
......
......@@ -261,7 +261,7 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings(wxCommandEvent& event)
#endif
m_Screen->SetModify();
m_Screen->SetRefreshReq();
m_Parent->DrawPanel->Refresh();
}
......
......@@ -40,6 +40,7 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
EVT_MOUSEWHEEL( EDA_DRAW_FRAME::OnMouseEvent )
EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen )
EVT_ACTIVATE( EDA_DRAW_FRAME::OnActivate )
EVT_MENU_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, EDA_DRAW_FRAME::OnZoom )
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
EDA_DRAW_FRAME::OnZoom )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
......
......@@ -27,17 +27,17 @@
BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, WinEDA_BasePcbFrame )
EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
EVT_SIZE( DISPLAY_FOOTPRINTS_FRAME::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, DISPLAY_FOOTPRINTS_FRAME::OnZoom )
EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GRID, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
EVT_TOOL( ID_TB_OPTIONS_SELECT_UNIT_INCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
EVT_TOOL( ID_TB_OPTIONS_SELECT_UNIT_MM, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
EVT_TOOL( ID_TB_OPTIONS_SELECT_CURSOR, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode )
END_EVENT_TABLE()
......@@ -49,11 +49,10 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
const wxString& title,
const wxPoint& pos,
const wxSize& size, long style ) :
WinEDA_BasePcbFrame( father, CVPCB_DISPLAY_FRAME, title, pos,
size, style )
WinEDA_BasePcbFrame( father, CVPCB_DISPLAY_FRAME, title, pos, size, style )
{
m_FrameName = wxT( "CmpFrame" );
m_Draw_Axis = true; // TRUE to draw axis.
m_Draw_Axis = true; // true to draw axis.
// Give an icon
#ifdef __WINDOWS__
......@@ -67,6 +66,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
SetScreen( new PCB_SCREEN() );
LoadSettings();
// Initialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0) ||
(m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
......@@ -78,7 +78,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
DisplayOpt.ShowTrackClearanceMode = 0; /* tracks and vias clearance has
* no meaning here. */
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
ReCreateHToolbar();
ReCreateVToolbar();
......@@ -100,8 +99,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) );
if( m_VToolBar ) // Currently, no vertical right toolbar.
m_auimgr.AddPane( m_VToolBar,
......@@ -118,7 +116,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
m_auimgr.Update();
Show( TRUE );
Show( true );
}
......@@ -160,17 +158,14 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
return;
// Create options tool bar.
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
wxBitmap( grid_xpm ),
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, wxBitmap( grid_xpm ),
_( "Hide grid" ), wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,IsGridVisible() );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
wxBitmap( polar_coord_xpm ),
_( "Display Polar Coord ON" ), wxITEM_CHECK );
_( "Display polar coordinates" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
wxBitmap( unit_inch_xpm ),
......@@ -182,26 +177,22 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
wxBitmap( cursor_shape_xpm ),
_( "Change Cursor Shape" ), wxITEM_CHECK );
_( "Change cursor shape" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
wxBitmap( pad_sketch_xpm ),
_( "Show Pads Sketch" ), wxITEM_CHECK );
_( "Show pads in outline mode" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
wxEmptyString,
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString,
wxBitmap( text_sketch_xpm ),
_( "Show Texts Sketch" ), wxITEM_CHECK );
_( "Show texts in line mode" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
wxEmptyString,
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString,
wxBitmap( show_mod_edge_xpm ),
_( "Show Edges Sketch" ), wxITEM_CHECK );
_( "Show outlines in line mode" ), wxITEM_CHECK );
m_OptionsToolBar->Realize();
SetToolbars();
}
......@@ -210,33 +201,27 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
if( m_HToolBar != NULL )
return;
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString,
wxBitmap( display_options_xpm ),
_( "Display Options" ) );
m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, wxBitmap( display_options_xpm ),
_( "Display options" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
wxBitmap( zoom_in_xpm ),
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
_( "Zoom in (F1)" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
wxBitmap( zoom_out_xpm ),
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
_( "Zoom out (F2)" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
wxBitmap( zoom_redraw_xpm ),
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ),
_( "Redraw view (F3)" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ),
_( "Zoom auto (Home)" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString,
wxBitmap( show_3d_xpm ),
m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, wxBitmap( show_3d_xpm ),
_( "3D Display" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect
......@@ -245,70 +230,36 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
}
void DISPLAY_FOOTPRINTS_FRAME::SetToolbars()
void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent )
{
if( m_OptionsToolBar )
{
m_OptionsToolBar->ToggleTool(
ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UserUnit == MILLIMETRES );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UserUnit == INCHES );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ?
_( "Display rectangular coordinates" ) :
_( "Display polar coordinates" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
IsGridVisible( ) );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
IsGridVisible( ) ?
_( "Hide grid" ) :
_( "Show grid" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
m_CursorShape );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
!m_DisplayPadFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
m_DisplayPadFill ?
_( "Show pads in sketch mode" ) :
_( "Show pads in filled mode" ) );
wxString msgTextsFill[3] =
{_( "Show texts in line mode" ),
wxString msgTextsFill[3] = { _( "Show texts in line mode" ),
_( "Show texts in filled mode" ),
_( "Show texts in sketch mode" )
};
unsigned idx = m_DisplayModText+1;
if ( idx > 2 )
idx = 0;
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
m_DisplayModText == 0 );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
msgTextsFill[idx] );
wxString msgEdgesFill[3] =
{_( "Show outlines in line mode" ),
_( "Show texts in sketch mode" ) };
unsigned i = m_DisplayModText + 1;
if ( i > 2 )
i = 0;
aEvent.Check( m_DisplayModText == 0 );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] );
}
void DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent )
{
wxString msgEdgesFill[3] = { _( "Show outlines in line mode" ),
_( "Show outlines in filled mode" ),
_( "Show outlines in sketch mode" )
};
idx = m_DisplayModEdge+1;
if ( idx > 2 )
idx = 0;
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
m_DisplayModEdge == 0 );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
msgEdgesFill[idx] );
m_OptionsToolBar->Refresh();
}
_( "Show outlines in sketch mode" ) };
int i = m_DisplayModEdge + 1;
if ( i > 2 )
i = 0;
aEvent.Check( m_DisplayModEdge == 0 );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] );
}
......@@ -322,61 +273,34 @@ void DISPLAY_FOOTPRINTS_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
}
bool DISPLAY_FOOTPRINTS_FRAME::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
bool DISPLAY_FOOTPRINTS_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
{
return true;
}
void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
switch( id )
{
case ID_TB_OPTIONS_SHOW_GRID:
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UserUnit = MILLIMETRES;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
g_UserUnit = INCHES;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
m_DisplayModText++;
if( m_DisplayModText > 2 )
m_DisplayModText = 0;
DrawPanel->Refresh( );
break;
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
m_DisplayModEdge++;
if( m_DisplayModEdge > 2 )
m_DisplayModEdge = 0;
DrawPanel->Refresh( );
DrawPanel->Refresh();
break;
default:
......@@ -384,62 +308,52 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
wxT( "DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar error" ) );
break;
}
SetToolbars();
}
void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
{
wxRealPoint gridSize;
int flagcurseur = 0;
wxPoint oldpos;
PCB_SCREEN* screen = GetScreen();
wxPoint pos = aPosition;
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
GetScreen()->SetCrossHairPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( g_KeyPressed )
{
case WXK_F1:
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
pos = GetScreen()->GetCrossHairPosition();
break;
case WXK_F2:
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
pos = GetScreen()->GetCrossHairPosition();
break;
case WXK_F3:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
break;
case WXK_F4:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
pos = GetScreen()->GetCrossHairPosition();
break;
case WXK_HOME:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
pos = GetScreen()->GetCrossHairPosition();
break;
case ' ':
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
screen->m_O_Curseur = screen->GetCrossHairPosition();
break;
case WXK_NUMPAD8: /* cursor moved up */
......@@ -467,24 +381,15 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
break;
}
GetScreen()->SetCrossHairPosition( pos );
if( GetScreen()->IsRefreshReq() )
{
flagcurseur = 2;
Refresh();
}
screen->SetCrossHairPosition( pos );
if( oldpos != GetScreen()->GetCrossHairPosition() )
{
if( flagcurseur != 2 )
if( oldpos != screen->GetCrossHairPosition() )
{
pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos );
pos = screen->GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos );
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos );
screen->SetCrossHairPosition( pos );
DrawPanel->CrossHairOn( aDC );
}
if( DrawPanel->IsMouseCaptured() )
{
......@@ -510,18 +415,20 @@ void DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame( wxCommandEvent& event )
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ),
KICAD_DEFAULT_3D_DRAWFRAME_STYLE |
wxFRAME_FLOAT_ON_PARENT );
m_Draw3DFrame->Show( TRUE );
m_Draw3DFrame->Show( true );
}
/* Virtual function needed by the PCB_SCREEN class derived from BASE_SCREEN
* this is a virtual pure function in BASE_SCREEN
* do nothing in cvpcb
* could be removed later
*/
void PCB_SCREEN::ClearUndoORRedoList(UNDO_REDO_CONTAINER&, int )
void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int )
{
}
/**
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
......@@ -531,10 +438,11 @@ bool DISPLAY_FOOTPRINTS_FRAME::IsGridVisible()
return m_DrawGrid;
}
/**
* Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visiblity in configuration.
* if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown
*/
void DISPLAY_FOOTPRINTS_FRAME::SetGridVisibility(bool aVisible)
......@@ -542,6 +450,7 @@ void DISPLAY_FOOTPRINTS_FRAME::SetGridVisibility(bool aVisible)
m_DrawGrid = aVisible;
}
/**
* Function GetGridColor() , virtual
* @return the color of the grid
......@@ -550,4 +459,3 @@ int DISPLAY_FOOTPRINTS_FRAME::GetGridColor()
{
return DARKGRAY;
}
......@@ -8,10 +8,7 @@
class DISPLAY_FOOTPRINTS_FRAME : public WinEDA_BasePcbFrame
{
public:
public:
DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
const wxString& title,
DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
......@@ -26,6 +23,9 @@ public:
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent );
/**
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
......@@ -35,10 +35,10 @@ public:
/**
* Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visiblity in configuration.
* if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown
*/
virtual void SetGridVisibility(bool aVisible);
virtual void SetGridVisibility( bool aVisible );
/**
* Function GetGridColor() , virtual
* @return the color of the grid
......@@ -48,8 +48,7 @@ public:
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars();
void GeneralControle( wxDC* DC, wxPoint Mouse );
void GeneralControle( wxDC* DC, const wxPoint& aPosition );
void InstallOptionsDisplay( wxCommandEvent& event );
MODULE* Get_Module( const wxString& CmpName );
......@@ -86,4 +85,3 @@ public:
DECLARE_EVENT_TABLE()
};
......@@ -281,12 +281,6 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
// Update cursor position.
screen->SetCrossHairPosition( pos );
if( screen->IsRefreshReq() )
{
DrawPanel->Refresh();
wxSafeYield();
}
if( oldpos != screen->GetCrossHairPosition() )
{
pos = screen->GetCrossHairPosition();
......@@ -362,12 +356,6 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
// Update the cursor position.
screen->SetCrossHairPosition( pos );
if( screen->IsRefreshReq() )
{
DrawPanel->Refresh( );
wxSafeYield();
}
if( oldpos != screen->GetCrossHairPosition() )
{
pos = screen->GetCrossHairPosition();
......@@ -443,12 +431,6 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
// Update cursor position.
screen->SetCrossHairPosition( pos );
if( screen->IsRefreshReq() )
{
DrawPanel->Refresh( );
wxSafeYield();
}
if( oldpos != screen->GetCrossHairPosition() )
{
pos = screen->GetCrossHairPosition();
......
......@@ -56,8 +56,6 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness );
GetScreen()->ClrRefreshReq();
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
......
......@@ -214,8 +214,6 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
Field->m_Text = fieldText;
}
GetScreen()->ClrRefreshReq();
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
......
......@@ -80,7 +80,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_ACTIVATE( LIB_EDIT_FRAME::OnActivate )
/* Main horizontal toolbar. */
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, LIB_EDIT_FRAME::OnZoom )
EVT_TOOL( ID_LIBEDIT_SAVE_CURRENT_LIB, LIB_EDIT_FRAME::SaveActiveLibrary )
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB, LIB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_DELETE_PART, LIB_EDIT_FRAME::DeleteOnePart )
......
......@@ -251,7 +251,7 @@ void SCH_SCREEN::ReplaceWires( SCH_ITEM* aWireList )
bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
{
SCH_ITEM* DrawList, * TstDrawList;
bool Modify = FALSE;
bool Modify = false;
DrawList = GetDrawItems();
......@@ -273,9 +273,9 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
* segment can be flagged */
DrawList->m_Flags |= TstDrawList->m_Flags;
EraseStruct( TstDrawList, this );
SetRefreshReq();
aCanvas->Refresh();
TstDrawList = GetDrawItems();
Modify = TRUE;
Modify = true;
}
else
{
......@@ -308,18 +308,18 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP,
SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) < 0
|| fprintf( aFile, " date %s\n", CONV_TO_UTF8( DateAndTime() ) ) < 0 )
return FALSE;
return false;
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{
if( fprintf( aFile, "LIBS:%s\n", CONV_TO_UTF8( lib.GetName() ) ) < 0 )
return FALSE;
return false;
}
if( fprintf( aFile, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers,
g_LayerDescr.CurrentLayer ) < 0
|| fprintf( aFile, "EELAYER END\n" ) < 0 )
return FALSE;
return false;
/* Write page info, ScreenNumber and NumberOfScreen; not very meaningful for
* SheetNumber and Sheet Count in a complex hierarchy, but useful in
......@@ -339,18 +339,18 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
|| fprintf( aFile, "Comment3 \"%s\"\n", CONV_TO_UTF8( m_Commentaire3 ) ) < 0
|| fprintf( aFile, "Comment4 \"%s\"\n", CONV_TO_UTF8( m_Commentaire4 ) ) < 0
|| fprintf( aFile, "$EndDescr\n" ) < 0 )
return FALSE;
return false;
for( SCH_ITEM* item = GetDrawItems(); item; item = item->Next() )
{
if( !item->Save( aFile ) )
return FALSE;
return false;
}
if( fprintf( aFile, "$EndSCHEMATC\n" ) < 0 )
return FALSE;
return false;
return TRUE;
return true;
}
......
......@@ -78,8 +78,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, SCH_EDIT_FRAME::SetLanguage )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, SCH_EDIT_FRAME::OnZoom )
EVT_TOOL( ID_TO_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor )
EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
......
......@@ -49,7 +49,6 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
LIB_VIEW_FRAME::Process_Special_Functions )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, LIB_VIEW_FRAME::OnZoom )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
LIB_VIEW_FRAME::ExportToSchematicLibraryPart )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
......
......@@ -17,21 +17,6 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
pos = GetScreen()->GetNearestGridPosition( pos );
if( GetScreen()->IsRefreshReq() )
{
DrawPanel->Refresh( );
wxSafeYield();
// 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;
}
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
......@@ -87,11 +72,5 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
OnHotKey( aDC, hotkey, NULL );
}
if( GetScreen()->IsRefreshReq() )
{
DrawPanel->Refresh( );
wxSafeYield();
}
UpdateStatusBar();
}
......@@ -261,8 +261,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
delete layerBitmap;
delete screenBitmap;
}
m_PcbFrame->GetScreen()->ClrRefreshReq();
}
/* Function DrawItemsDCodeID
......
......@@ -176,7 +176,6 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
}
Zoom_Automatique( true );
GetScreen()->SetRefreshReq();
g_SaveTime = time( NULL );
// Synchronize layers tools with actual active layer:
......@@ -220,5 +219,5 @@ static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileNa
frame->Read_D_Code_File( fn.GetFullPath() );
frame->CopyDCodesSizeToItems();
frame->GetScreen()->SetRefreshReq();
frame->Refresh();
}
......@@ -29,8 +29,6 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, WinEDA_GerberFrame::OnZoom )
EVT_TOOL( wxID_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, WinEDA_GerberFrame::Files_io )
......
......@@ -81,6 +81,6 @@ void WinEDA_GerberFrame::Erase_Current_Layer( bool query )
}
ScreenPcb->SetModify();
ScreenPcb->SetRefreshReq();
DrawPanel->Refresh();
syncLayerBox();
}
......@@ -248,14 +248,11 @@ public:
}
void SetRefreshReq() { m_FlagRefreshReq = 1; }
void ClrRefreshReq() { m_FlagRefreshReq = 0; }
void SetModify() { m_FlagModified = 1; m_FlagSave = 0; }
void ClrModify() { m_FlagModified = 0; m_FlagSave = 1; }
void SetSave() { m_FlagSave = 1; }
void ClrSave() { m_FlagSave = 0; }
int IsModify() { return m_FlagModified & 1; }
int IsRefreshReq() { return m_FlagRefreshReq & 1; }
int IsSave() { return m_FlagSave & 1; }
......
......@@ -216,7 +216,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
GetScreen()->m_Active_Layer = layer;
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
DrawPanel->Refresh();
}
......
......@@ -370,11 +370,5 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
OnHotKey( aDC, hotkey, aPosition );
}
if( GetScreen()->IsRefreshReq() )
{
DrawPanel->Refresh( );
wxSafeYield();
}
UpdateStatusBar(); /* Display new cursor coordinates */
}
......@@ -317,8 +317,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = VIA_MICROVIA; // place micro via and switch layer
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
GetBoard()->GetBoardDesignSettings()->m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay )
( (PCB_SCREEN*) GetScreen() )->SetRefreshReq();
DrawPanel->Refresh();
}
break;
......@@ -1168,7 +1169,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
if( Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC ) )
{
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
DrawPanel->Refresh();
}
// if the via was allowed by DRC, then the layer swap has already
// been done by Other_Layer_Route(). if via not allowed, then
......@@ -1186,7 +1187,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
setActiveLayer( layer );
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
DrawPanel->Refresh();
}
......
......@@ -39,8 +39,6 @@ BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_ModuleEditFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_ModuleEditFrame::OnSelectGrid )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, WinEDA_ModuleEditFrame::OnZoom )
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_PART, WinEDA_ModuleEditFrame::Process_Special_Functions )
......@@ -339,20 +337,6 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
int hotkey = 0;
wxPoint pos = aPosition;
if( GetScreen()->IsRefreshReq() )
{
DrawPanel->Refresh();
// 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;
}
pos = GetScreen()->GetNearestGridPosition( aPosition );
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
......@@ -409,12 +393,6 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
OnHotKey( aDC, hotkey, aPosition );
}
if( GetScreen()->IsRefreshReq() )
{
DrawPanel->Refresh();
wxSafeYield();
}
UpdateStatusBar();
}
......
......@@ -194,7 +194,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
pcbframe->DrawGeneralRatsnest( DC );
#ifdef __WXMAC__
pcbframe->GetScreen()->SetRefreshReq();
Panel->Refresh();
#endif
}
......
......@@ -74,8 +74,6 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
EVT_SIZE( WinEDA_PcbFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, WinEDA_PcbFrame::OnZoom )
EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_RECOVER_BOARD, WinEDA_PcbFrame::Files_io )
......
......@@ -62,8 +62,6 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
}
#endif
screen->ClrRefreshReq();
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
......@@ -100,8 +98,6 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
}
#endif
GetScreen()->ClrRefreshReq();
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
......
......@@ -79,7 +79,7 @@ void WinEDA_PcbFrame::Delete_Zone_Fill( SEGZONE* aZone, long aTimestamp )
if( modify )
{
OnModify();
GetScreen()->SetRefreshReq();
DrawPanel->Refresh();
}
}
......
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