KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_io_fabmaster.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 BeagleBoard Foundation
5 * Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.TXT for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
20 * or you may search the http://www.gnu.org website for the version 3 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
29#include "pcb_io_fabmaster.h"
30#include <board.h>
31#include <progress_reporter.h>
32#include <common.h>
33#include <macros.h>
34
35
37{
38}
39
40
42{
43}
44
45
46BOARD* PCB_IO_FABMASTER::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
47 const std::map<std::string, UTF8>* aProperties, PROJECT* aProject )
48{
49 m_props = aProperties;
50
51 m_board = aAppendToMe ? aAppendToMe : new BOARD();
52
53 // Give the filename to the board if it's new
54 if( !aAppendToMe )
55 m_board->SetFileName( aFileName );
56
58 {
59 m_progressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) );
60
62 THROW_IO_ERROR( _( "Open cancelled by user." ) );
63 }
64
65 if( !m_fabmaster.Read( aFileName.ToStdString() ) )
66 {
67 std::string readerr;
68
69 readerr = _( "Could not read file " ) + aFileName.ToStdString();
70 THROW_IO_ERROR( readerr );
71 }
72
75
76 return m_board;
77}
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
void SetFileName(const wxString &aFileName)
Definition: board.h:325
bool Read(const std::string &aFile)
bool LoadBoard(BOARD *aBoard, PROGRESS_REPORTER *aProgressReporter)
PROGRESS_REPORTER * m_progressReporter
Progress reporter to track the progress of the operation, may be nullptr.
Definition: io_base.h:221
PCB_IO_FABMASTER()
Pcbnew PLUGIN for FABMASTER ASCII *.txt / *.fab format.
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr) override
Load information from some input file format that this PCB_IO implementation knows about into either ...
A base class that BOARD loading and saving plugins should derive from.
Definition: pcb_io.h:71
BOARD * m_board
The board BOARD being worked on, no ownership here.
Definition: pcb_io.h:342
const std::map< std::string, UTF8 > * m_props
Properties passed via Save() or Load(), no ownership, may be NULL.
Definition: pcb_io.h:345
virtual bool KeepRefreshing(bool aWait=false)=0
Update the UI (if any).
virtual void Report(const wxString &aMessage)=0
Display aMessage in the progress bar dialog.
Container for project specific data.
Definition: project.h:64
The common library.
#define _(s)
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:39
This file contains miscellaneous commonly used macros and functions.