KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kicad_clipboard.h
Go to the documentation of this file.
1
30#ifndef KICAD_CLIPBOARD_H
31#define KICAD_CLIPBOARD_H
32
33#include <board_item.h>
34#include <footprint.h>
37#include <memory.h>
38#include <tools/pcb_selection.h>
39
40
42{
43public:
46
47 void SetWriter( std::function<void(const wxString&)> aWriter ) { m_writer = aWriter; }
48 void SetReader( std::function<wxString()> aReader ) { m_reader = aReader; }
49
50 /*
51 * Saves the entire board to the clipboard formatted using the PCB_IO_KICAD_SEXPR formatting
52 */
53 void SaveBoard( const wxString& aFileName, BOARD* aBoard,
54 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
55
56 /*
57 * Write all the settings of the BOARD* set by setBoard() and then adds all the
58 * BOARD_ITEMs found in selection formatted by PCB_IO_KICAD_SEXPR to clipboard as sexpr text
59 */
60 void SaveSelection( const PCB_SELECTION& selected, bool isFootprintEditor );
61
63
64 BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
65 const std::map<std::string, UTF8>* aProperties = nullptr, PROJECT* aProject = nullptr ) override;
66
67 void SetBoard( BOARD* aBoard );
68
69private:
70 static void clipboardWriter( const wxString& aData );
71 static wxString clipboardReader();
72
74 std::function<void(const wxString&)> m_writer;
75 std::function<wxString()> m_reader;
76};
77
78
79#endif /* KICAD_CLIPBOARD_H */
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
void SaveSelection(const PCB_SELECTION &selected, bool isFootprintEditor)
STRING_FORMATTER m_formatter
void SetWriter(std::function< void(const wxString &)> aWriter)
BOARD_ITEM * Parse()
void SaveBoard(const wxString &aFileName, BOARD *aBoard, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PCB_IO implementation knows about or it can be u...
static void clipboardWriter(const wxString &aData)
static wxString clipboardReader()
void SetReader(std::function< wxString()> aReader)
void SetBoard(BOARD *aBoard)
std::function< wxString()> m_reader
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 ...
std::function< void(const wxString &)> m_writer
A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
Container for project specific data.
Definition: project.h:64
Implement an OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:449
Pcbnew s-expression file format parser definition.