Commit 2d2c73ef authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: fix a bug that prevents duplicate timestamps to be corrected by annotate function.

very minor enhancement in netlist dialog.
Gerbview: remove useless  code I wrote specific to Windows in BOARD::Draw()  function, because Wayne has fixed the bug.
common_plotPS_functions.cpp: remove a potential bug.
Rename some classes according to coding style policy.
parents e01f8967 e3637dd3
...@@ -426,16 +426,17 @@ void PS_PLOTTER::flash_pad_circle( wxPoint pos, int diametre, ...@@ -426,16 +426,17 @@ void PS_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
GRTraceMode modetrace ) GRTraceMode modetrace )
{ {
wxASSERT( output_file ); wxASSERT( output_file );
if( modetrace == FILLED )
{
set_current_line_width( -1 ); set_current_line_width( -1 );
if( current_pen_width >= diametre )
set_current_line_width( diametre );
if( modetrace == FILLED )
circle( pos, diametre - current_pen_width, FILLED_SHAPE ); circle( pos, diametre - current_pen_width, FILLED_SHAPE );
}
else else
{
set_current_line_width( -1 );
circle( pos, diametre - current_pen_width, NO_FILL ); circle( pos, diametre - current_pen_width, NO_FILL );
}
set_current_line_width( -1 );
} }
......
...@@ -1149,8 +1149,7 @@ bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, ...@@ -1149,8 +1149,7 @@ bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1,
} }
/* Comparison routine for sorting by NumSheet table of elements /* Comparison routine for sorting items by Sheet Number ( used by qsort )
* connected (TabPinSort) by qsort ()
*/ */
bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, bool SortItemsBySheet( const NETLIST_OBJECT* Objet1,
......
This diff is collapsed.
...@@ -40,7 +40,7 @@ enum gen_netlist_diag { ...@@ -40,7 +40,7 @@ enum gen_netlist_diag {
/* wxPanels for creating the NoteBook pages for each netlist format: */ /* wxPanels for creating the NoteBook pages for each netlist format: */
class EDA_NoteBookPage : public wxPanel class NETLIST_PAGE_DIALOG : public wxPanel
{ {
public: public:
int m_IdNetType; int m_IdNetType;
...@@ -63,10 +63,10 @@ public: ...@@ -63,10 +63,10 @@ public:
* @param selected = true to have this notebook page selected when the dialog is opened * @param selected = true to have this notebook page selected when the dialog is opened
* Only one page can be created with selected = true. * Only one page can be created with selected = true.
*/ */
EDA_NoteBookPage( wxNotebook* parent, const wxString& title, NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
int id_NetType, int idCheckBox, int idCreateFile, int id_NetType, int idCheckBox, int idCreateFile,
bool selected ); bool selected );
~EDA_NoteBookPage() { }; ~NETLIST_PAGE_DIALOG() { };
}; };
...@@ -89,19 +89,19 @@ enum TypeNetForm { ...@@ -89,19 +89,19 @@ enum TypeNetForm {
/* Dialog frame for creating netlists */ /* Dialog frame for creating netlists */
class WinEDA_NetlistFrame : public wxDialog class NETLIST_DIALOG : public wxDialog
{ {
public: public:
SCH_EDIT_FRAME* m_Parent; SCH_EDIT_FRAME* m_Parent;
wxNotebook* m_NoteBook; wxNotebook* m_NoteBook;
EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
wxRadioBox* m_UseNetNamesInNetlist; wxRadioBox* m_UseNetNamesInNetlist;
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ); NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
~WinEDA_NetlistFrame() { }; ~NETLIST_DIALOG() { };
private: private:
void InstallCustomPages(); void InstallCustomPages();
...@@ -111,7 +111,7 @@ private: ...@@ -111,7 +111,7 @@ private:
void NetlistUpdateOpt(); void NetlistUpdateOpt();
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void SelectNetlistType( wxCommandEvent& event ); void SelectNetlistType( wxCommandEvent& event );
void SetupPluginData( wxCommandEvent& event ); void AddNewPluginPanel( wxCommandEvent& event );
void DeletePluginPanel( wxCommandEvent& event ); void DeletePluginPanel( wxCommandEvent& event );
void ValidatePluginPanel( wxCommandEvent& event ); void ValidatePluginPanel( wxCommandEvent& event );
......
...@@ -548,7 +548,7 @@ void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath ) ...@@ -548,7 +548,7 @@ void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
} }
void SCH_SCREEN::GetHierarchicalItems( std::vector <SCH_ITEM*> aItems ) void SCH_SCREEN::GetHierarchicalItems( std::vector <SCH_ITEM*>& aItems )
{ {
SCH_ITEM* item = GetDrawItems(); SCH_ITEM* item = GetDrawItems();
...@@ -786,7 +786,7 @@ static bool SortByTimeStamp( const SCH_ITEM* item1, const SCH_ITEM* item2 ) ...@@ -786,7 +786,7 @@ static bool SortByTimeStamp( const SCH_ITEM* item1, const SCH_ITEM* item2 )
int ii = item1->m_TimeStamp - item2->m_TimeStamp; int ii = item1->m_TimeStamp - item2->m_TimeStamp;
/* If the time stamps are the same, compare type in order to have component objects /* If the time stamps are the same, compare type in order to have component objects
* before sheet object. This is done because the changing the sheet time stamp * before sheet object. This is done because changing the sheet time stamp
* before the component time stamp could cause the current annotation to be lost. * before the component time stamp could cause the current annotation to be lost.
*/ */
if( ( ii == 0 && ( item1->Type() != item2->Type() ) ) && ( item1->Type() == SCH_SHEET_T ) ) if( ( ii == 0 && ( item1->Type() != item2->Type() ) ) && ( item1->Type() == SCH_SHEET_T ) )
...@@ -918,7 +918,6 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps() ...@@ -918,7 +918,6 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps()
item = items[ii]; item = items[ii];
SCH_ITEM* nextItem = items[ii + 1]; SCH_ITEM* nextItem = items[ii + 1];
if( item->m_TimeStamp == nextItem->m_TimeStamp ) if( item->m_TimeStamp == nextItem->m_TimeStamp )
{ {
count++; count++;
......
...@@ -564,7 +564,7 @@ void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event ) ...@@ -564,7 +564,7 @@ void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
do do
{ {
WinEDA_NetlistFrame* dlg = new WinEDA_NetlistFrame( this ); NETLIST_DIALOG* dlg = new NETLIST_DIALOG( this );
i = dlg->ShowModal(); i = dlg->ShowModal();
dlg->Destroy(); dlg->Destroy();
} while( i == NET_PLUGIN_CHANGE ); } while( i == NET_PLUGIN_CHANGE );
......
...@@ -18,14 +18,6 @@ ...@@ -18,14 +18,6 @@
#include "class_gerber_draw_item.h" #include "class_gerber_draw_item.h"
#include "class_GERBER.h" #include "class_GERBER.h"
#ifdef __WINDOWS__
// Blit function seems have problems when scale != 1 and/or offsets
#define AVOID_BLIT_SCALE_BUG true
#else
#define AVOID_BLIT_SCALE_BUG false // not needed on Linux
#endif
/** /**
* Function PrintPage (virtual) * Function PrintPage (virtual)
...@@ -130,23 +122,10 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -130,23 +122,10 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
int bitmapWidth, bitmapHeight; int bitmapWidth, bitmapHeight;
wxDC* plotDC = aDC; wxDC* plotDC = aDC;
#if AVOID_BLIT_SCALE_BUG
// Blit function used below seems to work OK only with scale = 1 and no offsets
// at least under Windows
// Store device context scale and origins:
double dc_scalex, dc_scaley;
wxPoint dev_org;
wxPoint logical_org;
aDC->GetDeviceOrigin( &dev_org.x, &dev_org.y );
aDC->GetLogicalOrigin( &logical_org.x, &logical_org.y );
aDC->GetUserScale( &dc_scalex, &dc_scaley );
#endif
aPanel->GetClientSize( &bitmapWidth, &bitmapHeight ); aPanel->GetClientSize( &bitmapWidth, &bitmapHeight );
wxBitmap* layerBitmap; wxBitmap* layerBitmap = NULL;
wxBitmap* screenBitmap; wxBitmap* screenBitmap = NULL;
wxMemoryDC layerDC; // used sequentially for each gerber layer wxMemoryDC layerDC; // used sequentially for each gerber layer
wxMemoryDC screenDC; wxMemoryDC screenDC;
...@@ -185,12 +164,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -185,12 +164,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
// layers are drawn in background color. // layers are drawn in background color.
if( gerber->HasNegativeItems() && doBlit ) if( gerber->HasNegativeItems() && doBlit )
{ {
#if AVOID_BLIT_SCALE_BUG
layerDC.SetUserScale( 1.0, 1.0 );
layerDC.SetDeviceOrigin( 0, 0 );
layerDC.SetLogicalOrigin( 0, 0 );
#endif
if( aDrawMode == GR_COPY ) if( aDrawMode == GR_COPY )
{ {
// Use the layer bitmap itself as a mask when blitting. The bitmap // Use the layer bitmap itself as a mask when blitting. The bitmap
...@@ -217,12 +190,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -217,12 +190,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
layerDC.Clear(); layerDC.Clear();
} }
#if AVOID_BLIT_SCALE_BUG
layerDC.SetUserScale( dc_scalex, dc_scaley );
layerDC.SetDeviceOrigin( dev_org.x, dev_org.y );
layerDC.SetLogicalOrigin( logical_org.x, logical_org.y );
#endif
if( gerber->m_ImageNegative ) if( gerber->m_ImageNegative )
{ {
// Draw background negative (i.e. in graphic layer color) for negative images. // Draw background negative (i.e. in graphic layer color) for negative images.
...@@ -271,15 +238,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -271,15 +238,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
{ {
// this is the last transfert to screenDC. If there are no negative items, this is // this is the last transfert to screenDC. If there are no negative items, this is
// the only one // the only one
#if AVOID_BLIT_SCALE_BUG
if( aDrawMode != -1 )
{
layerDC.SetUserScale( 1.0, 1.0 );
layerDC.SetDeviceOrigin( 0, 0 );
layerDC.SetLogicalOrigin( 0, 0 );
}
#endif
if( aDrawMode == GR_COPY ) if( aDrawMode == GR_COPY )
{ {
layerDC.SelectObject( wxNullBitmap ); layerDC.SelectObject( wxNullBitmap );
...@@ -296,14 +254,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -296,14 +254,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
if( aDrawMode != -1 ) if( aDrawMode != -1 )
{ {
aDC->Blit( 0, 0, bitmapWidth, bitmapHeight, &screenDC, 0, 0, wxCOPY ); aDC->Blit( 0, 0, bitmapWidth, bitmapHeight, &screenDC, 0, 0, wxCOPY );
#if AVOID_BLIT_SCALE_BUG
// Restore scale and offsets values:
aDC->SetUserScale( dc_scalex, dc_scaley );
aDC->SetDeviceOrigin( dev_org.x, dev_org.y );
aDC->SetLogicalOrigin( logical_org.x, logical_org.y );
#endif
layerDC.SelectObject( wxNullBitmap ); layerDC.SelectObject( wxNullBitmap );
screenDC.SelectObject( wxNullBitmap ); screenDC.SelectObject( wxNullBitmap );
delete layerBitmap; delete layerBitmap;
......
...@@ -251,9 +251,9 @@ public: ...@@ -251,9 +251,9 @@ public:
/** /**
* Function GetHierarchicalItems * Function GetHierarchicalItems
* adds all schematic sheet and component object in the screen to \a aItems. * adds all schematic sheet and component object in the screen to \a aItems.
* @param aItems Hierarchical item list. * @param aItems Hierarchical item list to fill.
*/ */
void GetHierarchicalItems( std::vector <SCH_ITEM*> aItems ); void GetHierarchicalItems( std::vector <SCH_ITEM*>& aItems );
/** /**
* Function SelectBlockItems * Function SelectBlockItems
......
...@@ -20,19 +20,19 @@ ...@@ -20,19 +20,19 @@
#include "richio.h" #include "richio.h"
#include "filter_reader.h" #include "filter_reader.h"
class ModList class FOOTPRINT_ITEM
{ {
public: public:
ModList* Next; FOOTPRINT_ITEM* Next;
wxString m_Name, m_Doc, m_KeyWord; wxString m_Name, m_Doc, m_KeyWord;
public: public:
ModList() FOOTPRINT_ITEM()
{ {
Next = NULL; Next = NULL;
} }
~ModList() ~FOOTPRINT_ITEM()
{ {
} }
}; };
...@@ -42,7 +42,7 @@ static void DisplayCmpDoc( wxString& Name ); ...@@ -42,7 +42,7 @@ static void DisplayCmpDoc( wxString& Name );
static void ReadDocLib( const wxString& ModLibName ); static void ReadDocLib( const wxString& ModLibName );
static ModList* MList; static FOOTPRINT_ITEM* MList;
/** /**
* Function Load_Module_From_BOARD * Function Load_Module_From_BOARD
...@@ -373,7 +373,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -373,7 +373,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
char* Line; char* Line;
wxFileName fn; wxFileName fn;
static wxString OldName; /* Save the name of the last module loaded. */ static wxString OldName; /* Save the name of the last module loaded. */
wxString CmpName, tmp; wxString CmpName;
wxString libFullName;
FILE* file; FILE* file;
wxString msg; wxString msg;
wxArrayString itemslist; wxArrayString itemslist;
...@@ -392,9 +393,9 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -392,9 +393,9 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
else else
fn = aLibraryFullFilename; fn = aLibraryFullFilename;
tmp = wxGetApp().FindLibraryPath( fn ); libFullName = wxGetApp().FindLibraryPath( fn );
if( !tmp ) if( libFullName.IsEmpty() )
{ {
msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ), msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ),
GetChars( fn.GetFullName() ) ); GetChars( fn.GetFullName() ) );
...@@ -403,7 +404,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -403,7 +404,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
continue; continue;
} }
ReadDocLib( tmp ); ReadDocLib( libFullName );
if( !aKeyWord.IsEmpty() ) /* Don't read the library if selection if( !aKeyWord.IsEmpty() ) /* Don't read the library if selection
* by keywords, already read. */ * by keywords, already read. */
...@@ -413,7 +414,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -413,7 +414,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
continue; continue;
} }
file = wxFopen( tmp, wxT( "rt" ) ); file = wxFopen( libFullName, wxT( "rt" ) );
if( file == NULL ) if( file == NULL )
{ {
...@@ -422,7 +423,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -422,7 +423,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
continue; continue;
} }
FILE_LINE_READER fileReader( file, tmp ); FILE_LINE_READER fileReader( file, libFullName );
FILTER_READER reader( fileReader ); FILTER_READER reader( fileReader );
...@@ -437,9 +438,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -437,9 +438,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 ) if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
{ {
msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library file." ), msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library file." ),
GetChars( tmp ) ); GetChars( libFullName ) );
wxMessageBox( msg, _( "Library Load Error" ), wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this );
wxOK | wxICON_ERROR, this );
continue; continue;
} }
...@@ -478,7 +478,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -478,7 +478,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
/* Create list of modules if search by keyword. */ /* Create list of modules if search by keyword. */
if( !aKeyWord.IsEmpty() ) if( !aKeyWord.IsEmpty() )
{ {
ModList* ItemMod = MList; FOOTPRINT_ITEM* ItemMod = MList;
while( ItemMod != NULL ) while( ItemMod != NULL )
{ {
if( KeyWordOk( aKeyWord, ItemMod->m_KeyWord ) ) if( KeyWordOk( aKeyWord, ItemMod->m_KeyWord ) )
...@@ -502,7 +502,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -502,7 +502,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
while( MList != NULL ) while( MList != NULL )
{ {
ModList* NewMod = MList->Next; FOOTPRINT_ITEM* NewMod = MList->Next;
delete MList; delete MList;
MList = NewMod; MList = NewMod;
} }
...@@ -519,7 +519,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow ...@@ -519,7 +519,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
*/ */
static void DisplayCmpDoc( wxString& Name ) static void DisplayCmpDoc( wxString& Name )
{ {
ModList* Mod = MList; FOOTPRINT_ITEM* Mod = MList;
if( !Mod ) if( !Mod )
{ {
...@@ -551,7 +551,7 @@ static void DisplayCmpDoc( wxString& Name ) ...@@ -551,7 +551,7 @@ static void DisplayCmpDoc( wxString& Name )
*/ */
static void ReadDocLib( const wxString& ModLibName ) static void ReadDocLib( const wxString& ModLibName )
{ {
ModList* NewMod; FOOTPRINT_ITEM* NewMod;
char* Line; char* Line;
FILE* LibDoc; FILE* LibDoc;
wxFileName fn = ModLibName; wxFileName fn = ModLibName;
...@@ -579,7 +579,7 @@ static void ReadDocLib( const wxString& ModLibName ) ...@@ -579,7 +579,7 @@ static void ReadDocLib( const wxString& ModLibName )
break; ; break; ;
if( Line[1] == 'M' ) /* Debut decription 1 module */ if( Line[1] == 'M' ) /* Debut decription 1 module */
{ {
NewMod = new ModList(); NewMod = new FOOTPRINT_ITEM();
NewMod->Next = MList; NewMod->Next = MList;
MList = NewMod; MList = NewMod;
while( reader.ReadLine() ) while( reader.ReadLine() )
......
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