Commit 8c87d71e authored by Dick Hollenbeck's avatar Dick Hollenbeck

Make environment variable wxGrid/table read-only in the fp lib table dialog.

Fix throwing of IO_ERROR in plugin.cpp by converting function name to wxString.GetData().
Switch to const PROPERTIES* in GITHUB PLUGIN functions.
parent 25b20c55
......@@ -150,7 +150,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
// Grid
m_path_subs_grid->CreateGrid( 1, 2 );
m_path_subs_grid->EnableEditing( true );
m_path_subs_grid->EnableEditing( false );
m_path_subs_grid->EnableGridLines( true );
m_path_subs_grid->EnableDragGridSize( false );
m_path_subs_grid->SetMargins( 0, 0 );
......
......@@ -1399,7 +1399,7 @@
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">1</property>
<property name="editing">1</property>
<property name="editing">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
......
......@@ -98,8 +98,10 @@ const wxString& GITHUB_PLUGIN::GetFileExtension() const
wxArrayString GITHUB_PLUGIN::FootprintEnumerate(
const wxString& aLibraryPath, PROPERTIES* aProperties )
const wxString& aLibraryPath, const PROPERTIES* aProperties )
{
D(printf("%s: this:%p aLibraryPath:'%s'\n", __func__, this, TO_UTF8(aLibraryPath) );)
cacheLib( aLibraryPath );
wxArrayString ret;
......@@ -114,8 +116,10 @@ wxArrayString GITHUB_PLUGIN::FootprintEnumerate(
MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, PROPERTIES* aProperties )
const wxString& aFootprintName, const PROPERTIES* aProperties )
{
D(printf("%s: this:%p aLibraryPath:'%s'\n", __func__, this, TO_UTF8(aLibraryPath) );)
cacheLib( aLibraryPath );
string fp_name = TO_UTF8( aFootprintName );
......@@ -162,11 +166,18 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath ) throw( IO_ERROR )
{
if( !m_cache || m_lib_path != aLibraryPath )
{
D(printf("%s: this:%p m_lib_path:'%s' aLibraryPath:'%s'\n",
__func__, this, TO_UTF8( m_lib_path), TO_UTF8(aLibraryPath) );)
delete m_cache;
m_cache = new GH_CACHE();
remote_get_zip( aLibraryPath );
m_lib_path = aLibraryPath;
D(printf("%s2: this:%p m_lib_path:'%s' aLibraryPath:'%s'\n",
__func__, this, TO_UTF8( m_lib_path), TO_UTF8(aLibraryPath) );)
wxMemoryInputStream mis( &m_zip_image[0], m_zip_image.size() );
// @todo: generalize this name encoding from a PROPERTY (option) later
......@@ -194,7 +205,7 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath ) throw( IO_ERROR )
bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, string* aZipURL )
{
// e.g. "https://github.com/liftoff-sr/pretty_footprints"
D(printf("aRepoURL:%s\n", TO_UTF8( aRepoURL ) );)
//D(printf("aRepoURL:%s\n", TO_UTF8( aRepoURL ) );)
wxURI repo( aRepoURL );
......
......@@ -47,10 +47,10 @@ public:
const wxString& GetFileExtension() const;
wxArrayString FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties );
wxArrayString FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties );
MODULE* FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, PROPERTIES* aProperties );
const wxString& aFootprintName, const PROPERTIES* aProperties );
bool IsFootprintLibWritable( const wxString& aLibraryPath );
......@@ -82,7 +82,7 @@ private:
wxString m_lib_path; ///< from aLibraryPath, something like https://github.com/liftoff-sr/pretty_footprints
std::string m_zip_image; ///< byte image of the zip file in its entirety.
GH_CACHE* m_cache;
GH_CACHE* m_cache;
};
#endif // GITHUB_PLUGIN_H_
......@@ -25,27 +25,42 @@
#include <io_mgr.h>
#define FMT_UNIMPLEMENTED _( "Plugin '%s' does not implement the '%s' function." )
#define FMT_NOTFOUND _( "Plugin type '%s' is not found." )
/**
* Function not_implemented
* throws an IO_ERROR and complains of an API function not being implemented.
*
* @param aPlugin is a PLUGIN instance
* @param aCaller is the name of the unimplemented API function.
*/
static void not_implemented( PLUGIN* aPlugin, const char* aCaller )
{
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED,
aPlugin->PluginName().GetData(),
wxString::FromUTF8( aCaller ).GetData() )
);
}
BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData(), __FUNCTION__ ) );
not_implemented( this, __FUNCTION__ );
return NULL;
}
void PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData(), __FUNCTION__ ) );
not_implemented( this, __FUNCTION__ );
}
wxArrayString PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
not_implemented( this, __FUNCTION__ );
return wxArrayString();
}
......@@ -53,41 +68,43 @@ MODULE* PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFo
const PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
not_implemented( this, __FUNCTION__ );
return NULL;
}
void PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, const PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
not_implemented( this, __FUNCTION__ );
}
void PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
not_implemented( this, __FUNCTION__ );
}
void PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
not_implemented( this, __FUNCTION__ );
}
bool PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
not_implemented( this, __FUNCTION__ );
return false;
}
bool PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath )
{
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) );
not_implemented( this, __FUNCTION__ );
return false;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment