Commit 26a3029a authored by jean-pierre charras's avatar jean-pierre charras

Remove duplicate code to draw and to plot title blocks.

parents c9be8bfd a8a64081
...@@ -62,7 +62,8 @@ const wxString PAGE_INFO::Custom( wxT( "User" ) ); ...@@ -62,7 +62,8 @@ const wxString PAGE_INFO::Custom( wxT( "User" ) );
// local readability macro for millimeter wxSize // local readability macro for millimeter wxSize
#define MMsize( x, y ) wxSize( Mm2mils( x ), Mm2mils( y ) ) #define MMsize( x, y ) wxSize( Mm2mils( x ), Mm2mils( y ) )
// All MUST be defined as landscape. If IsGOST() is true, A4 is dynamically rotated later. // All MUST be defined as landscape.
// If IsGOST() is true, A4 is dynamically rotated later.
const PAGE_INFO PAGE_INFO::pageA4( MMsize( 297, 210 ), wxT( "A4" ), wxPAPER_A4 ); const PAGE_INFO PAGE_INFO::pageA4( MMsize( 297, 210 ), wxT( "A4" ), wxPAPER_A4 );
const PAGE_INFO PAGE_INFO::pageA3( MMsize( 420, 297 ), wxT( "A3" ), wxPAPER_A3 ); const PAGE_INFO PAGE_INFO::pageA3( MMsize( 420, 297 ), wxT( "A3" ), wxPAPER_A3 );
const PAGE_INFO PAGE_INFO::pageA2( MMsize( 594, 420 ), wxT( "A2" ), wxPAPER_A2 ); const PAGE_INFO PAGE_INFO::pageA2( MMsize( 594, 420 ), wxT( "A2" ), wxPAPER_A2 );
...@@ -139,7 +140,7 @@ void PAGE_INFO::setMargins() ...@@ -139,7 +140,7 @@ void PAGE_INFO::setMargins()
m_left_margin = m_left_margin =
m_right_margin = m_right_margin =
m_top_margin = m_top_margin =
m_bottom_margin = 400; // Units = mils m_bottom_margin = Mm2mils( 10 );
} }
} }
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <base_struct.h> #include <base_struct.h>
#include <common.h> #include <common.h>
#include <plot_common.h> #include <plot_common.h>
#include <worksheet.h>
#include <macros.h> #include <macros.h>
#include <class_base_screen.h> #include <class_base_screen.h>
#include <drawtxt.h> #include <drawtxt.h>
......
This diff is collapsed.
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <class_board_item.h> #include <class_board_item.h>
#elif defined( EESCHEMA ) #elif defined( EESCHEMA )
#include <sch_item_struct.h> #include <sch_item_struct.h>
#elif defined( GERBVIEW )
#else #else
#error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW." #error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW."
#endif #endif
...@@ -325,10 +326,12 @@ bool EDA_TEXT::IsDefaultFormatting() const ...@@ -325,10 +326,12 @@ bool EDA_TEXT::IsDefaultFormatting() const
&& ( m_MultilineAllowed == false ) ); && ( m_MultilineAllowed == false ) );
} }
void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
throw( IO_ERROR ) throw( IO_ERROR )
{ {
#ifndef GERBVIEW // Gerbview does not use EDA_TEXT::Format
// and does not define FMT_IU, used here
// however this function should exist
if( !IsDefaultFormatting() ) if( !IsDefaultFormatting() )
{ {
aFormatter->Print( aNestLevel+1, "(effects" ); aFormatter->Print( aNestLevel+1, "(effects" );
...@@ -381,4 +384,5 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl ...@@ -381,4 +384,5 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
aFormatter->Print( 0, ")\n" ); aFormatter->Print( 0, ")\n" );
} }
#endif
} }
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <wxstruct.h> #include <wxstruct.h>
#include <macros.h> #include <macros.h>
#include <param_config.h> #include <param_config.h>
#include <worksheet.h>
#include <id.h> #include <id.h>
#include <build_version.h> #include <build_version.h>
#include <hotkeys_basic.h> #include <hotkeys_basic.h>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* @file worksheet_shape_builder.h
* @brief classes and function to generate graphics to plt or draw titles blocks
* and frame references
*/
#ifndef WORKSHEET_SHAPE_BUILDER_H
#define WORKSHEET_SHAPE_BUILDER_H
/*
* Helper classes to handle basic graphic items used to raw/plot
* title blocks and frame references
* segments
* rect
* polygons (for logos)
* graphic texts
*/
class WS_DRAW_ITEM_BASE // This basic class, not directly usable.
{
public:
enum WS_DRAW_TYPE {
wsg_line, wsg_rect, wsg_poly, wsg_text
};
protected:
WS_DRAW_TYPE m_type; // wsg_line, wsg_rect, wsg_poly, wsg_text
EDA_COLOR_T m_color;
protected:
WS_DRAW_ITEM_BASE( WS_DRAW_TYPE aType, EDA_COLOR_T aColor )
{
m_type = aType;
m_color = aColor;
}
public:
virtual ~WS_DRAW_ITEM_BASE() {}
// Accessors:
EDA_COLOR_T GetColor() { return m_color; }
WS_DRAW_TYPE GetType() { return m_type; };
};
// This class draws a thick segment
class WS_DRAW_ITEM_LINE : public WS_DRAW_ITEM_BASE
{
wxPoint m_start; // start point of line/rect
wxPoint m_end; // end point
int m_penWidth;
public:
WS_DRAW_ITEM_LINE( wxPoint aStart, wxPoint aEnd,
int aPenWidth, EDA_COLOR_T aColor ) :
WS_DRAW_ITEM_BASE( wsg_line, aColor )
{
m_start = aStart;
m_end = aEnd;
m_penWidth = aPenWidth;
}
// Accessors:
int GetPenWidth() { return m_penWidth; }
const wxPoint& GetStart() { return m_start; }
const wxPoint& GetEnd() { return m_end; }
};
// This class draws a polygon
class WS_DRAW_ITEM_POLYGON : public WS_DRAW_ITEM_BASE
{
int m_penWidth;
public:
std::vector <wxPoint> m_Corners;
public:
WS_DRAW_ITEM_POLYGON( wxPoint aStart, wxPoint aEnd,
int aPenWidth, EDA_COLOR_T aColor ) :
WS_DRAW_ITEM_BASE( wsg_poly, aColor )
{
m_penWidth = aPenWidth;
}
// Accessors:
int GetPenWidth() { return m_penWidth; }
};
// This class draws a not filled rectangle with thick segment
class WS_DRAW_ITEM_RECT : public WS_DRAW_ITEM_LINE
{
public:
WS_DRAW_ITEM_RECT( wxPoint aStart, wxPoint aEnd,
int aPenWidth, EDA_COLOR_T aColor ) :
WS_DRAW_ITEM_LINE( aStart, aEnd, aPenWidth, aColor )
{
m_type = wsg_rect;
}
};
// This class draws a graphic text.
// it is derived from an EDA_TEXT, so it handle all caracteristics
// of this graphic text (justification, rotation ... )
class WS_DRAW_ITEM_TEXT : public WS_DRAW_ITEM_BASE, public EDA_TEXT
{
public:
WS_DRAW_ITEM_TEXT( wxString& aText, wxPoint aPos, wxSize aSize,
int aPenWidth, EDA_COLOR_T aColor,
bool aItalic = false, bool aBold = false ) :
WS_DRAW_ITEM_BASE( wsg_text, aColor ), EDA_TEXT( aText )
{
SetTextPosition( aPos );
SetSize( aSize );
SetThickness( aPenWidth );
SetItalic( aItalic );
SetBold( aBold );
}
// Accessors:
int GetPenWidth() { return GetThickness(); }
};
/*
* this class stores the list of graphic items to draw/plot
* the title block and frame references
*/
class WS_DRAW_ITEM_LIST
{
std::vector <WS_DRAW_ITEM_BASE*> m_graphicList;
unsigned m_idx;
public:
WS_DRAW_ITEM_LIST()
{
m_idx = 0;
}
~WS_DRAW_ITEM_LIST()
{
for( unsigned ii = 0; ii < m_graphicList.size(); ii++ )
delete m_graphicList[ii];
}
void Append( WS_DRAW_ITEM_BASE* aItem )
{
m_graphicList.push_back( aItem );
}
WS_DRAW_ITEM_BASE* GetFirst()
{
m_idx = 0;
if( m_graphicList.size() )
return m_graphicList[0];
else
return NULL;
}
WS_DRAW_ITEM_BASE* GetNext()
{
m_idx++;
if( m_graphicList.size() > m_idx )
return m_graphicList[m_idx];
else
return NULL;
}
/**
* Function BuildWorkSheetGraphicList is a core function for
* drawing or plotting the page layout with
* the frame and the basic inscriptions.
* It fills the list of basic graphic items to draw or plot.
* currently lines, rect, polygons and texts
*
* @param aPageSize The size of the page layout.
* @param aLTmargin The left top margin of the page layout.
* @param aRBmargin The right bottom margin of the page layout.
* @param aPaperFormat The paper size type, for basic inscriptions.
* @param aFileName The file name, for basic inscriptions.
* @param aTitleBlock The sheet title block, for basic inscriptions.
* @param aSheetCount The number of sheets (for basic inscriptions).
* @param aSheetNumber The sheet number (for basic inscriptions).
* @param aPenWidth The line width for drawing.
* @param aScalar Scalar to convert from mils to internal units.
* @param aLineColor The color for drawing.
* @param aTextColor The color for inscriptions.
*/
void BuildWorkSheetGraphicList( wxSize& aPageSize,
wxPoint& aLTmargin, wxPoint& aRBmargin,
const wxString& aPaperFormat,
const wxString& aFileName,
const wxString& aSheetPathHumanReadable,
const TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
int aPenWidth, double aScalar,
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor );
};
#endif // WORKSHEET_SHAPE_BUILDER_H
...@@ -60,6 +60,14 @@ ...@@ -60,6 +60,14 @@
#define TRACE_DESTRUCTOR 0 #define TRACE_DESTRUCTOR 0
// the separator char between the subpart id and the reference
// 0 (no separator) or '.' or some other character
int LIB_COMPONENT::m_subpartIdSeparator = 0;
// the ascii char value to calculate the subpart symbol id from the part number:
// 'A' or '1' usually. (to print U1.A or U1.1)
// if this a a digit, a number is used as id symbol
int LIB_COMPONENT::m_subpartFirstId = 'A';
LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_COMPONENT* aRootComponent ): LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_COMPONENT* aRootComponent ):
EDA_ITEM( LIB_ALIAS_T ) EDA_ITEM( LIB_ALIAS_T )
...@@ -251,14 +259,18 @@ wxString LIB_COMPONENT::GetLibraryName() ...@@ -251,14 +259,18 @@ wxString LIB_COMPONENT::GetLibraryName()
} }
wxString LIB_COMPONENT::ReturnSubReference( int aUnit ) wxString LIB_COMPONENT::ReturnSubReference( int aUnit, bool aAddSeparator )
{ {
wxString subRef; wxString subRef;
#if defined(KICAD_GOST)
subRef.Printf( wxT(".%d" ), aUnit); if( m_subpartIdSeparator != 0 && aAddSeparator )
#else subRef << wxChar( m_subpartIdSeparator );
subRef.Append( wxChar(aUnit + 'A' - 1) );
#endif if( m_subpartFirstId >= '0' && m_subpartFirstId <= '9' )
subRef << aUnit;
else
subRef << wxChar( m_subpartFirstId + aUnit - 1);
return subRef; return subRef;
} }
......
...@@ -187,6 +187,9 @@ extern int LibraryEntryCompare( const LIB_ALIAS* aItem1, const LIB_ALIAS* aItem2 ...@@ -187,6 +187,9 @@ extern int LibraryEntryCompare( const LIB_ALIAS* aItem1, const LIB_ALIAS* aItem2
*/ */
class LIB_COMPONENT : public EDA_ITEM class LIB_COMPONENT : public EDA_ITEM
{ {
friend class CMP_LIBRARY;
friend class LIB_ALIAS;
wxString m_name; wxString m_name;
int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to 0 int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to 0
///< to draw the pin name above the pin. ///< to draw the pin name above the pin.
...@@ -203,12 +206,15 @@ class LIB_COMPONENT : public EDA_ITEM ...@@ -203,12 +206,15 @@ class LIB_COMPONENT : public EDA_ITEM
LIB_ALIASES m_aliases; ///< List of alias object pointers associated with the LIB_ALIASES m_aliases; ///< List of alias object pointers associated with the
///< component. ///< component.
CMP_LIBRARY* m_library; ///< Library the component belongs to if any. CMP_LIBRARY* m_library; ///< Library the component belongs to if any.
static int m_subpartIdSeparator; ///< the separator char between
///< the subpart id and the reference
///< like U1A ( m_subpartIdSeparator = 0 ) or U1.A or U1-A
static int m_subpartFirstId; ///< the ascii char value to calculate the subpart symbol id
///< from the part number: only 'A', 'a' or '1' can be used,
///< other values have no sense.
void deleteAllFields(); void deleteAllFields();
friend class CMP_LIBRARY;
friend class LIB_ALIAS;
public: public:
LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary = NULL ); LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary = NULL );
LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary = NULL ); LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary = NULL );
...@@ -645,9 +651,17 @@ public: ...@@ -645,9 +651,17 @@ public:
* @return the sub reference for component having multiple parts per package. * @return the sub reference for component having multiple parts per package.
* The sub reference identify the part (or unit) * The sub reference identify the part (or unit)
* @param aUnit = the part identifier ( 1 to max count) * @param aUnit = the part identifier ( 1 to max count)
* @param aAddSeparator = true (default) to prpebd the sub ref
* by the separator symbol (if any)
* Note: this is a static function. * Note: this is a static function.
*/ */
static wxString ReturnSubReference( int aUnit ); static wxString ReturnSubReference( int aUnit, bool aAddSeparator = true );
// Accessors to sub ref parameters
static int GetSubpartIdSeparator() { return m_subpartIdSeparator; }
static void SetSubpartIdSeparator( int aSep ) { m_subpartIdSeparator = aSep; }
static int GetSubpartFirstId() { return m_subpartFirstId; }
static void SetSubpartFirstId( int aFirstId ) { m_subpartFirstId = aFirstId; }
/** /**
* Set or clear the alternate body style (DeMorgan) for the component. * Set or clear the alternate body style (DeMorgan) for the component.
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <eda_text.h> #include <eda_text.h>
#include <general.h> #include <general.h>
#include <class_libentry.h>
#include <sch_junction.h>
#include <protos.h> #include <protos.h>
#include <hotkeys.h> #include <hotkeys.h>
#include <dialogs/dialog_color_config.h> #include <dialogs/dialog_color_config.h>
...@@ -117,10 +119,26 @@ bool EDA_APP::OnInit() ...@@ -117,10 +119,26 @@ bool EDA_APP::OnInit()
} }
// Give a default colour for all layers // Give a default colour for all layers
// (actual color will beinitialized by config) // (actual color will be initialized by config)
for( int ii = 0; ii < NB_SCH_LAYERS; ii++ ) for( int ii = 0; ii < NB_SCH_LAYERS; ii++ )
SetLayerColor( DARKGRAY, ii ); SetLayerColor( DARKGRAY, ii );
//#define KICAD_GOST
#ifdef KICAD_GOST
// These options will be user configurable in the future,
// and not specific to GOST users
// the separator char between the subpart id and the reference
// 0 (no separator) or '.' or some other character
LIB_COMPONENT::SetSubpartIdSeparator( '.' );
// the ascii char value to calculate the subpart symbol id from the part number:
// 'A' or '1' usually. (to print U1.A or U1.1)
// if this is a digit, a number is used as id symbol
LIB_COMPONENT::SetSubpartFirstId( '1' );
// Default diameter of the junction symbol
SCH_JUNCTION::SetSymbolSize( 32 );
#endif
// read current setup and reopen last directory if no filename to open in // read current setup and reopen last directory if no filename to open in
// command line // command line
bool reopenLastUsedDirectory = argc == 1; bool reopenLastUsedDirectory = argc == 1;
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <general.h> #include <general.h>
#include <libeditframe.h> #include <libeditframe.h>
#include <eeschema_config.h> #include <eeschema_config.h>
#include <worksheet.h>
#include <hotkeys.h> #include <hotkeys.h>
#include <sch_sheet.h> #include <sch_sheet.h>
......
...@@ -186,14 +186,14 @@ const wxChar* MsgPinElectricType[] = ...@@ -186,14 +186,14 @@ const wxChar* MsgPinElectricType[] =
LIB_PIN::LIB_PIN( LIB_COMPONENT* aParent ) : LIB_PIN::LIB_PIN( LIB_COMPONENT* aParent ) :
LIB_ITEM( LIB_PIN_T, aParent ) LIB_ITEM( LIB_PIN_T, aParent )
{ {
m_length = 300; /* default Pin len */ m_length = DEFAULT_PIN_LENGTH; // default Pin len
m_orientation = PIN_RIGHT; /* Pin orient: Up, Down, Left, Right */ m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
m_shape = NONE; /* Pin shape, bitwise. */ m_shape = NONE; // Pin shape, bitwise.
m_type = PIN_UNSPECIFIED; /* electrical type of pin */ m_type = PIN_UNSPECIFIED; // electrical type of pin
m_attributes = 0; /* bit 0 != 0: pin invisible */ m_attributes = 0; // bit 0 != 0: pin invisible
m_number = 0; /* pin number ( i.e. 4 codes ASCII ) */ m_number = 0; // pin number (i.e. 4 ASCII chars)
m_numTextSize = 50; m_numTextSize = DEFAULT_TEXT_SIZE;
m_nameTextSize = 50; /* Default size for pin name and num */ m_nameTextSize = DEFAULT_TEXT_SIZE; // Default size for pin name and num
m_width = 0; m_width = 0;
m_typeName = _( "Pin" ); m_typeName = _( "Pin" );
} }
......
...@@ -32,18 +32,14 @@ ...@@ -32,18 +32,14 @@
#include <lib_draw_item.h> #include <lib_draw_item.h>
#define TARGET_PIN_RADIUS 12 /* Circle diameter drawn at the active end of pins */ #define TARGET_PIN_RADIUS 12 // Circle diameter drawn at the active end of pins
#define PIN_LENGTH 300 /* Default Length of each pin to be drawn. */ #define DEFAULT_PIN_LENGTH 300 // Default Length of a pin when it is created.
#if defined(KICAD_GOST) // pins: special symbols sizes
#define INVERT_PIN_RADIUS 30 /* Radius of inverted pin circle. */ #define INVERT_PIN_RADIUS 30 // Radius of inverted pin circle.
#else #define CLOCK_PIN_DIM 40 // Dim of clock pin symbol.
#define INVERT_PIN_RADIUS 35 /* Radius of inverted pin circle. */ #define IEEE_SYMBOL_PIN_DIM 40 // Dim of special pin symbol.
#endif #define NONLOGIC_PIN_DIM 30 // Dim of nonlogic pin symbol (X).
#define CLOCK_PIN_DIM 40 /* Dim of clock pin symbol. */
#define IEEE_SYMBOL_PIN_DIM 40 /* Dim of special pin symbol. */
#define NONLOGIC_PIN_DIM 30 /* Dim of nonlogic pin symbol (X). */
/** /**
* The component library pin object electrical types used in ERC tests. * The component library pin object electrical types used in ERC tests.
......
...@@ -468,12 +468,8 @@ void LIB_EDIT_FRAME::UpdatePartSelectList() ...@@ -468,12 +468,8 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
{ {
for( int i = 0; i < m_component->GetPartCount(); i++ ) for( int i = 0; i < m_component->GetPartCount(); i++ )
{ {
wxString msg; wxString msg = LIB_COMPONENT::ReturnSubReference( i+1, false );
#if defined(KICAD_GOST) msg.Printf( _( "Part %s" ), GetChars( msg ) );
msg.Printf( _( "Part %d" ), i + 1 );
#else
msg.Printf( _( "Part %c" ), 'A' + i );
#endif
m_partSelectBox->Append( msg ); m_partSelectBox->Append( msg );
} }
} }
......
...@@ -59,9 +59,9 @@ static wxPoint PinPreviousPos; ...@@ -59,9 +59,9 @@ static wxPoint PinPreviousPos;
static int LastPinType = PIN_INPUT; static int LastPinType = PIN_INPUT;
static int LastPinOrient = PIN_RIGHT; static int LastPinOrient = PIN_RIGHT;
static int LastPinShape = NONE; static int LastPinShape = NONE;
static int LastPinLength = 300; static int LastPinLength = DEFAULT_PIN_LENGTH;
static int LastPinNameSize = 50; static int LastPinNameSize = DEFAULT_TEXT_SIZE;
static int LastPinNumSize = 50; static int LastPinNumSize = DEFAULT_TEXT_SIZE;
static bool LastPinCommonConvert = false; static bool LastPinCommonConvert = false;
static bool LastPinCommonUnit = false; static bool LastPinCommonUnit = false;
static bool LastPinVisible = true; static bool LastPinVisible = true;
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <fctsys.h> #include <fctsys.h>
#include <plot_common.h> #include <plot_common.h>
#include <worksheet.h>
#include <class_sch_screen.h> #include <class_sch_screen.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <sch_sheet_path.h> #include <sch_sheet_path.h>
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <fctsys.h> #include <fctsys.h>
#include <plot_common.h> #include <plot_common.h>
#include <worksheet.h>
#include <class_sch_screen.h> #include <class_sch_screen.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <base_units.h> #include <base_units.h>
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <worksheet.h>
#include <plot_common.h> #include <plot_common.h>
#include <class_sch_screen.h> #include <class_sch_screen.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
......
...@@ -70,15 +70,6 @@ std::string toUTFTildaText( const wxString& txt ) ...@@ -70,15 +70,6 @@ std::string toUTFTildaText( const wxString& txt )
{ {
if( (unsigned char) *it <= ' ' ) if( (unsigned char) *it <= ' ' )
*it = '~'; *it = '~';
/*
#if defined(KICAD_GOST)
if( *it == ' ' )
#else
if( (unsigned char) *it <= ' ' )
#endif
*it = '~';
*/
} }
return ret; return ret;
} }
......
...@@ -35,24 +35,16 @@ ...@@ -35,24 +35,16 @@
#include <richio.h> #include <richio.h>
#include <plot_common.h> #include <plot_common.h>
#include <general.h>
#include <protos.h>
#include <sch_junction.h> #include <sch_junction.h>
#include <class_netlist_object.h>
int SCH_JUNCTION::m_symbolSize = 50; // Default diameter of the junction symbol
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) : SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_JUNCTION_T ) SCH_ITEM( NULL, SCH_JUNCTION_T )
{ {
#if defined(KICAD_GOST)
#define DRAWJUNCTION_DIAMETER 50 /* Diameter of junction symbol between wires by GOST*/
#else
#define DRAWJUNCTION_DIAMETER 32 /* Diameter of junction symbol between wires */
#endif
m_pos = pos; m_pos = pos;
m_Layer = LAYER_JUNCTION; m_Layer = LAYER_JUNCTION;
m_size.x = m_size.y = DRAWJUNCTION_DIAMETER;
#undef DRAWJUNCTION_DIAMETER
} }
...@@ -82,7 +74,6 @@ void SCH_JUNCTION::SwapData( SCH_ITEM* aItem ) ...@@ -82,7 +74,6 @@ void SCH_JUNCTION::SwapData( SCH_ITEM* aItem )
SCH_JUNCTION* item = (SCH_JUNCTION*) aItem; SCH_JUNCTION* item = (SCH_JUNCTION*) aItem;
EXCHG( m_pos, item->m_pos ); EXCHG( m_pos, item->m_pos );
EXCHG( m_size, item->m_size );
} }
...@@ -111,7 +102,7 @@ EDA_RECT SCH_JUNCTION::GetBoundingBox() const ...@@ -111,7 +102,7 @@ EDA_RECT SCH_JUNCTION::GetBoundingBox() const
EDA_RECT rect; EDA_RECT rect;
rect.SetOrigin( m_pos ); rect.SetOrigin( m_pos );
rect.Inflate( ( GetPenSize() + m_size.x ) / 2 ); rect.Inflate( ( GetPenSize() + GetSymbolSize() ) / 2 );
return rect; return rect;
} }
...@@ -130,7 +121,7 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs ...@@ -130,7 +121,7 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
GRFilledCircle( aPanel->GetClipBox(), aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, GRFilledCircle( aPanel->GetClipBox(), aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
( m_size.x / 2 ), 0, color, color ); ( GetSymbolSize() / 2 ), 0, color, color );
} }
...@@ -243,5 +234,5 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const ...@@ -243,5 +234,5 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
void SCH_JUNCTION::Plot( PLOTTER* aPlotter ) void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
{ {
aPlotter->SetColor( GetLayerColor( GetLayer() ) ); aPlotter->SetColor( GetLayerColor( GetLayer() ) );
aPlotter->Circle( m_pos, m_size.x, FILLED_SHAPE ); aPlotter->Circle( m_pos, GetSymbolSize(), FILLED_SHAPE );
} }
...@@ -32,11 +32,10 @@ ...@@ -32,11 +32,10 @@
#include <sch_item_struct.h> #include <sch_item_struct.h>
class SCH_JUNCTION : public SCH_ITEM class SCH_JUNCTION : public SCH_ITEM
{ {
wxPoint m_pos; /* XY coordinates of connection. */ wxPoint m_pos; // Position of the junction.
wxSize m_size; static int m_symbolSize; // diameter of the junction graphic symbol
public: public:
SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ) ); SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ) );
...@@ -50,6 +49,9 @@ public: ...@@ -50,6 +49,9 @@ public:
return wxT( "SCH_JUNCTION" ); return wxT( "SCH_JUNCTION" );
} }
static int GetSymbolSize() { return m_symbolSize; }
static void SetSymbolSize( int aSize ) { m_symbolSize = aSize; }
void SwapData( SCH_ITEM* aItem ); void SwapData( SCH_ITEM* aItem );
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
......
...@@ -516,29 +516,35 @@ double SCH_EDIT_FRAME::BestZoom() ...@@ -516,29 +516,35 @@ double SCH_EDIT_FRAME::BestZoom()
} }
/* Build a filename that can be used in plot and print functions
* for the current sheet path.
* This filename is unique and must be used instead of the screen filename
* when one must creates file for each sheet in the hierarchy,
* because in complex hierarchies a sheet and a SCH_SCREEN is used more than once
*/
wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet() wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
{ {
wxFileName fn = GetScreen()->GetFileName(); wxFileName fn = GetScreen()->GetFileName();
#ifndef KICAD_GOST /* Name is <root sheet filename>-<sheet path> and has no extension.
wxString filename = fn.GetName(); * However if filename is too long name is <sheet filename>-<sheet number>
if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 50 ) */
#else
#define FN_LEN_MAX 100 // A reasonnable value for the full file name len
fn.ClearExt(); fn.ClearExt();
wxString filename = fn.GetFullPath(); wxString filename = fn.GetFullPath();
if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 80 ) if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < FN_LEN_MAX )
#endif
{ {
filename += m_CurrentSheet->PathHumanReadable(); filename += m_CurrentSheet->PathHumanReadable();
filename.Replace( wxT( "/" ), wxT( "-" ) ); filename.Replace( wxT( "/" ), wxT( "-" ) );
filename.RemoveLast(); filename.RemoveLast();
#if defined(KICAD_GOST) // To avoid issues on unix, ensure the filename does not start
// by '-', which has a special meaning in command lines
#ifndef __WINDOWS__ #ifndef __WINDOWS__
wxString newfn; wxString newfn;
if( filename.StartsWith( wxT( "-" ), &newfn ) ) if( filename.StartsWith( wxT( "-" ), &newfn ) )
filename = newfn; filename = newfn;
#endif
#endif #endif
} }
else else
......
...@@ -71,6 +71,7 @@ set(GERBVIEW_SRCS ...@@ -71,6 +71,7 @@ set(GERBVIEW_SRCS
set(GERBVIEW_EXTRA_SRCS set(GERBVIEW_EXTRA_SRCS
../common/base_screen.cpp ../common/base_screen.cpp
../common/base_units.cpp ../common/base_units.cpp
../common/eda_text.cpp
../common/class_layer_box_selector.cpp ../common/class_layer_box_selector.cpp
../common/class_page_info.cpp ../common/class_page_info.cpp
../pcbnew/layer_widget.cpp ../pcbnew/layer_widget.cpp
......
...@@ -7,51 +7,6 @@ ...@@ -7,51 +7,6 @@
#ifndef WORKSHEET_H_ #ifndef WORKSHEET_H_
#define WORKSHEET_H_ #define WORKSHEET_H_
#include <common.h> // Mm2mils()
#define GRID_REF_W 70 // height of the band reference grid
#if defined(KICAD_GOST)
#define SIZETEXT 100 // worksheet text size
#else
#define SIZETEXT 60 // worksheet text size
#endif
#define SIZETEXT_REF 50 // worksheet frame reference text size
#define PAS_REF 2000 // no reference markings on worksheet frame
#if !defined(KICAD_GOST)
// The coordinates below are relative to the bottom right corner of page and
// will be subtracted from this origin.
#define BLOCK_OX 4200
#define BLOCK_KICAD_VERSION_X BLOCK_OX - SIZETEXT
#define BLOCK_KICAD_VERSION_Y SIZETEXT
#define BLOCK_REV_X 820
#define BLOCK_REV_Y (SIZETEXT * 3)
#define BLOCK_DATE_X BLOCK_OX - (SIZETEXT * 15)
#define BLOCK_DATE_Y (SIZETEXT * 3)
#define BLOCK_ID_SHEET_X 820
#define BLOCK_ID_SHEET_Y SIZETEXT
#define BLOCK_SIZE_SHEET_X BLOCK_OX - SIZETEXT
#define BLOCK_SIZE_SHEET_Y (SIZETEXT * 3)
#define BLOCK_TITLE_X BLOCK_OX - SIZETEXT
#define BLOCK_TITLE_Y (SIZETEXT * 5)
#define BLOCK_FULLSHEETNAME_X BLOCK_OX - SIZETEXT
#define BLOCK_FULLSHEETNAME_Y (SIZETEXT * 7)
#define BLOCK_FILENAME_X BLOCK_OX - SIZETEXT
#define BLOCK_FILENAME_Y (SIZETEXT * 9)
#define BLOCK_COMMENT_X BLOCK_OX - SIZETEXT
#define BLOCK_COMPANY_Y (SIZETEXT * 11)
#define BLOCK_COMMENT1_Y (SIZETEXT * 13)
#define BLOCK_COMMENT2_Y (SIZETEXT * 15)
#define BLOCK_COMMENT3_Y (SIZETEXT * 17)
#define BLOCK_COMMENT4_Y (SIZETEXT * 19)
#endif
#define VARIABLE_BLOCK_START_POSITION (SIZETEXT * 10)
struct Ki_WorkSheetData struct Ki_WorkSheetData
{ {
public: public:
...@@ -63,156 +18,4 @@ public: ...@@ -63,156 +18,4 @@ public:
const wxChar* m_Text; const wxChar* m_Text;
}; };
/// Work sheet structure type definitions.
enum TypeKi_WorkSheetData {
#if defined(KICAD_GOST)
WS_OSN,
WS_TONK,
WS_TEXT,
WS_TEXTL
#else
WS_DATE,
WS_REV,
WS_KICAD_VERSION,
WS_SIZESHEET,
WS_IDENTSHEET,
WS_TITLE,
WS_FILENAME,
WS_FULLSHEETNAME,
WS_COMPANY_NAME,
WS_COMMENT1,
WS_COMMENT2,
WS_COMMENT3,
WS_COMMENT4,
WS_SEGMENT,
WS_UPPER_SEGMENT,
WS_LEFT_SEGMENT,
WS_CADRE
#endif
};
#if defined(KICAD_GOST)
extern Ki_WorkSheetData WS_Osn1_Line1;
extern Ki_WorkSheetData WS_Osn1_Line2;
extern Ki_WorkSheetData WS_Osn1_Line3;
extern Ki_WorkSheetData WS_Osn1_Line4;
extern Ki_WorkSheetData WS_Osn1_Line5;
extern Ki_WorkSheetData WS_Osn1_Line6;
extern Ki_WorkSheetData WS_Osn1_Line7;
extern Ki_WorkSheetData WS_Osn1_Line8;
extern Ki_WorkSheetData WS_Osn1_Line9;
extern Ki_WorkSheetData WS_Osn1_Line10;
extern Ki_WorkSheetData WS_Osn1_Line11;
extern Ki_WorkSheetData WS_Osn1_Line12;
extern Ki_WorkSheetData WS_Osn1_Line13;
extern Ki_WorkSheetData WS_Osn1_Line14;
extern Ki_WorkSheetData WS_Osn1_Line15;
extern Ki_WorkSheetData WS_Osn1_Line16;
extern Ki_WorkSheetData WS_Osn1_Line17;
extern Ki_WorkSheetData WS_Osn1_Line18;
extern Ki_WorkSheetData WS_Osn1_Line19;
extern Ki_WorkSheetData WS_Osn1_Line20;
extern Ki_WorkSheetData WS_Osn1_Line21;
extern Ki_WorkSheetData WS_Osn1_Line22;
extern Ki_WorkSheetData WS_Osn1_Line23;
extern Ki_WorkSheetData WS_Osn1_Line24;
extern Ki_WorkSheetData WS_Osn1_Line25;
extern Ki_WorkSheetData WS_Osn1_Line26;
extern Ki_WorkSheetData WS_Osn1_Line27;
extern Ki_WorkSheetData WS_Osn1_Text1;
extern Ki_WorkSheetData WS_Osn1_Text2;
extern Ki_WorkSheetData WS_Osn1_Text3;
extern Ki_WorkSheetData WS_Osn1_Text4;
extern Ki_WorkSheetData WS_Osn1_Text5;
extern Ki_WorkSheetData WS_Osn1_Text6;
extern Ki_WorkSheetData WS_Osn1_Text7;
extern Ki_WorkSheetData WS_Osn1_Text8;
extern Ki_WorkSheetData WS_Osn1_Text9;
extern Ki_WorkSheetData WS_Osn1_Text10;
extern Ki_WorkSheetData WS_Osn1_Text11;
extern Ki_WorkSheetData WS_Osn1_Text12;
extern Ki_WorkSheetData WS_Osn1_Text13;
extern Ki_WorkSheetData WS_Osn1_Text14;
extern Ki_WorkSheetData WS_Osn1_Text15;
extern Ki_WorkSheetData WS_Osn1_Text16;
extern Ki_WorkSheetData WS_Osn1_Text17;
extern Ki_WorkSheetData WS_Osn2a_Line1;
extern Ki_WorkSheetData WS_Osn2a_Line2;
extern Ki_WorkSheetData WS_Osn2a_Line3;
extern Ki_WorkSheetData WS_Osn2a_Line4;
extern Ki_WorkSheetData WS_Osn2a_Line5;
extern Ki_WorkSheetData WS_Osn2a_Line6;
extern Ki_WorkSheetData WS_Osn2a_Line7;
extern Ki_WorkSheetData WS_Osn2a_Line8;
extern Ki_WorkSheetData WS_Osn2a_Line9;
extern Ki_WorkSheetData WS_Osn2a_Line10;
extern Ki_WorkSheetData WS_Osn2a_Line11;
extern Ki_WorkSheetData WS_Osn2a_Text1;
extern Ki_WorkSheetData WS_Osn2a_Text2;
extern Ki_WorkSheetData WS_Osn2a_Text3;
extern Ki_WorkSheetData WS_Osn2a_Text4;
extern Ki_WorkSheetData WS_Osn2a_Text5;
extern Ki_WorkSheetData WS_Osn2a_Text6;
extern Ki_WorkSheetData WS_Osn2a_Text7;
extern Ki_WorkSheetData WS_Osn2a_Text8;
extern Ki_WorkSheetData WS_DopLeft_Line1;
extern Ki_WorkSheetData WS_DopLeft_Line2;
extern Ki_WorkSheetData WS_DopLeft_Line3;
extern Ki_WorkSheetData WS_DopLeft_Line4;
extern Ki_WorkSheetData WS_DopLeft_Line5;
extern Ki_WorkSheetData WS_DopLeft_Line6;
extern Ki_WorkSheetData WS_DopLeft_Line7;
extern Ki_WorkSheetData WS_DopLeft_Line8;
extern Ki_WorkSheetData WS_DopLeft_Line9;
extern Ki_WorkSheetData WS_DopLeft_Line10;
extern Ki_WorkSheetData WS_DopLeft_Line11;
extern Ki_WorkSheetData WS_DopLeft_Line12;
extern Ki_WorkSheetData WS_DopLeft_Line13;
extern Ki_WorkSheetData WS_DopLeft_Line14;
extern Ki_WorkSheetData WS_DopLeft_Text1;
extern Ki_WorkSheetData WS_DopLeft_Text2;
extern Ki_WorkSheetData WS_DopLeft_Text3;
extern Ki_WorkSheetData WS_DopLeft_Text4;
extern Ki_WorkSheetData WS_DopLeft_Text5;
extern Ki_WorkSheetData WS_DopLeft_Text6;
extern Ki_WorkSheetData WS_DopLeft_Text7;
extern Ki_WorkSheetData WS_DopTop_Line1;
extern Ki_WorkSheetData WS_DopTop_Line2;
extern Ki_WorkSheetData WS_DopTop_Line3;
extern Ki_WorkSheetData WS_DopTop_Line4;
extern Ki_WorkSheetData WS_DopTop_Line5;
extern Ki_WorkSheetData WS_DopTop_Line6;
#else
extern Ki_WorkSheetData WS_Date;
extern Ki_WorkSheetData WS_Revision;
extern Ki_WorkSheetData WS_Licence;
extern Ki_WorkSheetData WS_SizeSheet;
extern Ki_WorkSheetData WS_IdentSheet;
extern Ki_WorkSheetData WS_FullSheetName;
extern Ki_WorkSheetData WS_SheetFilename;
extern Ki_WorkSheetData WS_Title;
extern Ki_WorkSheetData WS_Company;
extern Ki_WorkSheetData WS_Comment1;
extern Ki_WorkSheetData WS_Comment2;
extern Ki_WorkSheetData WS_Comment3;
extern Ki_WorkSheetData WS_Comment4;
extern Ki_WorkSheetData WS_SeparatorLine;
extern Ki_WorkSheetData WS_MostLeftLine;
extern Ki_WorkSheetData WS_MostUpperLine;
extern Ki_WorkSheetData WS_Segm3;
extern Ki_WorkSheetData WS_Segm4;
extern Ki_WorkSheetData WS_Segm5;
extern Ki_WorkSheetData WS_Segm6;
extern Ki_WorkSheetData WS_Segm7;
#endif
#endif // WORKSHEET_H_ #endif // WORKSHEET_H_
...@@ -703,23 +703,26 @@ public: ...@@ -703,23 +703,26 @@ public:
* Function TraceWorkSheet is a core function for drawing of the page layout with * Function TraceWorkSheet is a core function for drawing of the page layout with
* the frame and the basic inscriptions. * the frame and the basic inscriptions.
* @param aDC The device context. * @param aDC The device context.
* @param aSz The size of the page layout. * @param aPageSize The size of the page layout.
* @param aLT The left top margin of the page layout. * @param aLTmargin The left top margin of the page layout.
* @param aRB The right bottom margin of the page layout. * @param aRBmargin The right bottom margin of the page layout.
* @param aType The paper size type (for basic inscriptions). * @param aPaperFormat The paper size type, for basic inscriptions.
* @param aFlNm The file name (for basic inscriptions). * @param aFileName The file name, for basic inscriptions.
* @param aTb The block of titles (for basic inscriptions). * @param aTitleBlock The sheet title block, for basic inscriptions.
* @param aNScr The number of screens (for basic inscriptions). * @param aSheetCount The number of sheets (for basic inscriptions).
* @param aScr The screen number (for basic inscriptions). * @param aSheetNumber The sheet number (for basic inscriptions).
* @param aLnW The line width for drawing. * @param aPenWidth The line width for drawing.
* @param aScalar Scalar to convert from mils to internal units. * @param aScalar Scalar to convert from mils to internal units.
* @param aClr1 The color for drawing. * @param aLineColor The color for drawing.
* @param aClr2 The colr for inscriptions. * @param aTextColor The color for inscriptions.
*/ */
void TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB, void TraceWorkSheet( wxDC* aDC, wxSize& aPageSize,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb, wxPoint& aLTmargin, wxPoint& aRBmargin,
int aNScr, int aScr, int aLnW, double aScalar, wxString& aPaperFormat, wxString& aFileName,
EDA_COLOR_T aClr1 = RED, EDA_COLOR_T aClr2 = RED ); TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
int aPenWidth, double aScalar,
EDA_COLOR_T aLineColor = RED, EDA_COLOR_T aTextColor = RED );
/** /**
* Function GetXYSheetReferences * Function GetXYSheetReferences
......
...@@ -61,7 +61,7 @@ wxPoint BOARD_ITEM::ZeroOffset( 0, 0 ); ...@@ -61,7 +61,7 @@ wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
BOARD::BOARD() : BOARD::BOARD() :
BOARD_ITEM( (BOARD_ITEM*) NULL, PCB_T ), BOARD_ITEM( (BOARD_ITEM*) NULL, PCB_T ),
m_NetInfo( this ), m_NetInfo( this ),
m_paper( IsGOST() ? PAGE_INFO::A4 : PAGE_INFO::A3, IsGOST() ), m_paper( PAGE_INFO::A4, IsGOST() ),
m_NetClasses( this ) m_NetClasses( this )
{ {
// we have not loaded a board yet, assume latest until then. // we have not loaded a board yet, assume latest until then.
......
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