Commit aa716870 authored by Maciej Suminski's avatar Maciej Suminski

Merged upstream

parents 89b80b2b 7985a4b1
...@@ -228,8 +228,6 @@ void EDA_3D_CANVAS::SetView3D( int keycode ) ...@@ -228,8 +228,6 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event ) void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
{ {
wxSize size( GetClientSize() );
if( event.ShiftDown() ) if( event.ShiftDown() )
{ {
if( event.GetWheelRotation() < 0 ) if( event.GetWheelRotation() < 0 )
......
...@@ -88,8 +88,8 @@ if( CMAKE_COMPILER_IS_GNUCXX ) ...@@ -88,8 +88,8 @@ if( CMAKE_COMPILER_IS_GNUCXX )
# Establish -Wall early, so specialized relaxations of this may come # Establish -Wall early, so specialized relaxations of this may come
# subsequently on the command line, such as in pcbnew/github/CMakeLists.txt # subsequently on the command line, such as in pcbnew/github/CMakeLists.txt
set( CMAKE_C_FLAGS "-Wall" ) set( CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "-Wall" ) set( CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}" )
# The optimization level is -O1 instead of the usual -O2 level because # The optimization level is -O1 instead of the usual -O2 level because
# boost::polygon has a function (inflate polygon) broken by the -O2 level # boost::polygon has a function (inflate polygon) broken by the -O2 level
...@@ -459,11 +459,6 @@ add_custom_target( uninstall ...@@ -459,11 +459,6 @@ add_custom_target( uninstall
# Installation # Installation
#================================================ #================================================
add_custom_target( install_user_configuration_files
"${CMAKE_COMMAND}" -E copy "${PROJECT_SOURCE_DIR}/template/fp-lib-table" ${KICAD_USER_CONFIG_DIR}/
COMMENT "Install template fp-lib-table into your home directory."
)
install( FILES INSTALL.txt install( FILES INSTALL.txt
DESTINATION ${KICAD_DOCS} DESTINATION ${KICAD_DOCS}
COMPONENT resources ) COMPONENT resources )
...@@ -534,10 +529,6 @@ if( UNIX AND NOT APPLE ) ...@@ -534,10 +529,6 @@ if( UNIX AND NOT APPLE )
#set( CPACK_PACKAGE_CONTACT Firstname Lastname <email@company.com> ) #set( CPACK_PACKAGE_CONTACT Firstname Lastname <email@company.com> )
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "KiCad built by CMake build system." ) set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "KiCad built by CMake build system." )
# Tell debian CPack about all files which are configuration files
add_conffiles() # clear file
add_conffiles( ${KICAD_USER_CONFIG_DIR}/fp-lib-table ) # append to it
include( CPack ) include( CPack )
endif() endif()
...@@ -58,7 +58,7 @@ set( BOOST_LIBS_BUILT ...@@ -58,7 +58,7 @@ set( BOOST_LIBS_BUILT
#-----</configure>--------------------------------------------------------------- #-----</configure>---------------------------------------------------------------
find_package( BZip2 REQUIRED )
string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" ) string( REGEX REPLACE "\\." "_" BOOST_VERS "${BOOST_RELEASE}" )
set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} ) set( PREFIX ${DOWNLOAD_DIR}/boost_${BOOST_VERS} )
......
...@@ -26,92 +26,6 @@ Common ...@@ -26,92 +26,6 @@ Common
but is now in scripts/python/ky temporarily. but is now in scripts/python/ky temporarily.
FP LIB TABLE
------------
Dialog:
- - - -
a) check for duplicate nicknames in a single table, complain, give the user a nice indication of the duplicate(s)
b) in the uri column give a small button popup a window(dialog?) which lets user choose a file or directory local to his system by pointing at it.
c) Active library table load and save functions. There are two tables active at any time, but
they look like one table. Identify a place to keep the access mechanism (pointer). Modify
the project specific portion of this RAM table when the board changes.
Other:
- - - -
a) develop a syntax for nickname:footprint combo, i.e. bring to life class FPID
with development and testing of parsing and formatting.
b) modify cvpcb to handle the nickname:footprint, i.e. textual form of FPID.
This means having a wider textfield for the FPID than was allocated for the footprint name alone.
Needed is the ability to pick a footprint from any active library.
c) modify the netlist format to handle nickname:footprint, save and load.
The nickname needs to be optional. I would say allowed in the grammar in the
footprint position are:
footprint | (fp_id FPID)
or just
FPID # if it can be parsed when nickname is missing.
d) write functions to lookup a footprint from
i) FPID
ii) footprint alone since most old netlists don't have nicknames in them.
e) Replace MODULE::m_LibRef which is a wxString with FPID. FPID supports
the footprint name only which is backwards compatible with the current
design.
f) On the first time an empty global footprint table is encountered, add
standard KiCad and user libraries not located in the project directory
or any of it's sub-directories to the global footprint library table.
g) When a project is opened and the project footprint library table is
empty, add any user library that is located in the project path or any
of it's sub-directories to the project footprint library table.
h) When populating the footprint library tables, use the library file name
without the extension as the FPID nickname. When duplicate names exist,
append an incremental integer to the nickname so that the second logic
libraries FPID nickname becomes logic1. Assign FPID library nicknames
to each MODULE based on the legacy library search order when loading an
existing board that does not have fully defined MODULE FPIDs.
i) Add check for KISYSMOD environment variable, on Pcbnew and CvPcb start up
and set it to the known directory of the default KiCad footprint libraries.
The code should look something like:
{
const char* envar;
envar = getenv( "KISYSMOD" );
if( !envar )
{
envvar = knownDirOfSysMods;
setenv( "KISYSMOD", envar );
}
}
These i) and ii) merge into one if footprint alone is a valid FPID.
Incorporate any environment variable in the the uri expansion using:
const wxString FP_LIB_TABLE::ExpandSubtitutions( const wxString aString )
Eeschema Eeschema
-------- --------
...@@ -148,10 +62,6 @@ PCBNew ...@@ -148,10 +62,6 @@ PCBNew
Dick's Final TODO List: Dick's Final TODO List:
====================== ======================
*) Rewrite
PCB_BASE_FRAME::Save_Module_In_Library
PCB_EDIT_FRAME::ArchiveModulesOnBoard
to use FP_LIB_TABLE mechanisms.
*) Apply Fabrizio and Alexander's linux desktop patches after unifying them. *) Apply Fabrizio and Alexander's linux desktop patches after unifying them.
*) Get licensing cleaned up. *) Get licensing cleaned up.
*) Re-arrange the repo architecture. *) Re-arrange the repo architecture.
......
...@@ -159,7 +159,7 @@ set(COMMON_SRCS ...@@ -159,7 +159,7 @@ set(COMMON_SRCS
math/math_util.cpp math/math_util.cpp
system/fcontext.s system/fcontext.s
tool/tool_base.cpp tool/tool_base.cpp
tool/tool_manager.cpp tool/tool_manager.cpp
tool/tool_dispatcher.cpp tool/tool_dispatcher.cpp
...@@ -231,7 +231,7 @@ set(PCB_COMMON_SRCS ...@@ -231,7 +231,7 @@ set(PCB_COMMON_SRCS
) )
set(PCB_COMMON_SRCS set(PCB_COMMON_SRCS
${PCB_COMMON_SRCS} ${PCB_COMMON_SRCS}
../pcbnew/pcb_painter.cpp ../pcbnew/pcb_painter.cpp
) )
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <macros.h>
#include <common.h> #include <common.h>
#include <base_struct.h> #include <base_struct.h>
#include <class_base_screen.h> #include <class_base_screen.h>
......
...@@ -67,7 +67,6 @@ EDA_ITEM::EDA_ITEM( const EDA_ITEM& base ) ...@@ -67,7 +67,6 @@ EDA_ITEM::EDA_ITEM( const EDA_ITEM& base )
InitVars(); InitVars();
m_StructType = base.m_StructType; m_StructType = base.m_StructType;
m_Parent = base.m_Parent; m_Parent = base.m_Parent;
m_Son = base.m_Son;
m_Flags = base.m_Flags; m_Flags = base.m_Flags;
// A copy of an item cannot have the same time stamp as the original item. // A copy of an item cannot have the same time stamp as the original item.
...@@ -82,7 +81,6 @@ void EDA_ITEM::InitVars() ...@@ -82,7 +81,6 @@ void EDA_ITEM::InitVars()
Pnext = NULL; // Linked list: Link (next struct) Pnext = NULL; // Linked list: Link (next struct)
Pback = NULL; // Linked list: Link (previous struct) Pback = NULL; // Linked list: Link (previous struct)
m_Parent = NULL; // Linked list: Link (parent struct) m_Parent = NULL; // Linked list: Link (parent struct)
m_Son = NULL; // Linked list: Link (son struct)
m_List = NULL; // I am not on any list yet m_List = NULL; // I am not on any list yet
m_Image = NULL; // Link to an image copy for undelete or abort command m_Image = NULL; // Link to an image copy for undelete or abort command
m_Flags = 0; // flags for editions and other m_Flags = 0; // flags for editions and other
...@@ -235,7 +233,6 @@ EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem ) ...@@ -235,7 +233,6 @@ EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem )
m_Image = aItem.m_Image; m_Image = aItem.m_Image;
m_StructType = aItem.m_StructType; m_StructType = aItem.m_StructType;
m_Parent = aItem.m_Parent; m_Parent = aItem.m_Parent;
m_Son = aItem.m_Son;
m_Flags = aItem.m_Flags; m_Flags = aItem.m_Flags;
m_TimeStamp = aItem.m_TimeStamp; m_TimeStamp = aItem.m_TimeStamp;
m_Status = aItem.m_Status; m_Status = aItem.m_Status;
...@@ -535,7 +532,7 @@ double EDA_RECT::GetArea() const ...@@ -535,7 +532,7 @@ double EDA_RECT::GetArea() const
/* Calculate the bounding box of this, when rotated /* Calculate the bounding box of this, when rotated
*/ */
EDA_RECT EDA_RECT::GetBoundingBoxRotated( wxPoint aRotCenter, double aAngle ) const EDA_RECT EDA_RECT::GetBoundingBoxRotated( wxPoint aRotCenter, double aAngle )
{ {
wxPoint corners[4]; wxPoint corners[4];
......
...@@ -459,7 +459,12 @@ void EDA_BASE_FRAME::AddHelpVersionInfoMenuEntry( wxMenu* aMenu ) ...@@ -459,7 +459,12 @@ void EDA_BASE_FRAME::AddHelpVersionInfoMenuEntry( wxMenu* aMenu )
static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE() static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE()
{ {
return return
" (" __WX_BO_UNICODE __ABI_VERSION __BO_COMPILER __WX_BO_STL #ifdef __WXDEBUG__
" (debug,"
#else
" (release,"
#endif
__WX_BO_UNICODE __ABI_VERSION __BO_COMPILER __WX_BO_STL
__WX_BO_WXWIN_COMPAT_2_6 __WX_BO_WXWIN_COMPAT_2_8 ")" __WX_BO_WXWIN_COMPAT_2_6 __WX_BO_WXWIN_COMPAT_2_8 ")"
; ;
} }
...@@ -469,7 +474,11 @@ static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE() ...@@ -469,7 +474,11 @@ static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE()
static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE() static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE()
{ {
return return
" (" __WX_BO_DEBUG "," #ifdef __WXDEBUG__
" (debug,"
#else
" (release,"
#endif
__WX_BO_UNICODE __ABI_VERSION __BO_COMPILER __WX_BO_STL __WX_BO_UNICODE __ABI_VERSION __BO_COMPILER __WX_BO_STL
__WX_BO_WXWIN_COMPAT_2_4 __WX_BO_WXWIN_COMPAT_2_6 ")" __WX_BO_WXWIN_COMPAT_2_4 __WX_BO_WXWIN_COMPAT_2_6 ")"
; ;
...@@ -490,8 +499,14 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event ) ...@@ -490,8 +499,14 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
wxPlatformInfo info; wxPlatformInfo info;
tmp = wxT( "Application: " ) + wxGetApp().GetTitle() + wxT( "\n" ); tmp = wxT( "Application: " ) + wxGetApp().GetTitle() + wxT( "\n" );
tmp += wxT( "Version: " ) + GetBuildVersion() + wxT( "\n" ); tmp << wxT( "Version: " ) << GetBuildVersion()
tmp << wxT( "Build: " ) << wxVERSION_STRING #ifdef DEBUG
<< wxT( " Debug" )
#else
<< wxT( " Release" )
#endif
<< wxT( " build\n" );
tmp << wxT( "wxWidgets: Version " ) << FROM_UTF8( wxVERSION_NUM_DOT_STRING )
<< FROM_UTF8( KICAD_BUILD_OPTIONS_SIGNATURE() ) << wxT( "\n" ) << FROM_UTF8( KICAD_BUILD_OPTIONS_SIGNATURE() ) << wxT( "\n" )
<< wxT( "Platform: " ) << wxGetOsDescription() << wxT( ", " ) << wxT( "Platform: " ) << wxGetOsDescription() << wxT( ", " )
<< info.GetArchName() << wxT( ", " ) << info.GetEndiannessName() << wxT( ", " ) << info.GetArchName() << wxT( ", " ) << info.GetEndiannessName() << wxT( ", " )
...@@ -537,6 +552,22 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event ) ...@@ -537,6 +552,22 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
tmp << wxT( "OFF\n" ); tmp << wxT( "OFF\n" );
#endif #endif
tmp << wxT( " USE_FP_LIB_TABLE=" );
#ifdef USE_FP_LIB_TABLE
tmp << wxT( "ON\n" );
#else
tmp << wxT( "OFF\n" );
#endif
tmp << wxT( " BUILD_GITHUB_PLUGIN=" );
#ifdef BUILD_GITHUB_PLUGIN
tmp << wxT( "ON\n" );
#else
tmp << wxT( "OFF\n" );
#endif
wxMessageBox( tmp, _("Version Information (copied to the clipboard)") );
wxTheClipboard->SetData( new wxTextDataObject( tmp ) ); wxTheClipboard->SetData( new wxTextDataObject( tmp ) );
wxTheClipboard->Close(); wxTheClipboard->Close();
} }
......
...@@ -52,9 +52,9 @@ public: ...@@ -52,9 +52,9 @@ public:
}; };
private: private:
void OnSaveAndExit( wxCommandEvent& event ) { EndModal( wxID_YES ); } void OnSaveAndExit( wxCommandEvent& event ) { EndModal( wxID_YES ); }
void OnCancel( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); } void OnCancel( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); }
void OnExitNoSave( wxCommandEvent& event ) { EndModal( wxID_NO ); } void OnExitNoSave( wxCommandEvent& event ) { EndModal( wxID_NO ); }
}; };
...@@ -73,10 +73,14 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime ) ...@@ -73,10 +73,14 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
if( displaytime > 0 ) if( displaytime > 0 )
dialog = new wxMessageDialog( parent, text, _( "Warning" ), dialog = new wxMessageDialog( parent, text, _( "Warning" ),
wxOK | wxCENTRE | wxICON_INFORMATION ); wxOK | wxCENTRE | wxICON_INFORMATION
| wxRESIZE_BORDER
);
else else
dialog = new wxMessageDialog( parent, text, _( "Error" ), dialog = new wxMessageDialog( parent, text, _( "Error" ),
wxOK | wxCENTRE | wxICON_ERROR ); wxOK | wxCENTRE | wxICON_ERROR
| wxRESIZE_BORDER
);
dialog->ShowModal(); dialog->ShowModal();
dialog->Destroy(); dialog->Destroy();
......
This diff is collapsed.
...@@ -46,7 +46,17 @@ static RECT_MAP class_map; ...@@ -46,7 +46,17 @@ static RECT_MAP class_map;
bool DIALOG_SHIM::Show( bool show ) bool DIALOG_SHIM::Show( bool show )
{ {
bool ret; bool ret;
const char* classname = typeid(*this).name(); const char* hash_key;
if( m_hash_key.size() )
{
// a special case like EDA_LIST_DIALOG, which has multiple uses.
hash_key = m_hash_key.c_str();
}
else
{
hash_key = typeid(*this).name();
}
// Show or hide the window. If hiding, save current position and size. // Show or hide the window. If hiding, save current position and size.
// If showing, use previous position and size. // If showing, use previous position and size.
...@@ -55,7 +65,7 @@ bool DIALOG_SHIM::Show( bool show ) ...@@ -55,7 +65,7 @@ bool DIALOG_SHIM::Show( bool show )
ret = wxDialog::Show( show ); ret = wxDialog::Show( show );
// classname is key, returns a zeroed out default EDA_RECT if none existed before. // classname is key, returns a zeroed out default EDA_RECT if none existed before.
EDA_RECT r = class_map[ classname ]; EDA_RECT r = class_map[ hash_key ];
if( r.GetSize().x != 0 && r.GetSize().y != 0 ) if( r.GetSize().x != 0 && r.GetSize().y != 0 )
SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 ); SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 );
...@@ -64,7 +74,7 @@ bool DIALOG_SHIM::Show( bool show ) ...@@ -64,7 +74,7 @@ bool DIALOG_SHIM::Show( bool show )
{ {
// Save the dialog's position & size before hiding, using classname as key // Save the dialog's position & size before hiding, using classname as key
EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() ); EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() );
class_map[ classname ] = r; class_map[ hash_key ] = r;
ret = wxDialog::Show( show ); ret = wxDialog::Show( show );
} }
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012) // C++ code generated with wxFormBuilder (version Nov 5 2013)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -24,6 +24,7 @@ DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindow ...@@ -24,6 +24,7 @@ DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindow
bSizerLeft->Add( m_staticTextName, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerLeft->Add( m_staticTextName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_textCmpNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textCmpNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCmpNameCtrl->SetMaxLength( 0 );
bSizerLeft->Add( m_textCmpNameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerLeft->Add( m_textCmpNameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextHistory = new wxStaticText( this, wxID_ANY, _("History list:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextHistory = new wxStaticText( this, wxID_ANY, _("History list:"), wxDefaultPosition, wxDefaultSize, 0 );
...@@ -63,6 +64,7 @@ DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindow ...@@ -63,6 +64,7 @@ DIALOG_GET_COMPONENT_BASE::DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindow
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );
this->Layout(); this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
......
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="precompiled_header"></property>
<property name="relative_path">1</property> <property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
...@@ -42,7 +44,7 @@ ...@@ -42,7 +44,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DIALOG_GET_COMPONENT_BASE</property> <property name="name">DIALOG_GET_COMPONENT_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">375,210</property> <property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title"></property> <property name="title"></property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012) // C++ code generated with wxFormBuilder (version Nov 5 2013)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
...@@ -57,7 +59,7 @@ class DIALOG_GET_COMPONENT_BASE : public DIALOG_SHIM ...@@ -57,7 +59,7 @@ class DIALOG_GET_COMPONENT_BASE : public DIALOG_SHIM
public: public:
DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 375,210 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_GET_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GET_COMPONENT_BASE(); ~DIALOG_GET_COMPONENT_BASE();
}; };
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012) // C++ code generated with wxFormBuilder (version Nov 5 2013)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -29,10 +29,10 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con ...@@ -29,10 +29,10 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
m_staticText2->Wrap( -1 ); m_staticText2->Wrap( -1 );
bSizerMain->Add( m_staticText2, 0, wxRIGHT|wxLEFT, 5 ); bSizerMain->Add( m_staticText2, 0, wxRIGHT|wxLEFT, 5 );
m_listBox = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxVSCROLL ); m_listBox = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxALWAYS_SHOW_SB|wxVSCROLL );
m_listBox->SetMinSize( wxSize( 300,200 ) ); m_listBox->SetMinSize( wxSize( -1,200 ) );
bSizerMain->Add( m_listBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizerMain->Add( m_listBox, 3, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextMsg = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextMsg = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextMsg->Wrap( -1 ); m_staticTextMsg->Wrap( -1 );
...@@ -41,7 +41,7 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con ...@@ -41,7 +41,7 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
m_messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); m_messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_messages->SetMinSize( wxSize( -1,80 ) ); m_messages->SetMinSize( wxSize( -1,80 ) );
bSizerMain->Add( m_messages, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerMain->Add( m_messages, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK ); m_sdbSizerOK = new wxButton( this, wxID_OK );
...@@ -55,6 +55,7 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con ...@@ -55,6 +55,7 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );
this->Layout(); this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
......
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="precompiled_header"></property>
<property name="relative_path">1</property> <property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
...@@ -32,7 +34,7 @@ ...@@ -32,7 +34,7 @@
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="event_handler">impl_virtual</property> <property name="event_handler">decl_pure_virtual</property>
<property name="extra_style"></property> <property name="extra_style"></property>
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
...@@ -42,7 +44,7 @@ ...@@ -42,7 +44,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">EDA_LIST_DIALOG_BASE</property> <property name="name">EDA_LIST_DIALOG_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">329,398</property> <property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title"></property> <property name="title"></property>
...@@ -351,7 +353,7 @@ ...@@ -351,7 +353,7 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property> <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">3</property>
<object class="wxListCtrl" expanded="1"> <object class="wxListCtrl" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
...@@ -385,7 +387,7 @@ ...@@ -385,7 +387,7 @@
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property> <property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size">300,200</property> <property name="minimum_size">-1,200</property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_listBox</property> <property name="name">m_listBox</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
...@@ -397,7 +399,7 @@ ...@@ -397,7 +399,7 @@
<property name="resize">Resizable</property> <property name="resize">Resizable</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxLC_REPORT</property> <property name="style">wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
...@@ -407,7 +409,7 @@ ...@@ -407,7 +409,7 @@
<property name="validator_variable"></property> <property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style">wxVSCROLL</property> <property name="window_style">wxALWAYS_SHOW_SB|wxVSCROLL</property>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
...@@ -539,7 +541,7 @@ ...@@ -539,7 +541,7 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012) // C++ code generated with wxFormBuilder (version Nov 5 2013)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -48,17 +48,17 @@ class EDA_LIST_DIALOG_BASE : public DIALOG_SHIM ...@@ -48,17 +48,17 @@ class EDA_LIST_DIALOG_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void onClose( wxCloseEvent& event ) { event.Skip(); } virtual void onClose( wxCloseEvent& event ) = 0;
virtual void textChangeInFilterBox( wxCommandEvent& event ) { event.Skip(); } virtual void textChangeInFilterBox( wxCommandEvent& event ) = 0;
virtual void onListItemActivated( wxListEvent& event ) { event.Skip(); } virtual void onListItemActivated( wxListEvent& event ) = 0;
virtual void onListItemSelected( wxListEvent& event ) { event.Skip(); } virtual void onListItemSelected( wxListEvent& event ) = 0;
virtual void onCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void onCancelClick( wxCommandEvent& event ) = 0;
virtual void onOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void onOkClick( wxCommandEvent& event ) = 0;
public: public:
EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 329,398 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~EDA_LIST_DIALOG_BASE(); ~EDA_LIST_DIALOG_BASE();
}; };
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <macros.h>
#include <wxstruct.h> #include <wxstruct.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <dialog_helpers.h> #include <dialog_helpers.h>
...@@ -34,8 +36,8 @@ ...@@ -34,8 +36,8 @@
EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle, EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
const wxArrayString& aItemHeaders, const wxArrayString& aItemHeaders,
const std::vector<wxArrayString>& aItemList, const std::vector<wxArrayString>& aItemList,
const wxString& aRefText, const wxString& aSelection,
void(*aCallBackFunction)(wxString& Text), void( *aCallBackFunction )( wxString& ),
bool aSortList ) : bool aSortList ) :
EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle ) EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle )
{ {
...@@ -46,42 +48,90 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl ...@@ -46,42 +48,90 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl
for( unsigned i = 0; i < aItemHeaders.Count(); i++ ) for( unsigned i = 0; i < aItemHeaders.Count(); i++ )
{ {
wxListItem column; wxListItem column;
column.SetId( i ); column.SetId( i );
column.SetText( aItemHeaders.Item( i ) ); column.SetText( aItemHeaders.Item( i ) );
column.SetWidth( 300 / aItemHeaders.Count() );
m_listBox->InsertColumn( i, column ); m_listBox->InsertColumn( i, column );
} }
InsertItems( aItemList, 0 ); InsertItems( aItemList, 0 );
if( !aRefText.IsEmpty() ) // try to select the item matching aRefText if( m_callBackFct == NULL )
{ {
for( unsigned ii = 0; ii < aItemList.size(); ii++ ) m_messages->Show( false );
m_staticTextMsg->Show( false );
}
for( unsigned col = 0; col < aItemHeaders.Count(); ++col )
{
m_listBox->SetColumnWidth( col, wxLIST_AUTOSIZE );
#if !wxCHECK_VERSION( 2, 9, 0 )
// include the column header in the width decision, wx 2.8 forgets this:
wxListItem col_info;
m_listBox->GetColumn( col, col_info );
wxString header = col_info.GetText();
int headerz = GetTextSize( header, m_listBox ).x;
// A reasonable column header has about 14 pixels of whitespace
// in addition to the width of the text itself.
headerz += 14;
if( headerz > col_info.GetWidth() )
{ {
if( aItemList[ii][0] == aRefText ) col_info.SetWidth( headerz );
{
m_listBox->SetItemState( ii, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); m_listBox->SetColumn( col, col_info );
break;
}
} }
#endif
} }
if( m_callBackFct == NULL )
#if !wxCHECK_VERSION( 2, 9, 0 )
// wx 2.8.x has bug in wxListCtrl WRT honoring the omission of wxHSCROLL, at least
// on gtk2. Fix by setting minimum width so horizontal wxListCtrl scrolling is
// not needed on 2.8.x because of minumum visible width setting:
{ {
m_messages->Show( false ); int width = 0;
m_staticTextMsg->Show( false );
}
m_filterBox->SetFocus(); for( unsigned col = 0; col < aItemHeaders.Count(); ++col )
{
width += m_listBox->GetColumnWidth( col ) + 2;
}
GetSizer()->Fit( this ); wxSize sz = m_listBox->GetSize();
GetSizer()->SetSizeHints( this );
sz.SetWidth( width );
m_listBox->SetMinSize( sz );
}
#endif
Fit();
Centre(); Centre();
}
if( !!aSelection )
{
for( unsigned row = 0; row < aItemList.size(); ++row )
{
if( aItemList[row][0] == aSelection )
{
m_listBox->SetItemState( row, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
m_listBox->EnsureVisible( row );
break;
}
}
}
EDA_LIST_DIALOG::~EDA_LIST_DIALOG() // DIALOG_SHIM needs a unique hash_key because classname is not sufficient
{ // because so many dialogs share this same class, with different numbers of
// columns, different column names, and column widths.
m_hash_key = TO_UTF8( aTitle );
m_filterBox->SetFocus();
} }
...@@ -111,22 +161,24 @@ void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event ) ...@@ -111,22 +161,24 @@ void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event )
wxString EDA_LIST_DIALOG::GetTextSelection( int aColumn ) wxString EDA_LIST_DIALOG::GetTextSelection( int aColumn )
{ {
wxCHECK_MSG( aColumn < m_listBox->GetColumnCount(), wxEmptyString, wxCHECK_MSG( unsigned( aColumn ) < unsigned( m_listBox->GetColumnCount() ), wxEmptyString,
wxT( "Invalid list control column." ) ); wxT( "Invalid list control column." ) );
wxListItem info; long item = m_listBox->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
wxString text;
long item = -1;
item = m_listBox->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
info.m_mask = wxLIST_MASK_TEXT; if( item >= 0 ) // if something is selected.
info.m_itemId = item; {
info.m_col = aColumn; wxListItem info;
if( !m_listBox->GetItem( info ) ) info.m_mask = wxLIST_MASK_TEXT;
return wxEmptyString; info.m_itemId = item;
info.m_col = aColumn;
if( m_listBox->GetItem( info ) )
return info.m_text;
}
return info.m_text; return wxEmptyString;
} }
...@@ -150,9 +202,9 @@ void EDA_LIST_DIALOG::InsertItems( const std::vector< wxArrayString >& itemList, ...@@ -150,9 +202,9 @@ void EDA_LIST_DIALOG::InsertItems( const std::vector< wxArrayString >& itemList,
{ {
wxASSERT( (int) itemList[row].GetCount() == m_listBox->GetColumnCount() ); wxASSERT( (int) itemList[row].GetCount() == m_listBox->GetColumnCount() );
long itemIndex = 0;
for( unsigned col = 0; col < itemList[row].GetCount(); col++ ) for( unsigned col = 0; col < itemList[row].GetCount(); col++ )
{ {
long itemIndex;
if( col == 0 ) if( col == 0 )
{ {
......
...@@ -95,7 +95,9 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -95,7 +95,9 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
#if wxCHECK_VERSION( 2, 9, 5 ) #if wxCHECK_VERSION( 2, 9, 5 )
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS ); ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
DisableKeyboardScrolling();
#endif #endif
m_scrollIncrementX = std::min( size.x / 8, 10 ); m_scrollIncrementX = std::min( size.x / 8, 10 );
m_scrollIncrementY = std::min( size.y / 8, 10 ); m_scrollIncrementY = std::min( size.y / 8, 10 );
...@@ -904,11 +906,22 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) ...@@ -904,11 +906,22 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
bool offCenterReq = event.ControlDown() && event.ShiftDown(); bool offCenterReq = event.ControlDown() && event.ShiftDown();
offCenterReq = offCenterReq || m_enableZoomNoCenter; offCenterReq = offCenterReq || m_enableZoomNoCenter;
#if wxMAJOR_VERSION >= 2 && wxMINOR_VERSION >= 9
int axis = event.GetWheelAxis();
#else
const int axis = 0;
#endif
// This is a zoom in or out command // This is a zoom in or out command
if( event.GetWheelRotation() > 0 ) if( event.GetWheelRotation() > 0 )
{ {
if( event.ShiftDown() && !event.ControlDown() ) if( event.ShiftDown() && !event.ControlDown() )
cmd.SetId( ID_PAN_UP ); {
if( axis == 0 )
cmd.SetId( ID_PAN_UP );
else
cmd.SetId( ID_PAN_RIGHT );
}
else if( event.ControlDown() && !event.ShiftDown() ) else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_LEFT ); cmd.SetId( ID_PAN_LEFT );
else if( offCenterReq ) else if( offCenterReq )
...@@ -919,7 +932,12 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) ...@@ -919,7 +932,12 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
else if( event.GetWheelRotation() < 0 ) else if( event.GetWheelRotation() < 0 )
{ {
if( event.ShiftDown() && !event.ControlDown() ) if( event.ShiftDown() && !event.ControlDown() )
cmd.SetId( ID_PAN_DOWN ); {
if( axis == 0 )
cmd.SetId( ID_PAN_DOWN );
else
cmd.SetId( ID_PAN_LEFT );
}
else if( event.ControlDown() && !event.ShiftDown() ) else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_RIGHT ); cmd.SetId( ID_PAN_RIGHT );
else if( offCenterReq ) else if( offCenterReq )
......
...@@ -32,15 +32,13 @@ ...@@ -32,15 +32,13 @@
#include <trigo.h> // RotatePoint #include <trigo.h> // RotatePoint
#include <class_drawpanel.h> // EDA_DRAW_PANEL #include <class_drawpanel.h> // EDA_DRAW_PANEL
// until bzr rev 4410, Y position of vertical justification // until bzr rev 4476, Y position of vertical justification
// of multiline texts was incorrectly calculated for BOTTOM // of multiline texts was incorrectly calculated for BOTTOM
// and CENTER vertical justification. (Only the first line was justified) // and CENTER vertical justification. (Only the first line was justified)
// If this line is left uncommented, the bug is fixed, but // If this line is left uncommented, the bug is fixed, but
// creates a (very minor) issue for existing texts, mainly in Pcbnew // creates a (very minor) issue for existing texts, mainly in Pcbnew
// because the text position is sometimes critical. // because the text position is sometimes critical.
// Currently, this change is broken for rotated or mirrored texts, #define FIX_MULTILINE_VERT_JUSTIF
// so keep this line commented until there are fixes
//#define FIX_MULTILINE_VERT_JUSTIF
// Conversion to application internal units defined at build time. // Conversion to application internal units defined at build time.
#if defined( PCBNEW ) #if defined( PCBNEW )
...@@ -267,38 +265,17 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, ...@@ -267,38 +265,17 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
{ {
if( m_MultilineAllowed ) if( m_MultilineAllowed )
{ {
wxPoint pos = m_Pos; std::vector<wxPoint> positions;
wxArrayString* list = wxStringSplit( m_Text, '\n' ); wxArrayString* list = wxStringSplit( m_Text, '\n' );
wxPoint offset; positions.reserve( list->Count() );
offset.y = GetInterline(); GetPositionsOfLinesOfMultilineText(positions, list->Count() );
#ifdef FIX_MULTILINE_VERT_JUSTIF for( unsigned ii = 0; ii < list->Count(); ii++ )
if( list->Count() > 1 )
{
switch( m_VJustify )
{
case GR_TEXT_VJUSTIFY_TOP:
break;
case GR_TEXT_VJUSTIFY_CENTER:
pos.y -= ( list->Count() - 1 ) * offset.y / 2;
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
pos.y -= ( list->Count() - 1 ) * offset.y;
break;
}
}
#endif
RotatePoint( &offset, m_Orient );
for( unsigned i = 0; i<list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString& txt = list->Item( ii );
drawOneLineOfText( aClipBox, aDC, aOffset, aColor, drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDrawMode, aFillMode, txt, pos ); aDrawMode, aFillMode, txt, positions[ii] );
pos += offset;
} }
delete (list); delete (list);
...@@ -317,6 +294,49 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, ...@@ -317,6 +294,49 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
} }
void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
std::vector<wxPoint>& aPositions, int aLineCount )
{
wxPoint pos = m_Pos; // Position of first line of the
// multiline text according to
// the center of the multiline text block
wxPoint offset; // Offset to next line.
offset.y = GetInterline();
#ifdef FIX_MULTILINE_VERT_JUSTIF
if( aLineCount > 1 )
{
switch( m_VJustify )
{
case GR_TEXT_VJUSTIFY_TOP:
break;
case GR_TEXT_VJUSTIFY_CENTER:
pos.y -= ( aLineCount - 1 ) * offset.y / 2;
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
pos.y -= ( aLineCount - 1 ) * offset.y;
break;
}
}
// Rotate the position of the first line
// around the center of the multiline text block
RotatePoint( &pos, m_Pos, m_Orient );
#endif
// Rotate the offset lines to increase happened in the right direction
RotatePoint( &offset, m_Orient );
for( int ii = 0; ii < aLineCount; ii++ )
{
aPositions.push_back( pos );
pos += offset;
}
}
void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC, void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
const wxPoint& aOffset, EDA_COLOR_T aColor, const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <online_help.h> #include <online_help.h>
#include <gestfich.h> #include <gestfich.h>
#include <menus_helpers.h> #include <menus_helpers.h>
#include <fp_lib_table.h>
static const wxChar* CommonConfigPath = wxT( "kicad_common" ); static const wxChar* CommonConfigPath = wxT( "kicad_common" );
...@@ -1160,19 +1161,20 @@ bool EDA_APP::LockFile( const wxString& fileName ) ...@@ -1160,19 +1161,20 @@ bool EDA_APP::LockFile( const wxString& fileName )
bool EDA_APP::SetFootprintLibTablePath() bool EDA_APP::SetFootprintLibTablePath()
{ {
wxString path; wxString path;
wxString kisysmod( wxT( KISYSMOD ) );
// Set the KISYSMOD environment variable for the current process if it is not already // Set the KISYSMOD environment variable for the current process if it is not already
// defined in the user's environment. This is required to expand the global footprint // defined in the user's environment. This is required to expand the global footprint
// library table paths. // library table paths.
if( wxGetEnv( wxT( "KISYSMOD" ), &path ) && wxFileName::DirExists( path ) ) if( wxGetEnv( kisysmod, &path ) && wxFileName::DirExists( path ) )
return true; return true;
// Set the KISYSMOD environment variable to the path defined in the user's configuration // Set the KISYSMOD environment variable to the path defined in the user's configuration
// if it is defined and the path exists. // if it is defined and the path exists.
if( m_commonSettings->Read( kicadFpLibPath, &path ) && wxFileName::DirExists( path ) ) if( m_commonSettings->Read( kicadFpLibPath, &path ) && wxFileName::DirExists( path ) )
{ {
wxSetEnv( wxT( "KISYSMOD" ), path ); wxSetEnv( kisysmod, path );
return true; return true;
} }
...@@ -1198,7 +1200,7 @@ bool EDA_APP::SetFootprintLibTablePath() ...@@ -1198,7 +1200,7 @@ bool EDA_APP::SetFootprintLibTablePath()
if( modFileCount != 0 ) if( modFileCount != 0 )
{ {
wxSetEnv( wxT( "KISYSMOD" ), bestPath ); wxSetEnv( kisysmod, bestPath );
return true; return true;
} }
} }
......
...@@ -49,9 +49,6 @@ using namespace FP_LIB_TABLE_T; ...@@ -49,9 +49,6 @@ using namespace FP_LIB_TABLE_T;
*/ */
static const wxString traceFpLibTable( wxT( "KicadFpLibTable" ) ); static const wxString traceFpLibTable( wxT( "KicadFpLibTable" ) );
/// The evinronment variable name for the current project path. This is used interanally
/// at run time and is not exposed outside of the current process.
static wxString projectPathEnvVariableName( wxT( "KIPRJMOD" ) );
/// The footprint library table name used when no project file is passed to Pcbnew or CvPcb. /// The footprint library table name used when no project file is passed to Pcbnew or CvPcb.
/// This is used temporarily to store the project specific library table until the project /// This is used temporarily to store the project specific library table until the project
...@@ -74,7 +71,71 @@ void FP_LIB_TABLE::ROW::SetType( const wxString& aType ) ...@@ -74,7 +71,71 @@ void FP_LIB_TABLE::ROW::SetType( const wxString& aType )
void FP_LIB_TABLE::ROW::SetFullURI( const wxString& aFullURI ) void FP_LIB_TABLE::ROW::SetFullURI( const wxString& aFullURI )
{ {
uri_user = aFullURI; uri_user = aFullURI;
#if !FP_LATE_ENVVAR
uri_expanded = FP_LIB_TABLE::ExpandSubstitutions( aFullURI ); uri_expanded = FP_LIB_TABLE::ExpandSubstitutions( aFullURI );
#endif
}
const wxString FP_LIB_TABLE::ROW::GetFullURI( bool aSubstituted ) const
{
if( aSubstituted )
{
#if !FP_LATE_ENVVAR // early expansion
return uri_expanded;
#else // late expansion
return FP_LIB_TABLE::ExpandSubstitutions( uri_user );
#endif
}
else
return uri_user;
}
FP_LIB_TABLE::ROW::ROW( const ROW& a ) :
nickName( a.nickName ),
type( a.type ),
options( a.options ),
description( a.description ),
properties( 0 )
{
// may call ExpandSubstitutions()
SetFullURI( a.uri_user );
if( a.properties )
properties = new PROPERTIES( *a.properties );
}
FP_LIB_TABLE::ROW& FP_LIB_TABLE::ROW::operator=( const ROW& r )
{
nickName = r.nickName;
type = r.type;
options = r.options;
description = r.description;
properties = r.properties ? new PROPERTIES( *r.properties ) : NULL;
// may call ExpandSubstitutions()
SetFullURI( r.uri_user );
// Do not copy the PLUGIN, it is lazily created. Delete any existing
// destination plugin.
setPlugin( NULL );
return *this;
}
bool FP_LIB_TABLE::ROW::operator==( const ROW& r ) const
{
return nickName == r.nickName
&& uri_user == r.uri_user
&& type == r.type
&& options == r.options
&& description == r.description
;
} }
...@@ -111,6 +172,12 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString& ...@@ -111,6 +172,12 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString&
// having to copy the FPID and its two strings, twice each. // having to copy the FPID and its two strings, twice each.
FPID& fpid = (FPID&) ret->GetFPID(); FPID& fpid = (FPID&) ret->GetFPID();
// Catch any misbehaving plugin, which should be setting internal footprint name properly:
wxASSERT( aFootprintName == FROM_UTF8( fpid.GetFootprintName().c_str() ) );
// and clearing nickname
wxASSERT( !fpid.GetLibNickname().size() );
fpid.SetLibNickname( row->GetNickName() ); fpid.SetLibNickname( row->GetNickName() );
} }
...@@ -118,11 +185,27 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString& ...@@ -118,11 +185,27 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString&
} }
void FP_LIB_TABLE::FootprintSave( const wxString& aNickname, const MODULE* aFootprint ) FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname, const MODULE* aFootprint, bool aOverwrite )
{ {
const ROW* row = FindRow( aNickname ); const ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin ); wxASSERT( (PLUGIN*) row->plugin );
return row->plugin->FootprintSave( row->GetFullURI( true ), aFootprint, row->GetProperties() );
if( !aOverwrite )
{
// Try loading the footprint to see if it already exists, caller wants overwrite
// protection, which is atypical, not the default.
wxString fpname = FROM_UTF8( aFootprint->GetFPID().GetFootprintName().c_str() );
std::auto_ptr<MODULE> m( row->plugin->FootprintLoad( row->GetFullURI( true ), fpname, row->GetProperties() ) );
if( m.get() )
return SAVE_SKIPPED;
}
row->plugin->FootprintSave( row->GetFullURI( true ), aFootprint, row->GetProperties() );
return SAVE_OK;
} }
...@@ -142,6 +225,33 @@ bool FP_LIB_TABLE::IsFootprintLibWritable( const wxString& aNickname ) ...@@ -142,6 +225,33 @@ bool FP_LIB_TABLE::IsFootprintLibWritable( const wxString& aNickname )
} }
void FP_LIB_TABLE::FootprintLibDelete( const wxString& aNickname )
{
const ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin );
row->plugin->FootprintLibDelete( row->GetFullURI( true ), row->GetProperties() );
}
void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname )
{
const ROW* row = FindRow( aNickname );
wxASSERT( (PLUGIN*) row->plugin );
row->plugin->FootprintLibCreate( row->GetFullURI( true ), row->GetProperties() );
}
const wxString FP_LIB_TABLE::GetDescription( const wxString& aNickname )
{
// use "no exception" form of find row:
const ROW* row = findRow( aNickname );
if( row )
return row->description;
else
return wxEmptyString;
}
void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR ) void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR )
{ {
/* /*
...@@ -726,14 +836,20 @@ void FP_LIB_TABLE::SetProjectPathEnvVariable( const wxFileName& aPath ) ...@@ -726,14 +836,20 @@ void FP_LIB_TABLE::SetProjectPathEnvVariable( const wxFileName& aPath )
path = aPath.GetPath(); path = aPath.GetPath();
wxLogTrace( traceFpLibTable, wxT( "Setting env %s to <%s>." ), wxLogTrace( traceFpLibTable, wxT( "Setting env %s to <%s>." ),
GetChars( projectPathEnvVariableName ), GetChars( path ) ); GetChars( ProjectPathEnvVariableName() ), GetChars( path ) );
wxSetEnv( projectPathEnvVariableName, path ); wxSetEnv( ProjectPathEnvVariableName(), path );
}
const wxString FP_LIB_TABLE::ProjectPathEnvVariableName()
{
return wxT( "KIPRJMOD" );
} }
const wxString& FP_LIB_TABLE::GetProjectPathEnvVariableName() const const wxString FP_LIB_TABLE::GlobalPathEnvVariableName()
{ {
return projectPathEnvVariableName; return wxT( KISYSMOD );
} }
......
...@@ -189,7 +189,7 @@ void GPU_CACHED_MANAGER::uploadToGpu() ...@@ -189,7 +189,7 @@ void GPU_CACHED_MANAGER::uploadToGpu()
{ {
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
prof_counter totalTime; prof_counter totalTime;
prof_start( &totalTime, false ); prof_start( &totalTime );
#endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */
if( !m_buffersInitialized ) if( !m_buffersInitialized )
...@@ -214,8 +214,7 @@ void GPU_CACHED_MANAGER::uploadToGpu() ...@@ -214,8 +214,7 @@ void GPU_CACHED_MANAGER::uploadToGpu()
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
prof_end( &totalTime ); prof_end( &totalTime );
wxLogDebug( wxT( "Uploading %d vertices to GPU / %.1f ms" ), wxLogDebug( wxT( "Uploading %d vertices to GPU / %.1f ms" ), bufferSize, totalTime.msecs() );
bufferSize, (double) totalTime.value / 1000.0 );
#endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */
} }
......
...@@ -1053,8 +1053,8 @@ void CALLBACK ErrorCallback( GLenum aErrorCode ) ...@@ -1053,8 +1053,8 @@ void CALLBACK ErrorCallback( GLenum aErrorCode )
{ {
const GLubyte* eString = gluErrorString( aErrorCode ); const GLubyte* eString = gluErrorString( aErrorCode );
DisplayError( NULL, wxString( std::string( "Tessellation error: " ) + DisplayError( NULL, wxT( "Tessellation error: " ) +
std::string( (const char*)( eString ) ) ) ); wxString( (const char*)( eString ), wxConvUTF8 ) );
exit( 1 ); exit( 1 );
} }
......
...@@ -188,7 +188,9 @@ void GRID_TRICKS::onKeyDown( wxKeyEvent& ev ) ...@@ -188,7 +188,9 @@ void GRID_TRICKS::onKeyDown( wxKeyEvent& ev )
cutcopy( true ); cutcopy( true );
} }
else else
ev.Skip(); {
ev.Skip( true );
}
} }
......
...@@ -68,7 +68,7 @@ int64_t rescale( int64_t aNumerator, int64_t aValue, int64_t aDenominator ) ...@@ -68,7 +68,7 @@ int64_t rescale( int64_t aNumerator, int64_t aValue, int64_t aDenominator )
a0 = a0 * b0 + t1a; a0 = a0 * b0 + t1a;
a1 = a1 * b1 + ( t1 >> 32 ) + ( a0 < t1a ); a1 = a1 * b1 + ( t1 >> 32 ) + ( a0 < t1a );
a0 += r; a0 += r;
a1 += ( (uint64_t) a0 ) < r; a1 += a0 < (uint64_t)r;
for( i = 63; i >= 0; i-- ) for( i = 63; i >= 0; i-- )
{ {
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file profile.h:
* @brief Simple profiling functions for measuring code execution time.
*/
#ifndef __TPROFILE_H
#define __TPROFILE_H
#include <sys/time.h>
#include <stdint.h>
/**
* Function rdtsc
* Returns processor's time-stamp counter. Main purpose is precise time measuring of code
* execution time.
* @return unsigned long long - Value of time-stamp counter.
*/
#if defined(__i386__)
static __inline__ unsigned long long rdtsc()
{
unsigned long long int x;
__asm__ volatile ( ".byte 0x0f, 0x31" : "=A" ( x ) );
return x;
}
#elif defined(__x86_64__)
static __inline__ unsigned long long rdtsc()
{
unsigned hi, lo;
__asm__ __volatile__ ( "rdtsc" : "=a" ( lo ), "=d" ( hi ) );
return ( (unsigned long long) lo ) | ( ( (unsigned long long) hi ) << 32 );
}
#elif defined(__powerpc__)
static __inline__ unsigned long long rdtsc()
{
unsigned long long int result = 0;
unsigned long int upper, lower, tmp;
__asm__ volatile (
"0: \n"
"\tmftbu %0 \n"
"\tmftb %1 \n"
"\tmftbu %2 \n"
"\tcmpw %2,%0 \n"
"\tbne 0b \n"
: "=r" ( upper ), "=r" ( lower ), "=r" ( tmp )
);
result = upper;
result = result << 32;
result = result | lower;
return result;
}
#endif /* __powerpc__ */
// Fixme: OS X version
/**
* Function get_tics
* Returns the number of microseconds that have elapsed since the system was started.
* @return uint64_t Number of microseconds.
*/
static inline uint64_t get_tics()
{
struct timeval tv;
gettimeofday( &tv, NULL );
return (uint64_t) tv.tv_sec * 1000000ULL + (uint64_t) tv.tv_usec;
}
/**
* Structure for storing data related to profiling counters.
*/
struct prof_counter
{
uint64_t value; /// Stored timer value
bool use_rdtsc; /// Method of time measuring (rdtsc or tics)
};
/**
* Function prof_start
* Begins code execution time counting for a given profiling counter.
* @param cnt is the counter which should be started.
* @param use_rdtsc tells if processor's time-stamp counter should be used for time counting.
* Otherwise is system tics method will be used. IMPORTANT: time-stamp counter should not
* be used on multicore machines executing threaded code.
*/
static inline void prof_start( prof_counter* cnt, bool use_rdtsc )
{
cnt->use_rdtsc = use_rdtsc;
if( use_rdtsc )
{
cnt->value = rdtsc();
}
else
{
cnt->value = get_tics();
}
}
/**
* Function prof_stop
* Ends code execution time counting for a given profiling counter.
* @param cnt is the counter which should be stopped.
*/
static inline void prof_end( prof_counter* cnt )
{
if( cnt->use_rdtsc )
cnt->value = rdtsc() - cnt->value;
else
cnt->value = get_tics() - cnt->value;
}
#endif
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <gr_basic.h>
#include <common.h> #include <common.h>
#include <colors.h> #include <colors.h>
...@@ -64,7 +63,7 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent, ...@@ -64,7 +63,7 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent,
const wxPoint& framepos, const wxPoint& framepos,
int OldColor ) : int OldColor ) :
wxDialog( parent, -1, _( "Colors" ), framepos, wxDefaultSize, wxDialog( parent, -1, _( "Colors" ), framepos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER ) wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{ {
Init_Dialog( OldColor ); Init_Dialog( OldColor );
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file string.cpp * @file string.cpp
* @brief Some useful functions to handle strings. * @brief Some useful functions to handle strings.
...@@ -5,9 +28,18 @@ ...@@ -5,9 +28,18 @@
#include <fctsys.h> #include <fctsys.h>
#include <macros.h> #include <macros.h>
#include <richio.h> // StrPrintf
#include <kicad_string.h> #include <kicad_string.h>
/**
* Illegal file name characters used to insure file names will be valid on all supported
* platforms. This is the list of illegal file name characters for Windows which includes
* the illegal file name characters for Linux and OSX.
*/
static const char illegalFileNameChars[] = "\\/:\"<>|";
int ReadDelimitedText( wxString* aDest, const char* aSource ) int ReadDelimitedText( wxString* aDest, const char* aSource )
{ {
std::string utf8; // utf8 but without escapes and quotes. std::string utf8; // utf8 but without escapes and quotes.
...@@ -414,3 +446,34 @@ int SplitString( wxString strToSplit, ...@@ -414,3 +446,34 @@ int SplitString( wxString strToSplit,
return 0; return 0;
} }
wxString GetIllegalFileNameWxChars()
{
return FROM_UTF8( illegalFileNameChars );
}
bool ReplaceIllegalFileNameChars( std::string* aName )
{
bool changed = false;
std::string result;
for( std::string::iterator it = aName->begin(); it != aName->end(); ++it )
{
if( strchr( illegalFileNameChars, *it ) )
{
StrPrintf( &result, "%%%02x", *it );
changed = true;
}
else
{
result += *it;
}
}
if( changed )
*aName = result;
return changed;
}
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
#include "jump_x86_64_sysv_elf_gas.S" #include "jump_x86_64_sysv_elf_gas.S"
#include "make_x86_64_sysv_elf_gas.S" #include "make_x86_64_sysv_elf_gas.S"
#elif __arm__
#include "jump_arm_aapcs_elf_gas.S"
#include "make_arm_aapcs_elf_gas.S"
#else #else
#error "Missing make_fcontext & jump_fcontext routines for this architecture" #error "Missing make_fcontext & jump_fcontext routines for this architecture"
#endif #endif
......
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************************
* *
* ------------------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
* ------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| 0x20| 0x24| *
* ------------------------------------------------------------- *
* | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | sp | lr | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 10 | | *
* ------------------------------------------------------------- *
* | 0x28| | *
* ------------------------------------------------------------- *
* | pc | | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 11 | 12 | | *
* ------------------------------------------------------------- *
* | 0x2c| 0x30| | *
* ------------------------------------------------------------- *
* | sp | size| | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | *
* ------------------------------------------------------------- *
* | 0x34| 0x38|0x3c| 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58 | *
* ------------------------------------------------------------- *
* | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | s24 | s25 | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 23 | 24 | 25 | 26 | 27 | 28 | | *
* ------------------------------------------------------------- *
* | 0x5c| 0x60| 0x64| 0x68| 0x6c| 0x70| | *
* ------------------------------------------------------------- *
* | s26 | s27 | s28 | s29 | s30 | s31 | | *
* ------------------------------------------------------------- *
* *
* *****************************************************************/
.text
.globl jump_fcontext
.align 2
.type jump_fcontext,%function
jump_fcontext:
stmia a1, {v1-v8,sp-lr} @ save V1-V8,SP-LR
str lr, [a1,#40] @ save LR as PC
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
cmp a4, #0 @ test if fpu env should be preserved
beq 1f
mov a4, a1
add a4, #52
vstmia a4, {d8-d15} @ save S16-S31
mov a4, a2
add a4, #52
vldmia a4, {d8-d15} @ restore S16-S31
1:
#endif
mov a1, a3 @ use third arg as return value after jump
@ and as first arg in context function
ldmia a2, {v1-v8,sp-pc} @ restore v1-V8,SP-PC
.size jump_fcontext,.-jump_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
/*
Copyright Oliver Kowalke 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*******************************************************************
* *
* ------------------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
* ------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| 0x20| 0x24| *
* ------------------------------------------------------------- *
* | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | sp | lr | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 10 | | *
* ------------------------------------------------------------- *
* | 0x28| | *
* ------------------------------------------------------------- *
* | pc | | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 11 | 12 | | *
* ------------------------------------------------------------- *
* | 0x2c| 0x30| | *
* ------------------------------------------------------------- *
* | sp | size| | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | *
* ------------------------------------------------------------- *
* | 0x34| 0x38|0x3c| 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58 | *
* ------------------------------------------------------------- *
* | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | s24 | s25 | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 23 | 24 | 25 | 26 | 27 | 28 | | *
* ------------------------------------------------------------- *
* | 0x5c| 0x60| 0x64| 0x68| 0x6c| 0x70| | *
* ------------------------------------------------------------- *
* | s26 | s27 | s28 | s29 | s30 | s31 | | *
* ------------------------------------------------------------- *
* *
* *****************************************************************/
.text
.globl make_fcontext
.align 2
.type make_fcontext,%function
make_fcontext:
mov a4, a1 @ save address of context stack (base) A4
sub a1, a1, #116 @ reserve space for fcontext_t at top of context stack
@ shift address in A1 to lower 16 byte boundary
@ == pointer to fcontext_t and address of context stack
bic a1, a1, #15
str a4, [a1,#44] @ save address of context stack (base) in fcontext_t
str a2, [a1,#48] @ save context stack size in fcontext_t
str a3, [a1,#40] @ save address of context function in fcontext_t
str a1, [a1,#32] @ save address in A4 as stack pointer for context function
adr a2, finish @ compute abs address of label finish
str a2, [a1,#36] @ save address of finish as return address for context function
@ entered after context function returns
bx lr
finish:
@ SP points to same addras SP on entry of context function
mov a1, #0 @ exit code is zero
bl _exit@PLT @ exit application
.size make_fcontext,.-make_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
...@@ -139,8 +139,9 @@ void TOOL_MANAGER::RegisterTool( TOOL_BASE* aTool ) ...@@ -139,8 +139,9 @@ void TOOL_MANAGER::RegisterTool( TOOL_BASE* aTool )
{ {
if( !static_cast<TOOL_INTERACTIVE*>( aTool )->Init() ) if( !static_cast<TOOL_INTERACTIVE*>( aTool )->Init() )
{ {
DisplayError( NULL, wxString( std::string( "Initialization of the %s tool failed" ) + std::string msg = StrPrintf( "Initialization of the %s tool failed", aTool->GetName().c_str() );
aTool->GetName() ) );
DisplayError( NULL, wxString::FromUTF8( msg.c_str() ) );
// Unregister the tool // Unregister the tool
m_toolState.erase( aTool ); m_toolState.erase( aTool );
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2013 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file validators.cpp
* @brief Custom text control validator implementations.
*/
#include <kicad_string.h>
#include <validators.h>
FOOTPRINT_NAME_VALIDATOR::FOOTPRINT_NAME_VALIDATOR( wxString* aValue ) :
wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, aValue )
{
// The Windows (DOS) file system forbidden characters already include the forbidden
// file name characters for both Posix and OSX systems. The characters \/*?|"<> are
// illegal and filtered by the validator.
wxString illegalChars = GetIllegalFileNameWxChars();
wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST );
wxArrayString illegalCharList;
for( unsigned i = 0; i < illegalChars.size(); i++ )
illegalCharList.Add( wxString( illegalChars[i] ) );
SetExcludes( illegalCharList );
}
...@@ -985,7 +985,7 @@ void VIEW::RecacheAllItems( bool aImmediately ) ...@@ -985,7 +985,7 @@ void VIEW::RecacheAllItems( bool aImmediately )
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
prof_counter totalRealTime; prof_counter totalRealTime;
prof_start( &totalRealTime, false ); prof_start( &totalRealTime );
#endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */
for( LAYER_MAP_ITER i = m_layers.begin(); i != m_layers.end(); ++i ) for( LAYER_MAP_ITER i = m_layers.begin(); i != m_layers.end(); ++i )
...@@ -1006,7 +1006,7 @@ void VIEW::RecacheAllItems( bool aImmediately ) ...@@ -1006,7 +1006,7 @@ void VIEW::RecacheAllItems( bool aImmediately )
prof_end( &totalRealTime ); prof_end( &totalRealTime );
wxLogDebug( wxT( "RecacheAllItems::immediately: %u %.1f ms" ), wxLogDebug( wxT( "RecacheAllItems::immediately: %u %.1f ms" ),
aImmediately, (double) totalRealTime.value / 1000.0 ); aImmediately, totalRealTime.msecs() );
#endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */
} }
......
...@@ -61,7 +61,7 @@ private: ...@@ -61,7 +61,7 @@ private:
const wxString& aCaption = _( "EESchema Colors" ), const wxString& aCaption = _( "EESchema Colors" ),
const wxPoint& aPosition = wxDefaultPosition, const wxPoint& aPosition = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize, const wxSize& aSize = wxDefaultSize,
long aStyle = wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER ); long aStyle = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
// Initializes member variables // Initializes member variables
void Init(); void Init();
......
...@@ -793,13 +793,15 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -793,13 +793,15 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
rotateCheckBox->SetValue( field.GetOrientation() == TEXT_ORIENT_VERT ); rotateCheckBox->SetValue( field.GetOrientation() == TEXT_ORIENT_VERT );
// Copy the text justification // Copy the text justification
EDA_TEXT_HJUSTIFY_T hjustify[3] = { static const EDA_TEXT_HJUSTIFY_T hjustify[] = {
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_HJUSTIFY_RIGHT GR_TEXT_HJUSTIFY_RIGHT
}; };
EDA_TEXT_VJUSTIFY_T vjustify[3] = { static const EDA_TEXT_VJUSTIFY_T vjustify[] = {
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
GR_TEXT_VJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP GR_TEXT_VJUSTIFY_TOP
}; };
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2008 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -295,7 +295,7 @@ void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent ) ...@@ -295,7 +295,7 @@ void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
m_Parent->OnModify(); m_Parent->OnModify();
/* Make the text size as new default size if it is a new text */ // Make the text size the new default size ( if it is a new text ):
if( m_CurrentText->IsNew() ) if( m_CurrentText->IsNew() )
m_Parent->SetDefaultLabelSize( m_CurrentText->GetSize().x ); m_Parent->SetDefaultLabelSize( m_CurrentText->GetSize().x );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 30 2013) // C++ code generated with wxFormBuilder (version Nov 5 2013)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -43,7 +43,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE ...@@ -43,7 +43,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
bSizerFiledsList->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 ); bSizerFiledsList->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 );
bSizerFieldsSetup->Add( bSizerFiledsList, 1, wxEXPAND, 5 ); bSizerFieldsSetup->Add( bSizerFiledsList, 3, wxEXPAND, 5 );
wxBoxSizer* fieldEditBoxSizer; wxBoxSizer* fieldEditBoxSizer;
fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL ); fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL );
...@@ -179,7 +179,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE ...@@ -179,7 +179,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
bSizerFieldsSetup->Add( fieldEditBoxSizer, 0, wxEXPAND, 5 ); bSizerFieldsSetup->Add( fieldEditBoxSizer, 2, wxEXPAND, 5 );
mainSizer->Add( bSizerFieldsSetup, 1, wxEXPAND, 5 ); mainSizer->Add( bSizerFieldsSetup, 1, wxEXPAND, 5 );
......
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="precompiled_header"></property>
<property name="relative_path">1</property> <property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
...@@ -45,7 +47,7 @@ ...@@ -45,7 +47,7 @@
<property name="size">-1,-1</property> <property name="size">-1,-1</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property> <property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Fields Properties</property> <property name="title">Field Properties</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
...@@ -103,17 +105,17 @@ ...@@ -103,17 +105,17 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">3</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizerFiledsList</property> <property name="name">bSizerFiledsList</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">8</property> <property name="border">8</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxListCtrl" expanded="1"> <object class="wxListCtrl" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
...@@ -214,11 +216,11 @@ ...@@ -214,11 +216,11 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
...@@ -302,11 +304,11 @@ ...@@ -302,11 +304,11 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
...@@ -390,11 +392,11 @@ ...@@ -390,11 +392,11 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
...@@ -483,7 +485,7 @@ ...@@ -483,7 +485,7 @@
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">2</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">fieldEditBoxSizer</property> <property name="name">fieldEditBoxSizer</property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 30 2013) // C++ code generated with wxFormBuilder (version Nov 5 2013)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -80,7 +80,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog ...@@ -80,7 +80,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog
public: public:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Field Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE(); ~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE();
}; };
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012) // C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -93,7 +93,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow ...@@ -93,7 +93,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
wxString m_TextVJustificationOptChoices[] = { _("Align bottom"), _("Align center"), _("Align top") }; wxString m_TextVJustificationOptChoices[] = { _("Align bottom"), _("Align center"), _("Align top") };
int m_TextVJustificationOptNChoices = sizeof( m_TextVJustificationOptChoices ) / sizeof( wxString ); int m_TextVJustificationOptNChoices = sizeof( m_TextVJustificationOptChoices ) / sizeof( wxString );
m_TextVJustificationOpt = new wxRadioBox( this, wxID_ANY, _("Verticle Justify"), wxDefaultPosition, wxDefaultSize, m_TextVJustificationOptNChoices, m_TextVJustificationOptChoices, 1, wxRA_SPECIFY_COLS ); m_TextVJustificationOpt = new wxRadioBox( this, wxID_ANY, _("Vertical Justify"), wxDefaultPosition, wxDefaultSize, m_TextVJustificationOptNChoices, m_TextVJustificationOptChoices, 1, wxRA_SPECIFY_COLS );
m_TextVJustificationOpt->SetSelection( 1 ); m_TextVJustificationOpt->SetSelection( 1 );
bBottomtBoxSizer->Add( m_TextVJustificationOpt, 1, wxALL|wxEXPAND, 5 ); bBottomtBoxSizer->Add( m_TextVJustificationOpt, 1, wxALL|wxEXPAND, 5 );
......
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="precompiled_header"></property>
<property name="relative_path">1</property> <property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property> <property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
...@@ -1150,7 +1152,7 @@ ...@@ -1150,7 +1152,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Verticle Justify</property> <property name="label">Vertical Justify</property>
<property name="majorDimension">1</property> <property name="majorDimension">1</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012) // C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
......
...@@ -664,7 +664,7 @@ ...@@ -664,7 +664,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Number of &amp;parts per package:</property> <property name="label">Number of units per &amp;package:</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
...@@ -1094,7 +1094,7 @@ ...@@ -1094,7 +1094,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Units in package locked (cannot be swapped)</property> <property name="label">Units are not &amp;interchangeable</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
......
...@@ -81,7 +81,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -81,7 +81,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer4->Add( 12, 0, 0, wxEXPAND, 3 ); bSizer4->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Number of &parts per package:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText4 = new wxStaticText( this, wxID_ANY, _("Number of units per &package:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 ); m_staticText4->Wrap( -1 );
m_staticText4->SetToolTip( _("This is the number of parts in this component package.\nA 74LS00 gate has 4 parts per packages.") ); m_staticText4->SetToolTip( _("This is the number of parts in this component package.\nA 74LS00 gate has 4 parts per packages.") );
...@@ -133,7 +133,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, ...@@ -133,7 +133,7 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
bSizer9->Add( 12, 0, 0, wxEXPAND, 3 ); bSizer9->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Units in package locked (cannot be swapped)"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Units are not &interchangeable"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkLockItems->SetToolTip( _("Check this option if Eeschema cannot change parts selections inside a given package\nThis happens when parts are different in this package.\nWhen this option is not checked, Eeschema automatically choose the parts in packages to minimize packages count") ); m_checkLockItems->SetToolTip( _("Check this option if Eeschema cannot change parts selections inside a given package\nThis happens when parts are different in this package.\nWhen this option is not checked, Eeschema automatically choose the parts in packages to minimize packages count") );
bSizer9->Add( m_checkLockItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); bSizer9->Add( m_checkLockItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -105,7 +105,6 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType ) ...@@ -105,7 +105,6 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
textItem->SetSize( wxSize( GetDefaultLabelSize(), GetDefaultLabelSize() ) ); textItem->SetSize( wxSize( GetDefaultLabelSize(), GetDefaultLabelSize() ) );
textItem->SetFlags( IS_NEW | IS_MOVED ); textItem->SetFlags( IS_NEW | IS_MOVED );
textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
EditSchematicText( textItem ); EditSchematicText( textItem );
if( textItem->GetText().IsEmpty() ) if( textItem->GetText().IsEmpty() )
...@@ -123,7 +122,8 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType ) ...@@ -123,7 +122,8 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
lastGlobalLabelShape = textItem->GetShape(); lastGlobalLabelShape = textItem->GetShape();
} }
textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); // Prepare display to move the new item
textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( (SCH_ITEM*) textItem, aDC ); MoveItem( (SCH_ITEM*) textItem, aDC );
return textItem; return textItem;
......
...@@ -138,7 +138,8 @@ void SCH_EDIT_FRAME::InstallHierarchyFrame( wxDC* DC, wxPoint& pos ) ...@@ -138,7 +138,8 @@ void SCH_EDIT_FRAME::InstallHierarchyFrame( wxDC* DC, wxPoint& pos )
HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPoint& pos ) : HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPoint& pos ) :
wxDialog( parent, -1, _( "Navigator" ), pos, wxSize( 110, 50 ), DIALOG_STYLE ) wxDialog( parent, -1, _( "Navigator" ), pos, wxSize( 110, 50 ),
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{ {
wxTreeItemId cellule; wxTreeItemId cellule;
......
...@@ -484,7 +484,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf ...@@ -484,7 +484,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
} }
EDA_RECT LIB_ARC::GetBoundingBox() const const EDA_RECT LIB_ARC::GetBoundingBox() const
{ {
int minX, minY, maxX, maxY, angleStart, angleEnd; int minX, minY, maxX, maxY, angleStart, angleEnd;
EDA_RECT rect; EDA_RECT rect;
......
...@@ -104,7 +104,7 @@ public: ...@@ -104,7 +104,7 @@ public:
bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform ); bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
......
...@@ -378,7 +378,7 @@ bool LIB_BEZIER::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra ...@@ -378,7 +378,7 @@ bool LIB_BEZIER::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra
} }
EDA_RECT LIB_BEZIER::GetBoundingBox() const const EDA_RECT LIB_BEZIER::GetBoundingBox() const
{ {
EDA_RECT rect; EDA_RECT rect;
int xmin, xmax, ymin, ymax; int xmin, xmax, ymin, ymax;
......
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform ); bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
bool Inside( EDA_RECT& aRect ) const; bool Inside( EDA_RECT& aRect ) const;
......
...@@ -105,7 +105,7 @@ bool LIB_CIRCLE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra ...@@ -105,7 +105,7 @@ bool LIB_CIRCLE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra
if( aThreshold < 0 ) if( aThreshold < 0 )
aThreshold = GetPenSize() / 2; aThreshold = GetPenSize() / 2;
int dist = KiROUND( GetLineLength( aPosRef, aTransform.TransformCoordinate( m_Pos ) ) ); int dist = KiROUND( GetLineLength( aPosRef, aTransform.TransformCoordinate( m_Pos ) ) );
if( abs( dist - m_Radius ) <= aThreshold ) if( abs( dist - m_Radius ) <= aThreshold )
return true; return true;
...@@ -251,7 +251,7 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -251,7 +251,7 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
} }
EDA_RECT LIB_CIRCLE::GetBoundingBox() const const EDA_RECT LIB_CIRCLE::GetBoundingBox() const
{ {
EDA_RECT rect; EDA_RECT rect;
......
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
int GetPenSize( ) const; int GetPenSize( ) const;
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
......
...@@ -260,7 +260,7 @@ public: ...@@ -260,7 +260,7 @@ public:
/** /**
* @return the boundary box for this, in library coordinates * @return the boundary box for this, in library coordinates
*/ */
virtual EDA_RECT GetBoundingBox() const { return EDA_ITEM::GetBoundingBox(); } virtual const EDA_RECT GetBoundingBox() const { return EDA_ITEM::GetBoundingBox(); }
/** /**
* Function GetMsgPanelInfo * Function GetMsgPanelInfo
......
...@@ -524,7 +524,7 @@ wxString LIB_FIELD::GetFullText( int unit ) ...@@ -524,7 +524,7 @@ wxString LIB_FIELD::GetFullText( int unit )
} }
EDA_RECT LIB_FIELD::GetBoundingBox() const const EDA_RECT LIB_FIELD::GetBoundingBox() const
{ {
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
* calling GetTextBox() that works using top to bottom Y axis orientation. * calling GetTextBox() that works using top to bottom Y axis orientation.
......
...@@ -165,7 +165,7 @@ public: ...@@ -165,7 +165,7 @@ public:
return (m_Attributs & TEXT_NO_VISIBLE) == 0 ? true : false; return (m_Attributs & TEXT_NO_VISIBLE) == 0 ? true : false;
} }
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
......
...@@ -1869,7 +1869,7 @@ void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -1869,7 +1869,7 @@ void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
} }
EDA_RECT LIB_PIN::GetBoundingBox() const const EDA_RECT LIB_PIN::GetBoundingBox() const
{ {
LIB_COMPONENT* entry = (LIB_COMPONENT*) m_Parent; LIB_COMPONENT* entry = (LIB_COMPONENT*) m_Parent;
EDA_RECT bbox; EDA_RECT bbox;
......
...@@ -139,7 +139,7 @@ public: ...@@ -139,7 +139,7 @@ public:
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ); bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
/** /**
* Function ReturnPinEndPoint * Function ReturnPinEndPoint
......
...@@ -353,7 +353,7 @@ bool LIB_POLYLINE::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& ...@@ -353,7 +353,7 @@ bool LIB_POLYLINE::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM&
} }
EDA_RECT LIB_POLYLINE::GetBoundingBox() const const EDA_RECT LIB_POLYLINE::GetBoundingBox() const
{ {
EDA_RECT rect; EDA_RECT rect;
int xmin, xmax, ymin, ymax; int xmin, xmax, ymin, ymax;
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform ); bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
int GetPenSize( ) const; int GetPenSize( ) const;
......
...@@ -256,7 +256,7 @@ void LIB_RECTANGLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -256,7 +256,7 @@ void LIB_RECTANGLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
} }
EDA_RECT LIB_RECTANGLE::GetBoundingBox() const const EDA_RECT LIB_RECTANGLE::GetBoundingBox() const
{ {
EDA_RECT rect; EDA_RECT rect;
......
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
int GetPenSize( ) const; int GetPenSize( ) const;
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
......
...@@ -430,7 +430,7 @@ void LIB_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -430,7 +430,7 @@ void LIB_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
} }
EDA_RECT LIB_TEXT::GetBoundingBox() const const EDA_RECT LIB_TEXT::GetBoundingBox() const
{ {
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
* calling GetTextBox() that works using top to bottom Y axis orientation. * calling GetTextBox() that works using top to bottom Y axis orientation.
......
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // virtual
void Rotate(); void Rotate();
......
...@@ -202,7 +202,6 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, ...@@ -202,7 +202,6 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
{ {
SCH_SHEET* sheet = (SCH_SHEET*) newitem; SCH_SHEET* sheet = (SCH_SHEET*) newitem;
sheet->SetTimeStamp( GetNewTimeStamp() ); sheet->SetTimeStamp( GetNewTimeStamp() );
sheet->SetSon( NULL );
break; break;
} }
......
...@@ -176,7 +176,7 @@ bool SCH_BITMAP::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -176,7 +176,7 @@ bool SCH_BITMAP::Load( LINE_READER& aLine, wxString& aErrorMsg )
} }
EDA_RECT SCH_BITMAP::GetBoundingBox() const const EDA_RECT SCH_BITMAP::GetBoundingBox() const
{ {
EDA_RECT rect = m_Image->GetBoundingBox(); EDA_RECT rect = m_Image->GetBoundingBox();
......
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
*/ */
wxSize GetSize() const; wxSize GetSize() const;
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
void SwapData( SCH_ITEM* aItem ); void SwapData( SCH_ITEM* aItem );
......
...@@ -110,7 +110,7 @@ bool SCH_BUS_BUS_ENTRY::Save( FILE* aFile ) const ...@@ -110,7 +110,7 @@ bool SCH_BUS_BUS_ENTRY::Save( FILE* aFile ) const
} }
bool SCH_BUS_ENTRY_BASE::Load( LINE_READER& aLine, wxString& aErrorMsg, bool SCH_BUS_ENTRY_BASE::Load( LINE_READER& aLine, wxString& aErrorMsg,
SCH_ITEM **out ) SCH_ITEM **out )
{ {
char Name1[256]; char Name1[256];
...@@ -136,7 +136,7 @@ bool SCH_BUS_ENTRY_BASE::Load( LINE_READER& aLine, wxString& aErrorMsg, ...@@ -136,7 +136,7 @@ bool SCH_BUS_ENTRY_BASE::Load( LINE_READER& aLine, wxString& aErrorMsg,
this_new = new SCH_BUS_WIRE_ENTRY; this_new = new SCH_BUS_WIRE_ENTRY;
*out = this_new; *out = this_new;
if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ",
&this_new->m_pos.x, &this_new->m_pos.y, &this_new->m_pos.x, &this_new->m_pos.y,
&this_new->m_size.x, &this_new->m_size.y ) != 4 ) &this_new->m_size.x, &this_new->m_size.y ) != 4 )
{ {
...@@ -153,7 +153,7 @@ bool SCH_BUS_ENTRY_BASE::Load( LINE_READER& aLine, wxString& aErrorMsg, ...@@ -153,7 +153,7 @@ bool SCH_BUS_ENTRY_BASE::Load( LINE_READER& aLine, wxString& aErrorMsg,
} }
EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const
{ {
EDA_RECT box; EDA_RECT box;
......
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
static bool Load( LINE_READER& aLine, wxString& aErrorMsg, SCH_ITEM **out ); static bool Load( LINE_READER& aLine, wxString& aErrorMsg, SCH_ITEM **out );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
void Move( const wxPoint& aMoveVector ) void Move( const wxPoint& aMoveVector )
{ {
......
...@@ -1229,7 +1229,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1229,7 +1229,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
int multi = atoi( name1 ); int multi = atoi( name1 );
if( multi < 0 || multi > 25 ) if( multi < 0 || multi > 26 )
multi = 1; multi = 1;
AddHierarchicalReference( path, ref, multi ); AddHierarchicalReference( path, ref, multi );
...@@ -1430,7 +1430,7 @@ EDA_RECT SCH_COMPONENT::GetBodyBoundingBox() const ...@@ -1430,7 +1430,7 @@ EDA_RECT SCH_COMPONENT::GetBodyBoundingBox() const
} }
EDA_RECT SCH_COMPONENT::GetBoundingBox() const const EDA_RECT SCH_COMPONENT::GetBoundingBox() const
{ {
EDA_RECT bbox = GetBodyBoundingBox(); EDA_RECT bbox = GetBodyBoundingBox();
for( size_t i = 0; i < m_Fields.size(); i++ ) for( size_t i = 0; i < m_Fields.size(); i++ )
......
...@@ -220,7 +220,7 @@ public: ...@@ -220,7 +220,7 @@ public:
*/ */
void SetTimeStamp( time_t aNewTimeStamp ); void SetTimeStamp( time_t aNewTimeStamp );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
//-----<Fields>----------------------------------------------------------- //-----<Fields>-----------------------------------------------------------
......
...@@ -259,7 +259,7 @@ void SCH_FIELD::SwapData( SCH_ITEM* aItem ) ...@@ -259,7 +259,7 @@ void SCH_FIELD::SwapData( SCH_ITEM* aItem )
} }
EDA_RECT SCH_FIELD::GetBoundingBox() const const EDA_RECT SCH_FIELD::GetBoundingBox() const
{ {
SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent; SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent;
int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness; int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;
......
...@@ -100,7 +100,7 @@ public: ...@@ -100,7 +100,7 @@ public:
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ); void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
/** /**
* Function IsVoid * Function IsVoid
......
...@@ -98,7 +98,7 @@ bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -98,7 +98,7 @@ bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg )
} }
EDA_RECT SCH_JUNCTION::GetBoundingBox() const const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
{ {
EDA_RECT rect; EDA_RECT rect;
......
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
void SwapData( SCH_ITEM* aItem ); void SwapData( SCH_ITEM* aItem );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ); GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
......
...@@ -116,7 +116,7 @@ void SCH_LINE::Show( int nestLevel, std::ostream& os ) const ...@@ -116,7 +116,7 @@ void SCH_LINE::Show( int nestLevel, std::ostream& os ) const
#endif #endif
EDA_RECT SCH_LINE::GetBoundingBox() const const EDA_RECT SCH_LINE::GetBoundingBox() const
{ {
int width = 25; int width = 25;
......
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; } void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; }
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
/** /**
* Function GetLength * Function GetLength
......
...@@ -151,7 +151,7 @@ bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocatio ...@@ -151,7 +151,7 @@ bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocatio
* object, and the units should be in the pcb or schematic coordinate system. * object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts. * It is OK to overestimate the size by a few counts.
*/ */
EDA_RECT SCH_MARKER::GetBoundingBox() const const EDA_RECT SCH_MARKER::GetBoundingBox() const
{ {
return GetBoundingBoxMarker(); return GetBoundingBoxMarker();
} }
......
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
EDA_RECT GetBoundingBox() const; EDA_RECT const GetBoundingBox() const; // Virtual
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
......
...@@ -71,7 +71,7 @@ void SCH_NO_CONNECT::SwapData( SCH_ITEM* aItem ) ...@@ -71,7 +71,7 @@ void SCH_NO_CONNECT::SwapData( SCH_ITEM* aItem )
} }
EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const const EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const
{ {
int delta = ( GetPenSize() + m_size.x ) / 2; int delta = ( GetPenSize() + m_size.x ) / 2;
EDA_RECT box; EDA_RECT box;
......
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
bool Load( LINE_READER& aLine, wxString& aErrorMsg ); bool Load( LINE_READER& aLine, wxString& aErrorMsg );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
......
...@@ -628,7 +628,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -628,7 +628,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
} }
EDA_RECT SCH_SHEET::GetBoundingBox() const const EDA_RECT SCH_SHEET::GetBoundingBox() const
{ {
wxPoint end; wxPoint end;
EDA_RECT box( m_pos, m_size ); EDA_RECT box( m_pos, m_size );
......
...@@ -398,7 +398,7 @@ public: ...@@ -398,7 +398,7 @@ public:
GR_DRAWMODE aDrawMode, GR_DRAWMODE aDrawMode,
EDA_COLOR_T aColor = UNSPECIFIED_COLOR ); EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
EDA_RECT GetBoundingBox() const; EDA_RECT const GetBoundingBox() const;
/** /**
* Function GetResizePos * Function GetResizePos
......
...@@ -574,7 +574,7 @@ void SCH_TEXT::GetConnectionPoints( vector< wxPoint >& aPoints ) const ...@@ -574,7 +574,7 @@ void SCH_TEXT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
} }
EDA_RECT SCH_TEXT::GetBoundingBox() const const EDA_RECT SCH_TEXT::GetBoundingBox() const
{ {
// We must pass the effective text thickness to GetTextBox // We must pass the effective text thickness to GetTextBox
// when calculating the bounding box // when calculating the bounding box
...@@ -673,20 +673,17 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) ...@@ -673,20 +673,17 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
if( m_MultilineAllowed ) if( m_MultilineAllowed )
{ {
wxPoint pos = textpos; std::vector<wxPoint> positions;
wxArrayString* list = wxStringSplit( m_Text, '\n' ); wxArrayString* list = wxStringSplit( m_Text, '\n' );
wxPoint offset; positions.reserve( list->Count() );
offset.y = GetInterline(); GetPositionsOfLinesOfMultilineText(positions, list->Count() );
RotatePoint( &offset, m_Orient ); for( unsigned ii = 0; ii < list->Count(); ii++ )
for( unsigned i = 0; i<list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString& txt = list->Item( ii );
aPlotter->Text( pos, color, txt, m_Orient, m_Size, m_HJustify, aPlotter->Text( positions[ii], color, txt, m_Orient, m_Size, m_HJustify,
m_VJustify, thickness, m_Italic, m_Bold ); m_VJustify, thickness, m_Italic, m_Bold );
pos += offset;
} }
delete (list); delete (list);
...@@ -969,7 +966,7 @@ void SCH_LABEL::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, ...@@ -969,7 +966,7 @@ void SCH_LABEL::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
} }
EDA_RECT SCH_LABEL::GetBoundingBox() const const EDA_RECT SCH_LABEL::GetBoundingBox() const
{ {
int x, y, dx, dy, length, height; int x, y, dx, dy, length, height;
...@@ -1397,7 +1394,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const ...@@ -1397,7 +1394,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
} }
EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
{ {
int x, y, dx, dy, length, height; int x, y, dx, dy, length, height;
...@@ -1663,7 +1660,7 @@ void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wx ...@@ -1663,7 +1660,7 @@ void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wx
} }
EDA_RECT SCH_HIERLABEL::GetBoundingBox() const const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
{ {
int x, y, dx, dy, length, height; int x, y, dx, dy, length, height;
......
...@@ -151,7 +151,7 @@ public: ...@@ -151,7 +151,7 @@ public:
virtual void SwapData( SCH_ITEM* aItem ); virtual void SwapData( SCH_ITEM* aItem );
virtual EDA_RECT GetBoundingBox() const; virtual const EDA_RECT GetBoundingBox() const;
virtual bool Save( FILE* aFile ) const; virtual bool Save( FILE* aFile ) const;
...@@ -249,7 +249,7 @@ public: ...@@ -249,7 +249,7 @@ public:
void Rotate( wxPoint aPosition ); void Rotate( wxPoint aPosition );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
...@@ -298,7 +298,7 @@ public: ...@@ -298,7 +298,7 @@ public:
bool Load( LINE_READER& aLine, wxString& aErrorMsg ); bool Load( LINE_READER& aLine, wxString& aErrorMsg );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& aPos ); void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& aPos );
...@@ -353,7 +353,7 @@ public: ...@@ -353,7 +353,7 @@ public:
bool Load( LINE_READER& aLine, wxString& aErrorMsg ); bool Load( LINE_READER& aLine, wxString& aErrorMsg );
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
void MirrorY( int aYaxis_position ); void MirrorY( int aYaxis_position );
......
...@@ -117,6 +117,8 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -117,6 +117,8 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
m_lastSheetPinType = sheetPin->GetShape(); m_lastSheetPinType = sheetPin->GetShape();
m_lastSheetPinTextSize = sheetPin->GetSize(); m_lastSheetPinTextSize = sheetPin->GetSize();
sheetPin->SetPosition( GetCrossHairPosition() );
sheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( (SCH_ITEM*) sheetPin, aDC ); MoveItem( (SCH_ITEM*) sheetPin, aDC );
OnModify(); OnModify();
...@@ -160,7 +162,9 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::ImportSheetPin( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -160,7 +162,9 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::ImportSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
sheetPin->SetSize( m_lastSheetPinTextSize ); sheetPin->SetSize( m_lastSheetPinTextSize );
m_lastSheetPinType = label->GetShape(); m_lastSheetPinType = label->GetShape();
sheetPin->SetShape( label->GetShape() ); sheetPin->SetShape( label->GetShape() );
sheetPin->SetPosition( GetCrossHairPosition() );
sheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( (SCH_ITEM*) sheetPin, aDC ); MoveItem( (SCH_ITEM*) sheetPin, aDC );
return sheetPin; return sheetPin;
......
...@@ -234,7 +234,7 @@ D_CODE* GERBER_DRAW_ITEM::GetDcodeDescr() ...@@ -234,7 +234,7 @@ D_CODE* GERBER_DRAW_ITEM::GetDcodeDescr()
} }
EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
{ {
// return a rectangle which is (pos,dim) in nature. therefore the +1 // return a rectangle which is (pos,dim) in nature. therefore the +1
EDA_RECT bbox( m_Start, wxSize( 1, 1 ) ); EDA_RECT bbox( m_Start, wxSize( 1, 1 ) );
......
...@@ -218,7 +218,7 @@ public: ...@@ -218,7 +218,7 @@ public:
*/ */
D_CODE* GetDcodeDescr(); D_CODE* GetDcodeDescr();
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const; // Virtual
/* Display on screen: */ /* Display on screen: */
void Draw( EDA_DRAW_PANEL* aPanel, void Draw( EDA_DRAW_PANEL* aPanel,
......
...@@ -86,7 +86,7 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, ...@@ -86,7 +86,7 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
bool aShowDeselectOption ) : bool aShowDeselectOption ) :
wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ), wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ),
wxSize( 470, 250 ), wxSize( 470, 250 ),
DIALOG_STYLE ) wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{ {
wxButton* Button; wxButton* Button;
LAYER_NUM ii; LAYER_NUM ii;
......
...@@ -283,7 +283,7 @@ public: ...@@ -283,7 +283,7 @@ public:
* useful to calculate bounding box of rotated items, when * useful to calculate bounding box of rotated items, when
* rotation if not k*90 degrees * rotation if not k*90 degrees
*/ */
EDA_RECT GetBoundingBoxRotated( wxPoint aRotCenter, double aAngle ); const EDA_RECT GetBoundingBoxRotated( wxPoint aRotCenter, double aAngle );
}; };
...@@ -346,8 +346,7 @@ protected: ...@@ -346,8 +346,7 @@ protected:
EDA_ITEM* Pback; ///< previous in linked list EDA_ITEM* Pback; ///< previous in linked list
DHEAD* m_List; ///< which DLIST I am on. DHEAD* m_List; ///< which DLIST I am on.
EDA_ITEM* m_Parent; /* Linked list: Link (parent struct) */ EDA_ITEM* m_Parent; ///< Linked list: Link (parent struct)
EDA_ITEM* m_Son; /* Linked list: Link (son struct) */
time_t m_TimeStamp; ///< Time stamp used for logical links time_t m_TimeStamp; ///< Time stamp used for logical links
/// Set to true to override the visibility setting of the item. /// Set to true to override the visibility setting of the item.
...@@ -379,13 +378,11 @@ public: ...@@ -379,13 +378,11 @@ public:
EDA_ITEM* Next() const { return (EDA_ITEM*) Pnext; } EDA_ITEM* Next() const { return (EDA_ITEM*) Pnext; }
EDA_ITEM* Back() const { return (EDA_ITEM*) Pback; } EDA_ITEM* Back() const { return (EDA_ITEM*) Pback; }
EDA_ITEM* GetParent() const { return m_Parent; } EDA_ITEM* GetParent() const { return m_Parent; }
EDA_ITEM* GetSon() const { return m_Son; }
DHEAD* GetList() const { return m_List; } DHEAD* GetList() const { return m_List; }
void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; } void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; }
void SetBack( EDA_ITEM* aBack ) { Pback = aBack; } void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
void SetParent( EDA_ITEM* aParent ) { m_Parent = aParent; } void SetParent( EDA_ITEM* aParent ) { m_Parent = aParent; }
void SetSon( EDA_ITEM* aSon ) { m_Son = aSon; }
void SetList( DHEAD* aList ) { m_List = aList; } void SetList( DHEAD* aList ) { m_List = aList; }
inline bool IsNew() const { return m_Flags & IS_NEW; } inline bool IsNew() const { return m_Flags & IS_NEW; }
...@@ -479,7 +476,7 @@ public: ...@@ -479,7 +476,7 @@ public:
* system. * system.
* It is OK to overestimate the size by a few counts. * It is OK to overestimate the size by a few counts.
*/ */
virtual EDA_RECT GetBoundingBox() const virtual const EDA_RECT GetBoundingBox() const
{ {
#if defined(DEBUG) #if defined(DEBUG)
printf( "Missing GetBoundingBox()\n" ); printf( "Missing GetBoundingBox()\n" );
......
...@@ -130,6 +130,17 @@ public: ...@@ -130,6 +130,17 @@ public:
virtual void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, virtual void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) = 0; GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) = 0;
/**
* Swap data between aItem and aImage.
* aItem and aImage should have the same type
* Used in undo redo command to swap values between an item and its copy
* Only values like layer, size .. which are modified by edition are swapped,
* not the pointers like
* Pnext and Pback because aItem is not changed in the linked list
* @param aImage = the item image which contains data to swap
*/
void SwapData( BOARD_ITEM* aImage );
/** /**
* Function IsOnLayer * Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so * tests to see if this object is on the given layer. Is virtual so
...@@ -172,11 +183,13 @@ public: ...@@ -172,11 +183,13 @@ public:
/** /**
* Function DeleteStructure * Function DeleteStructure
* deletes this object after UnLink()ing it from its owner. * deletes this object after UnLink()ing it from its owner if it has one.
*/ */
void DeleteStructure() void DeleteStructure()
{ {
UnLink(); if( GetList() != NULL )
UnLink();
delete this; delete this;
} }
......
...@@ -74,7 +74,8 @@ public: ...@@ -74,7 +74,8 @@ public:
const wxString& aRefText, const wxString& aRefText,
void(*aCallBackFunction)(wxString& Text) = NULL, void(*aCallBackFunction)(wxString& Text) = NULL,
bool aSortList = false ); bool aSortList = false );
~EDA_LIST_DIALOG();
// ~EDA_LIST_DIALOG() {}
void Append( const wxArrayString& aItemStr ); void Append( const wxArrayString& aItemStr );
void InsertItems( const std::vector<wxArrayString>& aItemList, int aPosition = 0 ); void InsertItems( const std::vector<wxArrayString>& aItemList, int aPosition = 0 );
......
...@@ -52,15 +52,20 @@ public: ...@@ -52,15 +52,20 @@ public:
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE, long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxDialogNameStr ); const wxString& name = wxDialogNameStr
);
bool Show( bool show ); // overload wxDialog::Show bool Show( bool show ); // overload wxDialog::Show
protected:
std::string m_hash_key; // alternate for class_map when classname re-used.
#if DLGSHIM_USE_SETFOCUS #if DLGSHIM_USE_SETFOCUS
private: private:
void onInit( wxInitDialogEvent& aEvent ); void onInit( wxInitDialogEvent& aEvent );
#endif #endif
}; };
#endif // DIALOG_SHIM_ #endif // DIALOG_SHIM_
...@@ -265,6 +265,17 @@ public: ...@@ -265,6 +265,17 @@ public:
void SetHorizJustify( EDA_TEXT_HJUSTIFY_T aType ) { m_HJustify = aType; }; void SetHorizJustify( EDA_TEXT_HJUSTIFY_T aType ) { m_HJustify = aType; };
void SetVertJustify( EDA_TEXT_VJUSTIFY_T aType ) { m_VJustify = aType; }; void SetVertJustify( EDA_TEXT_VJUSTIFY_T aType ) { m_VJustify = aType; };
/**
* Function GetPositionsOfLinesOfMultilineText
* Populates aPositions with the position of each line of
* a multiline text, according to the vertical justification and the
* rotation of the whole text
* @param aPositions is the list to populate by the wxPoint positions
* @param aLineCount is the number of lines (not recalculated here
* for efficiency reasons
*/
void GetPositionsOfLinesOfMultilineText(
std::vector<wxPoint>& aPositions, int aLineCount );
/** /**
* Function Format * Function Format
* outputs the object to \a aFormatter in s-expression form. * outputs the object to \a aFormatter in s-expression form.
......
...@@ -26,32 +26,6 @@ ...@@ -26,32 +26,6 @@
#define DBG(x) // nothing #define DBG(x) // nothing
#endif #endif
/**
* Function Clamp
* limits @a value within the range @a lower <= @a value <= @a upper. It will work
* on temporary expressions, since they are evaluated only once, and it should work
* on most if not all numeric types, string types, or any type for which "operator < ()"
* is present. The arguments are accepted in this order so you can remember the
* expression as a memory aid:
* <p>
* result is: lower <= value <= upper
*/
template <typename T> inline const T& Clamp( const T& lower, const T& value, const T& upper )
{
wxASSERT( lower <= upper );
if( value < lower )
return lower;
else if( upper < value )
return upper;
return value;
}
#define USE_RESIZE_BORDER
#if defined(__UNIX__) || defined(USE_RESIZE_BORDER)
#define MAYBE_RESIZE_BORDER wxRESIZE_BORDER // Linux users like resizeable borders
#else
#define MAYBE_RESIZE_BORDER 0 // no resizeable border
#endif
// wxNullPtr is not defined prior to wxWidgets 2.9.0. // wxNullPtr is not defined prior to wxWidgets 2.9.0.
#if !wxCHECK_VERSION( 2, 9, 0 ) #if !wxCHECK_VERSION( 2, 9, 0 )
......
...@@ -27,13 +27,15 @@ ...@@ -27,13 +27,15 @@
#define FP_LIB_TABLE_H_ #define FP_LIB_TABLE_H_
#include <macros.h> #include <macros.h>
#include <vector> #include <vector>
#include <map> #include <map>
#include <io_mgr.h> #include <io_mgr.h>
#define FP_LATE_ENVVAR 1 ///< late=1/early=0 environment variable expansion
#define KISYSMOD "KISYSMOD"
class wxFileName; class wxFileName;
class OUTPUTFORMATTER; class OUTPUTFORMATTER;
class MODULE; class MODULE;
...@@ -120,44 +122,17 @@ public: ...@@ -120,44 +122,17 @@ public:
SetType( aType ); SetType( aType );
} }
ROW( const ROW& a ) : ROW( const ROW& a );
nickName( a.nickName ),
uri_user( a.uri_user ),
uri_expanded( a.uri_expanded ),
type( a.type ),
options( a.options ),
description( a.description ),
properties( 0 )
{
if( a.properties )
properties = new PROPERTIES( *a.properties );
}
~ROW() ~ROW()
{ {
delete properties; delete properties;
} }
ROW& operator=( const ROW& r ) ROW& operator=( const ROW& r );
{
nickName = r.nickName;
uri_user = r.uri_user;
uri_expanded = r.uri_expanded;
type = r.type;
options = r.options;
description = r.description;
properties = r.properties ? new PROPERTIES( *r.properties ) : NULL;
// do not copy the PLUGIN, it is lazily created.
setPlugin( NULL );
return *this;
}
bool operator==( const ROW& r ) const /// Used in DIALOG_FP_LIB_TABLE for detecting an edit.
{ bool operator==( const ROW& r ) const;
return nickName==r.nickName && uri_user==r.uri_user && type==r.type && options==r.options;
}
bool operator!=( const ROW& r ) const { return !( *this == r ); } bool operator!=( const ROW& r ) const { return !( *this == r ); }
...@@ -194,13 +169,7 @@ public: ...@@ -194,13 +169,7 @@ public:
* *
* @param aSubstituted Tells if caller wanted the substituted form, else not. * @param aSubstituted Tells if caller wanted the substituted form, else not.
*/ */
const wxString& GetFullURI( bool aSubstituted = false ) const const wxString GetFullURI( bool aSubstituted = false ) const;
{
if( aSubstituted )
return uri_expanded;
else
return uri_user;
}
/** /**
* Function SetFullURI * Function SetFullURI
...@@ -278,7 +247,11 @@ public: ...@@ -278,7 +247,11 @@ public:
wxString nickName; wxString nickName;
wxString uri_user; ///< what user entered from UI or loaded from disk wxString uri_user; ///< what user entered from UI or loaded from disk
#if !FP_LATE_ENVVAR
wxString uri_expanded; ///< from ExpandSubstitutions() wxString uri_expanded; ///< from ExpandSubstitutions()
#endif
LIB_T type; LIB_T type;
wxString options; wxString options;
wxString description; wxString description;
...@@ -421,6 +394,16 @@ public: ...@@ -421,6 +394,16 @@ public:
*/ */
MODULE* FootprintLoad( const wxString& aNickname, const wxString& aFootprintName ); MODULE* FootprintLoad( const wxString& aNickname, const wxString& aFootprintName );
/**
* Enum SAVE_T
* is the set of return values from FootprintSave() below.
*/
enum SAVE_T
{
SAVE_OK,
SAVE_SKIPPED,
};
/** /**
* Function FootprintSave * Function FootprintSave
* will write @a aFootprint to an existing library given by @a aNickname. * will write @a aFootprint to an existing library given by @a aNickname.
...@@ -432,9 +415,14 @@ public: ...@@ -432,9 +415,14 @@ public:
* @param aFootprint is what to store in the library. The caller continues * @param aFootprint is what to store in the library. The caller continues
* to own the footprint after this call. * to own the footprint after this call.
* *
* @param aOverwrite when true means overwrite any existing footprint by the
* same name, else if false means skip the write and return SAVE_SKIPPED.
*
* @return SAVE_T - SAVE_OK or SAVE_SKIPPED. If error saving, then IO_ERROR is thrown.
*
* @throw IO_ERROR if there is a problem saving. * @throw IO_ERROR if there is a problem saving.
*/ */
void FootprintSave( const wxString& aNickname, const MODULE* aFootprint ); SAVE_T FootprintSave( const wxString& aNickname, const MODULE* aFootprint, bool aOverwrite = true );
/** /**
* Function FootprintDelete * Function FootprintDelete
...@@ -458,8 +446,18 @@ public: ...@@ -458,8 +446,18 @@ public:
*/ */
bool IsFootprintLibWritable( const wxString& aNickname ); bool IsFootprintLibWritable( const wxString& aNickname );
void FootprintLibDelete( const wxString& aNickname );
void FootprintLibCreate( const wxString& aNickname );
//-----</PLUGIN API SUBSET, REBASED ON aNickname>--------------------------- //-----</PLUGIN API SUBSET, REBASED ON aNickname>---------------------------
/**
* Function GetDescription
* returns the library desicription from @a aNickname, or an empty string
* if aNickname does not exist.
*/
const wxString GetDescription( const wxString& aNickname );
/** /**
* Function InsertRow * Function InsertRow
...@@ -567,7 +565,22 @@ public: ...@@ -567,7 +565,22 @@ public:
static void SetProjectPathEnvVariable( const wxFileName& aPath ); static void SetProjectPathEnvVariable( const wxFileName& aPath );
const wxString& GetProjectPathEnvVariableName() const; /**
* Function ProjectPathEnvVarVariableName
* returns the name of the environment variable used to hold the directory of
* the current project on program startup.
*/
static const wxString ProjectPathEnvVariableName();
/**
* Function GlobalPathEnvVarVariableName
* returns the name of the environment variable used to hold the directory of
* locally installed "KiCad sponsored" system footprint libraries. These can
* be either legacy or pretty format. The only thing special about this
* particular environment variable is that it is set automatically by
* KiCad on program startup, <b>iff</b> it is not set already in the environment.
*/
static const wxString GlobalPathEnvVariableName();
static wxString GetProjectFileName( const wxFileName& aPath ); static wxString GetProjectFileName( const wxFileName& aPath );
...@@ -587,10 +600,10 @@ protected: ...@@ -587,10 +600,10 @@ protected:
/** /**
* Function findRow * Function findRow
* returns a ROW if aNickName is found in this table or in any chained * returns a ROW if aNickname is found in this table or in any chained
* fallBack table fragment, else NULL. * fallBack table fragment, else NULL.
*/ */
ROW* findRow( const wxString& aNickName ) const; ROW* findRow( const wxString& aNickname ) const;
void reindex() void reindex()
{ {
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* This file is part of the common library \n
* Custom string manipulation routines.
* @file kicad_string.h * @file kicad_string.h
* @see common.h, string.cpp * @see common.h, string.cpp
*/ */
...@@ -10,6 +31,7 @@ ...@@ -10,6 +31,7 @@
#define KICAD_STRING_H_ #define KICAD_STRING_H_
#include <wx/string.h> #include <wx/string.h>
#include <wx/filename.h>
/** /**
...@@ -57,7 +79,7 @@ std::string EscapedUTF8( const wxString& aString ); ...@@ -57,7 +79,7 @@ std::string EscapedUTF8( const wxString& aString );
char* GetLine( FILE* aFile, char* Line, int* LineNum = NULL, int SizeLine = 255 ); char* GetLine( FILE* aFile, char* Line, int* LineNum = NULL, int SizeLine = 255 );
/** /**
* Funxtion StrPurge * Function StrPurge
* removes leading and training spaces, tabs and end of line chars in \a text * removes leading and training spaces, tabs and end of line chars in \a text
* return a pointer on the first n char in text * return a pointer on the first n char in text
*/ */
...@@ -79,7 +101,7 @@ wxString DateAndTime(); ...@@ -79,7 +101,7 @@ wxString DateAndTime();
* *
* @param aString1 A wxChar pointer to the reference string. * @param aString1 A wxChar pointer to the reference string.
* @param aString2 A wxChar pointer to the comparison string. * @param aString2 A wxChar pointer to the comparison string.
* @param aLength The numbere of characters to compare. Set to -1 to compare * @param aLength The number of characters to compare. Set to -1 to compare
* the entire string. * the entire string.
* @param aIgnoreCase Use true to make the comparison case insensitive. * @param aIgnoreCase Use true to make the comparison case insensitive.
* @return An integer value of -1 if \a aString1 is less than \a aString2, 0 if * @return An integer value of -1 if \a aString1 is less than \a aString2, 0 if
...@@ -121,4 +143,25 @@ int SplitString( wxString strToSplit, ...@@ -121,4 +143,25 @@ int SplitString( wxString strToSplit,
wxString* strDigits, wxString* strDigits,
wxString* strEnd ); wxString* strEnd );
/**
* Function GetIllegalFileNameWxChars
* @return a wString object containing the illegal file name characters for all platforms.
*/
wxString GetIllegalFileNameWxChars();
/**
* Function ReplaceIllegalFileNameChars
* checks \a aName for illegal file name characters.
*
* The Windows (DOS) file system forbidden characters already include the forbidden file
* name characters for both Posix and OSX systems. The characters \/?*|"\<\> are illegal
* and are replaced with %xx where xx the hexadecimal equivalent of the replaced character.
* This replacement may not be as elegant as using an underscore ('_') or hyphen ('-') but
* it guarentees that there will be no naming conflicts when fixing footprint library names.
*
* @param aName is a point to a std::string object containing the footprint name to verify.
* @return true if any characters have been replaced in \a aName.
*/
bool ReplaceIllegalFileNameChars( std::string* aName );
#endif // KICAD_STRING_H_ #endif // KICAD_STRING_H_
...@@ -77,4 +77,25 @@ template <class T, class T2> inline void EXCHG( T& a, T2& b ) ...@@ -77,4 +77,25 @@ template <class T, class T2> inline void EXCHG( T& a, T2& b )
b = temp; b = temp;
} }
/**
* Function Clamp
* limits @a value within the range @a lower <= @a value <= @a upper. It will work
* on temporary expressions, since they are evaluated only once, and it should work
* on most if not all numeric types, string types, or any type for which "operator < ()"
* is present. The arguments are accepted in this order so you can remember the
* expression as a memory aid:
* <p>
* result is: lower <= value <= upper
*/
template <typename T> inline const T& Clamp( const T& lower, const T& value, const T& upper )
{
wxASSERT( lower <= upper );
if( value < lower )
return lower;
else if( upper < value )
return upper;
return value;
}
#endif /* ifdef MACRO_H */ #endif /* ifdef MACRO_H */
...@@ -31,60 +31,9 @@ ...@@ -31,60 +31,9 @@
#define __TPROFILE_H #define __TPROFILE_H
#include <sys/time.h> #include <sys/time.h>
#include <string>
#include <stdint.h> #include <stdint.h>
/**
* Function rdtsc
* Returns processor's time-stamp counter. Main purpose is precise time measuring of code
* execution time.
* @return unsigned long long - Value of time-stamp counter.
*/
#if defined(__i386__)
static __inline__ unsigned long long rdtsc()
{
unsigned long long int x;
__asm__ volatile ( ".byte 0x0f, 0x31" : "=A" ( x ) );
return x;
}
#elif defined(__x86_64__)
static __inline__ unsigned long long rdtsc()
{
unsigned hi, lo;
__asm__ __volatile__ ( "rdtsc" : "=a" ( lo ), "=d" ( hi ) );
return ( (unsigned long long) lo ) | ( ( (unsigned long long) hi ) << 32 );
}
#elif defined(__powerpc__)
static __inline__ unsigned long long rdtsc()
{
unsigned long long int result = 0;
unsigned long int upper, lower, tmp;
__asm__ volatile (
"0: \n"
"\tmftbu %0 \n"
"\tmftb %1 \n"
"\tmftbu %2 \n"
"\tcmpw %2,%0 \n"
"\tbne 0b \n"
: "=r" ( upper ), "=r" ( lower ), "=r" ( tmp )
);
result = upper;
result = result << 32;
result = result | lower;
return result;
}
#endif /* __powerpc__ */
// Fixme: OS X version
/** /**
* Function get_tics * Function get_tics
* Returns the number of microseconds that have elapsed since the system was started. * Returns the number of microseconds that have elapsed since the system was started.
...@@ -98,14 +47,22 @@ static inline uint64_t get_tics() ...@@ -98,14 +47,22 @@ static inline uint64_t get_tics()
return (uint64_t) tv.tv_sec * 1000000ULL + (uint64_t) tv.tv_usec; return (uint64_t) tv.tv_sec * 1000000ULL + (uint64_t) tv.tv_usec;
} }
/** /**
* Structure for storing data related to profiling counters. * Structure for storing data related to profiling counters.
*/ */
struct prof_counter struct prof_counter
{ {
uint64_t value; /// Stored timer value uint64_t start, end; // Stored timer value
bool use_rdtsc; /// Method of time measuring (rdtsc or tics)
uint64_t usecs() const
{
return end - start;
}
float msecs() const
{
return ( end - start ) / 1000.0;
}
}; };
/** /**
...@@ -116,32 +73,19 @@ struct prof_counter ...@@ -116,32 +73,19 @@ struct prof_counter
* Otherwise is system tics method will be used. IMPORTANT: time-stamp counter should not * Otherwise is system tics method will be used. IMPORTANT: time-stamp counter should not
* be used on multicore machines executing threaded code. * be used on multicore machines executing threaded code.
*/ */
static inline void prof_start( prof_counter* cnt, bool use_rdtsc ) static inline void prof_start( prof_counter* aCnt )
{ {
cnt->use_rdtsc = use_rdtsc; aCnt->start = get_tics();
if( use_rdtsc )
{
cnt->value = rdtsc();
}
else
{
cnt->value = get_tics();
}
} }
/** /**
* Function prof_stop * Function prof_stop
* Ends code execution time counting for a given profiling counter. * Ends code execution time counting for a given profiling counter.
* @param cnt is the counter which should be stopped. * @param cnt is the counter which should be stopped.
*/ */
static inline void prof_end( prof_counter* cnt ) static inline void prof_end( prof_counter* aCnt )
{ {
if( cnt->use_rdtsc ) aCnt->end = get_tics();
cnt->value = rdtsc() - cnt->value;
else
cnt->value = get_tics() - cnt->value;
} }
#endif #endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment