Use layer_widget in Gerbview

Added sample gerber files for test (gerbview has problem with 2 files)
This commit is contained in:
charras 2010-02-03 14:05:17 +00:00
parent 9a6f753cac
commit 98ba50f80e
33 changed files with 4013 additions and 964 deletions

View File

@ -18,6 +18,7 @@ endif(APPLE)
set(GERBVIEW_SRCS
block.cpp
class_gerbview_layer_widget.cpp
controle.cpp
dcode.cpp
deltrack.cpp
@ -50,6 +51,7 @@ set(GERBVIEW_SRCS
set(GERBVIEW_EXTRA_SRCS
../share/setpage.cpp
../pcbnew/layer_widget.cpp
../pcbnew/printout_controler.cpp
)

View File

@ -0,0 +1,246 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*********************************************************/
/* class_gerbview_layer_widget.cpp - gerbview layers manager. */
/*********************************************************/
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "pcbstruct.h"
#include "gerbview.h"
#include "wxGerberFrame.h"
#include "layer_widget.h"
#include "class_gerbview_layer_widget.h"
/**
* Class GERBER_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they
* may be tied into the WinEDA_GerberFrame's data and so we can add a popup
* menu which is specific to PCBNEW's needs.
*/
GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( WinEDA_GerberFrame* aParent, wxWindow* aFocusOwner, int aPointSize ) :
LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
myframe( aParent )
{
BOARD* board = myframe->GetBoard();
// Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color
// is changed before appending to the LAYER_WIDGET. This is an automatic variable
// not a static variable, change the color & state after copying from code to renderRows
// on the stack.
LAYER_WIDGET::ROW renderRows[2] = {
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
// text id color tooltip checked
RR( _( "Grid" ), GERBER_GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ),
RR( _( "DCodes" ), DCODES_VISIBLE, WHITE, _( "Show DCodes identification" ) ),
};
for( unsigned row=0; row<DIM(renderRows); ++row )
{
if( renderRows[row].color != -1 ) // does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRows[row].color = board->GetVisibleElementColor( renderRows[row].id );
}
renderRows[row].state = board->IsElementVisible( renderRows[row].id );
}
AppendRenderRows( renderRows, DIM(renderRows) );
//-----<Popup menu>-------------------------------------------------
// handle the popup menu over the layer window.
m_LayerScrolledWindow->Connect( wxEVT_RIGHT_DOWN,
wxMouseEventHandler( GERBER_LAYER_WIDGET::onRightDownLayers ), NULL, this );
// since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
// and not m_LayerScrolledWindow->Connect()
Connect( ID_SHOW_ALL_COPPERS, ID_SHOW_NO_COPPERS, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( GERBER_LAYER_WIDGET::onPopupSelection ), NULL, this );
// install the right click handler into each control at end of ReFill()
// using installRightLayerClickHandler
}
void GERBER_LAYER_WIDGET::installRightLayerClickHandler()
{
int rowCount = GetLayerRowCount();
for( int row=0; row<rowCount; ++row )
{
for( int col=0; col<LYR_COLUMN_COUNT; ++col )
{
wxWindow* w = getLayerComp( row, col );
w->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler(
GERBER_LAYER_WIDGET::onRightDownLayers ), NULL, this );
}
}
}
void GERBER_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
{
wxMenu menu;
// menu text is capitalized:
// http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS,
_("Show All Layers") ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS,
_( "Hide All Layers" ) ) );
PopupMenu( &menu );
passOnFocus();
}
void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
{
int rowCount;
int menuId = event.GetId();
bool visible;
switch( menuId )
{
case ID_SHOW_ALL_COPPERS:
visible = true;
goto L_change_coppers;
case ID_SHOW_NO_COPPERS:
visible = false;
L_change_coppers:
int lastCu = -1;
rowCount = GetLayerRowCount();
for( int row=rowCount-1; row>=0; --row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
int layer = getDecodedId( cb->GetId() );
if( IsValidCopperLayerIndex( layer ) )
{
lastCu = row;
break;
}
}
for( int row=0; row<rowCount; ++row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
int layer = getDecodedId( cb->GetId() );
if( IsValidCopperLayerIndex( layer ) )
{
cb->SetValue( visible );
bool isLastCopperLayer = (row==lastCu);
OnLayerVisible( layer, visible, isLastCopperLayer );
if( isLastCopperLayer )
break;
}
}
break;
}
}
void GERBER_LAYER_WIDGET::ReFill()
{
BOARD* brd = myframe->GetBoard();
int layer;
ClearLayerRows();
for( layer = 0; layer < LAYER_COUNT; layer++ )
{
wxString msg;
msg.Printf( _("Layer %d"), layer+1 );
AppendLayerRow( LAYER_WIDGET::ROW( msg, layer, brd->GetLayerColor( layer ), wxEmptyString, true ) );
}
installRightLayerClickHandler();
}
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor )
{
myframe->GetBoard()->SetLayerColor( aLayer, aColor );
myframe->DrawPanel->Refresh();
}
bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
{
// the layer change from the GERBER_LAYER_WIDGET can be denied by returning
// false from this function.
// myframe->setActiveLayer( aLayer, false );
// myframe->syncLayerBox();
if(DisplayOpt.ContrastModeDisplay)
myframe->DrawPanel->Refresh();
return true;
}
void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
int visibleLayers = brd->GetVisibleLayers();
if( isVisible )
visibleLayers |= (1 << aLayer);
else
visibleLayers &= ~(1 << aLayer);
brd->SetVisibleLayers( visibleLayers );
if( isFinal )
myframe->DrawPanel->Refresh();
}
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, int aColor )
{
myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
myframe->DrawPanel->Refresh();
}
void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
BOARD* brd = myframe->GetBoard();
brd->SetElementVisibility( aId, isEnabled );
myframe->DrawPanel->Refresh();
}
//-----</LAYER_WIDGET callbacks>------------------------------------------

View File

