Commit 7e448f2e authored by dickelbeck's avatar dickelbeck

minor housekeeping

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