Commit 3b55948d authored by jean-pierre charras's avatar jean-pierre charras

fix an issue created by commit 2954. Gerbview: display now an indicator of...

fix an issue created by commit 2954. Gerbview: display now an indicator of layers in use. minor code cleanup.
parent df8f7d1e
...@@ -17,6 +17,28 @@ EESschema & PCBNew: ...@@ -17,6 +17,28 @@ EESschema & PCBNew:
Fix about and preferences wxMenu to be more native (remove unneeded WXMAC ) Fix about and preferences wxMenu to be more native (remove unneeded WXMAC )
Disable all icons in wxMenu on OSX with macro SETBITMAPS Disable all icons in wxMenu on OSX with macro SETBITMAPS
jp charras:
SETBITMAPS is incorrectly used here. change to SET_BITMAP
2011-Mar-25 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
EESchema multiple item hit testing and other minor improvements.
* Add item clarification context menu to EESchema when multiple unresolved
items are found at the current cross hair position.
* Add collector class SCH_COLLECTOR for supporting multiple item hit testing.
* Removed bit wise masked filtering from schematic item hit testing.
* Removed all old hit testing functions and methods scattered about the
EESchema source code.
* Move terminal point test function into SCH_SCREEN object.
* Fixed bug in terminal point test when terminating a bus to a label.
* Define the < operator for sorting schematic items.
* Add area calculation method to EDA_Rect item.
* Add method for returning an item's bitmap for menu display purposes.
* Add method for returning an item's menu text for menu display purposes.
* Changed EDA_ITEMS container from boost::ptr_vector to std::vector.
* Factor coordinate string conversion code from EDA_DRAW_FRAME to function CoordinateToString().
2011-Mar-16, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2011-Mar-16, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
Gerbview: Gerbview:
......
...@@ -416,6 +416,7 @@ set(BITMAP_SRCS ...@@ -416,6 +416,7 @@ set(BITMAP_SRCS
Width_Track_Via.xpm Width_Track_Via.xpm
Width_Track.xpm Width_Track.xpm
Width_Vias.xpm Width_Vias.xpm
window_close.xpm
zip_tool.xpm zip_tool.xpm
zip.xpm zip.xpm
zoom.xpm zoom.xpm
......
This diff is collapsed.
/* XPM */
const char *window_close_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 16 1",
"O c #DE7070",
"& c #BC9392",
"o c #BF9D9C",
"X c #DC6464",
"* c #CA4545",
"% c #D45051",
"- c #C03433",
"+ c #E88080",
"= c #C43C3C",
". c #C2A6A6",
"; c #BC8684",
": c #B47274",
" c None",
"$ c #BFB0AF",
"@ c #C55A5B",
"# c #DD5A59",
/* pixels */
" .X. .X. ",
" oO+O. .O+Oo ",
"oOOO+O. .O+OOOo",
"@OXXXOO..OOXXXO@",
".XO#XXOXXOXX#OX.",
" $@O###OO###O@$ ",
" $@X######X@$ ",
" $@X%%%%X@$ ",
" &@%%%%%%@& ",
" &%%******%%& ",
" o*****%%*****o ",
"o**===****===**o",
"==---==.&*=---==",
"&=---=. ;=---=.",
" &---o :--=$ ",
" &-o @* "
};
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#endif #endif
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2011-04-01)" #define KICAD_BUILD_VERSION "(2011-04-05)"
#endif #endif
// uncomment this line only when creating a stable version // uncomment this line only when creating a stable version
......
...@@ -74,6 +74,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() ...@@ -74,6 +74,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
_( "Prevent CVPcb from exiting after saving netlist file" ), _( "Prevent CVPcb from exiting after saving netlist file" ),
wxITEM_CHECK ); wxITEM_CHECK );
configmenu->Append( item ); configmenu->Append( item );
SETBITMAPS( window_close_xpm );
configmenu->AppendSeparator(); configmenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE,
......
This diff is collapsed.
...@@ -147,6 +147,7 @@ APERTURE_MACRO* GERBER_IMAGE::FindApertureMacro( const APERTURE_MACRO& aLookup ) ...@@ -147,6 +147,7 @@ APERTURE_MACRO* GERBER_IMAGE::FindApertureMacro( const APERTURE_MACRO& aLookup )
void GERBER_IMAGE::ResetDefaultValues() void GERBER_IMAGE::ResetDefaultValues()
{ {
m_InUse = false;
m_GBRLayerParams.ResetDefaultValues(); m_GBRLayerParams.ResetDefaultValues();
m_FileName.Empty(); m_FileName.Empty();
m_ImageName = wxT( "no name" ); // Image name from the IN command m_ImageName = wxT( "no name" ); // Image name from the IN command
......
...@@ -82,6 +82,8 @@ class GERBER_IMAGE ...@@ -82,6 +82,8 @@ class GERBER_IMAGE
GERBER_LAYER m_GBRLayerParams; // hold params for the current gerber layer GERBER_LAYER m_GBRLayerParams; // hold params for the current gerber layer
public: public:
bool m_InUse; // true if this image is currently in use
// (a file is loaded in it)
wxString m_FileName; // Full File Name for this layer wxString m_FileName; // Full File Name for this layer
wxString m_ImageName; // Image name, from IN <name>* command wxString m_ImageName; // Image name, from IN <name>* command
int m_GraphicLayer; // Graphic layer Number int m_GraphicLayer; // Graphic layer Number
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "pcbstruct.h" #include "pcbstruct.h"
#include "gerbview.h" #include "gerbview.h"
#include "class_GERBER.h"
#include "layer_widget.h" #include "layer_widget.h"
#include "class_gerbview_layer_widget.h" #include "class_gerbview_layer_widget.h"
...@@ -238,4 +239,37 @@ void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) ...@@ -238,4 +239,37 @@ void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
//-----</LAYER_WIDGET callbacks>------------------------------------------ //-----</LAYER_WIDGET callbacks>------------------------------------------
/*
* Virtual Function useAlternateBitmap
* return true if bitmaps shown in Render layer list
* must be alternate bitmaps, or false to use "normal" bitmaps
*/
bool GERBER_LAYER_WIDGET::useAlternateBitmap(int aRow)
{
bool inUse = false;
GERBER_IMAGE* gerber = g_GERBER_List[aRow];
if( gerber != NULL && gerber->m_InUse )
inUse = true;
return inUse;
}
/**
* Function UpdateLayerIcons
* Update the layer manager icons (layers only)
* Useful when loading a file or clearing a layer because they change
*/
void GERBER_LAYER_WIDGET::UpdateLayerIcons()
{
int row_count = GetLayerRowCount();
for( int row = 0; row < row_count ; row++ )
{
wxStaticBitmap* bm = (wxStaticBitmap*) getLayerComp( row, 0 );
if( bm == NULL)
continue;
if( row == m_CurrentRow )
bm->SetBitmap( useAlternateBitmap(row) ? *m_RightArrowAlternateBitmap : *m_RightArrowBitmap );
else
bm->SetBitmap( useAlternateBitmap(row) ? *m_BlankAlternateBitmap : *m_BlankBitmap );
}
}
...@@ -59,6 +59,13 @@ class GERBER_LAYER_WIDGET : public LAYER_WIDGET ...@@ -59,6 +59,13 @@ class GERBER_LAYER_WIDGET : public LAYER_WIDGET
/// on every child control within the layer panel. /// on every child control within the layer panel.
void installRightLayerClickHandler(); void installRightLayerClickHandler();
/**
* Virtual Function useAlternateBitmap
* @return true if bitmaps shown in Render layer list
* are alternate bitmaps, or false if they are "normal" bitmaps
*/
virtual bool useAlternateBitmap(int aRow);
public: public:
/** /**
...@@ -86,6 +93,13 @@ public: ...@@ -86,6 +93,13 @@ public:
*/ */
void SetLayersManagerTabsText( ); void SetLayersManagerTabsText( );
//-----</implement LAYER_WIDGET abstract callback functions>---------- //-----</implement LAYER_WIDGET abstract callback functions>----------
/**
* Function UpdateLayerIcons
* Update the layer manager icons (layers only)
* Useful when loading a file or clearing a layer because they change
*/
void UpdateLayerIcons();
}; };
#endif // _CLASS_GERBER_LAYER_WIDGET_H_ #endif // _CLASS_GERBER_LAYER_WIDGET_H_
...@@ -183,8 +183,8 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName ) ...@@ -183,8 +183,8 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
// Synchronize layers tools with actual active layer: // Synchronize layers tools with actual active layer:
setActiveLayer( getActiveLayer() ); setActiveLayer( getActiveLayer() );
m_LayersManager->UpdateLayerIcons();
syncLayerBox(); syncLayerBox();
return true; return true;
} }
...@@ -268,6 +268,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName ) ...@@ -268,6 +268,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
// Synchronize layers tools with actual active layer: // Synchronize layers tools with actual active layer:
setActiveLayer( getActiveLayer() ); setActiveLayer( getActiveLayer() );
m_LayersManager->UpdateLayerIcons();
syncLayerBox(); syncLayerBox();
return true; return true;
......
...@@ -46,6 +46,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) ...@@ -46,6 +46,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
SetScreen( ScreenPcb ); SetScreen( ScreenPcb );
GetScreen()->Init(); GetScreen()->Init();
setActiveLayer(FIRST_COPPER_LAYER); setActiveLayer(FIRST_COPPER_LAYER);
m_LayersManager->UpdateLayerIcons();
syncLayerBox(); syncLayerBox();
return TRUE; return TRUE;
} }
...@@ -81,5 +82,6 @@ void GERBVIEW_FRAME::Erase_Current_Layer( bool query ) ...@@ -81,5 +82,6 @@ void GERBVIEW_FRAME::Erase_Current_Layer( bool query )
ScreenPcb->SetModify(); ScreenPcb->SetModify();
DrawPanel->Refresh(); DrawPanel->Refresh();
m_LayersManager->UpdateLayerIcons();
syncLayerBox(); syncLayerBox();
} }
...@@ -151,6 +151,8 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName, ...@@ -151,6 +151,8 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
fclose( gerber->m_Current_File ); fclose( gerber->m_Current_File );
SetLocaleTo_Default(); SetLocaleTo_Default();
gerber->m_InUse = true;
// Display errors list // Display errors list
if( m_Messages.size() > 0 ) if( m_Messages.size() > 0 )
{ {
......
...@@ -412,6 +412,7 @@ extern const char* width_segment_xpm[]; ...@@ -412,6 +412,7 @@ extern const char* width_segment_xpm[];
extern const char* width_track_via_xpm[]; extern const char* width_track_via_xpm[];
extern const char* width_track_xpm[]; extern const char* width_track_xpm[];
extern const char* width_vias_xpm[]; extern const char* width_vias_xpm[];
extern const char* window_close_xpm[];
extern const char* zip_tool_xpm[]; extern const char* zip_tool_xpm[];
extern const char* zip_xpm[]; extern const char* zip_xpm[];
extern const char* zoom_area_xpm[]; extern const char* zoom_area_xpm[];
......
...@@ -237,10 +237,18 @@ static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu, ...@@ -237,10 +237,18 @@ static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu,
#endif #endif
// macro to add a bitmap list to check menus (do not use with normal menus)
#ifdef __WINDOWS__ #ifdef __WINDOWS__
# define SETBITMAPS( icon ) item->SetBitmaps( apply_xpm, (icon) ) # define SETBITMAPS( icon ) item->SetBitmaps( apply_xpm, (icon) )
#else #else
# define SETBITMAPS( icon ) # define SETBITMAPS( icon )
#endif #endif
// macro to add a bitmap menus (do not use with check menus)
#ifdef __WXMAC__
# define SET_BITMAP( icon )
#else
# define SET_BITMAP( icon ) item->SetBitmap( (icon) )
#endif
#endif /* ifdef MACRO_H */ #endif /* ifdef MACRO_H */
...@@ -49,8 +49,6 @@ extern PCB_SCREEN* ScreenPcb; ...@@ -49,8 +49,6 @@ extern PCB_SCREEN* ScreenPcb;
extern BOARD* g_ModuleEditor_Pcb; extern BOARD* g_ModuleEditor_Pcb;
/* Pad editing */ /* Pad editing */
extern wxString g_Current_PadName; // Last used pad name (pad num)
extern D_PAD g_Pad_Master; extern D_PAD g_Pad_Master;
#endif /* __PCBCOMMON_H__ */ #endif /* __PCBCOMMON_H__ */
...@@ -8,10 +8,20 @@ else(ZLIB_FOUND) ...@@ -8,10 +8,20 @@ else(ZLIB_FOUND)
# include files are in ${wxWidgets_ROOT_DIR}/src/zlib # include files are in ${wxWidgets_ROOT_DIR}/src/zlib
# and the corresponding library is libwxzlib-<version>.a (like libwxzlib-2.8.a) # and the corresponding library is libwxzlib-<version>.a (like libwxzlib-2.8.a)
# and we try to use it # and we try to use it
# Unfortunately, we have no way to know exactlty the path of zlib.h becuase this file # Unfortunately, we have no way to know exactlty the path of zlib.h because this file
# is in wxWidgets sources, not in wxWidgets include path. # is in wxWidgets sources, not in wxWidgets include path.
find_path(ZLIB_INCLUDE_DIR zlib.h PATHS ${wxWidgets_ROOT_DIR}/../src/zlib/ ${wxWidgets_ROOT_DIR}/src/zlib/ DOC "location of zlib include files") find_path(ZLIB_INCLUDE_DIR
find_file(ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.8.a ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.9.a libwxzlib.a PATHS ${wxWidgets_ROOT_DIR}/lib/ PATH_SUFFIXES gcc_dll DOC "location of wxzlib library file") zlib.h
PATHS ${wxWidgets_ROOT_DIR}/../src/zlib/ ${wxWidgets_ROOT_DIR}/src/zlib/
DOC "location of zlib include files"
)
find_file(
ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.8.a
ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.9.a libwxzlib.a
PATHS ${wxWidgets_ROOT_DIR}/lib/ PATH_SUFFIXES gcc_dll
DOC "location of wxzlib library file"
)
endif(ZLIB_FOUND) endif(ZLIB_FOUND)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} include_directories(${CMAKE_CURRENT_SOURCE_DIR}
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
; General Product Description Definitions ; General Product Description Definitions
!define PRODUCT_NAME "KiCad" !define PRODUCT_NAME "KiCad"
!define PRODUCT_VERSION "2011.04.01" !define PRODUCT_VERSION "2011.04.05"
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" !define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/" !define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
!define COMPANY_NAME "" !define COMPANY_NAME ""
......
...@@ -91,6 +91,26 @@ public: ...@@ -91,6 +91,26 @@ public:
} }
}; };
// Helper class to handle hight light nets
class HIGHT_LIGHT_INFO
{
friend class BOARD;
protected:
int m_netCode; // net selected for hightlight (-1 when no net selected )
bool m_hightLightOn; // hightlight active
protected:
void Clear()
{
m_netCode = -1;
m_hightLightOn = false;
}
HIGHT_LIGHT_INFO()
{
Clear();
}
};
/** /**
* Class BOARD * Class BOARD
...@@ -109,6 +129,9 @@ private: ...@@ -109,6 +129,9 @@ private:
ZONE_CONTAINERS m_ZoneDescriptorList; ///< edge zone descriptors, owned by pointer ZONE_CONTAINERS m_ZoneDescriptorList; ///< edge zone descriptors, owned by pointer
LAYER m_Layer[NB_COPPER_LAYERS]; LAYER m_Layer[NB_COPPER_LAYERS];
// if true m_hightLight_NetCode is used
HIGHT_LIGHT_INFO m_hightLight; // current hight light data
HIGHT_LIGHT_INFO m_hightLightPrevious; // a previously stored hight light data
public: public:
PCB_BASE_FRAME* m_PcbFrame; // Window of visualization PCB_BASE_FRAME* m_PcbFrame; // Window of visualization
...@@ -249,6 +272,67 @@ public: ...@@ -249,6 +272,67 @@ public:
} }
/**
* Function ResetHightLight
* Reset all hight light data to the init state
*/
void ResetHightLight()
{
m_hightLight.Clear();
m_hightLightPrevious.Clear();
}
/**
* Function GetHightLightNetCode
* @return netcode of net to hightlight (-1 when no net selected)
*/
int GetHightLightNetCode() { return m_hightLight.m_netCode; }
/**
* Function SetHightLightNet
* @param aNetCode = netcode of net to hightlight
*/
void SetHightLightNet( int aNetCode)
{
m_hightLight.m_netCode = aNetCode;
}
/**
* Function IsHightLightNetON
* @return true if a net is currently hightlighted
*/
bool IsHightLightNetON() { return m_hightLight.m_hightLightOn; }
/**
* Function HightLightOFF
* Disable hightlight.
*/
void HightLightOFF() { m_hightLight.m_hightLightOn = false; }
/**
* Function HightLightON
* Enable hightlight.
* if m_hightLight_NetCode >= 0, this net will be hightlighted
*/
void HightLightON() { m_hightLight.m_hightLightOn = true; }
/**
* Function PushHightLight
* save current hight light info for later use
*/
void PushHightLight() { m_hightLightPrevious = m_hightLight; }
/**
* Function PopHightLight
* retrieve a previously saved hight light info
*/
void PopHightLight()
{
m_hightLight = m_hightLightPrevious;
m_hightLightPrevious.Clear();
}
/** /**
* Function GetCopperLayerCount * Function GetCopperLayerCount
* @return int - The number of copper layers in the BOARD. * @return int - The number of copper layers in the BOARD.
......
...@@ -41,6 +41,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -41,6 +41,7 @@ void RemoteCommand( const char* cmdline )
char* text; char* text;
MODULE* module = 0; MODULE* module = 0;
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*)wxGetApp().GetTopWindow(); PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*)wxGetApp().GetTopWindow();
BOARD* pcb = frame->GetBoard();
wxPoint pos; wxPoint pos;
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
...@@ -81,7 +82,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -81,7 +82,7 @@ void RemoteCommand( const char* cmdline )
modName = FROM_UTF8( text ); modName = FROM_UTF8( text );
module = frame->GetBoard()->FindModuleByReference( modName ); module = pcb->FindModuleByReference( modName );
if( module ) if( module )
pad = module->FindPadByName( pinName ); pad = module->FindPadByName( pinName );
...@@ -96,13 +97,13 @@ void RemoteCommand( const char* cmdline ) ...@@ -96,13 +97,13 @@ void RemoteCommand( const char* cmdline )
if( netcode > 0 ) /* highlight the pad net*/ if( netcode > 0 ) /* highlight the pad net*/
{ {
g_HighLight_Status = 1; pcb->HightLightON();
g_HighLight_NetCode = netcode; pcb->SetHightLightNet( netcode );
} }
else else
{ {
g_HighLight_Status = 0; pcb->HightLightOFF();
g_HighLight_NetCode = 0; pcb->SetHightLightNet( -1 );
} }
if( module == NULL ) if( module == NULL )
......
...@@ -81,7 +81,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -81,7 +81,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
{ {
DrawPanel->SetMouseCapture( NULL, NULL ); DrawPanel->SetMouseCapture( NULL, NULL );
if( g_HighLight_Status ) if( GetBoard()->IsHightLightNetON() )
High_Light( DC ); High_Light( DC );
SetCurItem( NULL ); SetCurItem( NULL );
......
...@@ -555,7 +555,6 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) ...@@ -555,7 +555,6 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
return; return;
TransfertDataToPad( &g_Pad_Master, false ); TransfertDataToPad( &g_Pad_Master, false );
g_Current_PadName = g_Pad_Master.ReturnStringPadName();
if( m_CurrentPad ) // Set current Pad parameters if( m_CurrentPad ) // Set current Pad parameters
{ {
......
...@@ -1232,7 +1232,8 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) ...@@ -1232,7 +1232,8 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
if( DisplayOpt.DisplayZonesMode != 0 ) if( DisplayOpt.DisplayZonesMode != 0 )
DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) ); DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
if( !g_HighLight_Status && (g_HighLight_NetCode > 0 ) ) if( !GetBoard()->IsHightLightNetON() &&
(GetBoard()->GetHightLightNetCode() > 0 ) )
High_Light( &dc ); High_Light( &dc );
break; break;
......
...@@ -148,7 +148,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -148,7 +148,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
via->m_Flags = IS_NEW; via->m_Flags = IS_NEW;
via->m_Shape = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType; via->m_Shape = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
via->m_Width = GetBoard()->GetCurrentViaSize(); via->m_Width = GetBoard()->GetCurrentViaSize();
via->SetNet( g_HighLight_NetCode ); via->SetNet( GetBoard()->GetHightLightNetCode() );
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End; via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
// Usual via is from copper to component. // Usual via is from copper to component.
// layer pair is LAYER_N_BACK and LAYER_N_FRONT. // layer pair is LAYER_N_BACK and LAYER_N_FRONT.
......
...@@ -22,12 +22,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -22,12 +22,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase ); const wxPoint& aPosition, bool aErase );
static void ComputeBreakPoint( TRACK* track, int n, wxPoint end ); static void ComputeBreakPoint( TRACK* track, int n, wxPoint end );
static void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList ); static void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList );
static void EnsureEndTrackOnPad( D_PAD* Pad ); static void EnsureEndTrackOnPad( D_PAD* Pad );
static int OldNetCodeSurbrillance;
static int OldEtatSurbrillance;
static PICKED_ITEMS_LIST s_ItemsListPicker; static PICKED_ITEMS_LIST s_ItemsListPicker;
...@@ -37,17 +33,18 @@ static PICKED_ITEMS_LIST s_ItemsListPicker; ...@@ -37,17 +33,18 @@ static PICKED_ITEMS_LIST s_ItemsListPicker;
static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Panel->GetParent(); PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Panel->GetParent();
BOARD * pcb = frame->GetBoard();
TRACK* track = (TRACK*) frame->GetCurItem(); TRACK* track = (TRACK*) frame->GetCurItem();
if( track && ( track->Type()==TYPE_VIA || track->Type()==TYPE_TRACK ) ) if( track && ( track->Type()==TYPE_VIA || track->Type()==TYPE_TRACK ) )
{ {
/* Erase the current drawing */ /* Erase the current drawing */
ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false ); ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false );
if( g_HighLight_Status ) if( pcb->IsHightLightNetON() )
frame->High_Light( DC ); frame->High_Light( DC );
g_HighLight_NetCode = OldNetCodeSurbrillance; pcb->PopHightLight();
if( OldEtatSurbrillance ) if( pcb->IsHightLightNetON() )
frame->High_Light( DC ); frame->High_Light( DC );
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
...@@ -95,17 +92,16 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -95,17 +92,16 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
// necessary, // necessary,
// but... // but...
/* erase old highlight */ GetBoard()->PushHightLight();
OldNetCodeSurbrillance = g_HighLight_NetCode;
OldEtatSurbrillance = g_HighLight_Status;
if( g_HighLight_Status ) // erase old highlight
if( GetBoard()->IsHightLightNetON() )
High_Light( DC ); High_Light( DC );
g_CurrentTrackList.PushBack( new TRACK( GetBoard() ) ); g_CurrentTrackList.PushBack( new TRACK( GetBoard() ) );
g_CurrentTrackSegment->m_Flags = IS_NEW; g_CurrentTrackSegment->m_Flags = IS_NEW;
g_HighLight_NetCode = 0; GetBoard()->SetHightLightNet(0);
// Search for a starting point of the new track, a track or pad // Search for a starting point of the new track, a track or pad
LockPoint = LocateLockPoint( GetBoard(), pos, masquelayer ); LockPoint = LocateLockPoint( GetBoard(), pos, masquelayer );
...@@ -118,12 +114,12 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -118,12 +114,12 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
/* A pad is found: put the starting point on pad centre */ /* A pad is found: put the starting point on pad centre */
pos = pt_pad->m_Pos; pos = pt_pad->m_Pos;
g_HighLight_NetCode = pt_pad->GetNet(); GetBoard()->SetHightLightNet( pt_pad->GetNet() );
} }
else /* A track segment is found */ else /* A track segment is found */
{ {
TrackOnStartPoint = (TRACK*) LockPoint; TrackOnStartPoint = (TRACK*) LockPoint;
g_HighLight_NetCode = TrackOnStartPoint->GetNet(); GetBoard()->SetHightLightNet( TrackOnStartPoint->GetNet() );
CreateLockPoint( GetBoard(), pos, CreateLockPoint( GetBoard(), pos,
TrackOnStartPoint, TrackOnStartPoint,
&s_ItemsListPicker ); &s_ItemsListPicker );
...@@ -136,7 +132,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -136,7 +132,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()-> m_Active_Layer ); zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()-> m_Active_Layer );
if( zone ) if( zone )
g_HighLight_NetCode = zone->GetNet(); GetBoard()->SetHightLightNet( zone->GetNet() );
} }
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
...@@ -148,7 +144,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -148,7 +144,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
High_Light( DC ); High_Light( DC );
// Display info about track Net class, and init track and vias sizes: // Display info about track Net class, and init track and vias sizes:
g_CurrentTrackSegment->SetNet( g_HighLight_NetCode ); g_CurrentTrackSegment->SetNet( GetBoard()->GetHightLightNetCode() );
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() ); GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
...@@ -467,7 +463,7 @@ void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC ) ...@@ -467,7 +463,7 @@ void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
* possibly create an anchor. */ * possibly create an anchor. */
{ {
TRACK* adr_buf = (TRACK*) LockPoint; TRACK* adr_buf = (TRACK*) LockPoint;
g_HighLight_NetCode = adr_buf->GetNet(); GetBoard()->SetHightLightNet( adr_buf->GetNet() );
/* Possible establishment of a hanging point. */ /* Possible establishment of a hanging point. */
LockPoint = CreateLockPoint( GetBoard(), LockPoint = CreateLockPoint( GetBoard(),
...@@ -529,12 +525,12 @@ void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC ) ...@@ -529,12 +525,12 @@ void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
wxASSERT( g_CurrentTrackSegment==NULL ); wxASSERT( g_CurrentTrackSegment==NULL );
wxASSERT( g_CurrentTrackList.GetCount()==0 ); wxASSERT( g_CurrentTrackList.GetCount()==0 );
if( g_HighLight_Status ) if( GetBoard()->IsHightLightNetON() )
High_Light( DC ); High_Light( DC );
g_HighLight_NetCode = OldNetCodeSurbrillance; GetBoard()->PopHightLight();
if( OldEtatSurbrillance ) if( GetBoard()->IsHightLightNetON() )
High_Light( DC ); High_Light( DC );
DrawPanel->SetMouseCapture( NULL, NULL ); DrawPanel->SetMouseCapture( NULL, NULL );
......
...@@ -52,7 +52,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) ...@@ -52,7 +52,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
GetScreen()->Init(); GetScreen()->Init();
GetScreen()->SetGrid( gridsize ); GetScreen()->SetGrid( gridsize );
g_HighLight_Status = 0; GetBoard()->ResetHightLight();
// Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled) // Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled)
GetBoard()->SetEnabledLayers(ALL_LAYERS); GetBoard()->SetEnabledLayers(ALL_LAYERS);
......
...@@ -44,7 +44,9 @@ ...@@ -44,7 +44,9 @@
#define BUTT_SIZE_Y 18 #define BUTT_SIZE_Y 18
#define BUTT_VOID 4 #define BUTT_VOID 4
/* XPM */ /* XPM
* This bitmap is used for not selected layers
*/
static const char * clear_xpm[] = { static const char * clear_xpm[] = {
"10 14 1 1", "10 14 1 1",
" c None", " c None",
...@@ -63,11 +65,38 @@ static const char * clear_xpm[] = { ...@@ -63,11 +65,38 @@ static const char * clear_xpm[] = {
" ", " ",
" "}; " "};
/* XPM */ /* XPM
* This bitmap can be used to show a not selected layer
* with special property (mainly not selected layers not in use in Gerbview)
*/
static const char * clear_alternate_xpm[] = {
"10 14 4 1",
" c None",
"X c #008080",
"o c GREEN",
"O c #00B080",
" ",
" ",
" ",
" ",
" X ",
" XXX ",
" XXXXX ",
" OOOOOOO ",
" ooooo ",
" ooo ",
" o ",
" ",
" ",
" "};
/* XPM
* This bitmap is used for a normale selected layer
*/
static const char * rightarrow_xpm[] = { static const char * rightarrow_xpm[] = {
"10 14 5 1", "10 14 4 1",
" c None", " c None",
". c white",
"X c #8080ff", "X c #8080ff",
"o c BLUE", "o c BLUE",
"O c gray56", "O c gray56",
...@@ -86,6 +115,32 @@ static const char * rightarrow_xpm[] = { ...@@ -86,6 +115,32 @@ static const char * rightarrow_xpm[] = {
" ooO ", " ooO ",
" oO "}; " oO "};
/* XPM
* This bitmap can be used to show the selected layer
* with special property (mainly a layer in use in Gerbview)
*/
static const char * rightarrow_alternate_xpm[] = {
"10 14 5 1",
" c None",
". c #00B000",
"X c #8080ff",
"o c BLUE",
"O c gray56",
"..X ",
"..XX ",
"..XXX ",
"..XXXX ",
"..XXXXX ",
"..XXXXXX ",
"..XXXXXXX ",
"..oooooooO",
"..ooooooO ",
"..oooooO ",
"..ooooO ",
"..oooO ",
"..ooO ",
"..oO "};
/** /**
* Function makeColorTxt * Function makeColorTxt
...@@ -349,7 +404,8 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) ...@@ -349,7 +404,8 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
// column 0 // column 0
col = 0; col = 0;
wxStaticBitmap* sbm = new wxStaticBitmap( m_LayerScrolledWindow, encodeId( col, aSpec.id ), wxStaticBitmap* sbm = new wxStaticBitmap( m_LayerScrolledWindow, encodeId( col, aSpec.id ),
*m_BlankBitmap, wxDefaultPosition, m_BitmapSize ); useAlternateBitmap(aRow) ? *m_BlankAlternateBitmap : *m_BlankBitmap,
wxDefaultPosition, m_BitmapSize );
sbm->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this ); sbm->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this );
m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags ); m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags );
...@@ -502,8 +558,10 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint ...@@ -502,8 +558,10 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint
m_CurrentRow = -1; // hide the arrow initially m_CurrentRow = -1; // hide the arrow initially
m_RightArrowBitmap = new wxBitmap( rightarrow_xpm ); m_RightArrowBitmap = new wxBitmap( rightarrow_xpm );
m_RightArrowAlternateBitmap = new wxBitmap( rightarrow_alternate_xpm );
m_BlankBitmap = new wxBitmap( clear_xpm ); // translucent m_BlankBitmap = new wxBitmap( clear_xpm ); // translucent
m_BlankAlternateBitmap = new wxBitmap( clear_alternate_xpm );
m_BitmapSize = wxSize(m_BlankBitmap->GetWidth(), m_BlankBitmap->GetHeight()); m_BitmapSize = wxSize(m_BlankBitmap->GetWidth(), m_BlankBitmap->GetHeight());
// trap the tab changes so that we can call passOnFocus(). // trap the tab changes so that we can call passOnFocus().
...@@ -656,12 +714,12 @@ void LAYER_WIDGET::SelectLayerRow( int aRow ) ...@@ -656,12 +714,12 @@ void LAYER_WIDGET::SelectLayerRow( int aRow )
wxStaticBitmap* oldbm = (wxStaticBitmap*) getLayerComp( m_CurrentRow, 0 ); wxStaticBitmap* oldbm = (wxStaticBitmap*) getLayerComp( m_CurrentRow, 0 );
if( oldbm ) if( oldbm )
oldbm->SetBitmap( *m_BlankBitmap ); oldbm->SetBitmap( useAlternateBitmap(m_CurrentRow) ? *m_BlankAlternateBitmap : *m_BlankBitmap );
wxStaticBitmap* newbm = (wxStaticBitmap*) getLayerComp( aRow, 0 ); wxStaticBitmap* newbm = (wxStaticBitmap*) getLayerComp( aRow, 0 );
if( newbm ) if( newbm )
{ {
newbm->SetBitmap( *m_RightArrowBitmap ); newbm->SetBitmap( useAlternateBitmap(aRow) ? *m_RightArrowAlternateBitmap : *m_RightArrowBitmap );
// Make sure the desired layer row is visible. // Make sure the desired layer row is visible.
// It seems that as of 2.8.2, setting the focus does this. // It seems that as of 2.8.2, setting the focus does this.
......
...@@ -103,13 +103,25 @@ protected: ...@@ -103,13 +103,25 @@ protected:
wxWindow* m_FocusOwner; wxWindow* m_FocusOwner;
wxBitmap* m_BlankBitmap; wxBitmap* m_BlankBitmap;
wxBitmap* m_BlankAlternateBitmap;
wxBitmap* m_RightArrowBitmap; wxBitmap* m_RightArrowBitmap;
wxBitmap* m_RightArrowAlternateBitmap;
wxSize m_BitmapSize; wxSize m_BitmapSize;
int m_CurrentRow; ///< selected row of layer list int m_CurrentRow; ///< selected row of layer list
int m_PointSize; int m_PointSize;
static wxBitmap makeBitmap( int aColor ); static wxBitmap makeBitmap( int aColor );
/**
* Virtual Function useAlternateBitmap
* @return true if bitmaps shown in Render layer list
* are alternate bitmaps, or false if they are "normal" bitmaps
* This is a virtual function because Pcbnew uses normal bitmaps
* but Gerbview uses both bitmaps
* (alternate bitmaps to show layers in use, normal fo others)
*/
virtual bool useAlternateBitmap(int aRow) { return false; }
/** /**
* Function encodeId * Function encodeId
* is here to allow saving a layer index within a control as its wxControl id, * is here to allow saving a layer index within a control as its wxControl id,
......
This diff is collapsed.
...@@ -184,13 +184,13 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -184,13 +184,13 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
*/ */
void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw ) void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
{ {
D_PAD* Pad; wxString lastPadName; // Last used pad name (pad num)
int rX, rY; lastPadName = g_Pad_Master.ReturnStringPadName();
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );
Pad = new D_PAD( Module ); D_PAD* Pad = new D_PAD( Module );
/* Add the new pad to end of the module pad list. */ /* Add the new pad to end of the module pad list. */
Module->m_Pads.PushBack( Pad ); Module->m_Pads.PushBack( Pad );
...@@ -201,29 +201,27 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw ) ...@@ -201,29 +201,27 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
Pad->m_Pos = GetScreen()->GetCrossHairPosition(); Pad->m_Pos = GetScreen()->GetCrossHairPosition();
rX = Pad->m_Pos.x - Module->m_Pos.x; // Set the relative pad position
rY = Pad->m_Pos.y - Module->m_Pos.y; // ( pad position for module orient, 0, and relative to the module position)
Pad->m_Pos0 = Pad->m_Pos - Module->m_Pos;
RotatePoint( &Pad->m_Pos0, -Module->m_Orient );
RotatePoint( &rX, &rY, -Module->m_Orient ); /* Automatically increment the current pad number. */
Pad->m_Pos0.x = rX;
Pad->m_Pos0.y = rY;
/* Automatically increment the current pad number and name. */
long num = 0; long num = 0;
int ponder = 1; int ponder = 1;
while( g_Current_PadName.Len() && g_Current_PadName.Last() >= '0' while( lastPadName.Len() && lastPadName.Last() >= '0'
&& g_Current_PadName.Last() <= '9' ) && lastPadName.Last() <= '9' )
{ {
num += ( g_Current_PadName.Last() - '0' ) * ponder; num += ( lastPadName.Last() - '0' ) * ponder;
g_Current_PadName.RemoveLast(); lastPadName.RemoveLast();
ponder *= 10; ponder *= 10;
} }
num++; num++; // Use next number for the new pad
g_Current_PadName << num; lastPadName << num;
Pad->SetPadName( g_Current_PadName ); Pad->SetPadName( lastPadName );
g_Pad_Master.SetPadName(lastPadName);
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Pad->DisplayInfo( this ); Pad->DisplayInfo( this );
......
...@@ -32,8 +32,6 @@ static bool InitialiseDragParameters(); ...@@ -32,8 +32,6 @@ static bool InitialiseDragParameters();
static wxPoint PosInit, s_LastPos; static wxPoint PosInit, s_LastPos;
static TRACK* NewTrack; /* New track or track being moved. */ static TRACK* NewTrack; /* New track or track being moved. */
static int NbPtNewTrack; static int NbPtNewTrack;
static int Old_HighLigth_NetCode;
static bool Old_HighLigt_Status;
static double s_StartSegmentSlope, s_EndSegmentSlope, static double s_StartSegmentSlope, s_EndSegmentSlope,
s_MovingSegmentSlope, s_MovingSegmentSlope,
s_StartSegment_Yorg, s_EndSegment_Yorg, s_StartSegment_Yorg, s_EndSegment_Yorg,
...@@ -54,6 +52,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -54,6 +52,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
TRACK* NextS; TRACK* NextS;
int ii; int ii;
BOARD * pcb = ( (PCB_EDIT_FRAME*) Panel->GetParent() )->GetBoard();
/* Erase the current drawings */ /* Erase the current drawings */
wxPoint oldpos = Panel->GetScreen()->GetCrossHairPosition(); wxPoint oldpos = Panel->GetScreen()->GetCrossHairPosition();
...@@ -64,10 +63,8 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -64,10 +63,8 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true ); Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->SetCrossHairPosition( oldpos ); Panel->GetScreen()->SetCrossHairPosition( oldpos );
g_HighLight_Status = false; pcb->HightLightOFF();
( (PCB_EDIT_FRAME*) Panel->GetParent() )->GetBoard()->DrawHighLight( Panel, pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() );
DC,
g_HighLight_NetCode );
if( NewTrack ) if( NewTrack )
{ {
...@@ -122,11 +119,10 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -122,11 +119,10 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
// Clear the undo picker list: // Clear the undo picker list:
s_ItemsListPicker.ClearListAndDeleteItems(); s_ItemsListPicker.ClearListAndDeleteItems();
g_HighLight_NetCode = Old_HighLigth_NetCode; pcb->PopHightLight();
g_HighLight_Status = Old_HighLigt_Status;
if( g_HighLight_Status ) if( pcb->IsHightLightNetON() )
( (PCB_EDIT_FRAME*) Panel->GetParent() )->GetBoard()->DrawHighLight( pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() );
Panel, DC, g_HighLight_NetCode );
EraseDragList(); EraseDragList();
Panel->SetMouseCapture( NULL, NULL ); Panel->SetMouseCapture( NULL, NULL );
...@@ -665,9 +661,9 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com ...@@ -665,9 +661,9 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
EraseDragList(); EraseDragList();
/* Change highlighted net: the new one will be highlighted */ /* Change highlighted net: the new one will be highlighted */
Old_HighLigt_Status = g_HighLight_Status; GetBoard()->PushHightLight();
Old_HighLigth_NetCode = g_HighLight_NetCode;
if( g_HighLight_Status ) if( GetBoard()->IsHightLightNetON() )
High_Light( DC ); High_Light( DC );
PosInit = GetScreen()->GetCrossHairPosition(); PosInit = GetScreen()->GetCrossHairPosition();
...@@ -738,10 +734,10 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com ...@@ -738,10 +734,10 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
s_LastPos = PosInit; s_LastPos = PosInit;
DrawPanel->SetMouseCapture( Show_MoveNode, Abort_MoveTrack ); DrawPanel->SetMouseCapture( Show_MoveNode, Abort_MoveTrack );
g_HighLight_NetCode = track->GetNet(); GetBoard()->SetHightLightNet( track->GetNet() );
g_HighLight_Status = true; GetBoard()->HightLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode ); GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
} }
...@@ -902,9 +898,8 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ...@@ -902,9 +898,8 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
s_EndSegmentPresent = false; s_EndSegmentPresent = false;
/* Change high light net: the new one will be highlighted */ /* Change high light net: the new one will be highlighted */
Old_HighLigt_Status = g_HighLight_Status; GetBoard()->PushHightLight();
Old_HighLigth_NetCode = g_HighLight_NetCode; if( GetBoard()->IsHightLightNetON() )
if( g_HighLight_Status )
High_Light( DC ); High_Light( DC );
EraseDragList(); EraseDragList();
...@@ -938,9 +933,9 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ...@@ -938,9 +933,9 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
s_LastPos = GetScreen()->GetCrossHairPosition(); s_LastPos = GetScreen()->GetCrossHairPosition();
DrawPanel->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack ); DrawPanel->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack );
g_HighLight_NetCode = track->GetNet(); GetBoard()->SetHightLightNet( track->GetNet() );
g_HighLight_Status = true; GetBoard()->HightLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode ); GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
// Prepare the Undo command // Prepare the Undo command
ITEM_PICKER picker( NULL, UR_CHANGED ); ITEM_PICKER picker( NULL, UR_CHANGED );
......
...@@ -61,7 +61,6 @@ int g_MagneticTrackOption = capture_cursor_in_track_tool; ...@@ -61,7 +61,6 @@ int g_MagneticTrackOption = capture_cursor_in_track_tool;
int g_HighLight_NetCode = -1; int g_HighLight_NetCode = -1;
wxPoint g_Offset_Module; /* Offset de trace du modul en depl */ wxPoint g_Offset_Module; /* Offset de trace du modul en depl */
wxString g_Current_PadName; // Last used pad name (pad num)
// Wildcard for footprint libraries filesnames // Wildcard for footprint libraries filesnames
const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (*.mod)|*.mod" ) ); const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (*.mod)|*.mod" ) );
......
...@@ -69,14 +69,8 @@ extern bool g_TwoSegmentTrackBuild; ...@@ -69,14 +69,8 @@ extern bool g_TwoSegmentTrackBuild;
extern int g_MagneticPadOption; extern int g_MagneticPadOption;
extern int g_MagneticTrackOption; extern int g_MagneticTrackOption;
/* Variables to handle highlight nets */
extern bool g_HighLight_Status;
extern int g_HighLight_NetCode;
extern wxPoint g_Offset_Module; /* Offset de trace du modul en depl */ extern wxPoint g_Offset_Module; /* Offset de trace du modul en depl */
extern wxString g_Current_PadName; // Last used pad name (pad num)
enum MagneticPadOptionValues { enum MagneticPadOptionValues {
no_effect, no_effect,
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
/*******************/ /*******************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -80,10 +78,10 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event ) ...@@ -80,10 +78,10 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
{ {
INSTALL_UNBUFFERED_DC( dc, DrawPanel ); INSTALL_UNBUFFERED_DC( dc, DrawPanel );
if( g_HighLight_Status ) if( GetBoard()->IsHightLightNetON() )
High_Light( &dc ); High_Light( &dc );
g_HighLight_NetCode = netcode; GetBoard()->SetHightLightNet( netcode );
High_Light( &dc ); High_Light( &dc );
} }
} }
...@@ -94,7 +92,8 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event ) ...@@ -94,7 +92,8 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
*/ */
int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC ) int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC )
{ {
if( g_HighLight_Status ) int netcode = -1;
if( GetBoard()->IsHightLightNetON() )
High_Light( DC ); High_Light( DC );
// use this scheme because a pad is a higher priority than a track in the // use this scheme because a pad is a higher priority than a track in the
...@@ -115,33 +114,35 @@ int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC ) ...@@ -115,33 +114,35 @@ int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC )
switch( item->Type() ) switch( item->Type() )
{ {
case TYPE_PAD: case TYPE_PAD:
g_HighLight_NetCode = ( (D_PAD*) item )->GetNet(); netcode = ( (D_PAD*) item )->GetNet();
High_Light( DC );
SendMessageToEESCHEMA( item ); SendMessageToEESCHEMA( item );
return g_HighLight_NetCode; break;
case TYPE_TRACK: case TYPE_TRACK:
case TYPE_VIA: case TYPE_VIA:
case TYPE_ZONE: case TYPE_ZONE:
// since these classes are all derived from TRACK, use a common // since these classes are all derived from TRACK, use a common
// GetNet() function: // GetNet() function:
g_HighLight_NetCode = ( (TRACK*) item )->GetNet(); netcode = ( (TRACK*) item )->GetNet();
High_Light( DC ); break;
return g_HighLight_NetCode;
case TYPE_ZONE_CONTAINER: case TYPE_ZONE_CONTAINER:
g_HighLight_NetCode = ( (ZONE_CONTAINER*) item )->GetNet(); netcode = ( (ZONE_CONTAINER*) item )->GetNet();
High_Light( DC ); break;
return g_HighLight_NetCode;
default: default:
; // until somebody changes GENERAL_COLLECTOR::PadsOrTracks, ; // until somebody changes GENERAL_COLLECTOR::PadsOrTracks,
// this should not happen. // this should not happen.
} }
} }
if( netcode >= 0 )
{
GetBoard()->SetHightLightNet( netcode );
High_Light( DC );
}
return -1; // HitTest() failed. return netcode; // HitTest() failed.
} }
...@@ -152,7 +153,10 @@ int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC ) ...@@ -152,7 +153,10 @@ int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC )
*/ */
void PCB_EDIT_FRAME::High_Light( wxDC* DC ) void PCB_EDIT_FRAME::High_Light( wxDC* DC )
{ {
g_HighLight_Status = !g_HighLight_Status; if( GetBoard()->IsHightLightNetON() )
GetBoard()->HightLightOFF();
else
GetBoard()->HightLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode ); GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
} }
...@@ -198,8 +198,8 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, ...@@ -198,8 +198,8 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC,
} }
// @todo: this high-light functionality could be built into me. // @todo: this high-light functionality could be built into me.
if( g_HighLight_Status ) if( IsHightLightNetON() )
DrawHighLight( aPanel, DC, g_HighLight_NetCode ); DrawHighLight( aPanel, DC, GetHightLightNetCode() );
// draw the BOARD's markers last, otherwise the high light will erase // draw the BOARD's markers last, otherwise the high light will erase
// any marker on a pad // any marker on a pad
...@@ -214,22 +214,11 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode ) ...@@ -214,22 +214,11 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode )
{ {
int draw_mode; int draw_mode;
if( g_HighLight_Status ) if( IsHightLightNetON() )
draw_mode = GR_SURBRILL | GR_OR; draw_mode = GR_SURBRILL | GR_OR;
else else
draw_mode = GR_AND | GR_SURBRILL; draw_mode = GR_AND | GR_SURBRILL;
#if 0 // does not unhighlight properly
// redraw the zones with the aNetCode
for( SEGZONE* zone = m_Zone; zone; zone = zone->Next() )
{
if( zone->GetNet() == aNetCode )
{
zone->Draw( aDrawPanel, DC, draw_mode );
}
}
#endif
// Redraw ZONE_CONTAINERS // Redraw ZONE_CONTAINERS
BOARD::ZONE_CONTAINERS& zones = m_ZoneDescriptorList; BOARD::ZONE_CONTAINERS& zones = m_ZoneDescriptorList;
for( BOARD::ZONE_CONTAINERS::iterator zc = zones.begin(); zc!=zones.end(); ++zc ) for( BOARD::ZONE_CONTAINERS::iterator zc = zones.begin(); zc!=zones.end(); ++zc )
......
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: zones_by_polygon.cpp // Name: zones_by_polygon.cpp
// Licence: GPL License // Licence: GPL License
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
...@@ -172,12 +171,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont ...@@ -172,12 +171,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont
{ {
if( zone_container->IsOnCopperLayer() ) /* Show the Net */ if( zone_container->IsOnCopperLayer() ) /* Show the Net */
{ {
if( g_HighLight_Status && DC ) if( GetBoard()->IsHightLightNetON() && DC )
{ {
High_Light( DC ); // Remove old hightlight selection High_Light( DC ); // Remove old hightlight selection
} }
g_HighLight_NetCode = g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet(); g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet();
GetBoard()->SetHightLightNet( zone_container->GetNet() );
if( DC ) if( DC )
High_Light( DC ); High_Light( DC );
} }
...@@ -246,12 +246,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co ...@@ -246,12 +246,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co
/* Show the Net */ /* Show the Net */
if( zone_container->IsOnCopperLayer() ) /* Show the Net */ if( zone_container->IsOnCopperLayer() ) /* Show the Net */
{ {
if( g_HighLight_Status ) if( GetBoard()->IsHightLightNetON() )
{ {
High_Light( DC ); // Remove old hightlight selection High_Light( DC ); // Remove old hightlight selection
} }
g_HighLight_NetCode = g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet(); g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet();
GetBoard()->SetHightLightNet( zone_container->GetNet() );
High_Light( DC ); High_Light( DC );
} }
...@@ -507,9 +508,10 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) ...@@ -507,9 +508,10 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
if( zone->IsOnCopperLayer() ) if( zone->IsOnCopperLayer() )
{ // Put a zone on a copper layer { // Put a zone on a copper layer
if ( g_HighLight_NetCode ) if ( GetBoard()->GetHightLightNetCode() > 0 )
{ {
g_Zone_Default_Setting.m_NetcodeSelection = g_HighLight_NetCode; g_Zone_Default_Setting.m_NetcodeSelection = GetBoard()->GetHightLightNetCode();
zone->SetNet( g_Zone_Default_Setting.m_NetcodeSelection ); zone->SetNet( g_Zone_Default_Setting.m_NetcodeSelection );
zone->SetNetNameFromNetCode( ); zone->SetNetNameFromNetCode( );
} }
...@@ -550,12 +552,12 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) ...@@ -550,12 +552,12 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
{ {
if( s_CurrentZone ) if( s_CurrentZone )
g_Zone_Default_Setting.m_NetcodeSelection = s_CurrentZone->GetNet(); g_Zone_Default_Setting.m_NetcodeSelection = s_CurrentZone->GetNet();
if( g_HighLight_Status ) if( GetBoard()->IsHightLightNetON() )
{ {
High_Light( DC ); // Remove old hightlight selection High_Light( DC ); // Remove old hightlight selection
} }
g_HighLight_NetCode = g_Zone_Default_Setting.m_NetcodeSelection; GetBoard()->SetHightLightNet( g_Zone_Default_Setting.m_NetcodeSelection );
High_Light( DC ); High_Light( DC );
} }
if( !s_AddCutoutToCurrentZone ) if( !s_AddCutoutToCurrentZone )
......
release version: release version:
2011 apr 01 2011 apr 05
files (.zip,.tgz): files (.zip,.tgz):
kicad-2011-04-01 kicad-2011-04-05
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