Merge trunk @ 5359
This commit is contained in:
commit
b941da6b0e
|
@ -126,22 +126,6 @@ enum LAYER_ID
|
||||||
|
|
||||||
#define MAX_CU_LAYERS (B_Cu - F_Cu + 1)
|
#define MAX_CU_LAYERS (B_Cu - F_Cu + 1)
|
||||||
|
|
||||||
/* These were moved to legacy_plugin.cpp, please don't ever use them
|
|
||||||
outside there. Now with the advent of class LSEQ, we don't iterate over
|
|
||||||
LAYER_ID any more, so therefore FIRST_COPPER_LAYER and LAST_COPPER_LAYER are
|
|
||||||
dead concepts. They in fact failed to do what they were intended to do because
|
|
||||||
they implied a particular sequence which in and of itself was subject to change
|
|
||||||
and actually did when we flipped the pretty and *.kicad_pcb copper layer stack.
|
|
||||||
LSEQ is the way to go, use it. It gives a level of manipulation between
|
|
||||||
LAYER_ID and iteration.
|
|
||||||
#define FIRST_COPPER_LAYER brain dead
|
|
||||||
#define LAST_COPPER_LAYER brain dead
|
|
||||||
#define FIRST_LAYER brain dead
|
|
||||||
#define NB_LAYERS use LAYER_ID_COUNT instead
|
|
||||||
#define NB_COPPER_LAYERS was always a max, not a number, use MAX_CU_LAYERS now.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/// A sequence of layers, a sequence provides a certain order.
|
/// A sequence of layers, a sequence provides a certain order.
|
||||||
typedef std::vector<LAYER_ID> BASE_SEQ;
|
typedef std::vector<LAYER_ID> BASE_SEQ;
|
||||||
|
|
||||||
|
|
|
@ -343,7 +343,6 @@ public:
|
||||||
void DeleteTextModule( TEXTE_MODULE* Text );
|
void DeleteTextModule( TEXTE_MODULE* Text );
|
||||||
void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC );
|
void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC );
|
||||||
void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC );
|
void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC );
|
||||||
TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ResetTextSize
|
* Function ResetTextSize
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2004-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -173,6 +173,13 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
|
||||||
prjloaded = true; // OnFileHistory() loads the project
|
prjloaded = true; // OnFileHistory() loads the project
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // there is no history
|
||||||
|
{
|
||||||
|
wxFileName namelessProject( wxGetCwd(), NAMELESS_PROJECT,
|
||||||
|
ProjectFileExtension );
|
||||||
|
|
||||||
|
frame->SetProjectFileName( namelessProject.GetFullPath() );
|
||||||
|
}
|
||||||
|
|
||||||
if( !prjloaded )
|
if( !prjloaded )
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2012 Jean-Pierre Charras
|
* Copyright (C) 2004-2015 Jean-Pierre Charras
|
||||||
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -259,7 +259,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
|
||||||
wxString nameless_prj = NAMELESS_PROJECT wxT( ".pro" );
|
wxString nameless_prj = NAMELESS_PROJECT wxT( ".pro" );
|
||||||
|
|
||||||
// Check if project file exists and if it is not noname.pro
|
// Check if project file exists and if it is not noname.pro
|
||||||
if( !wxFileExists( prj_filename ) && !prj_filename.IsSameAs( nameless_prj ) )
|
if( !wxFileExists( prj_filename ) && !wxFileName( prj_filename ).GetFullName().IsSameAs( nameless_prj ) )
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format( _(
|
wxString msg = wxString::Format( _(
|
||||||
"KiCad project file '%s' not found" ),
|
"KiCad project file '%s' not found" ),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
|
||||||
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
|
@ -79,15 +79,22 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
|
||||||
RR( _( "References" ), MOD_REFERENCES_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprint's references") ),
|
RR( _( "References" ), MOD_REFERENCES_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprint's references") ),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int s_allowed_in_FpEditor[] =
|
||||||
|
{
|
||||||
|
MOD_TEXT_INVISIBLE, PAD_FR_VISIBLE, PAD_BK_VISIBLE,
|
||||||
|
GRID_VISIBLE, MOD_VALUES_VISIBLE, MOD_REFERENCES_VISIBLE
|
||||||
|
};
|
||||||
|
|
||||||
PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize ) :
|
PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner,
|
||||||
|
int aPointSize, bool aFpEditorMode ) :
|
||||||
LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
|
LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
|
||||||
myframe( aParent )
|
myframe( aParent )
|
||||||
{
|
{
|
||||||
m_alwaysShowActiveCopperLayer = false;
|
m_alwaysShowActiveCopperLayer = false;
|
||||||
|
m_fp_editor_mode = aFpEditorMode;
|
||||||
ReFillRender();
|
ReFillRender();
|
||||||
|
|
||||||
// Update default tabs labels for GerbView
|
// Update default tabs labels
|
||||||
SetLayersManagerTabsText();
|
SetLayersManagerTabsText();
|
||||||
|
|
||||||
//-----<Popup menu>-------------------------------------------------
|
//-----<Popup menu>-------------------------------------------------
|
||||||
|
@ -106,6 +113,33 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* return true if item aId has meaning in footprint editor mode,
|
||||||
|
* i.e. is in s_allowed_in_FpEditor and therefore is shown in render panel
|
||||||
|
*/
|
||||||
|
bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId )
|
||||||
|
{
|
||||||
|
for( unsigned ii = 0; ii < DIM( s_allowed_in_FpEditor ); ii++ )
|
||||||
|
if( s_allowed_in_FpEditor[ii] == aId )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return true if item aId has meaning in footprint editor mode,
|
||||||
|
* i.e. is in s_allowed_in_FpEditor and therefore is shown in render panel
|
||||||
|
* Note: User layers, which are not paired, are not shown in layers manager.
|
||||||
|
* However a not listed layer can be reachable in the graphic item proprerties
|
||||||
|
* dialog.
|
||||||
|
*/
|
||||||
|
bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( LAYER_ID aLayer )
|
||||||
|
{
|
||||||
|
static LSET allowed = LSET::AllTechMask();
|
||||||
|
// Currently not in use because putting a graphic item on a copper layer
|
||||||
|
// is not currently supported by DRC.
|
||||||
|
// allowed.set( F_Cu ).set( B_Cu );
|
||||||
|
return allowed.test( aLayer );
|
||||||
|
}
|
||||||
|
|
||||||
void PCB_LAYER_WIDGET::installRightLayerClickHandler()
|
void PCB_LAYER_WIDGET::installRightLayerClickHandler()
|
||||||
{
|
{
|
||||||
int rowCount = GetLayerRowCount();
|
int rowCount = GetLayerRowCount();
|
||||||
|
@ -223,6 +257,9 @@ void PCB_LAYER_WIDGET::ReFillRender()
|
||||||
{
|
{
|
||||||
LAYER_WIDGET::ROW renderRow = s_render_rows[row];
|
LAYER_WIDGET::ROW renderRow = s_render_rows[row];
|
||||||
|
|
||||||
|
if( !isAllowedInFpMode( renderRow.id ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip );
|
renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip );
|
||||||
renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName );
|
renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName );
|
||||||
|
|
||||||
|
@ -247,6 +284,9 @@ void PCB_LAYER_WIDGET::SyncRenderStates()
|
||||||
{
|
{
|
||||||
int rowId = s_render_rows[row].id;
|
int rowId = s_render_rows[row].id;
|
||||||
|
|
||||||
|
if( !isAllowedInFpMode( rowId ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
// this does not fire a UI event
|
// this does not fire a UI event
|
||||||
SetRenderState( rowId, board->IsElementVisible( rowId ) );
|
SetRenderState( rowId, board->IsElementVisible( rowId ) );
|
||||||
}
|
}
|
||||||
|
@ -305,6 +345,13 @@ void PCB_LAYER_WIDGET::ReFill()
|
||||||
AppendLayerRow( LAYER_WIDGET::ROW(
|
AppendLayerRow( LAYER_WIDGET::ROW(
|
||||||
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ),
|
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ),
|
||||||
dsc, true ) );
|
dsc, true ) );
|
||||||
|
|
||||||
|
if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
|
||||||
|
{
|
||||||
|
getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
|
||||||
|
getLayerComp( GetLayerRowCount()-1,
|
||||||
|
COLUMN_COLORBM )->SetToolTip( wxEmptyString );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,6 +392,13 @@ void PCB_LAYER_WIDGET::ReFill()
|
||||||
AppendLayerRow( LAYER_WIDGET::ROW(
|
AppendLayerRow( LAYER_WIDGET::ROW(
|
||||||
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ),
|
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ),
|
||||||
wxGetTranslation( non_cu_seq[i].tooltip ), true ) );
|
wxGetTranslation( non_cu_seq[i].tooltip ), true ) );
|
||||||
|
|
||||||
|
if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
|
||||||
|
{
|
||||||
|
getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
|
||||||
|
getLayerComp( GetLayerRowCount()-1,
|
||||||
|
COLUMN_COLORBM )->SetToolTip( wxEmptyString );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
installRightLayerClickHandler();
|
installRightLayerClickHandler();
|
||||||
|
@ -371,7 +425,12 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
|
||||||
{
|
{
|
||||||
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
|
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
|
||||||
// false from this function.
|
// false from this function.
|
||||||
myframe->SetActiveLayer( ToLAYER_ID( aLayer ) );
|
LAYER_ID layer = ToLAYER_ID( aLayer );
|
||||||
|
|
||||||
|
if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
myframe->SetActiveLayer( layer );
|
||||||
|
|
||||||
if( m_alwaysShowActiveCopperLayer )
|
if( m_alwaysShowActiveCopperLayer )
|
||||||
OnLayerSelected();
|
OnLayerSelected();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
|
||||||
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
|
@ -50,8 +50,12 @@ public:
|
||||||
* @param aPointSize is the font point size to use within the widget. This
|
* @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
|
* effectively sets the overal size of the widget via the row height and bitmap
|
||||||
* button sizes.
|
* button sizes.
|
||||||
|
* @param aFpEditorMode false for the board editor (default), true for fp editor
|
||||||
|
* when true, some options or layers which cannot be used in editor mode are not
|
||||||
|
* displayed
|
||||||
*/
|
*/
|
||||||
PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
|
PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner,
|
||||||
|
int aPointSize = 10, bool aFpEditorMode = false );
|
||||||
|
|
||||||
void ReFill();
|
void ReFill();
|
||||||
|
|
||||||
|
@ -109,6 +113,7 @@ protected:
|
||||||
static const LAYER_WIDGET::ROW s_render_rows[];
|
static const LAYER_WIDGET::ROW s_render_rows[];
|
||||||
bool m_alwaysShowActiveCopperLayer; // If true: Only shows the current active layer
|
bool m_alwaysShowActiveCopperLayer; // If true: Only shows the current active layer
|
||||||
// even if it is changed
|
// even if it is changed
|
||||||
|
bool m_fp_editor_mode;
|
||||||
|
|
||||||
PCB_BASE_FRAME* myframe;
|
PCB_BASE_FRAME* myframe;
|
||||||
|
|
||||||
|
@ -118,6 +123,21 @@ protected:
|
||||||
#define ID_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+2)
|
#define ID_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+2)
|
||||||
#define ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+3)
|
#define ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+3)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function isAllowedInFpMode
|
||||||
|
* @return true if item aId has meaning in footprint editor mode.
|
||||||
|
* and therefore is shown in render panel
|
||||||
|
*/
|
||||||
|
bool isAllowedInFpMode( int aId );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function isLayerAllowedInFpMode
|
||||||
|
* @param aLayer is the layer id to test
|
||||||
|
* @return true if LAYER_ID aLayer has meaning in footprint editor mode.
|
||||||
|
* and therefore is shown in render panel
|
||||||
|
*/
|
||||||
|
bool isLayerAllowedInFpMode( LAYER_ID aLayer );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function OnRightDownLayers
|
* Function OnRightDownLayers
|
||||||
* puts up a popup menu for the layer panel.
|
* puts up a popup menu for the layer panel.
|
||||||
|
|
|
@ -207,10 +207,11 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
|
||||||
|
|
||||||
if( IsCopperLayer( new_layer ) )
|
if( IsCopperLayer( new_layer ) )
|
||||||
{
|
{
|
||||||
/* an edge is put on a copper layer, and it is very dangerous. a
|
// an edge is put on a copper layer, and it is very dangerous.
|
||||||
*confirmation is requested */
|
// A confirmation is requested
|
||||||
if( !IsOK( this,
|
if( !IsOK( this,
|
||||||
_( "The graphic item will be on a copper layer. This is very dangerous. Are you sure?" ) ) )
|
_( "The graphic item will be on a copper layer.\n"
|
||||||
|
"This is very dangerous. Are you sure?" ) ) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,13 +347,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
|
||||||
aEdge->SetAngle( ArcValue );
|
aEdge->SetAngle( ArcValue );
|
||||||
|
|
||||||
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
|
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
|
||||||
aEdge->SetLayer( module->GetLayer() );
|
aEdge->SetLayer( GetActiveLayer() );
|
||||||
|
|
||||||
// The default layer for an edge is the corresponding silk layer
|
|
||||||
if( module->IsFlipped() )
|
|
||||||
aEdge->SetLayer( B_SilkS );
|
|
||||||
else
|
|
||||||
aEdge->SetLayer( F_SilkS );
|
|
||||||
|
|
||||||
// Initialize the starting point of the new segment or arc
|
// Initialize the starting point of the new segment or arc
|
||||||
aEdge->SetStart( GetCrossHairPosition() );
|
aEdge->SetStart( GetCrossHairPosition() );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include <pcbnew.h>
|
#include <pcbnew.h>
|
||||||
#include <wxPcbStruct.h>
|
#include <wxPcbStruct.h>
|
||||||
|
#include <module_editor_frame.h>
|
||||||
|
|
||||||
#include <class_board.h>
|
#include <class_board.h>
|
||||||
#include <class_module.h>
|
#include <class_module.h>
|
||||||
|
@ -62,36 +63,43 @@ static double TextInitialOrientation; // module text initial orientation for
|
||||||
* Note there always are 2 mandatory texts: reference and value.
|
* Note there always are 2 mandatory texts: reference and value.
|
||||||
* New texts have the member TEXTE_MODULE.GetType() set to TEXT_is_DIVERS
|
* New texts have the member TEXTE_MODULE.GetType() set to TEXT_is_DIVERS
|
||||||
*/
|
*/
|
||||||
TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
|
TEXTE_MODULE* FOOTPRINT_EDIT_FRAME::CreateTextModule( MODULE* aModule, wxDC* aDC )
|
||||||
{
|
{
|
||||||
TEXTE_MODULE* Text = new TEXTE_MODULE( Module );
|
TEXTE_MODULE* text = new TEXTE_MODULE( aModule );
|
||||||
|
|
||||||
// Add the new text object to the beginning of the draw item list.
|
text->SetFlags( IS_NEW );
|
||||||
if( Module )
|
|
||||||
Module->GraphicalItems().PushFront( Text );
|
|
||||||
|
|
||||||
Text->SetFlags( IS_NEW );
|
|
||||||
|
|
||||||
Text->SetText( wxT( "text" ) );
|
|
||||||
|
|
||||||
GetDesignSettings().m_ModuleTextWidth = Clamp_Text_PenSize( GetDesignSettings().m_ModuleTextWidth,
|
GetDesignSettings().m_ModuleTextWidth = Clamp_Text_PenSize( GetDesignSettings().m_ModuleTextWidth,
|
||||||
std::min( GetDesignSettings().m_ModuleTextSize.x, GetDesignSettings().m_ModuleTextSize.y ), true );
|
std::min( GetDesignSettings().m_ModuleTextSize.x, GetDesignSettings().m_ModuleTextSize.y ), true );
|
||||||
Text->SetSize( GetDesignSettings().m_ModuleTextSize );
|
text->SetSize( GetDesignSettings().m_ModuleTextSize );
|
||||||
Text->SetThickness( GetDesignSettings().m_ModuleTextWidth );
|
text->SetThickness( GetDesignSettings().m_ModuleTextWidth );
|
||||||
Text->SetTextPosition( GetCrossHairPosition() );
|
text->SetPosition( GetCrossHairPosition() );
|
||||||
Text->SetLocalCoord();
|
|
||||||
|
if( LSET::AllTechMask().test( GetActiveLayer() ) ) // i.e. a possible layer for a text
|
||||||
|
text->SetLayer( GetActiveLayer() );
|
||||||
|
|
||||||
|
InstallTextModOptionsFrame( text, NULL );
|
||||||
|
|
||||||
InstallTextModOptionsFrame( Text, NULL );
|
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
|
||||||
Text->ClearFlags();
|
if( text->GetText().IsEmpty() )
|
||||||
|
{
|
||||||
|
delete text;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if( DC )
|
// Add the new text object to the beginning of the footprint draw list.
|
||||||
Text->Draw( m_canvas, DC, GR_OR );
|
if( aModule )
|
||||||
|
aModule->GraphicalItems().PushFront( text );
|
||||||
|
|
||||||
SetMsgPanel( Text );
|
text->ClearFlags();
|
||||||
|
|
||||||
return Text;
|
if( aDC )
|
||||||
|
text->Draw( m_canvas, aDC, GR_OR );
|
||||||
|
|
||||||
|
SetMsgPanel( text );
|
||||||
|
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -401,7 +401,7 @@ public:
|
||||||
* is called to notify client code about a layer visibility change.
|
* is called to notify client code about a layer visibility change.
|
||||||
*
|
*
|
||||||
* @param aLayer is the board layer to select
|
* @param aLayer is the board layer to select
|
||||||
* @param isVisible is the new vosible state
|
* @param isVisible is the new visible state
|
||||||
* @param isFinal is true when this is the last of potentially several
|
* @param isFinal is true when this is the last of potentially several
|
||||||
* such calls, and can be used to decide when to update the screen only
|
* such calls, and can be used to decide when to update the screen only
|
||||||
* one time instead of several times in the midst of a multiple layer change.
|
* one time instead of several times in the midst of a multiple layer change.
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <kicad_device_context.h>
|
#include <kicad_device_context.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <invoke_pcb_dialog.h>
|
#include <invoke_pcb_dialog.h>
|
||||||
|
#include <class_pcb_layer_widget.h>
|
||||||
|
|
||||||
#include <class_board.h>
|
#include <class_board.h>
|
||||||
#include <class_module.h>
|
#include <class_module.h>
|
||||||
|
@ -909,6 +910,9 @@ void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
|
||||||
|
|
||||||
GetGalCanvas()->SetHighContrastLayer( aLayer );
|
GetGalCanvas()->SetHighContrastLayer( aLayer );
|
||||||
|
|
||||||
|
m_Layers->SelectLayer( GetActiveLayer() );
|
||||||
|
m_Layers->OnLayerSelected();
|
||||||
|
|
||||||
if( IsGalCanvasActive() )
|
if( IsGalCanvasActive() )
|
||||||
GetGalCanvas()->Refresh();
|
GetGalCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,6 +416,43 @@ public:
|
||||||
*/
|
*/
|
||||||
bool DeleteModuleFromCurrentLibrary();
|
bool DeleteModuleFromCurrentLibrary();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function IsElementVisible
|
||||||
|
* tests whether a given element category is visible. Keep this as an
|
||||||
|
* inline function.
|
||||||
|
* @param aElement is from the enum by the same name
|
||||||
|
* @return bool - true if the element is visible.
|
||||||
|
* @see enum PCB_VISIBLE
|
||||||
|
*/
|
||||||
|
bool IsElementVisible( int aElement ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetElementVisibility
|
||||||
|
* changes the visibility of an element category
|
||||||
|
* @param aElement 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 aElement, bool aNewState );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function IsGridVisible() , virtual
|
||||||
|
* @return true if the grid must be shown
|
||||||
|
*/
|
||||||
|
virtual bool IsGridVisible() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetGridVisibility() , virtual
|
||||||
|
* It may be overloaded by derived classes
|
||||||
|
* if you want to store/retrieve the grid visibility 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 EDA_COLOR_T GetGridColor() const;
|
virtual EDA_COLOR_T GetGridColor() const;
|
||||||
|
|
||||||
///> @copydoc PCB_BASE_FRAME::SetActiveLayer()
|
///> @copydoc PCB_BASE_FRAME::SetActiveLayer()
|
||||||
|
@ -447,6 +484,14 @@ protected:
|
||||||
|
|
||||||
void restoreLastFootprint();
|
void restoreLastFootprint();
|
||||||
void retainLastFootprint();
|
void retainLastFootprint();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new text for the footprint
|
||||||
|
* @param aModule is the owner of the text
|
||||||
|
* @param aDC is the current DC (can be NULL )
|
||||||
|
* @return a pointer to the new text, or NULL if aborted
|
||||||
|
*/
|
||||||
|
TEXTE_MODULE* CreateTextModule( MODULE* aModule, wxDC* aDC );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODULE_EDITOR_FRAME_H_
|
#endif // MODULE_EDITOR_FRAME_H_
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
@ -198,10 +198,13 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
restoreLastFootprint();
|
restoreLastFootprint();
|
||||||
|
|
||||||
// Ensure all layers and items are visible:
|
// Ensure all layers and items are visible:
|
||||||
|
// In footprint editor, some layers have no meaning or
|
||||||
|
// cannot be used, but we show all of them, at least to be able
|
||||||
|
// to edit a bad layer
|
||||||
GetBoard()->SetVisibleAlls();
|
GetBoard()->SetVisibleAlls();
|
||||||
|
|
||||||
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||||
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize() );
|
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize(), true );
|
||||||
|
|
||||||
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
|
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
|
||||||
|
|
||||||
|
@ -257,7 +260,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
// Add the layer manager ( most right side of pcbframe )
|
// Add the layer manager ( most right side of pcbframe )
|
||||||
m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 2 ) );
|
m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 2 ) );
|
||||||
// Layers manager is visible and served only in GAL canvas mode.
|
// Layers manager is visible and served only in GAL canvas mode.
|
||||||
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( parentFrame->IsGalCanvasActive() );
|
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( true ); // parentFrame->IsGalCanvasActive() );
|
||||||
|
|
||||||
// The left vertical toolbar (fast acces to display options)
|
// The left vertical toolbar (fast acces to display options)
|
||||||
m_auimgr.AddPane( m_optionsToolBar,
|
m_auimgr.AddPane( m_optionsToolBar,
|
||||||
|
@ -295,15 +298,17 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
m_toolManager->ResetTools( TOOL_BASE::RUN );
|
||||||
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
|
||||||
|
UseGalCanvas( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).IsShown() )
|
||||||
|
{
|
||||||
m_Layers->ReFill();
|
m_Layers->ReFill();
|
||||||
m_Layers->ReFillRender();
|
m_Layers->ReFillRender();
|
||||||
|
|
||||||
GetScreen()->m_Active_Layer = F_SilkS;
|
GetScreen()->m_Active_Layer = F_SilkS;
|
||||||
m_Layers->SelectLayer( F_SilkS );
|
m_Layers->SelectLayer( F_SilkS );
|
||||||
m_Layers->OnLayerSelected();
|
m_Layers->OnLayerSelected();
|
||||||
|
|
||||||
UseGalCanvas( true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
@ -714,3 +719,30 @@ void FOOTPRINT_EDIT_FRAME::updateView()
|
||||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||||
m_toolManager->RunAction( COMMON_ACTIONS::zoomFitScreen, true );
|
m_toolManager->RunAction( COMMON_ACTIONS::zoomFitScreen, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FOOTPRINT_EDIT_FRAME::IsGridVisible() const
|
||||||
|
{
|
||||||
|
return IsElementVisible( GRID_VISIBLE );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FOOTPRINT_EDIT_FRAME::SetGridVisibility(bool aVisible)
|
||||||
|
{
|
||||||
|
SetElementVisibility( GRID_VISIBLE, aVisible );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FOOTPRINT_EDIT_FRAME::IsElementVisible( int aElement ) const
|
||||||
|
{
|
||||||
|
return GetBoard()->IsElementVisible( aElement );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FOOTPRINT_EDIT_FRAME::SetElementVisibility( int aElement, bool aNewState )
|
||||||
|
{
|
||||||
|
GetGalCanvas()->GetView()->SetLayerVisible( ITEM_GAL_LAYER( aElement ), aNewState );
|
||||||
|
GetBoard()->SetElementVisibility( aElement, aNewState );
|
||||||
|
m_Layers->SetRenderState( aElement, aNewState );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue