Commit e8e6f1a7 authored by charras's avatar charras

code cleaning and very minor bugs fixed

parent 6f631976
...@@ -328,7 +328,7 @@ bool EDA_TextStruct::HitTest( EDA_Rect& refArea ) ...@@ -328,7 +328,7 @@ bool EDA_TextStruct::HitTest( EDA_Rect& refArea )
void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor, const wxPoint& aOffset, EDA_Colors aColor,
int aDrawMode, int aDrawMode,
GRFillMode aDisplayMode, EDA_Colors aAnchor_color ) GRFillMode aFillMode, EDA_Colors aAnchor_color )
/***************************************************************/ /***************************************************************/
/** Function Draw /** Function Draw
...@@ -338,7 +338,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -338,7 +338,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aOffset = draw offset (usually (0,0)) * @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color * @param EDA_Colors aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aDisplayMode = FILAIRE, FILLED or SKETCH * @param aFillMode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
*/ */
...@@ -360,7 +360,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -360,7 +360,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
aOffset, aOffset,
aColor, aColor,
aDrawMode, aDrawMode,
aDisplayMode, aFillMode,
aAnchor_color, aAnchor_color,
txt, txt,
pos ); pos );
...@@ -375,7 +375,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -375,7 +375,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
aOffset, aOffset,
aColor, aColor,
aDrawMode, aDrawMode,
aDisplayMode, aFillMode,
aAnchor_color, aAnchor_color,
m_Text, m_Text,
m_Pos ); m_Pos );
...@@ -390,7 +390,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -390,7 +390,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aOffset = draw offset (usually (0,0)) * @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color * @param EDA_Colors aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aDisplayMode = FILAIRE, FILLED or SKETCH * @param aFillMode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
* @param EDA_Colors aText = the single line of text to draw. * @param EDA_Colors aText = the single line of text to draw.
* @param EDA_Colors aPos = the position of this line ). * @param EDA_Colors aPos = the position of this line ).
...@@ -398,12 +398,12 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -398,12 +398,12 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC, void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor, const wxPoint& aOffset, EDA_Colors aColor,
int aDrawMode, int aDrawMode,
GRFillMode aDisplayMode, EDA_Colors aAnchor_color, GRFillMode aFillMode, EDA_Colors aAnchor_color,
wxString& aText, wxPoint aPos ) wxString& aText, wxPoint aPos )
{ {
int width = m_Width; int width = m_Width;
if( aDisplayMode == FILAIRE ) if( aFillMode == FILAIRE )
width = 0; width = 0;
if( aDrawMode != -1 ) if( aDrawMode != -1 )
...@@ -425,7 +425,7 @@ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC, ...@@ -425,7 +425,7 @@ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
cX, cY + anchor_size, 0, aAnchor_color ); cX, cY + anchor_size, 0, aAnchor_color );
} }
if( aDisplayMode == SKETCH ) if( aFillMode == SKETCH )
width = -width; width = -width;
wxSize size = m_Size; wxSize size = m_Size;
......
...@@ -69,7 +69,6 @@ wxArrayString g_LibName_List; // library list to load ...@@ -69,7 +69,6 @@ wxArrayString g_LibName_List; // library list to load
BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Linked list of deleted items BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Linked list of deleted items
int g_UnDeleteStackPtr; int g_UnDeleteStackPtr;
bool g_ShowGrid = true;
DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */ DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */
......
...@@ -36,7 +36,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -36,7 +36,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 = g_ShowGrid = m_OptionsToolBar->GetToolState( id ); m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
#include "protos.h" #include "protos.h"
// variable used to handle grid visibility:
bool s_showGrid;
#include "set_color.h" // Header file associated with this file #include "set_color.h" // Header file associated with this file
// Local variables: // Local variables:
...@@ -132,6 +135,7 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -132,6 +135,7 @@ 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;
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.
...@@ -441,8 +445,8 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() ...@@ -441,8 +445,8 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
*laytool_list[lyr]->m_NoDisplay = laytool_list[lyr]->m_CheckBox->GetValue(); *laytool_list[lyr]->m_NoDisplay = laytool_list[lyr]->m_CheckBox->GetValue();
} }
} }
// Additional command required for updating visibility of grid. // Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = g_ShowGrid; m_Parent->m_Draw_Grid = s_showGrid;
} }
......
...@@ -324,7 +324,7 @@ static ColorButton Grid_Butt= ...@@ -324,7 +324,7 @@ static ColorButton Grid_Butt=
_("Grid"), // Title _("Grid"), // Title
&g_GridColor, // Address of optional parameter &g_GridColor, // Address of optional parameter
FALSE, FALSE,
&g_ShowGrid // Address of boolean display control parameter to toggle &s_showGrid // Address of boolean display control parameter to toggle
}; };
static ColorButton Show_DCodes_Butt= static ColorButton Show_DCodes_Butt=
......
...@@ -513,13 +513,13 @@ public: ...@@ -513,13 +513,13 @@ public:
* @param aDC = the current Device Context * @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0)) * @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color * @param EDA_Colors aColor = text color
* @param aDraw_mode = GR_OR, GR_XOR.., -1 to use the current mode. * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param GRFillMode aDisplay_mode = FILAIRE, FILLED or SKETCH * @param GRFillMode aDisplay_mode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
*/ */
void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor, const wxPoint& aOffset, EDA_Colors aColor,
int aDisplayMode, GRFillMode aDisplay_mode = FILAIRE, int aDrawMode, GRFillMode aDisplay_mode = FILAIRE,
EDA_Colors aAnchor_color = UNSPECIFIED_COLOR ); EDA_Colors aAnchor_color = UNSPECIFIED_COLOR );
private: private:
...@@ -531,14 +531,14 @@ private: ...@@ -531,14 +531,14 @@ private:
* @param aOffset = draw offset (usually (0,0)) * @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color * @param EDA_Colors aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aDisplayMode = FILAIRE, FILLED or SKETCH * @param aFillMode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
* @param EDA_Colors aText = the single line of text to draw. * @param EDA_Colors aText = the single line of text to draw.
* @param EDA_Colors aPos = the position of this line ). * @param EDA_Colors aPos = the position of this line ).
*/ */
void DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC, void DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor, const wxPoint& aOffset, EDA_Colors aColor,
int aDisplayMode, GRFillMode aDisplay_mode, int aDrawMode, GRFillMode aFillMode,
EDA_Colors aAnchor_color, wxString& aText, EDA_Colors aAnchor_color, wxString& aText,
wxPoint aPos ); wxPoint aPos );
public: public:
......
...@@ -23,7 +23,6 @@ extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS]; ...@@ -23,7 +23,6 @@ extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern wxArrayString g_LibName_List; // library list to load extern wxArrayString g_LibName_List; // library list to load
extern bool g_ShowGrid;
extern BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; extern BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE];
extern int g_UnDeleteStackPtr; extern int g_UnDeleteStackPtr;
extern DISPLAY_OPTIONS DisplayOpt; extern DISPLAY_OPTIONS DisplayOpt;
......
...@@ -320,7 +320,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -320,7 +320,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_GRID: case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = g_ShowGrid = m_OptionsToolBar->GetToolState( id ); m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
......
...@@ -182,7 +182,7 @@ file extension to a Kicad project file extension (.pro)." ), ...@@ -182,7 +182,7 @@ file extension to a Kicad project file extension (.pro)." ),
/* User library path takes precedent over default library search paths. */ /* User library path takes precedent over default library search paths. */
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 ); wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
/* Traitement des variables particulieres: */ /* Some parameters must be reinitialize after loading a new board or config: */
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth; g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize; g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
...@@ -192,6 +192,26 @@ file extension to a Kicad project file extension (.pro)." ), ...@@ -192,6 +192,26 @@ file extension to a Kicad project file extension (.pro)." ),
g_DesignSettings.m_ViaSizeHistory[ii] = 0; g_DesignSettings.m_ViaSizeHistory[ii] = 0;
} }
/* Reset the ITEM_NOT_SHOW flag when loading a new config
* Because it could creates SERIOUS mistakes for the user,
* if some items are not visible after loading a board...
*/
for( ii = 0; ii < LAYER_COUNT; ii++ )
g_DesignSettings.m_LayerColor[ii] &= ~ ITEM_NOT_SHOW;
DisplayOpt.Show_Modules_Cmp = true;
DisplayOpt.Show_Modules_Cu = true;
g_ModuleTextNOVColor &= ~ ITEM_NOT_SHOW;
g_ModuleTextCMPColor &= ~ ITEM_NOT_SHOW;
g_ModuleTextCUColor &= ~ ITEM_NOT_SHOW;
g_PadCMPColor &= ~ ITEM_NOT_SHOW;
g_PadCUColor &= ~ ITEM_NOT_SHOW;
g_DesignSettings.m_ViaColor[VIA_THROUGH] &= ~ ITEM_NOT_SHOW;
g_DesignSettings.m_ViaColor[VIA_BLIND_BURIED] &= ~ ITEM_NOT_SHOW;
g_DesignSettings.m_ViaColor[VIA_MICROVIA] &= ~ ITEM_NOT_SHOW;
// These parameters could be left in their previous state, or resetted
// Comment or uncomment to keep or reset this option after loading a board
g_AnchorColor &= ~ ITEM_NOT_SHOW;
DisplayOpt.DisplayPadNoConn = true;
return TRUE; return TRUE;
} }
......
...@@ -210,11 +210,11 @@ static PARAM_CFG_BOOL TrackAfficheGardeCfg ...@@ -210,11 +210,11 @@ static PARAM_CFG_BOOL TrackAfficheGardeCfg
FALSE /* Default value */ FALSE /* Default value */
); );
static PARAM_CFG_INT PadFillCfg static PARAM_CFG_BOOL PadFillCfg
( (
INSETUP, INSETUP,
wxT( "PadFill" ), /* Keyword */ wxT( "PadFill" ), /* Keyword */
(int*)&DisplayOpt.DisplayPadFill, /* Parameter address */ &DisplayOpt.DisplayPadFill, /* Parameter address */
TRUE /* Default value */ TRUE /* Default value */
); );
...@@ -252,7 +252,7 @@ static PARAM_CFG_INT AfficheTexteModuleCfg // Module Texts: fill/line/sketch ...@@ -252,7 +252,7 @@ static PARAM_CFG_INT AfficheTexteModuleCfg // Module Texts: fill/line/sketch
0, 2 /* Min and max values*/ 0, 2 /* Min and max values*/
); );
static PARAM_CFG_INT AfficheTextePcbCfg // PCB Texts: fill/line/sketch static PARAM_CFG_INT AffichePcbTextCfg // PCB Texts: fill/line/sketch
( (
INSETUP, INSETUP,
wxT( "PcbAffT" ), /* Keyword */ wxT( "PcbAffT" ), /* Keyword */
...@@ -268,7 +268,7 @@ static PARAM_CFG_BOOL SegmPcb45Cfg // Force 45 degrees for segments ...@@ -268,7 +268,7 @@ static PARAM_CFG_BOOL SegmPcb45Cfg // Force 45 degrees for segments
TRUE /* Default value */ TRUE /* Default value */
); );
static PARAM_CFG_INT TextePcbDimVCfg static PARAM_CFG_INT PcbTextDimVCfg
( (
wxT( "TxtPcbV" ), /* Keyword */ wxT( "TxtPcbV" ), /* Keyword */
&g_DesignSettings.m_PcbTextSize.y, /* Parameter address */ &g_DesignSettings.m_PcbTextSize.y, /* Parameter address */
...@@ -276,7 +276,7 @@ static PARAM_CFG_INT TextePcbDimVCfg ...@@ -276,7 +276,7 @@ static PARAM_CFG_INT TextePcbDimVCfg
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Min and max values*/ TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Min and max values*/
); );
static PARAM_CFG_INT TextePcbDimHCfg static PARAM_CFG_INT PcbTextDimHCfg
( (
wxT( "TxtPcbH" ), /* Keyword */ wxT( "TxtPcbH" ), /* Keyword */
&g_DesignSettings.m_PcbTextSize.x, /* Parameter address */ &g_DesignSettings.m_PcbTextSize.x, /* Parameter address */
...@@ -823,10 +823,10 @@ PARAM_CFG_BASE* ParamCfgList[] = ...@@ -823,10 +823,10 @@ PARAM_CFG_BASE* ParamCfgList[] =
&PadShowNumCfg, &PadShowNumCfg,
&AfficheContourModuleCfg, &AfficheContourModuleCfg,
&AfficheTexteModuleCfg, &AfficheTexteModuleCfg,
&AfficheTextePcbCfg, &AffichePcbTextCfg,
&SegmPcb45Cfg, &SegmPcb45Cfg,
&TextePcbDimVCfg, &PcbTextDimVCfg,
&TextePcbDimHCfg, &PcbTextDimHCfg,
&ColorLayer0Cfg, &ColorLayer0Cfg,
&ColorLayer1Cfg, &ColorLayer1Cfg,
&ColorLayer2Cfg, &ColorLayer2Cfg,
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "protos.h" #include "protos.h"
// temporary variable used to handle grid visibility:
bool s_showGrid;
#include "set_color.h" // Header file associated with this file #include "set_color.h" // Header file associated with this file
// Local variables: // Local variables:
...@@ -129,6 +132,8 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -129,6 +132,8 @@ void WinEDA_SetColorsFrame::CreateControls()
MainBoxSizer = new wxBoxSizer(wxHORIZONTAL); MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
OuterBoxSizer->Add(MainBoxSizer, 1, wxGROW|wxLEFT|wxRIGHT, 5); OuterBoxSizer->Add(MainBoxSizer, 1, wxGROW|wxLEFT|wxRIGHT, 5);
s_showGrid = m_Parent->m_Draw_Grid;
// 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[]
for( lyr = 0, cln = 0; lyr < NB_BUTT; lyr++ ) for( lyr = 0, cln = 0; lyr < NB_BUTT; lyr++ )
...@@ -470,7 +475,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() ...@@ -470,7 +475,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
} }
} }
// Additional command required for updating visibility of grid. // Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = g_ShowGrid; m_Parent->m_Draw_Grid = s_showGrid;
} }
......
...@@ -16,6 +16,8 @@ class wxFlexGridSizer; ...@@ -16,6 +16,8 @@ class wxFlexGridSizer;
class wxStaticLine; class wxStaticLine;
class wxStdDialogButtonSizer; class wxStdDialogButtonSizer;
// variable used to handle grid visibility:
extern bool s_showGrid;
// Specify how many elements are contained within laytool_list[] // Specify how many elements are contained within laytool_list[]
const int NB_BUTT = 43; const int NB_BUTT = 43;
...@@ -415,7 +417,7 @@ static ColorButton Grid_Butt = ...@@ -415,7 +417,7 @@ static ColorButton Grid_Butt =
-1, -1,
&g_GridColor, // Address of optional parameter &g_GridColor, // Address of optional parameter
FALSE, FALSE,
&g_ShowGrid // Address of boolean display control parameter to toggle &s_showGrid // Address of boolean display control parameter to toggle
}; };
static ColorButton Show_Pads_Noconnect_Butt = static ColorButton Show_Pads_Noconnect_Butt =
......
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