Commit 28f3b198 authored by charras's avatar charras

Pcbnew: Code cleaning about visibility variables in draw functions.

Removed old color and visiblity dialog
work in progress.
See also TODO, P0)
parent 99b3739c
......@@ -4,6 +4,13 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-Jan-27 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++ Pcbnew:
Code cleaning about visibility variables (dulpicates) in draw functions.
Removed old color and visiblity dialog
work in progress
2010-Jan-24 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++ Pcbnew:
......
......@@ -59,9 +59,18 @@ from folks with less than that minimum.
PCBNew
------
P0) JP Charras:
We should need to separate color handling from visibility handling:
Visibilty variables nus be owned by the current board.
(Modedit and Board editor must have separate visibility options:
Modedit should have always all items and layers visibles)
Colors options must be left global
(Modedit and Board editor must have common color options)
P1) Fix the color box which shows which layer is selected, or change tool tip.
It is not tracking layer changes. Look into WinEDA_PcbFrame::syncLayerBox(),
which is probably where fix should go.
>> JP Charras: For me this is now working.
Dick:
P2) Write accessors for all items in PCB_VISIBLE such as grid control, so that
......
......@@ -59,6 +59,12 @@ public:
*/
int GetVisibleLayers() const;
/**
* Function SetVisibleAlls
* Set the bit-mask of all visible elements categories, including layers
*/
void SetVisibleAlls( );
/**
* Function SetVisibleLayers
* changes the bit-mask of visible layers
......
......@@ -300,9 +300,6 @@ public:
* 3 show netnames on tracks and pads
*/
bool Show_Modules_Cmp;
bool Show_Modules_Cu;
int DisplayDrawItems;
bool ContrastModeDisplay;
......
......@@ -54,8 +54,8 @@ public:
bool m_DisplayViaFill; // How show vias
bool m_DisplayPadNum; // show pads numbers
int m_DisplayModEdge; // How show module drawings
int m_DisplayModText; // How show module texts
int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch)
int m_DisplayModText; // How to display module texts (line/ filled / sketch)
bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode,
* TRUE = filled */
int m_UserGridUnits;
......
No preview for this file type
......@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: kicad\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-01-25 21:03+0100\n"
"PO-Revision-Date: 2010-01-25 21:03+0100\n"
"PO-Revision-Date: 2010-01-26 20:02+0100\n"
"Last-Translator: \n"
"Language-Team: kicad team <jean-pierre.charras@ujf-grenoble.fr>\n"
"MIME-Version: 1.0\n"
......@@ -6234,9 +6234,8 @@ msgid "Delete tracks, modules, texts... on board"
msgstr "Effacer pistes, modules, textes... sur le C.I."
#: pcbnew/menubar_pcbframe.cpp:291
#, fuzzy
msgid "&Cleanup Tracks and Vias"
msgstr "Changer Taille Pistes et Vias"
msgstr "&Nettoyer Pistes et Vias"
#: pcbnew/menubar_pcbframe.cpp:292
msgid "Clean stubs, vias, delete break points, or connect dangling tracks to pads and vias"
......
......@@ -142,7 +142,7 @@ set(PCBNEW_SRCS
printout_controler.cpp
queue.cpp
ratsnest.cpp
set_color.cpp
# set_color.cpp
set_grid.cpp
solve.cpp
specctra.cpp
......
......@@ -59,8 +59,8 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
m_DisplayViaFill = true; // How to draw vias
m_DisplayPadNum = true; // show pads number
m_DisplayModEdge = FILLED; // How to show module drawings
m_DisplayModText = FILLED; // How to show module texts
m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
m_DisplayPcbTrackFill = true; /* FALSE = sketch , true = filled */
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_ModuleEditFrame = NULL; // Frame for footprint edition
......@@ -280,8 +280,8 @@ GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ));
guide.SetIgnoreMTextsOnCopper( ! g_DesignSettings.IsElementVisible( MOD_TEXT_BK_VISIBLE ));
guide.SetIgnoreMTextsOnCmp( ! g_DesignSettings.IsElementVisible( MOD_TEXT_FR_VISIBLE ));
guide.SetIgnoreModulesOnCu( !DisplayOpt.Show_Modules_Cu );
guide.SetIgnoreModulesOnCmp( !DisplayOpt.Show_Modules_Cmp );
guide.SetIgnoreModulesOnCu( !g_DesignSettings.IsElementVisible( MOD_BK_VISIBLE ) );
guide.SetIgnoreModulesOnCmp( !g_DesignSettings.IsElementVisible( MOD_FR_VISIBLE ) );
return guide;
}
......
......@@ -409,13 +409,6 @@ bool BOARD::IsElementVisible( int aPCB_VISIBLE ) const
myframe->m_Draw_Grid = isEnabled;
break;
*/
case MOD_FR_VISIBLE:
return DisplayOpt.Show_Modules_Cmp;
case MOD_BK_VISIBLE:
return DisplayOpt.Show_Modules_Cu;
default:
return m_BoardSettings->IsElementVisible( aPCB_VISIBLE );
}
......@@ -432,15 +425,6 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
break;
*/
// @todo move these special cases into default, by moving globals into the board.
case MOD_FR_VISIBLE:
DisplayOpt.Show_Modules_Cmp = isEnabled;
break;
case MOD_BK_VISIBLE:
DisplayOpt.Show_Modules_Cu = isEnabled;
break;
default:
m_BoardSettings->SetElementVisibility( aPCB_VISIBLE, isEnabled );
}
......
......@@ -37,8 +37,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust this.
m_VisibleLayers = 0xffffffff; // All layers visible at first.
m_VisibleElements = 0x00000fff; // All elements visible at first. TODO: Use a macro for the initial value.
SetVisibleAlls( ); // All layers and all elements visible at first.
SetCopperLayerCount( 2 ); // Default design is a double sided board
......@@ -83,6 +82,17 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const
}
/**
* Function SetVisibleAlls
* Set the bit-mask of all visible elements categories,
* including enabled layers
*/
void EDA_BoardDesignSettings::SetVisibleAlls( )
{
SetVisibleLayers( FULL_LAYERS );
m_VisibleElements = 0xFFFFFFFF;
}
void EDA_BoardDesignSettings::SetVisibleLayers( int aMask )
{
// Although Pcbnew uses only 29, Gerbview uses all 32 layers
......
......@@ -469,7 +469,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
GRSetDrawMode( DC, draw_mode );
/* Draw "No connect" ( / or \ or cross X ) if necessary. : */
if( m_Netname.IsEmpty() && DisplayOpt.DisplayPadNoConn )
if( m_Netname.IsEmpty() && g_DesignSettings.IsElementVisible( PCB_VISIBLE(NO_CONNECTS_VISIBLE) ) )
{
dx0 = MIN( dx0, dy0 );
int nc_color = BLUE;
......
......@@ -164,9 +164,6 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS()
* 1 show netnames on pads
* 2 show netnames on tracks
* 3 show netnames on tracks and pads */
Show_Modules_Cmp = true;
Show_Modules_Cu = true;
DisplayDrawItems = true;
ContrastModeDisplay = false;
}
......@@ -270,6 +270,12 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
m_show_layer_manager_tools = m_OptionsToolBar->GetToolState( id );
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update();
if( m_show_layer_manager_tools )
GetMenuBar()->SetLabel(ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_("Hide &Layers Manager" ) );
else
GetMenuBar()->SetLabel(ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_("Show &Layers Manager" ) );
#endif
break;
......
......@@ -245,11 +245,11 @@ this file again."));
/* Rebuild the new pad list (for drc and ratsnet control ...) */
GetBoard()->m_Status_Pcb = 0;
/* Reset the layers visibility flag when loading a new config
/* Reset the layers and items visibility flag when loading a new config
* Because it could creates SERIOUS mistakes for the user,
* if some layers are not visible after loading a board...
* if some enabled layers or items are not visible after loading a board...
*/
GetBoard()->SetVisibleLayers( GetBoard()->GetEnabledLayers() );
GetBoard()->m_BoardSettings->SetVisibleAlls( );
// Update info shown by the horizontal toolbars
GetBoard()->SetCurrentNetClass( NETCLASS::Default );
......
......@@ -199,30 +199,6 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum )
continue;
}
if( stricmp( data, "VisibleLayers" ) == 0 )
{
int VisibleLayers = 0;
data = strtok( NULL, " =\n\r" );
sscanf( data, "%X", &VisibleLayers );
// Setup layer visibility
GetBoard()->SetVisibleLayers( VisibleLayers );
continue;
}
if( stricmp( data, "VisibleElements" ) == 0 )
{
int VisibleElements = 0;
data = strtok( NULL, " =\n\r" );
sscanf( data, "%X", &VisibleElements );
// Setup elements visibility
GetBoard()->SetVisibleElements( VisibleElements );
continue;
}
if( strncmp( data, "Ly", 2 ) == 0 ) // Old format for Layer count
{
int Masque_Layer = 1, ii;
......@@ -741,8 +717,6 @@ bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File )
"Ly %8X\n",
g_TabAllCopperLayerMask[NbLayers - 1] | ALL_NO_CU_LAYERS );
fprintf( File, "EnabledLayers %08X\n", GetBoard()->GetEnabledLayers() );
fprintf( File, "VisibleLayers %08X\n", GetBoard()->GetVisibleLayers() );
fprintf( File, "VisibleElements %08X\n", GetBoard()->GetVisibleElements() );
fprintf( File, "Links %d\n", GetBoard()->GetRatsnestsCount() );
fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect );
......
......@@ -391,10 +391,12 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item->SetBitmap( library_xpm );
configmenu->Append( item );
/* Colors and Visibility */
item = new wxMenuItem( configmenu, ID_COLORS_SETUP,
_( "&Colors and Visibility" ),
_( "Select colors and visibility of layers and some items" ) );
/* Colors and Visibility are handled by the layers manager toolbar
* that can be shown or hidden
*/
item = new wxMenuItem( configmenu, ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_( "Hide &Layers Manager" ),
_( "Show/hide the layers manager toolbar" ) );
item->SetBitmap( palette_xpm );
configmenu->Append( item );
......
......@@ -364,11 +364,6 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
RATSNEST_VISIBLE,
GRID_VISIBLE, ? maybe not this one
NO_CONNECTS_VISIBLE,
MOD_FR_VISIBLE,
MOD_BK_VISIBLE,
into m_VisibleElements and get rid of globals.
2) Add IsElementVisible() & SetVisibleElement() to class BOARD
......@@ -456,7 +451,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
ID_CONFIG_AND_PREFERENCES_END,
WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_LAYERS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_MASK_CLEARANCE, WinEDA_PcbFrame::Process_Config )
......
......@@ -7,6 +7,7 @@
#include "pcbstruct.h"
#include "macros.h"
#include "pcbcommon.h"
#include "class_board_design_settings.h"
#define U_PCB (PCB_INTERNAL_UNIT / EESCHEMA_INTERNAL_UNIT)
......@@ -71,10 +72,10 @@ extern const wxString g_FootprintLibFileWildcard; // Wildcard for footprint li
bool inline IsModuleLayerVisible( int layer )
{
if( layer==LAYER_N_FRONT )
return DisplayOpt.Show_Modules_Cmp;
return g_DesignSettings.IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) );
else if( layer==LAYER_N_BACK )
return DisplayOpt.Show_Modules_Cu;
return g_DesignSettings.IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) );
else
return true;
......
......@@ -38,8 +38,16 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
switch( id )
{
case ID_COLORS_SETUP:
DisplayColorSetupFrame( this, pos );
case ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG:
if( m_OptionsToolBar )
{ //This command is same as the Options Vertical Toolbar
// tool Show/hide layers manager
bool state = m_OptionsToolBar->GetToolState(ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR);
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, !state);
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED,
ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR );
wxPostEvent( this, event );
}
break;
case ID_PCB_LAYERS_SETUP:
......@@ -185,21 +193,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
* Because it could creates SERIOUS mistakes for the user,
* if some items are not visible after loading a board...
*/
g_DesignSettings.SetVisibleLayers( FULL_LAYERS );
DisplayOpt.Show_Modules_Cmp = true;
DisplayOpt.Show_Modules_Cu = true;
g_DesignSettings.SetElementVisibility( MOD_TEXT_INVISIBLE, true );
g_DesignSettings.SetElementVisibility( MOD_TEXT_FR_VISIBLE, true );
g_DesignSettings.SetElementVisibility( MOD_TEXT_BK_VISIBLE, true );
g_DesignSettings.SetElementVisibility( PAD_BK_VISIBLE, true );
g_DesignSettings.SetElementVisibility( PAD_BK_VISIBLE, true );
g_DesignSettings.SetElementVisibility( VIA_THROUGH_VISIBLE, true );
g_DesignSettings.SetElementVisibility( VIA_BBLIND_VISIBLE, true );
g_DesignSettings.SetElementVisibility( VIA_MICROVIA_VISIBLE, true );
// Items that can remain not visible: comment them if you want.
g_DesignSettings.SetElementVisibility( ANCHOR_VISIBLE, true );
g_DesignSettings.SetVisibleAlls( );
DisplayOpt.DisplayPadNoConn = true;
return TRUE;
......
......@@ -230,6 +230,7 @@ enum pcbnew_ids
ID_PCB_USER_GRID_SETUP,
ID_PCB_GEN_BOM_FILE_FROM_BOARD,
ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
......
......@@ -390,13 +390,6 @@ void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC ); /* for Debugging */
MODULE* ListAndSelectModuleName( COMMAND* Cmd );
/*****************/
/* SET_COLOR.CPP */
/*****************/
void DisplayColorSetupFrame( WinEDA_PcbFrame* parent,
const wxPoint& framepos );
/***************************/
/* DIALOG_LAYERS_SETUP.CPP */
/***************************/
......
......@@ -151,14 +151,14 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
if( module->m_Flags & IS_MOVED )
continue;
if( !DisplayOpt.Show_Modules_Cmp )
if( !g_DesignSettings.IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) ) )
{
if( module->GetLayer() == LAYER_N_FRONT )
display = FALSE;
layerMask &= ~LAYER_FRONT;
}
if( !DisplayOpt.Show_Modules_Cu )
if( !g_DesignSettings.IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) ) )
{
if( module->GetLayer() == LAYER_N_BACK )
display = FALSE;
......
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