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
......@@ -10,13 +10,35 @@ More native OSX changes, this removes some WXMAC defines replaced by wxID
macros. These are handled by wxWidgets itself and reduces in-app platform
defines. More work needs to be done for CvPCB and Gerbview.
All:
All:
Hotkey names in menu's all have tabs, this looks more uniform and pretty.
EESschema & PCBNew:
Fix about and preferences wxMenu to be more native (remove unneeded WXMAC )
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>
================================================================================
Gerbview:
......
......@@ -416,6 +416,7 @@ set(BITMAP_SRCS
Width_Track_Via.xpm
Width_Track.xpm
Width_Vias.xpm
window_close.xpm
zip_tool.xpm
zip.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 @@
#endif
#ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2011-04-01)"
#define KICAD_BUILD_VERSION "(2011-04-05)"
#endif
// uncomment this line only when creating a stable version
......
......@@ -74,6 +74,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
_( "Prevent CVPcb from exiting after saving netlist file" ),
wxITEM_CHECK );
configmenu->Append( item );
SETBITMAPS( window_close_xpm );
configmenu->AppendSeparator();
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 )
void GERBER_IMAGE::ResetDefaultValues()
{
m_InUse = false;
m_GBRLayerParams.ResetDefaultValues();
m_FileName.Empty();
m_ImageName = wxT( "no name" ); // Image name from the IN command
......
......@@ -82,6 +82,8 @@ class GERBER_IMAGE
GERBER_LAYER m_GBRLayerParams; // hold params for the current gerber layer
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_ImageName; // Image name, from IN <name>* command
int m_GraphicLayer; // Graphic layer Number
......
......@@ -33,6 +33,7 @@
#include "class_drawpanel.h"
#include "pcbstruct.h"
#include "gerbview.h"
#include "class_GERBER.h"
#include "layer_widget.h"
#include "class_gerbview_layer_widget.h"
......@@ -238,4 +239,37 @@ void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
//-----</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
/// on every child control within the layer panel.
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:
/**
......@@ -86,6 +93,13 @@ public:
*/
void SetLayersManagerTabsText( );
//-----</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_
......@@ -183,8 +183,8 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
// Synchronize layers tools with actual active layer:
setActiveLayer( getActiveLayer() );
m_LayersManager->UpdateLayerIcons();
syncLayerBox();
return true;
}
......@@ -268,6 +268,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
// Synchronize layers tools with actual active layer:
setActiveLayer( getActiveLayer() );
m_LayersManager->UpdateLayerIcons();
syncLayerBox();
return true;
......
......@@ -46,6 +46,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
SetScreen( ScreenPcb );
GetScreen()->Init();
setActiveLayer(FIRST_COPPER_LAYER);
m_LayersManager->UpdateLayerIcons();
syncLayerBox();
return TRUE;
}
......@@ -81,5 +82,6 @@ void GERBVIEW_FRAME::Erase_Current_Layer( bool query )
ScreenPcb->SetModify();
DrawPanel->Refresh();
m_LayersManager->UpdateLayerIcons();
syncLayerBox();
}
......@@ -151,6 +151,8 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
fclose( gerber->m_Current_File );
SetLocaleTo_Default();
gerber->m_InUse = true;
// Display errors list
if( m_Messages.size() > 0 )
{
......
......@@ -412,6 +412,7 @@ extern const char* width_segment_xpm[];
extern const char* width_track_via_xpm[];
extern const char* width_track_xpm[];
extern const char* width_vias_xpm[];
extern const char* window_close_xpm[];
extern const char* zip_tool_xpm[];
extern const char* zip_xpm[];
extern const char* zoom_area_xpm[];
......
......@@ -237,10 +237,18 @@ static inline void ADD_MENUITEM_WITH_HELP_AND_SUBMENU( wxMenu* menu,
#endif
// macro to add a bitmap list to check menus (do not use with normal menus)
#ifdef __WINDOWS__
# define SETBITMAPS( icon ) item->SetBitmaps( apply_xpm, (icon) )
#else
# define SETBITMAPS( icon )
#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 */
......@@ -49,8 +49,6 @@ extern PCB_SCREEN* ScreenPcb;
extern BOARD* g_ModuleEditor_Pcb;
/* Pad editing */
extern wxString g_Current_PadName; // Last used pad name (pad num)
extern D_PAD g_Pad_Master;
#endif /* __PCBCOMMON_H__ */
......@@ -8,10 +8,20 @@ else(ZLIB_FOUND)
# include files are in ${wxWidgets_ROOT_DIR}/src/zlib
# and the corresponding library is libwxzlib-<version>.a (like libwxzlib-2.8.a)
# 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.
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_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")
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_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)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
......
......@@ -17,7 +17,7 @@
; General Product Description Definitions
!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 SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
!define COMPANY_NAME ""
......
......@@ -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
......@@ -109,6 +129,9 @@ private:
ZONE_CONTAINERS m_ZoneDescriptorList; ///< edge zone descriptors, owned by pointer
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:
PCB_BASE_FRAME* m_PcbFrame; // Window of visualization
......@@ -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
* @return int - The number of copper layers in the BOARD.
......
......@@ -41,6 +41,7 @@ void RemoteCommand( const char* cmdline )
char* text;
MODULE* module = 0;
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*)wxGetApp().GetTopWindow();
BOARD* pcb = frame->GetBoard();
wxPoint pos;
strncpy( line, cmdline, sizeof(line) - 1 );
......@@ -81,7 +82,7 @@ void RemoteCommand( const char* cmdline )
modName = FROM_UTF8( text );
module = frame->GetBoard()->FindModuleByReference( modName );
module = pcb->FindModuleByReference( modName );
if( module )
pad = module->FindPadByName( pinName );
......@@ -96,13 +97,13 @@ void RemoteCommand( const char* cmdline )
if( netcode > 0 ) /* highlight the pad net*/
{
g_HighLight_Status = 1;
g_HighLight_NetCode = netcode;
pcb->HightLightON();
pcb->SetHightLightNet( netcode );
}
else
{
g_HighLight_Status = 0;
g_HighLight_NetCode = 0;
pcb->HightLightOFF();
pcb->SetHightLightNet( -1 );
}
if( module == NULL )
......
......@@ -81,7 +81,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
{
DrawPanel->SetMouseCapture( NULL, NULL );
if( g_HighLight_Status )
if( GetBoard()->IsHightLightNetON() )
High_Light( DC );
SetCurItem( NULL );
......
......@@ -555,7 +555,6 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
return;
TransfertDataToPad( &g_Pad_Master, false );
g_Current_PadName = g_Pad_Master.ReturnStringPadName();
if( m_CurrentPad ) // Set current Pad parameters
{
......
......@@ -1232,7 +1232,8 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
if( DisplayOpt.DisplayZonesMode != 0 )
DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
if( !g_HighLight_Status && (g_HighLight_NetCode > 0 ) )
if( !GetBoard()->IsHightLightNetON() &&
(GetBoard()->GetHightLightNetCode() > 0 ) )
High_Light( &dc );
break;
......
......@@ -148,7 +148,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
via->m_Flags = IS_NEW;
via->m_Shape = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
via->m_Width = GetBoard()->GetCurrentViaSize();
via->SetNet( g_HighLight_NetCode );
via->SetNet( GetBoard()->GetHightLightNetCode() );
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
// Usual via is from copper to component.
// layer pair is LAYER_N_BACK and LAYER_N_FRONT.
......
......@@ -22,12 +22,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase );
static void ComputeBreakPoint( TRACK* track, int n, wxPoint end );
static void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList );
static void EnsureEndTrackOnPad( D_PAD* Pad );
static int OldNetCodeSurbrillance;
static int OldEtatSurbrillance;
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 )
{
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Panel->GetParent();
BOARD * pcb = frame->GetBoard();
TRACK* track = (TRACK*) frame->GetCurItem();
if( track && ( track->Type()==TYPE_VIA || track->Type()==TYPE_TRACK ) )
{
/* Erase the current drawing */
ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false );
if( g_HighLight_Status )
if( pcb->IsHightLightNetON() )
frame->High_Light( DC );
g_HighLight_NetCode = OldNetCodeSurbrillance;
if( OldEtatSurbrillance )
pcb->PopHightLight();
if( pcb->IsHightLightNetON() )
frame->High_Light( DC );
frame->MsgPanel->EraseMsgBox();
......@@ -95,17 +92,16 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
// necessary,
// but...
/* erase old highlight */
OldNetCodeSurbrillance = g_HighLight_NetCode;
OldEtatSurbrillance = g_HighLight_Status;
GetBoard()->PushHightLight();
if( g_HighLight_Status )
// erase old highlight
if( GetBoard()->IsHightLightNetON() )
High_Light( DC );
g_CurrentTrackList.PushBack( new TRACK( GetBoard() ) );
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
LockPoint = LocateLockPoint( GetBoard(), pos, masquelayer );
......@@ -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 */
pos = pt_pad->m_Pos;
g_HighLight_NetCode = pt_pad->GetNet();
GetBoard()->SetHightLightNet( pt_pad->GetNet() );
}
else /* A track segment is found */
{
TrackOnStartPoint = (TRACK*) LockPoint;
g_HighLight_NetCode = TrackOnStartPoint->GetNet();
GetBoard()->SetHightLightNet( TrackOnStartPoint->GetNet() );
CreateLockPoint( GetBoard(), pos,
TrackOnStartPoint,
&s_ItemsListPicker );
......@@ -136,7 +132,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()-> m_Active_Layer );
if( zone )
g_HighLight_NetCode = zone->GetNet();
GetBoard()->SetHightLightNet( zone->GetNet() );
}
D( g_CurrentTrackList.VerifyListIntegrity(); );
......@@ -148,7 +144,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
High_Light( DC );
// 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() );
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
......@@ -467,7 +463,7 @@ void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
* possibly create an anchor. */
{
TRACK* adr_buf = (TRACK*) LockPoint;
g_HighLight_NetCode = adr_buf->GetNet();
GetBoard()->SetHightLightNet( adr_buf->GetNet() );
/* Possible establishment of a hanging point. */
LockPoint = CreateLockPoint( GetBoard(),
......@@ -529,12 +525,12 @@ void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
wxASSERT( g_CurrentTrackSegment==NULL );
wxASSERT( g_CurrentTrackList.GetCount()==0 );
if( g_HighLight_Status )
if( GetBoard()->IsHightLightNetON() )
High_Light( DC );
g_HighLight_NetCode = OldNetCodeSurbrillance;
GetBoard()->PopHightLight();
if( OldEtatSurbrillance )
if( GetBoard()->IsHightLightNetON() )
High_Light( DC );
DrawPanel->SetMouseCapture( NULL, NULL );
......
......@@ -52,7 +52,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
GetScreen()->Init();
GetScreen()->SetGrid( gridsize );
g_HighLight_Status = 0;
GetBoard()->ResetHightLight();
// Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled)
GetBoard()->SetEnabledLayers(ALL_LAYERS);
......
......@@ -44,7 +44,9 @@
#define BUTT_SIZE_Y 18
#define BUTT_VOID 4
/* XPM */
/* XPM
* This bitmap is used for not selected layers
*/
static const char * clear_xpm[] = {
"10 14 1 1",
" c None",
......@@ -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[] = {
"10 14 5 1",
"10 14 4 1",
" c None",
". c white",
"X c #8080ff",
"o c BLUE",
"O c gray56",
......@@ -86,6 +115,32 @@ static const char * rightarrow_xpm[] = {
" ooO ",
" 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
......@@ -349,7 +404,8 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
// column 0
col = 0;
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 );
m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags );
......@@ -502,8 +558,10 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint
m_CurrentRow = -1; // hide the arrow initially
m_RightArrowBitmap = new wxBitmap( rightarrow_xpm );
m_RightArrowAlternateBitmap = new wxBitmap( rightarrow_alternate_xpm );
m_BlankBitmap = new wxBitmap( clear_xpm ); // translucent
m_BlankAlternateBitmap = new wxBitmap( clear_alternate_xpm );
m_BitmapSize = wxSize(m_BlankBitmap->GetWidth(), m_BlankBitmap->GetHeight());
// trap the tab changes so that we can call passOnFocus().
......@@ -656,12 +714,12 @@ void LAYER_WIDGET::SelectLayerRow( int aRow )
wxStaticBitmap* oldbm = (wxStaticBitmap*) getLayerComp( m_CurrentRow, 0 );
if( oldbm )
oldbm->SetBitmap( *m_BlankBitmap );
oldbm->SetBitmap( useAlternateBitmap(m_CurrentRow) ? *m_BlankAlternateBitmap : *m_BlankBitmap );
wxStaticBitmap* newbm = (wxStaticBitmap*) getLayerComp( aRow, 0 );
if( newbm )
{
newbm->SetBitmap( *m_RightArrowBitmap );
newbm->SetBitmap( useAlternateBitmap(aRow) ? *m_RightArrowAlternateBitmap : *m_RightArrowBitmap );
// Make sure the desired layer row is visible.
// It seems that as of 2.8.2, setting the focus does this.
......
......@@ -103,13 +103,25 @@ protected:
wxWindow* m_FocusOwner;
wxBitmap* m_BlankBitmap;
wxBitmap* m_BlankAlternateBitmap;
wxBitmap* m_RightArrowBitmap;
wxBitmap* m_RightArrowAlternateBitmap;
wxSize m_BitmapSize;
int m_CurrentRow; ///< selected row of layer list
int m_PointSize;
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
* 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 )
*/
void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
{
D_PAD* Pad;
int rX, rY;
wxString lastPadName; // Last used pad name (pad num)
lastPadName = g_Pad_Master.ReturnStringPadName();
m_Pcb->m_Status_Pcb = 0;
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. */
Module->m_Pads.PushBack( Pad );
......@@ -201,29 +201,27 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
Pad->m_Pos = GetScreen()->GetCrossHairPosition();
rX = Pad->m_Pos.x - Module->m_Pos.x;
rY = Pad->m_Pos.y - Module->m_Pos.y;
// Set the relative pad position
// ( 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 );
Pad->m_Pos0.x = rX;
Pad->m_Pos0.y = rY;
/* Automatically increment the current pad number and name. */
/* Automatically increment the current pad number. */
long num = 0;
int ponder = 1;
while( g_Current_PadName.Len() && g_Current_PadName.Last() >= '0'
&& g_Current_PadName.Last() <= '9' )
while( lastPadName.Len() && lastPadName.Last() >= '0'
&& lastPadName.Last() <= '9' )
{
num += ( g_Current_PadName.Last() - '0' ) * ponder;
g_Current_PadName.RemoveLast();
num += ( lastPadName.Last() - '0' ) * ponder;
lastPadName.RemoveLast();
ponder *= 10;
}
num++;
g_Current_PadName << num;
Pad->SetPadName( g_Current_PadName );
num++; // Use next number for the new pad
lastPadName << num;
Pad->SetPadName( lastPadName );
g_Pad_Master.SetPadName(lastPadName);
Module->Set_Rectangle_Encadrement();
Pad->DisplayInfo( this );
......
......@@ -32,8 +32,6 @@ static bool InitialiseDragParameters();
static wxPoint PosInit, s_LastPos;
static TRACK* NewTrack; /* New track or track being moved. */
static int NbPtNewTrack;
static int Old_HighLigth_NetCode;
static bool Old_HighLigt_Status;
static double s_StartSegmentSlope, s_EndSegmentSlope,
s_MovingSegmentSlope,
s_StartSegment_Yorg, s_EndSegment_Yorg,
......@@ -54,6 +52,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
TRACK* NextS;
int ii;
BOARD * pcb = ( (PCB_EDIT_FRAME*) Panel->GetParent() )->GetBoard();
/* Erase the current drawings */
wxPoint oldpos = Panel->GetScreen()->GetCrossHairPosition();
......@@ -64,10 +63,8 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->SetCrossHairPosition( oldpos );
g_HighLight_Status = false;
( (PCB_EDIT_FRAME*) Panel->GetParent() )->GetBoard()->DrawHighLight( Panel,
DC,
g_HighLight_NetCode );
pcb->HightLightOFF();
pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() );
if( NewTrack )
{
......@@ -122,11 +119,10 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
// Clear the undo picker list:
s_ItemsListPicker.ClearListAndDeleteItems();
g_HighLight_NetCode = Old_HighLigth_NetCode;
g_HighLight_Status = Old_HighLigt_Status;
if( g_HighLight_Status )
( (PCB_EDIT_FRAME*) Panel->GetParent() )->GetBoard()->DrawHighLight(
Panel, DC, g_HighLight_NetCode );
pcb->PopHightLight();
if( pcb->IsHightLightNetON() )
pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() );
EraseDragList();
Panel->SetMouseCapture( NULL, NULL );
......@@ -665,9 +661,9 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
EraseDragList();
/* Change highlighted net: the new one will be highlighted */
Old_HighLigt_Status = g_HighLight_Status;
Old_HighLigth_NetCode = g_HighLight_NetCode;
if( g_HighLight_Status )
GetBoard()->PushHightLight();
if( GetBoard()->IsHightLightNetON() )
High_Light( DC );
PosInit = GetScreen()->GetCrossHairPosition();
......@@ -738,10 +734,10 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
s_LastPos = PosInit;
DrawPanel->SetMouseCapture( Show_MoveNode, Abort_MoveTrack );
g_HighLight_NetCode = track->GetNet();
g_HighLight_Status = true;
GetBoard()->SetHightLightNet( track->GetNet() );
GetBoard()->HightLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode );
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
}
......@@ -902,9 +898,8 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
s_EndSegmentPresent = false;
/* Change high light net: the new one will be highlighted */
Old_HighLigt_Status = g_HighLight_Status;
Old_HighLigth_NetCode = g_HighLight_NetCode;
if( g_HighLight_Status )
GetBoard()->PushHightLight();
if( GetBoard()->IsHightLightNetON() )
High_Light( DC );
EraseDragList();
......@@ -938,9 +933,9 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
s_LastPos = GetScreen()->GetCrossHairPosition();
DrawPanel->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack );
g_HighLight_NetCode = track->GetNet();
g_HighLight_Status = true;
GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode );
GetBoard()->SetHightLightNet( track->GetNet() );
GetBoard()->HightLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
// Prepare the Undo command
ITEM_PICKER picker( NULL, UR_CHANGED );
......
......@@ -61,7 +61,6 @@ int g_MagneticTrackOption = capture_cursor_in_track_tool;
int g_HighLight_NetCode = -1;
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
const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (*.mod)|*.mod" ) );
......
......@@ -69,14 +69,8 @@ extern bool g_TwoSegmentTrackBuild;
extern int g_MagneticPadOption;
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 wxString g_Current_PadName; // Last used pad name (pad num)
enum MagneticPadOptionValues {
no_effect,
......
......@@ -3,9 +3,7 @@
/*******************/
#include "fctsys.h"
#include "gr_basic.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "kicad_string.h"
#include "pcbnew.h"
......@@ -80,10 +78,10 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
{
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
if( g_HighLight_Status )
if( GetBoard()->IsHightLightNetON() )
High_Light( &dc );
g_HighLight_NetCode = netcode;
GetBoard()->SetHightLightNet( netcode );
High_Light( &dc );
}
}
......@@ -94,7 +92,8 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
*/
int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC )
{
if( g_HighLight_Status )
int netcode = -1;
if( GetBoard()->IsHightLightNetON() )
High_Light( DC );
// 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 )
switch( item->Type() )
{
case TYPE_PAD:
g_HighLight_NetCode = ( (D_PAD*) item )->GetNet();
High_Light( DC );
netcode = ( (D_PAD*) item )->GetNet();
SendMessageToEESCHEMA( item );
return g_HighLight_NetCode;
break;
case TYPE_TRACK:
case TYPE_VIA:
case TYPE_ZONE:
// since these classes are all derived from TRACK, use a common
// GetNet() function:
g_HighLight_NetCode = ( (TRACK*) item )->GetNet();
High_Light( DC );
return g_HighLight_NetCode;
netcode = ( (TRACK*) item )->GetNet();
break;
case TYPE_ZONE_CONTAINER:
g_HighLight_NetCode = ( (ZONE_CONTAINER*) item )->GetNet();
High_Light( DC );
return g_HighLight_NetCode;
netcode = ( (ZONE_CONTAINER*) item )->GetNet();
break;
default:
; // until somebody changes GENERAL_COLLECTOR::PadsOrTracks,
// 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 )
*/
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,
}
// @todo: this high-light functionality could be built into me.
if( g_HighLight_Status )
DrawHighLight( aPanel, DC, g_HighLight_NetCode );
if( IsHightLightNetON() )
DrawHighLight( aPanel, DC, GetHightLightNetCode() );
// draw the BOARD's markers last, otherwise the high light will erase
// any marker on a pad
......@@ -214,22 +214,11 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode )
{
int draw_mode;
if( g_HighLight_Status )
if( IsHightLightNetON() )
draw_mode = GR_SURBRILL | GR_OR;
else
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
BOARD::ZONE_CONTAINERS& zones = m_ZoneDescriptorList;
for( BOARD::ZONE_CONTAINERS::iterator zc = zones.begin(); zc!=zones.end(); ++zc )
......@@ -241,7 +230,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode )
}
// Redraw any pads that have aNetCode
for( MODULE* module = m_Modules; module; module = module->Next() )
for( MODULE* module = m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
......
/////////////////////////////////////////////////////////////////////////////
// Name: zones_by_polygon.cpp
// Licence: GPL License
/////////////////////////////////////////////////////////////////////////////
......@@ -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( g_HighLight_Status && DC )
if( GetBoard()->IsHightLightNetON() && DC )
{
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 )
High_Light( DC );
}
......@@ -246,12 +246,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co
/* Show the Net */
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
{
if( g_HighLight_Status )
if( GetBoard()->IsHightLightNetON() )
{
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 );
}
......@@ -507,9 +508,10 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
DrawPanel->m_IgnoreMouseEvents = TRUE;
if( zone->IsOnCopperLayer() )
{ // 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->SetNetNameFromNetCode( );
}
......@@ -550,12 +552,12 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
{
if( s_CurrentZone )
g_Zone_Default_Setting.m_NetcodeSelection = s_CurrentZone->GetNet();
if( g_HighLight_Status )
if( GetBoard()->IsHightLightNetON() )
{
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 );
}
if( !s_AddCutoutToCurrentZone )
......
release version:
2011 apr 01
2011 apr 05
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