2007-05-06 16:03:28 +00:00
|
|
|
/*****************************************************************************
|
2009-10-16 17:18:23 +00:00
|
|
|
* Program to draw EE diagrams. *
|
|
|
|
* This module redraw/draw all structs. *
|
2007-05-06 16:03:28 +00:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2009-04-05 20:49:15 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "class_sch_screen.h"
|
|
|
|
#include "wxEeschemaStruct.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "general.h"
|
|
|
|
#include "protos.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_library.h"
|
2010-12-21 15:13:09 +00:00
|
|
|
#include "sch_bus_entry.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_component.h"
|
2011-01-12 21:47:54 +00:00
|
|
|
#include "sch_junction.h"
|
2010-12-21 15:13:09 +00:00
|
|
|
#include "sch_line.h"
|
|
|
|
#include "sch_no_connect.h"
|
|
|
|
#include "sch_polyline.h"
|
|
|
|
#include "sch_sheet.h"
|
|
|
|
#include "sch_sheet_path.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2010-01-05 08:48:49 +00:00
|
|
|
#include "build_version.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, int Color )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
BASE_SCREEN* screen = panel->GetScreen();
|
|
|
|
|
|
|
|
if( !screen->m_IsPrinting ) /* Draw but do not print the Dangling Symbol */
|
2008-03-13 06:36:53 +00:00
|
|
|
{
|
|
|
|
GRRect( &panel->m_ClipBox, DC,
|
2009-01-02 17:07:50 +00:00
|
|
|
pos.x - DANGLING_SYMBOL_SIZE, pos.y - DANGLING_SYMBOL_SIZE,
|
|
|
|
pos.x + DANGLING_SYMBOL_SIZE, pos.y + DANGLING_SYMBOL_SIZE,
|
|
|
|
0, Color );
|
2008-03-13 06:36:53 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2009-01-02 17:07:50 +00:00
|
|
|
* Redraws only the active window which is assumed to be whole visible.
|
2008-03-13 06:36:53 +00:00
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-03-13 06:36:53 +00:00
|
|
|
wxString title;
|
|
|
|
|
|
|
|
if( GetScreen() == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
DrawPanel->DrawBackGround( DC );
|
|
|
|
|
2011-01-11 20:34:29 +00:00
|
|
|
GetScreen()->Draw( DrawPanel, DC, GR_DEFAULT_DRAWMODE );
|
2008-03-13 06:36:53 +00:00
|
|
|
|
2009-06-02 07:26:49 +00:00
|
|
|
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness );
|
2008-03-13 06:36:53 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
if( DrawPanel->IsMouseCaptured() )
|
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
2008-03-13 06:36:53 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->DrawCrossHair( DC );
|
2008-04-16 08:40:31 +00:00
|
|
|
|
|
|
|
// Display the sheet filename, and the sheet path, for non root sheets
|
2011-01-20 16:34:57 +00:00
|
|
|
if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
|
2008-03-13 06:36:53 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxString msg = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
2011-01-20 16:34:57 +00:00
|
|
|
title.Printf( wxT( "%s [%s]" ), GetChars( msg), GetChars( GetScreen()->GetFileName() ) );
|
2008-03-13 06:36:53 +00:00
|
|
|
SetTitle( title );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-31 10:43:10 +00:00
|
|
|
#if 0
|
2008-04-16 08:40:31 +00:00
|
|
|
title = wxT( "[" );
|
2011-01-20 16:34:57 +00:00
|
|
|
title << GetScreen()->GetFileName() << wxT( "] " ) << _( "Sheet" );
|
2008-04-16 08:40:31 +00:00
|
|
|
title << wxT( " " ) << m_CurrentSheet->PathHumanReadable();
|
2010-08-31 10:43:10 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
// Window title format:
|
|
|
|
// [filename sheetpath] (/path/to/filedir)
|
|
|
|
|
2011-01-20 16:34:57 +00:00
|
|
|
wxFileName t( GetScreen()->GetFileName() );
|
2010-08-31 10:43:10 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
// Often the /path/to/filedir is blank because of the FullFileName argument
|
|
|
|
// passed to LoadOneEEFile() which omits the path on non-root schematics.
|
|
|
|
// Making the path absolute solves this problem.
|
|
|
|
t.MakeAbsolute();
|
2010-08-31 10:43:10 +00:00
|
|
|
title = wxChar( '[' );
|
|
|
|
title << t.GetName() << wxChar( ' ' );
|
|
|
|
title << m_CurrentSheet->PathHumanReadable() << wxChar( ']' );
|
|
|
|
|
|
|
|
title << wxChar( ' ' );
|
|
|
|
title << wxChar( '(' ) << t.GetPath() << wxChar( ')' );
|
2011-08-18 19:25:12 +00:00
|
|
|
|
|
|
|
if( !t.IsFileWritable() )
|
|
|
|
title << _( " [Read Only]" );
|
2010-08-31 10:43:10 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-13 06:36:53 +00:00
|
|
|
SetTitle( title );
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|