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

This commit is contained in:
jean-pierre charras 2012-09-28 19:47:41 +02:00
parent 63257245e8
commit 143af26952
62 changed files with 1626 additions and 1695 deletions

View File

@ -41,9 +41,11 @@
# tools are required. If MAINTAIN_PNG is defined, then you are a PNG maintainer
# and will need the following tools findable in your PATH:
#
# 1) imagemagick - all its programs must be on your PATH
# 2) inkscape - command line mode is used, must be on your PATH
# 3) pngcrush -
# 1) inkscape - command line mode is used, must be on your PATH
# 2) pngcrush - this program must be on your PATH
# 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
@ -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)."
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(
${INC_AFTER}
)
# Plan for three sizes of bitmaps:
# SMALL - for listboxes or comboboxes and perhaps menus
# SMALL - for menus
# MID - for toolbars 26 x 26
# BIG - for program icons 48 x 48
# 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.
# A corresponding ${basename}.svg file must exist in 'sources' dir below here.
# small icons (16x16) needed in listboxes
set( BMAPS_SMALL
pinorient_right
@ -113,6 +134,7 @@ set( BMAPS_SMALL
tree_sel
)
# image basenames that go into the toolbar sized destinations, i.e. 26x26
set( BMAPS_MID
add_arc
@ -248,6 +270,7 @@ set( BMAPS_MID
gerber_open_dcode_file
gerbview_drill_file
gerbview_clear_layers
gerber_open_dcode_file
gerbview_open_recent_drill_files
general_deletions
general_ratsnest
@ -541,7 +564,8 @@ function( svg2png inputFile outFile pngWidth pngHeight )
add_custom_command(
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}
COMMENT "Creating ${pngHeight} pixel tall ${outFile}"
)
@ -566,9 +590,27 @@ function( png2png inputFile outFile )
)
endfunction()
# Function png2cpp
# converts a single *.png to *.cpp
if( CONVERT_EOL )
function( png2cpp inputFile outFile )
add_custom_command(
OUTPUT ${outFile}
COMMAND rm -f ${outFile}.tmp
COMMAND ${CMAKE_COMMAND} -DinputFile=${inputFile} -DoutCppFile=${outFile}
-P ${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}
@ -577,11 +619,12 @@ function( png2cpp inputFile outFile )
-P ${CMAKE_MODULE_PATH}/PNG2cpp.cmake
DEPENDS ${inputFile} ${CMAKE_MODULE_PATH}/PNG2cpp.cmake
COMMENT "Creating ${outFile}"
)
endfunction()
endif(CONVERT_EOL)
# Function bitmap_dir
# converts all the basenames in bmapList found in hardcoded 'sources' dir
@ -652,6 +695,7 @@ if( MAINTAIN_PNGS )
endif( NOT pngcrush_EXECUTABLE )
endif( NOT pngcrush_FOUND )
# these 3 cmake commands for each desired bitmap size set, repeat as needed:
bitmap_dir( 16 16 "${BMAPS_SMALL}" )
@ -659,6 +703,26 @@ if( MAINTAIN_PNGS )
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}" )
# a target with no output, just so changes get built

View File

@ -177,6 +177,11 @@
// HPGL scale factor (1 PLU = 1/40mm = 25 micrometers)
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,
double aScale, bool aMirror )

View File

@ -32,6 +32,10 @@
* 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 ProjectFileExtension( wxT( "pro" ) );
@ -51,6 +55,8 @@ const wxString FootprintPlaceFileExtension( wxT( "pos" ) );
// These strings are wildcards for file selection dialogs.
// Because thes are static, one should explicitely call wxGetTranslation
// 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 SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) );
const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );

View File

@ -83,8 +83,9 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
}
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 );
else
( (SCH_LINE*) s_wires.GetLast() )->SetEndPoint( endpos );
@ -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
// and vertical lines only switch is on.
if( g_HVLines )
if( GetForceHVLines() )
{
nextSegment = new SCH_LINE( *segment );
nextSegment->SetFlags( IS_NEW );
@ -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
// 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( segment->IsNull() )
@ -356,7 +357,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
int idx = polyLine->GetCornerCount() - 1;
wxPoint pt = (*polyLine)[idx];
if( g_HVLines )
if( GetForceHVLines() )
{
/* Coerce the line to vertical or horizontal one: */
if( std::abs( endpos.x - pt.x ) < std::abs( endpos.y - pt.y ) )

View File

@ -52,7 +52,6 @@
#include <boost/foreach.hpp>
// Set this to 1 to print debugging output in alias and component destructors to verify
// objects get cleaned up properly.
#if defined( TRACE_DESTRUCTOR )

View File

@ -46,7 +46,6 @@
#include <wx/regex.h>
#include <wx/wfstream.h>
static const wxChar* duplicate_name_msg =
_( "Library <%s> has duplicate entry name <%s>.\n\
This may cause some unexpected behavior when loading components into a schematic." );
@ -588,7 +587,7 @@ bool CMP_LIBRARY::LoadHeader( LINE_READER& aLineReader )
bool CMP_LIBRARY::LoadDocs( wxString& aErrorMsg )
{
int lineNumber = 0;
char line[LINE_BUFFER_LEN_LARGE], * name, * text;
char line[8000], * name, * text;
LIB_ALIAS* entry;
FILE* file;
wxString msg;

View File

@ -167,7 +167,7 @@ void DIALOG_COLOR_CONFIG::CreateControls()
wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
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 );
wxBrush brush;
brush.SetColour( ColorRefs[ color ].m_Red,
@ -292,15 +292,15 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings()
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;
}
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;
return warning;
@ -333,34 +333,3 @@ void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& event )
UpdateColorsSettings();
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;
}

View File

@ -45,10 +45,10 @@ class SCH_EDIT_FRAME;
class SCH_TEXT;
class DialogLabelEditor : public DialogLabelEditor_Base
class DIALOG_LABEL_EDITOR : public DIALOG_LABEL_EDITOR_BASE
{
public:
DialogLabelEditor( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem );
DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem );
private:
void InitDialog( );
@ -72,14 +72,14 @@ void SCH_EDIT_FRAME::EditSchematicText( SCH_TEXT* aTextItem )
if( aTextItem == NULL )
return;
DialogLabelEditor dialog( this, aTextItem );
DIALOG_LABEL_EDITOR dialog( this, aTextItem );
dialog.ShowModal();
}
DialogLabelEditor::DialogLabelEditor( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) :
DialogLabelEditor_Base( aParent )
DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) :
DIALOG_LABEL_EDITOR_BASE( aParent )
{
m_Parent = aParent;
m_CurrentText = aTextItem;
@ -94,7 +94,7 @@ DialogLabelEditor::DialogLabelEditor( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextIt
}
void DialogLabelEditor::InitDialog()
void DIALOG_LABEL_EDITOR::InitDialog()
{
wxString msg;
bool multiLine = false;
@ -135,7 +135,7 @@ void DialogLabelEditor::InitDialog()
default:
SetTitle( _( "Text Properties" ) );
m_textLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER,
wxCommandEventHandler ( DialogLabelEditor::OnEnterKey ),
wxCommandEventHandler ( DIALOG_LABEL_EDITOR::OnEnterKey ),
NULL, this );
break;
}
@ -214,7 +214,7 @@ void DialogLabelEditor::InitDialog()
* wxTE_PROCESS_ENTER event handler for m_textLabel
*/
void DialogLabelEditor::OnEnterKey( wxCommandEvent& aEvent )
void DIALOG_LABEL_EDITOR::OnEnterKey( wxCommandEvent& aEvent )
{
TextPropertiesAccept( aEvent );
}
@ -224,7 +224,7 @@ void DialogLabelEditor::OnEnterKey( wxCommandEvent& aEvent )
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent )
void DIALOG_LABEL_EDITOR::OnOkClick( wxCommandEvent& aEvent )
{
TextPropertiesAccept( aEvent );
}
@ -234,14 +234,14 @@ void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent )
* 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();
EndModal( wxID_CANCEL );
}
void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
{
wxString text;
int value;
@ -289,7 +289,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
/* Make the text size as new default size if it is a new text */
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()->MoveCursorToCrossHair();

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
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 );
@ -101,18 +101,18 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
bMainSizer->Fit( this );
// Connect Events
m_textLabelSingleLine->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
m_textLabelMultiLine->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), 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( DIALOG_LABEL_EDITOR_BASE::OnEnterKey ), 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( DIALOG_LABEL_EDITOR_BASE::OnOkClick ), NULL, this );
}
DialogLabelEditor_Base::~DialogLabelEditor_Base()
DIALOG_LABEL_EDITOR_BASE::~DIALOG_LABEL_EDITOR_BASE()
{
// Disconnect Events
m_textLabelSingleLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
m_textLabelMultiLine->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::OnEnterKey ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnOkClick ), 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( DIALOG_LABEL_EDITOR_BASE::OnEnterKey ), 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( DIALOG_LABEL_EDITOR_BASE::OnOkClick ), NULL, this );
}

View File

@ -25,62 +25,28 @@
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_managed">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center"></property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">DialogLabelEditor_Base</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="name">DIALOG_LABEL_EDITOR_BASE</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Text Editor</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -195,10 +161,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Enter the text to be used within the schematic</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -475,10 +437,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -662,10 +620,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -27,9 +27,9 @@
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DialogLabelEditor_Base
/// Class DIALOG_LABEL_EDITOR_BASE
///////////////////////////////////////////////////////////////////////////////
class DialogLabelEditor_Base : public DIALOG_SHIM
class DIALOG_LABEL_EDITOR_BASE : public DIALOG_SHIM
{
private:
@ -63,8 +63,8 @@ class DialogLabelEditor_Base : public DIALOG_SHIM
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 );
~DialogLabelEditor_Base();
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 );
~DIALOG_LABEL_EDITOR_BASE();
};

View File

@ -37,6 +37,7 @@
#include <netlist.h>
#include <libeditframe.h>
#include <viewlib_frame.h>
#include <wildcards_and_files_ext.h>
#include <wx/tokenzr.h>
@ -288,7 +289,7 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
libpath = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog FilesDialog( this, _( "Library files:" ), libpath,
wxEmptyString, CompLibFileWildcard,
wxEmptyString, SchematicLibraryFileWildcard,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
if( FilesDialog.ShowModal() != wxID_OK )

View File

@ -43,6 +43,7 @@
#define PLOT_FRAME_REFERENCE_KEY wxT( "PlotFrameRef" )
#define PLOT_HPGL_ORIGIN_KEY wxT( "PlotHPGLOrg" )
#define PLOT_HPGL_PAPERSIZE_KEY wxT( "PlotHPGLPaperSize" )
#define PLOT_HPGL_PEN_SIZE_KEY wxT( "PlotHPGLPenSize" )
@ -95,6 +96,10 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
m_config->Read( PLOT_HPGL_PAPERSIZE_KEY, &m_HPGLPaperSizeSelect, 0 );
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
long plotfmt;
m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 );
@ -125,11 +130,11 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
// Set the default line width (pen width which should be used for
// items that do not have a pen size defined (like frame ref)
AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness );
PutValueInLocalUnits( *m_DefaultLineSizeCtrl, GetDefaultLineThickness() );
// Initialize HPGL specific widgets
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 );
// Hide/show widgets that are not always displayed:
@ -166,12 +171,11 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions()
m_config->Write( PLOT_HPGL_ORIGIN_KEY, GetPlotOriginCenter() );
m_HPGLPaperSizeSelect = m_HPGLPaperSizeOption->GetSelection();
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();
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl );
if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1;
SetDefaultLineThickness( ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl ) );
}
void DIALOG_PLOT_SCHEMATIC::OnPlotFormatSelection( wxCommandEvent& event )

View File

@ -51,6 +51,7 @@ private:
// Static to keep last option:
// use default size or force A or A4 size
int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
double m_HPGLPenSize; // for HPGL format only: pen size
public:
// / Constructors

View File

@ -420,7 +420,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
if( printReference )
parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness,
parent->TraceWorkSheet( dc, aScreen, GetDefaultLineThickness(),
IU_PER_MILS, parent->GetScreenDesc() );
g_DrawBgColor = bg_color;

View File

@ -102,7 +102,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
textItem->m_Bold = lastTextBold;
textItem->m_Italic = lastTextItalic;
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->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );

View File

@ -11,6 +11,7 @@
#include <general.h>
#include <class_library.h>
#include <wildcards_and_files_ext.h>
#include <html_messagebox.h>
@ -45,7 +46,7 @@ void SCH_EDIT_FRAME::LoadLibraries( void )
{
fn.Clear();
fn.SetName( m_componentLibFiles[ii] );
fn.SetExt( CompLibFileExtension );
fn.SetExt( SchematicLibraryFileExtension );
/* Skip if the file name is not valid.. */
if( !fn.IsOk() )

View File

@ -71,7 +71,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->Draw( m_canvas, DC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness, IU_PER_MILS,
TraceWorkSheet( DC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS,
GetScreenDesc() );
#ifdef USE_WX_OVERLAY

View File

@ -25,6 +25,7 @@
/**
* @file eeschema.cpp
* @brief the main file
*/
#include <fctsys.h>
@ -33,7 +34,6 @@
#include <confirm.h>
#include <gestfich.h>
#include <eda_dde.h>
#include <id.h>
#include <wxEeschemaStruct.h>
#include <eda_text.h>
@ -48,45 +48,11 @@
// Global variables
bool g_OptNetListUseNames; /* true to use names rather than net
* The numbers (PSPICE netlist only) */
wxSize g_RepeatStep;
int g_RepeatDeltaLabel;
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;
int g_DefaultBusWidth;
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 );
@ -135,8 +101,10 @@ bool EDA_APP::OnInit()
if( argc > 1 )
filename = argv[1];
// Init Eeschema
SeedLayers();
// Give a default colour for all layers
// (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
// command line

View File

@ -55,7 +55,66 @@
#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 )
{
@ -208,9 +267,9 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetUnits( units, g_UserUnit );
dlg.SetGridSizes( grid_list, GetScreen()->GetGridId() );
dlg.SetBusWidth( g_DefaultBusWidth );
dlg.SetLineWidth( g_DrawDefaultLineThickness );
dlg.SetTextSize( g_DefaultTextLabelSize );
dlg.SetBusWidth( GetDefaultBusThickness() );
dlg.SetLineWidth( GetDefaultLineThickness() );
dlg.SetTextSize( GetDefaultLabelSize() );
dlg.SetRepeatHorizontal( g_RepeatStep.x );
dlg.SetRepeatVertical( g_RepeatStep.y );
dlg.SetRepeatLabel( g_RepeatDeltaLabel );
@ -220,7 +279,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetEnableMiddleButtonPan( m_canvas->GetEnableMiddleButtonPan() );
dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() );
dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() );
dlg.SetEnableHVBusOrientation( g_HVLines );
dlg.SetEnableHVBusOrientation( GetForceHVLines() );
dlg.SetShowPageLimits( g_ShowPageLimits );
dlg.Layout();
dlg.Fit();
@ -242,9 +301,9 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
GetScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
g_DefaultBusWidth = dlg.GetBusWidth();
g_DrawDefaultLineThickness = dlg.GetLineWidth();
g_DefaultTextLabelSize = dlg.GetTextSize();
SetDefaultBusThickness( dlg.GetBusWidth() );
SetDefaultLineThickness( dlg.GetLineWidth() );
SetDefaultLabelSize( dlg.GetTextSize() );
g_RepeatStep.x = dlg.GetRepeatHorizontal();
g_RepeatStep.y = dlg.GetRepeatVertical();
g_RepeatDeltaLabel = dlg.GetRepeatLabel();
@ -254,7 +313,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
m_canvas->SetEnableMiddleButtonPan( dlg.GetEnableMiddleButtonPan() );
m_canvas->SetMiddleButtonPanLimited( dlg.GetMiddleButtonPanLimited() );
m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() );
g_HVLines = dlg.GetEnableHVBusOrientation();
SetForceHVLines( dlg.GetEnableHVBusOrientation() );
g_ShowPageLimits = dlg.GetShowPageLimits();
wxString templateFieldName;
@ -295,17 +354,6 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( wxT( "NetFmtName" ),
&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" ),
&g_RepeatStep.x,
0, -1000, +1000 ) );
@ -316,8 +364,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
&g_RepeatDeltaLabel,
1, -10, +10 ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "LabSize" ),
&g_DefaultTextLabelSize,
DEFAULT_SIZE_TEXT, 0,
&m_defaultLabelSize,
DEFAULT_SIZE_TEXT, 5,
1000 ) );
return m_projectFileParams;
@ -402,7 +450,6 @@ static const wxString ReplaceStringEntry( wxT( "LastReplaceString" ) );
static const wxString FindStringHistoryEntry( wxT( "FindStringHistoryList%d" ) );
static const wxString ReplaceStringHistoryEntry( wxT( "ReplaceStringHistoryList%d" ) );
static const wxString FieldNamesEntry( wxT( "FieldNames" ) );
static const wxString SpiceNetNamesEntry( wxT( "SpiceUseNetNames" ) );
static const wxString SimulatorCommandEntry( wxT( "SimCmdLine" ) );
@ -414,80 +461,80 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void )
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
(int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColWire" ),
&g_LayerDescr.LayerColor[LAYER_WIRE],
&s_layerColor[LAYER_WIRE],
GREEN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBus" ),
&g_LayerDescr.LayerColor[LAYER_BUS],
&s_layerColor[LAYER_BUS],
BLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorConn" ),
&g_LayerDescr.LayerColor[LAYER_JUNCTION],
&s_layerColor[LAYER_JUNCTION],
GREEN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLlab" ),
&g_LayerDescr.LayerColor[LAYER_LOCLABEL],
&s_layerColor[LAYER_LOCLABEL],
BLACK ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorHlab" ),
&g_LayerDescr.LayerColor[LAYER_HIERLABEL],
&s_layerColor[LAYER_HIERLABEL],
BROWN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGbllab" ),
&g_LayerDescr.LayerColor[LAYER_GLOBLABEL],
&s_layerColor[LAYER_GLOBLABEL],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinF" ),
&g_LayerDescr.LayerColor[LAYER_PINFUN],
&s_layerColor[LAYER_PINFUN],
MAGENTA ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColPinN" ),
&g_LayerDescr.LayerColor[LAYER_PINNUM],
&s_layerColor[LAYER_PINNUM],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPNam" ),
&g_LayerDescr.LayerColor[LAYER_PINNAM],
&s_layerColor[LAYER_PINNAM],
CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorField" ),
&g_LayerDescr.LayerColor[LAYER_FIELDS],
&s_layerColor[LAYER_FIELDS],
MAGENTA ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRef" ),
&g_LayerDescr.LayerColor[LAYER_REFERENCEPART],
&s_layerColor[LAYER_REFERENCEPART],
CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorValue" ),
&g_LayerDescr.LayerColor[LAYER_VALUEPART],
&s_layerColor[LAYER_VALUEPART],
CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNote" ),
&g_LayerDescr.LayerColor[LAYER_NOTES],
&s_layerColor[LAYER_NOTES],
LIGHTBLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBody" ),
&g_LayerDescr.LayerColor[LAYER_DEVICE],
&s_layerColor[LAYER_DEVICE],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBodyBg" ),
&g_LayerDescr.LayerColor[LAYER_DEVICE_BACKGROUND],
&s_layerColor[LAYER_DEVICE_BACKGROUND],
LIGHTYELLOW ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNetN" ),
&g_LayerDescr.LayerColor[LAYER_NETNAM],
&s_layerColor[LAYER_NETNAM],
DARKGRAY ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPin" ),
&g_LayerDescr.LayerColor[LAYER_PIN],
&s_layerColor[LAYER_PIN],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheet" ),
&g_LayerDescr.LayerColor[LAYER_SHEET],
&s_layerColor[LAYER_SHEET],
MAGENTA ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
wxT( "ColorSheetFileName" ),
&g_LayerDescr.LayerColor[LAYER_SHEETFILENAME],
&s_layerColor[LAYER_SHEETFILENAME],
BROWN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetName" ),
&g_LayerDescr.LayerColor[LAYER_SHEETNAME],
&s_layerColor[LAYER_SHEETNAME],
CYAN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetLab" ),
&g_LayerDescr.LayerColor[LAYER_SHEETLABEL],
&s_layerColor[LAYER_SHEETLABEL],
BROWN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNoCo" ),
&g_LayerDescr.LayerColor[LAYER_NOCONNECT],
&s_layerColor[LAYER_NOCONNECT],
BLUE ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcW" ),
&g_LayerDescr.LayerColor[LAYER_ERC_WARN],
&s_layerColor[LAYER_ERC_WARN],
GREEN ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ),
&g_LayerDescr.LayerColor[LAYER_ERC_ERR],
&s_layerColor[LAYER_ERC_ERR],
RED ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGrid" ),
&g_LayerDescr.LayerColor[LAYER_GRID],
&s_layerColor[LAYER_GRID],
DARKGRAY ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PrintMonochrome" ),
&m_printMonochrome, true ) );
@ -510,13 +557,13 @@ void SCH_EDIT_FRAME::LoadSettings()
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
// This is required until someone gets rid of the global variable g_LayerDescription().
m_GridColor = g_LayerDescr.LayerColor[LAYER_GRID];
// This is required until someone gets rid of the global variable s_layerColor.
m_GridColor = ReturnLayerColor( LAYER_GRID );
g_DefaultBusWidth = cfg->Read( DefaultBusWidthEntry, (long) 8 );
g_DrawDefaultLineThickness = cfg->Read( DefaultDrawLineWidthEntry,(long) 6 );
SetDefaultBusThickness( cfg->Read( DefaultBusWidthEntry, 12l ) );
SetDefaultLineThickness( cfg->Read( DefaultDrawLineWidthEntry, 6l ) );
cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
cfg->Read( HorzVertLinesOnlyEntry, &m_forceHVLines, true );
// Load print preview window session settings.
cfg->Read( PreviewFramePositionXEntry, &tmp, -1 );
@ -539,7 +586,6 @@ void SCH_EDIT_FRAME::LoadSettings()
m_printDialogSize.SetHeight( (int) tmp );
// Load netlists options:
cfg->Read( SpiceNetNamesEntry, &g_OptNetListUseNames, false );
cfg->Read( SimulatorCommandEntry, &m_simulatorCommand );
// Load find dialog session setting.
@ -605,10 +651,10 @@ void SCH_EDIT_FRAME::SaveSettings()
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
cfg->Write( DefaultBusWidthEntry, (long) g_DefaultBusWidth );
cfg->Write( DefaultDrawLineWidthEntry, (long) g_DrawDefaultLineThickness );
cfg->Write( DefaultBusWidthEntry, (long) GetDefaultBusThickness() );
cfg->Write( DefaultDrawLineWidthEntry, (long) GetDefaultLineThickness() );
cfg->Write( ShowHiddenPinsEntry, m_showAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );
cfg->Write( HorzVertLinesOnlyEntry, GetForceHVLines() );
// Save print preview window session settings.
cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x );
@ -623,7 +669,6 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( PrintDialogHeightEntry, m_printDialogSize.GetHeight() );
// Save netlists options:
cfg->Write( SpiceNetNamesEntry, g_OptNetListUseNames );
cfg->Write( SimulatorCommandEntry, m_simulatorCommand );
// Save find dialog session setting.

View File

@ -8,11 +8,6 @@
#define GROUPCOMMON wxT( "/common" )
#define GROUPLIB wxT( "libraries" )
/**
* The width given to bus drawings that do not have a specific width
*/
extern int g_DefaultBusWidth;
/* saving parameters option : */
#define INSETUP true /* used when the parameter is saved in general config
* if not used, the parameter is saved in the local

View File

@ -51,6 +51,10 @@
enum id_eeschema_frm
{
ID_UPDATE_ONE_SHEET,
ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
ID_LOAD_ONE_SHEET,
/* Schematic editor horizontal toolbar IDs */
ID_HIERARCHY = ID_END_LIST,
ID_TO_LIBVIEW,

View File

@ -42,7 +42,7 @@
#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;
wxFileName schematicFileName, backupFileName;
@ -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( aScreen->GetFileName().IsEmpty() )
aSaveType = FILE_SAVE_NEW;
aSaveUnderNewName = true;
switch( aSaveType )
if( aSaveUnderNewName == false )
{
case FILE_SAVE_AS:
schematicFileName = aScreen->GetFileName();
// 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
/* Rename the old file to a '.bak' one: */
if( schematicFileName.FileExists() )
{
backupFileName.SetExt( g_SchematicBackupFileExtension );
backupFileName.SetExt( SchematicBackupFileExtension );
if( backupFileName.FileExists() )
wxRemoveFile( backupFileName.GetFullPath() );
@ -87,10 +86,8 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat
}
}
}
break;
case FILE_SAVE_NEW:
}
else
{
schematicFileName = aScreen->GetFileName();
@ -106,12 +103,6 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat
if( !IsWritable( schematicFileName ) )
return false;
break;
}
default:
break;
}
wxLogTrace( traceAutoSave,
@ -125,7 +116,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* aScreen, int aSaveType, bool aCreat
return false;
}
if( aSaveType == FILE_SAVE_NEW )
if( aSaveUnderNewName )
aScreen->SetFileName( schematicFileName.GetFullPath() );
bool success = aScreen->Save( f );
@ -169,16 +160,12 @@ void SCH_EDIT_FRAME::Save_File( wxCommandEvent& event )
switch( id )
{
case ID_SAVE_ONE_SHEET: /* Update Schematic File */
SaveEEFile( NULL, FILE_SAVE_AS );
case ID_UPDATE_ONE_SHEET:
SaveEEFile( NULL );
break;
case ID_SAVE_ONE_SHEET_AS: /* Save EED (new name) */
SaveEEFile( NULL, FILE_SAVE_NEW );
break;
default:
DisplayError( this, wxT( "SCH_EDIT_FRAME::Save_File Internal Error" ) );
case ID_SAVE_ONE_SHEET_UNDER_NEW_NAME:
SaveEEFile( NULL, true );
break;
}
}
@ -293,7 +280,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
wxString cachename = fn.GetName() + wxT( "-cache" );
fn.SetName( cachename );
fn.SetExt( CompLibFileExtension );
fn.SetExt( SchematicLibraryFileExtension );
if( ! fn.FileExists() )
{
@ -320,7 +307,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
if ( use_oldcachename ) // set the new name
{
fn.SetName( cachename );
fn.SetExt( CompLibFileExtension );
fn.SetExt( SchematicLibraryFileExtension );
LibCache->SetFileName( fn );
}
@ -380,13 +367,11 @@ void SCH_EDIT_FRAME::OnSaveProject( wxCommandEvent& aEvent )
return;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{
SaveEEFile( screen, FILE_SAVE_AS );
}
SaveEEFile( screen );
wxString cachename = fn.GetName() + wxT( "-cache" );
fn.SetName( cachename );
fn.SetExt( CompLibFileExtension );
fn.SetExt( SchematicLibraryFileExtension );
CreateArchiveLibrary( fn.GetFullPath() );
}
@ -417,14 +402,10 @@ bool SCH_EDIT_FRAME::doAutoSave()
screen->SetFileName( fn.GetFullPath() );
if( SaveEEFile( screen, FILE_SAVE_AS, NO_BACKUP_FILE ) )
{
if( SaveEEFile( screen, false, NO_BACKUP_FILE ) )
screen->SetModify();
}
else
{
autoSaveOk = false;
}
screen->SetFileName( tmpFileName.GetFullPath() );
}

View File

@ -11,37 +11,21 @@
#include <block_commande.h>
#include <class_netlist_object.h>
class SCH_ITEM;
class SCH_SHEET;
class TRANSFORM;
#define EESCHEMA_VERSION 2
#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 HIGHLIGHT_COLOR WHITE
//#define GR_DEFAULT_DRAWMODE GR_COPY
#define GR_DEFAULT_DRAWMODE GR_COPY
#define DANGLING_SYMBOL_SIZE 12
extern wxString g_DefaultSchematicFileName;
typedef enum
{
// this enum is for color management
typedef enum {
LAYER_WIRE,
LAYER_BUS,
LAYER_JUNCTION,
@ -67,99 +51,52 @@ typedef enum
LAYER_ERC_ERR,
LAYER_DEVICE_BACKGROUND,
LAYER_GRID,
LAYER_ITEM_SELECTED,
LAYER_INVISIBLE_ITEM,
MAX_LAYER /* Maximum layers */
MAX_LAYER // end of list
} LayerNumber;
typedef enum
{
FILE_SAVE_AS,
FILE_SAVE_NEW
} FileSaveType;
/* Rotation, mirror of graphic items in components bodies are handled by a
* transform matrix. The default matix is useful to draw lib entries with
* a defualt matix ( no rotation, no mirror but Y axis is bottom to top, and
* transform matrix. The default matrix is useful to draw lib entries with
* 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
* the Y coordinate and keeps the X coordiate
*/
extern TRANSFORM DefaultTransform;
#define MIN_BUSLINES_THICKNESS 12 // min bus lines and entries thickness
#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;
};
#define MAX_LAYERS (int) MAX_LAYER
extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel;
// Management options.
extern bool g_HVLines;
extern struct EESchemaVariables g_EESchemaVar;
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 */
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;
/// 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 thickness line value (i.e. = 0 ).
* 0 = single pixel line width.
*/
extern int g_DrawDefaultLineThickness;
/// Color to draw selected items
extern EDA_COLOR_T g_ItemSelectetColor;
/// Color to draw items flagged invisible, in libedit (they are invisible in Eeschema
extern EDA_COLOR_T g_InvisibleItemColor;
/* Global Variables */
extern NETLIST_OBJECT_LIST g_NetObjectslist;
extern bool g_OptNetListUseNames; /* true to use names rather than
* net numbers. SPICE netlist only
/**
* Default line thickness used to draw/plot items having a
* default thickness line value (i.e. = 0 ).
*/
int GetDefaultLineThickness();
void SetDefaultLineThickness( int aThickness);
/**
* Default line thickness used to draw/plot busses.
*/
int GetDefaultBusThickness();
void SetDefaultBusThickness( int aThickness );
EDA_COLOR_T ReturnLayerColor( int aLayer );
// Color to draw selected items
EDA_COLOR_T GetItemSelectedColor();
// Color to draw items flagged invisible, in libedit (they are invisible in Eeschema
EDA_COLOR_T GetInvisibleItemColor();
void SetLayerColor( EDA_COLOR_T aColor, int aLayer );
#endif // _GENERAL_H_

