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 )
void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,
int aDrawMode,
GRFillMode aDisplayMode, EDA_Colors aAnchor_color )
GRFillMode aFillMode, EDA_Colors aAnchor_color )
/***************************************************************/
/** Function Draw
......@@ -338,7 +338,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color
* @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 ).
*/
......@@ -360,7 +360,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
aOffset,
aColor,
aDrawMode,
aDisplayMode,
aFillMode,
aAnchor_color,
txt,
pos );
......@@ -375,7 +375,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
aOffset,
aColor,
aDrawMode,
aDisplayMode,
aFillMode,
aAnchor_color,
m_Text,
m_Pos );
......@@ -390,7 +390,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color
* @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 aText = the single line of text to draw.
* @param EDA_Colors aPos = the position of this line ).
......@@ -398,12 +398,12 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,
int aDrawMode,
GRFillMode aDisplayMode, EDA_Colors aAnchor_color,
GRFillMode aFillMode, EDA_Colors aAnchor_color,
wxString& aText, wxPoint aPos )
{
int width = m_Width;
if( aDisplayMode == FILAIRE )
if( aFillMode == FILAIRE )
width = 0;
if( aDrawMode != -1 )
......@@ -425,7 +425,7 @@ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
cX, cY + anchor_size, 0, aAnchor_color );
}
if( aDisplayMode == SKETCH )
if( aFillMode == SKETCH )
width = -width;
wxSize size = m_Size;
......
......@@ -69,7 +69,6 @@ wxArrayString g_LibName_List; // library list to load
BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Linked list of deleted items
int g_UnDeleteStackPtr;
bool g_ShowGrid = true;
DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */
......
......@@ -36,7 +36,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id )
{
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 );
break;
......
......@@ -19,6 +19,9 @@
#include "protos.h"
// variable used to handle grid visibility:
bool s_showGrid;
#include "set_color.h" // Header file associated with this file
// Local variables:
......@@ -132,6 +135,7 @@ 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;
for( lyr = 0, cln = 0; lyr < NB_BUTT; lyr++ )
{
// Look for the first set of controls within each column.
......@@ -441,8 +445,8 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
*laytool_list[lyr]->m_NoDisplay = laytool_list[lyr]->m_CheckBox->GetValue();
}
}
// Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = g_ShowGrid;
// Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = s_showGrid;
}
......
......@@ -324,7 +324,7 @@ static ColorButton Grid_Butt=
_("Grid"), // Title
&g_GridColor, // Address of optional parameter
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=
......
......@@ -513,13 +513,13 @@ public:
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
* @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 EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
*/
void Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,
int aDisplayMode, GRFillMode aDisplay_mode = FILAIRE,
int aDrawMode, GRFillMode aDisplay_mode = FILAIRE,
EDA_Colors aAnchor_color = UNSPECIFIED_COLOR );
private:
......@@ -531,14 +531,14 @@ private:
* @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color
* @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 aText = the single line of text to draw.
* @param EDA_Colors aPos = the position of this line ).
*/
void DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,
int aDisplayMode, GRFillMode aDisplay_mode,
int aDrawMode, GRFillMode aFillMode,
EDA_Colors aAnchor_color, wxString& aText,
wxPoint aPos );
public:
......
......@@ -23,7 +23,6 @@ extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern wxArrayString g_LibName_List; // library list to load
extern bool g_ShowGrid;
extern BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE];
extern int g_UnDeleteStackPtr;
extern DISPLAY_OPTIONS DisplayOpt;
......
......@@ -320,7 +320,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = g_ShowGrid = m_OptionsToolBar->GetToolState( id );
m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( );
break;
......
......@@ -182,7 +182,7 @@ file extension to a Kicad project file extension (.pro)." ),
/* User library path takes precedent over default library search paths. */
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_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize;
......@@ -192,6 +192,26 @@ file extension to a Kicad project file extension (.pro)." ),
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;
}
......
......@@ -210,11 +210,11 @@ static PARAM_CFG_BOOL TrackAfficheGardeCfg
FALSE /* Default value */
);
static PARAM_CFG_INT PadFillCfg
static PARAM_CFG_BOOL PadFillCfg
(
INSETUP,
wxT( "PadFill" ), /* Keyword */
(int*)&DisplayOpt.DisplayPadFill, /* Parameter address */
&DisplayOpt.DisplayPadFill, /* Parameter address */
TRUE /* Default value */
);
......@@ -252,7 +252,7 @@ static PARAM_CFG_INT AfficheTexteModuleCfg // Module Texts: fill/line/sketch
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,
wxT( "PcbAffT" ), /* Keyword */
......@@ -268,7 +268,7 @@ static PARAM_CFG_BOOL SegmPcb45Cfg // Force 45 degrees for segments
TRUE /* Default value */
);
static PARAM_CFG_INT TextePcbDimVCfg
static PARAM_CFG_INT PcbTextDimVCfg
(
wxT( "TxtPcbV" ), /* Keyword */
&g_DesignSettings.m_PcbTextSize.y, /* Parameter address */
......@@ -276,7 +276,7 @@ static PARAM_CFG_INT TextePcbDimVCfg
TEXTS_MIN_SIZE, TEXTS_MAX_SIZE /* Min and max values*/
);
static PARAM_CFG_INT TextePcbDimHCfg
static PARAM_CFG_INT PcbTextDimHCfg
(
wxT( "TxtPcbH" ), /* Keyword */
&g_DesignSettings.m_PcbTextSize.x, /* Parameter address */
......@@ -823,10 +823,10 @@ PARAM_CFG_BASE* ParamCfgList[] =
&PadShowNumCfg,
&AfficheContourModuleCfg,
&AfficheTexteModuleCfg,
&AfficheTextePcbCfg,
&AffichePcbTextCfg,
&SegmPcb45Cfg,
&TextePcbDimVCfg,
&TextePcbDimHCfg,
&PcbTextDimVCfg,
&PcbTextDimHCfg,
&ColorLayer0Cfg,
&ColorLayer1Cfg,
&ColorLayer2Cfg,
......
......@@ -17,6 +17,9 @@
#include "pcbnew.h"
#include "protos.h"
// temporary variable used to handle grid visibility:
bool s_showGrid;
#include "set_color.h" // Header file associated with this file
// Local variables:
......@@ -129,6 +132,8 @@ void WinEDA_SetColorsFrame::CreateControls()
MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
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
// details of each element contained within laytool_list[]
for( lyr = 0, cln = 0; lyr < NB_BUTT; lyr++ )
......@@ -470,7 +475,7 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
}
}
// 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;
class wxStaticLine;
class wxStdDialogButtonSizer;
// variable used to handle grid visibility:
extern bool s_showGrid;
// Specify how many elements are contained within laytool_list[]
const int NB_BUTT = 43;
......@@ -415,7 +417,7 @@ static ColorButton Grid_Butt =
-1,
&g_GridColor, // Address of optional parameter
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 =
......
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