@ -0,0 +1,83 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/************************************************************/
/* class_gerber_layer_widget.h : header for the layers manager */
/************************************************************/
#ifndef _CLASS_GERBER_LAYER_WIDGET_H_
#define _CLASS_GERBER_LAYER_WIDGET_H_
#include "layer_widget.h"
/**
* Class GERBER_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they
* may be tied into the WinEDA_GerberFrame's data and so we can add a popup
* menu which is specific to PCBNEW's needs.
*/
class GERBER_LAYER_WIDGET : public LAYER_WIDGET
{
WinEDA_GerberFrame* myframe;
// popup menu ids.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1)
/**
* Function OnRightDownLayers
* puts up a popup menu for the layer panel.
*/
void onRightDownLayers( wxMouseEvent& event );
void onPopupSelection( wxCommandEvent& event );
/// this is for the popup menu, the right click handler has to be installed
/// on every child control within the layer panel.
void installRightLayerClickHandler();
public:
/**
* Constructor
* @param aPointSize is the font point size to use within the widget. This
* effectively sets the overal size of the widget via the row height and bitmap
* button sizes.
*/
GERBER_LAYER_WIDGET( WinEDA_GerberFrame* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
void ReFill();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, int aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, int aColor );
void OnRenderEnable( int aId, bool isEnabled );
//-----</implement LAYER_WIDGET abstract callback functions>----------
};
#endif // _CLASS_GERBER_LAYER_WIDGET_H_

View File

@ -49,7 +49,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_PCB_DELETE_ITEM_BUTT:
case ID_GERBVIEW_DELETE_ITEM_BUTT:
DrawStruct = GerberGeneralLocateAndDisplay();
if( DrawStruct == NULL )
break;
@ -126,7 +126,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
Files_io( event );
break;
case ID_PCB_GLOBAL_DELETE:
case ID_GERBVIEW_GLOBAL_DELETE:
Erase_Current_Layer( TRUE );
break;
@ -152,20 +152,11 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_CANCEL_CURRENT_COMMAND:
break;
case ID_POPUP_PCB_DELETE_TRACKSEG:
DrawPanel->MouseToCursorSchema();
if( GetScreen()->GetCurItem() == NULL )
break;
Delete_Segment( &dc, (TRACK*) GetScreen()->GetCurItem() );
GetScreen()->SetCurItem( NULL );
GetScreen()->SetModify();
break;
case ID_PCB_DELETE_ITEM_BUTT:
case ID_GERBVIEW_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, wxT( "Delete item" ) );
break;
case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_TOOLBARH_GERBVIEW_SELECT_LAYER:
GetScreen()->m_Active_Layer = m_SelLayerBox->GetChoice();
DrawPanel->Refresh( TRUE );
break;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -57,9 +57,9 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
ID_CONFIG_AND_PREFERENCES_END,
WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_COLORS_SETUP, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_GerberFrame::InstallGerberGeneralOptionsFrame )
EVT_MENU( ID_PCB_DISPLAY_OPTIONS_SETUP, WinEDA_GerberFrame::InstallGerberDisplayOptionsDialog )
EVT_MENU( ID_GERBVIEW_DISPLAY_OPTIONS_SETUP, WinEDA_GerberFrame::InstallGerberDisplayOptionsDialog )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage )
@ -74,7 +74,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
// menu Miscellaneous
EVT_MENU( ID_PCB_GLOBAL_DELETE,
EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE,
WinEDA_GerberFrame::Process_Special_Functions )
// Menu Help
@ -88,7 +88,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_TOOL( wxID_UNDO, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_GerberFrame::ToPrinter )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBER_SELECT_TOOL,
@ -96,7 +96,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
// Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT,
EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
@ -109,6 +109,8 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
// Option toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
WinEDA_GerberFrame::OnSelectOptionToolbar )
END_EVENT_TABLE()
@ -120,6 +122,7 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
WinEDA_BasePcbFrame( father, GERBER_FRAME, title, pos, size, style )
{
m_FrameName = wxT( "GerberFrame" );
m_show_layer_manager_tools = true;
m_Draw_Axis = true; // true to show X and Y axis on screen
m_Draw_Sheet_Ref = FALSE; // TRUE for reference drawings.
@ -136,8 +139,20 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
SetBaseScreen( ScreenPcb );
ActiveScreen = ScreenPcb;
LoadSettings();
SetBoard( new BOARD( NULL, this ) );
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
// Create the PCB_LAYER_WIDGET *after* SetBoard():
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int pointSize = font.GetPointSize();
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
if( screenHeight <= 900 )
pointSize = (pointSize * 8) / 10;
m_LayersManager = new GERBER_LAYER_WIDGET( this, DrawPanel, pointSize );
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
// initialize parameters in m_LayersManager
LoadSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
@ -146,7 +161,6 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
ReCreateVToolbar();
ReCreateOptToolbar();
#if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
@ -162,13 +176,23 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
// LAYER_WIDGET is floatable, but initially docked at far right
wxAuiPaneInfo lyrs;
lyrs.MinSize( m_LayersManager->GetBestSize() ); // updated in ReFillLayerWidget
lyrs.BestSize( m_LayersManager->GetBestSize() );
lyrs.CloseButton( false );
lyrs.Caption( _( "Visibles" ) );
lyrs.IsFloatable();
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
if( m_VToolBar )
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Row( 1 ) );
m_auimgr.AddPane( m_LayersManager, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Row( 0 ) );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar,
@ -183,7 +207,8 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
ReFillLayerWidget(); // this is near end because contents establish size
}
@ -197,34 +222,6 @@ WinEDA_GerberFrame::~WinEDA_GerberFrame()
void WinEDA_GerberFrame::OnCloseWindow( wxCloseEvent& Event )
{
PCB_SCREEN* screen = ScreenPcb;
#if 0 // unused currently
while( screen )
{
if( screen->IsModify() )
break;
screen = screen->Next();
}
if( screen )
{
if( !IsOK( this, _( "Layer modified, Continue ?" ) ) )
{
Event.Veto();
return;
}
}
#endif
while( screen ) // Modify delete flag to prevent further message.
{
screen->ClrModify();
screen = screen->Next();
}
SetBaseScreen( ActiveScreen = ScreenPcb );
SaveSettings();
Destroy();
}
@ -307,15 +304,23 @@ void WinEDA_GerberFrame::SetToolbars()
g_DisplayPolygonsModeSketch == 0 ? 0 : 1 );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_DCODES,
DisplayOpt.DisplayPadNum );
}
IsElementVisible( DCODES_VISIBLE) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
m_show_layer_manager_tools );
if( m_show_layer_manager_tools )
GetMenuBar()->SetLabel(ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_("Hide &Layers Manager" ) );
else
GetMenuBar()->SetLabel(ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_("Show &Layers Manager" ) );
}
DisplayUnitsMsg();
#if defined(KICAD_AUIMANAGER)
if( m_auimgr.GetManagedWindow() )
m_auimgr.Update();
#endif
}
@ -356,6 +361,10 @@ void WinEDA_GerberFrame::LoadSettings()
{
m_Draw_Sheet_Ref = true;
}
long tmp;
config->Read( GerbviewShowDCodes, &tmp, 1);
SetElementVisibility( DCODES_VISIBLE, tmp);
}
/**************************************/
@ -384,4 +393,71 @@ void WinEDA_GerberFrame::SaveSettings()
}
}
config->Write( GerbviewShowPageSizeOption, pageSize_opt );
config->Write( GerbviewShowDCodes, IsElementVisible( DCODES_VISIBLE) );
}
void WinEDA_GerberFrame::ReFillLayerWidget()
{
m_LayersManager->ReFill();
wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
wxSize bestz = m_LayersManager->GetBestSize();
lyrs.MinSize( bestz );
lyrs.BestSize( bestz );
lyrs.FloatingSize( bestz );
if( lyrs.IsDocked() )
m_auimgr.Update();
else
m_LayersManager->SetSize( bestz );
}
/** Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
bool WinEDA_GerberFrame::IsGridVisible()
{
return IsElementVisible(GERBER_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_GerberFrame::SetGridVisibility(bool aVisible)
{
SetElementVisibility(GERBER_GRID_VISIBLE, aVisible);
}
/** Function GetGridColor() , virtual
* @return the color of the grid
*/
int WinEDA_GerberFrame::GetGridColor()
{
return GetBoard()->GetVisibleElementColor( GERBER_GRID_VISIBLE );
}
/** Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
void WinEDA_GerberFrame::SetGridColor(int aColor)
{
GetBoard()->SetVisibleElementColor( GERBER_GRID_VISIBLE, aColor );
}
/**
* Function SetElementVisibility
* changes the visibility of an element category
* @param aGERBER_VISIBLE is from the enum by the same name
* @param aNewState = The new visibility state of the element category
* @see enum aGERBER_VISIBLE
*/
void WinEDA_GerberFrame::SetElementVisibility( int aGERBER_VISIBLE, bool aNewState )
{
GetBoard()->SetElementVisibility( aGERBER_VISIBLE, aNewState );
m_LayersManager->SetRenderState( aGERBER_VISIBLE, aNewState );
}

