Commit a61b48ec authored by charras's avatar charras

Code cleaning. Use new font.

parent d84087c0
......@@ -68,7 +68,6 @@ const wxString AllFilesWildcard( _( "All files (*)|*" ) );
wxString g_ProductName = wxT( "KiCad E.D.A. " );
bool g_ShowPageLimits = true;
int g_GridColor = DARKGRAY;
wxString g_UserLibDirBuffer;
int g_DebugLevel;
int g_MouseOldButtons;
......
......@@ -22,8 +22,9 @@
/* Configuration entry names. */
static const wxString CursorShapeEntry( wxT( "CuShape" ) );
static const wxString ShowGridEntry( wxT( "ShGrid" ) );
static const wxString CursorShapeEntryKeyword( wxT( "CursorShape" ) );
static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
static const wxString GridColorEntryKeyword( wxT( "GridColor" ) );
static const wxString LastGridSizeId( wxT( "_LastGridSize" ) );
......@@ -60,13 +61,14 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
m_ID_last_state = 0;
m_HTOOL_current_state = 0;
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_Print_Sheet_Ref = TRUE; // TRUE to print reference sheet.
m_Draw_Auxiliary_Axis = FALSE; // TRUE draw auxilary axis.
m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch
m_CursorShape = 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
m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
......@@ -720,8 +722,13 @@ void WinEDA_DrawFrame::LoadSettings()
wxConfig* cfg = wxGetApp().m_EDA_Config;
WinEDA_BasicFrame::LoadSettings();
cfg->Read( m_FrameName + CursorShapeEntry, &m_CursorShape, ( long )0 );
cfg->Read( m_FrameName + ShowGridEntry, &m_Draw_Grid, true );
cfg->Read( m_FrameName + CursorShapeEntryKeyword, &m_CursorShape, ( long )0 );
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 );
}
......@@ -739,8 +746,9 @@ void WinEDA_DrawFrame::SaveSettings()
wxConfig* cfg = wxGetApp().m_EDA_Config;
WinEDA_BasicFrame::SaveSettings();
cfg->Write( m_FrameName + CursorShapeEntry, m_CursorShape );
cfg->Write( m_FrameName + ShowGridEntry, m_Draw_Grid );
cfg->Write( m_FrameName + CursorShapeEntryKeyword, m_CursorShape );
cfg->Write( m_FrameName + ShowGridEntryKeyword, IsGridVisible() );
cfg->Write( m_FrameName + GridColorEntryKeyword, GetGridColor() );
cfg->Write( m_FrameName + LastGridSizeId, ( long ) m_LastGridSizeId );
}
......
......@@ -703,7 +703,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
GRSetDrawMode( DC, GR_COPY );
if( m_Parent->m_Draw_Grid )
if( m_Parent->IsGridVisible() )
DrawGrid( DC );
/* Draw axis */
......@@ -789,7 +789,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
#endif
m_Parent->PutOnGrid( &org );
GRSetColorPen( DC, g_GridColor );
GRSetColorPen( DC, m_Parent->GetGridColor() );
int xpos, ypos;
......@@ -842,7 +842,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
tmpDC.SelectObject( tmpBM );
GRSetColorPen( &tmpDC, g_DrawBgColor );
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
{
yg = wxRound( jj * screen_grid_size.y );
......
......@@ -18,7 +18,7 @@
#endif
#define EDA_DRAWBASE
#include "hershey_fonts.h"
#include "newstroke_font.h"
#include "plot_common.h"
/* 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 )
}
#endif
if ( AsciiCode > 0x7F )
/* calculate font length */
int font_length_max = sizeof(newstroke_font)/sizeof(*newstroke_font);
if ( AsciiCode >= (32 + font_length_max) )
AsciiCode = '?';
if( AsciiCode < 32 )
AsciiCode = 32; /* Clamp control chars */
AsciiCode -= 32;
return hershey_simplex[AsciiCode];
return newstroke_font[AsciiCode];
}
......
......@@ -21,13 +21,13 @@ set(CVPCB_SRCS
cfg.cpp
class_cvpcb.cpp
class_components_listbox.cpp
class_DisplayFootprintsFrame.cpp
class_footprints_listbox.cpp
cvframe.cpp
cvpcb.cpp
dialog_cvpcb_config.cpp
dialog_cvpcb_config_fbp.cpp
dialog_display_options.cpp
displayframe.cpp
dummy_functions.cpp
genequiv.cpp
init.cpp
......
......@@ -13,6 +13,7 @@
#include "bitmaps.h"
#include "protos.h"
#include "cvstruct.h"
#include "class_DisplayFootprintsFrame.h"
/*
* NOTE: There is something in 3d_viewer.h that causes a compiler error in
......@@ -23,20 +24,20 @@
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )
EVT_SIZE( WinEDA_DisplayFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_DisplayFrame::OnZoom )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_DisplayFrame::Show3D_Frame )
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 )
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 wxPoint& pos,
const wxSize& size, long style ) :
......@@ -109,7 +110,7 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father,
}
WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
{
delete GetBoard();
......@@ -122,7 +123,7 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame()
/* Called when the frame is closed
* Save current settings (frame position and size
*/
void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event )
void DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow( wxCloseEvent& event )
{
wxPoint pos;
wxSize size;
......@@ -135,14 +136,14 @@ void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event )
}
void WinEDA_DisplayFrame::ReCreateVToolbar()
void DISPLAY_FOOTPRINTS_FRAME::ReCreateVToolbar()
{
// Currently, no vertical right toolbar.
// So do nothing
}
void WinEDA_DisplayFrame::ReCreateHToolbar()
void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
{
if( m_HToolBar != NULL )
return;
......@@ -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 )
{
return true;
}
void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* DC, wxPoint Mouse )
{
wxRealPoint delta;
int flagcurseur = 0;
......@@ -325,7 +326,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/**
* 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 )
{
......@@ -347,3 +348,30 @@ void WinEDA_DisplayFrame::Show3D_Frame( wxCommandEvent& event )
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 @@
#include "protos.h"
#include "cvstruct.h"
#include "dialog_cvpcb_config.h"
#include "class_DisplayFootprintsFrame.h"
#include "build_version.h"
......
......@@ -13,7 +13,7 @@
/* Forward declarations of all top-level window classes. */
class FOOTPRINTS_LISTBOX;
class COMPONENTS_LISTBOX;
class WinEDA_DisplayFrame;
class DISPLAY_FOOTPRINTS_FRAME;
#include "id.h"
......@@ -57,7 +57,7 @@ public:
bool m_KeepCvpcbOpen;
FOOTPRINTS_LISTBOX* m_FootprintList;
COMPONENTS_LISTBOX* m_ListCmp;
WinEDA_DisplayFrame* DrawFrame;
DISPLAY_FOOTPRINTS_FRAME* DrawFrame;
WinEDA_Toolbar* m_HToolBar;
wxFileName m_NetlistFileName;
wxArrayString m_ModuleLibNames;
......@@ -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
......@@ -26,6 +26,7 @@
#include "protos.h"
#include "class_drawpanel.h"
#include "cvstruct.h"
#include "class_DisplayFootprintsFrame.h"
#include "dialog_display_options.h"
......@@ -33,7 +34,7 @@
////@end XPM images
void WinEDA_DisplayFrame::InstallOptionsDisplay( wxCommandEvent& event )
void DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay( wxCommandEvent& event )
{
WinEDA_FootprintDisplayOptionsFrame* OptionWindow =
new WinEDA_FootprintDisplayOptionsFrame( this );
......
......@@ -14,6 +14,7 @@
#include "cvpcb.h"
#include "protos.h"
#include "cvstruct.h"
#include "class_DisplayFootprintsFrame.h"
/**
......@@ -24,7 +25,7 @@
* @param CmpName - Module name
* @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;
unsigned ii;
......
......@@ -10,6 +10,7 @@
#include "cvpcb.h"
#include "protos.h"
#include "cvstruct.h"
#include "class_DisplayFootprintsFrame.h"
/*
* NOTE: There is something in 3d_viewer.h that causes a compiler error in
......@@ -33,7 +34,7 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
if( DrawFrame == NULL )
{
DrawFrame = new WinEDA_DisplayFrame( this, _( "Module" ),
DrawFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ),
wxPoint( 0, 0 ),
wxSize( 600, 400 ),
KICAD_DEFAULT_DRAWFRAME_STYLE |
......@@ -85,7 +86,7 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
/*
* Draws the current highlighted footprint.
*/
void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
if( !GetBoard() )
return;
......
......@@ -18,8 +18,7 @@
#include "eelayer.h" // Header file associated with this file
// 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 )
......@@ -35,7 +34,7 @@ END_EVENT_TABLE()
/**************************************************************/
void DisplayColorSetupFrame( WinEDA_DrawFrame* parent,
void DisplayColorSetupFrame( WinEDA_SchematicFrame* parent,
const wxPoint& framepos )
{
/**************************************************************/
......@@ -56,7 +55,7 @@ WinEDA_SetColorsFrame::WinEDA_SetColorsFrame()
// Standard Constructor
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent,
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_SchematicFrame* parent,
const wxPoint& framepos )
{
m_Parent = parent;
......@@ -224,7 +223,7 @@ void WinEDA_SetColorsFrame::CreateControls()
m_ShowGrid =
new wxCheckBox( this, ID_CHECKBOX_SHOW_GRID, _( "Grid" ),
wxDefaultPosition, wxDefaultSize, 0 );
m_ShowGrid->SetValue( m_Parent->m_Draw_Grid );
m_ShowGrid->SetValue( m_Parent->IsGridVisible() );
RowBoxSizer->Add( m_ShowGrid,
1,
wxALIGN_CENTER_VERTICAL | wxBOTTOM,
......@@ -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 )
{
......@@ -367,7 +340,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
// The previous command compiles OK, but to prevent a warning
// from being generated when the Linux version is being compiled,
// 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
if( m_SelBgColor->GetSelection() == 0 )
......
......@@ -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] = {
&Layer_Wire_Item,
&Layer_Bus_Item,
......@@ -239,8 +232,6 @@ static ColorButton* laytool_list[NB_BUTT] = {
&Layer_Erc_Warning_Item,
&Layer_Erc_Error_Item,
&Layer_Grid_Item
};
......@@ -294,7 +285,7 @@ private:
DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame )
DECLARE_EVENT_TABLE()
WinEDA_DrawFrame* m_Parent;
WinEDA_SchematicFrame* m_Parent;
wxBoxSizer* OuterBoxSizer;
wxBoxSizer* MainBoxSizer;
wxBoxSizer* ColumnBoxSizer;
......@@ -334,7 +325,7 @@ private:
public:
// Constructors and destructor
WinEDA_SetColorsFrame();
WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos );
WinEDA_SetColorsFrame( WinEDA_SchematicFrame* parent, const wxPoint& framepos );
~WinEDA_SetColorsFrame();
};
......
......@@ -120,7 +120,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event )
dlg.SetRepeatHorizontal( g_RepeatStep.x );
dlg.SetRepeatVertical( g_RepeatStep.y );
dlg.SetRepeatLabel( g_RepeatDeltaLabel );
dlg.SetShowGrid( m_Draw_Grid );
dlg.SetShowGrid( IsGridVisible() );
dlg.SetShowHiddenPins( m_ShowAllPins );
dlg.SetEnableAutoPan( DrawPanel->m_AutoPAN_Enable );
dlg.SetEnableAnyBusOrientation( g_HVLines );
......@@ -140,7 +140,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event )
g_RepeatStep.x = dlg.GetRepeatHorizontal();
g_RepeatStep.y = dlg.GetRepeatVertical();
g_RepeatDeltaLabel = dlg.GetRepeatLabel();
m_Draw_Grid = dlg.GetShowGrid();
SetGridVisibility( dlg.GetShowGrid() );
m_ShowAllPins = dlg.GetShowHiddenPins();
DrawPanel->m_AutoPAN_Enable = dlg.GetEnableAutoPan();
g_HVLines = dlg.GetEnableAnyBusOrientation();
......@@ -437,9 +437,6 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void )
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ),
&g_LayerDescr.LayerColor[LAYER_ERC_ERR],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGrid" ),
&g_GridColor,
DARKDARKGRAY ) );
return m_configSettings;
}
......
......@@ -163,7 +163,6 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
{
m_FrameName = wxT( "LibeditFrame" );
m_Draw_Axis = true; // true to draw axis
m_Draw_Grid = true; // true to draw grid
m_ConfigPath = wxT( "LibraryEditor" );
SetShowDeMorgan( false );
m_drawSpecificConvert = true;
......
......@@ -158,7 +158,7 @@ void RedrawOneStruct( WinEDA_DrawPanel* panel,
/**************/
void SeedLayers();
EDA_Colors ReturnLayerColor( int Layer );
void DisplayColorSetupFrame( WinEDA_DrawFrame* parent,
void DisplayColorSetupFrame( WinEDA_SchematicFrame* parent,
const wxPoint& pos );
/*************/
......
......@@ -519,9 +519,9 @@ void WinEDA_SchematicFrame::OnUpdateUnits( 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 );
}
......
......@@ -291,7 +291,7 @@ void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id )
{
case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh();
break;
......
......@@ -292,7 +292,7 @@ void WinEDA_GerberFrame::SetToolbars()
DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid );
IsGridVisible() );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
m_CursorShape );
......
......@@ -337,15 +337,6 @@ static PARAM_CFG_SETCOLOR ColorLayer31Cfg
7
);
static PARAM_CFG_SETCOLOR ColorpcbGrilleCfg
(
INSETUP,
wxT("CoPcbGr"),
&g_GridColor,
DARKGRAY
);
static PARAM_CFG_SETCOLOR ColorDCodesCfg
(
INSETUP,
......@@ -421,7 +412,6 @@ PARAM_CFG_BASE * ParamCfgList[] =
& ColorLayer29Cfg,
& ColorLayer30Cfg,
& ColorLayer31Cfg,
& ColorpcbGrilleCfg,
& ColorDCodesCfg,
& GERBERSpotMiniCfg,
& TimeOutCfg,
......
......@@ -29,7 +29,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id )
{
case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh( TRUE );
break;
......
......@@ -18,6 +18,7 @@
// variable used to handle grid visibility:
bool s_showGrid;
int s_gridColor;
#include "set_color.h" // Header file associated with this file
......@@ -132,7 +133,8 @@ void WinEDA_SetColorsFrame::CreateControls()
// Add various items to the dialog box, as determined by the
// 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++ )
{
// Look for the first set of controls within each column.
......@@ -435,14 +437,15 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
// 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();
g_ColorsSettings.SetItemColor(DCODES_VISIBLE, CurrentColor[33] );
DisplayOpt.DisplayPadNum = laytool_list[33]->m_CheckBox->GetValue();
// 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 =
static ColorButton Grid_Butt=
{
_("Grid"), // Title
&g_GridColor, // Address of optional parameter
&s_gridColor, // Address of optional parameter
FALSE,
&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
/* Draw color for moving objects: */
extern int g_GhostColor;
/* Draw color for grid: */
extern int g_GridColor;
/* Current used screen: (not used in eeshema)*/
extern BASE_SCREEN* ActiveScreen;
......
This diff is collapsed.
......@@ -73,7 +73,6 @@ private:
PARAM_CFG_ARRAY m_projectFileParams;
PARAM_CFG_ARRAY m_configSettings;
public:
WinEDA_SchematicFrame( wxWindow* father,
const wxString& title,
......
......@@ -148,6 +148,28 @@ public:
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:
void InstallConfigFrame( const wxPoint& pos );
void Process_Config( wxCommandEvent& event );
......
......@@ -18,6 +18,7 @@
#include <wx/aui/aui.h>
#endif
#include "colors.h"
//C++ guarantees that operator delete checks its argument for null-ness
#ifndef SAFE_DELETE
......@@ -175,7 +176,6 @@ public:
int m_UnitType; // Internal Unit type (0 = inch)
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_Print_Sheet_Ref; // TRUE to print frame references
......@@ -189,6 +189,8 @@ public:
protected:
int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color
private:
BASE_SCREEN* m_CurrentScreen; ///< current used SCREEN
......@@ -233,6 +235,44 @@ public:
virtual void SetToolID( int id, int new_cursor_id,
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.
*
......
No preview for this file type
This diff is collapsed.
......@@ -432,12 +432,6 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
{
switch( aPCB_VISIBLE )
{
case GRID_VISIBLE:
m_PcbFrame->m_Draw_Grid = isEnabled;
GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled );
break;
case RATSNEST_VISIBLE:
GetBoardDesignSettings()->SetElementVisibility( aPCB_VISIBLE, isEnabled );
// we must clear or set the CH_VISIBLE flags to hide/show ratsnet
......@@ -478,10 +472,8 @@ int BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
case PAD_FR_VISIBLE:
case PAD_BK_VISIBLE:
case RATSNEST_VISIBLE:
color = GetColorsSettings()->GetItemColor( aPCB_VISIBLE );
break;
case GRID_VISIBLE:
color = g_GridColor;
color = GetColorsSettings()->GetItemColor( aPCB_VISIBLE );
break;
default:
......@@ -505,14 +497,8 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor )
case ANCHOR_VISIBLE:
case PAD_FR_VISIBLE:
case PAD_BK_VISIBLE:
GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor );
break;
case RATSNEST_VISIBLE:
GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor );
break;
case GRID_VISIBLE:
g_GridColor = aColor;
GetColorsSettings()->SetItemColor( aPCB_VISIBLE, aColor );
break;
default:
......
......@@ -22,7 +22,7 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id )
{
case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
DrawPanel->Refresh( );
break;
......
......@@ -363,9 +363,9 @@ void WinEDA_ModuleEditFrame::SetToolbars()
_( "Display polar coordinates" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid );
IsGridVisible( ) );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ?
IsGridVisible( ) ?
_( "Hide grid" ) :
_( "Show grid" ) );
......
......@@ -844,10 +844,6 @@ void WinEDA_PcbFrame::LoadSettings()
config->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption );
config->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_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()
}
/** 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
* 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
......
......@@ -579,14 +579,6 @@ static PARAM_CFG_SETCOLOR ColorViaMicroViaCfg // Buried Via Color
CYAN
);
static PARAM_CFG_SETCOLOR ColorpcbGrilleCfg
(
INSETUP,
wxT( "CoPcbGr" ),
&g_GridColor,
DARKGRAY
);
static PARAM_CFG_SETCOLOR ColorCheveluCfg
(
INSETUP,
......@@ -795,7 +787,6 @@ PARAM_CFG_BASE* ParamCfgList[] =
&ColorViaThroughCfg,
&ColorViaBlindBuriedCfg,
&ColorViaMicroViaCfg,
&ColorpcbGrilleCfg,
&ColorCheveluCfg,
&HPGLpenNumCfg,
&HPGLdiamCfg,
......
......@@ -201,7 +201,7 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
wxBitmap( grid_xpm ),
_( "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,
wxBitmap( polar_coord_xpm ),
......
......@@ -203,9 +203,9 @@ void WinEDA_PcbFrame::SetToolbars()
_( "Display rectangular 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,
GetBoard()->IsElementVisible(GRID_VISIBLE) ?
IsGridVisible( ) ?
_( "Hide 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