50using json = nlohmann::json;
 
   69                              int aCtlBits = 0 )
 override 
   94            return new PANEL_GERBVIEW_COLOR_SETTINGS( aParent );
 
  101            std::vector<TOOL_ACTION*>            actions;
 
  102            std::vector<ACTION_TOOLBAR_CONTROL*> controls;
 
  105                actions.push_back( action );
 
  108                controls.push_back( control );
 
  110            return new PANEL_TOOLBAR_CUSTOMIZATION( aParent, cfg, tb, actions, controls );
 
 
  140    void SaveFileAs( 
const wxString& aProjectBasePath, 
const wxString& aProjectName,
 
  141                     const wxString& aNewProjectBasePath, 
const wxString& aNewProjectName,
 
  142                     const wxString& aSrcFilePath, wxString& aErrors ) 
override;
 
 
 
  149using namespace GERBV;
 
  179                        const wxString& aNewProjectBasePath, 
const wxString& aNewProjectName,
 
  180                        const wxString& aSrcFilePath, wxString& aErrors )
 
  182    wxFileName destFile( aSrcFilePath );
 
  183    wxString   destPath = destFile.GetPathWithSep();
 
  184    wxUniChar  pathSep = wxFileName::GetPathSeparator();
 
  185    wxString   ext = destFile.GetExt();
 
  187    if( destPath.StartsWith( aProjectBasePath + pathSep ) )
 
  189        destPath.Replace( aProjectBasePath, aNewProjectBasePath, 
false );
 
  190        destFile.SetPath( destPath );
 
  195        wxString destFileName = destFile.GetName();
 
  197        if( destFileName.StartsWith( aProjectName + 
"-" ) )
 
  199            destFileName.Replace( aProjectName, aNewProjectName, 
false );
 
  200            destFile.SetName( destFileName );
 
  203        KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
 
  207        if( destFile.GetName() == aProjectName + wxT( 
"-job" ) )
 
  208            destFile.SetName( aNewProjectName + wxT( 
"-job" )  );
 
  215         while( ( line = jobfileReader.
ReadLine() ) != 
nullptr )
 
  216            data << line << 
'\n';
 
  219        if( !data.Contains( wxT( 
"{" ) ) )
 
  221            KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
 
  225        bool success = 
false;
 
  232            for( 
auto& entry : js[
"FilesAttributes"] )
 
  234                wxString 
path = wxString( entry[
"Path"].get<std::string>() );
 
  236                if( 
path.StartsWith( aProjectName + wxT( 
"-" ) ) )
 
  238                    path.Replace( aProjectName, aNewProjectName, 
false );
 
  239                    entry[
"Path"] = 
path.ToStdString();
 
  243            wxFFile destJobFile( destFile.GetFullPath(), wxT( 
"wb" ) );
 
  245            if( destJobFile.IsOpened() )
 
  246                success = destJobFile.Write( js.dump( 0 ) );
 
  259            if( !aErrors.empty() )
 
  260                aErrors += wxT( 
"\n" );
 
  262            msg.Printf( 
_( 
"Cannot copy file '%s'." ), destFile.GetFullPath() );
 
  268        wxString destFileName = destFile.GetName();
 
  270        if( destFileName == aProjectName )
 
  271            destFileName = aNewProjectName;
 
  272        else if( destFileName.StartsWith( aProjectName + wxT( 
"-" ) ) )
 
  273            destFileName.Replace( aProjectName, aNewProjectName, 
false );
 
  275        destFile.SetName( destFileName );
 
  277        KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
 
  281        wxFAIL_MSG( wxT( 
"Unexpected filetype for GerbView::SaveFileAs()" ) );
 
 
 
constexpr EDA_IU_SCALE gerbIUScale
 
static std::list< TOOL_ACTION * > & GetActionList()
Return list of TOOL_ACTIONs.
 
The base frame for deriving all KiCad main window classes.
 
A LINE_READER that reads from an open file.
 
char * ReadLine() override
Read a line of text into the buffer and increments the line number counter.
 
KIFACE_BASE(const char *aKifaceName, KIWAY::FACE_T aId)
 
void InitSettings(APP_SETTINGS_BASE *aSettings)
 
void end_common()
Common things to do for a top program module, during OnKifaceEnd();.
 
APP_SETTINGS_BASE * KifaceSettings() const
 
bool start_common(int aCtlBits)
Common things to do for a top program module, during OnKifaceStart().
 
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
 
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
 
FACE_T
Known KIFACE implementations.
 
Container for data for KiCad programs.
 
virtual SETTINGS_MANAGER & GetSettingsManager() const
 
T * RegisterSettings(T *aSettings, bool aLoadNow=true)
Take ownership of the pointer passed in.
 
UNITS_PROVIDER(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits)
 
EDA_UNITS GetUserUnits() const
 
void SetUserUnits(EDA_UNITS aUnits)
 
@ PANEL_GBR_DISPLAY_OPTIONS
 
@ PANEL_GBR_EXCELLON_OPTIONS
 
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
 
void KiCopyFile(const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
 
static const std::string GerberJobFileExtension
 
static const std::string DrillFileExtension
 
static bool IsGerberFileExtension(const wxString &ext)
 
This file contains miscellaneous commonly used macros and functions.
 
GERBV::IFACE KIFACE_BASE, UNITS_PROVIDER kiface("gerbview", KIWAY::FACE_GERBVIEW)
 
T * GetToolbarSettings(const wxString &aFilename)
 
T * GetAppSettings(const char *aFilename)
 
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
 
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits, KIWAY *aKiway) override
Typically start_common() is called from here.
 
void SaveFileAs(const wxString &aProjectBasePath, const wxString &aProjectName, const wxString &aNewProjectBasePath, const wxString &aNewProjectName, const wxString &aSrcFilePath, wxString &aErrors) override
Saving a file under a different name is delegated to the various KIFACEs because the project doesn't ...
 
wxWindow * CreateKiWindow(wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
Create a wxWindow for the current project.
 
void * IfaceOrAddress(int aDataId) override
Return a pointer to the requested object.
 
void OnKifaceEnd() override
Called just once just before the DSO is to be unloaded.
 
IFACE(const char *aName, KIWAY::FACE_T aType)
 
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits, KIWAY *aKiway) override
Typically start_common() is called from here.
 
Implement a participant in the KIWAY alchemy.
 
Definition of file extensions used in Kicad.