View File

@ -41,6 +41,7 @@ const wxString GerbviewProjectFileWildcard( _( "GerbView project files (.cnf)|*.
// Config keywords
const wxString GerbviewShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
extern const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) );
GERBER* g_GERBER_List[32];
@ -105,9 +106,6 @@ bool WinEDA_App::OnInit()
/* Gerbview mainframe title */
frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() );
frame->SetBoard( new BOARD( NULL, frame ) );
frame->GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
// Initialize some display options
DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning

View File

@ -29,11 +29,11 @@ typedef enum
* Enum ITEM_VISIBLE
* is a set of visible PCB elements.
*/
enum ITEM_VISIBLE
enum GERBER_VISIBLE
{
DCODES_VISIBLE,
END_ITEM_VISIBLE_LIST // sentinel
DCODES_VISIBLE = 1, // visible item id cannot be 0 because this id is used as wxWidget id
GERBER_GRID_VISIBLE,
END_GERBER_VISIBLE_LIST // sentinel
};
extern wxString g_PhotoFilenameExt;
@ -52,6 +52,7 @@ extern Ki_PageDescr* g_GerberPageSizeList[];
// Config keywords
extern const wxString GerbviewShowPageSizeOption;
extern const wxString GerbviewShowDCodes;
/**
* Enum APERTURE_T

View File

@ -33,10 +33,6 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
switch( id )
{
case ID_COLORS_SETUP:
DisplayColorSetupFrame( this, pos );
break;
case ID_CONFIG_REQ:
{
InstallConfigFrame( pos );

View File

@ -73,14 +73,6 @@ static PARAM_CFG_INT ViaFillCfg
TRUE
);
static PARAM_CFG_BOOL PadShowNumCfg // Show DCodes
(
INSETUP,
wxT("PadSNum"),
&DisplayOpt.DisplayPadNum,
TRUE
);
static PARAM_CFG_SETCOLOR ColorLayer0Cfg
(
INSETUP,
@ -379,7 +371,6 @@ PARAM_CFG_BASE * ParamCfgList[] =
& SegmFillCfg,
& PadFillCfg,
& ViaFillCfg, //TODO: Will adding this line break tha pcbnew file compatibility?
& PadShowNumCfg,
& ColorLayer0Cfg,
& ColorLayer1Cfg,
& ColorLayer2Cfg,

View File

@ -19,11 +19,11 @@
class DIALOG_DISPLAY_OPTIONS : public DIALOG_DISPLAY_OPTIONS_BASE
{
private:
WinEDA_BasePcbFrame* m_Parent;
WinEDA_GerberFrame* m_Parent;
public:
DIALOG_DISPLAY_OPTIONS( WinEDA_BasePcbFrame* parent );
DIALOG_DISPLAY_OPTIONS( WinEDA_GerberFrame* parent );
~DIALOG_DISPLAY_OPTIONS() {};
private:
@ -40,7 +40,7 @@ void WinEDA_GerberFrame::InstallGerberDisplayOptionsDialog( wxCommandEvent& even
DrawPanel->Refresh();
}
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( WinEDA_BasePcbFrame *parent) :
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( WinEDA_GerberFrame *parent) :
DIALOG_DISPLAY_OPTIONS_BASE( parent, wxID_ANY )
{
m_Parent = parent;
@ -76,7 +76,7 @@ DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( WinEDA_BasePcbFrame *parent) :
}
}
m_OptDisplayDCodes->SetValue( DisplayOpt.DisplayPadNum );
m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
@ -113,7 +113,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
else
g_DisplayPolygonsModeSketch = 0;
DisplayOpt.DisplayPadNum = m_OptDisplayDCodes->GetValue();
m_Parent->SetElementVisibility( DCODES_VISIBLE, m_OptDisplayDCodes->GetValue() );
m_Parent->m_DisplayPadFill = m_Parent->m_DisplayViaFill =
DisplayOpt.DisplayViaFill;

View File

@ -15,11 +15,17 @@ enum gerbview_ids
{
ID_MAIN_MENUBAR = ID_END_LIST,
ID_TOOLBARH_PCB_SELECT_LAYER,
ID_PCB_DELETE_ITEM_BUTT,
ID_PCB_GLOBAL_DELETE,
ID_POPUP_PCB_DELETE_TRACKSEG,
ID_PCB_DISPLAY_OPTIONS_SETUP
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
ID_GERBVIEW_DELETE_ITEM_BUTT,
ID_GERBVIEW_GLOBAL_DELETE,
ID_POPUP_GERBVIEW_DELETE_TRACKSEG,
ID_GERBVIEW_DISPLAY_OPTIONS_SETUP,
ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
ID_TB_OPTIONS_SHOW_DCODES,
ID_GERBER_END_LIST
};
#endif /* __GERBVIEW_IDS_H__ */

View File

@ -80,10 +80,6 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos,
switch( DrawStruct->Type() )
{
case TYPE_TRACK:
// PopMenu->AppendSeparator();
// PopMenu->Append(ID_POPUP_PCB_EDIT_TRACK, _("Edit"));
// PopMenu->Append(ID_POPUP_PCB_DELETE_TRACKSEG, _("Delete"));
break;

View File

@ -16,7 +16,7 @@
#include "gerbview.h"
#include "protos.h"
#include <wx/spinctrl.h>
#include "gerbview_id.h"
/** Function OnSelectOptionToolbar
@ -25,11 +25,24 @@
void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
bool state;
switch( id )
{
case ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG:
state = ! m_show_layer_manager_tools;
id = ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR;
break;
default:
state = m_OptionsToolBar->GetToolState( id );
break;
}
switch( id )
{
case ID_TB_OPTIONS_SHOW_GRID:
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
SetGridVisibility( state );
DrawPanel->Refresh( TRUE );
break;
@ -45,17 +58,17 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message( wxEmptyString );
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
DisplayOpt.DisplayPolarCood = state;
UpdateStatusBar();
break;
case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = m_OptionsToolBar->GetToolState( id );
m_CursorShape = state;
DrawPanel->Refresh( TRUE );
break;
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
if( m_OptionsToolBar->GetToolState( id ) )
if( state )
{
DisplayOpt.DisplayPadFill = m_DisplayPadFill = false;
}
@ -67,7 +80,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
if( m_OptionsToolBar->GetToolState( id ) )
if( state )
{
DisplayOpt.DisplayViaFill = m_DisplayViaFill = false;
}
@ -79,7 +92,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
if( m_OptionsToolBar->GetToolState( id ) )
if(state )
{
m_DisplayPcbTrackFill = FALSE;
DisplayOpt.DisplayPcbTrackFill = FALSE;
@ -93,7 +106,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
if( m_OptionsToolBar->GetToolState( id ) ) // Polygons filled asked
if( state ) // Polygons filled asked
g_DisplayPolygonsModeSketch = 1;
else
g_DisplayPolygonsModeSketch = 0;
@ -101,10 +114,17 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_DCODES:
DisplayOpt.DisplayPadNum = m_OptionsToolBar->GetToolState( id );
SetElementVisibility( DCODES_VISIBLE, state );
DrawPanel->Refresh( TRUE );
break;
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
// show/hide auxiliary Vertical layers and visibility manager toolbar
m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update();
break;
default:
DisplayError( this,
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );

View File

@ -73,17 +73,18 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
// Configuration:
// Configuration and preferences:
wxMenu* configmenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&File Ext" ),
_( "Set files extensions" ), config_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "Select colors and display for layers" ),
palette_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_( "Hide &Layers Manager" ),
_( "Show/hide the layers manager toolbar" ),
layers_manager_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_OPTIONS_SETUP, _( "&Options" ),
_( "Select general options" ), preference_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_PCB_DISPLAY_OPTIONS_SETUP,
ADD_MENUITEM_WITH_HELP( configmenu, ID_GERBVIEW_DISPLAY_OPTIONS_SETUP,
_( "Display" ),
_( "Select how items are displayed" ),
display_options_xpm );
@ -98,11 +99,6 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu );
/* wxMenu *drill_menu = new wxMenu;
* postprocess_menu->Append(ID_PCB_GEN_DRILL_FILE, "Create &Drill file",
* "Gen Drill (EXCELLON] file and/or Drill sheet");
*/
wxMenu* miscellaneous_menu = new wxMenu;
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_LIST_DCODES,
_( "&List DCodes" ),
@ -112,7 +108,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
_( "Show source file for the current layer" ),
tools_xpm );
miscellaneous_menu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_PCB_GLOBAL_DELETE,
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_GLOBAL_DELETE,
_( "&Delete Layer" ),
_( "Delete current layer" ), general_deletions_xpm );
@ -155,10 +151,6 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !defined(KICAD_AUIMANAGER)
SetToolBar( (wxToolBar*)m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString,
wxBitmap( new_xpm ),
@ -168,33 +160,9 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
wxBitmap( open_xpm ),
_( "Open existing Layer" ) );
#if 0
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
wxBitmap( save_button ),
_( "Save" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString,
wxBitmap( sheetset_xpm ),
_( "page settings (size, texts)" ) );
#endif
m_HToolBar->AddSeparator();
#if 0
m_HToolBar->AddTool( wxID_CUT, wxEmptyString,
wxBitmap( cut_button ),
_( "Cut selected item" ) );
m_HToolBar->AddTool( wxID_COPY, wxEmptyString,
wxBitmap( copy_button ),
_( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_PASTE, wxEmptyString,
wxBitmap( paste_xpm ),
_( "Paste" ) );
#endif
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString,
wxBitmap( undelete_xpm ),
@ -243,7 +211,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
}
m_SelLayerBox = new WinEDAChoiceBox( m_HToolBar,
ID_TOOLBARH_PCB_SELECT_LAYER,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
wxDefaultPosition, wxSize( 150, -1 ),
choices );
m_SelLayerBox->SetSelection( GetScreen()->m_Active_Layer );
@ -288,29 +256,8 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void )
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
wxBitmap( cursor_xpm ) );
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
#if 0
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_COMPONENT_BUTT, wxEmptyString,
wxBitmap( component_button ),
_( "Add flashes" ) );
m_VToolBar->AddTool( ID_BUS_BUTT, wxEmptyString,
wxBitmap( bus_button ),
_( "Add lines" ) );
m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString,
wxBitmap( junction_xpm ),
_( "Add layer alignment target" ) );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString,
wxBitmap( tool_text_xpm ),
_( "Add text" ) );
#endif
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString,
m_VToolBar->AddTool( ID_GERBVIEW_DELETE_ITEM_BUTT, wxEmptyString,
wxBitmap( delete_body_xpm ),
_( "Delete items" ) );
@ -369,7 +316,16 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void )
wxBitmap( show_dcodenumber_xpm ),
_( "Show dcode number" ), wxITEM_CHECK );
m_OptionsToolBar->Realize();
// Tools to show/hide toolbars:
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
wxEmptyString,
wxBitmap( layers_manager_xpm ),
_(
"Show/hide the layers manager toolbar" ),
wxITEM_CHECK );
m_OptionsToolBar->Realize();
SetToolbars();
}

