Commit a61b48ec authored by charras's avatar charras

Code cleaning. Use new font.

parent d84087c0
...@@ -68,7 +68,6 @@ const wxString AllFilesWildcard( _( "All files (*)|*" ) ); ...@@ -68,7 +68,6 @@ const wxString AllFilesWildcard( _( "All files (*)|*" ) );
wxString g_ProductName = wxT( "KiCad E.D.A. " ); wxString g_ProductName = wxT( "KiCad E.D.A. " );
bool g_ShowPageLimits = true; bool g_ShowPageLimits = true;
int g_GridColor = DARKGRAY;
wxString g_UserLibDirBuffer; wxString g_UserLibDirBuffer;
int g_DebugLevel; int g_DebugLevel;
int g_MouseOldButtons; int g_MouseOldButtons;
......
...@@ -22,8 +22,9 @@ ...@@ -22,8 +22,9 @@
/* Configuration entry names. */ /* Configuration entry names. */
static const wxString CursorShapeEntry( wxT( "CuShape" ) ); static const wxString CursorShapeEntryKeyword( wxT( "CursorShape" ) );
static const wxString ShowGridEntry( wxT( "ShGrid" ) ); static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
static const wxString GridColorEntryKeyword( wxT( "GridColor" ) );
static const wxString LastGridSizeId( wxT( "_LastGridSize" ) ); static const wxString LastGridSizeId( wxT( "_LastGridSize" ) );
...@@ -60,13 +61,14 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -60,13 +61,14 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
m_ID_last_state = 0; m_ID_last_state = 0;
m_HTOOL_current_state = 0; m_HTOOL_current_state = 0;
m_Draw_Axis = FALSE; // TRUE to draw axis. m_Draw_Axis = FALSE; // TRUE to draw axis.
m_Draw_Grid = FALSE; // TRUE to show grid.
m_Draw_Sheet_Ref = FALSE; // TRUE to display reference sheet. m_Draw_Sheet_Ref = FALSE; // TRUE to display reference sheet.
m_Print_Sheet_Ref = TRUE; // TRUE to print reference sheet. m_Print_Sheet_Ref = TRUE; // TRUE to print reference sheet.
m_Draw_Auxiliary_Axis = FALSE; // TRUE draw auxilary axis. m_Draw_Auxiliary_Axis = FALSE; // TRUE draw auxilary axis.
m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch
m_CursorShape = 0; m_CursorShape = 0;
m_LastGridSizeId = 0; m_LastGridSizeId = 0;
m_DrawGrid = true; // hide/Show grid. default = show
m_GridColor = DARKGRAY; // Grid color
// Internal units per inch: = 1000 for schema, = 10000 for PCB // Internal units per inch: = 1000 for schema, = 10000 for PCB
m_InternalUnits = EESCHEMA_INTERNAL_UNIT; m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
...@@ -720,8 +722,13 @@ void WinEDA_DrawFrame::LoadSettings() ...@@ -720,8 +722,13 @@ void WinEDA_DrawFrame::LoadSettings()
wxConfig* cfg = wxGetApp().m_EDA_Config; wxConfig* cfg = wxGetApp().m_EDA_Config;
WinEDA_BasicFrame::LoadSettings(); WinEDA_BasicFrame::LoadSettings();
cfg->Read( m_FrameName + CursorShapeEntry, &m_CursorShape, ( long )0 ); cfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_CursorShape, ( long )0 );
cfg->Read( m_FrameName + ShowGridEntry, &m_Draw_Grid, true ); bool btmp;
if ( cfg->Read( m_FrameName + ShowGridEntryKeyword, &btmp ) )
SetGridVisibility( btmp);
int itmp;
if( cfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) )
SetGridColor(itmp);
cfg->Read( m_FrameName + LastGridSizeId, &m_LastGridSizeId, 0L ); cfg->Read( m_FrameName + LastGridSizeId, &m_LastGridSizeId, 0L );
} }
...@@ -739,8 +746,9 @@ void WinEDA_DrawFrame::SaveSettings() ...@@ -739,8 +746,9 @@ void WinEDA_DrawFrame::SaveSettings()
wxConfig* cfg = wxGetApp().m_EDA_Config; wxConfig* cfg = wxGetApp().m_EDA_Config;
WinEDA_BasicFrame::SaveSettings(); WinEDA_BasicFrame::SaveSettings();
cfg->Write( m_FrameName + CursorShapeEntry, m_CursorShape ); cfg->Write( m_FrameName + CursorShapeEntryKeyword, m_CursorShape );
cfg->Write( m_FrameName + ShowGridEntry, m_Draw_Grid ); cfg->Write( m_FrameName + ShowGridEntryKeyword, IsGridVisible() );
cfg->Write( m_FrameName + GridColorEntryKeyword, GetGridColor() );
cfg->Write( m_FrameName + LastGridSizeId, ( long ) m_LastGridSizeId ); cfg->Write( m_FrameName + LastGridSizeId, ( long ) m_LastGridSizeId );
} }
......
...@@ -703,7 +703,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -703,7 +703,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY );
if( m_Parent->m_Draw_Grid ) if( m_Parent->IsGridVisible() )
DrawGrid( DC ); DrawGrid( DC );
/* Draw axis */ /* Draw axis */
...@@ -789,7 +789,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) ...@@ -789,7 +789,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
#endif #endif
m_Parent->PutOnGrid( &org ); m_Parent->PutOnGrid( &org );
GRSetColorPen( DC, g_GridColor ); GRSetColorPen( DC, m_Parent->GetGridColor() );
int xpos, ypos; int xpos, ypos;
...@@ -842,7 +842,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC ) ...@@ -842,7 +842,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
tmpDC.SelectObject( tmpBM ); tmpDC.SelectObject( tmpBM );
GRSetColorPen( &tmpDC, g_DrawBgColor ); GRSetColorPen( &tmpDC, g_DrawBgColor );
tmpDC.DrawLine( 0, 0, 0, screenSize.y-1 ); // init background tmpDC.DrawLine( 0, 0, 0, screenSize.y-1 ); // init background
GRSetColorPen( &tmpDC, g_GridColor ); GRSetColorPen( &tmpDC, m_Parent->GetGridColor() );
for( jj = 0; ; jj++ ) // draw grid points for( jj = 0; ; jj++ ) // draw grid points
{ {
yg = wxRound( jj * screen_grid_size.y ); yg = wxRound( jj * screen_grid_size.y );
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#endif #endif
#define EDA_DRAWBASE #define EDA_DRAWBASE
#include "hershey_fonts.h" #include "newstroke_font.h"
#include "plot_common.h" #include "plot_common.h"
/* factor used to calculate actual size of shapes from hershey fonts (could be adjusted depending on the font name) /* factor used to calculate actual size of shapes from hershey fonts (could be adjusted depending on the font name)
...@@ -122,13 +122,15 @@ static const char* GetHersheyShapeDescription( int AsciiCode ) ...@@ -122,13 +122,15 @@ static const char* GetHersheyShapeDescription( int AsciiCode )
} }
#endif #endif
if ( AsciiCode > 0x7F ) /* calculate font length */
int font_length_max = sizeof(newstroke_font)/sizeof(*newstroke_font);
if ( AsciiCode >= (32 + font_length_max) )
AsciiCode = '?'; AsciiCode = '?';
if( AsciiCode < 32 ) if( AsciiCode < 32 )
AsciiCode = 32; /* Clamp control chars */ AsciiCode = 32; /* Clamp control chars */
AsciiCode -= 32; AsciiCode -= 32;
return hershey_simplex[AsciiCode]; return newstroke_font[AsciiCode];
} }
......
...@@ -21,13 +21,13 @@ set(CVPCB_SRCS ...@@ -21,13 +21,13 @@ set(CVPCB_SRCS
cfg.cpp cfg.cpp
class_cvpcb.cpp class_cvpcb.cpp
class_components_listbox.cpp class_components_listbox.cpp
class_DisplayFootprintsFrame.cpp
class_footprints_listbox.cpp class_footprints_listbox.cpp
cvframe.cpp cvframe.cpp
cvpcb.cpp cvpcb.cpp
dialog_cvpcb_config.cpp dialog_cvpcb_config.cpp
dialog_cvpcb_config_fbp.cpp dialog_cvpcb_config_fbp.cpp
dialog_display_options.cpp dialog_display_options.cpp
displayframe.cpp
dummy_functions.cpp dummy_functions.cpp
genequiv.cpp genequiv.cpp
init.cpp init.cpp
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "bitmaps.h" #include "bitmaps.h"
#include "protos.h" #include "protos.h"
#include "cvstruct.h" #include "cvstruct.h"
#include "class_DisplayFootprintsFrame.h"
/* /*
* NOTE: There is something in 3d_viewer.h that causes a compiler error in * NOTE: There is something in 3d_viewer.h that causes a compiler error in
...@@ -23,20 +24,20 @@ ...@@ -23,20 +24,20 @@
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_BasePcbFrame ) BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow ) EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
EVT_SIZE( WinEDA_DisplayFrame::OnSize ) EVT_SIZE( DISPLAY_FOOTPRINTS_FRAME::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DisplayFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, DISPLAY_FOOTPRINTS_FRAME::OnZoom )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay ) EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_DisplayFrame::Show3D_Frame ) EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame )
END_EVENT_TABLE() END_EVENT_TABLE()
/***************************************************************************/ /***************************************************************************/
/* WinEDA_DisplayFrame: the frame to display the current focused footprint */ /* DISPLAY_FOOTPRINTS_FRAME: the frame to display the current focused footprint */
/***************************************************************************/ /***************************************************************************/
WinEDA_DisplayFrame::WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father, DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, long style ) : const wxSize& size, long style ) :
...@@ -109,7 +110,7 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father, ...@@ -109,7 +110,7 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father,
} }
WinEDA_DisplayFrame::~WinEDA_DisplayFrame() DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
{ {
delete GetBoard(); delete GetBoard();
...@@ -122,7 +123,7 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame() ...@@ -122,7 +123,7 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
/* Called when the frame is closed /* Called when the frame is closed
* Save current settings (frame position and size * Save current settings (frame position and size
*/ */
void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event ) void DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow( wxCloseEvent& event )
{ {
wxPoint pos; wxPoint pos;
wxSize size; wxSize size;
...@@ -135,14 +136,14 @@ void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event ) ...@@ -135,14 +136,14 @@ void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event )
} }
void WinEDA_DisplayFrame::ReCreateVToolbar() void DISPLAY_FOOTPRINTS_FRAME::ReCreateVToolbar()
{ {
// Currently, no vertical right toolbar. // Currently, no vertical right toolbar.
// So do nothing // So do nothing
} }
void WinEDA_DisplayFrame::ReCreateHToolbar() void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
{ {
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
return; return;
...@@ -184,29 +185,29 @@ void WinEDA_DisplayFrame::ReCreateHToolbar() ...@@ -184,29 +185,29 @@ void WinEDA_DisplayFrame::ReCreateHToolbar()
} }
void WinEDA_DisplayFrame::SetToolbars() void DISPLAY_FOOTPRINTS_FRAME::SetToolbars()
{ {
} }
void WinEDA_DisplayFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void DISPLAY_FOOTPRINTS_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
} }
void WinEDA_DisplayFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void DISPLAY_FOOTPRINTS_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
} }
bool WinEDA_DisplayFrame::OnRightClick( const wxPoint& MousePos, bool DISPLAY_FOOTPRINTS_FRAME::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu ) wxMenu* PopMenu )
{ {
return true; return true;
} }
void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* DC, wxPoint Mouse )
{ {
wxRealPoint delta; wxRealPoint delta;
int flagcurseur = 0; int flagcurseur = 0;
...@@ -325,7 +326,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -325,7 +326,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/** /**
* Display 3D frame of current footprint selection. * Display 3D frame of current footprint selection.
*/ */
void WinEDA_DisplayFrame::Show3D_Frame( wxCommandEvent& event ) void DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame( wxCommandEvent& event )
{ {
if( m_Draw3DFrame ) if( m_Draw3DFrame )
{ {
...@@ -347,3 +348,30 @@ void WinEDA_DisplayFrame::Show3D_Frame( wxCommandEvent& event ) ...@@ -347,3 +348,30 @@ void WinEDA_DisplayFrame::Show3D_Frame( wxCommandEvent& event )
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
*/
bool DISPLAY_FOOTPRINTS_FRAME::IsGridVisible()
{
return true;
}
/** Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visiblity in configuration.
* @param aVisible = true if the grid must be shown
*/
void DISPLAY_FOOTPRINTS_FRAME::SetGridVisibility(bool aVisible)
{
// Currently do nothing because there is no option to hide/show grid
}
/** Function GetGridColor() , virtual
* @return the color of the grid
*/
int DISPLAY_FOOTPRINTS_FRAME::GetGridColor()
{
return DARKGRAY;
}
/* class_DisplayFootprintsFrame.h */
/*******************************************************/
/* class DISPLAY_FOOTPRINTS_FRAME: used to display footprints */
/*******************************************************/
class DISPLAY_FOOTPRINTS_FRAME : public WinEDA_BasePcbFrame
{
public:
public:
DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~DISPLAY_FOOTPRINTS_FRAME();
void OnCloseWindow( wxCloseEvent& Event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void RecreateMenuBar();
/** Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
virtual bool IsGridVisible();
/** Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visiblity in configuration.
* @param aVisible = true if the grid must be shown
*/
virtual void SetGridVisibility(bool aVisible);
/** Function GetGridColor() , virtual
* @return the color of the grid
*/
virtual int GetGridColor();
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 InstallOptionsDisplay( wxCommandEvent& event );
MODULE* Get_Module( const wxString& CmpName );
void Process_Settings( wxCommandEvent& event );
void Show3D_Frame( wxCommandEvent& event );
/* SaveCopyInUndoList() virtual
* currently: do nothing in cvpcb.
* but but be defined because it is a pure virtual in WinEDA_BasePcbFrame
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
UndoRedoOpType aTypeCommand = UR_UNSPECIFIED,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
{
}
/** Function SaveCopyInUndoList (overloaded).
* Creates a new entry in undo list of commands.
* add a list of pickers to handle a list of items
* @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation,
* for commands like move
*/
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
{
// currently: do nothing in cvpcb.
}
DECLARE_EVENT_TABLE()
};
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "protos.h" #include "protos.h"
#include "cvstruct.h" #include "cvstruct.h"
#include "dialog_cvpcb_config.h" #include "dialog_cvpcb_config.h"
#include "class_DisplayFootprintsFrame.h"
#include "build_version.h" #include "build_version.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
/* Forward declarations of all top-level window classes. */ /* Forward declarations of all top-level window classes. */
class FOOTPRINTS_LISTBOX; class FOOTPRINTS_LISTBOX;
class COMPONENTS_LISTBOX; class COMPONENTS_LISTBOX;
class WinEDA_DisplayFrame; class DISPLAY_FOOTPRINTS_FRAME;
#include "id.h" #include "id.h"
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
bool m_KeepCvpcbOpen; bool m_KeepCvpcbOpen;
FOOTPRINTS_LISTBOX* m_FootprintList; FOOTPRINTS_LISTBOX* m_FootprintList;
COMPONENTS_LISTBOX* m_ListCmp; COMPONENTS_LISTBOX* m_ListCmp;
WinEDA_DisplayFrame* DrawFrame; DISPLAY_FOOTPRINTS_FRAME* DrawFrame;
WinEDA_Toolbar* m_HToolBar; WinEDA_Toolbar* m_HToolBar;
wxFileName m_NetlistFileName; wxFileName m_NetlistFileName;
wxArrayString m_ModuleLibNames; wxArrayString m_ModuleLibNames;
...@@ -219,67 +219,4 @@ public: ...@@ -219,67 +219,4 @@ public:
}; };
/*******************************************************/
/* class WinEDA_DisplayFrame: used to display footprints */
/*******************************************************/
class WinEDA_DisplayFrame : public WinEDA_BasePcbFrame
{
public:
public:
WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_DisplayFrame();
void OnCloseWindow( wxCloseEvent& Event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void RecreateMenuBar();
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 InstallOptionsDisplay( wxCommandEvent& event );
MODULE* Get_Module( const wxString& CmpName );
void Process_Settings( wxCommandEvent& event );
void Show3D_Frame( wxCommandEvent& event );
/* SaveCopyInUndoList() virtual
* currently: do nothing in cvpcb.
* but but be defined because it is a pure virtual in WinEDA_BasePcbFrame
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
UndoRedoOpType aTypeCommand = UR_UNSPECIFIED,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
{
}
/** Function SaveCopyInUndoList (overloaded).
* Creates a new entry in undo list of commands.
* add a list of pickers to handle a list of items
* @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation,
* for commands like move
*/
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
{
// currently: do nothing in cvpcb.
}
DECLARE_EVENT_TABLE()
};
#endif //#ifndef CVSTRUCT_H #endif //#ifndef CVSTRUCT_H
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "protos.h" #include "protos.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "cvstruct.h" #include "cvstruct.h"
#include "class_DisplayFootprintsFrame.h"
#include "dialog_display_options.h" #include "dialog_display_options.h"
...@@ -33,7 +34,7 @@ ...@@ -33,7 +34,7 @@
////@end XPM images ////@end XPM images
void WinEDA_DisplayFrame::InstallOptionsDisplay( wxCommandEvent& event ) void DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay( wxCommandEvent& event )
{ {
WinEDA_FootprintDisplayOptionsFrame* OptionWindow = WinEDA_FootprintDisplayOptionsFrame* OptionWindow =
new WinEDA_FootprintDisplayOptionsFrame( this ); new WinEDA_FootprintDisplayOptionsFrame( this );
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "cvpcb.h" #include "cvpcb.h"
#include "protos.h" #include "protos.h"
#include "cvstruct.h" #include "cvstruct.h"
#include "class_DisplayFootprintsFrame.h"
/** /**
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
* @param CmpName - Module name * @param CmpName - Module name
* @return - Module if found otherwise NULL. * @return - Module if found otherwise NULL.
*/ */
MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName ) MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& CmpName )
{ {
int LineNum, Found = 0; int LineNum, Found = 0;
unsigned ii; unsigned ii;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "cvpcb.h" #include "cvpcb.h"
#include "protos.h" #include "protos.h"
#include "cvstruct.h" #include "cvstruct.h"
#include "class_DisplayFootprintsFrame.h"
/* /*
* NOTE: There is something in 3d_viewer.h that causes a compiler error in * NOTE: There is something in 3d_viewer.h that causes a compiler error in
...@@ -33,7 +34,7 @@ void WinEDA_CvpcbFrame::CreateScreenCmp() ...@@ -33,7 +34,7 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
if( DrawFrame == NULL ) if( DrawFrame == NULL )
{ {
DrawFrame = new WinEDA_DisplayFrame( this, _( "Module" ), DrawFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ),
wxPoint( 0, 0 ), wxPoint( 0, 0 ),
wxSize( 600, 400 ), wxSize( 600, 400 ),
KICAD_DEFAULT_DRAWFRAME_STYLE | KICAD_DEFAULT_DRAWFRAME_STYLE |
...@@ -85,7 +86,7 @@ void WinEDA_CvpcbFrame::CreateScreenCmp() ...@@ -85,7 +86,7 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
/* /*
* Draws the current highlighted footprint. * Draws the current highlighted footprint.
*/ */
void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{ {
if( !GetBoard() ) if( !GetBoard() )
return; return;
......
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
#include "eelayer.h" // Header file associated with this file #include "eelayer.h" // Header file associated with this file
// Local variables: // Local variables:
int CurrentColor[NB_BUTT]; // Holds color for each layer while dialog box open static int CurrentColor[NB_BUTT]; // Holds color for each layer while dialog box open
IMPLEMENT_DYNAMIC_CLASS( WinEDA_SetColorsFrame, wxDialog ) IMPLEMENT_DYNAMIC_CLASS( WinEDA_SetColorsFrame, wxDialog )
...@@ -35,7 +34,7 @@ END_EVENT_TABLE() ...@@ -35,7 +34,7 @@ END_EVENT_TABLE()
/**************************************************************/ /**************************************************************/
void DisplayColorSetupFrame( WinEDA_DrawFrame* parent, void DisplayColorSetupFrame( WinEDA_SchematicFrame* parent,
const wxPoint& framepos ) const wxPoint& framepos )
{ {
/**************************************************************/ /**************************************************************/
...@@ -56,7 +55,7 @@ WinEDA_SetColorsFrame::WinEDA_SetColorsFrame() ...@@ -56,7 +55,7 @@ WinEDA_SetColorsFrame::WinEDA_SetColorsFrame()
// Standard Constructor // Standard Constructor
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_SchematicFrame* parent,
const wxPoint& framepos ) const wxPoint& framepos )
{ {
m_Parent = parent; m_Parent = parent;
...@@ -224,7 +223,7 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -224,7 +223,7 @@ void WinEDA_SetColorsFrame::CreateControls()
m_ShowGrid = m_ShowGrid =
new wxCheckBox( this, ID_CHECKBOX_SHOW_GRID, _( "Grid" ), new wxCheckBox( this, ID_CHECKBOX_SHOW_GRID, _( "Grid" ),
wxDefaultPosition, wxDefaultSize, 0 ); wxDefaultPosition, wxDefaultSize, 0 );
m_ShowGrid->SetValue( m_Parent->m_Draw_Grid ); m_ShowGrid->SetValue( m_Parent->IsGridVisible() );
RowBoxSizer->Add( m_ShowGrid, RowBoxSizer->Add( m_ShowGrid,
1, 1,
wxALIGN_CENTER_VERTICAL | wxBOTTOM, wxALIGN_CENTER_VERTICAL | wxBOTTOM,
...@@ -283,32 +282,6 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -283,32 +282,6 @@ void WinEDA_SetColorsFrame::CreateControls()
} }
/**********************************************************/
bool WinEDA_SetColorsFrame::ShowToolTips()
{
/**********************************************************/
return true;
}
/**********************************************************/
wxBitmap WinEDA_SetColorsFrame::GetBitmapResource( const wxString& name )
{
/**********************************************************/
wxUnusedVar( name );
return wxNullBitmap;
}
/**********************************************************/
wxIcon WinEDA_SetColorsFrame::GetIconResource( const wxString& name )
{
/**********************************************************/
wxUnusedVar( name );
return wxNullIcon;
}
/**********************************************************/ /**********************************************************/
void WinEDA_SetColorsFrame::SetColor( wxCommandEvent& event ) void WinEDA_SetColorsFrame::SetColor( wxCommandEvent& event )
{ {
...@@ -367,7 +340,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() ...@@ -367,7 +340,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
// The previous command compiles OK, but to prevent a warning // The previous command compiles OK, but to prevent a warning
// from being generated when the Linux version is being compiled, // from being generated when the Linux version is being compiled,
// the next two commands are provided instead. // the next two commands are provided instead.
m_Parent->m_Draw_Grid = m_ShowGrid->GetValue(); m_Parent->SetGridVisibility( m_ShowGrid->GetValue() );
// Update color of background // Update color of background
if( m_SelBgColor->GetSelection() == 0 ) if( m_SelBgColor->GetSelection() == 0 )
......
...@@ -205,13 +205,6 @@ static ColorButton Layer_Erc_Error_Item = ...@@ -205,13 +205,6 @@ static ColorButton Layer_Erc_Error_Item =
}; };
static ColorButton Layer_Grid_Item =
{
_( "Grid" ), // Title
&g_GridColor // Adr of optional parameter
};
static ColorButton* laytool_list[NB_BUTT] = { static ColorButton* laytool_list[NB_BUTT] = {
&Layer_Wire_Item, &Layer_Wire_Item,
&Layer_Bus_Item, &Layer_Bus_Item,
...@@ -239,8 +232,6 @@ static ColorButton* laytool_list[NB_BUTT] = { ...@@ -239,8 +232,6 @@ static ColorButton* laytool_list[NB_BUTT] = {
&Layer_Erc_Warning_Item, &Layer_Erc_Warning_Item,
&Layer_Erc_Error_Item, &Layer_Erc_Error_Item,
&Layer_Grid_Item
}; };
...@@ -294,7 +285,7 @@ private: ...@@ -294,7 +285,7 @@ private:
DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame ) DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame )
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
WinEDA_DrawFrame* m_Parent; WinEDA_SchematicFrame* m_Parent;
wxBoxSizer* OuterBoxSizer; wxBoxSizer* OuterBoxSizer;
wxBoxSizer* MainBoxSizer; wxBoxSizer* MainBoxSizer;
wxBoxSizer* ColumnBoxSizer; wxBoxSizer* ColumnBoxSizer;
...@@ -334,7 +325,7 @@ private: ...@@ -334,7 +325,7 @@ private:
public: public:
// Constructors and destructor // Constructors and destructor
WinEDA_SetColorsFrame(); WinEDA_SetColorsFrame();
WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos ); WinEDA_SetColorsFrame( WinEDA_SchematicFrame* parent, const wxPoint& framepos );
~WinEDA_SetColorsFrame(); ~WinEDA_SetColorsFrame();
}; };
......
...@@ -120,7 +120,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event ) ...@@ -120,7 +120,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event )
dlg.SetRepeatHorizontal( g_RepeatStep.x ); dlg.SetRepeatHorizontal( g_RepeatStep.x );
dlg.SetRepeatVertical( g_RepeatStep.y ); dlg.SetRepeatVertical( g_RepeatStep.y );
dlg.SetRepeatLabel( g_RepeatDeltaLabel ); dlg.SetRepeatLabel( g_RepeatDeltaLabel );
dlg.SetShowGrid( m_Draw_Grid ); dlg.SetShowGrid( IsGridVisible() );
dlg.SetShowHiddenPins( m_ShowAllPins ); dlg.SetShowHiddenPins( m_ShowAllPins );
dlg.SetEnableAutoPan( DrawPanel->m_AutoPAN_Enable ); dlg.SetEnableAutoPan( DrawPanel->m_AutoPAN_Enable );
dlg.SetEnableAnyBusOrientation( g_HVLines ); dlg.SetEnableAnyBusOrientation( g_HVLines );
...@@ -140,7 +140,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event ) ...@@ -140,7 +140,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event )
g_RepeatStep.x = dlg.GetRepeatHorizontal(); g_RepeatStep.x = dlg.GetRepeatHorizontal();
g_RepeatStep.y = dlg.GetRepeatVertical(); g_RepeatStep.y = dlg.GetRepeatVertical();
g_RepeatDeltaLabel = dlg.GetRepeatLabel(); g_RepeatDeltaLabel = dlg.GetRepeatLabel();
m_Draw_Grid = dlg.GetShowGrid(); SetGridVisibility( dlg.GetShowGrid() );
m_ShowAllPins = dlg.GetShowHiddenPins(); m_ShowAllPins = dlg.GetShowHiddenPins();
DrawPanel->m_AutoPAN_Enable = dlg.GetEnableAutoPan(); DrawPanel->m_AutoPAN_Enable = dlg.GetEnableAutoPan();
g_HVLines = dlg.GetEnableAnyBusOrientation(); g_HVLines = dlg.GetEnableAnyBusOrientation();
...@@ -437,9 +437,6 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void ) ...@@ -437,9 +437,6 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void )
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ),
&g_LayerDescr.LayerColor[LAYER_ERC_ERR], &g_LayerDescr.LayerColor[LAYER_ERC_ERR],
RED ) ); RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGrid" ),
&g_GridColor,
DARKDARKGRAY ) );
return m_configSettings; return m_configSettings;
} }
......
...@@ -163,7 +163,6 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, ...@@ -163,7 +163,6 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
{ {
m_FrameName = wxT( "LibeditFrame" ); m_FrameName = wxT( "LibeditFrame" );
m_Draw_Axis = true; // true to draw axis m_Draw_Axis = true; // true to draw axis
m_Draw_Grid = true; // true to draw grid
m_ConfigPath = wxT( "LibraryEditor" ); m_ConfigPath = wxT( "LibraryEditor" );
SetShowDeMorgan( false ); SetShowDeMorgan( false );
m_drawSpecificConvert = true; m_drawSpecificConvert = true;
......
...@@ -158,7 +158,7 @@ void RedrawOneStruct( WinEDA_DrawPanel* panel, ...@@ -158,7 +158,7 @@ void RedrawOneStruct( WinEDA_DrawPanel* panel,
/**************/ /**************/
void SeedLayers(); void SeedLayers();
EDA_Colors ReturnLayerColor( int Layer ); EDA_Colors ReturnLayerColor( int Layer );
void DisplayColorSetupFrame( WinEDA_DrawFrame* parent, void DisplayColorSetupFrame( WinEDA_SchematicFrame* parent,
const wxPoint& pos ); const wxPoint& pos );
/*************/ /*************/
......
...@@ -519,9 +519,9 @@ void WinEDA_SchematicFrame::OnUpdateUnits( wxUpdateUIEvent& event ) ...@@ -519,9 +519,9 @@ void WinEDA_SchematicFrame::OnUpdateUnits( wxUpdateUIEvent& event )
void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event ) void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event )
{ {
wxString tool_tip = m_Draw_Grid ? _( "Hide grid" ) : _( "Show grid" ); wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_Draw_Grid ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, IsGridVisible() );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip ); m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
} }
......
...@@ -291,7 +291,7 @@ void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -291,7 +291,7 @@ void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_SHOW_GRID: case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = m_OptionsToolBar->GetToolState( id ); SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
......
...@@ -292,7 +292,7 @@ void WinEDA_GerberFrame::SetToolbars() ...@@ -292,7 +292,7 @@ void WinEDA_GerberFrame::SetToolbars()
DisplayOpt.DisplayPolarCood ); DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ); IsGridVisible() );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
m_CursorShape ); m_CursorShape );
......
...@@ -337,15 +337,6 @@ static PARAM_CFG_SETCOLOR ColorLayer31Cfg ...@@ -337,15 +337,6 @@ static PARAM_CFG_SETCOLOR ColorLayer31Cfg
7 7
); );
static PARAM_CFG_SETCOLOR ColorpcbGrilleCfg
(
INSETUP,
wxT("CoPcbGr"),
&g_GridColor,
DARKGRAY
);
static PARAM_CFG_SETCOLOR ColorDCodesCfg static PARAM_CFG_SETCOLOR ColorDCodesCfg
( (
INSETUP, INSETUP,
...@@ -421,7 +412,6 @@ PARAM_CFG_BASE * ParamCfgList[] = ...@@ -421,7 +412,6 @@ PARAM_CFG_BASE * ParamCfgList[] =
& ColorLayer29Cfg, & ColorLayer29Cfg,
& ColorLayer30Cfg, & ColorLayer30Cfg,
& ColorLayer31Cfg, & ColorLayer31Cfg,
& ColorpcbGrilleCfg,
& ColorDCodesCfg, & ColorDCodesCfg,
& GERBERSpotMiniCfg, & GERBERSpotMiniCfg,
& TimeOutCfg, & TimeOutCfg,
......
...@@ -29,7 +29,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -29,7 +29,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_SHOW_GRID: case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = m_OptionsToolBar->GetToolState( id ); SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
// variable used to handle grid visibility: // variable used to handle grid visibility:
bool s_showGrid; bool s_showGrid;
int s_gridColor;
#include "set_color.h" // Header file associated with this file #include "set_color.h" // Header file associated with this file
...@@ -132,7 +133,8 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -132,7 +133,8 @@ void WinEDA_SetColorsFrame::CreateControls()
// Add various items to the dialog box, as determined by the // Add various items to the dialog box, as determined by the
// details of each element contained within laytool_list[] // details of each element contained within laytool_list[]
s_showGrid = m_Parent->m_Draw_Grid; s_showGrid = m_Parent->IsGridVisible();
s_gridColor = m_Parent->GetGridColor();
for( lyr = 0, cln = 0; lyr < NB_BUTT; lyr++ ) for( lyr = 0, cln = 0; lyr < NB_BUTT; lyr++ )
{ {
// Look for the first set of controls within each column. // Look for the first set of controls within each column.
...@@ -435,14 +437,15 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() ...@@ -435,14 +437,15 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
// actually has been provided for each of those layers.) // actually has been provided for each of those layers.)
g_GridColor = CurrentColor[32]; s_gridColor = CurrentColor[32];
s_showGrid = laytool_list[32]->m_CheckBox->GetValue(); s_showGrid = laytool_list[32]->m_CheckBox->GetValue();
g_ColorsSettings.SetItemColor(DCODES_VISIBLE, CurrentColor[33] ); g_ColorsSettings.SetItemColor(DCODES_VISIBLE, CurrentColor[33] );
DisplayOpt.DisplayPadNum = laytool_list[33]->m_CheckBox->GetValue(); DisplayOpt.DisplayPadNum = laytool_list[33]->m_CheckBox->GetValue();
// Additional command required for updating visibility of grid. // Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = s_showGrid; m_Parent->SetGridVisibility( s_showGrid );
m_Parent->SetGridColor( s_gridColor );
} }
......
...@@ -319,7 +319,7 @@ static ButtonIndex Msg_Others_Items = ...@@ -319,7 +319,7 @@ static ButtonIndex Msg_Others_Items =
static ColorButton Grid_Butt= static ColorButton Grid_Butt=
{ {
_("Grid"), // Title _("Grid"), // Title
&g_GridColor, // Address of optional parameter &s_gridColor, // Address of optional parameter
FALSE, FALSE,
&s_showGrid // Address of boolean display control parameter to toggle &s_showGrid // Address of boolean display control parameter to toggle
}; };
......
...@@ -182,9 +182,6 @@ extern int g_UnitMetric; // display units mm = 1, inches = 0, cm = 2 ...@@ -182,9 +182,6 @@ extern int g_UnitMetric; // display units mm = 1, inches = 0, cm = 2
/* Draw color for moving objects: */ /* Draw color for moving objects: */
extern int g_GhostColor; extern int g_GhostColor;
/* Draw color for grid: */
extern int g_GridColor;
/* Current used screen: (not used in eeshema)*/ /* Current used screen: (not used in eeshema)*/
extern BASE_SCREEN* ActiveScreen; extern BASE_SCREEN* ActiveScreen;
......
This diff is collapsed.
...@@ -73,7 +73,6 @@ private: ...@@ -73,7 +73,6 @@ private:
PARAM_CFG_ARRAY m_projectFileParams; PARAM_CFG_ARRAY m_projectFileParams;
PARAM_CFG_ARRAY m_configSettings; PARAM_CFG_ARRAY m_configSettings;
public: public:
WinEDA_SchematicFrame( wxWindow* father, WinEDA_SchematicFrame( wxWindow* father,
const wxString& title, const wxString& title,
......
...@@ -148,6 +148,28 @@ public: ...@@ -148,6 +148,28 @@ public:
void GetKicadAbout( wxCommandEvent& event ); void GetKicadAbout( wxCommandEvent& event );
/** Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
virtual bool IsGridVisible();
/** Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visiblity in configuration.
* @param aVisible = true if the grid must be shown
*/
virtual void SetGridVisibility(bool aVisible);
/** Function GetGridColor() , virtual
* @return the color of the grid
*/
virtual int GetGridColor();
/** Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
virtual void SetGridColor(int aColor);
// Configurations: // Configurations:
void InstallConfigFrame( const wxPoint& pos ); void InstallConfigFrame( const wxPoint& pos );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <wx/aui/aui.h> #include <wx/aui/aui.h>
#endif #endif
#include "colors.h"
//C++ guarantees that operator delete checks its argument for null-ness //C++ guarantees that operator delete checks its argument for null-ness
#ifndef SAFE_DELETE #ifndef SAFE_DELETE
...@@ -175,7 +176,6 @@ public: ...@@ -175,7 +176,6 @@ public:
int m_UnitType; // Internal Unit type (0 = inch) int m_UnitType; // Internal Unit type (0 = inch)
bool m_Draw_Axis; // TRUE to show X and Y axis bool m_Draw_Axis; // TRUE to show X and Y axis
bool m_Draw_Grid; // TRUE to show the grid
bool m_Draw_Sheet_Ref; // TRUE to show frame references bool m_Draw_Sheet_Ref; // TRUE to show frame references
bool m_Print_Sheet_Ref; // TRUE to print frame references bool m_Print_Sheet_Ref; // TRUE to print frame references
...@@ -189,6 +189,8 @@ public: ...@@ -189,6 +189,8 @@ public:
protected: protected:
int m_LastGridSizeId; int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color
private: private:
BASE_SCREEN* m_CurrentScreen; ///< current used SCREEN BASE_SCREEN* m_CurrentScreen; ///< current used SCREEN
...@@ -233,6 +235,44 @@ public: ...@@ -233,6 +235,44 @@ public:
virtual void SetToolID( int id, int new_cursor_id, virtual void SetToolID( int id, int new_cursor_id,
const wxString& title ); const wxString& title );
/* Thes 4 functions provide a basic way to sho/hide grid
* and /get/set grid color.
* thes parameters are saved in kicad config for each main frame
*/
/** Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
virtual bool IsGridVisible()
{
return m_DrawGrid;
}
/** Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* @param aVisible = true if the grid must be shown
*/
virtual void SetGridVisibility(bool aVisible)
{
m_DrawGrid = aVisible;
}
/** Function GetGridColor() , virtual
* @return the color of the grid
*/
virtual int GetGridColor()
{
return m_GridColor;
}
/** Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
virtual void SetGridColor(int aColor)
{
m_GridColor = aColor;
}
/** /**
* Command event handler for selecting grid sizes. * Command event handler for selecting grid sizes.
* *
...@@ -682,7 +722,7 @@ public: ...@@ -682,7 +722,7 @@ public:
void SetToolNormalBitmap( int id, const wxBitmap& bitmap ) {}; void SetToolNormalBitmap( int id, const wxBitmap& bitmap ) {};
void SetRows( int nRows ) {}; void SetRows( int nRows ) {};
#endif #endif
/** Function GetDimension /** Function GetDimension
* @return the dimension of this toolbar (Height if horizontal, Width if vertical. * @return the dimension of this toolbar (Height if horizontal, Width if vertical.
*/ */
......
No preview for this file type
This diff is collapsed.
...@@ -432,12 +432,6 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled ) ...@@ -432,12 +432,6 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
{ {
switch( aPCB_VISIBLE ) switch( aPCB_VISIBLE )
{ {
case GRID_VISIBLE:
m_PcbFrame->m_Draw_Grid = isEnabled;
GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled );
break;
case RATSNEST_VISIBLE: case RATSNEST_VISIBLE:
GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled ); GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled );
// we must clear or set the CH_VISIBLE flags to hide/show ratsnet // we must clear or set the CH_VISIBLE flags to hide/show ratsnet
...@@ -478,10 +472,8 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE ) ...@@ -478,10 +472,8 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
case PAD_FR_VISIBLE: case PAD_FR_VISIBLE:
case PAD_BK_VISIBLE: case PAD_BK_VISIBLE:
case RATSNEST_VISIBLE: case RATSNEST_VISIBLE:
color = GetColorsSettings()->GetItemColor( aPCB_VISIBLE );
break;
case GRID_VISIBLE: case GRID_VISIBLE:
color = g_GridColor; color = GetColorsSettings()->GetItemColor( aPCB_VISIBLE );
break; break;
default: default:
...@@ -505,15 +497,9 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor ) ...@@ -505,15 +497,9 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor )
case ANCHOR_VISIBLE: case ANCHOR_VISIBLE:
case PAD_FR_VISIBLE: case PAD_FR_VISIBLE:
case PAD_BK_VISIBLE: case PAD_BK_VISIBLE:
case GRID_VISIBLE:
GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor ); GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor );
break; break;
case RATSNEST_VISIBLE:
GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor );
break;
case GRID_VISIBLE:
g_GridColor = aColor;
break;
default: default:
wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE ); wxLogDebug( wxT( "BOARD::SetVisibleElementColor(): bad arg %d" ), aPCB_VISIBLE );
......
...@@ -22,7 +22,7 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -22,7 +22,7 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_SHOW_GRID: case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = m_OptionsToolBar->GetToolState( id ); SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
......
...@@ -363,9 +363,9 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -363,9 +363,9 @@ void WinEDA_ModuleEditFrame::SetToolbars()
_( "Display polar coordinates" ) ); _( "Display polar coordinates" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ); IsGridVisible( ) );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ? IsGridVisible( ) ?
_( "Hide grid" ) : _( "Hide grid" ) :
_( "Show grid" ) ); _( "Show grid" ) );
......
...@@ -844,10 +844,6 @@ void WinEDA_PcbFrame::LoadSettings() ...@@ -844,10 +844,6 @@ void WinEDA_PcbFrame::LoadSettings()
config->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption ); config->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption );
config->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools ); config->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools );
config->Read( SHOW_LAYER_MANAGER_TOOLS, &m_show_layer_manager_tools ); config->Read( SHOW_LAYER_MANAGER_TOOLS, &m_show_layer_manager_tools );
// Copy grid visibility (set by LoadSetting() in visibility items list:
GetBoard()->SetElementVisibility(GRID_VISIBLE, m_Draw_Grid);
} }
...@@ -872,6 +868,40 @@ void WinEDA_PcbFrame::SaveSettings() ...@@ -872,6 +868,40 @@ void WinEDA_PcbFrame::SaveSettings()
} }
/** Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
bool WinEDA_PcbFrame::IsGridVisible()
{
return IsElementVisible(GRID_VISIBLE);
}
/** Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visiblity in configuration.
* @param aVisible = true if the grid must be shown
*/
void WinEDA_PcbFrame::SetGridVisibility(bool aVisible)
{
SetElementVisibility(GRID_VISIBLE, aVisible);
}
/** Function GetGridColor() , virtual
* @return the color of the grid
*/
int WinEDA_PcbFrame::GetGridColor()
{
return GetBoard()->GetVisibleElementColor( GRID_VISIBLE );
}
/** Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
void WinEDA_PcbFrame::SetGridColor(int aColor)
{
GetBoard()->SetVisibleElementColor( GRID_VISIBLE, aColor );
}
/* Return true if a microvia can be put on board /* Return true if a microvia can be put on board
* A microvia ia a small via restricted to 2 near neighbour layers * A microvia ia a small via restricted to 2 near neighbour layers
* because its is hole is made by laser which can penetrate only one layer * because its is hole is made by laser which can penetrate only one layer
......
...@@ -579,14 +579,6 @@ static PARAM_CFG_SETCOLOR ColorViaMicroViaCfg // Buried Via Color ...@@ -579,14 +579,6 @@ static PARAM_CFG_SETCOLOR ColorViaMicroViaCfg // Buried Via Color
CYAN CYAN
); );
static PARAM_CFG_SETCOLOR ColorpcbGrilleCfg
(
INSETUP,
wxT( "CoPcbGr" ),
&g_GridColor,
DARKGRAY
);
static PARAM_CFG_SETCOLOR ColorCheveluCfg static PARAM_CFG_SETCOLOR ColorCheveluCfg
( (
INSETUP, INSETUP,
...@@ -795,7 +787,6 @@ PARAM_CFG_BASE* ParamCfgList[] = ...@@ -795,7 +787,6 @@ PARAM_CFG_BASE* ParamCfgList[] =
&ColorViaThroughCfg, &ColorViaThroughCfg,
&ColorViaBlindBuriedCfg, &ColorViaBlindBuriedCfg,
&ColorViaMicroViaCfg, &ColorViaMicroViaCfg,
&ColorpcbGrilleCfg,
&ColorCheveluCfg, &ColorCheveluCfg,
&HPGLpenNumCfg, &HPGLpenNumCfg,
&HPGLdiamCfg, &HPGLdiamCfg,
......
...@@ -201,7 +201,7 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar() ...@@ -201,7 +201,7 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
wxBitmap( grid_xpm ), wxBitmap( grid_xpm ),
_( "Hide grid" ), wxITEM_CHECK ); _( "Hide grid" ), wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_Draw_Grid ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,IsGridVisible() );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
wxBitmap( polar_coord_xpm ), wxBitmap( polar_coord_xpm ),
......
...@@ -203,9 +203,9 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -203,9 +203,9 @@ void WinEDA_PcbFrame::SetToolbars()
_( "Display rectangular coordinates" ) : _( "Display rectangular coordinates" ) :
_( "Display polar coordinates" ) ); _( "Display polar coordinates" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, GetBoard()->IsElementVisible(GRID_VISIBLE) ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, IsGridVisible( ) );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
GetBoard()->IsElementVisible(GRID_VISIBLE) ? IsGridVisible( ) ?
_( "Hide grid" ) : _( "Hide grid" ) :
_( "Show grid" ) ); _( "Show grid" ) );
......
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