Commit 143af269 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: code cleanup, remove dead code and some global and useless variables

parent 63257245
...@@ -41,9 +41,11 @@ ...@@ -41,9 +41,11 @@
# tools are required. If MAINTAIN_PNG is defined, then you are a PNG maintainer # tools are required. If MAINTAIN_PNG is defined, then you are a PNG maintainer
# and will need the following tools findable in your PATH: # and will need the following tools findable in your PATH:
# #
# 1) imagemagick - all its programs must be on your PATH # 1) inkscape - command line mode is used, must be on your PATH
# 2) inkscape - command line mode is used, must be on your PATH # 2) pngcrush - this program must be on your PATH
# 3) pngcrush - # 3) Under Windows only:
# dos2unix - to convert End Of Lines to unix EOL (CRLF to LF)
# this program must be on your PATH
# #
# lower case is used for local variables, uppercase for global variables # lower case is used for local variables, uppercase for global variables
...@@ -69,20 +71,39 @@ option( MAINTAIN_PNGS ...@@ -69,20 +71,39 @@ option( MAINTAIN_PNGS
"Set to true if you are a PNG maintainer and have the required tools given in the bitmaps_png/CMakeLists.txt file (default OFF)." "Set to true if you are a PNG maintainer and have the required tools given in the bitmaps_png/CMakeLists.txt file (default OFF)."
OFF) OFF)
# Used Only to maintain PNG files (and therefore to recreate .cpp files)
# The png2cpp creates files with native End of Line format.
# To avoid mixed EOF formats in these .cpp files, it is good to
# convert them in Unix EOL format (LF)
# Under Windows, the well known dos2unix.exe does the conversion
# It is installed with MinGW and MSYS.
# It is very easy to install (just an executable to copy in a known path) if it is missing
if( WIN32 )
set( CONVERT_EOL true )
set( eol2unix_converter dos2unix )
else()
set( CONVERT_EOL false )
endif( WIN32 )
include_directories(BEFORE ${INC_BEFORE}) include_directories(BEFORE ${INC_BEFORE})
include_directories( include_directories(
${INC_AFTER} ${INC_AFTER}
) )
# Plan for three sizes of bitmaps: # Plan for three sizes of bitmaps:
# SMALL - for listboxes or comboboxes and perhaps menus # SMALL - for menus
# MID - for toolbars 26 x 26 # MID - for toolbars 26 x 26
# BIG - for program icons 48 x 48 # BIG - for program icons 48 x 48
# which are given on three basename lists: BMAPS_SMALL, BMAPS_MID,a nd BMAPS_BIG # which are given on three basename lists: BMAPS_SMALL, BMAPS_MID,a nd BMAPS_BIG
# respectively. The basename is without file extension and without path. # respectively. The basename is without file extension and without path.
# A corresponding ${basename}.svg file must exist in 'sources' dir below here. # A corresponding ${basename}.svg file must exist in 'sources' dir below here.
# small icons (16x16) needed in listboxes # small icons (16x16) needed in listboxes
set( BMAPS_SMALL set( BMAPS_SMALL
pinorient_right pinorient_right
...@@ -113,6 +134,7 @@ set( BMAPS_SMALL ...@@ -113,6 +134,7 @@ set( BMAPS_SMALL
tree_sel tree_sel
) )
# image basenames that go into the toolbar sized destinations, i.e. 26x26 # image basenames that go into the toolbar sized destinations, i.e. 26x26
set( BMAPS_MID set( BMAPS_MID
add_arc add_arc
...@@ -248,6 +270,7 @@ set( BMAPS_MID ...@@ -248,6 +270,7 @@ set( BMAPS_MID
gerber_open_dcode_file gerber_open_dcode_file
gerbview_drill_file gerbview_drill_file
gerbview_clear_layers gerbview_clear_layers
gerber_open_dcode_file
gerbview_open_recent_drill_files gerbview_open_recent_drill_files
general_deletions general_deletions
general_ratsnest general_ratsnest
...@@ -541,7 +564,8 @@ function( svg2png inputFile outFile pngWidth pngHeight ) ...@@ -541,7 +564,8 @@ function( svg2png inputFile outFile pngWidth pngHeight )
add_custom_command( add_custom_command(
OUTPUT ${outFile} OUTPUT ${outFile}
COMMAND ${Inkscape_EXECUTABLE} --export-area-snap -f ${inputFile} -e ${outFile} -w ${pngWidth} -h ${pngHeight} > ${TMP_DIR}/${bmn}.inkscape.log COMMAND ${Inkscape_EXECUTABLE} --export-area-snap -f ${inputFile} -e ${outFile}
-w ${pngWidth} -h ${pngHeight} > ${TMP_DIR}/${bmn}.inkscape.log
DEPENDS ${inputFile} DEPENDS ${inputFile}
COMMENT "Creating ${pngHeight} pixel tall ${outFile}" COMMENT "Creating ${pngHeight} pixel tall ${outFile}"
) )
...@@ -566,22 +590,41 @@ function( png2png inputFile outFile ) ...@@ -566,22 +590,41 @@ function( png2png inputFile outFile )
) )
endfunction() endfunction()
# Function png2cpp # Function png2cpp
# converts a single *.png to *.cpp # converts a single *.png to *.cpp
if( CONVERT_EOL )
function( png2cpp inputFile outFile ) function( png2cpp inputFile outFile )
add_custom_command( add_custom_command(
OUTPUT ${outFile} OUTPUT ${outFile}
COMMAND rm -f ${outFile}.tmp
COMMAND ${CMAKE_COMMAND} -DinputFile=${inputFile} -DoutCppFile=${outFile} COMMAND ${CMAKE_COMMAND} -DinputFile=${inputFile} -DoutCppFile=${outFile}
-P ${CMAKE_MODULE_PATH}/PNG2cpp.cmake -P ${CMAKE_MODULE_PATH}/PNG2cpp.cmake
DEPENDS ${inputFile} ${CMAKE_MODULE_PATH}/PNG2cpp.cmake DEPENDS ${inputFile} ${CMAKE_MODULE_PATH}/PNG2cpp.cmake
POST_BUILD
COMMAND ${eol2unix_EXECUTABLE} ${outFile}
COMMENT "Creating (with unix eol) ${outFile}"
)
endfunction()
else( CONVERT_EOL )
function( png2cpp inputFile outFile )
add_custom_command(
OUTPUT ${outFile}
COMMAND ${CMAKE_COMMAND} -DinputFile=${inputFile} -DoutCppFile=${outFile}
-P ${CMAKE_MODULE_PATH}/PNG2cpp.cmake
DEPENDS ${inputFile} ${CMAKE_MODULE_PATH}/PNG2cpp.cmake
COMMENT "Creating ${outFile}" COMMENT "Creating ${outFile}"
) )
endfunction() endfunction()
endif(CONVERT_EOL)
# Function bitmap_dir # Function bitmap_dir
# converts all the basenames in bmapList found in hardcoded 'sources' dir # converts all the basenames in bmapList found in hardcoded 'sources' dir
...@@ -652,6 +695,7 @@ if( MAINTAIN_PNGS ) ...@@ -652,6 +695,7 @@ if( MAINTAIN_PNGS )
endif( NOT pngcrush_EXECUTABLE ) endif( NOT pngcrush_EXECUTABLE )
endif( NOT pngcrush_FOUND ) endif( NOT pngcrush_FOUND )
# these 3 cmake commands for each desired bitmap size set, repeat as needed: # these 3 cmake commands for each desired bitmap size set, repeat as needed:
bitmap_dir( 16 16 "${BMAPS_SMALL}" ) bitmap_dir( 16 16 "${BMAPS_SMALL}" )
...@@ -659,6 +703,26 @@ if( MAINTAIN_PNGS ) ...@@ -659,6 +703,26 @@ if( MAINTAIN_PNGS )
bitmap_dir( 48 48 "${BMAPS_BIG}" ) bitmap_dir( 48 48 "${BMAPS_BIG}" )
if(CONVERT_EOL)
# dos2unix is required to convert EOL format (CRLF) to unix EOL format (LF)
set( eol2unix_FOUND FALSE )
if( NOT eol2unix_FOUND )
find_program( eol2unix_EXECUTABLE ${eol2unix_converter} DOC "The EOL to LF converter program." )
if( NOT eol2unix_EXECUTABLE )
message( FATAL_ERROR "Could not find the ${eol2unix_converter} EOL to LF converter program." )
else( NOT eol2unix_EXECUTABLE )
set( eol2unix_FOUND TRUE )
set( eol2unix_EXECUTABLE ${eol2unix_EXECUTABLE}
CACHE FILEPATH "Path and file name of the end of line converter program." )
message( STATUS "The ${eol2unix_converter} EOL to LF converter program found." )
endif( NOT eol2unix_EXECUTABLE )
endif( NOT eol2unix_FOUND )
elseif(APPLE)
#TODO: see if a EOL converted is needed # OSX
endif(CONVERT_EOL)
#message( "CPP_LIST: ${CPP_LIST}" ) #message( "CPP_LIST: ${CPP_LIST}" )
# a target with no output, just so changes get built # a target with no output, just so changes get built
......
...@@ -177,6 +177,11 @@ ...@@ -177,6 +177,11 @@
// HPGL scale factor (1 PLU = 1/40mm = 25 micrometers) // HPGL scale factor (1 PLU = 1/40mm = 25 micrometers)
static const double PLUsPERDECIMIL = 0.102041; static const double PLUsPERDECIMIL = 0.102041;
HPGL_PLOTTER::HPGL_PLOTTER()
{
SetPenSpeed( 40 ); // Default pen speed = 40 cm/s
SetPenNumber( 1 ); // Default pen num = 1
}
void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) double aScale, bool aMirror )
......
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
* file extensions and wildcards used in kicad. * file extensions and wildcards used in kicad.
*/ */
const wxString SchematicSymbolFileExtension( wxT( "sym" ) );
const wxString SchematicLibraryFileExtension( wxT( "lib" ) );
const wxString SchematicBackupFileExtension( wxT( "bak" ) );
const wxString VrmlFileExtension( wxT( "wrl" ) ); const wxString VrmlFileExtension( wxT( "wrl" ) );
const wxString ProjectFileExtension( wxT( "pro" ) ); const wxString ProjectFileExtension( wxT( "pro" ) );
...@@ -51,6 +55,8 @@ const wxString FootprintPlaceFileExtension( wxT( "pos" ) ); ...@@ -51,6 +55,8 @@ const wxString FootprintPlaceFileExtension( wxT( "pos" ) );
// These strings are wildcards for file selection dialogs. // These strings are wildcards for file selection dialogs.
// Because thes are static, one should explicitely call wxGetTranslation // Because thes are static, one should explicitely call wxGetTranslation
// to display them translated. // to display them translated.
const wxString SchematicSymbolFileWildcard( _( "KiCad drawing symbol file (*.sym)|*.sym" ) );
const wxString SchematicLibraryFileWildcard( _( "KiCad component library file (*.lib)|*.lib" ) );
const wxString ProjectFileWildcard( _( "KiCad project files (*.pro)|*.pro" ) ); const wxString ProjectFileWildcard( _( "KiCad project files (*.pro)|*.pro" ) );
const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) ); const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) );
const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
......
...@@ -83,8 +83,9 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi ...@@ -83,8 +83,9 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
} }
wxPoint endpos = aPanel->GetScreen()->GetCrossHairPosition(); wxPoint endpos = aPanel->GetScreen()->GetCrossHairPosition();
SCH_EDIT_FRAME * frame = ( SCH_EDIT_FRAME * ) aPanel->GetParent();
if( g_HVLines ) /* Coerce the line to vertical or horizontal one: */ if( frame->GetForceHVLines() ) /* Coerce the line to vertical or horizontal one: */
ComputeBreakPoint( (SCH_LINE*) s_wires.GetLast()->Back(), endpos ); ComputeBreakPoint( (SCH_LINE*) s_wires.GetLast()->Back(), endpos );
else else
( (SCH_LINE*) s_wires.GetLast() )->SetEndPoint( endpos ); ( (SCH_LINE*) s_wires.GetLast() )->SetEndPoint( endpos );
...@@ -152,7 +153,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) ...@@ -152,7 +153,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
// We need 2 segments to go from a given start pin to an end point when the horizontal // We need 2 segments to go from a given start pin to an end point when the horizontal
// and vertical lines only switch is on. // and vertical lines only switch is on.
if( g_HVLines ) if( GetForceHVLines() )
{ {
nextSegment = new SCH_LINE( *segment ); nextSegment = new SCH_LINE( *segment );
nextSegment->SetFlags( IS_NEW ); nextSegment->SetFlags( IS_NEW );
...@@ -170,7 +171,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) ...@@ -170,7 +171,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
// Be aware prevSegment can be null when the horizontal and vertical lines only switch is off // Be aware prevSegment can be null when the horizontal and vertical lines only switch is off
// when we create the first segment. // when we create the first segment.
if( !g_HVLines ) if( !GetForceHVLines() )
{ {
// If only one segment is needed and it has a zero length, do not create a new one. // If only one segment is needed and it has a zero length, do not create a new one.
if( segment->IsNull() ) if( segment->IsNull() )
...@@ -356,7 +357,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC ) ...@@ -356,7 +357,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
int idx = polyLine->GetCornerCount() - 1; int idx = polyLine->GetCornerCount() - 1;
wxPoint pt = (*polyLine)[idx]; wxPoint pt = (*polyLine)[idx];
if( g_HVLines ) if( GetForceHVLines() )
{ {
/* Coerce the line to vertical or horizontal one: */ /* Coerce the line to vertical or horizontal one: */
if( std::abs( endpos.x - pt.x ) < std::abs( endpos.y - pt.y ) ) if( std::abs( endpos.x - pt.x ) < std::abs( endpos.y - pt.y ) )
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
// Set this to 1 to print debugging output in alias and component destructors to verify // Set this to 1 to print debugging output in alias and component destructors to verify
// objects get cleaned up properly. // objects get cleaned up properly.
#if defined( TRACE_DESTRUCTOR ) #if defined( TRACE_DESTRUCTOR )
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include <wx/regex.h> #include <wx/regex.h>
#include <wx/wfstream.h> #include <wx/wfstream.h>
static const wxChar* duplicate_name_msg = static const wxChar* duplicate_name_msg =
_( "Library <%s> has duplicate entry name <%s>.\n\ _( "Library <%s> has duplicate entry name <%s>.\n\
This may cause some unexpected behavior when loading components into a schematic." ); This may cause some unexpected behavior when loading components into a schematic." );
...@@ -588,7 +587,7 @@ bool CMP_LIBRARY::LoadHeader( LINE_READER& aLineReader ) ...@@ -588,7 +587,7 @@ bool CMP_LIBRARY::LoadHeader( LINE_READER& aLineReader )
bool CMP_LIBRARY::LoadDocs( wxString& aErrorMsg ) bool CMP_LIBRARY::LoadDocs( wxString& aErrorMsg )
{ {
int lineNumber = 0; int lineNumber = 0;
char line[LINE_BUFFER_LEN_LARGE], * name, * text; char line[8000], * name, * text;
LIB_ALIAS* entry; LIB_ALIAS* entry;
FILE* file; FILE* file;
wxString msg; wxString msg;
......
...@@ -167,7 +167,7 @@ void DIALOG_COLOR_CONFIG::CreateControls() ...@@ -167,7 +167,7 @@ void DIALOG_COLOR_CONFIG::CreateControls()
wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
iconDC.SelectObject( bitmap ); iconDC.SelectObject( bitmap );
color = currentColors[ buttons->m_Layer ] = g_LayerDescr.LayerColor[ buttons->m_Layer ]; color = currentColors[ buttons->m_Layer ] = ReturnLayerColor( buttons->m_Layer );
iconDC.SetPen( *wxBLACK_PEN ); iconDC.SetPen( *wxBLACK_PEN );
wxBrush brush; wxBrush brush;
brush.SetColour( ColorRefs[ color ].m_Red, brush.SetColour( ColorRefs[ color ].m_Red,
...@@ -292,15 +292,15 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings() ...@@ -292,15 +292,15 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings()
for( int ii = 0; ii < MAX_LAYERS; ii++ ) for( int ii = 0; ii < MAX_LAYERS; ii++ )
{ {
g_LayerDescr.LayerColor[ ii ] = currentColors[ ii ]; SetLayerColor( currentColors[ ii ], ii );
if( g_DrawBgColor == g_LayerDescr.LayerColor[ ii ] ) if( g_DrawBgColor == ReturnLayerColor( ii ) )
warning = true; warning = true;
} }
m_Parent->SetGridColor( g_LayerDescr.LayerColor[LAYER_GRID] ); m_Parent->SetGridColor( ReturnLayerColor( LAYER_GRID ) );
if( g_DrawBgColor == g_LayerDescr.LayerColor[ LAYER_GRID ] ) if( g_DrawBgColor == ReturnLayerColor( LAYER_GRID ) )
warning = true; warning = true;
return warning; return warning;
...@@ -333,34 +333,3 @@ void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& event ) ...@@ -333,34 +333,3 @@ void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& event )
UpdateColorsSettings(); UpdateColorsSettings();
m_Parent->GetCanvas()->Refresh(); m_Parent->GetCanvas()->Refresh();
} }
void SeedLayers()
{
LayerStruct* LayerPointer = &g_LayerDescr;
int pt;
LayerPointer->CommonColor = WHITE;
LayerPointer->Flags = 0;
pt = 0;
LayerPointer->CurrentWidth = 1;
/* seed Up the Layer colours, set all user layers off */
for( pt = 0; pt < MAX_LAYERS; pt++ )
{
LayerPointer->LayerStatus[pt] = 0;
LayerPointer->LayerColor[pt] = DARKGRAY;
}
LayerPointer->NumberOfLayers = pt - 1;
/* Specific colors: update by reading the config. */
}
EDA_COLOR_T ReturnLayerColor( int Layer )
{
if( g_LayerDescr.Flags == 0 )
return (EDA_COLOR_T) g_LayerDescr.LayerColor[Layer];
else
return (EDA_COLOR_T) g_LayerDescr.CommonColor;
}
...@@ -45,10 +45,10 @@ class SCH_EDIT_FRAME; ...@@ -45,10 +45,10 @@ class SCH_EDIT_FRAME;
class SCH_TEXT; class SCH_TEXT;
class DialogLabelEditor : public DialogLabelEditor_Base class DIALOG_LABEL_EDITOR : public DIALOG_LABEL_EDITOR_BASE
{ {
public: public:
DialogLabelEditor( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem ); DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem );
private: private:
void InitDialog( ); void InitDialog( );
...@@ -72,14 +72,14 @@ void SCH_EDIT_FRAME::EditSchematicText( SCH_TEXT* aTextItem ) ...@@ -72,14 +72,14 @@ void SCH_EDIT_FRAME::EditSchematicText( SCH_TEXT* aTextItem )
if( aTextItem == NULL ) if( aTextItem == NULL )
return; return;
DialogLabelEditor dialog( this, aTextItem ); DIALOG_LABEL_EDITOR dialog( this, aTextItem );
dialog.ShowModal(); dialog.ShowModal();
} }
DialogLabelEditor::DialogLabelEditor( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) : DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) :
DialogLabelEditor_Base( aParent ) DIALOG_LABEL_EDITOR_BASE( aParent )
{ {
m_Parent = aParent; m_Parent = aParent;
m_CurrentText = aTextItem; m_CurrentText = aTextItem;
...@@ -94,7 +94,7 @@ DialogLabelEditor::DialogLabelEditor( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextIt ...@@ -94,7 +94,7 @@ DialogLabelEditor::DialogLabelEditor( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextIt
} }
void DialogLabelEditor::InitDialog() void DIALOG_LABEL_EDITOR::InitDialog()
{ {
wxString msg; wxString msg;
bool multiLine = false; bool multiLine = false;
...@@ -135,7 +135,7 @@ void DialogLabelEditor::InitDialog() ...@@ -135,7 +135,7 @@ void DialogLabelEditor::InitDialog()
default: default:
SetTitle( _( "Text Properties" ) ); SetTitle( _( "Text Properties" ) );
m_textLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER, m_textLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER,
wxCommandEventHandler ( DialogLabelEditor::OnEnterKey ), wxCommandEventHandler ( DIALOG_LABEL_EDITOR::OnEnterKey ),
NULL, this ); NULL, this );
break; break;
} }
...@@ -214,7 +214,7 @@ void DialogLabelEditor::InitDialog() ...@@ -214,7 +214,7 @@ void DialogLabelEditor::InitDialog()
* wxTE_PROCESS_ENTER event handler for m_textLabel * wxTE_PROCESS_ENTER event handler for m_textLabel
*/ */
void DialogLabelEditor::OnEnterKey( wxCommandEvent& aEvent ) void DIALOG_LABEL_EDITOR::OnEnterKey( wxCommandEvent& aEvent )
{ {
TextPropertiesAccept( aEvent ); TextPropertiesAccept( aEvent );
} }
...@@ -224,7 +224,7 @@ void DialogLabelEditor::OnEnterKey( wxCommandEvent& aEvent ) ...@@ -224,7 +224,7 @@ void DialogLabelEditor::OnEnterKey( wxCommandEvent& aEvent )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/ */
void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent ) void DIALOG_LABEL_EDITOR::OnOkClick( wxCommandEvent& aEvent )
{ {
TextPropertiesAccept( aEvent ); TextPropertiesAccept( aEvent );
} }
...@@ -234,14 +234,14 @@ void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent ) ...@@ -234,14 +234,14 @@ void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/ */
void DialogLabelEditor::OnCancelClick( wxCommandEvent& aEvent ) void DIALOG_LABEL_EDITOR::OnCancelClick( wxCommandEvent& aEvent )
{ {
m_Parent->GetCanvas()->MoveCursorToCrossHair(); m_Parent->GetCanvas()->MoveCursorToCrossHair();
EndModal( wxID_CANCEL ); EndModal( wxID_CANCEL );
} }
void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent ) void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
{ {
wxString text; wxString text;
int value; int value;
...@@ -289,7 +289,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent ) ...@@ -289,7 +289,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
/* Make the text size as new default size if it is a new text */ /* Make the text size as new default size if it is a new text */
if( m_CurrentText->IsNew() ) if( m_CurrentText->IsNew() )
g_DefaultTextLabelSize = m_CurrentText->m_Size.x; m_Parent->SetDefaultLabelSize( m_CurrentText->m_Size.x );
m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() ); m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
m_Parent->GetCanvas()->MoveCursorToCrossHair(); m_Parent->GetCanvas()->MoveCursorToCrossHair();
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#include "dialog_edit_label_base.h" #include "dialog_edit_label_base.h"
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer; wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL ); bMainSizer = new wxBoxSizer( wxVERTICAL );
m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 ); m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 );
m_textControlSizer->AddGrowableCol( 1 ); m_textControlSizer->AddGrowableCol( 1 );
m_textControlSizer->AddGrowableRow( 0 ); m_textControlSizer->AddGrowableRow( 0 );
m_textControlSizer->SetFlexibleDirection( wxBOTH ); m_textControlSizer->SetFlexibleDirection( wxBOTH );
m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Text:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 ); m_staticText1->Wrap( -1 );
m_staticText1->SetToolTip( _("Enter the text to be used within the schematic") ); m_staticText1->SetToolTip( _("Enter the text to be used within the schematic") );
m_textControlSizer->Add( m_staticText1, 0, wxRIGHT, 3 ); m_textControlSizer->Add( m_staticText1, 0, wxRIGHT, 3 );
wxBoxSizer* bSizeText; wxBoxSizer* bSizeText;
bSizeText = new wxBoxSizer( wxVERTICAL ); bSizeText = new wxBoxSizer( wxVERTICAL );
m_textLabelSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_textLabelSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
bSizeText->Add( m_textLabelSingleLine, 0, wxEXPAND|wxLEFT, 3 ); bSizeText->Add( m_textLabelSingleLine, 0, wxEXPAND|wxLEFT, 3 );
m_textLabelMultiLine = new wxTextCtrl( this, wxID_VALUEMULTI, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER ); m_textLabelMultiLine = new wxTextCtrl( this, wxID_VALUEMULTI, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER );
m_textLabelMultiLine->SetMinSize( wxSize( -1,60 ) ); m_textLabelMultiLine->SetMinSize( wxSize( -1,60 ) );
bSizeText->Add( m_textLabelMultiLine, 1, wxEXPAND|wxLEFT, 3 ); bSizeText->Add( m_textLabelMultiLine, 1, wxEXPAND|wxLEFT, 3 );
m_textControlSizer->Add( bSizeText, 1, wxEXPAND, 3 ); m_textControlSizer->Add( bSizeText, 1, wxEXPAND, 3 );
m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeTitle->Wrap( -1 ); m_SizeTitle->Wrap( -1 );
m_textControlSizer->Add( m_SizeTitle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); m_textControlSizer->Add( m_SizeTitle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
wxBoxSizer* bSizeCtrlSizer; wxBoxSizer* bSizeCtrlSizer;
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL ); bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizeCtrlSizer->Add( m_TextSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 3 ); bSizeCtrlSizer->Add( m_TextSize, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 3 );
m_staticSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticSizeUnits->Wrap( -1 ); m_staticSizeUnits->Wrap( -1 );
bSizeCtrlSizer->Add( m_staticSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); bSizeCtrlSizer->Add( m_staticSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_textControlSizer->Add( bSizeCtrlSizer, 1, wxEXPAND, 3 ); m_textControlSizer->Add( bSizeCtrlSizer, 1, wxEXPAND, 3 );
bMainSizer->Add( m_textControlSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 ); bMainSizer->Add( m_textControlSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 );
wxBoxSizer* m_OptionsSizer; wxBoxSizer* m_OptionsSizer;
m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL ); m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_TextOrientChoices[] = { _("Right"), _("Up"), _("Left"), _("Down") }; wxString m_TextOrientChoices[] = { _("Right"), _("Up"), _("Left"), _("Down") };
int m_TextOrientNChoices = sizeof( m_TextOrientChoices ) / sizeof( wxString ); int m_TextOrientNChoices = sizeof( m_TextOrientChoices ) / sizeof( wxString );
m_TextOrient = new wxRadioBox( this, wxID_ANY, _("O&rientation"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS ); m_TextOrient = new wxRadioBox( this, wxID_ANY, _("O&rientation"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS );
m_TextOrient->SetSelection( 0 ); m_TextOrient->SetSelection( 0 );
m_OptionsSizer->Add( m_TextOrient, 1, wxRIGHT|wxTOP, 3 ); m_OptionsSizer->Add( m_TextOrient, 1, wxRIGHT|wxTOP, 3 );
wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_TextStyleNChoices = sizeof( m_TextStyleChoices ) / sizeof( wxString ); int m_TextStyleNChoices = sizeof( m_TextStyleChoices ) / sizeof( wxString );
m_TextStyle = new wxRadioBox( this, wxID_ANY, _("St&yle"), wxDefaultPosition, wxDefaultSize, m_TextStyleNChoices, m_TextStyleChoices, 1, wxRA_SPECIFY_COLS ); m_TextStyle = new wxRadioBox( this, wxID_ANY, _("St&yle"), wxDefaultPosition, wxDefaultSize, m_TextStyleNChoices, m_TextStyleChoices, 1, wxRA_SPECIFY_COLS );
m_TextStyle->SetSelection( 0 ); m_TextStyle->SetSelection( 0 );
m_OptionsSizer->Add( m_TextStyle, 1, wxLEFT|wxRIGHT|wxTOP, 3 ); m_OptionsSizer->Add( m_TextStyle, 1, wxLEFT|wxRIGHT|wxTOP, 3 );
wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidirectional"), _("Tri-State"), _("Passive") }; wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidirectional"), _("Tri-State"), _("Passive") };
int m_TextShapeNChoices = sizeof( m_TextShapeChoices ) / sizeof( wxString ); int m_TextShapeNChoices = sizeof( m_TextShapeChoices ) / sizeof( wxString );
m_TextShape = new wxRadioBox( this, wxID_ANY, _("S&hape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS ); m_TextShape = new wxRadioBox( this, wxID_ANY, _("S&hape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS );
m_TextShape->SetSelection( 0 ); m_TextShape->SetSelection( 0 );
m_OptionsSizer->Add( m_TextShape, 1, wxALL|wxLEFT|wxTOP, 3 ); m_OptionsSizer->Add( m_TextShape, 1, wxALL|wxLEFT|wxTOP, 3 );
bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 ); bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 );
m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize(); m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 ); bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this ); bMainSizer->Fit( this );
// Connect Events // Connect Events
m_textLabelSingleLine->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this ); m_textLabelSingleLine->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnEnterKey ), NULL, this );
m_textLabelMultiLine->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this ); m_textLabelMultiLine->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnEnterKey ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this ); m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnOkClick ), NULL, this );
} }
DialogLabelEditor_Base::~DialogLabelEditor_Base() DIALOG_LABEL_EDITOR_BASE::~DIALOG_LABEL_EDITOR_BASE()
{ {
// Disconnect Events // Disconnect Events
m_textLabelSingleLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this ); m_textLabelSingleLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnEnterKey ), NULL, this );
m_textLabelMultiLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this ); m_textLabelMultiLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnEnterKey ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this ); m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LABEL_EDITOR_BASE::OnOkClick ), NULL, this );
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EDIT_LABEL_BASE_H__ #ifndef __DIALOG_EDIT_LABEL_BASE_H__
#define __DIALOG_EDIT_LABEL_BASE_H__ #define __DIALOG_EDIT_LABEL_BASE_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DialogLabelEditor_Base /// Class DIALOG_LABEL_EDITOR_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DialogLabelEditor_Base : public DIALOG_SHIM class DIALOG_LABEL_EDITOR_BASE : public DIALOG_SHIM
{ {
private: private:
protected: protected:
enum enum
{ {
wxID_VALUESINGLE = 1000, wxID_VALUESINGLE = 1000,
wxID_VALUEMULTI, wxID_VALUEMULTI,
wxID_SIZE wxID_SIZE
}; };
wxFlexGridSizer* m_textControlSizer; wxFlexGridSizer* m_textControlSizer;
wxStaticText* m_staticText1; wxStaticText* m_staticText1;
wxTextCtrl* m_textLabelSingleLine; wxTextCtrl* m_textLabelSingleLine;
wxTextCtrl* m_textLabelMultiLine; wxTextCtrl* m_textLabelMultiLine;
wxStaticText* m_SizeTitle; wxStaticText* m_SizeTitle;
wxTextCtrl* m_TextSize; wxTextCtrl* m_TextSize;
wxStaticText* m_staticSizeUnits; wxStaticText* m_staticSizeUnits;
wxRadioBox* m_TextOrient; wxRadioBox* m_TextOrient;
wxRadioBox* m_TextStyle; wxRadioBox* m_TextStyle;
wxRadioBox* m_TextShape; wxRadioBox* m_TextShape;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnEnterKey( wxCommandEvent& event ) { event.Skip(); } virtual void OnEnterKey( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DialogLabelEditor_Base(); ~DIALOG_LABEL_EDITOR_BASE();
}; };
#endif //__DIALOG_EDIT_LABEL_BASE_H__ #endif //__DIALOG_EDIT_LABEL_BASE_H__
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <netlist.h> #include <netlist.h>
#include <libeditframe.h> #include <libeditframe.h>
#include <viewlib_frame.h> #include <viewlib_frame.h>
#include <wildcards_and_files_ext.h>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
...@@ -288,7 +289,7 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event ) ...@@ -288,7 +289,7 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
libpath = wxGetApp().ReturnLastVisitedLibraryPath(); libpath = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog FilesDialog( this, _( "Library files:" ), libpath, wxFileDialog FilesDialog( this, _( "Library files:" ), libpath,
wxEmptyString, CompLibFileWildcard, wxEmptyString, SchematicLibraryFileWildcard,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE ); wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
if( FilesDialog.ShowModal() != wxID_OK ) if( FilesDialog.ShowModal() != wxID_OK )
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#define PLOT_FRAME_REFERENCE_KEY wxT( "PlotFrameRef" ) #define PLOT_FRAME_REFERENCE_KEY wxT( "PlotFrameRef" )
#define PLOT_HPGL_ORIGIN_KEY wxT( "PlotHPGLOrg" ) #define PLOT_HPGL_ORIGIN_KEY wxT( "PlotHPGLOrg" )
#define PLOT_HPGL_PAPERSIZE_KEY wxT( "PlotHPGLPaperSize" ) #define PLOT_HPGL_PAPERSIZE_KEY wxT( "PlotHPGLPaperSize" )
#define PLOT_HPGL_PEN_SIZE_KEY wxT( "PlotHPGLPenSize" )
...@@ -95,6 +96,10 @@ void DIALOG_PLOT_SCHEMATIC::initDlg() ...@@ -95,6 +96,10 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
m_config->Read( PLOT_HPGL_PAPERSIZE_KEY, &m_HPGLPaperSizeSelect, 0 ); m_config->Read( PLOT_HPGL_PAPERSIZE_KEY, &m_HPGLPaperSizeSelect, 0 );
m_HPGLPaperSizeOption->SetSelection( m_HPGLPaperSizeSelect ); m_HPGLPaperSizeOption->SetSelection( m_HPGLPaperSizeSelect );
// HPGL Pen Size is stored in mm in config
m_config->Read( PLOT_HPGL_PEN_SIZE_KEY, &m_HPGLPenSize, 0.5 );
m_HPGLPenSize *= IU_PER_MM;
// Switch to the last save plot format // Switch to the last save plot format
long plotfmt; long plotfmt;
m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 ); m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 );
...@@ -125,11 +130,11 @@ void DIALOG_PLOT_SCHEMATIC::initDlg() ...@@ -125,11 +130,11 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
// Set the default line width (pen width which should be used for // Set the default line width (pen width which should be used for
// items that do not have a pen size defined (like frame ref) // items that do not have a pen size defined (like frame ref)
AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit ); AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness ); PutValueInLocalUnits( *m_DefaultLineSizeCtrl, GetDefaultLineThickness() );
// Initialize HPGL specific widgets // Initialize HPGL specific widgets
AddUnitSymbol( *m_penHPLGWidthTitle, g_UserUnit ); AddUnitSymbol( *m_penHPLGWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_penHPGLWidthCtrl, g_HPGL_Pen_Descr.m_Pen_Diam ); PutValueInLocalUnits( *m_penHPGLWidthCtrl, m_HPGLPenSize );
m_HPGLPaperSizeOption->SetSelection( m_HPGLPaperSizeSelect ); m_HPGLPaperSizeOption->SetSelection( m_HPGLPaperSizeSelect );
// Hide/show widgets that are not always displayed: // Hide/show widgets that are not always displayed:
...@@ -166,12 +171,11 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions() ...@@ -166,12 +171,11 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions()
m_config->Write( PLOT_HPGL_ORIGIN_KEY, GetPlotOriginCenter() ); m_config->Write( PLOT_HPGL_ORIGIN_KEY, GetPlotOriginCenter() );
m_HPGLPaperSizeSelect = m_HPGLPaperSizeOption->GetSelection(); m_HPGLPaperSizeSelect = m_HPGLPaperSizeOption->GetSelection();
m_config->Write( PLOT_HPGL_PAPERSIZE_KEY, m_HPGLPaperSizeSelect ); m_config->Write( PLOT_HPGL_PAPERSIZE_KEY, m_HPGLPaperSizeSelect );
// HPGL Pen Size is stored in mm in config
m_config->Write( PLOT_HPGL_PEN_SIZE_KEY, m_HPGLPenSize/IU_PER_MM );
m_pageSizeSelect = m_PaperSizeOption->GetSelection(); m_pageSizeSelect = m_PaperSizeOption->GetSelection();
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl ); SetDefaultLineThickness( ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl ) );
if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1;
} }
void DIALOG_PLOT_SCHEMATIC::OnPlotFormatSelection( wxCommandEvent& event ) void DIALOG_PLOT_SCHEMATIC::OnPlotFormatSelection( wxCommandEvent& event )
......
...@@ -51,6 +51,7 @@ private: ...@@ -51,6 +51,7 @@ private:
// Static to keep last option: // Static to keep last option:
// use default size or force A or A4 size // use default size or force A or A4 size
int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
double m_HPGLPenSize; // for HPGL format only: pen size
public: public:
// / Constructors // / Constructors
......
...@@ -420,7 +420,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) ...@@ -420,7 +420,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE ); aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
if( printReference ) if( printReference )
parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness, parent->TraceWorkSheet( dc, aScreen, GetDefaultLineThickness(),
IU_PER_MILS, parent->GetScreenDesc() ); IU_PER_MILS, parent->GetScreenDesc() );
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
......
...@@ -102,7 +102,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType ) ...@@ -102,7 +102,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
textItem->m_Bold = lastTextBold; textItem->m_Bold = lastTextBold;
textItem->m_Italic = lastTextItalic; textItem->m_Italic = lastTextItalic;
textItem->SetOrientation( lastTextOrientation ); textItem->SetOrientation( lastTextOrientation );
textItem->m_Size.x = textItem->m_Size.y = g_DefaultTextLabelSize; textItem->m_Size.x = textItem->m_Size.y = GetDefaultLabelSize();
textItem->SetFlags( IS_NEW | IS_MOVED ); textItem->SetFlags( IS_NEW | IS_MOVED );
textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <general.h> #include <general.h>
#include <class_library.h> #include <class_library.h>
#include <wildcards_and_files_ext.h>
#include <html_messagebox.h> #include <html_messagebox.h>
...@@ -45,7 +46,7 @@ void SCH_EDIT_FRAME::LoadLibraries( void ) ...@@ -45,7 +46,7 @@ void SCH_EDIT_FRAME::LoadLibraries( void )
{ {
fn.Clear(); fn.Clear();
fn.SetName( m_componentLibFiles[ii] ); fn.SetName( m_componentLibFiles[ii] );
fn.SetExt( CompLibFileExtension ); fn.SetExt( SchematicLibraryFileExtension );
/* Skip if the file name is not valid.. */ /* Skip if the file name is not valid.. */
if( !fn.IsOk() ) if( !fn.IsOk() )
......
...@@ -71,7 +71,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -71,7 +71,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->Draw( m_canvas, DC, GR_DEFAULT_DRAWMODE ); GetScreen()->Draw( m_canvas, DC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness, IU_PER_MILS, TraceWorkSheet( DC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS,
GetScreenDesc() ); GetScreenDesc() );
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
/** /**
* @file eeschema.cpp * @file eeschema.cpp
* @brief the main file
*/ */
#include <fctsys.h> #include <fctsys.h>
...@@ -33,7 +34,6 @@ ...@@ -33,7 +34,6 @@
#include <confirm.h> #include <confirm.h>
#include <gestfich.h> #include <gestfich.h>
#include <eda_dde.h> #include <eda_dde.h>
#include <id.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <eda_text.h> #include <eda_text.h>
...@@ -48,44 +48,10 @@ ...@@ -48,44 +48,10 @@
// Global variables // Global variables
bool g_OptNetListUseNames; /* true to use names rather than net wxSize g_RepeatStep;
* The numbers (PSPICE netlist only) */ int g_RepeatDeltaLabel;
wxSize g_RepeatStep; int g_DefaultBusWidth;
int g_RepeatDeltaLabel; SCH_SHEET* g_RootSheet = NULL;
bool g_HVLines = true; // Bool: force H or V
// directions (Wires, Bus ..)
int g_DefaultTextLabelSize = DEFAULT_SIZE_TEXT;
HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
SCH_SHEET* g_RootSheet = NULL;
wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
const wxString SymbolFileExtension( wxT( "sym" ) );
const wxString CompLibFileExtension( wxT( "lib" ) );
const wxString g_SchematicBackupFileExtension( wxT( "bak" ) );
const wxString SymbolFileWildcard( wxT( "KiCad drawing symbol file (*.sym)|*.sym" ) );
const wxString CompLibFileWildcard( wxT( "KiCad component library file (*.lib)|*.lib" ) );
LayerStruct g_LayerDescr; /* layer colors. */
int g_DrawDefaultLineThickness = 6; /* Default line thickness in
* Eeschema units used to
* draw/plot items having a
* default thickness line value
* (i.e. = 0 ). 0 = single pixel
* line width */
// Color to draw selected items
EDA_COLOR_T g_ItemSelectetColor = BROWN;
// Color to draw items flagged invisible, in libedit (they are invisible
// in Eeschema
EDA_COLOR_T g_InvisibleItemColor = DARKGRAY;
TRANSFORM DefaultTransform = TRANSFORM( 1, 0, 0, -1 ); TRANSFORM DefaultTransform = TRANSFORM( 1, 0, 0, -1 );
...@@ -135,8 +101,10 @@ bool EDA_APP::OnInit() ...@@ -135,8 +101,10 @@ bool EDA_APP::OnInit()
if( argc > 1 ) if( argc > 1 )
filename = argv[1]; filename = argv[1];
// Init Eeschema // Give a default colour for all layers
SeedLayers(); // (actual color will beinitialized by config)
for( int ii = 0; ii < MAX_LAYERS; ii++ )
SetLayerColor( DARKGRAY, ii );
// 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
......
...@@ -55,7 +55,66 @@ ...@@ -55,7 +55,66 @@
#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings. #define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings.
int g_DefaultBusWidth = 9; static EDA_COLOR_T s_layerColor[MAX_LAYERS];
// The width to draw busses that do not have a specific width
static int s_defaultBusThickness;
int GetDefaultBusThickness()
{
return s_defaultBusThickness;
}
void SetDefaultBusThickness( int aThickness)
{
if( aThickness >=1 )
s_defaultBusThickness = aThickness;
else
s_defaultBusThickness = 1;
}
/*
* Default line (in Eeschema units) thickness used to draw/plot items having a
* default thickness line value (i.e. = 0 ).
*/
static int s_drawDefaultLineThickness;
int GetDefaultLineThickness()
{
return s_drawDefaultLineThickness;
}
void SetDefaultLineThickness( int aThickness)
{
if( aThickness >=1 )
s_drawDefaultLineThickness = aThickness;
else
s_drawDefaultLineThickness = 1;
}
EDA_COLOR_T ReturnLayerColor( int aLayer )
{
return s_layerColor[aLayer];
}
void SetLayerColor( EDA_COLOR_T aColor, int aLayer )
{
s_layerColor[aLayer] = aColor;
}
// Color to draw selected items
EDA_COLOR_T GetItemSelectedColor()
{
return BROWN;
}
// Color to draw items flagged invisible, in libedit (they are invisible
// in Eeschema
EDA_COLOR_T GetInvisibleItemColor()
{
return DARKGRAY;
}
void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event ) void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
{ {
...@@ -208,9 +267,9 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -208,9 +267,9 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetUnits( units, g_UserUnit ); dlg.SetUnits( units, g_UserUnit );
dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() ); dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() );
dlg.SetBusWidth( g_DefaultBusWidth ); dlg.SetBusWidth( GetDefaultBusThickness() );
dlg.SetLineWidth( g_DrawDefaultLineThickness ); dlg.SetLineWidth( GetDefaultLineThickness() );
dlg.SetTextSize( g_DefaultTextLabelSize ); dlg.SetTextSize( GetDefaultLabelSize() );
dlg.SetRepeatHorizontal( g_RepeatStep.x ); dlg.SetRepeatHorizontal( g_RepeatStep.x );
dlg.SetRepeatVertical( g_RepeatStep.y ); dlg.SetRepeatVertical( g_RepeatStep.y );
dlg.SetRepeatLabel( g_RepeatDeltaLabel ); dlg.SetRepeatLabel( g_RepeatDeltaLabel );
...@@ -220,7 +279,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -220,7 +279,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetEnableMiddleButtonPan( m_canvas->GetEnableMiddleButtonPan() ); dlg.SetEnableMiddleButtonPan( m_canvas->GetEnableMiddleButtonPan() );
dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() ); dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() );
dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() ); dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() );
dlg.SetEnableHVBusOrientation( g_HVLines ); dlg.SetEnableHVBusOrientation( GetForceHVLines() );
dlg.SetShowPageLimits( g_ShowPageLimits ); dlg.SetShowPageLimits( g_ShowPageLimits );
dlg.Layout(); dlg.Layout();
dlg.Fit(); dlg.Fit();
...@@ -242,9 +301,9 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -242,9 +301,9 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
GetScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size ); GetScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
g_DefaultBusWidth = dlg.GetBusWidth(); SetDefaultBusThickness( dlg.GetBusWidth() );
g_DrawDefaultLineThickness = dlg.GetLineWidth(); SetDefaultLineThickness( dlg.GetLineWidth() );
g_DefaultTextLabelSize = dlg.GetTextSize(); SetDefaultLabelSize( dlg.GetTextSize() );
g_RepeatStep.x = dlg.GetRepeatHorizontal(); g_RepeatStep.x = dlg.GetRepeatHorizontal();
g_RepeatStep.y = dlg.GetRepeatVertical(); g_RepeatStep.y = dlg.GetRepeatVertical();
g_RepeatDeltaLabel = dlg.GetRepeatLabel(); g_RepeatDeltaLabel = dlg.GetRepeatLabel();
...@@ -254,7 +313,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -254,7 +313,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
m_canvas->SetEnableMiddleButtonPan( dlg.GetEnableMiddleButtonPan() ); m_canvas->SetEnableMiddleButtonPan( dlg.GetEnableMiddleButtonPan() );
m_canvas->SetMiddleButtonPanLimited( dlg.GetMiddleButtonPanLimited() ); m_canvas->SetMiddleButtonPanLimited( dlg.GetMiddleButtonPanLimited() );
m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() ); m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() );
g_HVLines = dlg.GetEnableHVBusOrientation(); SetForceHVLines( dlg.GetEnableHVBusOrientation() );
g_ShowPageLimits = dlg.GetShowPageLimits(); g_ShowPageLimits = dlg.GetShowPageLimits();
wxString templateFieldName; wxString templateFieldName;
...@@ -295,17 +354,6 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters() ...@@ -295,17 +354,6 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ), m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ),
&m_netListFormat) ); &m_netListFormat) );
// NOTE: Left as global until supporting code can be fixed.
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLSpd" ),
&g_HPGL_Pen_Descr.m_Pen_Speed,
20, 2, 45 ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLDm" ),
&g_HPGL_Pen_Descr.m_Pen_Diam,
15, 1, 150 ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLNum" ),
&g_HPGL_Pen_Descr.m_Pen_Num,
1, 1, 8 ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ),
&g_RepeatStep.x, &g_RepeatStep.x,
0, -1000, +1000 ) ); 0, -1000, +1000 ) );
...@@ -316,8 +364,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters() ...@@ -316,8 +364,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
&g_RepeatDeltaLabel, &g_RepeatDeltaLabel,
1, -10, +10 ) ); 1, -10, +10 ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "LabSize" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "LabSize" ),
&g_DefaultTextLabelSize, &m_defaultLabelSize,
DEFAULT_SIZE_TEXT, 0, DEFAULT_SIZE_TEXT, 5,
1000 ) ); 1000 ) );
return m_projectFileParams; return m_projectFileParams;
...@@ -402,7 +450,6 @@ static const wxString ReplaceStringEntry( wxT( "LastReplaceString" ) ); ...@@ -402,7 +450,6 @@ static const wxString ReplaceStringEntry( wxT( "LastReplaceString" ) );
static const wxString FindStringHistoryEntry( wxT( "FindStringHistoryList%d" ) ); static const wxString FindStringHistoryEntry( wxT( "FindStringHistoryList%d" ) );
static const wxString ReplaceStringHistoryEntry( wxT( "ReplaceStringHistoryList%d" ) ); static const wxString ReplaceStringHistoryEntry( wxT( "ReplaceStringHistoryList%d" ) );
static const wxString FieldNamesEntry( wxT( "FieldNames" ) ); static const wxString FieldNamesEntry( wxT( "FieldNames" ) );
static const wxString SpiceNetNamesEntry( wxT( "SpiceUseNetNames" ) );
static const wxString SimulatorCommandEntry( wxT( "SimCmdLine" ) ); static const wxString SimulatorCommandEntry( wxT( "SimCmdLine" ) );
...@@ -414,80 +461,80 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void ) ...@@ -414,80 +461,80 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void )
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
(int*)&g_UserUnit, MILLIMETRES ) ); (int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColWire" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColWire" ),
&g_LayerDescr.LayerColor[LAYER_WIRE], &s_layerColor[LAYER_WIRE],
GREEN ) ); GREEN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBus" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBus" ),
&g_LayerDescr.LayerColor[LAYER_BUS], &s_layerColor[LAYER_BUS],
BLUE ) ); BLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorConn" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorConn" ),
&g_LayerDescr.LayerColor[LAYER_JUNCTION], &s_layerColor[LAYER_JUNCTION],
GREEN ) ); GREEN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLlab" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLlab" ),
&g_LayerDescr.LayerColor[LAYER_LOCLABEL], &s_layerColor[LAYER_LOCLABEL],
BLACK ) ); BLACK ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorHlab" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorHlab" ),
&g_LayerDescr.LayerColor[LAYER_HIERLABEL], &s_layerColor[LAYER_HIERLABEL],
BROWN ) ); BROWN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGbllab" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGbllab" ),
&g_LayerDescr.LayerColor[LAYER_GLOBLABEL], &s_layerColor[LAYER_GLOBLABEL],
RED ) ); RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinF" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinF" ),
&g_LayerDescr.LayerColor[LAYER_PINFUN], &s_layerColor[LAYER_PINFUN],
MAGENTA ) ); MAGENTA ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColPinN" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColPinN" ),
&g_LayerDescr.LayerColor[LAYER_PINNUM], &s_layerColor[LAYER_PINNUM],
RED ) ); RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPNam" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPNam" ),
&g_LayerDescr.LayerColor[LAYER_PINNAM], &s_layerColor[LAYER_PINNAM],
CYAN ) ); CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorField" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorField" ),
&g_LayerDescr.LayerColor[LAYER_FIELDS], &s_layerColor[LAYER_FIELDS],
MAGENTA ) ); MAGENTA ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRef" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRef" ),
&g_LayerDescr.LayerColor[LAYER_REFERENCEPART], &s_layerColor[LAYER_REFERENCEPART],
CYAN ) ); CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorValue" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorValue" ),
&g_LayerDescr.LayerColor[LAYER_VALUEPART], &s_layerColor[LAYER_VALUEPART],
CYAN ) ); CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNote" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNote" ),
&g_LayerDescr.LayerColor[LAYER_NOTES], &s_layerColor[LAYER_NOTES],
LIGHTBLUE ) ); LIGHTBLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBody" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBody" ),
&g_LayerDescr.LayerColor[LAYER_DEVICE], &s_layerColor[LAYER_DEVICE],
RED ) ); RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBodyBg" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBodyBg" ),
&g_LayerDescr.LayerColor[LAYER_DEVICE_BACKGROUND], &s_layerColor[LAYER_DEVICE_BACKGROUND],
LIGHTYELLOW ) ); LIGHTYELLOW ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNetN" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNetN" ),
&g_LayerDescr.LayerColor[LAYER_NETNAM], &s_layerColor[LAYER_NETNAM],
DARKGRAY ) ); DARKGRAY ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPin" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPin" ),
&g_LayerDescr.LayerColor[LAYER_PIN], &s_layerColor[LAYER_PIN],
RED ) ); RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheet" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheet" ),
&g_LayerDescr.LayerColor[LAYER_SHEET], &s_layerColor[LAYER_SHEET],
MAGENTA ) ); MAGENTA ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
wxT( "ColorSheetFileName" ), wxT( "ColorSheetFileName" ),
&g_LayerDescr.LayerColor[LAYER_SHEETFILENAME], &s_layerColor[LAYER_SHEETFILENAME],
BROWN ) ); BROWN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetName" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetName" ),
&g_LayerDescr.LayerColor[LAYER_SHEETNAME], &s_layerColor[LAYER_SHEETNAME],
CYAN ) ); CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetLab" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetLab" ),
&g_LayerDescr.LayerColor[LAYER_SHEETLABEL], &s_layerColor[LAYER_SHEETLABEL],
BROWN ) ); BROWN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNoCo" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNoCo" ),
&g_LayerDescr.LayerColor[LAYER_NOCONNECT], &s_layerColor[LAYER_NOCONNECT],
BLUE ) ); BLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcW" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcW" ),
&g_LayerDescr.LayerColor[LAYER_ERC_WARN], &s_layerColor[LAYER_ERC_WARN],
GREEN ) ); GREEN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ),
&g_LayerDescr.LayerColor[LAYER_ERC_ERR], &s_layerColor[LAYER_ERC_ERR],
RED ) ); RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGrid" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGrid" ),
&g_LayerDescr.LayerColor[LAYER_GRID], &s_layerColor[LAYER_GRID],
DARKGRAY ) ); DARKGRAY ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PrintMonochrome" ), m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PrintMonochrome" ),
&m_printMonochrome, true ) ); &m_printMonochrome, true ) );
...@@ -510,13 +557,13 @@ void SCH_EDIT_FRAME::LoadSettings() ...@@ -510,13 +557,13 @@ void SCH_EDIT_FRAME::LoadSettings()
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() ); wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
// This is required until someone gets rid of the global variable g_LayerDescription(). // This is required until someone gets rid of the global variable s_layerColor.
m_GridColor = g_LayerDescr.LayerColor[LAYER_GRID]; m_GridColor = ReturnLayerColor( LAYER_GRID );
g_DefaultBusWidth = cfg->Read( DefaultBusWidthEntry, (long) 8 ); SetDefaultBusThickness( cfg->Read( DefaultBusWidthEntry, 12l ) );
g_DrawDefaultLineThickness = cfg->Read( DefaultDrawLineWidthEntry,(long) 6 ); SetDefaultLineThickness( cfg->Read( DefaultDrawLineWidthEntry, 6l ) );
cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false ); cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true ); cfg->Read( HorzVertLinesOnlyEntry, &m_forceHVLines, true );
// Load print preview window session settings. // Load print preview window session settings.
cfg->Read( PreviewFramePositionXEntry, &tmp, -1 ); cfg->Read( PreviewFramePositionXEntry, &tmp, -1 );
...@@ -539,7 +586,6 @@ void SCH_EDIT_FRAME::LoadSettings() ...@@ -539,7 +586,6 @@ void SCH_EDIT_FRAME::LoadSettings()
m_printDialogSize.SetHeight( (int) tmp ); m_printDialogSize.SetHeight( (int) tmp );
// Load netlists options: // Load netlists options:
cfg->Read( SpiceNetNamesEntry, &g_OptNetListUseNames, false );
cfg->Read( SimulatorCommandEntry, &m_simulatorCommand ); cfg->Read( SimulatorCommandEntry, &m_simulatorCommand );
// Load find dialog session setting. // Load find dialog session setting.
...@@ -605,10 +651,10 @@ void SCH_EDIT_FRAME::SaveSettings() ...@@ -605,10 +651,10 @@ void SCH_EDIT_FRAME::SaveSettings()
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() ); wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
cfg->Write( DefaultBusWidthEntry, (long) g_DefaultBusWidth ); cfg->Write( DefaultBusWidthEntry, (long) GetDefaultBusThickness() );
cfg->Write( DefaultDrawLineWidthEntry, (long) g_DrawDefaultLineThickness ); cfg->Write( DefaultDrawLineWidthEntry, (long) GetDefaultLineThickness() );
cfg->Write( ShowHiddenPinsEntry, m_showAllPins ); cfg->Write( ShowHiddenPinsEntry, m_showAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines ); cfg->Write( HorzVertLinesOnlyEntry, GetForceHVLines() );
// Save print preview window session settings. // Save print preview window session settings.
cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x ); cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x );
...@@ -623,7 +669,6 @@ void SCH_EDIT_FRAME::SaveSettings() ...@@ -623,7 +669,6 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( PrintDialogHeightEntry, m_printDialogSize.GetHeight() ); cfg->Write( PrintDialogHeightEntry, m_printDialogSize.GetHeight() );
// Save netlists options: // Save netlists options:
cfg->Write( SpiceNetNamesEntry, g_OptNetListUseNames );
cfg->Write( SimulatorCommandEntry, m_simulatorCommand ); cfg->Write( SimulatorCommandEntry, m_simulatorCommand );
// Save find dialog session setting. // Save find dialog session setting.
......
...@@ -8,11 +8,6 @@ ...@@ -8,11 +8,6 @@
#define GROUPCOMMON wxT( "/common" ) #define GROUPCOMMON wxT( "/common" )
#define GROUPLIB wxT( "libraries" ) #define GROUPLIB wxT( "libraries" )
/**
* The width given to bus drawings that do not have a specific width
*/
extern int g_DefaultBusWidth;
/* saving parameters option : */ /* saving parameters option : */
#define INSETUP true /* used when the parameter is saved in general config #define INSETUP true /* used when the parameter is saved in general config
* if not used, the parameter is saved in the local * if not used, the parameter is saved in the local
......
...@@ -51,6 +51,10 @@ ...@@ -51,6 +51,10 @@
enum id_eeschema_frm enum id_eeschema_frm
{ {
ID_UPDATE_ONE_SHEET,
ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
ID_LOAD_ONE_SHEET,
/* Schematic editor horizontal toolbar IDs */ /* Schematic editor horizontal toolbar IDs */
ID_HIERARCHY = ID_END_LIST, ID_HIERARCHY = ID_END_LIST,
ID_TO_LIBVIEW, ID_TO_LIBVIEW,
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreateBackupFile ) bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, bool aSaveUnderNewName, bool aCreateBackupFile )
{ {
wxString msg; wxString msg;
wxFileName schematicFileName, backupFileName; wxFileName schematicFileName, backupFileName;
...@@ -53,11 +53,10 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat ...@@ -53,11 +53,10 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat
/* If no name exists in the window yet - save as new. */ /* If no name exists in the window yet - save as new. */
if( aScreen->GetFileName().IsEmpty() ) if( aScreen->GetFileName().IsEmpty() )
aSaveType = FILE_SAVE_NEW; aSaveUnderNewName = true;
switch( aSaveType ) if( aSaveUnderNewName == false )
{ {
case FILE_SAVE_AS:
schematicFileName = aScreen->GetFileName(); schematicFileName = aScreen->GetFileName();
// Sheet file names are relative to the root sheet path which is the current // Sheet file names are relative to the root sheet path which is the current
...@@ -75,7 +74,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat ...@@ -75,7 +74,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat
/* Rename the old file to a '.bak' one: */ /* Rename the old file to a '.bak' one: */
if( schematicFileName.FileExists() ) if( schematicFileName.FileExists() )
{ {
backupFileName.SetExt( g_SchematicBackupFileExtension ); backupFileName.SetExt( SchematicBackupFileExtension );
if( backupFileName.FileExists() ) if( backupFileName.FileExists() )
wxRemoveFile( backupFileName.GetFullPath() ); wxRemoveFile( backupFileName.GetFullPath() );
...@@ -87,10 +86,8 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat ...@@ -87,10 +86,8 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat
} }
} }
} }
}
break; else
case FILE_SAVE_NEW:
{ {
schematicFileName = aScreen->GetFileName(); schematicFileName = aScreen->GetFileName();
...@@ -106,12 +103,6 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat ...@@ -106,12 +103,6 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat
if( !IsWritable( schematicFileName ) ) if( !IsWritable( schematicFileName ) )
return false; return false;
break;
}
default:
break;
} }
wxLogTrace( traceAutoSave, wxLogTrace( traceAutoSave,
...@@ -125,7 +116,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat ...@@ -125,7 +116,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat
return false; return false;
} }
if( aSaveType == FILE_SAVE_NEW ) if( aSaveUnderNewName )
aScreen->SetFileName( schematicFileName.GetFullPath() ); aScreen->SetFileName( schematicFileName.GetFullPath() );
bool success = aScreen->Save( f ); bool success = aScreen->Save( f );
...@@ -169,16 +160,12 @@ void SCH_EDIT_FRAME::Save_File( wxCommandEvent& event ) ...@@ -169,16 +160,12 @@ void SCH_EDIT_FRAME::Save_File( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_SAVE_ONE_SHEET: /* Update Schematic File */ case ID_UPDATE_ONE_SHEET:
SaveEEFile( NULL, FILE_SAVE_AS ); SaveEEFile( NULL );
break;
case ID_SAVE_ONE_SHEET_AS: /* Save EED (new name) */
SaveEEFile( NULL, FILE_SAVE_NEW );
break; break;
default: case ID_SAVE_ONE_SHEET_UNDER_NEW_NAME:
DisplayError( this, wxT( "SCH_EDIT_FRAME::Save_File Internal Error" ) ); SaveEEFile( NULL, true );
break; break;
} }
} }
...@@ -293,7 +280,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew ) ...@@ -293,7 +280,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
wxString cachename = fn.GetName() + wxT( "-cache" ); wxString cachename = fn.GetName() + wxT( "-cache" );
fn.SetName( cachename ); fn.SetName( cachename );
fn.SetExt( CompLibFileExtension ); fn.SetExt( SchematicLibraryFileExtension );
if( ! fn.FileExists() ) if( ! fn.FileExists() )
{ {
...@@ -320,7 +307,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew ) ...@@ -320,7 +307,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
if ( use_oldcachename ) // set the new name if ( use_oldcachename ) // set the new name
{ {
fn.SetName( cachename ); fn.SetName( cachename );
fn.SetExt( CompLibFileExtension ); fn.SetExt( SchematicLibraryFileExtension );
LibCache->SetFileName( fn ); LibCache->SetFileName( fn );
} }
...@@ -380,13 +367,11 @@ void SCH_EDIT_FRAME::OnSaveProject( wxCommandEvent& aEvent ) ...@@ -380,13 +367,11 @@ void SCH_EDIT_FRAME::OnSaveProject( wxCommandEvent& aEvent )
return; return;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{ SaveEEFile( screen );
SaveEEFile( screen, FILE_SAVE_AS );
}
wxString cachename = fn.GetName() + wxT( "-cache" ); wxString cachename = fn.GetName() + wxT( "-cache" );
fn.SetName( cachename ); fn.SetName( cachename );
fn.SetExt( CompLibFileExtension ); fn.SetExt( SchematicLibraryFileExtension );
CreateArchiveLibrary( fn.GetFullPath() ); CreateArchiveLibrary( fn.GetFullPath() );
} }
...@@ -417,14 +402,10 @@ bool SCH_EDIT_FRAME::doAutoSave() ...@@ -417,14 +402,10 @@ bool SCH_EDIT_FRAME::doAutoSave()
screen->SetFileName( fn.GetFullPath() ); screen->SetFileName( fn.GetFullPath() );
if( SaveEEFile( screen, FILE_SAVE_AS, NO_BACKUP_FILE ) ) if( SaveEEFile( screen, false, NO_BACKUP_FILE ) )
{
screen->SetModify(); screen->SetModify();
}
else else
{
autoSaveOk = false; autoSaveOk = false;
}
screen->SetFileName( tmpFileName.GetFullPath() ); screen->SetFileName( tmpFileName.GetFullPath() );
} }
......
...@@ -11,37 +11,21 @@ ...@@ -11,37 +11,21 @@
#include <block_commande.h> #include <block_commande.h>
#include <class_netlist_object.h> #include <class_netlist_object.h>
class SCH_ITEM;
class SCH_SHEET; class SCH_SHEET;
class TRANSFORM; class TRANSFORM;
#define EESCHEMA_VERSION 2 #define EESCHEMA_VERSION 2
#define SCHEMATIC_HEAD_STRING "Schematic File Version" #define SCHEMATIC_HEAD_STRING "Schematic File Version"
#define EESCHEMA_FILE_STAMP "EESchema"
#define NULL_STRING "_NONAME_"
// Define the char buffer size used to read library files
#define LINE_BUFFER_LEN_LARGE 8000
#define LINE_BUFFER_LEN 1024
#define MAX_PIN_INFO 10
#define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers. #define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers.
#define HIGHLIGHT_COLOR WHITE
//#define GR_DEFAULT_DRAWMODE GR_COPY
#define GR_DEFAULT_DRAWMODE GR_COPY #define GR_DEFAULT_DRAWMODE GR_COPY
#define DANGLING_SYMBOL_SIZE 12 #define DANGLING_SYMBOL_SIZE 12
extern wxString g_DefaultSchematicFileName; // this enum is for color management
typedef enum {
typedef enum
{
LAYER_WIRE, LAYER_WIRE,
LAYER_BUS, LAYER_BUS,
LAYER_JUNCTION, LAYER_JUNCTION,
...@@ -67,99 +51,52 @@ typedef enum ...@@ -67,99 +51,52 @@ typedef enum
LAYER_ERC_ERR, LAYER_ERC_ERR,
LAYER_DEVICE_BACKGROUND, LAYER_DEVICE_BACKGROUND,
LAYER_GRID, LAYER_GRID,
LAYER_ITEM_SELECTED,
LAYER_INVISIBLE_ITEM,
MAX_LAYER /* Maximum layers */ MAX_LAYER // end of list
} LayerNumber; } LayerNumber;
typedef enum
{
FILE_SAVE_AS,
FILE_SAVE_NEW
} FileSaveType;
/* Rotation, mirror of graphic items in components bodies are handled by a /* Rotation, mirror of graphic items in components bodies are handled by a
* transform matrix. The default matix is useful to draw lib entries with * transform matrix. The default matrix is useful to draw lib entries with
* a defualt matix ( no rotation, no mirror but Y axis is bottom to top, and * using this default matrix ( no rotation, no mirror but Y axis is bottom to top, and
* Y draw axis is to to bottom so we must have a default matix that reverses * Y draw axis is to to bottom so we must have a default matix that reverses
* the Y coordinate and keeps the X coordiate * the Y coordinate and keeps the X coordiate
*/ */
extern TRANSFORM DefaultTransform; extern TRANSFORM DefaultTransform;
#define MIN_BUSLINES_THICKNESS 12 // min bus lines and entries thickness #define MAX_LAYERS (int) MAX_LAYER
#define MAX_LAYERS 44
class LayerStruct
{
public:
char LayerNames[MAX_LAYERS + 1][8];
EDA_COLOR_T LayerColor[MAX_LAYERS + 1];
char LayerStatus[MAX_LAYERS + 1];
int NumberOfLayers;
int CurrentLayer;
int CurrentWidth;
EDA_COLOR_T CommonColor;
int Flags;
};
extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel;
// Management options.
extern bool g_HVLines;
extern struct EESchemaVariables g_EESchemaVar; extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel;
extern int g_DefaultTextLabelSize;
struct HPGL_Pen_Descr_Struct
{
int m_Pen_Num; /* Pen number */
int m_Pen_Speed; /* Pen speed in cm/s */
int m_Pen_Diam; /* Pen diameter in mils */
};
extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
/* First and main (root) screen */ /* First and main (root) screen */
extern SCH_SHEET* g_RootSheet; extern SCH_SHEET* g_RootSheet;
extern wxString g_NetCmpExtBuffer;
extern const wxString SymbolFileExtension;
extern const wxString SymbolFileWildcard;
extern const wxString CompLibFileExtension;
extern const wxString CompLibFileWildcard;
extern const wxString g_SchematicBackupFileExtension;
extern LayerStruct g_LayerDescr; extern NETLIST_OBJECT_LIST g_NetObjectslist;
/// True to prevent displacing pins, when they are at the same position.
extern bool g_EditPinByPinIsOn;
/** /**
* Default line (in Eeschema units) thickness used to draw/plot items having a * Default line thickness used to draw/plot items having a
* default thickness line value (i.e. = 0 ). * default thickness line value (i.e. = 0 ).
* 0 = single pixel line width.
*/ */
extern int g_DrawDefaultLineThickness; int GetDefaultLineThickness();
void SetDefaultLineThickness( int aThickness);
/// Color to draw selected items /**
extern EDA_COLOR_T g_ItemSelectetColor; * Default line thickness used to draw/plot busses.
*/
int GetDefaultBusThickness();
void SetDefaultBusThickness( int aThickness );
/// Color to draw items flagged invisible, in libedit (they are invisible in Eeschema EDA_COLOR_T ReturnLayerColor( int aLayer );
extern EDA_COLOR_T g_InvisibleItemColor;
/* Global Variables */ // Color to draw selected items
EDA_COLOR_T GetItemSelectedColor();
extern NETLIST_OBJECT_LIST g_NetObjectslist; // Color to draw items flagged invisible, in libedit (they are invisible in Eeschema
EDA_COLOR_T GetInvisibleItemColor();
extern bool g_OptNetListUseNames; /* true to use names rather than void SetLayerColor( EDA_COLOR_T aColor, int aLayer );
* net numbers. SPICE netlist only
*/
#endif // _GENERAL_H_ #endif // _GENERAL_H_
...@@ -337,7 +337,7 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, ...@@ -337,7 +337,7 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_ARC::GetPenSize() const int LIB_ARC::GetPenSize() const
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
} }
...@@ -376,7 +376,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf ...@@ -376,7 +376,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
if( IsSelected() ) if( IsSelected() )
color = g_ItemSelectetColor; color = GetItemSelectedColor();
} }
else else
{ {
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -282,7 +281,7 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, ...@@ -282,7 +281,7 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_BEZIER::GetPenSize() const int LIB_BEZIER::GetPenSize() const
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
} }
...@@ -309,7 +308,7 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -309,7 +308,7 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
if( IsSelected() ) if( IsSelected() )
color = g_ItemSelectetColor; color = GetItemSelectedColor();
} }
else else
{ {
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -205,7 +205,7 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, ...@@ -205,7 +205,7 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_CIRCLE::GetPenSize() const int LIB_CIRCLE::GetPenSize() const
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
} }
...@@ -220,7 +220,7 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -220,7 +220,7 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
if( IsSelected() ) if( IsSelected() )
color = g_ItemSelectetColor; color = GetItemSelectedColor();
} }
else else
{ {
......
...@@ -30,17 +30,13 @@ ...@@ -30,17 +30,13 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <confirm.h> #include <confirm.h>
#include <gestfich.h>
#include <eeschema_id.h>
#include <richio.h>
#include <general.h> #include <general.h>
#include <protos.h>
#include <libeditframe.h> #include <libeditframe.h>
#include <class_library.h> #include <class_library.h>
#include <wildcards_and_files_ext.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/wfstream.h> #include <wx/wfstream.h>
...@@ -59,7 +55,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event ) ...@@ -59,7 +55,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
m_lastDrawItem = NULL; m_lastDrawItem = NULL;
wxFileDialog dlg( this, _( "Import Component" ), m_lastLibImportPath, wxFileDialog dlg( this, _( "Import Component" ), m_lastLibImportPath,
wxEmptyString, CompLibFileWildcard, wxEmptyString, SchematicLibraryFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
...@@ -110,12 +106,12 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event ) ...@@ -110,12 +106,12 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
} }
fn = m_component->GetName().Lower(); fn = m_component->GetName().Lower();
fn.SetExt( CompLibFileExtension ); fn.SetExt( SchematicLibraryFileExtension );
title = createLib ? _( "New Library" ) : _( "Export Component" ); title = createLib ? _( "New Library" ) : _( "Export Component" );
wxFileDialog dlg( this, title, wxGetCwd(), fn.GetFullName(), wxFileDialog dlg( this, title, wxGetCwd(), fn.GetFullName(),
CompLibFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); SchematicLibraryFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -255,7 +255,7 @@ bool LIB_FIELD::Load( LINE_READER& aLineReader, wxString& errorMsg ) ...@@ -255,7 +255,7 @@ bool LIB_FIELD::Load( LINE_READER& aLineReader, wxString& errorMsg )
int LIB_FIELD::GetPenSize() const int LIB_FIELD::GetPenSize() const
{ {
return ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness; return ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;
} }
...@@ -274,11 +274,11 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a ...@@ -274,11 +274,11 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if( ( m_Attributs & TEXT_NO_VISIBLE ) && ( aColor < 0 ) ) if( ( m_Attributs & TEXT_NO_VISIBLE ) && ( aColor < 0 ) )
{ {
color = g_InvisibleItemColor; color = GetInvisibleItemColor();
} }
else if( IsSelected() && ( aColor < 0 ) ) else if( IsSelected() && ( aColor < 0 ) )
{ {
color = g_ItemSelectetColor; color = GetItemSelectedColor();
} }
else else
{ {
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -782,7 +782,7 @@ bool LIB_PIN::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) ...@@ -782,7 +782,7 @@ bool LIB_PIN::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
int LIB_PIN::GetPenSize() const int LIB_PIN::GetPenSize() const
{ {
return ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width; return ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
} }
...@@ -795,7 +795,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, ...@@ -795,7 +795,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )
{ {
// Invisible pins are only drawn on request. // Invisible pins are only drawn on request.
// They are drawn in g_InvisibleItemColor. // They are drawn in GetInvisibleItemColor().
// in schematic, they are drawn only if m_showAllPins is true. // in schematic, they are drawn only if m_showAllPins is true.
// In other windows, they are always drawn because we must see them. // In other windows, they are always drawn because we must see them.
if( ! IsVisible() ) if( ! IsVisible() )
...@@ -809,7 +809,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, ...@@ -809,7 +809,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() ) ! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
return; return;
aColor = g_InvisibleItemColor; aColor = GetInvisibleItemColor();
} }
LIB_COMPONENT* Entry = GetParent(); LIB_COMPONENT* Entry = GetParent();
...@@ -866,7 +866,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, ...@@ -866,7 +866,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
if( IsSelected() ) if( IsSelected() )
color = g_ItemSelectetColor; color = GetItemSelectedColor();
} }
else else
color = aColor; color = aColor;
...@@ -1088,7 +1088,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, ...@@ -1088,7 +1088,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
/* Get the num and name colors */ /* Get the num and name colors */
if( (Color < 0) && IsSelected() ) if( (Color < 0) && IsSelected() )
Color = g_ItemSelectetColor; Color = GetItemSelectedColor();
NameColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color ); NameColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color );
NumColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color ); NumColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color );
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -260,7 +260,7 @@ void LIB_POLYLINE::AddPoint( const wxPoint& point ) ...@@ -260,7 +260,7 @@ void LIB_POLYLINE::AddPoint( const wxPoint& point )
int LIB_POLYLINE::GetPenSize() const int LIB_POLYLINE::GetPenSize() const
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
} }
...@@ -275,7 +275,7 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint ...@@ -275,7 +275,7 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
if( IsSelected() ) if( IsSelected() )
color = g_ItemSelectetColor; color = GetItemSelectedColor();
} }
else else
{ {
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -190,7 +190,7 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, ...@@ -190,7 +190,7 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_RECTANGLE::GetPenSize() const int LIB_RECTANGLE::GetPenSize() const
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? GetDefaultLineThickness() : m_Width;
} }
...@@ -205,7 +205,7 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -205,7 +205,7 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
if( IsSelected() ) if( IsSelected() )
color = g_ItemSelectetColor; color = GetItemSelectedColor();
} }
else else
{ {
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -334,7 +333,7 @@ int LIB_TEXT::GetPenSize() const ...@@ -334,7 +333,7 @@ int LIB_TEXT::GetPenSize() const
if( m_Bold ) if( m_Bold )
pensize = GetPenSizeForBold( m_Size.x ); pensize = GetPenSizeForBold( m_Size.x );
else else
pensize = g_DrawDefaultLineThickness; pensize = GetDefaultLineThickness();
} }
// Clip pen size for small texts: // Clip pen size for small texts:
...@@ -352,7 +351,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO ...@@ -352,7 +351,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
if( aColor < 0 ) // Used normal color or selected color if( aColor < 0 ) // Used normal color or selected color
{ {
if( IsSelected() ) if( IsSelected() )
color = g_ItemSelectetColor; color = GetItemSelectedColor();
} }
else else
{ {
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <libeditframe.h> #include <libeditframe.h>
#include <class_library.h> #include <class_library.h>
#include <template_fieldnames.h> #include <template_fieldnames.h>
#include <wildcards_and_files_ext.h>
#include <dialogs/dialog_lib_new_component.h> #include <dialogs/dialog_lib_new_component.h>
...@@ -309,7 +310,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event ) ...@@ -309,7 +310,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
{ // Get a new name for the library { // Get a new name for the library
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath(); wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog dlg( this, _( "Component Library Name:" ), default_path, wxFileDialog dlg( this, _( "Component Library Name:" ), default_path,
wxEmptyString, CompLibFileWildcard, wxEmptyString, SchematicLibraryFileExtension,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
...@@ -320,7 +321,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event ) ...@@ -320,7 +321,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
/* The GTK file chooser doesn't return the file extension added to /* The GTK file chooser doesn't return the file extension added to
* file name so add it here. */ * file name so add it here. */
if( fn.GetExt().IsEmpty() ) if( fn.GetExt().IsEmpty() )
fn.SetExt( CompLibFileExtension ); fn.SetExt( SchematicLibraryFileExtension );
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() ); wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
} }
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <richio.h> #include <richio.h>
#include <general.h> #include <general.h>
#include <protos.h> //#include <protos.h>
#include <sch_bus_entry.h> #include <sch_bus_entry.h>
#include <sch_marker.h> #include <sch_marker.h>
#include <sch_junction.h> #include <sch_junction.h>
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <sch_text.h> #include <sch_text.h>
#include <sch_sheet.h> #include <sch_sheet.h>
#include <sch_bitmap.h> #include <sch_bitmap.h>
#include <wildcards_and_files_ext.h>
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* Window ); bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* Window );
...@@ -55,10 +56,10 @@ static void LoadLayers( LINE_READER* aLine ); ...@@ -55,10 +56,10 @@ static void LoadLayers( LINE_READER* aLine );
bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName ) bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName )
{ {
char Name1[256]; char name1[256];
bool itemLoaded = false; bool itemLoaded = false;
SCH_ITEM* item; SCH_ITEM* item;
wxString MsgDiag; // Error and log messages wxString msgDiag; // Error and log messages
char* line; char* line;
wxFileName fn; wxFileName fn;
...@@ -69,7 +70,7 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi ...@@ -69,7 +70,7 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
return false; return false;
fn = aFullFileName; fn = aFullFileName;
CheckForAutoSaveFile( fn, g_SchematicBackupFileExtension ); CheckForAutoSaveFile( fn, SchematicBackupFileExtension );
wxLogTrace( traceAutoSave, wxT( "Loading schematic file " ) + aFullFileName ); wxLogTrace( traceAutoSave, wxT( "Loading schematic file " ) + aFullFileName );
...@@ -80,23 +81,23 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi ...@@ -80,23 +81,23 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
if( ( f = wxFopen( aFullFileName, wxT( "rt" ) ) ) == NULL ) if( ( f = wxFopen( aFullFileName, wxT( "rt" ) ) ) == NULL )
{ {
MsgDiag = _( "Failed to open " ) + aFullFileName; msgDiag = _( "Failed to open " ) + aFullFileName;
DisplayError( this, MsgDiag ); DisplayError( this, msgDiag );
return false; return false;
} }
// reader now owns the open FILE. // reader now owns the open FILE.
FILE_LINE_READER reader( f, aFullFileName ); FILE_LINE_READER reader( f, aFullFileName );
MsgDiag = _( "Loading " ) + aScreen->GetFileName(); msgDiag = _( "Loading " ) + aScreen->GetFileName();
PrintMsg( MsgDiag ); PrintMsg( msgDiag );
if( !reader.ReadLine() if( !reader.ReadLine()
|| strncmp( (char*)reader + 9, SCHEMATIC_HEAD_STRING, || strncmp( (char*)reader + 9, SCHEMATIC_HEAD_STRING,
sizeof( SCHEMATIC_HEAD_STRING ) - 1 ) != 0 ) sizeof( SCHEMATIC_HEAD_STRING ) - 1 ) != 0 )
{ {
MsgDiag = aFullFileName + _( " is NOT an Eeschema file!" ); msgDiag = aFullFileName + _( " is NOT an Eeschema file!" );
DisplayError( this, MsgDiag ); DisplayError( this, msgDiag );
return false; return false;
} }
...@@ -113,9 +114,9 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi ...@@ -113,9 +114,9 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
if( version > EESCHEMA_VERSION ) if( version > EESCHEMA_VERSION )
{ {
MsgDiag = aFullFileName + _( " was created by a more recent \ msgDiag = aFullFileName + _( " was created by a more recent \
version of Eeschema and may not load correctly. Please consider updating!" ); version of Eeschema and may not load correctly. Please consider updating!" );
DisplayInfoMessage( this, MsgDiag ); DisplayInfoMessage( this, msgDiag );
} }
#if 0 #if 0
...@@ -132,8 +133,8 @@ again." ); ...@@ -132,8 +133,8 @@ again." );
if( !reader.ReadLine() || strncmp( reader, "LIBS:", 5 ) != 0 ) if( !reader.ReadLine() || strncmp( reader, "LIBS:", 5 ) != 0 )
{ {
MsgDiag = aFullFileName + _( " is NOT an Eeschema file!" ); msgDiag = aFullFileName + _( " is NOT an Eeschema file!" );
DisplayError( this, MsgDiag ); DisplayError( this, msgDiag );
return false; return false;
} }
...@@ -158,7 +159,7 @@ again." ); ...@@ -158,7 +159,7 @@ again." );
else if( line[1] == 'S' ) else if( line[1] == 'S' )
item = new SCH_SHEET(); item = new SCH_SHEET();
else if( line[1] == 'D' ) else if( line[1] == 'D' )
itemLoaded = ReadSchemaDescr( &reader, MsgDiag, aScreen ); itemLoaded = ReadSchemaDescr( &reader, msgDiag, aScreen );
else if( line[1] == 'B' ) else if( line[1] == 'B' )
item = new SCH_BITMAP(); item = new SCH_BITMAP();
break; break;
...@@ -193,17 +194,17 @@ again." ); ...@@ -193,17 +194,17 @@ again." );
break; break;
case 'T': // It is a text item. case 'T': // It is a text item.
if( sscanf( sline, "%s", Name1 ) != 1 ) if( sscanf( sline, "%s", name1 ) != 1 )
{ {
MsgDiag.Printf( _( "Eeschema file text load error at line %d" ), msgDiag.Printf( _( "Eeschema file text load error at line %d" ),
reader.LineNumber() ); reader.LineNumber() );
itemLoaded = false; itemLoaded = false;
} }
else if( Name1[0] == 'L' ) else if( name1[0] == 'L' )
item = new SCH_LABEL(); item = new SCH_LABEL();
else if( Name1[0] == 'G' && version > 1 ) else if( name1[0] == 'G' && version > 1 )
item = new SCH_GLOBALLABEL(); item = new SCH_GLOBALLABEL();
else if( (Name1[0] == 'H') || (Name1[0] == 'G' && version == 1) ) else if( (name1[0] == 'H') || (name1[0] == 'G' && version == 1) )
item = new SCH_HIERLABEL(); item = new SCH_HIERLABEL();
else else
item = new SCH_TEXT(); item = new SCH_TEXT();
...@@ -211,14 +212,14 @@ again." ); ...@@ -211,14 +212,14 @@ again." );
default: default:
itemLoaded = false; itemLoaded = false;
MsgDiag.Printf( _( "Eeschema file undefined object at line %d, aborted" ), msgDiag.Printf( _( "Eeschema file undefined object at line %d, aborted" ),
reader.LineNumber() ); reader.LineNumber() );
MsgDiag << wxT( "\n" ) << FROM_UTF8( line ); msgDiag << wxT( "\n" ) << FROM_UTF8( line );
} }
if( item ) if( item )
{ {
itemLoaded = item->Load( reader, MsgDiag ); itemLoaded = item->Load( reader, msgDiag );
if( !itemLoaded ) if( !itemLoaded )
{ {
...@@ -232,7 +233,7 @@ again." ); ...@@ -232,7 +233,7 @@ again." );
if( !itemLoaded ) if( !itemLoaded )
{ {
DisplayError( this, MsgDiag ); DisplayError( this, msgDiag );
break; break;
} }
} }
...@@ -243,8 +244,8 @@ again." ); ...@@ -243,8 +244,8 @@ again." );
aScreen->TestDanglingEnds(); aScreen->TestDanglingEnds();
MsgDiag = _( "Done Loading " ) + aScreen->GetFileName(); msgDiag = _( "Done Loading " ) + aScreen->GetFileName();
PrintMsg( MsgDiag ); PrintMsg( msgDiag );
return true; // Although it may be that file is only partially loaded. return true; // Although it may be that file is only partially loaded.
} }
...@@ -252,28 +253,12 @@ again." ); ...@@ -252,28 +253,12 @@ again." );
static void LoadLayers( LINE_READER* aLine ) static void LoadLayers( LINE_READER* aLine )
{ {
int Number; /* read the layer descr
* legacy code, not actually used, so this section is just skipped
//int Mode,Color,Layer; * read lines like
char Name[256]; * EELAYER 25 0
* EELAYER END
aLine->ReadLine(); */
sscanf( *aLine, "%s %d %d", Name, &Number, &g_LayerDescr.CurrentLayer );
if( strcmp( Name, "EELAYER" ) !=0 )
{
/* error : init par default */
Number = MAX_LAYER;
}
if( Number <= 0 )
Number = MAX_LAYER;
if( Number > MAX_LAYER )
Number = MAX_LAYER;
g_LayerDescr.NumberOfLayers = Number;
while( aLine->ReadLine() ) while( aLine->ReadLine() )
{ {
......
...@@ -110,14 +110,14 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() ...@@ -110,14 +110,14 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Save current sheet // Save current sheet
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
ID_SAVE_ONE_SHEET, ID_UPDATE_ONE_SHEET,
_( "Save &Current Sheet Only" ), _( "Save &Current Sheet Only" ),
_( "Save only current schematic sheet" ), _( "Save only current schematic sheet" ),
KiBitmap( save_xpm ) ); KiBitmap( save_xpm ) );
// Save current sheet as // Save current sheet as
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
ID_SAVE_ONE_SHEET_AS, ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
_( "Save Current Sheet &As" ), _( "Save Current Sheet &As" ),
_( "Save current schematic sheet as..." ), _( "Save current schematic sheet as..." ),
KiBitmap( save_as_xpm ) ); KiBitmap( save_as_xpm ) );
......
...@@ -71,6 +71,7 @@ int TestDuplicateSheetNames( bool aCreateMarker ); ...@@ -71,6 +71,7 @@ int TestDuplicateSheetNames( bool aCreateMarker );
#define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" ) #define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" )
#define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" ) #define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" )
#define NETLIST_USE_DEFAULT_NETNAME wxT( "NetlistUseDefaultNetname" ) #define NETLIST_USE_DEFAULT_NETNAME wxT( "NetlistUseDefaultNetname" )
#define NETLIST_PSPICE_USE_NETNAME wxT( "SpiceUseNetNames" )
...@@ -105,6 +106,7 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, ...@@ -105,6 +106,7 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
m_AddSubPrefix = NULL; m_AddSubPrefix = NULL;
m_ButtonCancel = NULL; m_ButtonCancel = NULL;
m_NetOption = NULL; m_NetOption = NULL;
wxString netfmtName = ((NETLIST_DIALOG*)parent->GetParent())->m_NetFmtName; wxString netfmtName = ((NETLIST_DIALOG*)parent->GetParent())->m_NetFmtName;
int fmtOption = 0; int fmtOption = 0;
...@@ -177,11 +179,12 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) : ...@@ -177,11 +179,12 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
NETLIST_DIALOG_BASE( parent ) NETLIST_DIALOG_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
m_Config = wxGetApp().GetSettings(); m_config = wxGetApp().GetSettings();
long tmp; long tmp;
m_Config->Read( NETLIST_USE_DEFAULT_NETNAME, &tmp, 0l ); m_config->Read( NETLIST_USE_DEFAULT_NETNAME, &tmp, 0l );
m_cbUseDefaultNetlistName->SetValue( tmp ); m_cbUseDefaultNetlistName->SetValue( tmp );
m_config->Read( NETLIST_PSPICE_USE_NETNAME, &m_spiceNetlistUseNames, true );
m_NetFmtName = m_Parent->GetNetListFormatName(); m_NetFmtName = m_Parent->GetNetListFormatName();
...@@ -241,7 +244,7 @@ const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item ) ...@@ -241,7 +244,7 @@ const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item )
msg = CUSTOM_NETLIST_TITLE; msg = CUSTOM_NETLIST_TITLE;
msg << index + 1; msg << index + 1;
name = m_Config->Read( msg ); name = m_config->Read( msg );
return name; return name;
} }
...@@ -268,7 +271,7 @@ void NETLIST_DIALOG::InstallPageSpice() ...@@ -268,7 +271,7 @@ void NETLIST_DIALOG::InstallPageSpice()
2, netlist_opt, 1, 2, netlist_opt, 1,
wxRA_SPECIFY_COLS ); wxRA_SPECIFY_COLS );
if( !g_OptNetListUseNames ) if( !m_spiceNetlistUseNames )
page->m_NetOption->SetSelection( 1 ); page->m_NetOption->SetSelection( 1 );
page->m_LeftBoxSizer->Add( page->m_NetOption, 0, wxGROW | wxALL, 5 ); page->m_LeftBoxSizer->Add( page->m_NetOption, 0, wxGROW | wxALL, 5 );
...@@ -309,7 +312,7 @@ void NETLIST_DIALOG::InstallCustomPages() ...@@ -309,7 +312,7 @@ void NETLIST_DIALOG::InstallCustomPages()
// Install a plugin panel // Install a plugin panel
msg = CUSTOM_NETLIST_COMMAND; msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1; msg << ii + 1;
wxString command = m_Config->Read( msg ); wxString command = m_config->Read( msg );
currPage = AddOneCustomPage( title, command, currPage = AddOneCustomPage( title, command,
(NETLIST_TYPE_ID)(NET_TYPE_CUSTOM1 + ii) ); (NETLIST_TYPE_ID)(NET_TYPE_CUSTOM1 + ii) );
...@@ -432,10 +435,10 @@ void NETLIST_DIALOG::NetlistUpdateOpt() ...@@ -432,10 +435,10 @@ void NETLIST_DIALOG::NetlistUpdateOpt()
m_Parent->SetNetListFormatName( m_PanelNetType[ii]->GetPageNetFmtName() ); m_Parent->SetNetListFormatName( m_PanelNetType[ii]->GetPageNetFmtName() );
} }
g_OptNetListUseNames = true; // Used for pspice, gnucap m_spiceNetlistUseNames = true; // Used for pspice, gnucap
if( m_PanelNetType[PANELSPICE]->m_NetOption->GetSelection() == 1 ) if( m_PanelNetType[PANELSPICE]->m_NetOption->GetSelection() == 1 )
g_OptNetListUseNames = false; m_spiceNetlistUseNames = false;
} }
...@@ -468,7 +471,7 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event ) ...@@ -468,7 +471,7 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
{ {
case NET_TYPE_SPICE: case NET_TYPE_SPICE:
// Set spice netlist options: // Set spice netlist options:
if( g_OptNetListUseNames ) if( m_spiceNetlistUseNames )
netlist_opt |= NET_USE_NETNAMES; netlist_opt |= NET_USE_NETNAMES;
if( currPage->m_AddSubPrefix->GetValue() ) if( currPage->m_AddSubPrefix->GetValue() )
netlist_opt |= NET_USE_X_PREFIX; netlist_opt |= NET_USE_X_PREFIX;
...@@ -640,12 +643,12 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event ) ...@@ -640,12 +643,12 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
NETLIST_PAGE_DIALOG* currPage; NETLIST_PAGE_DIALOG* currPage;
currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage(); currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
g_OptNetListUseNames = currPage->m_NetOption->GetSelection() == 0; m_spiceNetlistUseNames = currPage->m_NetOption->GetSelection() == 0;
// Set spice netlist options: // Set spice netlist options:
unsigned netlist_opt = 0; unsigned netlist_opt = 0;
if( g_OptNetListUseNames ) if( m_spiceNetlistUseNames )
netlist_opt |= NET_USE_NETNAMES; netlist_opt |= NET_USE_NETNAMES;
if( currPage->m_AddSubPrefix && currPage->m_AddSubPrefix->GetValue() ) if( currPage->m_AddSubPrefix && currPage->m_AddSubPrefix->GetValue() )
netlist_opt |= NET_USE_X_PREFIX; netlist_opt |= NET_USE_X_PREFIX;
...@@ -668,7 +671,8 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void ) ...@@ -668,7 +671,8 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
NetlistUpdateOpt(); NetlistUpdateOpt();
m_Config->Write( NETLIST_USE_DEFAULT_NETNAME, GetUseDefaultNetlistName() ); m_config->Write( NETLIST_USE_DEFAULT_NETNAME, GetUseDefaultNetlistName() );
m_config->Write( NETLIST_PSPICE_USE_NETNAME, m_spiceNetlistUseNames );
// Update the new titles // Update the new titles
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ ) for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
...@@ -690,7 +694,7 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void ) ...@@ -690,7 +694,7 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
{ {
msg = CUSTOM_NETLIST_TITLE; msg = CUSTOM_NETLIST_TITLE;
msg << ii + 1; msg << ii + 1;
m_Config->Write( msg, title ); m_config->Write( msg, title );
} }
} }
...@@ -699,7 +703,7 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void ) ...@@ -699,7 +703,7 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
Command = currPage->m_CommandStringCtrl->GetValue(); Command = currPage->m_CommandStringCtrl->GetValue();
msg = CUSTOM_NETLIST_COMMAND; msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1; msg << ii + 1;
m_Config->Write( msg, Command ); m_config->Write( msg, Command );
} }
} }
} }
......
...@@ -123,7 +123,9 @@ public: ...@@ -123,7 +123,9 @@ public:
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
private: private:
wxConfig* m_Config; wxConfig* m_config;
bool m_spiceNetlistUseNames; /* true to use names rather than net
* numbers (PSPICE netlist only) */
public: public:
......
...@@ -98,13 +98,13 @@ static const wxChar* plot_sheet_list( int aSize ) ...@@ -98,13 +98,13 @@ static const wxChar* plot_sheet_list( int aSize )
void DIALOG_PLOT_SCHEMATIC::SetHPGLPenWidth() void DIALOG_PLOT_SCHEMATIC::SetHPGLPenWidth()
{ {
g_HPGL_Pen_Descr.m_Pen_Diam = ReturnValueFromTextCtrl( *m_penHPGLWidthCtrl ); m_HPGLPenSize = ReturnValueFromTextCtrl( *m_penHPGLWidthCtrl );
if( g_HPGL_Pen_Descr.m_Pen_Diam > Millimeter2iu( 2 ) ) if( m_HPGLPenSize > Millimeter2iu( 2 ) )
g_HPGL_Pen_Descr.m_Pen_Diam = Millimeter2iu( 2 ); m_HPGLPenSize = Millimeter2iu( 2 );
if( g_HPGL_Pen_Descr.m_Pen_Diam < Millimeter2iu( 0.01 ) ) if( m_HPGLPenSize < Millimeter2iu( 0.01 ) )
g_HPGL_Pen_Descr.m_Pen_Diam = Millimeter2iu( 0.01 ); m_HPGLPenSize = Millimeter2iu( 0.01 );
} }
...@@ -220,10 +220,10 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName, ...@@ -220,10 +220,10 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
// Init : // Init :
plotter->SetCreator( wxT( "Eeschema-HPGL" ) ); plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
plotter->SetFilename( aFileName ); plotter->SetFilename( aFileName );
plotter->SetPenSpeed( g_HPGL_Pen_Descr.m_Pen_Speed ); // Pen num and pen speed are not initialized here.
plotter->SetPenNumber( g_HPGL_Pen_Descr.m_Pen_Num ); // Default HPGL driver values are used
plotter->SetPenDiameter( g_HPGL_Pen_Descr.m_Pen_Diam ); plotter->SetPenDiameter( m_HPGLPenSize );
plotter->SetPenOverlap( g_HPGL_Pen_Descr.m_Pen_Diam / 2 ); plotter->SetPenOverlap( m_HPGLPenSize / 4 );
plotter->StartPlot( output_file ); plotter->StartPlot( output_file );
plotter->SetColor( BLACK ); plotter->SetColor( BLACK );
......
...@@ -54,7 +54,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef ) ...@@ -54,7 +54,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
// Allocate the plotter and set the job level parameter // Allocate the plotter and set the job level parameter
PDF_PLOTTER* plotter = new PDF_PLOTTER(); PDF_PLOTTER* plotter = new PDF_PLOTTER();
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness ); plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetColorMode( getModeColor() ); plotter->SetColorMode( getModeColor() );
plotter->SetCreator( wxT( "Eeschema-PDF" ) ); plotter->SetCreator( wxT( "Eeschema-PDF" ) );
......
...@@ -140,7 +140,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName, ...@@ -140,7 +140,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
PS_PLOTTER* plotter = new PS_PLOTTER(); PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->SetPageSettings( aPageInfo ); plotter->SetPageSettings( aPageInfo );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness ); plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetColorMode( getModeColor() ); plotter->SetColorMode( getModeColor() );
plotter->SetViewport( aPlot0ffset, IU_PER_DECIMILS, aScale, false ); plotter->SetViewport( aPlot0ffset, IU_PER_DECIMILS, aScale, false );
......
...@@ -131,7 +131,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame, ...@@ -131,7 +131,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame,
const PAGE_INFO& pageInfo = aScreen->GetPageSettings(); const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
plotter->SetPageSettings( pageInfo ); plotter->SetPageSettings( pageInfo );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness ); plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetColorMode( aPlotBlackAndWhite ? false : true ); plotter->SetColorMode( aPlotBlackAndWhite ? false : true );
wxPoint plot_offset; wxPoint plot_offset;
double scale = 1.0; double scale = 1.0;
......
...@@ -157,7 +157,7 @@ EDA_RECT SCH_BUS_ENTRY::GetBoundingBox() const ...@@ -157,7 +157,7 @@ EDA_RECT SCH_BUS_ENTRY::GetBoundingBox() const
box.SetEnd( m_End() ); box.SetEnd( m_End() );
box.Normalize(); box.Normalize();
int width = ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width; int width = ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
box.Inflate( width / 2 ); box.Inflate( width / 2 );
return box; return box;
...@@ -166,11 +166,11 @@ EDA_RECT SCH_BUS_ENTRY::GetBoundingBox() const ...@@ -166,11 +166,11 @@ EDA_RECT SCH_BUS_ENTRY::GetBoundingBox() const
int SCH_BUS_ENTRY::GetPenSize() const int SCH_BUS_ENTRY::GetPenSize() const
{ {
int pensize = ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width; int pensize = ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
if( m_Layer == LAYER_BUS ) if( m_Layer == LAYER_BUS )
{ {
pensize = ( m_width == 0 ) ? g_DefaultBusWidth : m_width; pensize = ( m_width == 0 ) ? GetDefaultBusThickness() : m_width;
} }
return pensize; return pensize;
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#define NULL_STRING "_NONAME_"
static LIB_COMPONENT* DummyCmp; static LIB_COMPONENT* DummyCmp;
......
...@@ -120,7 +120,7 @@ int SCH_FIELD::GetPenSize() const ...@@ -120,7 +120,7 @@ int SCH_FIELD::GetPenSize() const
if( m_Bold ) if( m_Bold )
pensize = GetPenSizeForBold( m_Size.x ); pensize = GetPenSizeForBold( m_Size.x );
else else
pensize = g_DrawDefaultLineThickness; pensize = GetDefaultLineThickness();
} }
// Clip pen size for small texts: // Clip pen size for small texts:
...@@ -143,7 +143,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, ...@@ -143,7 +143,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
if( m_Bold ) if( m_Bold )
LineWidth = GetPenSizeForBold( m_Size.x ); LineWidth = GetPenSizeForBold( m_Size.x );
else else
LineWidth = g_DrawDefaultLineThickness; LineWidth = GetDefaultLineThickness();
} }
...@@ -261,7 +261,7 @@ void SCH_FIELD::SwapData( SCH_ITEM* aItem ) ...@@ -261,7 +261,7 @@ void SCH_FIELD::SwapData( SCH_ITEM* aItem )
EDA_RECT SCH_FIELD::GetBoundingBox() const EDA_RECT SCH_FIELD::GetBoundingBox() const
{ {
SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent; SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent;
int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness; int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;
// We must pass the effective text thickness to GetTextBox // We must pass the effective text thickness to GetTextBox
// when calculating the bounding box // when calculating the bounding box
......
...@@ -210,11 +210,11 @@ bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -210,11 +210,11 @@ bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
int SCH_LINE::GetPenSize() const int SCH_LINE::GetPenSize() const
{ {
int pensize = ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width; int pensize = ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
if( m_Layer == LAYER_BUS ) if( m_Layer == LAYER_BUS )
{ {
pensize = ( m_width == 0 ) ? g_DefaultBusWidth : m_width; pensize = ( m_width == 0 ) ? GetDefaultBusThickness() : m_width;
} }
return pensize; return pensize;
......
...@@ -105,14 +105,13 @@ bool SCH_MARKER::Save( FILE* aFile ) const ...@@ -105,14 +105,13 @@ bool SCH_MARKER::Save( FILE* aFile ) const
void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor ) const wxPoint& aOffset, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{ {
EDA_COLOR_T color = (EDA_COLOR_T) m_Color; EDA_COLOR_T color = m_Color;
EDA_COLOR_T tmp = color; EDA_COLOR_T tmp = color;
if( GetMarkerType() == MARK_ERC ) if( GetMarkerType() == MARK_ERC )
{ {
color = ( GetErrorLevel() == WAR ) ? color = ( GetErrorLevel() == WAR ) ? ReturnLayerColor( LAYER_ERC_WARN ) :
(EDA_COLOR_T) g_LayerDescr.LayerColor[LAYER_ERC_WARN] : ReturnLayerColor( LAYER_ERC_ERR );
(EDA_COLOR_T) g_LayerDescr.LayerColor[LAYER_ERC_ERR];
} }
if( aColor < 0 ) if( aColor < 0 )
......
...@@ -118,7 +118,7 @@ bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -118,7 +118,7 @@ bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg )
int SCH_NO_CONNECT::GetPenSize() const int SCH_NO_CONNECT::GetPenSize() const
{ {
return g_DrawDefaultLineThickness; return GetDefaultLineThickness();
} }
...@@ -127,7 +127,7 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf ...@@ -127,7 +127,7 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
{ {
int pX, pY; int pX, pY;
int delta = m_size.x / 2; int delta = m_size.x / 2;
int width = g_DrawDefaultLineThickness; int width = GetDefaultLineThickness();
pX = m_pos.x + aOffset.x; pX = m_pos.x + aOffset.x;
pY = m_pos.y + aOffset.y; pY = m_pos.y + aOffset.y;
...@@ -210,7 +210,7 @@ bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const ...@@ -210,7 +210,7 @@ bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
int delta = ( ( m_size.x + g_DrawDefaultLineThickness ) / 2 ) + aAccuracy; int delta = ( ( m_size.x + GetDefaultLineThickness() ) / 2 ) + aAccuracy;
wxPoint dist = aPosition - m_pos; wxPoint dist = aPosition - m_pos;
......
...@@ -149,7 +149,7 @@ bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -149,7 +149,7 @@ bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
int SCH_POLYLINE::GetPenSize() const int SCH_POLYLINE::GetPenSize() const
{ {
int pensize = ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width; int pensize = ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
return pensize; return pensize;
} }
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#define EESCHEMA_FILE_STAMP "EESchema"
/* Default Eeschema zoom values. Limited to 17 values to keep a decent size /* Default Eeschema zoom values. Limited to 17 values to keep a decent size
* to menus * to menus
...@@ -393,10 +394,10 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer ) ...@@ -393,10 +394,10 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
break; break;
case LAYER_WIRE: case LAYER_WIRE:
if( GetItem( aPosition, std::max( g_DrawDefaultLineThickness, 3 ), SCH_BUS_ENTRY_T ) ) if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_BUS_ENTRY_T ) )
return true; return true;
if( GetItem( aPosition, std::max( g_DrawDefaultLineThickness, 3 ), SCH_JUNCTION_T ) ) if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_JUNCTION_T ) )
return true; return true;
if( GetPin( aPosition, NULL, true ) ) if( GetPin( aPosition, NULL, true ) )
...@@ -503,8 +504,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const ...@@ -503,8 +504,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
return false; return false;
} }
if( fprintf( aFile, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers, // This section is not used, but written for file compatibility
g_LayerDescr.CurrentLayer ) < 0 if( fprintf( aFile, "EELAYER %d %d\n", MAX_LAYERS, 0 ) < 0
|| fprintf( aFile, "EELAYER END\n" ) < 0 ) || fprintf( aFile, "EELAYER END\n" ) < 0 )
return false; return false;
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 Kicad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -524,7 +524,7 @@ SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition ) ...@@ -524,7 +524,7 @@ SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition )
int SCH_SHEET::GetPenSize() const int SCH_SHEET::GetPenSize() const
{ {
return g_DrawDefaultLineThickness; return GetDefaultLineThickness();
} }
...@@ -1146,7 +1146,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) ...@@ -1146,7 +1146,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
size = wxSize( m_sheetNameSize, m_sheetNameSize ); size = wxSize( m_sheetNameSize, m_sheetNameSize );
//pos = m_pos; pos.y -= 4; //pos = m_pos; pos.y -= 4;
thickness = g_DrawDefaultLineThickness; thickness = GetDefaultLineThickness();
thickness = Clamp_Text_PenSize( thickness, size, false ); thickness = Clamp_Text_PenSize( thickness, size, false );
aPlotter->SetColor( ReturnLayerColor( LAYER_SHEETNAME ) ); aPlotter->SetColor( ReturnLayerColor( LAYER_SHEETNAME ) );
...@@ -1159,7 +1159,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) ...@@ -1159,7 +1159,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
/*Draw texts : FileName */ /*Draw texts : FileName */
Text = GetFileName(); Text = GetFileName();
size = wxSize( m_fileNameSize, m_fileNameSize ); size = wxSize( m_fileNameSize, m_fileNameSize );
thickness = g_DrawDefaultLineThickness; thickness = GetDefaultLineThickness();
thickness = Clamp_Text_PenSize( thickness, size, false ); thickness = Clamp_Text_PenSize( thickness, size, false );
aPlotter->SetColor( ReturnLayerColor( LAYER_SHEETFILENAME ) ); aPlotter->SetColor( ReturnLayerColor( LAYER_SHEETFILENAME ) );
......
...@@ -105,7 +105,7 @@ bool SCH_SHEET_PIN::operator==( const SCH_SHEET_PIN* aPin ) const ...@@ -105,7 +105,7 @@ bool SCH_SHEET_PIN::operator==( const SCH_SHEET_PIN* aPin ) const
int SCH_SHEET_PIN::GetPenSize() const int SCH_SHEET_PIN::GetPenSize() const
{ {
return g_DrawDefaultLineThickness; return GetDefaultLineThickness();
} }
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -361,7 +361,7 @@ int SCH_TEXT::GetPenSize() const ...@@ -361,7 +361,7 @@ int SCH_TEXT::GetPenSize() const
if( m_Bold ) if( m_Bold )
pensize = GetPenSizeForBold( m_Size.x ); pensize = GetPenSizeForBold( m_Size.x );
else else
pensize = g_DrawDefaultLineThickness; pensize = GetDefaultLineThickness();
} }
// Clip pen size for small texts: // Clip pen size for small texts:
...@@ -374,7 +374,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, ...@@ -374,7 +374,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
GR_DRAWMODE DrawMode, EDA_COLOR_T Color ) GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
{ {
EDA_COLOR_T color; EDA_COLOR_T color;
int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness; int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
...@@ -609,7 +609,7 @@ EDA_RECT SCH_TEXT::GetBoundingBox() const ...@@ -609,7 +609,7 @@ EDA_RECT SCH_TEXT::GetBoundingBox() const
{ {
// We must pass the effective text thickness to GetTextBox // We must pass the effective text thickness to GetTextBox
// when calculating the bounding box // when calculating the bounding box
int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness; int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
...@@ -893,7 +893,7 @@ EDA_RECT SCH_LABEL::GetBoundingBox() const ...@@ -893,7 +893,7 @@ EDA_RECT SCH_LABEL::GetBoundingBox() const
x = m_Pos.x; x = m_Pos.x;
y = m_Pos.y; y = m_Pos.y;
int width = (m_Thickness == 0) ? g_DrawDefaultLineThickness : m_Thickness; int width = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
length = LenSize( m_Text ); length = LenSize( m_Text );
height = m_Size.y + width; height = m_Size.y + width;
dx = dy = 0; dx = dy = 0;
...@@ -1109,7 +1109,7 @@ void SCH_GLOBALLABEL::Rotate( wxPoint aPosition ) ...@@ -1109,7 +1109,7 @@ void SCH_GLOBALLABEL::Rotate( wxPoint aPosition )
wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
{ {
wxPoint text_offset; wxPoint text_offset;
int width = (m_Thickness == 0) ? g_DrawDefaultLineThickness : m_Thickness; int width = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
width = Clamp_Text_PenSize( width, m_Size, m_Bold ); width = Clamp_Text_PenSize( width, m_Size, m_Bold );
int HalfSize = m_Size.x / 2; int HalfSize = m_Size.x / 2;
...@@ -1206,7 +1206,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1206,7 +1206,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
int linewidth = (m_Thickness == 0) ? g_DrawDefaultLineThickness : m_Thickness; int linewidth = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
EXCHG( linewidth, m_Thickness ); // Set the minimum width EXCHG( linewidth, m_Thickness ); // Set the minimum width
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
...@@ -1231,7 +1231,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1231,7 +1231,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& Pos ) void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& Pos )
{ {
int HalfSize = m_Size.y / 2; int HalfSize = m_Size.y / 2;
int linewidth = (m_Thickness == 0) ? g_DrawDefaultLineThickness : m_Thickness; int linewidth = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
...@@ -1327,7 +1327,7 @@ EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const ...@@ -1327,7 +1327,7 @@ EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
y = m_Pos.y; y = m_Pos.y;
dx = dy = 0; dx = dy = 0;
int width = (m_Thickness == 0) ? g_DrawDefaultLineThickness : m_Thickness; int width = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
height = ( (m_Size.y * 15) / 10 ) + width + 2 * TXTMARGE; height = ( (m_Size.y * 15) / 10 ) + width + 2 * TXTMARGE;
// text X size add height for triangular shapes(bidirectional) // text X size add height for triangular shapes(bidirectional)
...@@ -1533,7 +1533,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1533,7 +1533,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
{ {
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
EDA_COLOR_T color; EDA_COLOR_T color;
int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness; int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
...@@ -1596,7 +1596,7 @@ EDA_RECT SCH_HIERLABEL::GetBoundingBox() const ...@@ -1596,7 +1596,7 @@ EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
y = m_Pos.y; y = m_Pos.y;
dx = dy = 0; dx = dy = 0;
int width = (m_Thickness == 0) ? g_DrawDefaultLineThickness : m_Thickness; int width = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
height = m_Size.y + width + 2 * TXTMARGE; height = m_Size.y + width + 2 * TXTMARGE;
length = LenSize( m_Text ) length = LenSize( m_Text )
+ height // add height for triangular shapes + height // add height for triangular shapes
...@@ -1643,7 +1643,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const ...@@ -1643,7 +1643,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const
{ {
wxPoint text_offset; wxPoint text_offset;
int width = std::max( m_Thickness, g_DrawDefaultLineThickness ); int width = std::max( m_Thickness, GetDefaultLineThickness() );
int ii = m_Size.x + TXTMARGE + width; int ii = m_Size.x + TXTMARGE + width;
......
...@@ -79,8 +79,8 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -79,8 +79,8 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_LOAD_PROJECT, SCH_EDIT_FRAME::OnLoadProject ) EVT_TOOL( ID_LOAD_PROJECT, SCH_EDIT_FRAME::OnLoadProject )
EVT_MENU( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnSaveProject ) EVT_MENU( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnSaveProject )
EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File ) EVT_MENU( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET_UNDER_NEW_NAME, SCH_EDIT_FRAME::Save_File )
EVT_MENU( ID_GEN_PLOT_SCHEMATIC, SCH_EDIT_FRAME::PlotSchematic ) EVT_MENU( ID_GEN_PLOT_SCHEMATIC, SCH_EDIT_FRAME::PlotSchematic )
EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, EDA_DRAW_FRAME::CopyToClipboard ) EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, EDA_DRAW_FRAME::CopyToClipboard )
EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit ) EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
...@@ -198,6 +198,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle, ...@@ -198,6 +198,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle,
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN ); m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
m_undoItem = NULL; m_undoItem = NULL;
m_hasAutoSave = true; m_hasAutoSave = true;
SetForceHVLines( true );
SetDefaultLabelSize( DEFAULT_SIZE_TEXT );
CreateScreens(); CreateScreens();
...@@ -582,11 +584,11 @@ void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event ) ...@@ -582,11 +584,11 @@ void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent ) void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
{ {
wxString tool_tip = g_HVLines ? wxString tool_tip = GetForceHVLines() ?
_( "Draw wires and buses in any direction" ) : _( "Draw wires and buses in any direction" ) :
_( "Draw horizontal and vertical wires and buses only" ); _( "Draw horizontal and vertical wires and buses only" );
aEvent.Check( g_HVLines ); aEvent.Check( GetForceHVLines() );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT, tool_tip );
} }
...@@ -851,7 +853,7 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event ) ...@@ -851,7 +853,7 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData ) void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData )
{ {
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE ); GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness, IU_PER_MILS, TraceWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS,
GetScreenDesc() ); GetScreenDesc() );
} }
......
...@@ -169,7 +169,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -169,7 +169,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( renameFile ) if( renameFile )
{ {
aSheet->GetScreen()->SetFileName( fileName.GetFullName() ); aSheet->GetScreen()->SetFileName( fileName.GetFullName() );
SaveEEFile( aSheet->GetScreen(), FILE_SAVE_AS ); SaveEEFile( aSheet->GetScreen() );
// If the the associated screen is shared by more than one sheet, remove the // If the the associated screen is shared by more than one sheet, remove the
// screen and reload the file to a new screen. Failure to do this will trash // screen and reload the file to a new screen. Failure to do this will trash
......
...@@ -30,18 +30,16 @@ ...@@ -30,18 +30,16 @@
#include <fctsys.h> #include <fctsys.h>
#include <appl_wxstruct.h> #include <appl_wxstruct.h>
#include <macros.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <confirm.h> #include <confirm.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <gestfich.h> #include <gestfich.h>
#include <class_sch_screen.h> #include <class_sch_screen.h>
#include <richio.h>
#include <general.h> #include <general.h>
#include <protos.h>
#include <libeditframe.h> #include <libeditframe.h>
#include <class_library.h> #include <class_library.h>
#include <wildcards_and_files_ext.h>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <wx/wfstream.h> #include <wx/wfstream.h>
...@@ -62,7 +60,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol() ...@@ -62,7 +60,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath(); wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path, wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path,
wxEmptyString, SymbolFileWildcard, wxEmptyString, SchematicSymbolFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
...@@ -142,7 +140,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol() ...@@ -142,7 +140,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath(); wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path, wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
m_component->GetName(), SymbolFileWildcard, m_component->GetName(), SchematicSymbolFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
...@@ -153,7 +151,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol() ...@@ -153,7 +151,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
/* The GTK file chooser doesn't return the file extension added to /* The GTK file chooser doesn't return the file extension added to
* file name so add it here. */ * file name so add it here. */
if( fn.GetExt().IsEmpty() ) if( fn.GetExt().IsEmpty() )
fn.SetExt( SymbolFileExtension ); fn.SetExt( SchematicSymbolFileExtension );
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() ); wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
......
...@@ -306,7 +306,6 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar() ...@@ -306,7 +306,6 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
// set icon paddings // set icon paddings
m_optionsToolBar->SetToolBorderPadding(2); // padding m_optionsToolBar->SetToolBorderPadding(2); // padding
m_optionsToolBar->SetToolSeparation(0); m_optionsToolBar->SetToolSeparation(0);
//m_optionsToolBar->SetMargins(4,0); // margins width and height
m_optionsToolBar->Realize(); m_optionsToolBar->Realize();
} }
...@@ -327,7 +326,7 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -327,7 +326,7 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_BUS_WIRES_ORIENT: case ID_TB_OPTIONS_BUS_WIRES_ORIENT:
g_HVLines = m_optionsToolBar->GetToolToggled( id ); SetForceHVLines( m_optionsToolBar->GetToolToggled( id ) );
break; break;
default: default:
......
...@@ -47,12 +47,9 @@ enum main_id ...@@ -47,12 +47,9 @@ enum main_id
ID_TO_PCB = wxID_HIGHEST, ID_TO_PCB = wxID_HIGHEST,
ID_TO_CVPCB, ID_TO_CVPCB,
ID_LOAD_PROJECT, ID_LOAD_PROJECT,
ID_LOAD_ONE_SHEET,
ID_NEW_PROJECT, ID_NEW_PROJECT,
ID_SAVE_PROJECT, ID_SAVE_PROJECT,
ID_SAVE_PROJECT_AS, ID_SAVE_PROJECT_AS,
ID_SAVE_ONE_SHEET,
ID_SAVE_ONE_SHEET_AS,
ID_LOAD_FILE, ID_LOAD_FILE,
ID_APPEND_FILE, ID_APPEND_FILE,
ID_NEW_BOARD, ID_NEW_BOARD,
......
...@@ -17,6 +17,7 @@ enum PAD_SHAPE_T ...@@ -17,6 +17,7 @@ enum PAD_SHAPE_T
PAD_RECT, PAD_RECT,
PAD_OVAL, PAD_OVAL,
PAD_TRAPEZOID, PAD_TRAPEZOID,
PAD_OCTAGON // Provided, but not existing in Pcbnew. waiting for a volunteer
}; };
......
...@@ -344,18 +344,16 @@ protected: ...@@ -344,18 +344,16 @@ protected:
class HPGL_PLOTTER : public PLOTTER class HPGL_PLOTTER : public PLOTTER
{ {
public: public:
HPGL_PLOTTER() HPGL_PLOTTER();
{
}
virtual PlotFormat GetPlotterType() const virtual PlotFormat GetPlotterType() const
{ {
return PLOT_FORMAT_HPGL; return PLOT_FORMAT_HPGL;
} }
static wxString GetDefaultFileExtension() static wxString GetDefaultFileExtension()
{ {
return wxString( wxT( "plt" ) ); return wxString( wxT( "plt" ) );
} }
virtual bool StartPlot( FILE* fout ); virtual bool StartPlot( FILE* fout );
...@@ -375,25 +373,21 @@ public: ...@@ -375,25 +373,21 @@ public:
virtual void SetPenSpeed( int speed ) virtual void SetPenSpeed( int speed )
{ {
wxASSERT( outputFile == 0 );
penSpeed = speed; penSpeed = speed;
} }
virtual void SetPenNumber( int number ) virtual void SetPenNumber( int number )
{ {
wxASSERT( outputFile == 0 );
penNumber = number; penNumber = number;
} }
virtual void SetPenDiameter( double diameter ) virtual void SetPenDiameter( double diameter )
{ {
wxASSERT( outputFile == 0 );
penDiameter = diameter; penDiameter = diameter;
} }
virtual void SetPenOverlap( double overlap ) virtual void SetPenOverlap( double overlap )
{ {
wxASSERT( outputFile == 0 );
penOverlap = overlap; penOverlap = overlap;
} }
......
...@@ -41,6 +41,11 @@ ...@@ -41,6 +41,11 @@
* that they cannot be changed. * that they cannot be changed.
* Mainly wild cards are most of time translated when displayed * Mainly wild cards are most of time translated when displayed
*/ */
extern const wxString SchematicSymbolFileExtension;
extern const wxString SchematicLibraryFileExtension;
extern const wxString SchematicBackupFileExtension;
extern const wxString VrmlFileExtension; extern const wxString VrmlFileExtension;
extern const wxString ProjectFileExtension; extern const wxString ProjectFileExtension;
extern const wxString SchematicFileExtension; extern const wxString SchematicFileExtension;
...@@ -57,6 +62,8 @@ extern const wxString ReportFileExtension; ...@@ -57,6 +62,8 @@ extern const wxString ReportFileExtension;
extern const wxString FootprintPlaceFileExtension; extern const wxString FootprintPlaceFileExtension;
/// Proper wxFileDialog wild card definitions. /// Proper wxFileDialog wild card definitions.
extern const wxString SchematicSymbolFileWildcard;
extern const wxString SchematicLibraryFileWildcard;
extern const wxString ProjectFileWildcard; extern const wxString ProjectFileWildcard;
extern const wxString SchematicFileWildcard; extern const wxString SchematicFileWildcard;
extern const wxString BoardFileWildcard; extern const wxString BoardFileWildcard;
......
...@@ -142,6 +142,10 @@ private: ...@@ -142,6 +142,10 @@ private:
wxString m_netListerCommand; ///< Command line to call a custom net list wxString m_netListerCommand; ///< Command line to call a custom net list
///< generator. ///< generator.
bool m_forceHVLines; ///< force H or V directions for wires, bus, line
int m_defaultLabelSize; ///< size of a new label
/// An index to the last find item in the found items list #m_foundItems. /// An index to the last find item in the found items list #m_foundItems.
int m_foundItemIndex; int m_foundItemIndex;
...@@ -199,6 +203,12 @@ public: ...@@ -199,6 +203,12 @@ public:
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
bool GetDefaultLabelSize() const { return m_defaultLabelSize; }
void SetDefaultLabelSize( int aLabelSize ) { m_defaultLabelSize = aLabelSize; }
bool GetForceHVLines() const { return m_forceHVLines; }
void SetForceHVLines( bool aForceHVdirection ) { m_forceHVLines = aForceHVdirection; }
bool GetShowAllPins() const { return m_showAllPins; } bool GetShowAllPins() const { return m_showAllPins; }
void SetShowAllPins( bool aEnable ) { m_showAllPins = aEnable; } void SetShowAllPins( bool aEnable ) { m_showAllPins = aEnable; }
...@@ -658,14 +668,16 @@ public: ...@@ -658,14 +668,16 @@ public:
* *
* @param aScreen A pointer to the SCH_SCREEN object to save. A NULL pointer saves * @param aScreen A pointer to the SCH_SCREEN object to save. A NULL pointer saves
* the current screen. * the current screen.
* @param aSaveType Controls how the file is to be saved. * @param aSaveUnderNewName Controls how the file is to be saved;: using previous name
* or under a new name .
* @param aCreateBackupFile Creates a back of the file associated with \a aScreen * @param aCreateBackupFile Creates a back of the file associated with \a aScreen
* if true. Helper definitions #CREATE_BACKUP_FILE and * if true.
* Helper definitions #CREATE_BACKUP_FILE and
* #NO_BACKUP_FILE are defined for improved code readability. * #NO_BACKUP_FILE are defined for improved code readability.
* @return True if the file has been saved. * @return True if the file has been saved.
*/ */
bool SaveEEFile( SCH_SCREEN* aScreen, bool SaveEEFile( SCH_SCREEN* aScreen,
int aSaveType, bool aSaveUnderNewName = false,
bool aCreateBackupFile = CREATE_BACKUP_FILE ); bool aCreateBackupFile = CREATE_BACKUP_FILE );
// General search: // General search:
......
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