View File

@ -337,7 +337,7 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
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
if( aColor < 0 ) // Used normal color or selected color
{
if( IsSelected() )
color = g_ItemSelectetColor;
color = GetItemSelectedColor();
}
else
{

View File

@ -1,8 +1,7 @@
/*
* 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-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
* 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,
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&
if( aColor < 0 ) // Used normal color or selected color
{
if( IsSelected() )
color = g_ItemSelectetColor;
color = GetItemSelectedColor();
}
else
{

View File

@ -1,8 +1,8 @@
/*
* 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-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* 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,
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&
if( aColor < 0 ) // Used normal color or selected color
{
if( IsSelected() )
color = g_ItemSelectetColor;
color = GetItemSelectedColor();
}
else
{

View File

@ -30,17 +30,13 @@
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <gestfich.h>
#include <eeschema_id.h>
#include <richio.h>
#include <general.h>
#include <protos.h>
#include <libeditframe.h>
#include <class_library.h>
#include <wildcards_and_files_ext.h>
#include <wx/filename.h>
#include <wx/wfstream.h>
@ -59,7 +55,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
m_lastDrawItem = NULL;
wxFileDialog dlg( this, _( "Import Component" ), m_lastLibImportPath,
wxEmptyString, CompLibFileWildcard,
wxEmptyString, SchematicLibraryFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
@ -110,12 +106,12 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
}
fn = m_component->GetName().Lower();
fn.SetExt( CompLibFileExtension );
fn.SetExt( SchematicLibraryFileExtension );
title = createLib ? _( "New Library" ) : _( "Export Component" );
wxFileDialog dlg( this, title, wxGetCwd(), fn.GetFullName(),
CompLibFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
SchematicLibraryFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;

View File

@ -1,8 +1,8 @@
/*
* 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-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -255,7 +255,7 @@ bool LIB_FIELD::Load( LINE_READER& aLineReader, wxString& errorMsg )
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
if( ( m_Attributs & TEXT_NO_VISIBLE ) && ( aColor < 0 ) )
{
color = g_InvisibleItemColor;
color = GetInvisibleItemColor();
}
else if( IsSelected() && ( aColor < 0 ) )
{
color = g_ItemSelectetColor;
color = GetItemSelectedColor();
}
else
{

View File

@ -1,8 +1,8 @@
/*
* 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) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -782,7 +782,7 @@ bool LIB_PIN::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
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,
const TRANSFORM& aTransform )
{
// 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 other windows, they are always drawn because we must see them.
if( ! IsVisible() )
@ -809,7 +809,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
return;
aColor = g_InvisibleItemColor;
aColor = GetInvisibleItemColor();
}
LIB_COMPONENT* Entry = GetParent();
@ -866,7 +866,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
if( aColor < 0 ) // Used normal color or selected color
{
if( IsSelected() )
color = g_ItemSelectetColor;
color = GetItemSelectedColor();
}
else
color = aColor;
@ -1088,7 +1088,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
/* Get the num and name colors */
if( (Color < 0) && IsSelected() )
Color = g_ItemSelectetColor;
Color = GetItemSelectedColor();
NameColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color );
NumColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color );

View File

@ -1,7 +1,7 @@
/*
* 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.
*
* This program is free software; you can redistribute it and/or
@ -260,7 +260,7 @@ void LIB_POLYLINE::AddPoint( const wxPoint& point )
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
if( aColor < 0 ) // Used normal color or selected color
{
if( IsSelected() )
color = g_ItemSelectetColor;
color = GetItemSelectedColor();
}
else
{

View File

@ -1,8 +1,8 @@
/*
* 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-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* 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,
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,
if( aColor < 0 ) // Used normal color or selected color
{
if( IsSelected() )
color = g_ItemSelectetColor;
color = GetItemSelectedColor();
}
else
{

View File

@ -1,8 +1,7 @@
/*
* 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-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
* modify it under the terms of the GNU General Public License
@ -334,7 +333,7 @@ int LIB_TEXT::GetPenSize() const
if( m_Bold )
pensize = GetPenSizeForBold( m_Size.x );
else
pensize = g_DrawDefaultLineThickness;
pensize = GetDefaultLineThickness();
}
// Clip pen size for small texts:
@ -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( IsSelected() )
color = g_ItemSelectetColor;
color = GetItemSelectedColor();
}
else
{

View File

@ -43,6 +43,7 @@
#include <libeditframe.h>
#include <class_library.h>
#include <template_fieldnames.h>
#include <wildcards_and_files_ext.h>
#include <dialogs/dialog_lib_new_component.h>
@ -309,7 +310,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
{ // Get a new name for the library
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog dlg( this, _( "Component Library Name:" ), default_path,
wxEmptyString, CompLibFileWildcard,
wxEmptyString, SchematicLibraryFileExtension,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
@ -320,7 +321,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
/* The GTK file chooser doesn't return the file extension added to
* file name so add it here. */
if( fn.GetExt().IsEmpty() )
fn.SetExt( CompLibFileExtension );
fn.SetExt( SchematicLibraryFileExtension );
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
}

View File

@ -35,7 +35,7 @@
#include <richio.h>
#include <general.h>
#include <protos.h>
//#include <protos.h>
#include <sch_bus_entry.h>
#include <sch_marker.h>
#include <sch_junction.h>
@ -46,6 +46,7 @@
#include <sch_text.h>
#include <sch_sheet.h>
#include <sch_bitmap.h>
#include <wildcards_and_files_ext.h>
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* Window );
@ -55,10 +56,10 @@ static void LoadLayers( LINE_READER* aLine );
bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName )
{
char Name1[256];
char name1[256];
bool itemLoaded = false;
SCH_ITEM* item;
wxString MsgDiag; // Error and log messages
wxString msgDiag; // Error and log messages
char* line;
wxFileName fn;
@ -69,7 +70,7 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
return false;
fn = aFullFileName;
CheckForAutoSaveFile( fn, g_SchematicBackupFileExtension );
CheckForAutoSaveFile( fn, SchematicBackupFileExtension );
wxLogTrace( traceAutoSave, wxT( "Loading schematic file " ) + aFullFileName );
@ -80,23 +81,23 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
if( ( f = wxFopen( aFullFileName, wxT( "rt" ) ) ) == NULL )
{
MsgDiag = _( "Failed to open " ) + aFullFileName;
DisplayError( this, MsgDiag );
msgDiag = _( "Failed to open " ) + aFullFileName;
DisplayError( this, msgDiag );
return false;
}
// reader now owns the open FILE.
FILE_LINE_READER reader( f, aFullFileName );
MsgDiag = _( "Loading " ) + aScreen->GetFileName();
PrintMsg( MsgDiag );
msgDiag = _( "Loading " ) + aScreen->GetFileName();
PrintMsg( msgDiag );
if( !reader.ReadLine()
|| strncmp( (char*)reader + 9, SCHEMATIC_HEAD_STRING,
sizeof( SCHEMATIC_HEAD_STRING ) - 1 ) != 0 )
{
MsgDiag = aFullFileName + _( " is NOT an Eeschema file!" );
DisplayError( this, MsgDiag );
msgDiag = aFullFileName + _( " is NOT an Eeschema file!" );
DisplayError( this, msgDiag );
return false;
}
@ -113,9 +114,9 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
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!" );
DisplayInfoMessage( this, MsgDiag );
DisplayInfoMessage( this, msgDiag );
}
#if 0
@ -132,8 +133,8 @@ again." );
if( !reader.ReadLine() || strncmp( reader, "LIBS:", 5 ) != 0 )
{
MsgDiag = aFullFileName + _( " is NOT an Eeschema file!" );
DisplayError( this, MsgDiag );
msgDiag = aFullFileName + _( " is NOT an Eeschema file!" );
DisplayError( this, msgDiag );
return false;
}
@ -158,7 +159,7 @@ again." );
else if( line[1] == 'S' )
item = new SCH_SHEET();
else if( line[1] == 'D' )
itemLoaded = ReadSchemaDescr( &reader, MsgDiag, aScreen );
itemLoaded = ReadSchemaDescr( &reader, msgDiag, aScreen );
else if( line[1] == 'B' )
item = new SCH_BITMAP();
break;
@ -193,17 +194,17 @@ again." );
break;
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() );
itemLoaded = false;
}
else if( Name1[0] == 'L' )
else if( name1[0] == 'L' )
item = new SCH_LABEL();
else if( Name1[0] == 'G' && version > 1 )
else if( name1[0] == 'G' && version > 1 )
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();
else
item = new SCH_TEXT();
@ -211,14 +212,14 @@ again." );
default:
itemLoaded = false;
MsgDiag.Printf( _( "Eeschema file undefined object at line %d, aborted" ),
msgDiag.Printf( _( "Eeschema file undefined object at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << FROM_UTF8( line );
msgDiag << wxT( "\n" ) << FROM_UTF8( line );
}
if( item )
{
itemLoaded = item->Load( reader, MsgDiag );
itemLoaded = item->Load( reader, msgDiag );
if( !itemLoaded )
{
@ -232,7 +233,7 @@ again." );
if( !itemLoaded )
{
DisplayError( this, MsgDiag );
DisplayError( this, msgDiag );
break;
}
}
@ -243,8 +244,8 @@ again." );
aScreen->TestDanglingEnds();
MsgDiag = _( "Done Loading " ) + aScreen->GetFileName();
PrintMsg( MsgDiag );
msgDiag = _( "Done Loading " ) + aScreen->GetFileName();
PrintMsg( msgDiag );
return true; // Although it may be that file is only partially loaded.
}
@ -252,28 +253,12 @@ again." );
static void LoadLayers( LINE_READER* aLine )
{
int Number;
//int Mode,Color,Layer;
char Name[256];
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;
/* read the layer descr
* legacy code, not actually used, so this section is just skipped
* read lines like
* EELAYER 25 0
* EELAYER END
*/
while( aLine->ReadLine() )
{

View File

@ -110,14 +110,14 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Save current sheet
AddMenuItem( fileMenu,
ID_SAVE_ONE_SHEET,
ID_UPDATE_ONE_SHEET,
_( "Save &Current Sheet Only" ),
_( "Save only current schematic sheet" ),
KiBitmap( save_xpm ) );
// Save current sheet as
AddMenuItem( fileMenu,
ID_SAVE_ONE_SHEET_AS,
ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
_( "Save Current Sheet &As" ),
_( "Save current schematic sheet as..." ),
KiBitmap( save_as_xpm ) );

View File

@ -71,6 +71,7 @@ int TestDuplicateSheetNames( bool aCreateMarker );
#define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" )
#define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" )
#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,
m_AddSubPrefix = NULL;
m_ButtonCancel = NULL;
m_NetOption = NULL;
wxString netfmtName = ((NETLIST_DIALOG*)parent->GetParent())->m_NetFmtName;
int fmtOption = 0;
@ -177,11 +179,12 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
NETLIST_DIALOG_BASE( parent )
{
m_Parent = parent;
m_Config = wxGetApp().GetSettings();
m_config = wxGetApp().GetSettings();
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_config->Read( NETLIST_PSPICE_USE_NETNAME, &m_spiceNetlistUseNames, true );
m_NetFmtName = m_Parent->GetNetListFormatName();
@ -241,7 +244,7 @@ const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item )
msg = CUSTOM_NETLIST_TITLE;
msg << index + 1;
name = m_Config->Read( msg );
name = m_config->Read( msg );
return name;
}
@ -268,7 +271,7 @@ void NETLIST_DIALOG::InstallPageSpice()
2, netlist_opt, 1,
wxRA_SPECIFY_COLS );
if( !g_OptNetListUseNames )
if( !m_spiceNetlistUseNames )
page->m_NetOption->SetSelection( 1 );
page->m_LeftBoxSizer->Add( page->m_NetOption, 0, wxGROW | wxALL, 5 );
@ -309,7 +312,7 @@ void NETLIST_DIALOG::InstallCustomPages()
// Install a plugin panel
msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1;
wxString command = m_Config->Read( msg );
wxString command = m_config->Read( msg );
currPage = AddOneCustomPage( title, command,
(NETLIST_TYPE_ID)(NET_TYPE_CUSTOM1 + ii) );
@ -432,10 +435,10 @@ void NETLIST_DIALOG::NetlistUpdateOpt()
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 )
g_OptNetListUseNames = false;
m_spiceNetlistUseNames = false;
}
@ -468,7 +471,7 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
{
case NET_TYPE_SPICE:
// Set spice netlist options:
if( g_OptNetListUseNames )
if( m_spiceNetlistUseNames )
netlist_opt |= NET_USE_NETNAMES;
if( currPage->m_AddSubPrefix->GetValue() )
netlist_opt |= NET_USE_X_PREFIX;
@ -640,12 +643,12 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
NETLIST_PAGE_DIALOG* currPage;
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:
unsigned netlist_opt = 0;
if( g_OptNetListUseNames )
if( m_spiceNetlistUseNames )
netlist_opt |= NET_USE_NETNAMES;
if( currPage->m_AddSubPrefix && currPage->m_AddSubPrefix->GetValue() )
netlist_opt |= NET_USE_X_PREFIX;
@ -668,7 +671,8 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
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
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
@ -690,7 +694,7 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
{
msg = CUSTOM_NETLIST_TITLE;
msg << ii + 1;
m_Config->Write( msg, title );
m_config->Write( msg, title );
}
}
@ -699,7 +703,7 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
Command = currPage->m_CommandStringCtrl->GetValue();
msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1;
m_Config->Write( msg, Command );
m_config->Write( msg, Command );
}
}
}