View File

@ -189,7 +189,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
SetPenMinWidth( tmp );
if( DisplayOpt.DisplayPadNum )
if( IsElementVisible( DCODES_VISIBLE) )
Affiche_DCodes_Pistes( DrawPanel, DC, GetBoard(), GR_COPY );
GetScreen()->ClrRefreshReq();

View File

@ -7,6 +7,7 @@
#include "id.h"
#include "class_gerbview_layer_widget.h"
/**
@ -37,10 +38,18 @@ class WinEDA_GerberFrame: this is the main window used in gerbview
class WinEDA_GerberFrame : public WinEDA_BasePcbFrame
{
friend class PCB_LAYER_WIDGET;
protected:
GERBER_LAYER_WIDGET* m_LayersManager;
public:
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelLayerTool;
private:
bool m_show_layer_manager_tools;
public:
WinEDA_GerberFrame( wxWindow* father, const wxString& title,
const wxPoint& pos, const wxSize& size,
@ -50,6 +59,64 @@ public:
void Update_config();
void OnCloseWindow( wxCloseEvent& 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);
/**
* Function IsElementVisible
* tests whether a given element category is visible. Keep this as an
* inline function.
* @param aGERBER_VISIBLE is from the enum by the same name
* @return bool - true if the element is visible.
* @see enum PCB_VISIBLE
*/
bool IsElementVisible( int aGERBER_VISIBLE )
{
return GetBoard()->IsElementVisible( aGERBER_VISIBLE );
}
/**
* Function SetElementVisibility
* changes the visibility of an element category
* @param aGERBER_VISIBLE is from the enum by the same name
* @param aNewState = The new visibility state of the element category
* @see enum PCB_VISIBLE
*/
void SetElementVisibility( int aGERBER_VISIBLE, bool aNewState );
/**
* Function SetVisibleAlls
* Set the status of all visible element categories and layers to VISIBLE
*/
void SetVisibleAlls( );
/**
* Function ReFillLayerWidget
* changes out all the layers in m_Layers and may be called upon
* loading a new BOARD.
*/
void ReFillLayerWidget();
/**
* Load applications settings specific to the PCBNew.
*

View File

@ -231,7 +231,6 @@ enum main_id
ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
ID_TB_OPTIONS_SHOW_DCODES,
ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,7 @@ set(PCBNEW_SRCS
block.cpp
block_module_editor.cpp
build_BOM_from_board.cpp
class_pcb_layer_widget.cpp
clean.cpp
# cleaningoptions_dialog.cpp
connect.cpp

View File

@ -0,0 +1,347 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/******************************************************/
/* class_pcb_layer_widget.cpp - Pcbnew layers manager */
/******************************************************/
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "pcbstruct.h" // enum PCB_VISIBLE
#include "collectors.h"
#include "bitmaps.h"
#include "pcbnew_id.h"
#include "layer_widget.h"
#include "class_pcb_layer_widget.h"
/**
* Class PCB_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they
* may be tied into the WinEDA_PcbFrame's data and so we can add a popup
* menu which is specific to PCBNEW's needs.
*/
PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( WinEDA_PcbFrame* aParent, wxWindow* aFocusOwner, int aPointSize ) :
LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
myframe( aParent )
{
BOARD* board = myframe->GetBoard();
// Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color
// is changed before appending to the LAYER_WIDGET. This is an automatic variable
// not a static variable, change the color & state after copying from code to renderRows
// on the stack.
LAYER_WIDGET::ROW renderRows[16] = {
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
// text id color tooltip checked
RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ),
RR( _( "Bl/Buried Via" ), VIA_BBLIND_VISIBLE, WHITE, _( "Show blind or buried vias" ) ),
RR( _( "Micro Via" ), VIA_MICROVIA_VISIBLE, WHITE, _( "Show micro vias") ),
RR( _( "Ratsnest" ), RATSNEST_VISIBLE, WHITE, _( "Show unconnected nets as a ratsnest") ),
RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ),
RR( _( "Pads Back" ), PAD_BK_VISIBLE, WHITE, _( "Show footprint pads on board's back" ) ),
RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ),
RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ),
RR( _( "Hidden Text" ), MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
RR( _( "Anchors" ), ANCHOR_VISIBLE, WHITE, _( "Show footprint and text origins as a cross" ) ),
RR( _( "Grid" ), GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ),
RR( _( "No-Connects" ), NO_CONNECTS_VISIBLE, -1, _( "Show a marker on pads which have no net connected" ) ),
RR( _( "Modules Front" ), MOD_FR_VISIBLE, -1, _( "Show footprints that are on board's front") ),
RR( _( "Modules Back" ), MOD_BK_VISIBLE, -1, _( "Show footprints that are on board's back") ),
RR( _( "Values" ), MOD_VALUES_VISIBLE, -1, _( "Show footprint's values") ),
RR( _( "References" ), MOD_REFERENCES_VISIBLE, -1, _( "Show footprint's references") ),
};
for( unsigned row=0; row<DIM(renderRows); ++row )
{
if( renderRows[row].color != -1 ) // does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRows[row].color = board->GetVisibleElementColor( renderRows[row].id );
}
renderRows[row].state = board->IsElementVisible( renderRows[row].id );
}
AppendRenderRows( renderRows, DIM(renderRows) );
//-----<Popup menu>-------------------------------------------------
// handle the popup menu over the layer window.
m_LayerScrolledWindow->Connect( wxEVT_RIGHT_DOWN,
wxMouseEventHandler( PCB_LAYER_WIDGET::onRightDownLayers ), NULL, this );
// since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
// and not m_LayerScrolledWindow->Connect()
Connect( ID_SHOW_ALL_COPPERS, ID_SHOW_NO_COPPERS, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this );
// install the right click handler into each control at end of ReFill()
// using installRightLayerClickHandler
}
void PCB_LAYER_WIDGET::installRightLayerClickHandler()
{
int rowCount = GetLayerRowCount();
for( int row=0; row<rowCount; ++row )
{
for( int col=0; col<LYR_COLUMN_COUNT; ++col )
{
wxWindow* w = getLayerComp( row, col );
w->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler(
PCB_LAYER_WIDGET::onRightDownLayers ), NULL, this );
}
}
}
void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
{
wxMenu menu;
// menu text is capitalized:
// http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS,
_("Show All Cu") ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS,
_( "Hide All Cu" ) ) );
PopupMenu( &menu );
passOnFocus();
}
void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
{
int rowCount;
int menuId = event.GetId();
bool visible;
switch( menuId )
{
case ID_SHOW_ALL_COPPERS:
visible = true;
goto L_change_coppers;
case ID_SHOW_NO_COPPERS:
visible = false;
L_change_coppers:
int lastCu = -1;
rowCount = GetLayerRowCount();
for( int row=rowCount-1; row>=0; --row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
int layer = getDecodedId( cb->GetId() );
if( IsValidCopperLayerIndex( layer ) )
{
lastCu = row;
break;
}
}
for( int row=0; row<rowCount; ++row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
int layer = getDecodedId( cb->GetId() );
if( IsValidCopperLayerIndex( layer ) )
{
cb->SetValue( visible );
bool isLastCopperLayer = (row==lastCu);
OnLayerVisible( layer, visible, isLastCopperLayer );
if( isLastCopperLayer )
break;
}
}
break;
}
}
void PCB_LAYER_WIDGET::ReFill()
{
BOARD* brd = myframe->GetBoard();
int layer;
int enabledLayers = brd->GetEnabledLayers();
// m_Layers->Freeze(); // no screen updates until done modifying
ClearLayerRows();
// show all coppers first, with front on top, back on bottom, then technical layers
layer = LAYER_N_FRONT;
if( enabledLayers & (1 << layer) )
{
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Front copper layer"), true ) );
}
for( layer = LAYER_N_FRONT-1; layer >= 1; --layer )
{
if( enabledLayers & (1 << layer) )
{
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("An innner copper layer"), true ) );
}
}
layer = LAYER_N_BACK;
if( enabledLayers & (1 << layer) )
{
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Back copper layer"), true ) );
}
// technical layers are shown in this order:
static const struct {
int layerId;
wxString tooltip;
} techLayerSeq[] = {
{ ADHESIVE_N_FRONT, _( "Adhesive on board's front" ) },
{ ADHESIVE_N_BACK, _( "Adhesive on board's back" ) },
{ SOLDERPASTE_N_FRONT, _( "Solder paste on board's front" )},
{ SOLDERPASTE_N_BACK, _( "Solder paste on board's back" ) },
{ SILKSCREEN_N_FRONT, _( "Silkscreen on board's front" ) },
{ SILKSCREEN_N_BACK, _( "Silkscreen on board's back" ) },
{ SOLDERMASK_N_FRONT, _( "Solder mask on board's front" ) },
{ SOLDERMASK_N_BACK, _( "Solder mask on board's back" ) },
{ DRAW_N, _( "Explanatory drawings" ) },
{ COMMENT_N, _( "Explanatory comments" ) },
{ ECO1_N, _( "TDB" ) },
{ ECO2_N, _( "TBD" ) },
{ EDGE_N, _( "Board's perimeter definition" ) },
};
for( unsigned i=0; i<DIM(techLayerSeq); ++i )
{
layer = techLayerSeq[i].layerId;
if( !(enabledLayers & (1 << layer)) )
continue;
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ),
techLayerSeq[i].tooltip, true ) );
}
installRightLayerClickHandler();
// m_Layers->Thaw();
}
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor )
{
myframe->GetBoard()->SetLayerColor( aLayer, aColor );
myframe->DrawPanel->Refresh();
}
bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
{
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
// false from this function.
myframe->setActiveLayer( aLayer, false );
myframe->syncLayerBox();
if(DisplayOpt.ContrastModeDisplay)
myframe->DrawPanel->Refresh();
return true;
}
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
int visibleLayers = brd->GetVisibleLayers();
if( isVisible )
visibleLayers |= (1 << aLayer);
else
visibleLayers &= ~(1 << aLayer);
brd->SetVisibleLayers( visibleLayers );
if( isFinal )
myframe->DrawPanel->Refresh();
}
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, int aColor )
{
myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
myframe->DrawPanel->Refresh();
}
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
BOARD* brd = myframe->GetBoard();
/* @todo:
move:
GRID_VISIBLE, ? maybe not this one
into m_VisibleElements and get rid of globals.
*/
switch( aId )
{
// see todo above, don't really want anything except IsElementVisible() here.
case GRID_VISIBLE:
// @todo, make read/write accessors for grid control so the write accessor can fire updates to
// grid state listeners. I think the grid state should be kept in the BOARD.
brd->SetElementVisibility( aId, isEnabled ); // set visibilty flag also in list, and myframe->m_Draw_Grid
break;
default:
brd->SetElementVisibility( aId, isEnabled );
}
myframe->DrawPanel->Refresh();
}
//-----</LAYER_WIDGET callbacks>------------------------------------------

