Added Backannotate Footprints from Stuff File Feature
This commit is contained in:
parent
e2770b4078
commit
7327197c17
|
@ -0,0 +1,31 @@
|
|||
/* XPM */
|
||||
#ifndef XPMMAIN
|
||||
extern const char *backanno_xpm[];
|
||||
|
||||
#else
|
||||
const char *backanno_xpm[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
" 16 16 3 1",
|
||||
/* colors */
|
||||
" c None",
|
||||
". c yellow",
|
||||
"# c black",
|
||||
/* pixels */
|
||||
" ",
|
||||
" .... ",
|
||||
" ...... ",
|
||||
" ...##... ",
|
||||
" ....##.... ",
|
||||
" .####....... ",
|
||||
" ..#.###..##... ",
|
||||
" .###########.. ",
|
||||
" ...##....##... ",
|
||||
" ...###.....#.. ",
|
||||
" ..#.#..##... ",
|
||||
" .#.#.####. ",
|
||||
" ........ ",
|
||||
" ...... ",
|
||||
" .... ",
|
||||
" "
|
||||
};
|
||||
#endif
|
|
@ -8,6 +8,7 @@ set(EESCHEMA_SRCS
|
|||
affiche.cpp
|
||||
annotate.cpp
|
||||
annotate_dialog.cpp
|
||||
backanno.cpp
|
||||
block.cpp
|
||||
block_libedit.cpp
|
||||
busentry.cpp
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
/****************************************************************
|
||||
* EESchema: backanno.cpp
|
||||
* (functions for backannotating Footprint info
|
||||
****************************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "program.h"
|
||||
#include "libcmp.h"
|
||||
#include "general.h"
|
||||
|
||||
/* Variables Locales */
|
||||
|
||||
#include "dialog_backanno.cpp"
|
||||
|
||||
#include "protos.h"
|
||||
|
||||
/**************************************************************/
|
||||
bool WinEDA_SchematicFrame::ProcessStuffFile(FILE* StuffFile)
|
||||
/**************************************************************/
|
||||
|
||||
/* get footprint info from each line in the Stuff File by Ref Desg
|
||||
*/
|
||||
{
|
||||
int LineNum = 0;
|
||||
char *cp, Ref[256], FootPrint[256], Line[1024];
|
||||
SCH_ITEM* DrawList = NULL;
|
||||
SCH_COMPONENT* Cmp ;
|
||||
PartTextStruct* TextField ;
|
||||
|
||||
while( GetLine( StuffFile, Line, &LineNum, sizeof(Line) ) ) {
|
||||
if( sscanf( Line, "comp = \"%s module = \"%s", Ref, FootPrint) == 2 ) {
|
||||
for( cp=Ref; *cp ; cp++ )
|
||||
if( *cp == '"' )
|
||||
*cp = 0;
|
||||
for( cp=FootPrint; *cp ; cp++ )
|
||||
if( *cp == '"' )
|
||||
*cp = 0;
|
||||
// printf("'%s' '%s'\n", Ref, FootPrint);
|
||||
DrawList = WinEDA_SchematicFrame::FindComponentAndItem(
|
||||
Ref, TRUE, 2, wxEmptyString, false);
|
||||
|
||||
if( DrawList == NULL )
|
||||
continue;
|
||||
|
||||
if( DrawList->Type() == TYPE_SCH_COMPONENT ) {
|
||||
Cmp = (SCH_COMPONENT*) DrawList;
|
||||
TextField = &Cmp->m_Field[FOOTPRINT];
|
||||
TextField->m_Text = FootPrint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
bool WinEDA_SchematicFrame::ReadInputStuffFile()
|
||||
/**************************************************************/
|
||||
|
||||
/* Backann footprint info to schematic.
|
||||
*/
|
||||
{
|
||||
wxString Line, filename;
|
||||
FILE* StuffFile;
|
||||
wxString msg;
|
||||
|
||||
filename = EDA_FileSelector(_("Load Stuff File"),
|
||||
wxEmptyString, /* Chemin par defaut */
|
||||
wxEmptyString, /* nom fichier par defaut */
|
||||
wxT( ".stf" ), /* extension par defaut */
|
||||
wxT( "*.stf" ), /* Masque d'affichage */
|
||||
this,
|
||||
wxFD_OPEN,
|
||||
FALSE
|
||||
);
|
||||
if ( filename.IsEmpty())
|
||||
return FALSE;
|
||||
|
||||
Line = g_Main_Title + wxT(" ") + GetBuildVersion();
|
||||
Line += wxT(" ") + filename;
|
||||
SetTitle(Line);
|
||||
|
||||
if( filename.IsEmpty() )
|
||||
return FALSE;
|
||||
|
||||
StuffFile = wxFopen( filename, wxT( "rt" ) );
|
||||
if( StuffFile == NULL ) {
|
||||
msg.Printf( _( "Failed to open Stuff File <%s>" ), filename.GetData() );
|
||||
DisplayError( this, msg, 20 );
|
||||
return FALSE;
|
||||
}
|
||||
ProcessStuffFile( StuffFile );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dialog_Backanno.cpp
|
||||
// Purpose:
|
||||
// Author: Frank Bennett
|
||||
// Modified by:
|
||||
// Created: Thu May 1 11:23:06 MDT 2008
|
||||
// RCS-ID:
|
||||
// Copyright: License GNU
|
||||
// Licence:
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////@begin includes
|
||||
////@end includes
|
||||
|
||||
#include "dialog_backanno.h"
|
||||
|
||||
////@begin XPM images
|
||||
////@end XPM images
|
||||
|
||||
/*!
|
||||
* WinEDA_BackannoFrame type definition
|
||||
*/
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( WinEDA_BackannoFrame, wxDialog )
|
||||
|
||||
/*!
|
||||
* WinEDA_BackannoFrame event table definition
|
||||
*/
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_BackannoFrame, wxDialog )
|
||||
|
||||
////@begin WinEDA_BackannoFrame event table entries
|
||||
|
||||
////@end WinEDA_BackannoFrame event table entries
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
/*!
|
||||
* WinEDA_BackannoFrame constructors
|
||||
*/
|
||||
|
||||
WinEDA_BackannoFrame::WinEDA_BackannoFrame( )
|
||||
{
|
||||
}
|
||||
|
||||
WinEDA_BackannoFrame::WinEDA_BackannoFrame( WinEDA_SchematicFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
||||
{
|
||||
m_Parent = parent;
|
||||
Create(parent, id, caption, pos, size, style);
|
||||
}
|
||||
|
||||
/*!
|
||||
* WinEDA_BackannoFrame creator
|
||||
*/
|
||||
|
||||
bool WinEDA_BackannoFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
||||
{
|
||||
////@begin WinEDA_BackannoFrame member initialisation
|
||||
m_NewTextCtrl = NULL;
|
||||
////@end WinEDA_BackannoFrame member initialisation
|
||||
|
||||
////@begin WinEDA_BackannoFrame creation
|
||||
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
|
||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||
|
||||
GetSizer()->Fit(this);
|
||||
GetSizer()->SetSizeHints(this);
|
||||
Centre();
|
||||
////@end WinEDA_BackannoFrame creation
|
||||
|
||||
m_NewTextCtrl->SetFocus();
|
||||
|
||||
/* does not work here, might work if moved elsewhere,
|
||||
// see void DrcDialog::OnInitDialog( wxInitDialogEvent& event )
|
||||
// deselect the existing text, seems SetFocus() wants to emulate
|
||||
// Microsoft and select all text, which is not desireable here.
|
||||
m_NewTextCtrl->SetSelection(0,0);
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Should we show tooltips?
|
||||
*/
|
||||
|
||||
bool WinEDA_BackannoFrame::ShowToolTips()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get bitmap resources
|
||||
*/
|
||||
|
||||
wxBitmap WinEDA_BackannoFrame::GetBitmapResource( const wxString& name )
|
||||
{
|
||||
// Bitmap retrieval
|
||||
////@begin WinEDA_BackannoFrame bitmap retrieval
|
||||
wxUnusedVar(name);
|
||||
return wxNullBitmap;
|
||||
////@end WinEDA_BackannoFrame bitmap retrieval
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get icon resources
|
||||
*/
|
||||
|
||||
wxIcon WinEDA_BackannoFrame::GetIconResource( const wxString& name )
|
||||
{
|
||||
// Icon retrieval
|
||||
////@begin WinEDA_BackannoFrame icon retrieval
|
||||
wxUnusedVar(name);
|
||||
return wxNullIcon;
|
||||
////@end WinEDA_BackannoFrame icon retrieval
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dialog_backanno.h
|
||||
// Purpose:
|
||||
// Author: Frank Bennett
|
||||
// Modified by:
|
||||
// Created: Wed Apr 30 16:40:21 MDT 2008
|
||||
// RCS-ID:
|
||||
// Copyright: License GNU
|
||||
// Licence:
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _DIALOG_BACKANNO_H_
|
||||
#define _DIALOG_BACKANNO_H_
|
||||
|
||||
/*!
|
||||
* Includes
|
||||
*/
|
||||
|
||||
////@begin includes
|
||||
#include "wx/valtext.h"
|
||||
////@end includes
|
||||
|
||||
/*!
|
||||
* Forward declarations
|
||||
*/
|
||||
|
||||
////@begin forward declarations
|
||||
////@end forward declarations
|
||||
|
||||
/*!
|
||||
* Control identifiers
|
||||
*/
|
||||
|
||||
////@begin control identifiers
|
||||
#define ID_DIALOG 10000
|
||||
#define SYMBOL_WINEDA_BACKANNOFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
|
||||
#define SYMBOL_WINEDA_BACKANNOFRAME_TITLE _("EESchema Back Annotate")
|
||||
#define SYMBOL_WINEDA_BACKANNOFRAME_IDNAME ID_DIALOG
|
||||
#define SYMBOL_WINEDA_BACKANNOFRAME_SIZE wxSize(400, 300)
|
||||
#define SYMBOL_WINEDA_BACKANNOFRAME_POSITION wxDefaultPosition
|
||||
#define ID_TEXTCTRL1 10008
|
||||
#define BACKANNO_SHEET 10001
|
||||
#define FIND_HIERARCHY 10002
|
||||
#define FIND_NEXT 10005
|
||||
#define FIND_MARKERS 10003
|
||||
#define FIND_NEXT_MARKER 10006
|
||||
#define LOCATE_IN_LIBRARIES 10004
|
||||
////@end control identifiers
|
||||
|
||||
/*!
|
||||
* Compatibility
|
||||
*/
|
||||
|
||||
#ifndef wxCLOSE_BOX
|
||||
#define wxCLOSE_BOX 0x1000
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* WinEDA_BackannoFrame class declaration
|
||||
*/
|
||||
|
||||
class WinEDA_BackannoFrame: public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( WinEDA_BackannoFrame )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
public:
|
||||
/// Constructors
|
||||
WinEDA_BackannoFrame( );
|
||||
WinEDA_BackannoFrame( WinEDA_SchematicFrame* parent, wxWindowID id = SYMBOL_WINEDA_BACKANNOFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BACKANNOFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BACKANNOFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BACKANNOFRAME_SIZE, long style = SYMBOL_WINEDA_BACKANNOFRAME_STYLE );
|
||||
|
||||
/// Creation
|
||||
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_BACKANNOFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_BACKANNOFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_BACKANNOFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_BACKANNOFRAME_SIZE, long style = SYMBOL_WINEDA_BACKANNOFRAME_STYLE );
|
||||
|
||||
////@begin WinEDA_BackannoFrame event handler declarations
|
||||
|
||||
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for BACKANNO_SHEET
|
||||
void OnBackannoSheetClick( wxCommandEvent& event );
|
||||
|
||||
////@end WinEDA_BackannoFrame event handler declarations
|
||||
|
||||
////@begin WinEDA_BackannoFrame member function declarations
|
||||
|
||||
/// Retrieves bitmap resources
|
||||
wxBitmap GetBitmapResource( const wxString& name );
|
||||
|
||||
/// Retrieves icon resources
|
||||
wxIcon GetIconResource( const wxString& name );
|
||||
////@end WinEDA_BackannoFrame member function declarations
|
||||
|
||||
/// Should we show tooltips?
|
||||
static bool ShowToolTips();
|
||||
|
||||
void BackannoSchematicItem(wxCommandEvent& event);
|
||||
bool ReadInputStuffFile(const wxString & FullFileName);
|
||||
void LoadStuffFile( wxCommandEvent& event );
|
||||
|
||||
////@begin WinEDA_BackannoFrame member variables
|
||||
wxTextCtrl* m_NewTextCtrl;
|
||||
////@end WinEDA_BackannoFrame member variables
|
||||
WinEDA_SchematicFrame * m_Parent;
|
||||
};
|
||||
|
||||
#endif
|
||||
// _DIALOG_FIND_H_
|
|
@ -83,6 +83,7 @@ OBJECTS = eeschema.o\
|
|||
onrightclick.o \
|
||||
onleftclick.o \
|
||||
find.o \
|
||||
backanno.o \
|
||||
controle.o\
|
||||
hotkeys.o\
|
||||
svg_print.o
|
||||
|
@ -110,6 +111,8 @@ menubar.o: menubar.cpp $(DEPEND)
|
|||
|
||||
find.o:find.cpp dialog_find.cpp dialog_find.h $(DEPEND)
|
||||
|
||||
backanno.o:backanno.cpp dialog_backanno.cpp dialog_backanno.h $(DEPEND)
|
||||
|
||||
eeconfig.o: eeconfig.cpp eeconfig.h $(DEPEND)
|
||||
|
||||
annotate.o: annotate.cpp annotate_dialog.h $(DEPEND) netlist.h
|
||||
|
|
|
@ -162,6 +162,14 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
|
|||
item->SetBitmap( find_xpm );
|
||||
editMenu->Append( item );
|
||||
|
||||
editMenu->AppendSeparator();
|
||||
|
||||
item = new wxMenuItem( editMenu, ID_BACKANNO_ITEMS,
|
||||
_( "BackAnno" ), _( "Back Annotated Footprints" ),
|
||||
wxITEM_NORMAL );
|
||||
item->SetBitmap( backanno_xpm );
|
||||
editMenu->Append( item );
|
||||
|
||||
// Menu View:
|
||||
wxMenu* viewMenu = new wxMenu;
|
||||
msg = AddHotkeyName( _( "Zoom in" ), s_Schematic_Hokeys_Descr,
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "dialog_build_BOM.h"
|
||||
#include "dialog_erc.h"
|
||||
#include "dialog_find.h"
|
||||
#include "dialog_backanno.h"
|
||||
#include "netlist_control.h"
|
||||
|
||||
|
||||
|
@ -95,6 +96,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame )
|
|||
EVT_TOOL( ID_GET_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist )
|
||||
EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials )
|
||||
EVT_TOOL( ID_FIND_ITEMS, WinEDA_SchematicFrame::OnFindItems )
|
||||
EVT_TOOL( ID_BACKANNO_ITEMS, WinEDA_SchematicFrame::OnLoadStuffFile )
|
||||
|
||||
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
|
||||
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
|
||||
|
@ -504,6 +506,11 @@ void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
|
|||
SetToolbars();
|
||||
}
|
||||
|
||||
void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event )
|
||||
{
|
||||
ReadInputStuffFile( );
|
||||
}
|
||||
|
||||
void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event )
|
||||
{
|
||||
LoadOneEEProject( wxEmptyString, true );
|
||||
|
|
|
@ -130,6 +130,8 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
|
|||
m_HToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, BITMAP( tools_xpm ),
|
||||
_( "Bill of material and/or Crossreferences" ) );
|
||||
|
||||
m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, BITMAP( backanno_xpm ),
|
||||
_( "BackAnnotate Footprint" ) );
|
||||
|
||||
// after adding the tools to the toolbar, must call Realize() to reflect the changes
|
||||
m_HToolBar->Realize();
|
||||
|
|
|
@ -109,7 +109,9 @@
|
|||
#include "../bitmaps/cut.xpm"
|
||||
#include "../bitmaps/paste.xpm"
|
||||
#include "../bitmaps/print.xpm"
|
||||
#include "../bitmaps/backanno.xpm"
|
||||
#include "../bitmaps/find.xpm"
|
||||
|
||||
#include "../bitmaps/Cursor_Shape.xpm"
|
||||
#include "../bitmaps/Add_Component.xpm"
|
||||
#include "../bitmaps/noconn.xpm"
|
||||
|
|
|
@ -393,6 +393,7 @@ enum main_id {
|
|||
ID_GET_NETLIST,
|
||||
ID_GET_TOOLS,
|
||||
ID_FIND_ITEMS,
|
||||
ID_BACKANNO_ITEMS,
|
||||
|
||||
// Id pour HToolBar de Libview (Process_Special_Functions)
|
||||
ID_LIBVIEW_START_H_TOOL,
|
||||
|
|
|
@ -128,6 +128,8 @@ public:
|
|||
void SaveProject();
|
||||
int LoadOneEEProject( const wxString& FileName, bool IsNew );
|
||||
bool LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName );
|
||||
bool ReadInputStuffFile();
|
||||
bool ProcessStuffFile(FILE* filename);
|
||||
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
|
||||
SCH_SCREEN* CreateNewScreen( SCH_SCREEN* OldScreen, int TimeStamp );
|
||||
|
||||
|
@ -158,6 +160,7 @@ private:
|
|||
void OnCreateBillOfMaterials( wxCommandEvent& event );
|
||||
void OnFindItems( wxCommandEvent& event );
|
||||
void OnLoadFile( wxCommandEvent& event );
|
||||
void OnLoadStuffFile( wxCommandEvent& event );
|
||||
void OnNewProject( wxCommandEvent& event );
|
||||
void OnLoadProject( wxCommandEvent& event );
|
||||
void OnOpenPcbnew( wxCommandEvent& event );
|
||||
|
|
Loading…
Reference in New Issue