Commit 7e448f2e authored by dickelbeck's avatar dickelbeck

minor housekeeping

parent 6a0451e7
/****************************/ /****************************/
/* EESCHEMA - files-io.cpp */ /* EESCHEMA - files-io.cpp */
/****************************/ /****************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -17,125 +17,140 @@ ...@@ -17,125 +17,140 @@
/****************************************************************/ /****************************************************************/
void WinEDA_SchematicFrame::Save_File(wxCommandEvent& event) void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
/****************************************************************/ /****************************************************************/
/* Commands to save shepatic project or the current page. /* Commands to save shepatic project or the current page.
*/ */
{ {
int id = event.GetId(); int id = event.GetId();
switch (id) switch( id )
{ {
case ID_SAVE_PROJECT: /* Update Schematic File */ case ID_SAVE_PROJECT: /* Update Schematic File */
SaveProject(this); SaveProject( this );
break; break;
case ID_SAVE_ONE_SHEET: /* Update Schematic File */ case ID_SAVE_ONE_SHEET: /* Update Schematic File */
SaveEEFile(NULL, FILE_SAVE_AS); SaveEEFile( NULL, FILE_SAVE_AS );
break; break;
case ID_SAVE_ONE_SHEET_AS: /* Save EED (new name) */ case ID_SAVE_ONE_SHEET_AS: /* Save EED (new name) */
SaveEEFile(NULL, FILE_SAVE_NEW); SaveEEFile( NULL, FILE_SAVE_NEW );
break; break;
default: DisplayError(this, wxT("WinEDA_SchematicFrame::Save_File Internal Error")); default:
break; DisplayError( this, wxT( "WinEDA_SchematicFrame::Save_File Internal Error" ) );
} break;
}
} }
/******************************************************************************************/ /******************************************************************************************/
bool WinEDA_SchematicFrame::LoadOneSheet(SCH_SCREEN * screen, const wxString & filename) bool WinEDA_SchematicFrame::LoadOneSheet( SCH_SCREEN* screen, const wxString& filename )
/******************************************************************************************/ /******************************************************************************************/
{ {
wxString FullFileName = filename; wxString FullFileName = filename;
if( screen->EEDrawList != NULL ) if( screen->EEDrawList != NULL )
{ {
if( !IsOK(this, _("Clear SubHierarchy ?") ) ) return FALSE; if( !IsOK( this, _( "Clear SubHierarchy ?" ) ) )
} return FALSE;
}
if( FullFileName.IsEmpty() )
{ if( FullFileName.IsEmpty() )
wxString mask; {
mask = wxT("*") + g_SchExtBuffer; wxString mask;
FullFileName = EDA_FileSelector( _("Schematic files:"), mask = wxT( "*" ) + g_SchExtBuffer;
wxEmptyString, /* default path */ FullFileName = EDA_FileSelector( _( "Schematic files:" ),
screen->m_FileName, /* default filename */ wxEmptyString, /* default path */
g_SchExtBuffer, /* extension par defaut */ screen->m_FileName, /* default filename */
mask, /* Masque d'affichage */ g_SchExtBuffer, /* extension par defaut */
this, mask, /* Masque d'affichage */
wxFD_OPEN, this,
FALSE wxFD_OPEN,
); FALSE
if ( FullFileName.IsEmpty() ) return FALSE; );
} if( FullFileName.IsEmpty() )
return FALSE;
ClearProjectDrawList(screen, TRUE); }
screen->m_FileName = FullFileName; ClearProjectDrawList( screen, TRUE );
LoadOneEEFile(screen, FullFileName);
screen->SetModify(); screen->m_FileName = FullFileName;
LoadOneEEFile( screen, FullFileName );
if ( GetScreen() == screen ) Refresh(TRUE); screen->SetModify();
return TRUE;
if( GetScreen() == screen )
Refresh( TRUE );
return TRUE;
} }
/****************************************************/ /****************************************************/
void SaveProject(WinEDA_SchematicFrame * frame) void SaveProject( WinEDA_SchematicFrame* frame )
/****************************************************/ /****************************************************/
/* Sauvegarde toutes les feuilles du projet /* Sauvegarde toutes les feuilles du projet
et cre une librairie archive des composants, de nom <root_name>.chche.lib * et cre une librairie archive des composants, de nom <root_name>.chche.lib
*/ */
{ {
SCH_SCREEN * screen_tmp; SCH_SCREEN* screen_tmp;
wxString LibArchiveFileName; wxString LibArchiveFileName;
if ( frame == NULL) return; if( frame == NULL )
return;
screen_tmp = frame->GetScreen(); screen_tmp = frame->GetScreen();
EDA_ScreenList ScreenList(NULL); EDA_ScreenList ScreenList( NULL );
for ( ActiveScreen = ScreenList.GetFirst(); ActiveScreen != NULL; ActiveScreen = ScreenList.GetNext() )
{
frame->m_CurrentScreen = ActiveScreen;
frame->SaveEEFile( NULL, FILE_SAVE_AS);
}
frame->m_CurrentScreen = ActiveScreen = screen_tmp; for( ActiveScreen = ScreenList.GetFirst();
ActiveScreen != NULL;
ActiveScreen = ScreenList.GetNext() )
{
frame->m_CurrentScreen = ActiveScreen;
frame->SaveEEFile( NULL, FILE_SAVE_AS );
}
/* Creation du fichier d'archivage composants en repertoire courant */ frame->m_CurrentScreen = ActiveScreen = screen_tmp;
LibArchiveFileName = MakeFileName(wxEmptyString,ScreenSch->m_FileName,wxEmptyString);
ChangeFileNameExt(LibArchiveFileName, wxEmptyString);
/* mise a jour extension */
LibArchiveFileName += wxT(".cache") + g_LibExtBuffer;
LibArchive(frame, LibArchiveFileName);
/* Creation du fichier d'archivage composants en repertoire courant */
LibArchiveFileName = MakeFileName( wxEmptyString, ScreenSch->m_FileName, wxEmptyString );
ChangeFileNameExt( LibArchiveFileName, wxEmptyString );
/* mise a jour extension */
LibArchiveFileName += wxT( ".cache" ) + g_LibExtBuffer;
LibArchive( frame, LibArchiveFileName );
} }
/************************/ /************************/
int CountCmpNumber() int CountCmpNumber()
/************************/ /************************/
/* Routine retournant le nombre de composants dans le schema, /* Routine retournant le nombre de composants dans le schema,
powers non comprises */ * powers non comprises */
{ {
BASE_SCREEN * Window; BASE_SCREEN* Window;
EDA_BaseStruct *Phead; EDA_BaseStruct* Phead;
int Nb = 0; int Nb = 0;
Window = ScreenSch ; Window = ScreenSch;
while( Window ) while( Window )
{ {
for( Phead=Window->EEDrawList; Phead != NULL; Phead=Phead->Pnext) for( Phead = Window->EEDrawList; Phead != NULL; Phead = Phead->Pnext )
{ {
if (Phead->Type() == DRAW_LIB_ITEM_STRUCT_TYPE) if( Phead->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
DrawPartStruct * Cmp = (DrawPartStruct *) Phead; DrawPartStruct* Cmp = (DrawPartStruct*) Phead;
if ( Cmp->m_Field[VALUE].m_Text.GetChar(0) != '#' ) Nb++; if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
} Nb++;
} }
Window = (BASE_SCREEN*)Window->Pnext; }
}
Window = (BASE_SCREEN*) Window->Pnext;
return(Nb); }
return Nb;
} }
...@@ -773,7 +773,7 @@ public: ...@@ -773,7 +773,7 @@ public:
* to a part with the same reference as the objectToSync * to a part with the same reference as the objectToSync
* @param objectToSync The object whose reference is used to syncronize eeschema. * @param objectToSync The object whose reference is used to syncronize eeschema.
*/ */
void SendMessageToEESCHEMA( EDA_BaseStruct* objectToSync ); void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
/* Special micro_ondes */ /* Special micro_ondes */
void Edit_Gap( wxDC* DC, MODULE* Module ); void Edit_Gap( wxDC* DC, MODULE* Module );
......
...@@ -1031,8 +1031,9 @@ void D_PAD::Show( int nestLevel, std::ostream& os ) ...@@ -1031,8 +1031,9 @@ void D_PAD::Show( int nestLevel, std::ostream& os )
// for now, make it look like XML: // for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" num=\"" << padname << '"' << " num=\"" << padname << '"' <<
" net=\"" << m_Netname.mb_str() << '"' << " net=\"" << m_Netname.mb_str() << '"' <<
" netcode=\"" << m_NetCode << '"' <<
" layerMask=\"" << layerMask << '"' << m_Pos << "/>\n"; " layerMask=\"" << layerMask << '"' << m_Pos << "/>\n";
// NestedSpace( nestLevel+1, os ) << m_Text.mb_str() << '\n'; // NestedSpace( nestLevel+1, os ) << m_Text.mb_str() << '\n';
......
This diff is collapsed.
...@@ -20,19 +20,20 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame, ...@@ -20,19 +20,20 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
EDA_BaseStruct* DrawStruct, wxDC* DC ); EDA_BaseStruct* DrawStruct, wxDC* DC );
// see wxstruct.h // see wxstruct.h
void WinEDA_PcbFrame::SendMessageToEESCHEMA( EDA_BaseStruct* objectToSync ) void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
{ {
char cmd[1024]; char cmd[1024];
MODULE* module = NULL; MODULE* module = NULL;
if ( objectToSync == NULL ) return ; if ( objectToSync == NULL )
return;
if( objectToSync->Type() == TYPEMODULE ) if( objectToSync->Type() == TYPEMODULE )
module = (MODULE*) objectToSync; module = (MODULE*) objectToSync;
else if( objectToSync->Type() == TYPEPAD ) else if( objectToSync->Type() == TYPEPAD )
module = (MODULE*) objectToSync->m_Parent; module = (MODULE*) objectToSync->GetParent();
else if( objectToSync->Type() == TYPETEXTEMODULE ) else if( objectToSync->Type() == TYPETEXTEMODULE )
module = (MODULE*) objectToSync->m_Parent; module = (MODULE*) objectToSync->GetParent();
// ask only for the reference for now, maybe pins later. // ask only for the reference for now, maybe pins later.
if( module ) if( module )
......
...@@ -375,7 +375,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC ) ...@@ -375,7 +375,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
if( track == NULL ) if( track == NULL )
return; return;
if( Drc_On && ( Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 ) == BAD_DRC) ) if( Drc_On && Drc( this, DC, g_CurrentTrackSegment, m_Pcb->m_Track, 1 )==BAD_DRC )
return; return;
/* Sauvegarde des coord du point terminal de la piste */ /* Sauvegarde des coord du point terminal de la piste */
......
...@@ -235,7 +235,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo ...@@ -235,7 +235,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo
g_SaveTime = time( NULL ); g_SaveTime = time( NULL );
#if 0 && defined(DEBUG) #if 1 && defined(DEBUG)
// note this seems to freeze up pcbnew when run under the kicad project // note this seems to freeze up pcbnew when run under the kicad project
// manager. runs fine from command prompt. // manager. runs fine from command prompt.
// output the board object tree to stdout: // output the board object tree to stdout:
......
...@@ -332,7 +332,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -332,7 +332,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
{ {
// A new track is in progress: call to End_Route() // A new track is in progress: call to End_Route()
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
End_Route( (TRACK*) ( GetCurItem() ), DC ); End_Route( (TRACK*) GetCurItem(), DC );
} }
break; break;
......
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