KiCad PCB EDA Suite
gerbview.cpp File Reference

GERBVIEW main file. More...

#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerbview_settings.h>
#include <gestfich.h>
#include <kiface_base.h>
#include <macros.h>
#include <nlohmann/json.hpp>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <wildcards_and_files_ext.h>
#include <wx/ffile.h>

Go to the source code of this file.

Classes

struct  GERBV::IFACE
 

Namespaces

 GERBV
 

Typedefs

using json = nlohmann::json
 

Functions

GERBV::IFACE KIFACE_BASE GERBV::kiface ("gerbview", KIWAY::FACE_GERBVIEW)
 
 IFACE (const char *aName, KIWAY::FACE_T aType)
 
bool OnKifaceStart (PGM_BASE *aProgram, int aCtlBits) override
 
void OnKifaceEnd () override
 
wxWindow * CreateWindow (wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
 
void * IfaceOrAddress (int aDataId) override
 Return a pointer to the requested object. More...
 
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 know the internal format of the various files (which may have paths in them that need updating). More...
 
KIFACE_BASEKiface ()
 Global KIFACE_BASE "get" accessor. More...
 
 MY_API (KIFACE *) KIFACE_GETTER(int *aKIFACEversion
 
PGM_BASEPgm ()
 The global Program "get" accessor. More...
 
PGM_BASEPgmOrNull ()
 similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from a script, not from a kicad appl More...
 

Variables

static PGM_BASEprocess
 
int aKiwayVersion
 
int PGM_BASEaProgram
 
return & kiface
 

Detailed Description

GERBVIEW main file.

Definition in file gerbview.cpp.

Typedef Documentation

◆ json

using json = nlohmann::json

Definition at line 41 of file gerbview.cpp.

Function Documentation

◆ CreateWindow()

wxWindow* kiface::CreateWindow ( wxWindow *  aParent,
int  aClassId,
KIWAY aKiway,
int  aCtlBits = 0 
)
override

Definition at line 164 of file gerbview.cpp.

169  {
170  wxString destFileName = destFile.GetName();
171 
172  if( destFileName.StartsWith( aProjectName + "-" ) )
173  {
174  destFileName.Replace( aProjectName, aNewProjectName, false );
175  destFile.SetName( destFileName );
176  }
177 
178  KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
179  }
180  else if( ext == "gbrjob" )
181  {
void KiCopyFile(const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
Definition: gestfich.cpp:334

◆ IFACE()

kiface::IFACE ( const char *  aName,
KIWAY::FACE_T  aType 
)

Definition at line 156 of file gerbview.cpp.

156 {
157  wxFileName destFile( aSrcFilePath );
158  wxString destPath = destFile.GetPathWithSep();

◆ IfaceOrAddress()

void* kiface::IfaceOrAddress ( int  aDataId)
override

Return a pointer to the requested object.

The safest way to use this is to retrieve a pointer to a static instance of an interface, similar to how the KIFACE interface is exported. But if you know what you are doing use it to retrieve anything you want.

Parameters
aDataIdidentifies which object you want the address of.
Returns
the object requested and must be cast into the know type.

Definition at line 193 of file gerbview.cpp.

194  {" ) )
195  {
196  KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );

References KiCopyFile().

◆ Kiface()

KIFACE_BASE& Kiface ( )

Global KIFACE_BASE "get" accessor.

Definition at line 112 of file gerbview.cpp.

112 { return kiface; }
return & kiface
Definition: gerbview.cpp:120

References GERBV::kiface().

◆ MY_API()

MY_API ( KIFACE )

◆ OnKifaceEnd()

void kiface::OnKifaceEnd ( )
override

Definition at line 47 of file mocks_eeschema.cpp.

47  {
48  return true;
49  }

◆ OnKifaceStart()

bool kiface::OnKifaceStart ( PGM_BASE aProgram,
int  aCtlBits 
)
override

Definition at line 40 of file common_mocks.cpp.

40 {
41  static PGM_TEST_FRAME program;
42  return program;
43 }
PGM_SINGLE_TOP program

◆ Pgm()

PGM_BASE& Pgm ( )

The global Program "get" accessor.

Implemented in: 1) common/single_top.cpp, 2) kicad/kicad.cpp, and 3) scripting/kiway.i

Definition at line 124 of file gerbview.cpp.

125 {
126  wxASSERT( process ); // KIFACE_GETTER has already been called.
127  return *process;
128 }
static PGM_BASE * process
Definition: gerbview.cpp:109

References process.

◆ PgmOrNull()

PGM_BASE* PgmOrNull ( )

similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from a script, not from a kicad appl

Definition at line 132 of file gerbview.cpp.

133 {
134  return process;
135 }
static PGM_BASE * process
Definition: gerbview.cpp:109

References process.

◆ SaveFileAs()

void kiface::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 know the internal format of the various files (which may have paths in them that need updating).

Variable Documentation

◆ aKiwayVersion

int aKiwayVersion

Definition at line 117 of file gerbview.cpp.

◆ aProgram

int PGM_BASE* aProgram
Initial value:
{
int PGM_BASE * aProgram
Definition: gerbview.cpp:118
static PGM_BASE * process
Definition: gerbview.cpp:109

Definition at line 118 of file gerbview.cpp.

Referenced by GERBV::IFACE::OnKifaceStart().

◆ kiface

return& kiface

Definition at line 120 of file gerbview.cpp.

◆ process

PGM_BASE* process
static

Definition at line 109 of file gerbview.cpp.

Referenced by Pgm(), and PgmOrNull().