View File

@ -123,7 +123,9 @@ public:
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
private:
wxConfig* m_Config;
wxConfig* m_config;
bool m_spiceNetlistUseNames; /* true to use names rather than net
* numbers (PSPICE netlist only) */
public:

View File

@ -98,13 +98,13 @@ static const wxChar* plot_sheet_list( int aSize )
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 ) )
g_HPGL_Pen_Descr.m_Pen_Diam = Millimeter2iu( 2 );
if( m_HPGLPenSize > Millimeter2iu( 2 ) )
m_HPGLPenSize = Millimeter2iu( 2 );
if( g_HPGL_Pen_Descr.m_Pen_Diam < Millimeter2iu( 0.01 ) )
g_HPGL_Pen_Descr.m_Pen_Diam = Millimeter2iu( 0.01 );
if( m_HPGLPenSize < Millimeter2iu( 0.01 ) )
m_HPGLPenSize = Millimeter2iu( 0.01 );
}
@ -220,10 +220,10 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
// Init :
plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
plotter->SetFilename( aFileName );
plotter->SetPenSpeed( g_HPGL_Pen_Descr.m_Pen_Speed );
plotter->SetPenNumber( g_HPGL_Pen_Descr.m_Pen_Num );
plotter->SetPenDiameter( g_HPGL_Pen_Descr.m_Pen_Diam );
plotter->SetPenOverlap( g_HPGL_Pen_Descr.m_Pen_Diam / 2 );
// Pen num and pen speed are not initialized here.
// Default HPGL driver values are used
plotter->SetPenDiameter( m_HPGLPenSize );
plotter->SetPenOverlap( m_HPGLPenSize / 4 );
plotter->StartPlot( output_file );
plotter->SetColor( BLACK );

View File

@ -54,7 +54,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
// Allocate the plotter and set the job level parameter
PDF_PLOTTER* plotter = new PDF_PLOTTER();
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetColorMode( getModeColor() );
plotter->SetCreator( wxT( "Eeschema-PDF" ) );

View File

@ -140,7 +140,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
SetLocaleTo_C_standard();
PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->SetPageSettings( aPageInfo );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetColorMode( getModeColor() );
plotter->SetViewport( aPlot0ffset, IU_PER_DECIMILS, aScale, false );

View File

@ -131,7 +131,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame,
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
plotter->SetPageSettings( pageInfo );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetColorMode( aPlotBlackAndWhite ? false : true );
wxPoint plot_offset;
double scale = 1.0;

View File

@ -157,7 +157,7 @@ EDA_RECT SCH_BUS_ENTRY::GetBoundingBox() const
box.SetEnd( m_End() );
box.Normalize();
int width = ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width;
int width = ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
box.Inflate( width / 2 );
return box;
@ -166,11 +166,11 @@ EDA_RECT SCH_BUS_ENTRY::GetBoundingBox() 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 )
{
pensize = ( m_width == 0 ) ? g_DefaultBusWidth : m_width;
pensize = ( m_width == 0 ) ? GetDefaultBusThickness() : m_width;
}
return pensize;

View File

@ -51,6 +51,7 @@
#include <wx/tokenzr.h>
#define NULL_STRING "_NONAME_"
static LIB_COMPONENT* DummyCmp;

View File

@ -120,7 +120,7 @@ int SCH_FIELD::GetPenSize() const
if( m_Bold )
pensize = GetPenSizeForBold( m_Size.x );
else
pensize = g_DrawDefaultLineThickness;
pensize = GetDefaultLineThickness();
}
// Clip pen size for small texts:
@ -143,7 +143,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
if( m_Bold )
LineWidth = GetPenSizeForBold( m_Size.x );
else
LineWidth = g_DrawDefaultLineThickness;
LineWidth = GetDefaultLineThickness();
}
@ -261,7 +261,7 @@ void SCH_FIELD::SwapData( SCH_ITEM* aItem )
EDA_RECT SCH_FIELD::GetBoundingBox() const
{
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
// when calculating the bounding box

View File

@ -210,11 +210,11 @@ bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
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 )
{
pensize = ( m_width == 0 ) ? g_DefaultBusWidth : m_width;
pensize = ( m_width == 0 ) ? GetDefaultBusThickness() : m_width;
}
return pensize;

View File

@ -105,14 +105,13 @@ bool SCH_MARKER::Save( FILE* aFile ) const
void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
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;
if( GetMarkerType() == MARK_ERC )
{
color = ( GetErrorLevel() == WAR ) ?
(EDA_COLOR_T) g_LayerDescr.LayerColor[LAYER_ERC_WARN] :
(EDA_COLOR_T) g_LayerDescr.LayerColor[LAYER_ERC_ERR];
color = ( GetErrorLevel() == WAR ) ? ReturnLayerColor( LAYER_ERC_WARN ) :
ReturnLayerColor( LAYER_ERC_ERR );
}
if( aColor < 0 )

View File

@ -118,7 +118,7 @@ bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg )
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
{
int pX, pY;
int delta = m_size.x / 2;
int width = g_DrawDefaultLineThickness;
int width = GetDefaultLineThickness();
pX = m_pos.x + aOffset.x;
pY = m_pos.y + aOffset.y;
@ -210,7 +210,7 @@ bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) 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;

View File

@ -149,7 +149,7 @@ bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
int SCH_POLYLINE::GetPenSize() const
{
int pensize = ( m_width == 0 ) ? g_DrawDefaultLineThickness : m_width;
int pensize = ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
return pensize;
}

View File

@ -53,6 +53,7 @@
#include <boost/foreach.hpp>
#define EESCHEMA_FILE_STAMP "EESchema"
/* Default Eeschema zoom values. Limited to 17 values to keep a decent size
* to menus
@ -393,10 +394,10 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
break;
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;
if( GetItem( aPosition, std::max( g_DrawDefaultLineThickness, 3 ), SCH_JUNCTION_T ) )
if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_JUNCTION_T ) )
return true;
if( GetPin( aPosition, NULL, true ) )
@ -503,8 +504,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
return false;
}
if( fprintf( aFile, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers,
g_LayerDescr.CurrentLayer ) < 0
// This section is not used, but written for file compatibility
if( fprintf( aFile, "EELAYER %d %d\n", MAX_LAYERS, 0 ) < 0
|| fprintf( aFile, "EELAYER END\n" ) < 0 )
return false;

View File

@ -1,7 +1,7 @@
/*
* 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.
*
* This program is free software; you can redistribute it and/or
@ -524,7 +524,7 @@ SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition )
int SCH_SHEET::GetPenSize() const
{
return g_DrawDefaultLineThickness;
return GetDefaultLineThickness();
}
@ -1146,7 +1146,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
size = wxSize( m_sheetNameSize, m_sheetNameSize );
//pos = m_pos; pos.y -= 4;
thickness = g_DrawDefaultLineThickness;
thickness = GetDefaultLineThickness();
thickness = Clamp_Text_PenSize( thickness, size, false );
aPlotter->SetColor( ReturnLayerColor( LAYER_SHEETNAME ) );
@ -1159,7 +1159,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
/*Draw texts : FileName */
Text = GetFileName();
size = wxSize( m_fileNameSize, m_fileNameSize );
thickness = g_DrawDefaultLineThickness;
thickness = GetDefaultLineThickness();
thickness = Clamp_Text_PenSize( thickness, size, false );
aPlotter->SetColor( ReturnLayerColor( LAYER_SHEETFILENAME ) );

View File

@ -105,7 +105,7 @@ bool SCH_SHEET_PIN::operator==( const SCH_SHEET_PIN* aPin ) const
int SCH_SHEET_PIN::GetPenSize() const
{
return g_DrawDefaultLineThickness;
return GetDefaultLineThickness();
}

View File

@ -1,7 +1,7 @@
/*
* 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.
*
* This program is free software; you can redistribute it and/or
@ -361,7 +361,7 @@ int SCH_TEXT::GetPenSize() const
if( m_Bold )
pensize = GetPenSizeForBold( m_Size.x );
else
pensize = g_DrawDefaultLineThickness;
pensize = GetDefaultLineThickness();
}
// Clip pen size for small texts:
@ -374,7 +374,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
GR_DRAWMODE DrawMode, 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 );
@ -609,7 +609,7 @@ EDA_RECT SCH_TEXT::GetBoundingBox() const
{
// We must pass the effective text thickness to GetTextBox
// 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 );
@ -893,7 +893,7 @@ EDA_RECT SCH_LABEL::GetBoundingBox() const
x = m_Pos.x;
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 );
height = m_Size.y + width;
dx = dy = 0;
@ -1109,7 +1109,7 @@ void SCH_GLOBALLABEL::Rotate( wxPoint aPosition )
wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
{
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 );
int HalfSize = m_Size.x / 2;
@ -1206,7 +1206,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
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 );
EXCHG( linewidth, m_Thickness ); // Set the minimum width
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
@ -1231,7 +1231,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& Pos )
{
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 );
@ -1327,7 +1327,7 @@ EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
y = m_Pos.y;
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;
// text X size add height for triangular shapes(bidirectional)
@ -1533,7 +1533,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
{
static std::vector <wxPoint> Poly;
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 );
@ -1596,7 +1596,7 @@ EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
y = m_Pos.y;
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;
length = LenSize( m_Text )
+ height // add height for triangular shapes
@ -1643,7 +1643,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const
{
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;

View File

@ -79,8 +79,8 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_LOAD_PROJECT, SCH_EDIT_FRAME::OnLoadProject )
EVT_MENU( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnSaveProject )
EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File )
EVT_MENU( ID_UPDATE_ONE_SHEET, 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_COPY_SHEET_TO_CLIPBOARD, EDA_DRAW_FRAME::CopyToClipboard )
EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
@ -198,6 +198,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle,
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
m_undoItem = NULL;
m_hasAutoSave = true;
SetForceHVLines( true );
SetDefaultLabelSize( DEFAULT_SIZE_TEXT );
CreateScreens();
@ -582,11 +584,11 @@ void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
{
wxString tool_tip = g_HVLines ?
wxString tool_tip = GetForceHVLines() ?
_( "Draw wires and buses in any direction" ) :
_( "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 );
}
@ -851,7 +853,7 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData )
{
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness, IU_PER_MILS,
TraceWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS,
GetScreenDesc() );
}

View File

@ -169,7 +169,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( renameFile )
{
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
// screen and reload the file to a new screen. Failure to do this will trash

View File

@ -30,18 +30,16 @@
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <macros.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <kicad_string.h>
#include <gestfich.h>
#include <class_sch_screen.h>
#include <richio.h>
#include <general.h>
#include <protos.h>
#include <libeditframe.h>
#include <class_library.h>
#include <wildcards_and_files_ext.h>
#include <boost/foreach.hpp>
#include <wx/wfstream.h>
@ -62,7 +60,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path,
wxEmptyString, SymbolFileWildcard,
wxEmptyString, SchematicSymbolFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
@ -142,7 +140,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
m_component->GetName(), SymbolFileWildcard,
m_component->GetName(), SchematicSymbolFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
@ -153,7 +151,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
/* The GTK file chooser doesn't return the file extension added to
* file name so add it here. */
if( fn.GetExt().IsEmpty() )
fn.SetExt( SymbolFileExtension );
fn.SetExt( SchematicSymbolFileExtension );
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );

View File

@ -306,7 +306,6 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
// set icon paddings
m_optionsToolBar->SetToolBorderPadding(2); // padding
m_optionsToolBar->SetToolSeparation(0);
//m_optionsToolBar->SetMargins(4,0); // margins width and height
m_optionsToolBar->Realize();
}
@ -327,7 +326,7 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_BUS_WIRES_ORIENT:
g_HVLines = m_optionsToolBar->GetToolToggled( id );
SetForceHVLines( m_optionsToolBar->GetToolToggled( id ) );
break;
default:

View File

@ -47,12 +47,9 @@ enum main_id
ID_TO_PCB = wxID_HIGHEST,
ID_TO_CVPCB,
ID_LOAD_PROJECT,
ID_LOAD_ONE_SHEET,
ID_NEW_PROJECT,
ID_SAVE_PROJECT,
ID_SAVE_PROJECT_AS,
ID_SAVE_ONE_SHEET,
ID_SAVE_ONE_SHEET_AS,
ID_LOAD_FILE,
ID_APPEND_FILE,
ID_NEW_BOARD,

View File

@ -17,6 +17,7 @@ enum PAD_SHAPE_T
PAD_RECT,
PAD_OVAL,
PAD_TRAPEZOID,
PAD_OCTAGON // Provided, but not existing in Pcbnew. waiting for a volunteer
};

View File

@ -344,9 +344,7 @@ protected:
class HPGL_PLOTTER : public PLOTTER
{
public:
HPGL_PLOTTER()
{
}
HPGL_PLOTTER();
virtual PlotFormat GetPlotterType() const
{
@ -375,25 +373,21 @@ public:
virtual void SetPenSpeed( int speed )
{
wxASSERT( outputFile == 0 );
penSpeed = speed;
}
virtual void SetPenNumber( int number )
{
wxASSERT( outputFile == 0 );
penNumber = number;
}
virtual void SetPenDiameter( double diameter )
{
wxASSERT( outputFile == 0 );
penDiameter = diameter;
}
virtual void SetPenOverlap( double overlap )
{
wxASSERT( outputFile == 0 );
penOverlap = overlap;
}

View File

@ -41,6 +41,11 @@
* that they cannot be changed.
* 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 ProjectFileExtension;
extern const wxString SchematicFileExtension;
@ -57,6 +62,8 @@ extern const wxString ReportFileExtension;
extern const wxString FootprintPlaceFileExtension;
/// Proper wxFileDialog wild card definitions.
extern const wxString SchematicSymbolFileWildcard;
extern const wxString SchematicLibraryFileWildcard;
extern const wxString ProjectFileWildcard;
extern const wxString SchematicFileWildcard;
extern const wxString BoardFileWildcard;

View File

@ -142,6 +142,10 @@ private:
wxString m_netListerCommand; ///< Command line to call a custom net list
///< 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.
int m_foundItemIndex;
@ -199,6 +203,12 @@ public:
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; }
void SetShowAllPins( bool aEnable ) { m_showAllPins = aEnable; }
@ -658,14 +668,16 @@ public:
*
* @param aScreen A pointer to the SCH_SCREEN object to save. A NULL pointer saves
* 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
* 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.
* @return True if the file has been saved.
*/
bool SaveEEFile( SCH_SCREEN* aScreen,
int aSaveType,
bool aSaveUnderNewName = false,
bool aCreateBackupFile = CREATE_BACKUP_FILE );
// General search: