diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index 2edfc16e9d..94414e97da 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -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 diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp index 17a9ae92b2..057cbf0b70 100644 --- a/common/common_plotHPGL_functions.cpp +++ b/common/common_plotHPGL_functions.cpp @@ -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 ) diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp index d26876b83b..1076d9de55 100644 --- a/common/wildcards_and_files_ext.cpp +++ b/common/wildcards_and_files_ext.cpp @@ -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" ) ); diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 8d79ffad50..6cc039235e 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -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 ) ) diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 01e00fe734..6c67ad9f98 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -52,7 +52,6 @@ #include - // Set this to 1 to print debugging output in alias and component destructors to verify // objects get cleaned up properly. #if defined( TRACE_DESTRUCTOR ) diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 85b5f609d7..00b611d751 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -46,7 +46,6 @@ #include #include - 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; diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/dialogs/dialog_color_config.cpp index b87f9f17c5..92b5e0b9d1 100644 --- a/eeschema/dialogs/dialog_color_config.cpp +++ b/eeschema/dialogs/dialog_color_config.cpp @@ -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; -} diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index 6c21700fa7..1e5a2f7fcd 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -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(); diff --git a/eeschema/dialogs/dialog_edit_label_base.cpp b/eeschema/dialogs/dialog_edit_label_base.cpp index 8c0c44be75..2879a09720 100644 --- a/eeschema/dialogs/dialog_edit_label_base.cpp +++ b/eeschema/dialogs/dialog_edit_label_base.cpp @@ -1,118 +1,118 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 19 2012) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#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 ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bMainSizer; - bMainSizer = new wxBoxSizer( wxVERTICAL ); - - m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 ); - m_textControlSizer->AddGrowableCol( 1 ); - m_textControlSizer->AddGrowableRow( 0 ); - m_textControlSizer->SetFlexibleDirection( wxBOTH ); - m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Text:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->Wrap( -1 ); - m_staticText1->SetToolTip( _("Enter the text to be used within the schematic") ); - - m_textControlSizer->Add( m_staticText1, 0, wxRIGHT, 3 ); - - wxBoxSizer* bSizeText; - bSizeText = new wxBoxSizer( wxVERTICAL ); - - m_textLabelSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); - 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->SetMinSize( wxSize( -1,60 ) ); - - bSizeText->Add( m_textLabelMultiLine, 1, wxEXPAND|wxLEFT, 3 ); - - - m_textControlSizer->Add( bSizeText, 1, wxEXPAND, 3 ); - - m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_SizeTitle->Wrap( -1 ); - m_textControlSizer->Add( m_SizeTitle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); - - wxBoxSizer* bSizeCtrlSizer; - bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL ); - - m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - 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->Wrap( -1 ); - bSizeCtrlSizer->Add( m_staticSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); - - - m_textControlSizer->Add( bSizeCtrlSizer, 1, wxEXPAND, 3 ); - - - bMainSizer->Add( m_textControlSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 ); - - wxBoxSizer* m_OptionsSizer; - m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxString m_TextOrientChoices[] = { _("Right"), _("Up"), _("Left"), _("Down") }; - 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->SetSelection( 0 ); - m_OptionsSizer->Add( m_TextOrient, 1, wxRIGHT|wxTOP, 3 ); - - wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; - 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->SetSelection( 0 ); - m_OptionsSizer->Add( m_TextStyle, 1, wxLEFT|wxRIGHT|wxTOP, 3 ); - - wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidirectional"), _("Tri-State"), _("Passive") }; - 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->SetSelection( 0 ); - m_OptionsSizer->Add( m_TextShape, 1, wxALL|wxLEFT|wxTOP, 3 ); - - - bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 ); - - m_sdbSizer1 = new wxStdDialogButtonSizer(); - m_sdbSizer1OK = new wxButton( this, wxID_OK ); - m_sdbSizer1->AddButton( m_sdbSizer1OK ); - m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); - m_sdbSizer1->Realize(); - - bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 ); - - - this->SetSizer( bMainSizer ); - this->Layout(); - 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 ); -} - -DialogLabelEditor_Base::~DialogLabelEditor_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 ); - -} +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 10 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_edit_label_base.h" + +/////////////////////////////////////////////////////////////////////////// + +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 ); + + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + m_textControlSizer = new wxFlexGridSizer( 2, 2, 3, 3 ); + m_textControlSizer->AddGrowableCol( 1 ); + m_textControlSizer->AddGrowableRow( 0 ); + m_textControlSizer->SetFlexibleDirection( wxBOTH ); + m_textControlSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Text:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + m_staticText1->SetToolTip( _("Enter the text to be used within the schematic") ); + + m_textControlSizer->Add( m_staticText1, 0, wxRIGHT, 3 ); + + wxBoxSizer* bSizeText; + bSizeText = new wxBoxSizer( wxVERTICAL ); + + m_textLabelSingleLine = new wxTextCtrl( this, wxID_VALUESINGLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); + 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->SetMinSize( wxSize( -1,60 ) ); + + bSizeText->Add( m_textLabelMultiLine, 1, wxEXPAND|wxLEFT, 3 ); + + + m_textControlSizer->Add( bSizeText, 1, wxEXPAND, 3 ); + + m_SizeTitle = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_SizeTitle->Wrap( -1 ); + m_textControlSizer->Add( m_SizeTitle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); + + wxBoxSizer* bSizeCtrlSizer; + bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_TextSize = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + 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->Wrap( -1 ); + bSizeCtrlSizer->Add( m_staticSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); + + + m_textControlSizer->Add( bSizeCtrlSizer, 1, wxEXPAND, 3 ); + + + bMainSizer->Add( m_textControlSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 ); + + wxBoxSizer* m_OptionsSizer; + m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxString m_TextOrientChoices[] = { _("Right"), _("Up"), _("Left"), _("Down") }; + 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->SetSelection( 0 ); + m_OptionsSizer->Add( m_TextOrient, 1, wxRIGHT|wxTOP, 3 ); + + wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; + 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->SetSelection( 0 ); + m_OptionsSizer->Add( m_TextStyle, 1, wxLEFT|wxRIGHT|wxTOP, 3 ); + + wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidirectional"), _("Tri-State"), _("Passive") }; + 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->SetSelection( 0 ); + m_OptionsSizer->Add( m_TextShape, 1, wxALL|wxLEFT|wxTOP, 3 ); + + + bMainSizer->Add( m_OptionsSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 12 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + + bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + bMainSizer->Fit( this ); + + // Connect Events + 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 ); +} + +DIALOG_LABEL_EDITOR_BASE::~DIALOG_LABEL_EDITOR_BASE() +{ + // Disconnect Events + 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 ); + +} diff --git a/eeschema/dialogs/dialog_edit_label_base.fbp b/eeschema/dialogs/dialog_edit_label_base.fbp index 464b84e967..d58b1b116b 100644 --- a/eeschema/dialogs/dialog_edit_label_base.fbp +++ b/eeschema/dialogs/dialog_edit_label_base.fbp @@ -1,1012 +1,966 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_edit_label_base - 1000 - none - 1 - dialog_edit_label_base - - . - - 1 - 1 - 1 - 1 - 0 - - 1 - 1 - 1 - 1 - - 0 - - - - - - - 1 - - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - impl_virtual - - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - DialogLabelEditor_Base - 1 - - - 1 - - Resizable - 1 - -1,-1 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - Text Editor - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bMainSizer - wxVERTICAL - none - - 12 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 1 - - 2 - wxBOTH - 1 - 0 - 3 - - m_textControlSizer - wxFLEX_GROWMODE_SPECIFIED - protected - 2 - 3 - - 3 - wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Text: - - 0 - - - 0 - - 1 - m_staticText1 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Enter the text to be used within the schematic - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxEXPAND - 1 - - -1,-1 - bSizeText - wxVERTICAL - none - - 3 - wxEXPAND|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_VALUESINGLE - - 0 - - 0 - - 0 - - 1 - m_textLabelSingleLine - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_PROCESS_ENTER - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnEnterKey - - - - - - - 3 - wxEXPAND|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_VALUEMULTI - - 0 - - 0 - - 0 - -1,60 - 1 - m_textLabelMultiLine - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_MULTILINE|wxTE_PROCESS_ENTER - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnEnterKey - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Size: - - 0 - - - 0 - - 1 - m_SizeTitle - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxEXPAND - 1 - - - bSizeCtrlSizer - wxHORIZONTAL - none - - 3 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_SIZE - - 0 - - 0 - - 0 - - 1 - m_TextSize - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - units - - 0 - - - 0 - - 1 - m_staticSizeUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - - - m_OptionsSizer - wxHORIZONTAL - none - - 3 - wxRIGHT|wxTOP - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Right" "Up" "Left" "Down" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - O&rientation - 1 - - 0 - - - 0 - - 1 - m_TextOrient - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxLEFT|wxRIGHT|wxTOP - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Normal" "Italic" "Bold" "Bold Italic" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - St&yle - 1 - - 0 - - - 0 - - 1 - m_TextStyle - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALL|wxLEFT|wxTOP - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Input" "Output" "Bidirectional" "Tri-State" "Passive" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - S&hape - 1 - - 0 - - - 0 - - 1 - m_TextShape - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12 - wxALL|wxEXPAND - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer1 - protected - - OnCancelClick - - - - OnOkClick - - - - - - - - + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_edit_label_base + 1000 + none + 1 + dialog_edit_label_base + + . + + 1 + 1 + 1 + 1 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_LABEL_EDITOR_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Text Editor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bMainSizer + wxVERTICAL + none + + 12 + wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 1 + + 2 + wxBOTH + 1 + 0 + 3 + + m_textControlSizer + wxFLEX_GROWMODE_SPECIFIED + protected + 2 + 3 + + 3 + wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + &Text: + + 0 + + + 0 + + 1 + m_staticText1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Enter the text to be used within the schematic + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxEXPAND + 1 + + -1,-1 + bSizeText + wxVERTICAL + none + + 3 + wxEXPAND|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_VALUESINGLE + + 0 + + 0 + + 0 + + 1 + m_textLabelSingleLine + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_PROCESS_ENTER + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnEnterKey + + + + + + + 3 + wxEXPAND|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_VALUEMULTI + + 0 + + 0 + + 0 + -1,60 + 1 + m_textLabelMultiLine + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_MULTILINE|wxTE_PROCESS_ENTER + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnEnterKey + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + &Size: + + 0 + + + 0 + + 1 + m_SizeTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxEXPAND + 1 + + + bSizeCtrlSizer + wxHORIZONTAL + none + + 3 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_SIZE + + 0 + + 0 + + 0 + + 1 + m_TextSize + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + units + + 0 + + + 0 + + 1 + m_staticSizeUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 12 + wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + + m_OptionsSizer + wxHORIZONTAL + none + + 3 + wxRIGHT|wxTOP + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Right" "Up" "Left" "Down" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + O&rientation + 1 + + 0 + + + 0 + + 1 + m_TextOrient + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxLEFT|wxRIGHT|wxTOP + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Normal" "Italic" "Bold" "Bold Italic" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + St&yle + 1 + + 0 + + + 0 + + 1 + m_TextStyle + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxALL|wxLEFT|wxTOP + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Input" "Output" "Bidirectional" "Tri-State" "Passive" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + S&hape + 1 + + 0 + + + 0 + + 1 + m_TextShape + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 12 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + OnCancelClick + + + + OnOkClick + + + + + + + + diff --git a/eeschema/dialogs/dialog_edit_label_base.h b/eeschema/dialogs/dialog_edit_label_base.h index b9b1cebe27..28a4dffd58 100644 --- a/eeschema/dialogs/dialog_edit_label_base.h +++ b/eeschema/dialogs/dialog_edit_label_base.h @@ -1,71 +1,71 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 19 2012) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_EDIT_LABEL_BASE_H__ -#define __DIALOG_EDIT_LABEL_BASE_H__ - -#include -#include -#include -#include "dialog_shim.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -/// Class DialogLabelEditor_Base -/////////////////////////////////////////////////////////////////////////////// -class DialogLabelEditor_Base : public DIALOG_SHIM -{ - private: - - protected: - enum - { - wxID_VALUESINGLE = 1000, - wxID_VALUEMULTI, - wxID_SIZE - }; - - wxFlexGridSizer* m_textControlSizer; - wxStaticText* m_staticText1; - wxTextCtrl* m_textLabelSingleLine; - wxTextCtrl* m_textLabelMultiLine; - wxStaticText* m_SizeTitle; - wxTextCtrl* m_TextSize; - wxStaticText* m_staticSizeUnits; - wxRadioBox* m_TextOrient; - wxRadioBox* m_TextStyle; - wxRadioBox* m_TextShape; - wxStdDialogButtonSizer* m_sdbSizer1; - wxButton* m_sdbSizer1OK; - wxButton* m_sdbSizer1Cancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnEnterKey( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } - - - 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(); - -}; - -#endif //__DIALOG_EDIT_LABEL_BASE_H__ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 10 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_EDIT_LABEL_BASE_H__ +#define __DIALOG_EDIT_LABEL_BASE_H__ + +#include +#include +#include +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_LABEL_EDITOR_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_LABEL_EDITOR_BASE : public DIALOG_SHIM +{ + private: + + protected: + enum + { + wxID_VALUESINGLE = 1000, + wxID_VALUEMULTI, + wxID_SIZE + }; + + wxFlexGridSizer* m_textControlSizer; + wxStaticText* m_staticText1; + wxTextCtrl* m_textLabelSingleLine; + wxTextCtrl* m_textLabelMultiLine; + wxStaticText* m_SizeTitle; + wxTextCtrl* m_TextSize; + wxStaticText* m_staticSizeUnits; + wxRadioBox* m_TextOrient; + wxRadioBox* m_TextStyle; + wxRadioBox* m_TextShape; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnEnterKey( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + 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(); + +}; + +#endif //__DIALOG_EDIT_LABEL_BASE_H__ diff --git a/eeschema/dialogs/dialog_eeschema_config.cpp b/eeschema/dialogs/dialog_eeschema_config.cpp index ed59063944..0e4751d171 100644 --- a/eeschema/dialogs/dialog_eeschema_config.cpp +++ b/eeschema/dialogs/dialog_eeschema_config.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -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 ) diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp index 0c3e70926a..aa637539cf 100644 --- a/eeschema/dialogs/dialog_plot_schematic.cpp +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -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 ) diff --git a/eeschema/dialogs/dialog_plot_schematic.h b/eeschema/dialogs/dialog_plot_schematic.h index 01758ddd95..baa03bd4d1 100644 --- a/eeschema/dialogs/dialog_plot_schematic.h +++ b/eeschema/dialogs/dialog_plot_schematic.h @@ -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 diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index b25d6ea58c..1d1f8f613b 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -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; diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index fb23f6b922..7b7ce258eb 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -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 ); diff --git a/eeschema/eelibs_read_libraryfiles.cpp b/eeschema/eelibs_read_libraryfiles.cpp index e836b013c0..05ab46c11f 100644 --- a/eeschema/eelibs_read_libraryfiles.cpp +++ b/eeschema/eelibs_read_libraryfiles.cpp @@ -11,6 +11,7 @@ #include #include +#include #include @@ -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() ) diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index 04bdf2ed91..63422085fd 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -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 diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index caac4ce5b0..0f2de0ad32 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -25,6 +25,7 @@ /** * @file eeschema.cpp + * @brief the main file */ #include @@ -33,7 +34,6 @@ #include #include #include -#include #include #include @@ -48,44 +48,10 @@ // 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; - -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; +wxSize g_RepeatStep; +int g_RepeatDeltaLabel; +int g_DefaultBusWidth; +SCH_SHEET* g_RootSheet = NULL; 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 diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 17173008ac..1654853751 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -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. diff --git a/eeschema/eeschema_config.h b/eeschema/eeschema_config.h index caa9025224..0c9135066c 100644 --- a/eeschema/eeschema_config.h +++ b/eeschema/eeschema_config.h @@ -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 diff --git a/eeschema/eeschema_id.h b/eeschema/eeschema_id.h index bb0020e3ed..acedd1ec5c 100644 --- a/eeschema/eeschema_id.h +++ b/eeschema/eeschema_id.h @@ -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, diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 554b93c421..552e1ccc57 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -42,7 +42,7 @@ #include -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() ); } diff --git a/eeschema/general.h b/eeschema/general.h index 40d2434711..27a22c44f8 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -11,37 +11,21 @@ #include #include - -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 (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 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; +extern wxSize g_RepeatStep; +extern int g_RepeatDeltaLabel; /* 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 SCH_SHEET* g_RootSheet; 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); -#endif // _GENERAL_H_ +/** + * 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_ diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 1c8e8c752d..b9bd9f7592 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -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 { diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index 0ce65c0f55..a6a2528b02 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -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 { diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index caf9b07474..2af086fc60 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -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 { diff --git a/eeschema/lib_export.cpp b/eeschema/lib_export.cpp index 850a97ba5f..eacf2a336b 100644 --- a/eeschema/lib_export.cpp +++ b/eeschema/lib_export.cpp @@ -30,17 +30,13 @@ */ #include -#include #include #include -#include -#include -#include #include -#include #include #include +#include #include #include @@ -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; diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 9627c8aedb..91fc0f6188 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -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 { diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 2b915ac5cf..083e4d76a9 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -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 ); diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 5a4024aaa9..4c957b8d29 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -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 { diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 1824c443a7..8a3a08a759 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -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 { diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 2151f64e61..e8f24432f7 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -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 { diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index d5595602cf..3a2dbc8540 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -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() ); } diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp index 8a0305e94b..eaf556444b 100644 --- a/eeschema/load_one_schematic_file.cpp +++ b/eeschema/load_one_schematic_file.cpp @@ -35,7 +35,7 @@ #include #include -#include +//#include #include #include #include @@ -46,6 +46,7 @@ #include #include #include +#include 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() ) { diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 858e84443e..6acce6e864 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -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 ) ); diff --git a/eeschema/netlist_control.cpp b/eeschema/netlist_control.cpp index 1fe657f83f..30ce04ef22 100644 --- a/eeschema/netlist_control.cpp +++ b/eeschema/netlist_control.cpp @@ -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 ); } } } diff --git a/eeschema/netlist_control.h b/eeschema/netlist_control.h index d4bea729c3..c06d630aac 100644 --- a/eeschema/netlist_control.h +++ b/eeschema/netlist_control.h @@ -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: diff --git a/eeschema/plot_schematic_HPGL.cpp b/eeschema/plot_schematic_HPGL.cpp index bc440f7def..7e4c1fe055 100644 --- a/eeschema/plot_schematic_HPGL.cpp +++ b/eeschema/plot_schematic_HPGL.cpp @@ -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 ); diff --git a/eeschema/plot_schematic_PDF.cpp b/eeschema/plot_schematic_PDF.cpp index 51b5884f85..b34160994d 100644 --- a/eeschema/plot_schematic_PDF.cpp +++ b/eeschema/plot_schematic_PDF.cpp @@ -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" ) ); diff --git a/eeschema/plot_schematic_PS.cpp b/eeschema/plot_schematic_PS.cpp index 1b0d901140..084edfaf3a 100644 --- a/eeschema/plot_schematic_PS.cpp +++ b/eeschema/plot_schematic_PS.cpp @@ -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 ); diff --git a/eeschema/plot_schematic_SVG.cpp b/eeschema/plot_schematic_SVG.cpp index d0a0253284..3222956f14 100644 --- a/eeschema/plot_schematic_SVG.cpp +++ b/eeschema/plot_schematic_SVG.cpp @@ -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; diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 1d8c603de0..b7c2c61e27 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -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; diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index d15d7e66bb..7b07b8713e 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -51,6 +51,7 @@ #include +#define NULL_STRING "_NONAME_" static LIB_COMPONENT* DummyCmp; diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 83b68699eb..f6c2a37200 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -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 diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 02fe79d40f..c9d4bfdad5 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -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; diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index cfc7feb78c..e8c9b375c2 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -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 ) diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index 9132c0852c..4d88f7824f 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -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; diff --git a/eeschema/sch_polyline.cpp b/eeschema/sch_polyline.cpp index 299bcbb256..dc38b29f48 100644 --- a/eeschema/sch_polyline.cpp +++ b/eeschema/sch_polyline.cpp @@ -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; } diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index f6bafdf599..cf9f1863c9 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -53,6 +53,7 @@ #include +#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; diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index be598815d5..c1954d5db9 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -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 ) ); diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index fa9ef9a8ea..3b3809c2e3 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -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(); } diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 2edaf2d35d..ad19911c6d 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -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 & 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 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; diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 1a0b80e7e6..826ec01283 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -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() ); } diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index ce8e6a0601..11a73284b4 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -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 diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp index 5aece2e28f..b608bdd40c 100644 --- a/eeschema/symbedit.cpp +++ b/eeschema/symbedit.cpp @@ -30,18 +30,16 @@ #include #include -#include #include #include #include #include #include -#include #include -#include #include #include +#include #include #include @@ -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() ); diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index 53e5e107c7..4154262376 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -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: diff --git a/include/id.h b/include/id.h index 8ec230b236..7659ef1925 100644 --- a/include/id.h +++ b/include/id.h @@ -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, diff --git a/include/pad_shapes.h b/include/pad_shapes.h index cbe537573d..e372795903 100644 --- a/include/pad_shapes.h +++ b/include/pad_shapes.h @@ -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 }; diff --git a/include/plot_common.h b/include/plot_common.h index 8f03e3d6a1..3b2312bfa1 100644 --- a/include/plot_common.h +++ b/include/plot_common.h @@ -344,18 +344,16 @@ protected: class HPGL_PLOTTER : public PLOTTER { public: - HPGL_PLOTTER() - { - } + HPGL_PLOTTER(); virtual PlotFormat GetPlotterType() const { - return PLOT_FORMAT_HPGL; + return PLOT_FORMAT_HPGL; } static wxString GetDefaultFileExtension() { - return wxString( wxT( "plt" ) ); + return wxString( wxT( "plt" ) ); } virtual bool StartPlot( FILE* fout ); @@ -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; } diff --git a/include/wildcards_and_files_ext.h b/include/wildcards_and_files_ext.h index 056608d22f..448de6555c 100644 --- a/include/wildcards_and_files_ext.h +++ b/include/wildcards_and_files_ext.h @@ -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; diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index 7a8cc1cc94..ddee0b6697 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -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: