KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kicad_clipboard.h
Go to the documentation of this file.
1
25
26#ifndef KICAD_CLIPBOARD_H
27#define KICAD_CLIPBOARD_H
28
29#include <board_item.h>
32#include <memory.h>
33#include <tools/pcb_selection.h>
34
35
37{
38public:
41
42 void SetWriter( std::function<void(const wxString&)> aWriter ) { m_writer = aWriter; }
43 void SetReader( std::function<wxString()> aReader ) { m_reader = aReader; }
44
45 /*
46 * Saves the entire board to the clipboard formatted using the PCB_IO_KICAD_SEXPR formatting
47 */
48 void SaveBoard( const wxString& aFileName, BOARD* aBoard,
49 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
50
51 /*
52 * Write all the settings of the BOARD* set by setBoard() and then adds all the
53 * BOARD_ITEMs found in selection formatted by PCB_IO_KICAD_SEXPR to clipboard as sexpr text
54 */
55 void SaveSelection( const PCB_SELECTION& selected, bool isFootprintEditor );
56
58
59 BOARD* LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
60 const std::map<std::string, UTF8>* aProperties = nullptr, PROJECT* aProject = nullptr ) override;
61
62 void SetBoard( BOARD* aBoard );
63
64private:
65 static void clipboardWriter( const wxString& aData );
66 static wxString clipboardReader();
67
69 std::function<void(const wxString&)> m_writer;
70 std::function<wxString()> m_reader;
71};
72
73
74#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:81
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
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
PCB_IO_KICAD_SEXPR(int aControlFlags=CTL_FOR_BOARD)
Container for project specific data.
Definition project.h:62
Implement an OUTPUTFORMATTER to a memory buffer.
Definition richio.h:418
Pcbnew s-expression file format parser definition.