added comment
This commit is contained in:
parent
afb2eb9b40
commit
b08a3bb300
|
@ -260,6 +260,7 @@ bool TreePrjItemData::Rename( const wxString& name, bool check )
|
|||
//this is broken & unsafe to use on linux.
|
||||
if( m_Type == TREE_DIRECTORY )
|
||||
return false;
|
||||
|
||||
if( name.IsEmpty() )
|
||||
return false;
|
||||
|
||||
|
@ -282,8 +283,7 @@ bool TreePrjItemData::Rename( const wxString& name, bool check )
|
|||
if( check && !ext.IsEmpty() && !reg.Matches( newFile ) )
|
||||
{
|
||||
wxMessageDialog dialog( m_Parent,
|
||||
_(
|
||||
"Changing file extension will change file type.\n Do you want to continue ?" ),
|
||||
_( "Changing file extension will change file type.\n Do you want to continue ?" ),
|
||||
_( "Rename File" ),
|
||||
wxYES_NO | wxICON_QUESTION );
|
||||
|
||||
|
@ -291,23 +291,23 @@ bool TreePrjItemData::Rename( const wxString& name, bool check )
|
|||
return false;
|
||||
}
|
||||
|
||||
#if ( (wxMAJOR_VERSION < 2) || ( (wxMAJOR_VERSION == 2) && (wxMINOR_VERSION < 7) ) )
|
||||
#if ( ( wxMAJOR_VERSION < 2) || ( ( wxMAJOR_VERSION == 2) && (wxMINOR_VERSION < 7 ) ) )
|
||||
if( !wxRenameFile( m_FileName, newFile ) )
|
||||
#else
|
||||
if( !wxRenameFile( m_FileName, newFile, false ) )
|
||||
#endif
|
||||
{
|
||||
wxMessageDialog( m_Parent, _( "Unable to rename file ... " ),
|
||||
_("Permission error ?" ), wxICON_ERROR | wxOK );
|
||||
_( "Permission error ?" ), wxICON_ERROR | wxOK );
|
||||
return false;
|
||||
}
|
||||
SetFileName( newFile );
|
||||
|
||||
#ifdef KICAD_PYTHON
|
||||
#ifdef KICAD_PYTHON
|
||||
object param = make_tuple( PyHandler::Convert( m_FileName ),
|
||||
PyHandler::Convert( newFile ) );
|
||||
PyHandler::GetInstance()->TriggerEvent( wxT( "kicad::RenameFile" ), param );
|
||||
#endif
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ bool TreePrjItemData::Delete( bool check )
|
|||
/* delete a file */
|
||||
{
|
||||
wxMessageDialog dialog( m_Parent, _ ("Do you really want to delete ") + GetFileName(),
|
||||
_("Delete File" ), wxYES_NO | wxICON_QUESTION );
|
||||
_( "Delete File" ), wxYES_NO | wxICON_QUESTION );
|
||||
|
||||
if( !check || wxID_YES == dialog.ShowModal() )
|
||||
{
|
||||
|
@ -350,13 +350,13 @@ bool TreePrjItemData::Delete( bool check )
|
|||
|
||||
|
||||
/**********************************/
|
||||
void TreePrjItemData::Activate(WinEDA_PrjFrame* prjframe)
|
||||
void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe )
|
||||
/**********************************/
|
||||
/* Called under item activation */
|
||||
{
|
||||
wxString sep = wxFileName().GetPathSeparator();
|
||||
wxString FullFileName = GetFileName();
|
||||
wxDir *dir;
|
||||
wxDir* dir;
|
||||
wxString dir_filename;
|
||||
wxTreeItemId id = GetId();
|
||||
int count;
|
||||
|
@ -367,8 +367,10 @@ void TreePrjItemData::Activate(WinEDA_PrjFrame* prjframe)
|
|||
break;
|
||||
|
||||
case TREE_DIRECTORY:
|
||||
if(prjframe){
|
||||
dir = new wxDir(FullFileName);
|
||||
if( prjframe )
|
||||
{
|
||||
dir = new wxDir( FullFileName );
|
||||
|
||||
count = 0;
|
||||
if( dir && dir->IsOpened() && dir->GetFirst( &dir_filename ) )
|
||||
{
|
||||
|
@ -376,39 +378,44 @@ void TreePrjItemData::Activate(WinEDA_PrjFrame* prjframe)
|
|||
{
|
||||
wxString fil = FullFileName + sep + dir_filename;
|
||||
|
||||
if( prjframe->AddFile(fil, id) ){
|
||||
if( prjframe->AddFile( fil, id ) )
|
||||
{
|
||||
count++;
|
||||
}
|
||||
} while( dir->GetNext( &dir_filename ) );
|
||||
}
|
||||
if(count == 0)
|
||||
|
||||
if( count == 0 )
|
||||
{
|
||||
prjframe->AddFile(wxString(_("no kicad files found in this directory")), id);
|
||||
/* The AddFile() text below should match the filter added to handle
|
||||
it in treeprj_frame.cpp in the line looking like this:
|
||||
m_Filters.push_back( wxT( "^no kicad files found" ) );
|
||||
*/
|
||||
prjframe->AddFile( wxString(_("no kicad files found in this directory")), id );
|
||||
}
|
||||
|
||||
/* Sort filenames by alphabetic order */
|
||||
m_Parent->SortChildren( id );
|
||||
if(dir) delete dir;
|
||||
delete dir;
|
||||
}
|
||||
m_Parent->Toggle( id );
|
||||
break;
|
||||
|
||||
case TREE_SCHEMA:
|
||||
{
|
||||
AddDelimiterString( FullFileName );
|
||||
ExecuteFile( m_Parent, EESCHEMA_EXE, FullFileName );
|
||||
break;
|
||||
}
|
||||
|
||||
case TREE_PCB:
|
||||
AddDelimiterString( FullFileName );
|
||||
ExecuteFile( m_Parent, PCBNEW_EXE, FullFileName );
|
||||
break;
|
||||
|
||||
#ifdef KICAD_PYTHON
|
||||
#ifdef KICAD_PYTHON
|
||||
case TREE_PY:
|
||||
PyHandler::GetInstance()->RunScript( FullFileName );
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
case TREE_GERBER:
|
||||
AddDelimiterString( FullFileName );
|
||||
|
|
Loading…
Reference in New Issue