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,
GRTraceMode modetrace )
{
wxASSERT( output_file );
set_current_line_width( -1 );
if( current_pen_width >= diametre )
set_current_line_width( diametre );
if( modetrace == FILLED )
{
set_current_line_width( -1 );
circle( pos, diametre - current_pen_width, FILLED_SHAPE );
}
else
{
set_current_line_width( -1 );
circle( pos, diametre - current_pen_width, NO_FILL );
}
set_current_line_width( -1 );
}
......
......@@ -1149,8 +1149,7 @@ bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1,
}
/* Comparison routine for sorting by NumSheet table of elements
* connected (TabPinSort) by qsort ()
/* Comparison routine for sorting items by Sheet Number ( used by qsort )
*/
bool SortItemsBySheet( const NETLIST_OBJECT* Objet1,
......
This diff is collapsed.
......@@ -40,7 +40,7 @@ enum gen_netlist_diag {
/* wxPanels for creating the NoteBook pages for each netlist format: */
class EDA_NoteBookPage : public wxPanel
class NETLIST_PAGE_DIALOG : public wxPanel
{
public:
int m_IdNetType;
......@@ -63,10 +63,10 @@ public:
* @param selected = true to have this notebook page selected when the dialog is opened
* 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,
bool selected );
~EDA_NoteBookPage() { };
~NETLIST_PAGE_DIALOG() { };
};
......@@ -89,19 +89,19 @@ enum TypeNetForm {
/* Dialog frame for creating netlists */
class WinEDA_NetlistFrame : public wxDialog
class NETLIST_DIALOG : public wxDialog
{
public:
SCH_EDIT_FRAME* m_Parent;
wxNotebook* m_NoteBook;
EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
wxRadioBox* m_UseNetNamesInNetlist;
public:
// Constructor and destructor
WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent );
~WinEDA_NetlistFrame() { };
NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
~NETLIST_DIALOG() { };
private:
void InstallCustomPages();
......@@ -111,7 +111,7 @@ private:
void NetlistUpdateOpt();
void OnCancelClick( wxCommandEvent& event );
void SelectNetlistType( wxCommandEvent& event );
void SetupPluginData( wxCommandEvent& event );
void AddNewPluginPanel( wxCommandEvent& event );
void DeletePluginPanel( wxCommandEvent& event );
void ValidatePluginPanel( wxCommandEvent& event );
......
......@@ -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();
......@@ -786,7 +786,7 @@ static bool SortByTimeStamp( const SCH_ITEM* item1, const SCH_ITEM* item2 )
int ii = item1->m_TimeStamp - item2->m_TimeStamp;
/* 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.
*/
if( ( ii == 0 && ( item1->Type() != item2->Type() ) ) && ( item1->Type() == SCH_SHEET_T ) )
......@@ -918,7 +918,6 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps()
item = items[ii];
SCH_ITEM* nextItem = items[ii + 1];
if( item->m_TimeStamp == nextItem->m_TimeStamp )
{
count++;
......
......@@ -564,7 +564,7 @@ void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
do
{
WinEDA_NetlistFrame* dlg = new WinEDA_NetlistFrame( this );
NETLIST_DIALOG* dlg = new NETLIST_DIALOG( this );
i = dlg->ShowModal();
dlg->Destroy();
} while( i == NET_PLUGIN_CHANGE );
......
......@@ -18,14 +18,6 @@
#include "class_gerber_draw_item.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)
......@@ -130,23 +122,10 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
int bitmapWidth, bitmapHeight;
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 );
wxBitmap* layerBitmap;
wxBitmap* screenBitmap;
wxBitmap* layerBitmap = NULL;
wxBitmap* screenBitmap = NULL;
wxMemoryDC layerDC; // used sequentially for each gerber layer
wxMemoryDC screenDC;
......@@ -185,12 +164,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
// layers are drawn in background color.
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 )
{
// 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
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 )
{
// 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
{
// this is the last transfert to screenDC. If there are no negative items, this is
// 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 )
{
layerDC.SelectObject( wxNullBitmap );
......@@ -296,14 +254,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
if( aDrawMode != -1 )
{
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 );
screenDC.SelectObject( wxNullBitmap );
delete layerBitmap;
......
......@@ -251,9 +251,9 @@ public:
/**
* Function GetHierarchicalItems
* 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
......
......@@ -20,19 +20,19 @@
#include "richio.h"
#include "filter_reader.h"
class ModList
class FOOTPRINT_ITEM
{
public:
ModList* Next;
FOOTPRINT_ITEM* Next;
wxString m_Name, m_Doc, m_KeyWord;
public:
ModList()
FOOTPRINT_ITEM()
{
Next = NULL;
}
~ModList()
~FOOTPRINT_ITEM()
{
}
};
......@@ -42,7 +42,7 @@ static void DisplayCmpDoc( wxString& Name );
static void ReadDocLib( const wxString& ModLibName );
static ModList* MList;
static FOOTPRINT_ITEM* MList;
/**
* Function Load_Module_From_BOARD
......@@ -373,7 +373,8 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
char* Line;
wxFileName fn;
static wxString OldName; /* Save the name of the last module loaded. */
wxString CmpName, tmp;
wxString CmpName;
wxString libFullName;
FILE* file;
wxString msg;
wxArrayString itemslist;
......@@ -392,9 +393,9 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
else
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." ),
GetChars( fn.GetFullName() ) );
......@@ -403,7 +404,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
continue;
}
ReadDocLib( tmp );
ReadDocLib( libFullName );
if( !aKeyWord.IsEmpty() ) /* Don't read the library if selection
* by keywords, already read. */
......@@ -413,7 +414,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
continue;
}
file = wxFopen( tmp, wxT( "rt" ) );
file = wxFopen( libFullName, wxT( "rt" ) );
if( file == NULL )
{
......@@ -422,7 +423,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
continue;
}
FILE_LINE_READER fileReader( file, tmp );
FILE_LINE_READER fileReader( file, libFullName );
FILTER_READER reader( fileReader );
......@@ -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 )
{
msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library file." ),
GetChars( tmp ) );
wxMessageBox( msg, _( "Library Load Error" ),
wxOK | wxICON_ERROR, this );
GetChars( libFullName ) );
wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this );
continue;
}
......@@ -478,7 +478,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
/* Create list of modules if search by keyword. */
if( !aKeyWord.IsEmpty() )
{
ModList* ItemMod = MList;
FOOTPRINT_ITEM* ItemMod = MList;
while( ItemMod != NULL )
{
if( KeyWordOk( aKeyWord, ItemMod->m_KeyWord ) )
......@@ -502,7 +502,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
while( MList != NULL )
{
ModList* NewMod = MList->Next;
FOOTPRINT_ITEM* NewMod = MList->Next;
delete MList;
MList = NewMod;
}
......@@ -519,7 +519,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
*/
static void DisplayCmpDoc( wxString& Name )
{
ModList* Mod = MList;
FOOTPRINT_ITEM* Mod = MList;
if( !Mod )
{
......@@ -551,7 +551,7 @@ static void DisplayCmpDoc( wxString& Name )
*/
static void ReadDocLib( const wxString& ModLibName )
{
ModList* NewMod;
FOOTPRINT_ITEM* NewMod;
char* Line;
FILE* LibDoc;
wxFileName fn = ModLibName;
......@@ -579,7 +579,7 @@ static void ReadDocLib( const wxString& ModLibName )
break; ;
if( Line[1] == 'M' ) /* Debut decription 1 module */
{
NewMod = new ModList();
NewMod = new FOOTPRINT_ITEM();
NewMod->Next = MList;
MList = NewMod;
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