View File

@ -0,0 +1,81 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/************************************************************/
/* class_pcb_layer_widget.h : header for the layers manager */
/************************************************************/
#ifndef _CLASS_PCB_LAYER_WIDGET_H_
#define _CLASS_PCB_LAYER_WIDGET_H_
/**
* Class PCB_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they
* may be tied into the WinEDA_PcbFrame's data and so we can add a popup
* menu which is specific to PCBNEW's needs.
*/
class PCB_LAYER_WIDGET : public LAYER_WIDGET
{
WinEDA_PcbFrame* myframe;
// popup menu ids.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1)
/**
* Function OnRightDownLayers
* puts up a popup menu for the layer panel.
*/
void onRightDownLayers( wxMouseEvent& event );
void onPopupSelection( wxCommandEvent& event );
/// this is for the popup menu, the right click handler has to be installed
/// on every child control within the layer panel.
void installRightLayerClickHandler();
public:
/**
* Constructor
* @param aPointSize is the font point size to use within the widget. This
* effectively sets the overal size of the widget via the row height and bitmap
* button sizes.
*/
PCB_LAYER_WIDGET( WinEDA_PcbFrame* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
void ReFill();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, int aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, int aColor );
void OnRenderEnable( int aId, bool isEnabled );
//-----</implement LAYER_WIDGET abstract callback functions>----------
};
#endif // _CLASS_PCB_LAYER_WIDGET_H_

View File

@ -44,18 +44,6 @@ void Dialog_GeneralOptions::init()
wxString timevalue;
timevalue << g_TimeOut / 60;
m_SaveTime->SetValue( timevalue );
/*
* int layer_count[] = {1,2,4,6,8,10,12,14,16};
* m_LayerNumber->SetSelection(1);
* for ( unsigned ii = 0; ii < sizeof(layer_count); ii++ )
* {
* if ( g_DesignSettings.m_CopperLayerCount != layer_count[ii] )
* continue;
* m_LayerNumber->SetSelection(ii);
* break;
* }
*/
m_MaxShowLinks->SetValue( g_MaxLinksShowed );
m_DrcOn->SetValue( Drc_On );
@ -249,21 +237,11 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1:
m_show_microwave_tools = state;
#if !defined(KICAD_AUIMANAGER)
// show auxiliary Vertical toolbar (Microwave tool)
m_AuxVToolBar->Show(m_show_microwave_tools);
{
wxSizeEvent SizeEv( GetSize() );
OnSize( SizeEv );
}
#else
m_auimgr.GetPane( wxT( "m_AuxVToolBar" ) ).Show( m_show_microwave_tools );
m_auimgr.Update();
#endif
break;
case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR:
#if defined(KICAD_AUIMANAGER)
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
// show auxiliary Vertical layers and visibility manager toolbar
m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
@ -274,7 +252,6 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
else
GetMenuBar()->SetLabel(ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_("Show &Layers Manager" ) );
#endif
break;
default:

View File

@ -397,7 +397,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
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 );
item->SetBitmap( layers_manager_xpm );
configmenu->Append( item );
/* General */

View File

@ -45,350 +45,7 @@
#include "kbool/include/kbool/booleng.h"
#include "layer_widget.h"
#include "dialog_design_rules.h"
/**
* Class PCB_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they
* may be tied into the WinEDA_PcbFrame's data and so we can add a popup
* menu which is specific to PCBNEW's needs.
*/
class PCB_LAYER_WIDGET : public LAYER_WIDGET
{
WinEDA_PcbFrame* myframe;
// popup menu ids.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1)
/**
* Function OnRightDownLayers
* puts up a popup menu for the layer panel.
*/
void onRightDownLayers( wxMouseEvent& event );
void onPopupSelection( wxCommandEvent& event );
/// this is for the popup menu, the right click handler has to be installed
/// on every child control within the layer panel.
void installRightLayerClickHandler();
public:
/**
* Constructor
* @param aPointSize is the font point size to use within the widget. This
* effectively sets the overal size of the widget via the row height and bitmap
* button sizes.
*/
PCB_LAYER_WIDGET( WinEDA_PcbFrame* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
void ReFill();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( int aLayer, int aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, int aColor );
void OnRenderEnable( int aId, bool isEnabled );
//-----</implement LAYER_WIDGET abstract callback functions>----------
};
PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( WinEDA_PcbFrame* aParent, wxWindow* aFocusOwner, int aPointSize ) :
LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
myframe( aParent )
{
BOARD* board = myframe->GetBoard();
// Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color
// is changed before appending to the LAYER_WIDGET. This is an automatic variable
// not a static variable, change the color & state after copying from code to renderRows
// on the stack.
LAYER_WIDGET::ROW renderRows[16] = {
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
// text id color tooltip checked
RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ),
RR( _( "Bl/Buried Via" ), VIA_BBLIND_VISIBLE, WHITE, _( "Show blind or buried vias" ) ),
RR( _( "Micro Via" ), VIA_MICROVIA_VISIBLE, WHITE, _( "Show micro vias") ),
RR( _( "Ratsnest" ), RATSNEST_VISIBLE, WHITE, _( "Show unconnected nets as a ratsnest") ),
RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ),
RR( _( "Pads Back" ), PAD_BK_VISIBLE, WHITE, _( "Show footprint pads on board's back" ) ),
RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ),
RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, WHITE, _( "Show footprint text on board's back" ) ),
RR( _( "Hidden Text" ), MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
RR( _( "Anchors" ), ANCHOR_VISIBLE, WHITE, _( "Show footprint and text origins as a cross" ) ),
RR( _( "Grid" ), GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ),
RR( _( "No-Connects" ), NO_CONNECTS_VISIBLE, -1, _( "Show a marker on pads which have no net connected" ) ),
RR( _( "Modules Front" ), MOD_FR_VISIBLE, -1, _( "Show footprints that are on board's front") ),
RR( _( "Modules Back" ), MOD_BK_VISIBLE, -1, _( "Show footprints that are on board's back") ),
RR( _( "Values" ), MOD_VALUES_VISIBLE, -1, _( "Show footprint's values") ),
RR( _( "References" ), MOD_REFERENCES_VISIBLE, -1, _( "Show footprint's references") ),
};
for( unsigned row=0; row<DIM(renderRows); ++row )
{
if( renderRows[row].color != -1 ) // does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRows[row].color = board->GetVisibleElementColor( renderRows[row].id );
}
renderRows[row].state = board->IsElementVisible( renderRows[row].id );
}
AppendRenderRows( renderRows, DIM(renderRows) );
//-----<Popup menu>-------------------------------------------------
// handle the popup menu over the layer window.
m_LayerScrolledWindow->Connect( wxEVT_RIGHT_DOWN,
wxMouseEventHandler( PCB_LAYER_WIDGET::onRightDownLayers ), NULL, this );
// since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
// and not m_LayerScrolledWindow->Connect()
Connect( ID_SHOW_ALL_COPPERS, ID_SHOW_NO_COPPERS, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this );
// install the right click handler into each control at end of ReFill()
// using installRightLayerClickHandler
}
void PCB_LAYER_WIDGET::installRightLayerClickHandler()
{
int rowCount = GetLayerRowCount();
for( int row=0; row<rowCount; ++row )
{
for( int col=0; col<LYR_COLUMN_COUNT; ++col )
{
wxWindow* w = getLayerComp( row, col );
w->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler(
PCB_LAYER_WIDGET::onRightDownLayers ), NULL, this );
}
}
}
void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event )
{
wxMenu menu;
// menu text is capitalized:
// http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization
menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS,
_("Show All Cu") ) );
menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS,
_( "Hide All Cu" ) ) );
PopupMenu( &menu );
passOnFocus();
}
void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
{
int rowCount;
int menuId = event.GetId();
bool visible;
switch( menuId )
{
case ID_SHOW_ALL_COPPERS:
visible = true;
goto L_change_coppers;
case ID_SHOW_NO_COPPERS:
visible = false;
L_change_coppers:
int lastCu = -1;
rowCount = GetLayerRowCount();
for( int row=rowCount-1; row>=0; --row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
int layer = getDecodedId( cb->GetId() );
if( IsValidCopperLayerIndex( layer ) )
{
lastCu = row;
break;
}
}
for( int row=0; row<rowCount; ++row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
int layer = getDecodedId( cb->GetId() );
if( IsValidCopperLayerIndex( layer ) )
{
cb->SetValue( visible );
bool isLastCopperLayer = (row==lastCu);
OnLayerVisible( layer, visible, isLastCopperLayer );
if( isLastCopperLayer )
break;
}
}
break;
}
}
void PCB_LAYER_WIDGET::ReFill()
{
BOARD* brd = myframe->GetBoard();
int layer;
int enabledLayers = brd->GetEnabledLayers();
// m_Layers->Freeze(); // no screen updates until done modifying
ClearLayerRows();
// show all coppers first, with front on top, back on bottom, then technical layers
layer = LAYER_N_FRONT;
if( enabledLayers & (1 << layer) )
{
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Front copper layer"), true ) );
}
for( layer = LAYER_N_FRONT-1; layer >= 1; --layer )
{
if( enabledLayers & (1 << layer) )
{
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("An innner copper layer"), true ) );
}
}
layer = LAYER_N_BACK;
if( enabledLayers & (1 << layer) )
{
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Back copper layer"), true ) );
}
// technical layers are shown in this order:
static const struct {
int layerId;
wxString tooltip;
} techLayerSeq[] = {
{ ADHESIVE_N_FRONT, _( "Adhesive on board's front" ) },
{ ADHESIVE_N_BACK, _( "Adhesive on board's back" ) },
{ SOLDERPASTE_N_FRONT, _( "Solder paste on board's front" )},
{ SOLDERPASTE_N_BACK, _( "Solder paste on board's back" ) },
{ SILKSCREEN_N_FRONT, _( "Silkscreen on board's front" ) },
{ SILKSCREEN_N_BACK, _( "Silkscreen on board's back" ) },
{ SOLDERMASK_N_FRONT, _( "Solder mask on board's front" ) },
{ SOLDERMASK_N_BACK, _( "Solder mask on board's back" ) },
{ DRAW_N, _( "Explanatory drawings" ) },
{ COMMENT_N, _( "Explanatory comments" ) },
{ ECO1_N, _( "TDB" ) },
{ ECO2_N, _( "TBD" ) },
{ EDGE_N, _( "Board's perimeter definition" ) },
};
for( unsigned i=0; i<DIM(techLayerSeq); ++i )
{
layer = techLayerSeq[i].layerId;
if( !(enabledLayers & (1 << layer)) )
continue;
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ),
techLayerSeq[i].tooltip, true ) );
}
installRightLayerClickHandler();
// m_Layers->Thaw();
}
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor )
{
myframe->GetBoard()->SetLayerColor( aLayer, aColor );
myframe->DrawPanel->Refresh();
}
bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
{
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
// false from this function.
myframe->setActiveLayer( aLayer, false );
myframe->syncLayerBox();
if(DisplayOpt.ContrastModeDisplay)
myframe->DrawPanel->Refresh();
return true;
}
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
int visibleLayers = brd->GetVisibleLayers();
if( isVisible )
visibleLayers |= (1 << aLayer);
else
visibleLayers &= ~(1 << aLayer);
brd->SetVisibleLayers( visibleLayers );
if( isFinal )
myframe->DrawPanel->Refresh();
}
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, int aColor )
{
myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
myframe->DrawPanel->Refresh();
}
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
BOARD* brd = myframe->GetBoard();
/* @todo:
move:
GRID_VISIBLE, ? maybe not this one
into m_VisibleElements and get rid of globals.
*/
switch( aId )
{
// see todo above, don't really want anything except IsElementVisible() here.
case GRID_VISIBLE:
// @todo, make read/write accessors for grid control so the write accessor can fire updates to
// grid state listeners. I think the grid state should be kept in the BOARD.
brd->SetElementVisibility( aId, isEnabled ); // set visibilty flag also in list, and myframe->m_Draw_Grid
break;
default:
brd->SetElementVisibility( aId, isEnabled );
}
myframe->DrawPanel->Refresh();
}
//-----</LAYER_WIDGET callbacks>------------------------------------------
#include "class_pcb_layer_widget.h"
@ -634,6 +291,9 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
m_InternalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch
SetBaseScreen( ScreenPcb );
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
// initialize parameters in m_LayersManager
LoadSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );