diff --git a/3d-viewer/3d_canvas.cpp b/3d-viewer/3d_canvas.cpp index 315e406b00..f1139f0d75 100644 --- a/3d-viewer/3d_canvas.cpp +++ b/3d-viewer/3d_canvas.cpp @@ -66,7 +66,7 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas ) // mouse events EVT_RIGHT_DOWN( EDA_3D_CANVAS::OnRightClick ) EVT_MOUSEWHEEL( EDA_3D_CANVAS::OnMouseWheel ) -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) EVT_MAGNIFY( EDA_3D_CANVAS::OnMagnify ) #endif EVT_MOTION( EDA_3D_CANVAS::OnMouseMove ) @@ -319,7 +319,7 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event ) } -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event ) { double magnification = ( event.GetMagnification() + 1.0f ); diff --git a/3d-viewer/3d_canvas.h b/3d-viewer/3d_canvas.h index 1f1ff5dd9c..cd41efe99e 100644 --- a/3d-viewer/3d_canvas.h +++ b/3d-viewer/3d_canvas.h @@ -134,7 +134,7 @@ public: void OnEraseBackground( wxEraseEvent& event ); void OnChar( wxKeyEvent& event ); void OnMouseWheel( wxMouseEvent& event ); -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) void OnMagnify( wxMouseEvent& event ); #endif void OnMouseMove( wxMouseEvent& event ); diff --git a/common/class_page_info.cpp b/common/class_page_info.cpp index 30a694a0e1..2cf94d4cc2 100644 --- a/common/class_page_info.cpp +++ b/common/class_page_info.cpp @@ -89,36 +89,6 @@ const PAGE_INFO PAGE_INFO::pageUSLedger( wxSize( 17000, 11000 ), wxT( "USLedge int PAGE_INFO::s_user_width = 17000; int PAGE_INFO::s_user_height = 11000; -/* -wxArrayString PAGE_INFO::GetStandardSizes() -{ - wxArrayString ret; - - static const PAGE_INFO* stdPageSizes[] = { - &pageA4, - &pageA3, - &pageA2, - &pageA1, - &pageA0, - &pageA, - &pageB, - &pageC, - &pageD, - &pageE, - // &pageGERBER, // standard? - &pageUSLetter, - &pageUSLegal, - &pageUSLedger, - &pageUser, - }; - - for( unsigned i=0; i < DIM( stdPageSizes ); ++i ) - ret.Add( stdPageSizes[i]->GetType() ); - - return ret; -} -*/ - inline void PAGE_INFO::updatePortrait() { diff --git a/common/confirm.cpp b/common/confirm.cpp index 7aeb85f451..4e0b4abc45 100644 --- a/common/confirm.cpp +++ b/common/confirm.cpp @@ -27,14 +27,12 @@ * @brief utilities to display some error, warning and info short messges */ -#include -#include -#include -#include #include + +#include #include #include -#include + class DIALOG_EXIT: public DIALOG_EXIT_BASE { diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 93bd8c7231..819d68a893 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -52,26 +52,29 @@ // List of page formats. -// should be statically initialized, because we need both -// the translated and the not translated version. +// they are prefixed by "_HKI" (already in use for hotkeys) instead of "_", +// because we need both the translated and the not translated version. // when displayed in dialog we should explicitely call wxGetTranslation() // to show the translated version. +// See hotkeys_basic.h for more info +#define _HKI( x ) wxT( x ) static const wxString pageFmts[] = { - _("A4 210x297mm"), - _("A3 297x420mm"), - _("A2 420x594mm"), - _("A1 594x841mm"), - _("A0 841x1189mm"), - _("A 8.5x11in"), - _("B 11x17in"), - _("C 17x22in"), - _("D 22x34in"), - _("E 34x44in"), - _("USLetter 8.5x11in"), // USLetter without space is correct - _("USLegal 8.5x14in"), // USLegal without space is correct - _("USLedger 11x17in"), // USLedger without space is correct - _("User (Custom)"), + _HKI("A4 210x297mm"), + _HKI("A3 297x420mm"), + _HKI("A2 420x594mm"), + _HKI("A1 594x841mm"), + _HKI("A0 841x1189mm"), + _HKI("A 8.5x11in"), + _HKI("B 11x17in"), + _HKI("C 17x22in"), + _HKI("D 22x34in"), + _HKI("E 34x44in"), + _HKI("USLetter 8.5x11in"), // USLetter without space is correct + _HKI("USLegal 8.5x14in"), // USLegal without space is correct + _HKI("USLedger 11x17in"), // USLedger without space is correct + _HKI("User (Custom)"), // size defined by user. The string must contain "Custom" + // to be reconized in code }; void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event ) diff --git a/common/displlst.cpp b/common/displlst.cpp index b8961f6ad6..7e2eddda2d 100644 --- a/common/displlst.cpp +++ b/common/displlst.cpp @@ -161,7 +161,7 @@ void EDA_LIST_DIALOG::Append( const wxArrayString& itemList ) { long itemIndex = m_listBox->InsertItem( m_listBox->GetItemCount(), itemList[0] ); - m_listBox->SetItemData( itemIndex, (long) &(itemList[0]) ); + m_listBox->SetItemPtrData( itemIndex, wxUIntPtr( &itemList[0] ) ); // Adding the next columns content for( unsigned i = 1; i < itemList.size(); i++ ) @@ -184,7 +184,7 @@ void EDA_LIST_DIALOG::InsertItems( const std::vector< wxArrayString >& itemList, if( col == 0 ) { itemIndex = m_listBox->InsertItem( row+position, itemList[row].Item( col ) ); - m_listBox->SetItemData( itemIndex, (long) &itemList[row].Item( col ) ); + m_listBox->SetItemPtrData( itemIndex, wxUIntPtr( &itemList[row].Item( col ) ) ); } else { diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 42936ef233..63c7974d4a 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -594,7 +594,7 @@ void EDA_DRAW_FRAME::SetPresetGrid( int aIndex ) } -int EDA_DRAW_FRAME::BlockCommand( int key ) +int EDA_DRAW_FRAME::BlockCommand( EDA_KEY key ) { return 0; } @@ -767,7 +767,7 @@ wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMil } -bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosition ) +bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition ) { BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp index 063c5db5a3..4bfcaad92d 100644 --- a/common/draw_panel.cpp +++ b/common/draw_panel.cpp @@ -72,7 +72,7 @@ BEGIN_EVENT_TABLE( EDA_DRAW_PANEL, wxScrolledWindow ) EVT_LEAVE_WINDOW( EDA_DRAW_PANEL::OnMouseLeaving ) EVT_ENTER_WINDOW( EDA_DRAW_PANEL::OnMouseEntering ) EVT_MOUSEWHEEL( EDA_DRAW_PANEL::OnMouseWheel ) -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) EVT_MAGNIFY( EDA_DRAW_PANEL::OnMagnify ) #endif EVT_MOUSE_EVENTS( EDA_DRAW_PANEL::OnMouseEvent ) @@ -994,7 +994,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) } -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) void EDA_DRAW_PANEL::OnMagnify( wxMouseEvent& event ) { // Scale the panel around our cursor position. diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index c060ab5041..cccc5dd357 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -83,7 +83,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK, wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK, wxEVT_MOTION, wxEVT_MOUSEWHEEL, wxEVT_CHAR, -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) wxEVT_MAGNIFY, #endif KIGFX::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index 07714ec775..b7ead4cbc7 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -257,38 +257,6 @@ void CAIRO_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd } -void CAIRO_GAL::DrawPolyline( std::deque& aPointList ) -{ - // Iterate over the point list and draw the segments - std::deque::const_iterator it = aPointList.begin(); - - cairo_move_to( currentContext, it->x, it->y ); - - for( ++it; it != aPointList.end(); ++it ) - { - cairo_line_to( currentContext, it->x, it->y ); - } - - isElementAdded = true; -} - - -void CAIRO_GAL::DrawPolygon( const std::deque& aPointList ) -{ - // Iterate over the point list and draw the polygon - std::deque::const_iterator it = aPointList.begin(); - - cairo_move_to( currentContext, it->x, it->y ); - - for( ++it; it != aPointList.end(); ++it ) - { - cairo_line_to( currentContext, it->x, it->y ); - } - - isElementAdded = true; -} - - void CAIRO_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControlPointA, const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint ) { @@ -1059,6 +1027,39 @@ void CAIRO_GAL::setCompositor() } +void CAIRO_GAL::drawPoly( const std::deque& aPointList ) +{ + // Iterate over the point list and draw the segments + std::deque::const_iterator it = aPointList.begin(); + + cairo_move_to( currentContext, it->x, it->y ); + + for( ++it; it != aPointList.end(); ++it ) + { + cairo_line_to( currentContext, it->x, it->y ); + } + + isElementAdded = true; +} + + +void CAIRO_GAL::drawPoly( const VECTOR2D aPointList[], int aListSize ) +{ + // Iterate over the point list and draw the segments + const VECTOR2D* ptr = aPointList; + + cairo_move_to( currentContext, ptr->x, ptr->y ); + + for( int i = 0; i < aListSize; ++i ) + { + ++ptr; + cairo_line_to( currentContext, ptr->x, ptr->y ); + } + + isElementAdded = true; +} + + unsigned int CAIRO_GAL::getNewGroupNumber() { wxASSERT_MSG( groups.size() < std::numeric_limits::max(), diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 73c71fb207..e830c38b06 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2012 Torsten Hueter, torstenhtr gmx.de * Copyright (C) 2012 Kicad Developers, see change_log.txt for contributors. - * Copyright (C) 2013-2015 CERN + * Copyright (C) 2013-2016 CERN * @author Maciej Suminski * * Graphics Abstraction Layer (GAL) for OpenGL @@ -89,7 +89,7 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); Connect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) Connect( wxEVT_MAGNIFY, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); #endif #if defined _WIN32 || defined _WIN64 @@ -448,7 +448,7 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn } -void OPENGL_GAL::DrawPolyline( std::deque& aPointList ) +void OPENGL_GAL::DrawPolyline( const std::deque& aPointList ) { if( aPointList.empty() ) return; @@ -476,19 +476,43 @@ void OPENGL_GAL::DrawPolyline( std::deque& aPointList ) } +void OPENGL_GAL::DrawPolyline( const VECTOR2D aPointList[], int aListSize ) +{ + currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); + + // Start from the second point + for( int i = 1; i < aListSize; ++i ) + { + const VECTOR2D startEndVector = ( aPointList[i] - aPointList[i - 1] ); + double lineAngle = startEndVector.Angle(); + + drawLineQuad( aPointList[i - 1], aPointList[i] ); + + // There is no need to draw line caps on both ends of polyline's segments + drawFilledSemiCircle( aPointList[i - 1], lineWidth / 2, lineAngle + M_PI / 2 ); + } + + // ..and now - draw the ending cap + const VECTOR2D startEndVector = ( aPointList[aListSize - 1] - aPointList[aListSize - 2] ); + double lineAngle = startEndVector.Angle(); + drawFilledSemiCircle( aPointList[aListSize - 1], lineWidth / 2, lineAngle - M_PI / 2 ); +} + + void OPENGL_GAL::DrawPolygon( const std::deque& aPointList ) { - // Any non convex polygon needs to be tesselated - // for this purpose the GLU standard functions are used currentManager->Shader( SHADER_NONE ); currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); + // Any non convex polygon needs to be tesselated + // for this purpose the GLU standard functions are used TessParams params = { currentManager, tessIntersects }; gluTessBeginPolygon( tesselator, ¶ms ); gluTessBeginContour( tesselator ); boost::shared_array points( new GLdouble[3 * aPointList.size()] ); int v = 0; + for( std::deque::const_iterator it = aPointList.begin(); it != aPointList.end(); ++it ) { points[v] = it->x; @@ -508,6 +532,41 @@ void OPENGL_GAL::DrawPolygon( const std::deque& aPointList ) } +void OPENGL_GAL::DrawPolygon( const VECTOR2D aPointList[], int aListSize ) +{ + currentManager->Shader( SHADER_NONE ); + currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); + + // Any non convex polygon needs to be tesselated + // for this purpose the GLU standard functions are used + TessParams params = { currentManager, tessIntersects }; + gluTessBeginPolygon( tesselator, ¶ms ); + gluTessBeginContour( tesselator ); + + boost::shared_array points( new GLdouble[3 * aListSize] ); + int v = 0; + const VECTOR2D* ptr = aPointList; + + for( int i = 0; i < aListSize; ++i ) + { + points[v] = ptr->x; + points[v + 1] = ptr->y; + points[v + 2] = layerDepth; + gluTessVertex( tesselator, &points[v], &points[v] ); + ++ptr; + v += 3; + } + + gluTessEndContour( tesselator ); + gluTessEndPolygon( tesselator ); + + // Free allocated intersecting points + tessIntersects.clear(); + + // vertexList destroyed here +} + + void OPENGL_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControlPointA, const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint ) { diff --git a/common/kicad_curl/kicad_curl.cpp b/common/kicad_curl/kicad_curl.cpp index 3201bf743f..fe899603ea 100644 --- a/common/kicad_curl/kicad_curl.cpp +++ b/common/kicad_curl/kicad_curl.cpp @@ -23,12 +23,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +// kicad_curl.h must be included before xw headers, to avoid +// conflicts for some defines, at least on Windows +#include + #include #include #include #include -#include #include // MUTEX and MUTLOCK #include diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index 97127cef49..55d0742e3c 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -250,7 +250,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) // Mouse handling if( type == wxEVT_MOTION || type == wxEVT_MOUSEWHEEL || -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) type == wxEVT_MAGNIFY || #endif type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_UP || diff --git a/common/trigo.cpp b/common/trigo.cpp index 4f29125588..b6be2033fb 100644 --- a/common/trigo.cpp +++ b/common/trigo.cpp @@ -310,7 +310,7 @@ double ArcTangente( int dy, int dx ) } // Of course dy and dx are treated as double - return RAD2DECIDEG( atan2( dy, dx ) ); + return RAD2DECIDEG( atan2( (double) dy, (double) dx ) ); } diff --git a/common/view/view.cpp b/common/view/view.cpp index 8f1933c094..6f94af86ac 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -985,7 +985,7 @@ bool VIEW::areRequiredLayersEnabled( int aLayerId ) const { wxASSERT( (unsigned) aLayerId < m_layers.size() ); - std::set::iterator it, it_end; + std::set::const_iterator it, it_end; for( it = m_layers.at( aLayerId ).requiredLayers.begin(), it_end = m_layers.at( aLayerId ).requiredLayers.end(); it != it_end; ++it ) diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp index 3484a1530c..0ed353e564 100644 --- a/common/view/wx_view_controls.cpp +++ b/common/view/wx_view_controls.cpp @@ -40,7 +40,7 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel { m_parentPanel->Connect( wxEVT_MOTION, wxMouseEventHandler( WX_VIEW_CONTROLS::onMotion ), NULL, this ); -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) m_parentPanel->Connect( wxEVT_MAGNIFY, wxMouseEventHandler( WX_VIEW_CONTROLS::onMagnify ), NULL, this ); #endif @@ -167,7 +167,7 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent ) } -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) void WX_VIEW_CONTROLS::onMagnify( wxMouseEvent& aEvent ) { // Scale based on the magnification from our underlying magnification event. diff --git a/common/widgets/widget_hotkey_list.cpp b/common/widgets/widget_hotkey_list.cpp index 381367020d..00bb23a201 100644 --- a/common/widgets/widget_hotkey_list.cpp +++ b/common/widgets/widget_hotkey_list.cpp @@ -322,6 +322,10 @@ void WIDGET_HOTKEY_LIST::EditItem( wxTreeListItem aItem ) } UpdateFromClientData(); + + // Trigger a resize in case column widths have changed + wxSizeEvent dummy_evt; + OnSize( dummy_evt ); } } @@ -432,9 +436,16 @@ void WIDGET_HOTKEY_LIST::OnSize( wxSizeEvent& aEvent ) if( hk_column_width < HOTKEY_MIN_WIDTH ) hk_column_width = HOTKEY_MIN_WIDTH; + else if( hk_column_width <= 0 ) + hk_column_width = 1; + + int name_column_width = rect.width - hk_column_width - HORIZ_MARGIN; + + if( name_column_width <= 0 ) + name_column_width = 1; SetColumnWidth( 1, hk_column_width ); - SetColumnWidth( 0, rect.width - hk_column_width - HORIZ_MARGIN ); + SetColumnWidth( 0, name_column_width ); } diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index dff95aee86..073844bac3 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -315,7 +315,8 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) } -bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, + EDA_KEY aHotKey ) { bool eventHandled = true; diff --git a/cvpcb/class_DisplayFootprintsFrame.h b/cvpcb/class_DisplayFootprintsFrame.h index 6f4b0e9bb0..f4cbf7c0ee 100644 --- a/cvpcb/class_DisplayFootprintsFrame.h +++ b/cvpcb/class_DisplayFootprintsFrame.h @@ -92,7 +92,7 @@ public: void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); - bool GeneralControl( wxDC* DC, const wxPoint& aPosition, int aHotKey = 0 ); + bool GeneralControl( wxDC* DC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ); void InstallOptionsDisplay( wxCommandEvent& event ); MODULE* Get_Module( const wxString& CmpName ); diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index c8d9a46813..fd13769f4a 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -25,8 +25,6 @@ set( EESCHEMA_DLGS dialogs/dialog_bom.cpp dialogs/dialog_bom_base.cpp dialogs/dialog_bom_cfg_keywords.cpp - dialogs/dialog_color_config.cpp - dialogs/dialog_color_config_base.cpp dialogs/dialog_choose_component.cpp dialogs/dialog_choose_component_base.cpp dialogs/dialog_lib_edit_text.cpp @@ -72,6 +70,11 @@ set( EESCHEMA_DLGS dialogs/dialog_schematic_find_base.cpp ) +set( EESCHEMA_WIDGETS + widgets/widget_eeschema_color_config.cpp + ) + + set( EESCHEMA_SRCS autoplace_fields.cpp annotate.cpp @@ -90,6 +93,7 @@ set( EESCHEMA_SRCS controle.cpp cross-probing.cpp ${EESCHEMA_DLGS} + ${EESCHEMA_WIDGETS} edit_component_in_schematic.cpp edit_bitmap.cpp edit_label.cpp diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index e08efab313..a0b2ab472b 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -93,11 +94,11 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic, { if( aAnnotateSchematic ) { - sheets.GetMultiUnitComponents( Prj().SchLibs(), lockedComponents ); + g_RootSheet->GetMultiUnitComponents( Prj().SchLibs(), lockedComponents ); } else { - m_CurrentSheet->GetMultiUnitComponents( Prj().SchLibs(), lockedComponents ); + m_CurrentSheet->Last()->GetMultiUnitComponents( Prj().SchLibs(), lockedComponents ); } } diff --git a/eeschema/block.cpp b/eeschema/block.cpp index e4b38e9f91..9edd9d43fa 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -62,7 +62,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ); -int SCH_EDIT_FRAME::BlockCommand( int key ) +int SCH_EDIT_FRAME::BlockCommand( EDA_KEY key ) { int cmd = BLOCK_IDLE; diff --git a/eeschema/block_libedit.cpp b/eeschema/block_libedit.cpp index 5dc235f746..865d4e6736 100644 --- a/eeschema/block_libedit.cpp +++ b/eeschema/block_libedit.cpp @@ -41,7 +41,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx bool aErase ); -int LIB_EDIT_FRAME::BlockCommand( int key ) +int LIB_EDIT_FRAME::BlockCommand( EDA_KEY key ) { int cmd = BLOCK_IDLE; @@ -51,11 +51,18 @@ int LIB_EDIT_FRAME::BlockCommand( int key ) cmd = key & 0xFF; break; - case -1: + case EDA_KEY_C( 0xffffffff ): // -1 + // Historically, -1 has been used as a key, which can cause bit flag + // clashes with unaware code. On debug builds, catch any old code that + // might still be doing this. TODO: remove if sure all this old code is gone. + wxFAIL_MSG( "negative EDA_KEY value should be converted to GR_KEY_INVALID" ); + // fall through on release builds + + case GR_KEY_INVALID: cmd = BLOCK_PRESELECT_MOVE; break; - case 0: + case GR_KEY_NONE: cmd = BLOCK_MOVE; break; diff --git a/eeschema/class_sch_screen.h b/eeschema/class_sch_screen.h index a13249098e..180f925775 100644 --- a/eeschema/class_sch_screen.h +++ b/eeschema/class_sch_screen.h @@ -49,6 +49,7 @@ class SCH_SHEET_PIN; class SCH_LINE; class SCH_TEXT; class PLOTTER; +class SCH_SHEET; enum SCH_LINE_TEST_T @@ -500,13 +501,13 @@ public: * searches screen for a component with \a aReference and set the footprint field to * \a aFootPrint if found. * - * @param aSheetPath The sheet path used to look up the reference designator. + * @param aSheet The sheet used to look up the reference designator. * @param aReference The reference designator of the component. * @param aFootPrint The value to set the footprint field. * @param aSetVisible The value to set the field visibility flag. * @return True if \a aReference was found otherwise false. */ - bool SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxString& aReference, + bool SetComponentFootprint( SCH_SHEET* aSheet, const wxString& aReference, const wxString& aFootPrint, bool aSetVisible ); /** diff --git a/eeschema/component_references_lister.cpp b/eeschema/component_references_lister.cpp index bb01190ae1..38619e541f 100644 --- a/eeschema/component_references_lister.cpp +++ b/eeschema/component_references_lister.cpp @@ -736,6 +736,24 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent } +int SCH_REFERENCE::CompareLibName( const SCH_REFERENCE& item ) const +{ + return Cmp_KEEPCASE( m_RootCmp->GetPartName(), item.m_RootCmp->GetPartName() ); +} + + +bool SCH_REFERENCE::IsSameInstance( const SCH_REFERENCE& other ) const +{ + return GetComp() == other.GetComp() && GetSheet()->GetPath() == other.GetSheet()->GetPath(); +} + + +bool SCH_REFERENCE::IsUnitsLocked() const +{ + return m_Entry->UnitsLocked(); +} + + void SCH_REFERENCE::Annotate() { if( m_NumRef < 0 ) diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 99bd9ee755..362b1fc66a 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -187,7 +187,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF if( item ) { if( item->Type() == SCH_COMPONENT_T ) - ( (SCH_COMPONENT*) item )->SetCurrentSheetPath( &GetCurrentSheet() ); + ( (SCH_COMPONENT*) item )->SetCurrentSheet( GetCurrentSheet().Last() ); MSG_PANEL_ITEMS items; item->GetMsgPanelInfo( items ); @@ -202,7 +202,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF } -bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) { bool eventHandled = true; @@ -249,7 +249,7 @@ bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH } -bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) { bool eventHandled = true; @@ -291,7 +291,7 @@ bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH } -bool LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +bool LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) { bool eventHandled = true; diff --git a/eeschema/dialogs/dialog_color_config_base.cpp b/eeschema/dialogs/dialog_color_config_base.cpp deleted file mode 100644 index 8991523b7c..0000000000 --- a/eeschema/dialogs/dialog_color_config_base.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 5 2014) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_color_config_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_COLOR_CONFIG_BASE::DIALOG_COLOR_CONFIG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bmainSizer; - bmainSizer = new wxBoxSizer( wxVERTICAL ); - - m_mainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - - - bmainSizer->Add( m_mainBoxSizer, 1, wxEXPAND, 5 ); - - m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bmainSizer->Add( m_staticline, 0, wxEXPAND | wxALL, 5 ); - - m_sdbSizer = new wxStdDialogButtonSizer(); - m_sdbSizerOK = new wxButton( this, wxID_OK ); - m_sdbSizer->AddButton( m_sdbSizerOK ); - m_sdbSizerApply = new wxButton( this, wxID_APPLY ); - m_sdbSizer->AddButton( m_sdbSizerApply ); - m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizer->AddButton( m_sdbSizerCancel ); - m_sdbSizer->Realize(); - - bmainSizer->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 ); - - - this->SetSizer( bmainSizer ); - this->Layout(); - bmainSizer->Fit( this ); - - this->Centre( wxBOTH ); -} - -DIALOG_COLOR_CONFIG_BASE::~DIALOG_COLOR_CONFIG_BASE() -{ -} diff --git a/eeschema/dialogs/dialog_color_config_base.fbp b/eeschema/dialogs/dialog_color_config_base.fbp deleted file mode 100644 index d739b5795e..0000000000 --- a/eeschema/dialogs/dialog_color_config_base.fbp +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_color_config_base - 1000 - none - 1 - dialog_color_config_base - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - DIALOG_COLOR_CONFIG_BASE - - -1,-1 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - EESchema Colors - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bmainSizer - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - - m_mainBoxSizer - wxHORIZONTAL - protected - - - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer - protected - - - - - - - - - - - - - - diff --git a/eeschema/dialogs/dialog_color_config_base.h b/eeschema/dialogs/dialog_color_config_base.h deleted file mode 100644 index 83697b118c..0000000000 --- a/eeschema/dialogs/dialog_color_config_base.h +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 5 2014) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_COLOR_CONFIG_BASE_H__ -#define __DIALOG_COLOR_CONFIG_BASE_H__ - -#include -#include -#include -class DIALOG_SHIM; - -#include "dialog_shim.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_COLOR_CONFIG_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_COLOR_CONFIG_BASE : public DIALOG_SHIM -{ - private: - - protected: - wxBoxSizer* m_mainBoxSizer; - wxStaticLine* m_staticline; - wxStdDialogButtonSizer* m_sdbSizer; - wxButton* m_sdbSizerOK; - wxButton* m_sdbSizerApply; - wxButton* m_sdbSizerCancel; - - public: - - DIALOG_COLOR_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EESchema Colors"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_COLOR_CONFIG_BASE(); - -}; - -#endif //__DIALOG_COLOR_CONFIG_BASE_H__ diff --git a/eeschema/dialogs/dialog_eeschema_options.cpp b/eeschema/dialogs/dialog_eeschema_options.cpp index 5ce1477ebb..383dfdcb32 100644 --- a/eeschema/dialogs/dialog_eeschema_options.cpp +++ b/eeschema/dialogs/dialog_eeschema_options.cpp @@ -31,6 +31,7 @@ #include #include +#include "../widgets/widget_eeschema_color_config.h" #include #include @@ -59,6 +60,10 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( SCH_EDIT_FRAME* parent ) : m_hotkeyListCtrl = new WIDGET_HOTKEY_LIST( m_panelHotkeys, sections ); m_hotkeyListCtrl->InstallOnPanel( m_panelHotkeys ); + // Embed the color configurator + m_colorConfigCtrl = new WIDGET_EESCHEMA_COLOR_CONFIG( m_panelColors, GetParent() ); + m_colorConfigCtrl->InstallOnPanel( m_panelColors ); + // Make sure we select the first tab of the options tab page m_notebook->SetSelection( 0 ); @@ -288,6 +293,11 @@ bool DIALOG_EESCHEMA_OPTIONS::TransferDataFromWindow() if( !m_hotkeyListCtrl->TransferDataFromControl() ) return false; + GetParent()->WriteHotkeyConfig( g_Eeschema_Hokeys_Descr ); + + if( !m_colorConfigCtrl->TransferDataFromControl() ) + return false; + // Refresh hotkeys GetParent()->ReCreateMenuBar(); GetParent()->Refresh(); diff --git a/eeschema/dialogs/dialog_eeschema_options.h b/eeschema/dialogs/dialog_eeschema_options.h index d5daca2f80..8f18d05ef9 100644 --- a/eeschema/dialogs/dialog_eeschema_options.h +++ b/eeschema/dialogs/dialog_eeschema_options.h @@ -34,13 +34,15 @@ #include #include +class WIDGET_EESCHEMA_COLOR_CONFIG; class WIDGET_HOTKEY_LIST; class SCH_EDIT_FRAME; class DIALOG_EESCHEMA_OPTIONS : public DIALOG_EESCHEMA_OPTIONS_BASE { protected: - WIDGET_HOTKEY_LIST* m_hotkeyListCtrl; + WIDGET_HOTKEY_LIST* m_hotkeyListCtrl; + WIDGET_EESCHEMA_COLOR_CONFIG* m_colorConfigCtrl; /** @brief The template fieldnames for this dialog */ TEMPLATE_FIELDNAMES templateFields; diff --git a/eeschema/dialogs/dialog_eeschema_options_base.cpp b/eeschema/dialogs/dialog_eeschema_options_base.cpp index 9c85f9ddb6..31f17cdd70 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.cpp +++ b/eeschema/dialogs/dialog_eeschema_options_base.cpp @@ -117,7 +117,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx m_panel5->SetSizer( bSizer82 ); m_panel5->Layout(); bSizer82->Fit( m_panel5 ); - m_notebook->AddPage( m_panel5, _("Display"), true ); + m_notebook->AddPage( m_panel5, _("Display"), false ); m_panel3 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer8; bSizer8 = new wxBoxSizer( wxVERTICAL ); @@ -233,7 +233,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx m_panel3->Layout(); bSizer8->Fit( m_panel3 ); m_notebook->AddPage( m_panel3, _("Editing"), false ); - m_controlsPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_tabControls = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer81; bSizer81 = new wxBoxSizer( wxVERTICAL ); @@ -253,46 +253,58 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx wxBoxSizer* bSizer13; bSizer13 = new wxBoxSizer( wxHORIZONTAL ); - m_staticText20 = new wxStaticText( m_controlsPanel, wxID_ANY, _("Hotkeys:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText20 = new wxStaticText( m_tabControls, wxID_ANY, _("Hotkeys:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText20->Wrap( -1 ); bSizer13->Add( m_staticText20, 1, wxALL, 5 ); - m_staticText21 = new wxStaticText( m_controlsPanel, wxID_ANY, _("Double-click to edit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText21 = new wxStaticText( m_tabControls, wxID_ANY, _("Double-click to edit"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText21->Wrap( -1 ); bSizer13->Add( m_staticText21, 0, wxALL, 5 ); m_controlsSizer->Add( bSizer13, 0, wxEXPAND, 5 ); - m_panelHotkeys = new wxPanel( m_controlsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panelHotkeys = new wxPanel( m_tabControls, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_controlsSizer->Add( m_panelHotkeys, 1, wxEXPAND | wxALL, 5 ); - m_checkEnableZoomCenter = new wxCheckBox( m_controlsPanel, wxID_ANY, _("Cen&ter and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkEnableZoomCenter = new wxCheckBox( m_tabControls, wxID_ANY, _("Cen&ter and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkEnableZoomCenter->SetToolTip( _("Keep the cursor at its current location when zooming") ); m_controlsSizer->Add( m_checkEnableZoomCenter, 0, wxTOP|wxRIGHT|wxLEFT, 3 ); - m_checkEnableMiddleButtonPan = new wxCheckBox( m_controlsPanel, xwID_ANY, _("&Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkEnableMiddleButtonPan = new wxCheckBox( m_tabControls, xwID_ANY, _("&Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkEnableMiddleButtonPan->SetToolTip( _("Use middle mouse button dragging to pan") ); m_controlsSizer->Add( m_checkEnableMiddleButtonPan, 0, wxTOP|wxRIGHT|wxLEFT, 3 ); - m_checkMiddleButtonPanLimited = new wxCheckBox( m_controlsPanel, wxID_ANY, _("&Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkMiddleButtonPanLimited = new wxCheckBox( m_tabControls, wxID_ANY, _("&Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkMiddleButtonPanLimited->SetToolTip( _("Middle mouse button panning limited by current scrollbar size") ); m_controlsSizer->Add( m_checkMiddleButtonPanLimited, 0, wxTOP|wxRIGHT|wxLEFT, 3 ); - m_checkAutoPan = new wxCheckBox( m_controlsPanel, wxID_ANY, _("&Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkAutoPan = new wxCheckBox( m_tabControls, wxID_ANY, _("&Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 ); m_controlsSizer->Add( m_checkAutoPan, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 3 ); bSizer81->Add( m_controlsSizer, 1, wxALL|wxEXPAND, 5 ); - m_controlsPanel->SetSizer( bSizer81 ); - m_controlsPanel->Layout(); - bSizer81->Fit( m_controlsPanel ); - m_notebook->AddPage( m_controlsPanel, _("Controls"), false ); + m_tabControls->SetSizer( bSizer81 ); + m_tabControls->Layout(); + bSizer81->Fit( m_tabControls ); + m_notebook->AddPage( m_tabControls, _("Controls"), false ); + m_tabColors = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer14; + bSizer14 = new wxBoxSizer( wxVERTICAL ); + + m_panelColors = new wxPanel( m_tabColors, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + bSizer14->Add( m_panelColors, 1, wxEXPAND | wxALL, 5 ); + + + m_tabColors->SetSizer( bSizer14 ); + m_tabColors->Layout(); + bSizer14->Fit( m_tabColors ); + m_notebook->AddPage( m_tabColors, _("Colors"), true ); m_panel2 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panel2->SetToolTip( _("User defined field names for schematic components. ") ); diff --git a/eeschema/dialogs/dialog_eeschema_options_base.fbp b/eeschema/dialogs/dialog_eeschema_options_base.fbp index 668ac9f496..9e4a0e650e 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.fbp +++ b/eeschema/dialogs/dialog_eeschema_options_base.fbp @@ -187,7 +187,7 @@ Display - 1 + 0 1 1 @@ -3806,7 +3806,7 @@ 0 1 - m_controlsPanel + m_tabControls 1 @@ -3845,7 +3845,7 @@ - + bSizer81 wxVERTICAL @@ -3868,20 +3868,20 @@ 0 - + 5 wxALL|wxEXPAND 1 - + m_controlsSizer wxVERTICAL protected - + 5 wxEXPAND 0 - + bSizer13 wxHORIZONTAL @@ -4054,11 +4054,11 @@ - + 5 wxEXPAND | wxALL 1 - + 1 1 1 @@ -4491,6 +4491,172 @@ + + + Colors + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_tabColors + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer14 + wxVERTICAL + none + + 5 + wxEXPAND | wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panelColors + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default Fields diff --git a/eeschema/dialogs/dialog_eeschema_options_base.h b/eeschema/dialogs/dialog_eeschema_options_base.h index 5b20e1c9f4..eca809b1ac 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.h +++ b/eeschema/dialogs/dialog_eeschema_options_base.h @@ -103,7 +103,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM wxCheckBox* m_checkAutoplaceFields; wxCheckBox* m_checkAutoplaceJustify; wxCheckBox* m_checkAutoplaceAlign; - wxPanel* m_controlsPanel; + wxPanel* m_tabControls; wxBoxSizer* m_controlsSizer; wxStaticText* m_staticText20; wxStaticText* m_staticText21; @@ -112,6 +112,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM wxCheckBox* m_checkEnableMiddleButtonPan; wxCheckBox* m_checkMiddleButtonPanLimited; wxCheckBox* m_checkAutoPan; + wxPanel* m_tabColors; + wxPanel* m_panelColors; wxPanel* m_panel2; wxGrid* m_fieldGrid; wxButton* addFieldButton; diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index 0d899b24dc..3a606a12dd 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -146,7 +146,7 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField ) } MSG_PANEL_ITEMS items; - component->SetCurrentSheetPath( &GetCurrentSheet() ); + component->SetCurrentSheet( GetCurrentSheet().Last() ); component->GetMsgPanelInfo( items ); SetMsgPanel( items ); } diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index cfc062ac4c..1c7703929b 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 804045e45c..f2028eaa54 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -47,7 +47,6 @@ #include -#include #include #include #include @@ -157,14 +156,6 @@ void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event ) } -void LIB_EDIT_FRAME::OnColorConfig( wxCommandEvent& aEvent ) -{ - DIALOG_COLOR_CONFIG dlg( this ); - - dlg.ShowModal(); -} - - void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) { int id = event.GetId(); @@ -195,14 +186,6 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) } -void SCH_EDIT_FRAME::OnColorConfig( wxCommandEvent& aEvent ) -{ - DIALOG_COLOR_CONFIG dlg( this ); - - dlg.ShowModal(); -} - - void SCH_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event ) { // Identical to LIB_EDIT_FRAME::InstallConfigFrame() diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 4ff04e21d5..e0a6ee6417 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -447,6 +447,8 @@ bool SCH_EDIT_FRAME::AppendOneEEProject() bs = nextbs; } } + + OnModify(); // redraw base screen (ROOT) if necessary GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); diff --git a/eeschema/find.cpp b/eeschema/find.cpp index f239ad5727..032dd87ad2 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -71,7 +71,8 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event ) if( event.GetFlags() & FR_CURRENT_SHEET_ONLY ) { sheetFoundIn = m_CurrentSheet; - lastMarker = (SCH_MARKER*) m_CurrentSheet->FindNextItem( SCH_MARKER_T, lastMarker, wrap ); + lastMarker = (SCH_MARKER*) m_CurrentSheet->Last()->FindNextItem( SCH_MARKER_T, + lastMarker, wrap ); } else { diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 63c878e558..a6ca456207 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -221,8 +221,8 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC, return NULL; } - SCH_COMPONENT* component = new SCH_COMPONENT( *part, m_CurrentSheet, unit, convert, - GetCrossHairPosition(), true ); + SCH_COMPONENT* component = new SCH_COMPONENT( *part, m_CurrentSheet->Last(), unit, convert, + GetCrossHairPosition(), true ); // Set the m_ChipName value, from component name in lib, for aliases // Note if part is found, and if name is an alias of a component, @@ -237,7 +237,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC, MSG_PANEL_ITEMS items; - component->SetCurrentSheetPath( &GetCurrentSheet() ); + component->SetCurrentSheet( GetCurrentSheet().Last() ); component->GetMsgPanelInfo( items ); SetMsgPanel( items ); diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index bd489a0a3a..6663cf6f7d 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -130,10 +130,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout ) - EVT_MENU( ID_COLORS_SETUP, LIB_EDIT_FRAME::OnColorConfig ) EVT_MENU( wxID_PREFERENCES, LIB_EDIT_FRAME::OnPreferencesOptions ) EVT_MENU( ID_CONFIG_REQ, LIB_EDIT_FRAME::InstallConfigFrame ) - EVT_MENU( ID_COLORS_SETUP, LIB_EDIT_FRAME::Process_Config ) // Multiple item selection context menu commands. EVT_MENU_RANGE( ID_SELECT_ITEM_START, ID_SELECT_ITEM_END, LIB_EDIT_FRAME::OnSelectItem ) diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h index 6ae14cecf4..06c4169acd 100644 --- a/eeschema/libeditframe.h +++ b/eeschema/libeditframe.h @@ -193,7 +193,6 @@ public: static void EnsureActiveLibExists(); void InstallConfigFrame( wxCommandEvent& event ); - void OnColorConfig( wxCommandEvent& aEvent ); void OnPreferencesOptions( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event ); @@ -333,7 +332,7 @@ public: bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ); - bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ); void LoadSettings( wxConfigBase* aCfg ); @@ -607,7 +606,7 @@ public: * returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to * the \a aKey (ALT, SHIFT ALT ..) */ - virtual int BlockCommand( int aKey ); + virtual int BlockCommand( EDA_KEY aKey ); /** * Function HandleBlockPlace diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 2e8047dada..5ce4edf6a6 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -375,13 +375,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() _( "Configure component libraries and paths" ), KiBitmap( library_xpm ) ); - // Colors - AddMenuItem( preferencesMenu, - ID_COLORS_SETUP, - _( "Set &Colors Scheme" ), - _( "Set color preferences" ), - KiBitmap( palette_xpm ) ); - // Options (Preferences on WXMAC) #ifdef __WXMAC__ diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp index f2c9599107..ed3abe68f7 100644 --- a/eeschema/menubar_libedit.cpp +++ b/eeschema/menubar_libedit.cpp @@ -238,13 +238,6 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() _( "Set Component Editor default values and options" ), KiBitmap( preference_xpm ) ); - // Colors - AddMenuItem( preferencesMenu, - ID_COLORS_SETUP, - _( "Set &Colors Scheme" ), - _( "Set color preferences" ), - KiBitmap( palette_xpm ) ); - // Language submenu Pgm().AddMenuLanguageList( preferencesMenu ); diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 40e1cf0c00..b62a09f293 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -118,22 +118,22 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) : SCH_ITEM( aParent, SCH_COMPONENT_T ) { Init( aPos ); - m_currentSheetPath = NULL; + m_currentSheet = NULL; m_fieldsAutoplaced = AUTOPLACED_NO; } -SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit, +SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET* aSheet, int unit, int convert, const wxPoint& pos, bool setNewItemFlag ) : SCH_ITEM( NULL, SCH_COMPONENT_T ) { Init( pos ); - m_unit = unit; - m_convert = convert; - m_part_name = aPart.GetName(); - m_part = aPart.SharedPtr(); - m_currentSheetPath = NULL; + m_unit = unit; + m_convert = convert; + m_part_name = aPart.GetName(); + m_part = aPart.SharedPtr(); + m_currentSheet = aSheet; m_fieldsAutoplaced = AUTOPLACED_NO; SetTimeStamp( GetNewTimeStamp() ); @@ -186,7 +186,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit, // update the reference -- just the prefix for now. msg += wxT( "?" ); - SetRef( sheet->Last(), msg ); + SetRef( aSheet, msg ); // Use the schematic component name instead of the library value field // name. @@ -197,13 +197,13 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit, SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aComponent ) : SCH_ITEM( aComponent ) { - m_currentSheetPath = NULL; - m_Parent = aComponent.m_Parent; - m_Pos = aComponent.m_Pos; - m_unit = aComponent.m_unit; - m_convert = aComponent.m_convert; - m_part_name = aComponent.m_part_name; - m_part = aComponent.m_part; + m_currentSheet = NULL; + m_Parent = aComponent.m_Parent; + m_Pos = aComponent.m_Pos; + m_unit = aComponent.m_unit; + m_convert = aComponent.m_convert; + m_part_name = aComponent.m_part_name; + m_part = aComponent.m_part; SetTimeStamp( aComponent.m_TimeStamp ); @@ -1528,9 +1528,8 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) if( !alias ) return; - if( m_currentSheetPath ) - aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), - GetRef( m_currentSheetPath->Last() ), + if( m_currentSheet ) + aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), GetRef( m_currentSheet ), DARKCYAN ) ); wxString msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" ); diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index 6dc73c9cc5..9f917f3fef 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -89,12 +89,12 @@ private: AUTOPLACED m_fieldsAutoplaced; ///< indicates status of field autoplacement /** - * A temporary sheet path is required to generate the correct reference designator string + * A temporary sheet is required to generate the correct reference designator string * in complex heirarchies. Hopefully this is only a temporary hack to decouple schematic * objects from the drawing window until a better design for handling complex heirarchies * can be implemented. */ - const SCH_SHEET_PATH* m_currentSheetPath; + const SCH_SHEET* m_currentSheet; /** * Defines the hierarchical path and reference of the component. This allows support @@ -121,7 +121,7 @@ public: * @param pos - Position to place new component. * @param setNewItemFlag - Set the component IS_NEW and IS_MOVED flags. */ - SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* aSheet, + SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET* aSheet, int unit = 0, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ), bool setNewItemFlag = false ); @@ -404,9 +404,9 @@ public: */ static bool IsReferenceStringValid( const wxString& aReferenceString ); - void SetCurrentSheetPath( const SCH_SHEET_PATH* aSheetPath ) + void SetCurrentSheet( const SCH_SHEET* aSheet ) { - m_currentSheetPath = aSheetPath; + m_currentSheet = aSheet; } /** diff --git a/eeschema/sch_reference_list.h b/eeschema/sch_reference_list.h index 4d73f4bc5e..9c2e410a0a 100644 --- a/eeschema/sch_reference_list.h +++ b/eeschema/sch_reference_list.h @@ -35,12 +35,13 @@ #include #include -#include -#include #include #include + +class SCH_SHEET; +class SCH_COMPONENT; class SCH_REFERENCE_LIST; @@ -90,8 +91,7 @@ public: m_SheetNum = 0; } - SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent, - SCH_SHEET* aSheet ); + SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent, SCH_SHEET* aSheet ); SCH_COMPONENT* GetComp() const { return m_RootCmp; } @@ -152,25 +152,16 @@ public: return m_Ref.compare( item.m_Ref ); } - int CompareLibName( const SCH_REFERENCE& item ) const - { - return Cmp_KEEPCASE( m_RootCmp->GetPartName(), item.m_RootCmp->GetPartName() ); - } + int CompareLibName( const SCH_REFERENCE& item ) const; /** * Function IsSameInstance * returns whether this reference refers to the same component instance * (component and sheet) as another. */ - bool IsSameInstance( const SCH_REFERENCE& other ) const - { - return GetComp() == other.GetComp() && GetSheet()->GetPath() == other.GetSheet()->GetPath(); - } + bool IsSameInstance( const SCH_REFERENCE& other ) const; - bool IsUnitsLocked() - { - return m_Entry->UnitsLocked(); - } + bool IsUnitsLocked() const; }; diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 1a24d4a24e..8ea1d3f5d8 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -1103,7 +1103,7 @@ SCH_TEXT* SCH_SCREEN::GetLabel( const wxPoint& aPosition, int aAccuracy ) } -bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxString& aReference, +bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET* aSheet, const wxString& aReference, const wxString& aFootPrint, bool aSetVisible ) { SCH_COMPONENT* component; @@ -1116,7 +1116,7 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri component = (SCH_COMPONENT*) item; - if( aReference.CmpNoCase( component->GetRef( aSheetPath->Last() ) ) == 0 ) + if( aReference.CmpNoCase( component->GetRef( aSheet ) ) == 0 ) { // Found: Init Footprint Field @@ -1125,6 +1125,7 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri * it is probably not yet initialized */ SCH_FIELD * fpfield = component->GetField( FOOTPRINT ); + if( fpfield->GetText().IsEmpty() && ( fpfield->GetTextPosition() == component->GetPosition() ) ) { diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 83348b8eaf..85549a19a6 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -42,7 +42,6 @@ #include #include #include -#include SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : @@ -812,6 +811,11 @@ void SCH_SHEET::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Path" ), GetHumanReadablePath(), DARKMAGENTA ) ); + if( IsRootSheet() ) + aList.push_back( MSG_PANEL_ITEM( _( "Hierarchy Type" ), + IsComplexHierarchy() ? _( "Complex" ) : _( "Simple" ), + GREEN ) ); + #if 1 // Set to 1 to display the sheet time stamp (mainly for test) aList.push_back( MSG_PANEL_ITEM( _( "Time Stamp" ), GetPath(), BLUE ) ); #endif @@ -1162,6 +1166,27 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) } +unsigned SCH_SHEET::GetSheets( std::vector& aSheetList ) const +{ + // Sheet pointers must be unique. + wxASSERT( find( aSheetList.begin(), aSheetList.end(), this ) == aSheetList.end() ); + + aSheetList.push_back( this ); + + const SCH_ITEM* item = m_screen->GetDrawItems(); + + while( item ) + { + if( item->Type() == SCH_SHEET_T ) + ( (SCH_SHEET*) item )->GetSheets( aSheetList ); + + item = item->Next(); + } + + return aSheetList.size(); +} + + SCH_SHEET* SCH_SHEET::GetRootSheet() { EDA_ITEM* parent = GetParent(); @@ -1424,6 +1449,100 @@ SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem ) } +void SCH_SHEET::GetMultiUnitComponents( PART_LIBS* aLibs, + SCH_MULTI_UNIT_REFERENCE_MAP& aRefList, + bool aIncludePowerSymbols ) +{ + for( SCH_ITEM* item = m_screen->GetDrawItems(); item; item = item->Next() ) + { + if( item->Type() == SCH_SHEET_T ) + { + ( (SCH_SHEET*) item )->GetMultiUnitComponents( aLibs, aRefList, aIncludePowerSymbols ); + continue; + } + + if( item->Type() != SCH_COMPONENT_T ) + continue; + + SCH_COMPONENT* component = (SCH_COMPONENT*) item; + + // Skip pseudo components, which have a reference starting with #. This mainly + // affects power symbols. + if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) ) + continue; + + LIB_PART* part = aLibs->FindLibPart( component->GetPartName() ); + + if( part && part->GetUnitCount() > 1 ) + { + SCH_REFERENCE reference = SCH_REFERENCE( component, part, this ); + reference.SetSheetNumber( m_number ); + wxString reference_str = reference.GetRef(); + + // Never lock unassigned references + if( reference_str[reference_str.Len() - 1] == '?' ) + continue; + + aRefList[reference_str].AddItem( reference ); + } + } +} + + +bool SCH_SHEET::IsComplexHierarchy() const +{ + std::set fileNames; + std::vector< const SCH_SHEET* > sheets; + + unsigned count = GetSheets( sheets ); + + for( unsigned i = 0; i < count; i++ ) + { + if( fileNames.find( sheets[i]->m_fileName ) != fileNames.end() ) + return true; + + fileNames.insert( sheets[i]->m_fileName ); + } + + return false; +} + + +SCH_ITEM* SCH_SHEET::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const +{ + wxCHECK( m_screen != NULL, NULL ); + + bool hasWrapped = false; + bool firstItemFound = false; + SCH_ITEM* drawItem = m_screen->GetDrawItems(); + + while( drawItem ) + { + if( drawItem->Type() == aType ) + { + if( !aLastItem || firstItemFound ) + { + return drawItem; + } + else if( !firstItemFound && drawItem == aLastItem ) + { + firstItemFound = true; + } + } + + drawItem = drawItem->Next(); + + if( !drawItem && aLastItem && aWrap && !hasWrapped ) + { + hasWrapped = true; + drawItem = m_screen->GetDrawItems(); + } + } + + return NULL; +} + + bool SCH_SHEET::operator<( const SCH_SHEET& aRhs ) const { if( (*this - aRhs) < 0 ) diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index e2e1e018bf..ccb4c7e674 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -33,6 +33,7 @@ #include #include #include +#include class PART_LIBS; @@ -44,7 +45,6 @@ class SCH_SHEET_PATH; class DANGLING_END_ITEM; class SCH_EDIT_FRAME; class NETLIST_OBJECT_LIST; -class SCH_REFERENCE_LIST; #define MIN_SHEET_WIDTH 500 @@ -589,6 +589,16 @@ public: EDA_ITEM* Clone() const; + /** + * Function GetSheets + * + * add the point to #SCH_SHEET and all of it's sub-sheets to \a aSheetList. + * + * @param aSheetList is a reference to a set containing the #SCH_SHEET pointers. + * @return the number of #SCH_SHEET object pointers in \a aSheetList. + */ + unsigned GetSheets( std::vector& aSheetList ) const; + /** * Function GetRootSheet * @@ -700,6 +710,43 @@ public: void GetComponents( PART_LIBS* aLibs, SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols = true, bool aIncludeSubSheets = true ); + /** + * Function GetMultiUnitComponents + * adds a SCH_REFERENCE_LIST object to \a aRefList for each component with multiple units + * that has the same reference designator for this sheet and all of it's sub-sheets. The + * map key for each element will be the reference designator. + * + * @param aLibs a pointer to the #PART_LIB to use. + * @param aRefList Map of reference designators to reference lists + * @param aIncludePowerSymbols : false to only get normal components. + */ + void GetMultiUnitComponents( PART_LIBS* aLibs, SCH_MULTI_UNIT_REFERENCE_MAP& aRefList, + bool aIncludePowerSymbols = true ); + + /** + * Function IsComplexHierarchy + * searches all of the sheets for duplicate files names which indicates a complex + * hierarchy. + * + * Typically this function would be called from the root sheet. However, it is possible + * to test only the sub-hierarchy from any #SCH_SHEET object. + * + * @return true if the #SCH_SHEET is a complex hierarchy. + */ + bool IsComplexHierarchy() const; + + /** + * Find the next schematic item in this sheet object. + * + * @param aType - The type of schematic item object to search for. + * @param aLastItem - Start search from aLastItem. If no aLastItem, search from + * the beginning of the list. + * @param aWrap - Wrap around the end of the list to find the next item if aLastItem + * is defined. + * @return - The next schematic item if found. Otherwise, NULL is returned. + */ + SCH_ITEM* FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false ) const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // override #endif diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 62bb42aab8..f20056d26e 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -227,80 +227,6 @@ wxString SCH_SHEET_PATH::PathHumanReadable() const } -void SCH_SHEET_PATH::GetMultiUnitComponents( PART_LIBS* aLibs, - SCH_MULTI_UNIT_REFERENCE_MAP& aRefList, - bool aIncludePowerSymbols ) -{ - // Find sheet path number - int sheetnumber = 1; // 1 = root - - SCH_SHEET_LIST sheetList; - - for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext(), sheetnumber++ ) - { - if( Cmp( *path ) == 0 ) - break; - } - - for( SCH_ITEM* item = LastDrawList(); item; item = item->Next() ) - { - if( item->Type() != SCH_COMPONENT_T ) continue; - SCH_COMPONENT* component = (SCH_COMPONENT*) item; - - // Skip pseudo components, which have a reference starting with #. This mainly - // affects power symbols. - if( !aIncludePowerSymbols && component->GetRef( Last() )[0] == wxT( '#' ) ) - continue; - - LIB_PART* part = aLibs->FindLibPart( component->GetPartName() ); - if( part && part->GetUnitCount() > 1 ) - { - SCH_REFERENCE reference = SCH_REFERENCE( component, part, Last() ); - reference.SetSheetNumber( sheetnumber ); - wxString reference_str = reference.GetRef(); - - // Never lock unassigned references - if( reference_str[reference_str.Len() - 1] == '?' ) continue; - - aRefList[reference_str].AddItem( reference ); - } - } -} - - -SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const -{ - bool hasWrapped = false; - bool firstItemFound = false; - SCH_ITEM* drawItem = LastDrawList(); - - while( drawItem ) - { - if( drawItem->Type() == aType ) - { - if( !aLastItem || firstItemFound ) - { - return drawItem; - } - else if( !firstItemFound && drawItem == aLastItem ) - { - firstItemFound = true; - } - } - - drawItem = drawItem->Next(); - - if( !drawItem && aLastItem && aWrap && !hasWrapped ) - { - hasWrapped = true; - drawItem = LastDrawList(); - } - } - - return NULL; -} - - SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const { bool hasWrapped = false; @@ -334,18 +260,6 @@ SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, } -bool SCH_SHEET_PATH::SetComponentFootprint( const wxString& aReference, const wxString& aFootPrint, - bool aSetVisible ) -{ - SCH_SCREEN* screen = LastScreen(); - - if( screen == NULL ) - return false; - - return screen->SetComponentFootprint( this, aReference, aFootPrint, aSetVisible ); -} - - SCH_SHEET_PATH& SCH_SHEET_PATH::operator=( const SCH_SHEET_PATH& d1 ) { if( this == &d1 ) // Self assignment is bad! @@ -595,29 +509,6 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet ) } -void SCH_SHEET_LIST::GetMultiUnitComponents( PART_LIBS* aLibs, - SCH_MULTI_UNIT_REFERENCE_MAP& aRefList, - bool aIncludePowerSymbols ) -{ - for( SCH_SHEET_PATH* path = GetFirst(); path; path = GetNext() ) - { - SCH_MULTI_UNIT_REFERENCE_MAP tempMap; - path->GetMultiUnitComponents( aLibs, tempMap ); - - BOOST_FOREACH( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair, tempMap ) - { - // Merge this list into the main one - unsigned n_refs = pair.second.GetCount(); - - for( unsigned thisRef = 0; thisRef < n_refs; ++thisRef ) - { - aRefList[pair.first].AddItem( pair.second[thisRef] ); - } - } - } -} - - SCH_ITEM* SCH_SHEET_LIST::FindNextItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFoundIn, SCH_ITEM* aLastItem, bool aWrap ) { @@ -709,40 +600,6 @@ SCH_ITEM* SCH_SHEET_LIST::FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aShe } -bool SCH_SHEET_LIST::SetComponentFootprint( const wxString& aReference, - const wxString& aFootPrint, bool aSetVisible ) -{ - bool found = false; - - for( SCH_SHEET_PATH* path = GetFirst(); path; path = GetNext() ) - found = path->SetComponentFootprint( aReference, aFootPrint, aSetVisible ); - - return found; -} - - -bool SCH_SHEET_LIST::IsComplexHierarchy() const -{ - wxString fileName; - - for( int i = 0; i < m_count; i++ ) - { - fileName = m_list[i].Last()->GetFileName(); - - for( int j = 0; j < m_count; j++ ) - { - if( i == j ) - continue; - - if( fileName == m_list[j].Last()->GetFileName() ) - return true; - } - } - - return false; -} - - bool SCH_SHEET_LIST::TestForRecursion( const SCH_SHEET_LIST& aSrcSheetHierarchy, const wxString& aDestFileName ) const { diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h index e3db2c0374..be3e11a87a 100644 --- a/eeschema/sch_sheet_path.h +++ b/eeschema/sch_sheet_path.h @@ -33,7 +33,6 @@ #define CLASS_DRAWSHEET_PATH_H #include -#include /** Info about complex hierarchies handling: @@ -81,10 +80,8 @@ class wxFindReplaceData; class SCH_SCREEN; -class SCH_MARKER; class SCH_SHEET; class SCH_ITEM; -class PART_LIBS; #define SHEET_NOT_FOUND -1 @@ -211,43 +208,6 @@ public: */ bool BuildSheetPathInfoFromSheetPathValue( const wxString& aPath, bool aFound = false ); - /** - * Function GetMultiUnitComponents - * adds a SCH_REFERENCE_LIST object to \a aRefList for each same-reference set of - * multi-unit parts in the sheet. The map key for each element will be the - * reference designator. - * @param aLibs the library list to use - * @param aRefList Map of reference designators to reference lists - * @param aIncludePowerSymbols : false to only get normal components. - */ - void GetMultiUnitComponents( PART_LIBS* aLibs, SCH_MULTI_UNIT_REFERENCE_MAP& aRefList, - bool aIncludePowerSymbols = true ); - - /** - * Function SetFootprintField - * searches last sheet in the path for a component with \a aReference and set the footprint - * field to \a aFootPrint if found. - * - * @param aReference The reference designator of the component. - * @param aFootPrint The value to set the footprint field. - * @param aSetVisible The value to set the field visibility flag. - * @return True if \a aReference was found otherwise false. - */ - bool SetComponentFootprint( const wxString& aReference, const wxString& aFootPrint, - bool aSetVisible ); - - /** - * Find the next schematic item in this sheet object. - * - * @param aType - The type of schematic item object to search for. - * @param aLastItem - Start search from aLastItem. If no aLastItem, search from - * the beginning of the list. - * @param aWrap - Wrap around the end of the list to find the next item if aLastItem - * is defined. - * @return - The next schematic item if found. Otherwise, NULL is returned. - */ - SCH_ITEM* FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false ) const; - /** * Find the previous schematic item in this sheet path object. * @@ -400,18 +360,6 @@ public: */ SCH_SHEET_PATH* GetSheetByPath( const wxString aPath, bool aHumanReadable = true ); - /** - * Function GetMultiUnitComponents - * adds a SCH_REFERENCE_LIST object to \a aRefList for each same-reference set of - * multi-unit parts in the list of sheets. The map key for each element will be the - * reference designator. - * @param aLibs the library list to use - * @param aRefList Map of reference designators to reference lists - * @param aIncludePowerSymbols Set to false to only get normal components. - */ - void GetMultiUnitComponents( PART_LIBS* aLibs, SCH_MULTI_UNIT_REFERENCE_MAP& aRefList, - bool aIncludePowerSymbols = true ); - /** * Function FindNextItem * searches the entire schematic for the next schematic object. @@ -440,28 +388,6 @@ public: SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aSheetFound = NULL, SCH_ITEM* aLastItem = NULL, bool aWrap = true ); - /** - * Function SetFootprintField - * searches all the sheets for a component with \a aReference and set the footprint - * field to \a aFootPrint if found. - * - * @param aReference The reference designator of the component. - * @param aFootPrint The value to set the footprint field. - * @param aSetVisible The value to set the field visibility flag. - * @return True if \a aReference was found otherwise false. - */ - bool SetComponentFootprint( const wxString& aReference, const wxString& aFootPrint, - bool aSetVisible ); - - /** - * Function IsComplexHierarchy - * searches all of the sheets for duplicate files names which indicates a complex - * hierarchy. - * - * @return true if the #SCH_SHEET_LIST is a complex hierarchy. - */ - bool IsComplexHierarchy() const; - /** * Function TestForRecursion * diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index a9c7a07e55..ea6d2f21b8 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -237,7 +237,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, SCH_EDIT_FRAME::Process_Config ) - EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig ) EVT_TOOL( wxID_PREFERENCES, SCH_EDIT_FRAME::OnPreferencesOptions ) EVT_TOOL( ID_RUN_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor ) diff --git a/eeschema/schframe.h b/eeschema/schframe.h index f7309bc171..f057a4f649 100644 --- a/eeschema/schframe.h +++ b/eeschema/schframe.h @@ -266,11 +266,10 @@ public: void SetPlotDirectoryName( const wxString& aDirName ) { m_plotDirectoryName = aDirName; } void Process_Special_Functions( wxCommandEvent& event ); - void OnColorConfig( wxCommandEvent& aEvent ); void Process_Config( wxCommandEvent& event ); void OnSelectTool( wxCommandEvent& aEvent ); - bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ); /** * Function GetProjectFileParametersList @@ -1229,7 +1228,7 @@ public: * @param aKey = the key modifiers (Alt, Shift ...) * @return the block command id (BLOCK_MOVE, BLOCK_COPY...) */ - virtual int BlockCommand( int aKey ); + virtual int BlockCommand( EDA_KEY aKey ); /** * Function HandleBlockPlace diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h index ab7ecb21cf..4aed86232b 100644 --- a/eeschema/viewlib_frame.h +++ b/eeschema/viewlib_frame.h @@ -87,7 +87,7 @@ public: void ClickOnCmpList( wxCommandEvent& event ); void OnSetRelativeOffset( wxCommandEvent& event ); - bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ); ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription() EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const; diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/widgets/widget_eeschema_color_config.cpp similarity index 88% rename from eeschema/dialogs/dialog_color_config.cpp rename to eeschema/widgets/widget_eeschema_color_config.cpp index c59b067ebd..f23c2e9dcf 100644 --- a/eeschema/dialogs/dialog_color_config.cpp +++ b/eeschema/widgets/widget_eeschema_color_config.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2016 KiCad Developers, see CHANGELOG.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 @@ -31,10 +31,7 @@ #include -#include - - -#define ID_COLOR_SETUP 1800 +#include "widget_eeschema_color_config.h" // Specify the width and height of every (color-displaying / bitmap) button const int BUTT_SIZE_X = 16; @@ -110,21 +107,21 @@ static BUTTONINDEX buttonGroups[] = { static EDA_COLOR_T currentColors[ LAYERSCH_ID_COUNT ]; -DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent ) : - DIALOG_COLOR_CONFIG_BASE( aParent ) +WIDGET_EESCHEMA_COLOR_CONFIG::WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ) : + wxPanel( aParent ), m_drawFrame( aDrawFrame ) { - m_parent = aParent; CreateControls(); - - GetSizer()->SetSizeHints( this ); } -void DIALOG_COLOR_CONFIG::CreateControls() +void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls() { wxStaticText* label; int buttonId = 1800; + m_mainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); + SetSizer( m_mainBoxSizer ); + BUTTONINDEX* groups = buttonGroups; wxBoxSizer* columnBoxSizer = NULL; @@ -185,7 +182,7 @@ void DIALOG_COLOR_CONFIG::CreateControls() } Connect( 1800, buttonId - 1, wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler( DIALOG_COLOR_CONFIG::SetColor ) ); + wxCommandEventHandler( WIDGET_EESCHEMA_COLOR_CONFIG::SetColor ) ); wxArrayString selBgColorStrings; selBgColorStrings.Add( _( "White" ) ); @@ -193,7 +190,7 @@ void DIALOG_COLOR_CONFIG::CreateControls() m_SelBgColor = new wxRadioBox( this, wxID_ANY, _( "Background Color" ), wxDefaultPosition, wxDefaultSize, selBgColorStrings, 1, wxRA_SPECIFY_COLS ); - m_SelBgColor->SetSelection( ( m_parent->GetDrawBgColor() == BLACK ) ? 1 : 0 ); + m_SelBgColor->SetSelection( ( GetDrawFrame()->GetDrawBgColor() == BLACK ) ? 1 : 0 ); if( columnBoxSizer ) { @@ -202,13 +199,13 @@ void DIALOG_COLOR_CONFIG::CreateControls() columnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 ); } - currentColors[ LAYER_BACKGROUND ] = m_parent->GetDrawBgColor(); + currentColors[ LAYER_BACKGROUND ] = GetDrawFrame()->GetDrawBgColor(); // Dialog now needs to be resized, but the associated command is found elsewhere. } -void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event ) +void WIDGET_EESCHEMA_COLOR_CONFIG::SetColor( wxCommandEvent& event ) { wxBitmapButton* button = (wxBitmapButton*) event.GetEventObject(); @@ -246,7 +243,7 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event ) } -bool DIALOG_COLOR_CONFIG::TransferDataFromWindow() +bool WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl() { bool warning = false; @@ -280,7 +277,7 @@ bool DIALOG_COLOR_CONFIG::TransferDataFromWindow() } // Update color of background - m_parent->SetDrawBgColor( bgcolor ); + GetDrawFrame()->SetDrawBgColor( bgcolor ); currentColors[ LAYER_BACKGROUND ] = bgcolor; @@ -289,8 +286,17 @@ bool DIALOG_COLOR_CONFIG::TransferDataFromWindow() SetLayerColor( currentColors[ clyr ], clyr ); } - m_parent->SetGridColor( GetLayerColor( LAYER_GRID ) ); - m_parent->GetCanvas()->Refresh(); + GetDrawFrame()->SetGridColor( GetLayerColor( LAYER_GRID ) ); + GetDrawFrame()->GetCanvas()->Refresh(); return true; } + + +void WIDGET_EESCHEMA_COLOR_CONFIG::InstallOnPanel( wxPanel* aPanel ) +{ + wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); + + sizer->Add( this, 1, wxALL | wxEXPAND, 0 ); + aPanel->SetSizer( sizer ); +} diff --git a/eeschema/dialogs/dialog_color_config.h b/eeschema/widgets/widget_eeschema_color_config.h similarity index 63% rename from eeschema/dialogs/dialog_color_config.h rename to eeschema/widgets/widget_eeschema_color_config.h index 0f07367971..1f99a31193 100644 --- a/eeschema/dialogs/dialog_color_config.h +++ b/eeschema/widgets/widget_eeschema_color_config.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2007 G. Harland - * Copyright (C) 1992-2015 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see CHANGELOG.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 @@ -22,11 +22,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef DIALOG_COLOR_CONFIG_H_ -#define DIALOG_COLOR_CONFIG_H_ - -#include +#ifndef WIDGET_EESCHEMA_COLOR_CONFIG_H_ +#define WIDGET_EESCHEMA_COLOR_CONFIG_H_ +#include +#include class wxBoxSizer; class wxStaticLine; @@ -37,22 +37,33 @@ class wxStdDialogButtonSizer; /* Derived class for the frame color settings. */ /***********************************************/ -class DIALOG_COLOR_CONFIG : public DIALOG_COLOR_CONFIG_BASE +class WIDGET_EESCHEMA_COLOR_CONFIG : public wxPanel { private: - EDA_DRAW_FRAME* m_parent; + EDA_DRAW_FRAME* m_drawFrame; wxRadioBox* m_SelBgColor; + wxBoxSizer* m_mainBoxSizer; // Creates the controls and sizers void CreateControls(); void SetColor( wxCommandEvent& aEvent ); + virtual EDA_DRAW_FRAME* GetDrawFrame() { return m_drawFrame; } + public: // Constructors and destructor - DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent ); + WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ); - bool TransferDataFromWindow(); + bool TransferDataFromControl(); + + /** + * Method InstallOnPanel + * Install this WIDGET_EESCHEMA_COLOR_CONFIG onto an empty panel. This is useful + * when combining with wxFormBuilder, as an empty panel can be left as a + * placeholder in the layout. + */ + void InstallOnPanel( wxPanel* aPanel ); }; -#endif // DIALOG_COLOR_CONFIG_H_ +#endif // WIDGET_EESCHEMA_COLOR_CONFIG_H_ diff --git a/gerbview/block.cpp b/gerbview/block.cpp index 1218322b54..8494f75a1b 100644 --- a/gerbview/block.cpp +++ b/gerbview/block.cpp @@ -47,7 +47,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx bool erase ); -int GERBVIEW_FRAME::BlockCommand( int key ) +int GERBVIEW_FRAME::BlockCommand( EDA_KEY key ) { int cmd = 0; diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index e0968ac722..f2108ac58a 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -130,6 +130,7 @@ void GERBER_LAYER_WIDGET::ReFillRender() void GERBER_LAYER_WIDGET::installRightLayerClickHandler() { int rowCount = GetLayerRowCount(); + for( int row=0; row -bool GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +bool GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) { bool eventHandled = true; diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 68ddadc569..4a5852b915 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -755,7 +755,7 @@ void GERBVIEW_FRAME::UpdateStatusBar() dy = GetCrossHairPosition().y - screen->m_O_Curseur.y; // atan2 in the 0,0 case returns 0 - theta = RAD2DEG( atan2( -dy, dx ) ); + theta = RAD2DEG( atan2( (double) -dy, (double) dx ) ); ro = hypot( dx, dy ); wxString formatter; diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 383ab544fc..6bac9ff96e 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -546,7 +546,7 @@ public: * returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to * the \a aKey (ALT, SHIFT ALT ..) */ - virtual int BlockCommand( int key ); + virtual int BlockCommand( EDA_KEY key ); /** * Function HandleBlockPlace @@ -631,7 +631,7 @@ public: bool LoadExcellonFiles( const wxString& aFileName ); bool Read_EXCELLON_File( const wxString& aFullFileName ); - bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ); /** * Set Size Items (Lines, Flashes) from DCodes List diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h index 8c386f0b1b..0a75a1f19f 100644 --- a/include/class_drawpanel.h +++ b/include/class_drawpanel.h @@ -263,7 +263,7 @@ public: *

*/ void OnMouseWheel( wxMouseEvent& event ); -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) void OnMagnify( wxMouseEvent& event ); #endif void OnMouseEvent( wxMouseEvent& event ); diff --git a/include/common.h b/include/common.h index b881444a01..169c0c267e 100644 --- a/include/common.h +++ b/include/common.h @@ -4,7 +4,7 @@ * Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2008-2015 Wayne Stambaugh - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -33,6 +33,7 @@ #define INCLUDE__COMMON_H_ #include +#include #include #include @@ -49,17 +50,21 @@ class REPORTER; // Flag for special keys -#define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right - * shift key depressed */ -#define GR_KB_LEFTSHIFT 0x20000000 /* left shift key depressed - */ -#define GR_KB_CTRL 0x40000000 // CTRL depressed -#define GR_KB_ALT 0x80000000 // ALT depressed -#define GR_KB_SHIFT (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT) -#define GR_KB_SHIFTCTRL (GR_KB_SHIFT | GR_KB_CTRL) -#define MOUSE_MIDDLE 0x08000000 /* Middle button mouse - * flag for block commands - */ +// This type could be extended to 64 bits to add room for more flags. +// For compatibility with old code, keep flag bits out of the least +// significant nibble (0xF). +typedef uint32_t EDA_KEY; +#define EDA_KEY_C UINT32_C + +#define GR_KB_RIGHTSHIFT ( EDA_KEY_C( 0x01000000 ) ) +#define GR_KB_LEFTSHIFT ( EDA_KEY_C( 0x02000000 ) ) +#define GR_KB_CTRL ( EDA_KEY_C( 0x04000000 ) ) +#define GR_KB_ALT ( EDA_KEY_C( 0x08000000 ) ) +#define GR_KB_SHIFT ( GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT ) +#define GR_KB_SHIFTCTRL ( GR_KB_SHIFT | GR_KB_CTRL ) +#define MOUSE_MIDDLE ( EDA_KEY_C( 0x10000000 ) ) +#define GR_KEY_INVALID ( EDA_KEY_C( 0x80000000 ) ) +#define GR_KEY_NONE ( EDA_KEY_C( 0 ) ) /// default name for nameless projects #define NAMELESS_PROJECT wxT( "noname" ) diff --git a/include/confirm.h b/include/confirm.h index 5a10bb4f8e..ff2c64e9cc 100644 --- a/include/confirm.h +++ b/include/confirm.h @@ -28,9 +28,10 @@ * @see common.h */ - #ifndef __INCLUDE__CONFIRM_H__ -#define __INCLUDE__CONFIRM_H__ 1 +#define __INCLUDE__CONFIRM_H__ + +#include /** * Function DisplayExitDialog diff --git a/include/draw_frame.h b/include/draw_frame.h index 791a3ff17b..7765e975c4 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -516,7 +516,7 @@ public: * @param aPosition The current cursor position in logical (drawing) units. * @param aHotKey A key event used for application specific control if not zero. */ - virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ) + virtual bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) { return false; } @@ -642,7 +642,7 @@ public: * initializes the block command including the command type, initial position, * and other variables. */ - virtual bool HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosition ); + virtual bool HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& aPosition ); /** * Function BlockCommand @@ -653,7 +653,7 @@ public: * @param aKey = the key modifiers (Alt, Shift ...) * @return the block command id (BLOCK_MOVE, BLOCK_COPY...) */ - virtual int BlockCommand( int aKey ); + virtual int BlockCommand( EDA_KEY aKey ); /** * Function HandleBlockPlace( ) diff --git a/include/gal/cairo/cairo_gal.h b/include/gal/cairo/cairo_gal.h index dca18acc05..1f395f7201 100644 --- a/include/gal/cairo/cairo_gal.h +++ b/include/gal/cairo/cairo_gal.h @@ -112,10 +112,12 @@ public: virtual void DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ); /// @copydoc GAL::DrawPolyline() - virtual void DrawPolyline( std::deque& aPointList ); + virtual void DrawPolyline( const std::deque& aPointList ) { drawPoly( aPointList ); } + virtual void DrawPolyline( const VECTOR2D aPointList[], int aListSize ) { drawPoly( aPointList, aListSize ); } /// @copydoc GAL::DrawPolygon() - virtual void DrawPolygon( const std::deque& aPointList ); + virtual void DrawPolygon( const std::deque& aPointList ) { drawPoly( aPointList ); } + virtual void DrawPolygon( const VECTOR2D aPointList[], int aListSize ) { drawPoly( aPointList, aListSize ); } /// @copydoc GAL::DrawCurve() virtual void DrawCurve( const VECTOR2D& startPoint, const VECTOR2D& controlPointA, @@ -381,6 +383,10 @@ private: /// Prepare the compositor void setCompositor(); + /// Drawing polygons & polylines is the same in cairo, so here is the common code + void drawPoly( const std::deque& aPointList ); + void drawPoly( const VECTOR2D aPointList[], int aListSize ); + /** * @brief Returns a valid key that can be used as a new group number. * diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h index 1867f94175..40cebbf9f7 100644 --- a/include/gal/graphics_abstraction_layer.h +++ b/include/gal/graphics_abstraction_layer.h @@ -105,7 +105,8 @@ public: * * @param aPointList is a list of 2D-Vectors containing the polyline points. */ - virtual void DrawPolyline( std::deque& aPointList ) {}; + virtual void DrawPolyline( const std::deque& aPointList ) {}; + virtual void DrawPolyline( const VECTOR2D aPointList[], int aListSize ) {}; /** * @brief Draw a circle using world coordinates. @@ -140,6 +141,7 @@ public: * @param aPointList is the list of the polygon points. */ virtual void DrawPolygon( const std::deque& aPointList ) {}; + virtual void DrawPolygon( const VECTOR2D aPointList[], int aListSize ) {}; /** * @brief Draw a cubic bezier spline. diff --git a/include/gal/opengl/opengl_gal.h b/include/gal/opengl/opengl_gal.h index b587e7023f..83598baf68 100644 --- a/include/gal/opengl/opengl_gal.h +++ b/include/gal/opengl/opengl_gal.h @@ -3,7 +3,7 @@ * * Copyright (C) 2012 Torsten Hueter, torstenhtr gmx.de * Copyright (C) 2012 Kicad Developers, see change_log.txt for contributors. - * Copyright (C) 2013-2015 CERN + * Copyright (C) 2013-2016 CERN * @author Maciej Suminski * * Graphics Abstraction Layer (GAL) for OpenGL @@ -113,10 +113,12 @@ public: virtual void DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ); /// @copydoc GAL::DrawPolyline() - virtual void DrawPolyline( std::deque& aPointList ); + virtual void DrawPolyline( const std::deque& aPointList ); + virtual void DrawPolyline( const VECTOR2D aPointList[], int aListSize ); /// @copydoc GAL::DrawPolygon() virtual void DrawPolygon( const std::deque& aPointList ); + virtual void DrawPolygon( const VECTOR2D aPointList[], int aListSize ); /// @copydoc GAL::DrawCurve() virtual void DrawCurve( const VECTOR2D& startPoint, const VECTOR2D& controlPointA, diff --git a/include/id.h b/include/id.h index c864171a72..a50a950901 100644 --- a/include/id.h +++ b/include/id.h @@ -124,8 +124,6 @@ enum main_id ID_NO_TOOL_SELECTED, ID_SEL_BG_COLOR, - ID_COLORS_SETUP, - ID_REPEAT_BUTT, ID_LANGUAGE_CHOICE, diff --git a/include/math/vector2d.h b/include/math/vector2d.h index bba2a4af0a..764534add9 100644 --- a/include/math/vector2d.h +++ b/include/math/vector2d.h @@ -298,7 +298,7 @@ typename VECTOR2::extended_type VECTOR2::SquaredEuclideanNorm() const template double VECTOR2::Angle() const { - return atan2( y, x ); + return atan2( (double) y, (double) x ); } diff --git a/include/view/wx_view_controls.h b/include/view/wx_view_controls.h index 0338e582e1..5a05bddd21 100644 --- a/include/view/wx_view_controls.h +++ b/include/view/wx_view_controls.h @@ -54,7 +54,7 @@ public: /// Handler functions void onWheel( wxMouseEvent& aEvent ); void onMotion( wxMouseEvent& aEvent ); -#ifdef USE_OSX_MAGNIFY_EVENT +#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) void onMagnify( wxMouseEvent& aEvent ); #endif void onButton( wxMouseEvent& aEvent ); diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 9a1177e98d..81f592e44e 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -59,8 +59,6 @@ class ZONE_SETTINGS; class PCB_PLOT_PARAMS; class FP_LIB_TABLE; class FPID; -class TOOL_MANAGER; -class TOOL_DISPATCHER; /** * class PCB_BASE_FRAME diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 68f304bc48..1cb2d7a1ca 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -281,6 +281,11 @@ public: void OnLayerColorChange( wxCommandEvent& aEvent ); void OnConfigurePaths( wxCommandEvent& aEvent ); + /** + * called when the alt key is pressed during a mouse wheel action + */ + void OnAltWheel( wxCommandEvent& event ); + /** * Function RecordMacros. * records sequence of hotkeys and cursor positions to a macro. @@ -620,7 +625,7 @@ public: ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() void UseGalCanvas( bool aEnable ); - bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ); /** * Function ShowDesignRulesEditor @@ -716,7 +721,7 @@ public: * @param aKey = the key modifiers (Alt, Shift ...) * @return the block command id (BLOCK_MOVE, BLOCK_COPY...) */ - virtual int BlockCommand( int aKey ); + virtual int BlockCommand( EDA_KEY aKey ); /** * Function HandleBlockPlace() @@ -1683,44 +1688,6 @@ public: void Begin_Self( wxDC* DC ); - /** - * Function Genre_Self - * creates a self-shaped coil for microwave applications. - * - Length Mself.lng - * - Extremities Mself.m_Start and Mself.m_End - * - * We must determine: - * Mself.nbrin = number of segments perpendicular to the direction - * (The coil nbrin will demicercles + 1 + 2 1 / 4 circle) - * Mself.lbrin = length of a strand - * Mself.radius = radius of rounded parts of the coil - * Mself.delta = segments extremities connection between him and the coil even - * - * The equations are - * Mself.m_Size.x = 2 * Mself.radius + Mself.lbrin - * Mself.m_Size.y * Mself.delta = 2 + 2 * Mself.nbrin * Mself.radius - * Mself.lng = 2 * Mself.delta / / connections to the coil - + (Mself.nbrin-2) * Mself.lbrin / / length of the strands except 1st and last - + (Mself.nbrin 1) * (PI * Mself.radius) / / length of rounded - * Mself.lbrin + / 2 - Melf.radius * 2) / / length of 1st and last bit - * - * The constraints are: - * Nbrin >= 2 - * Mself.radius < Mself.m_Size.x - * Mself.m_Size.y = Mself.radius * 4 + 2 * Mself.raccord - * Mself.lbrin> Mself.radius * 2 - * - * The calculation is conducted in the following way: - * Initially: - * Nbrin = 2 - * Radius = 4 * m_Size.x (arbitrarily fixed value) - * Then: - * Increasing the number of segments to the desired length - * (Radius decreases if necessary) - * - */ - MODULE* Genere_Self( wxDC* DC ); - void ShowChangedLanguage(); // override EDA_BASE_FRAME virtual /** diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 130b6617f2..054dfecda9 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -148,7 +148,7 @@ static EDA_HOTKEY HkRunGerbview( _HKI( "Run Gerbview" ), HK_RUN_GERBVIEW, 'G' + static EDA_HOTKEY HkRunBm2Cmp( _HKI( "Run Bitmap2Component" ), HK_RUN_BM2COMPONENT, 'B' + GR_KB_CTRL, 0 ); static EDA_HOTKEY HkRunPcbCalc( _HKI( "Run PcbCalculator" ), - HK_RUN_PCBCALCULATOR, 'C' + GR_KB_CTRL, 0 ); + HK_RUN_PCBCALCULATOR, 'A' + GR_KB_CTRL, 0 ); static EDA_HOTKEY HkRunPleditor( _HKI( "Run PlEditor" ), HK_RUN_PLEDITOR, 'Y' + GR_KB_CTRL, 0 ); // List of hotkey descriptors diff --git a/pagelayout_editor/controle.cpp b/pagelayout_editor/controle.cpp index e14c18df8a..8405efce5f 100644 --- a/pagelayout_editor/controle.cpp +++ b/pagelayout_editor/controle.cpp @@ -32,7 +32,7 @@ #include -bool PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +bool PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) { bool eventHandled = true; diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h index ba3b7aebe1..67a5a29fd4 100644 --- a/pagelayout_editor/pl_editor_frame.h +++ b/pagelayout_editor/pl_editor_frame.h @@ -267,7 +267,7 @@ public: void ToPrinter( wxCommandEvent& event ); void Files_io( wxCommandEvent& event ); - bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ); /** Virtual function PrintPage * used to print a page diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt index fcde2f7678..d82b137d95 100644 --- a/pcb_calculator/CMakeLists.txt +++ b/pcb_calculator/CMakeLists.txt @@ -162,4 +162,35 @@ add_custom_target( ${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator_datafile_keywords.cpp ) +# +# Conversion of .html doc source files to .h files included in cpp sources +# +# Function html_doc2h : converts a single *.html text file to a *.h header +function( html_doc2h inputFile ) + add_custom_command( + OUTPUT ${inputFile}.h + + COMMAND ${CMAKE_COMMAND} -DinputFile=${inputFile}.html -DoutputFile=${inputFile}.h + -P ${CMAKE_MODULE_PATH}/Html2C.cmake + DEPENDS ${inputFile}.html ${CMAKE_MODULE_PATH}/Html2C.cmake + COMMENT "creating ${inputFile}.h from ${inputFile}.html" + ) +endfunction() + + html_doc2h( ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/bridget_tee_formula ) + html_doc2h( ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/splitter_formula ) + html_doc2h( ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/pi_formula ) + html_doc2h( ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/tee_formula ) + +set( DOCS_LIST + ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/pi_formula.h + ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/tee_formula.h + ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/bridget_tee_formula.h + ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/splitter_formula.h + ) + +set_source_files_properties( attenuators/attenuator_classes.cpp + PROPERTIES OBJECT_DEPENDS "${DOCS_LIST}" + ) + add_dependencies( pcb_calculator_kiface pcb_calculator_lexer_source_files ) diff --git a/pcb_calculator/attenuators.cpp b/pcb_calculator/attenuators.cpp index 4c0280e778..1fbb38766a 100644 --- a/pcb_calculator/attenuators.cpp +++ b/pcb_calculator/attenuators.cpp @@ -30,6 +30,7 @@ #include #include + extern double DoubleFromString( const wxString& TextValue ); // Called on a attenuator selection @@ -44,6 +45,7 @@ void PCB_CALCULATOR_FRAME::SetAttenuator( unsigned aIdx ) { if( aIdx >=m_attenuator_list.size() ) aIdx = m_attenuator_list.size() - 1; + m_currAttenuator = m_attenuator_list[aIdx]; TransfAttenuatorDataToPanel(); m_Attenuator_Messages->SetPage( wxEmptyString ); @@ -93,6 +95,11 @@ void PCB_CALCULATOR_FRAME::TransfAttenuatorDataToPanel() msg.Printf( wxT( "%g" ), m_currAttenuator->m_Zout ); m_ZoutValueCtrl->SetValue( msg ); + + if( m_currAttenuator->m_FormulaName ) + m_panelAttFormula->SetPage( *m_currAttenuator->m_FormulaName ); + else + m_panelAttFormula->SetPage( wxEmptyString ); } @@ -148,19 +155,3 @@ void PCB_CALCULATOR_FRAME::OnPaintAttenuatorPanel( wxPaintEvent& event ) event.Skip(); } - - -void PCB_CALCULATOR_FRAME::OnPaintAttFormulaPanel( wxPaintEvent& event ) -{ - wxPaintDC dc( m_panelAttFormula ); - - if( m_currAttenuator && m_currAttenuator->m_FormulaBitMap ) - { - wxSize size = m_panelAttFormula->GetSize(); - size.x -= m_currAttenuator->m_FormulaBitMap->GetWidth(); - size.y -= m_currAttenuator->m_FormulaBitMap->GetHeight(); - dc.DrawBitmap( *m_currAttenuator->m_FormulaBitMap, size.x / 2, size.y / 2 ); - } - - event.Skip(); -} diff --git a/pcb_calculator/attenuators/attenuator_classes.cpp b/pcb_calculator/attenuators/attenuator_classes.cpp index 058d0dd2f6..d7c15fd248 100644 --- a/pcb_calculator/attenuators/attenuator_classes.cpp +++ b/pcb_calculator/attenuators/attenuator_classes.cpp @@ -14,10 +14,25 @@ #include #include #include -#include -#include -#include -#include + + +// Html texts showing the formulas +wxString pi_formula( +#include +); + +wxString tee_formula( +#include +); + +wxString bridget_tee_formula( +#include +); + +wxString splitter_formula( +#include +); + #ifndef NULL #define NULL 0 @@ -36,7 +51,7 @@ ATTENUATOR::ATTENUATOR( ATTENUATORS_TYPE aTopology ) m_Attenuation_Enable = true; m_MinimumATT = 0.0; // dB m_SchBitMap = NULL; - m_FormulaBitMap = NULL; + m_FormulaName = NULL; // Initialize these variables mainly to avoid warnings from a static analyzer m_R1 = 0.0; @@ -49,7 +64,6 @@ ATTENUATOR::ATTENUATOR( ATTENUATORS_TYPE aTopology ) ATTENUATOR::~ATTENUATOR() { delete m_SchBitMap; - delete m_FormulaBitMap; } @@ -83,7 +97,7 @@ ATTENUATOR_PI::ATTENUATOR_PI() : ATTENUATOR( PI_TYPE ) { m_Name = wxT("att_pi"); m_SchBitMap = new wxBitmap( att_pi_xpm ); - m_FormulaBitMap = new wxBitmap( pi_formula_xpm ); + m_FormulaName = &pi_formula; } @@ -104,7 +118,7 @@ ATTENUATOR_TEE::ATTENUATOR_TEE() : ATTENUATOR( TEE_TYPE ) { m_Name = wxT("att_tee"); m_SchBitMap = new wxBitmap( att_tee_xpm ); - m_FormulaBitMap = new wxBitmap( tee_formula_xpm ); + m_FormulaName = &tee_formula; } @@ -127,7 +141,7 @@ ATTENUATOR_BRIDGE::ATTENUATOR_BRIDGE() : ATTENUATOR( BRIDGE_TYPE ) m_Zin_Enable = false; m_ResultCount = 2; m_SchBitMap = new wxBitmap( att_bridge_xpm ); - m_FormulaBitMap = new wxBitmap( bridged_tee_formula_xpm ); + m_FormulaName = &bridget_tee_formula; } @@ -153,7 +167,7 @@ ATTENUATOR_SPLITTER::ATTENUATOR_SPLITTER() : ATTENUATOR( SPLITTER_TYPE ) m_MinimumATT = 6.0; m_Zin_Enable = false; m_SchBitMap = new wxBitmap( att_splitter_xpm ); - m_FormulaBitMap = new wxBitmap( splitter_formula_xpm ); + m_FormulaName = &splitter_formula; } diff --git a/pcb_calculator/attenuators/attenuator_classes.h b/pcb_calculator/attenuators/attenuator_classes.h index a2014fa4a2..7e8e895403 100644 --- a/pcb_calculator/attenuators/attenuator_classes.h +++ b/pcb_calculator/attenuators/attenuator_classes.h @@ -40,7 +40,7 @@ public: double m_R2; // value of R2 double m_R3; // value of R3 (if any) wxBitmap* m_SchBitMap; // The schema of this attenuator - wxBitmap* m_FormulaBitMap; // The formula used to calcualte this attenuator + wxString* m_FormulaName; // The HTML text name of the formula used to calculate this attenuator protected: double Lmin, L, A; // internal variable for temporary use diff --git a/pcb_calculator/attenuators/bridget_tee_formula.html b/pcb_calculator/attenuators/bridget_tee_formula.html new file mode 100644 index 0000000000..87c8ddf9b3 --- /dev/null +++ b/pcb_calculator/attenuators/bridget_tee_formula.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + +

Zin +desired input impedance in

+

Zout +desired output impedance Z in = Z out

+

a +attenuation in dB

+

L += 10a/20 (the loss)

+


+ +

+

Bridged +tee attenuator

+

R1 += Zin * (L − 1)

+

R2 += Zin/(L − 1)

+ + \ No newline at end of file diff --git a/pcb_calculator/attenuators/pi_formula.html b/pcb_calculator/attenuators/pi_formula.html new file mode 100644 index 0000000000..d54e80f5d5 --- /dev/null +++ b/pcb_calculator/attenuators/pi_formula.html @@ -0,0 +1,44 @@ + + + + + + + + + + + +

+Zin + desired input impedance in Ω

+

+Zout + desired output impedance in Ω

+

+a + attenuation in dB

+

+L += 10a/10 (the loss)

+

+A += (L + 1)/(L − 1)

+

+
+ +

+

Pi +attenuator

+

R2 += (L − 1)/2 * √ ((Zin * Zout)/L)

+

R1 += 1/( A/Zin − 1/R2)

+

R3 += 1/ (A/Zout − 1/R2)

+ + \ No newline at end of file diff --git a/pcb_calculator/attenuators/splitter_formula.html b/pcb_calculator/attenuators/splitter_formula.html new file mode 100644 index 0000000000..e151169353 --- /dev/null +++ b/pcb_calculator/attenuators/splitter_formula.html @@ -0,0 +1,37 @@ + + + + + + + + + + + + + +

Zin +desired input impedance in Ω

+

Zout +desired output impedance in Ω

+

Zin += Zout

+


+ +

+

Attenuation +is 6dB

+


+ +

+

Splitted +attenuator

+

R1 += R2 = R3 = Zout/3

+ + \ No newline at end of file diff --git a/pcb_calculator/attenuators/tee_formula.html b/pcb_calculator/attenuators/tee_formula.html new file mode 100644 index 0000000000..ce6126b3b1 --- /dev/null +++ b/pcb_calculator/attenuators/tee_formula.html @@ -0,0 +1,47 @@ + + + + + + + + + + + +

+Zin +desired input impedance in Ω

+

+Zout +desired output impedance in Ω

+

+a +attenuation in dB

+

+L += 10 a/10 (the loss)

+

+A += (L + 1)/(L − 1)

+

+
+ +

+

Tee +attenuator

+

+R2 += 2*√ (L * Zin * Zout )/(L − 1)

+

+R1 += Zin * A − R2

+

+R3 += Zout * A − R2

+ + \ No newline at end of file diff --git a/pcb_calculator/bitmaps/bridged_tee_formula.xpm b/pcb_calculator/bitmaps/bridged_tee_formula.xpm deleted file mode 100644 index 4d5b2da617..0000000000 --- a/pcb_calculator/bitmaps/bridged_tee_formula.xpm +++ /dev/null @@ -1,216 +0,0 @@ -/* XPM */ -static const char *bridged_tee_formula_xpm[] = { -/* columns rows colors chars-per-pixel */ -"255 193 17 1", -"X c Black", -"> c #D9D9D9", -"* c #E1E1E1", -"- c #F0F0F0", -" c #FFFFFF", -"o c #E9E9E9", -": c #BDBDBD", -"O c #4D4D4D", -"+ c #A7A7A7", -"# c #7C7C7C", -"& c #9A9A9A", -"@ c #C7C7C7", -". c #C0C0C0", -"= c #8C8C8C", -"; c #B2B2B2", -"% c #D0D0D0", -"$ c #686868", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" .............................................................. ", -" . . ", -" . X . ", -" . XX . ", -" . X X . ", -" . X X . ", -" . XXXX . ", -" . X X . ", -" . XXX XXX . ", -" . . ", -" . . ", -" . XXXXXXXXXXXX . ", -" . XX XX . ", -" . X X X X . ", -" . X X X . ", -" . X X X . ", -" . XXX X X XXX X X X . X X oO X X X XXXXXX ", -" . XX XXX XX X X X X X X . XX +X@ XX X X ", -" . X X X X X XXXX XX . X X #X$ X X X X X X ", -" . X X X X X . X X %@&X% X X X X X X ", -" . X *XXXXXXXXX= X X X . XXX XXX XXX X XXXX X XX #-*X= XXXXXXXXX XXX XXXXXXXX XXX X XX XX XX XXX XXXX X XX X XX X X XX XX X X X ", -" . X XXXX X X X . X X X XX X XX X o& #X* X X X X X X XXX X X X X X X XX X X XXX X XX XXX X X XX XXXXX ", -" . X X *XXXXXXXXX= X X X . X X X X X X X +% %X+ XX X X XXXXX X X X X XX X X X X X X X X X X X X X ", -" . X X X X X . X X X X X X X X OXXXXXX- XXXXXXXXX XX X X X X X X X X XX X X X X X X X X X X X X X X ", -" . X X X X X . X X X X X X X X @; ;X+ X X X X X X X X X X X X X X X X X X X X X X X X ", -" . XXXXX XXX XXX . XX XX X X X X X *O* -XX% X XX X X X X X X X X X XXX X XX X X X X X X X X X X X XXX X X ", -" . . X X XXX XX XXX XXX *XXX: *XXXX: XXX XX XX XX XXX XXX XXX XX X XXX XX XX XXX XX XXX XXX XXX XXX XXX XX X XXXXXXX ", -" . . ", -" . . ", -" .............................................................. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" XXXXXXX& ## XXXXXXX& XXXXXXX& ", -" X$* oXO- ## X$* oXO- : X$* oXO- ", -" X> #X: X> #X: -O X> #X: ", -" : @X$ : @X$ #X : @X$ ", -" OX* XXX XXX%OX% XXXXXXXX OX* -+XX+- XXX XXX #XXXX XXXXXXXX OX* ", -" +X+ XX XX% XO +X+ OX%%XO XX XX XX +X+ ", -" *XO XX XX XX *XO XX XX XX XX XX *XO XX ", -" $X@ X XX XX XX XXXXXXXX $X@ X XX XX XX XX XX XXXXXXXX $X@ X XX X ", -" :X= %# XX XX XX :X= %# XX XX XX XX XX :X= %# XX X ", -" -OXo @O= XX XX XX -OXo @O= OX%%XO OX %XX XX>= -OXo @O= XX X ", -" &XXXXXXX= XXXX XXXX XXX &XXXXXXX= -+XX+- %OO:XXX %O$o &XXXXXXX= XX X ", -" XX X ", -" XX ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" XXXXXXXX+- ##XX XXXXXXX& :X: $ o= %$XO:-X ##XX =o ", -" -XX %XO XX X$* oXO- o#X+X#o X oO% ;X@ -+XX XX %O- ", -" XX XX XX X> #X: XX% %XX $XXX$ #= *X; &X XX == ", -" XX XX XX : @X$ XX XX -&&&- %X> &X* -X XX %X> ", -" XX %XO XX XXXXXXXX OX* XX XX O# #O &X- OX XX -X& ", -" XXXXXX+- XX +X+ XX XX $X XX XX X$ ", -" XX $X* XX *XO XX XX XX XX XXXX XX XX ", -" XX %X# XX XXXXXXXX $X@ X XX XX XX &Xo XX XXXXXXXX XX XX ", -" XX =X@ XX :X= %# XX% %XX $X *X: XX XX X$ ", -" -XX- *XOo -XX- -OXo @O= o#X+X#o &X- +X: -XO -XX- -X& ", -" XXXXXX =XXX XXXXXX &XXXXXXX= :X: >X% >#XX$; XXXXXX >X% ", -" == =# ", -" -O% %Oo ", -" o= =o ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" XXXXXXXX+- >$X& XXXXXXX& :X: -$ o= %$XO:-X ##XX =o ", -" -XX %XO -XXXX+ X$* oXO- o#X+X#o @; oO% ;X@ -+XX XX %O- ", -" XX XX ++ @XX X> #X: XX% %XX &> #= *X; &X XX == ", -" XX XX o XO : @X$ XX XX O %X> &X* -X XX %X> ", -" XX %XO X+ XXXXXXXX OX* XX XX *= &X- OX XX -X& ", -" XXXXXX+- *Xo +X+ XX XX :: $X XX XX X$ ", -" XX $X* +; *XO XX XX #o XX XX XXXX XX XX ", -" XX %X# *# XXXXXXXX $X@ X XX XX O XX &Xo XX XXXX XX XX ", -" XX =X@ -$- & :X= %# XX% %XX >& $X *X: XX XX X$ ", -" -XX- *XOo #XXXX@ -OXo @O= o#X+X#o +% &X- +X: -XO -XX- -X& ", -" XXXXXX =XXX&XXXXX- &XXXXXXX= :X: $- >X% >#XX$; XXXXXX >X% ", -" == =# ", -" -O% %Oo ", -" o= =o ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/pcb_calculator/bitmaps/pi_formula.xpm b/pcb_calculator/bitmaps/pi_formula.xpm deleted file mode 100644 index 4c5bcda76a..0000000000 --- a/pcb_calculator/bitmaps/pi_formula.xpm +++ /dev/null @@ -1,301 +0,0 @@ -/* XPM */ -static const char *pi_formula_xpm[] = { -/* columns rows colors chars-per-pixel */ -"259 278 17 1", -"X c Black", -"> c #D9D9D9", -"* c #E1E1E1", -"= c #F0F0F0", -" c #FFFFFF", -"o c #E9E9E9", -": c #BDBDBD", -"O c #4D4D4D", -"+ c #A7A7A7", -"# c #7C7C7C", -"& c #9A9A9A", -"@ c #C7C7C7", -". c #C0C0C0", -"- c #8C8C8C", -"; c #B2B2B2", -"% c #D0D0D0", -"$ c #686868", -/* pixels */ -" ", -" ", -" ............................................................. ", -" . . ", -" . X . ", -" . XX . ", -" . X X . ", -" . X X . ", -" . XXX . ", -" . X X . ", -" . XXX XXX . ", -" . . ", -" . . ", -" . XXXXXXXXXXXX . ", -" . . ", -" . XX XX . ", -" . X X X X . ", -" . X X X . ", -" . XXXX X X XX X X X . X X oO X X X XXXXXX ", -" . XX XXX XXX X X X X X . XX +X@ XX X X ", -" . X X X X X X X X X . X X #X$ X X X X X X ", -" . X X X X X XXXX XX . X X %@&X% X X X X X X ", -" . X *XXXXXXXXX X X X . XXX XXX XXX X XXXX X XX #=*X- XXXXXXXXX XXX XXXXXXXX XXX X XX XX XX XXX XXXX X XX X XX X X XX XX X X X ", -" . X XXXX X X X . X X X XX X XX X o& #X* X X X X X X XXX X X X X X X XX X X XXX X XX XXX X X XX XXXXX ", -" . X X X X X . X X X X X X X +% %X+ XX X X XXXXX X X X X XX X X X X X X X X X X X X X ", -" . X X *XXXXXXXXX X X X . X X X X X X X X OXXXXXX= XXXXXXXXX XX X X X X X X X X XX X X X X X X X X X X X X X X ", -" . X X X X X . X X X X X X X X @; ;X+ X X X X X X X X X X X X X X X X X X X X X X X X ", -" . X X X X X . XX XX X X X X X *O* =XX% X XX X X X X X X X X X XXX X XX X X X X X X X X X X X XXX X X ", -" . XXXXXX XXX XX . X X XXX XX XXX XXX *XXX: *XXXX: XXX XX XX XX XXX XXX XXX XX X XXX XX XX XXX XX XXX XXX XXX XXX XXX XX X XXXXXXX ", -" . . ", -" . . ", -" . . ", -" ............................................................. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" XXXXXXX X X X X X X X ", -" X X XX XX XX ", -" X X X X X X ", -" X X X X X ", -" X X X XX XXXXXXXXX XX X XXX XXX X X XX XXX XX X X X XX X XX XX XX XXXX X X XX XX X XX XXX XX X XXX X XX XXX XXX ", -" X XX XXX X X XX X X X X XX XXX X X X XX XX XXX X XXX X X X X XX XXX XX X XXX X X X X XX X X XXX X X X X X ", -" X X X X X X XXXXX X X X XXXXX X X X X X X X X X X X X X X X X XXXXX X X XX X X X XXXXX ", -" X X X X XXXXXXXXX X X X XX X X X X X X X X X X X X X X X X X X X X X X XX X X X X X ", -" X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X ", -" X X X X X X XXX X X X X X X X X X XXX X X X XX X X XXX X X X X X X XX X X X X XXX X XX X X X X X X ", -" XXXXXXXX XXX XXX XXX XX X XXX XXX XXX XXX XXX XX X XXX XXX XXX X XX XX X XX XXX XXX XXX XXX X XX XXX XX X XXX XX XXX XXX XXX XXX ", -" X X ", -" X X ", -" XXX XXX ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" XXXXXXX X X X X X ", -" X X XX XX XX ", -" X X X X X X X X ", -" X X X X X X X ", -" X XX XX XX XXXX XXXXXXXXX XX X XXX XXX X X XX XXX XX X XX XX XX XXXX X XX XX XX XXXX X X XX XX X XX XXX XX X XXX X XX XXX XXX ", -" X X X X X X X XX X X X X XX XXX X X X XX X X X X X XXX X X X X XX XXX XX X XXX X X X X XX X X XXX X X X X X ", -" X X X X X X X X XXXXX X X X XXXXX X X X X X X X X X X X X X X X X X X XXXXX X X XX X X X XXXXX ", -" X X X X X X XXXXXXXXX X X X XX X X X X X X X X X X X X X X X X X X X X X X X X XX X X X X X ", -" X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X ", -" X X X X X XXX X X X XXX X X X X X X X X X XXX X X X XXX X X XX X X XXX X X X X X X XX X X X X XXX X XX X X X X X X ", -" XXXXXXXX XX XX X XX XX X XXX XXX XXX XXX XXX XX X XX XX X XX X XX XX X XX XXX XXX XXX XXX X XX XXX XX X XXX XX XXX XXX XXX XXX ", -" X X ", -" X X ", -" XXX XXX ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ................................................................................................................................................................................................... ", -" . XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX . ", -" . ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX . ", -" . - . ", -" . ; . ", -" . & . ", -" . & . ", -" . X : XXXXXXX XXXXXXX . ", -" . XXX *: X X X X X . ", -" . X *% X X X X X . ", -" . X @* X -* X X . ", -" . X :* X XXX XX XX =; &*o; X XXX XX X XXX . ", -" . X : X X X X X =+#&;$% X XX X X X X X . ", -" . X - X X XX X %O$= X X X X X X . ", -" . X & X X XX X o$;;%#+ X X X X X X . ", -" . X o% %o + X X X X X > -* > X X X X X XX X . ", -" . X + + - X X X X X X X ;o X X X XX X XX XX X . ", -" . XXXXX XXX XXX o; XXXX X X ;= + XXXXXXX XX X XX XXXXXXX XXX XXX XX XXX . ", -" . X X X X :% XX XXX XXX %@ *: . ", -" . X X X -* X X X *& *: . ", -" . X X X -* $ X X X # -* %* . ", -" . X X X *XXXXXXXXX =; &*o; X X X X =; &*o; :* . ", -" . XXXX X =+#&;$% X X XXXX X X =+#&;$% > :o . ", -" . X X X XXXXXXXXXXX %O$= X X X *XXXXXXXXX X X %O$= O - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX . ", -" . X X X *XXXXXXXXX o$;;%#+ X X X X X o$;;%#+ :$o - . ", -" . X X X > -* > # X X X $ > -* > ::> - . ", -" . X X X X ;o -* X X X *- ;o %: - . ", -" . XXXX XX XXXXX @% XXXXXX XXX %: *+ - . ", -" . XXX =; ;o - *: XXXX X . ", -" . X X + + O *: XX XXX . ", -" . X X o> >o - %@ X X . ", -" . X ;*:* X X . ", -" . X @@:* X . ", -" . X *:- X XXXX . ", -" . X =-- X X . ", -" . X $$ X X . ", -" . X -- X X . ", -" . X X +- X X . ", -" . XXXXXX :& XXXXXX . ", -" . >: . ", -" . . ", -" ................................................................................................................................................................................................... ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ......................................................................................................................................................................... ", -" . . ", -" . . ", -" . X . ", -" . XXX . ", -" . X . ", -" . X . ", -" . X . ", -" . X . ", -" . X . ", -" . X . ", -" . X . ", -" . XXXXX XX X . ", -" . X X X X XXX . ", -" . X X X . ", -" . X X X . ", -" . X X X *XXXXXXXXX . ", -" . XXXX XX . ", -" . X X X . ", -" . X X X *XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX . ", -" . X X X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX . ", -" . X X X X . ", -" . XXXX XX XXX . ", -" . XXXX X X X . ", -" . XX XXX o XXX XXX . ", -" . X X - X X . ", -" . X X - X X . ", -" . X - X X . ", -" . X XXXX - X X . ", -" . X X o----O---- X X . ", -" . X X - X X . ", -" . X X - X X . ", -" . X X - X X . ", -" . XXXXXX - XXX XXX . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX . ", -" . XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX . ", -" . o% %o . ", -" . + + . ", -" . XXXXXXX o; XXXX X X ;= XXXXX XXX . ", -" . X X :% XX XXX XXX %@ X X X X . ", -" . X X X -* X X X *& X X X . ", -" . X X -* $ X X X # X X X . ", -" . X XXX XX X XXX =; &*o; X X X X X X X . ", -" . X XX X X X X X =+#&;$% X X XXXX X X XXXX X . ", -" . X X X X X X %O$= X X X *XXXXXXXXX X X X X X . ", -" . X X X X X X o$;;%#+ X X X X X X X X . ", -" . X X X X X XX X > -* > # X X X $ X X X . ", -" . X X X XX X XX XX X ;o -* X X X *- X X X X . ", -" . XXXXXXX XXX XXX XX XXX @% XXXXXX XXX %: XXXX XX XXXXX . ", -" . =; ;o . ", -" . + + . ", -" . o> >o . ", -" ......................................................................................................................................................................... ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ............................................................................................................................................................... ", -" . . ", -" . . ", -" . X . ", -" . XXX . ", -" . X . ", -" . X . ", -" . X . ", -" . X . ", -" . X . ", -" . X . ", -" . X . ", -" . XXXXX XX X . ", -" . X X X XXX . ", -" . X X X . ", -" . X X X . ", -" . X X X *XXXXXXXXX . ", -" . XXXX X . ", -" . X X X . ", -" . X X X *XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX . ", -" . X X X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX . ", -" . X X X . ", -" . XXXX XX XXXX . ", -" . . ", -" . XXXX X X X . ", -" . XX XXX o XXX XXX . ", -" . X X - X X . ", -" . X X - X X . ", -" . X - X X . ", -" . X XXXX - X X . ", -" . X X o----O---- X X . ", -" . X X - X X . ", -" . X X - X X . ", -" . X X - X X . ", -" . XXXXXX - XXX XXX . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX . ", -" . . ", -" . o% %o . ", -" . + + . ", -" . XXXXXXX o; XXXX X X ;= XXXXX XXX . ", -" . X X X :% XX XXX XXX %@ X X X X . ", -" . X X -* X X X *& X X X . ", -" . X -* $ X X X # X X X . ", -" . X XXX XX XX =; &*o; X X X X X X X . ", -" . X X X X X =+#&;$% X X XXXX X X XXXX X . ", -" . X X XX X %O$= X X X *XXXXXXXXX X X X X X . ", -" . X X XX X o$;;%#+ X X X X X X X X . ", -" . X X X X X > -* > # X X X $ X X X . ", -" . X X X X X X X ;o -* X X X *- X X X X . ", -" . XXXXXXX XX X XX @% XXXXXX XXX %: XXXX XX XXXXX . ", -" . =; ;o . ", -" . + + . ", -" . o> >o . ", -" ............................................................................................................................................................... ", -" ", -" ", -" ", -" " -}; diff --git a/pcb_calculator/bitmaps/sources/attenuator/bridged_tee_formula.png b/pcb_calculator/bitmaps/sources/attenuator/bridged_tee_formula.png deleted file mode 100644 index bdddbe4050..0000000000 Binary files a/pcb_calculator/bitmaps/sources/attenuator/bridged_tee_formula.png and /dev/null differ diff --git a/pcb_calculator/bitmaps/sources/attenuator/pi_formula.png b/pcb_calculator/bitmaps/sources/attenuator/pi_formula.png deleted file mode 100644 index 69f9210f97..0000000000 Binary files a/pcb_calculator/bitmaps/sources/attenuator/pi_formula.png and /dev/null differ diff --git a/pcb_calculator/bitmaps/sources/attenuator/splitter_formula.png b/pcb_calculator/bitmaps/sources/attenuator/splitter_formula.png deleted file mode 100644 index a7ca12ac5e..0000000000 Binary files a/pcb_calculator/bitmaps/sources/attenuator/splitter_formula.png and /dev/null differ diff --git a/pcb_calculator/bitmaps/sources/attenuator/splitter_formula.xpm b/pcb_calculator/bitmaps/sources/attenuator/splitter_formula.xpm deleted file mode 100644 index 781fe92ec2..0000000000 --- a/pcb_calculator/bitmaps/sources/attenuator/splitter_formula.xpm +++ /dev/null @@ -1,135 +0,0 @@ -/* XPM */ -static const char *splitter_formula_xpm[] = { -/* columns rows colors chars-per-pixel */ -"230 112 17 1", -". c Black", -"& c #D9D9D9", -"+ c #E1E1E1", -"$ c #F0F0F0", -" c #FFFFFF", -"@ c #E9E9E9", -"% c #BDBDBD", -"# c #4D4D4D", -"- c #A7A7A7", -"o c #7C7C7C", -"X c #9A9A9A", -"* c #C7C7C7", -"> c #C0C0C0", -"; c #8C8C8C", -": c #B2B2B2", -"= c #D0D0D0", -"O c #686868", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" . . ... . ...... ", -" . . .. . . ", -" . . . . . . . . . ", -" . . . . . . . . . ", -" . . .... .... ... . .. .. .. ... .... . .. . .. ......... . .. .. . . . ", -" . . . . . . ... . . . . . . .. . . ... . .. . . .. ..... ", -" . . . . ..... . . . . .. . . . . . . . . . . . . ", -" ..... . . . . . . . .. . . . . . . . ......... . . . . . . ", -" . . . . . . . . . . . . . . . . . . . . . . . ", -" . . . . . . . . . . . ... . .. . . . . . . . . . . ... . . ", -" .... .... .. .. ... ... ... .. . ... .. .. ... .. ... ... .. .. . ....... ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" .......X oo .......X ... oo ... oo ... ", -" .O+ @.#$ oo .O+ @.#$ % .. oo .. oo .. ", -" .& o.% .& o.% $# .. .. .. ", -" % *.O % *.O o. .. .. .. ", -" #.+ ... ...=#.= ........ #.+ $-..-$ ... ... o.... ........ $-.%.. $-..- =#... ... ...@Oo $-..- $-.%.. ... ...=#- =.-$ ...%.-$ $-..- $-.%.. $;..-$ ...=#.= X.#: $-..- ", -" -.- .. ..= .# -.- #.==.# .. .. .. #.==.. #.==.# #. *. .. ..&=o #.==.# #.==.. .. ..==.#.-.# ..+=.# #.==.# #.==.. O.$=.# ..= .# X.+:# #.==.# ", -" +.# .. .. .. +.# .. .. .. .. .. .. .. .. .. O.;$ .. .. .. .. .. .. .. .. ..= .. .. .. .. .. .. .. @.. .. .. #. .. .. ", -" O.* . .. .. .. ........ O.* . .. .. .. .. .. ........ .. .. ...... @o.#@ .. .. ...... .. .. .. .. .. .. .. .. ...... .. .. -.-.. .. .. .. ...... ", -" %.; =o .. .. .. %.; =o .. .. .. .. .. .. .. #. -.# .. .. #. .. .. .. .. .. .. .. .. #. .. .. :.= .. .. .. #o #. ", -" $#.@ *#; .. .. .. $#.@ *#; #.==.# #. =.. ..&; #.=*.. :.% =X .* .# .. .. :.% =X #.=*.. .. .. .. .. ..*=.# :.% =X #.=*.. #.==.. .. .. -#&+X :.% =X ", -" X.......; .... .... ... X.......; $-..-$ =##%... =#O@ $-.=... :..- .&O#= ........ :..- $-.=... .... .... ... ... ..:.-$ :..- $-.=... $Xo&o.: .... ... ;.;@ :..- ", -" .. ", -" .. ", -" .... ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ", -" > > ", -" > $ > ", -" > ..... .. ..... ... ..... .. ....... O .... > ", -" > . . . . . . . . . . . . . . &o . . > ", -" > . . . . . . . . . . . -% . > ", -" > . . . . . . . . . . O@ . > ", -" > . . . +......... . . . +......... . . . +......... . ... .. .. @# . > ", -" > .... . .... . .... .. . . . . . *X ... > ", -" > . . . . . . . . . . . .. . ;= . > ", -" > . . . +......... . . . +......... . . . +......... . . .. . .$ . > ", -" > . . . . . . . . . . . . . . &o . > ", -" > . . . . . . . . . . . . . . . . . . :: . > ", -" > .... .. .... .... .. ..... .... .. ... ....... .. . .. O+ .... > ", -" > > ", -" > > ", -" > > ", -" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/pcb_calculator/bitmaps/sources/attenuator/tee_formula.png b/pcb_calculator/bitmaps/sources/attenuator/tee_formula.png deleted file mode 100644 index 34e19e03b5..0000000000 Binary files a/pcb_calculator/bitmaps/sources/attenuator/tee_formula.png and /dev/null differ diff --git a/pcb_calculator/bitmaps/splitter_formula.xpm b/pcb_calculator/bitmaps/splitter_formula.xpm deleted file mode 100644 index 781fe92ec2..0000000000 --- a/pcb_calculator/bitmaps/splitter_formula.xpm +++ /dev/null @@ -1,135 +0,0 @@ -/* XPM */ -static const char *splitter_formula_xpm[] = { -/* columns rows colors chars-per-pixel */ -"230 112 17 1", -". c Black", -"& c #D9D9D9", -"+ c #E1E1E1", -"$ c #F0F0F0", -" c #FFFFFF", -"@ c #E9E9E9", -"% c #BDBDBD", -"# c #4D4D4D", -"- c #A7A7A7", -"o c #7C7C7C", -"X c #9A9A9A", -"* c #C7C7C7", -"> c #C0C0C0", -"; c #8C8C8C", -": c #B2B2B2", -"= c #D0D0D0", -"O c #686868", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" . . ... . ...... ", -" . . .. . . ", -" . . . . . . . . . ", -" . . . . . . . . . ", -" . . .... .... ... . .. .. .. ... .... . .. . .. ......... . .. .. . . . ", -" . . . . . . ... . . . . . . .. . . ... . .. . . .. ..... ", -" . . . . ..... . . . . .. . . . . . . . . . . . . ", -" ..... . . . . . . . .. . . . . . . . ......... . . . . . . ", -" . . . . . . . . . . . . . . . . . . . . . . . ", -" . . . . . . . . . . . ... . .. . . . . . . . . . . ... . . ", -" .... .... .. .. ... ... ... .. . ... .. .. ... .. ... ... .. .. . ....... ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" .......X oo .......X ... oo ... oo ... ", -" .O+ @.#$ oo .O+ @.#$ % .. oo .. oo .. ", -" .& o.% .& o.% $# .. .. .. ", -" % *.O % *.O o. .. .. .. ", -" #.+ ... ...=#.= ........ #.+ $-..-$ ... ... o.... ........ $-.%.. $-..- =#... ... ...@Oo $-..- $-.%.. ... ...=#- =.-$ ...%.-$ $-..- $-.%.. $;..-$ ...=#.= X.#: $-..- ", -" -.- .. ..= .# -.- #.==.# .. .. .. #.==.. #.==.# #. *. .. ..&=o #.==.# #.==.. .. ..==.#.-.# ..+=.# #.==.# #.==.. O.$=.# ..= .# X.+:# #.==.# ", -" +.# .. .. .. +.# .. .. .. .. .. .. .. .. .. O.;$ .. .. .. .. .. .. .. .. ..= .. .. .. .. .. .. .. @.. .. .. #. .. .. ", -" O.* . .. .. .. ........ O.* . .. .. .. .. .. ........ .. .. ...... @o.#@ .. .. ...... .. .. .. .. .. .. .. .. ...... .. .. -.-.. .. .. .. ...... ", -" %.; =o .. .. .. %.; =o .. .. .. .. .. .. .. #. -.# .. .. #. .. .. .. .. .. .. .. .. #. .. .. :.= .. .. .. #o #. ", -" $#.@ *#; .. .. .. $#.@ *#; #.==.# #. =.. ..&; #.=*.. :.% =X .* .# .. .. :.% =X #.=*.. .. .. .. .. ..*=.# :.% =X #.=*.. #.==.. .. .. -#&+X :.% =X ", -" X.......; .... .... ... X.......; $-..-$ =##%... =#O@ $-.=... :..- .&O#= ........ :..- $-.=... .... .... ... ... ..:.-$ :..- $-.=... $Xo&o.: .... ... ;.;@ :..- ", -" .. ", -" .. ", -" .... ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ", -" > > ", -" > $ > ", -" > ..... .. ..... ... ..... .. ....... O .... > ", -" > . . . . . . . . . . . . . . &o . . > ", -" > . . . . . . . . . . . -% . > ", -" > . . . . . . . . . . O@ . > ", -" > . . . +......... . . . +......... . . . +......... . ... .. .. @# . > ", -" > .... . .... . .... .. . . . . . *X ... > ", -" > . . . . . . . . . . . .. . ;= . > ", -" > . . . +......... . . . +......... . . . +......... . . .. . .$ . > ", -" > . . . . . . . . . . . . . . &o . > ", -" > . . . . . . . . . . . . . . . . . . :: . > ", -" > .... .. .... .... .. ..... .... .. ... ....... .. . .. O+ .... > ", -" > > ", -" > > ", -" > > ", -" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/pcb_calculator/bitmaps/tee_formula.xpm b/pcb_calculator/bitmaps/tee_formula.xpm deleted file mode 100644 index 62e6f7a14e..0000000000 --- a/pcb_calculator/bitmaps/tee_formula.xpm +++ /dev/null @@ -1,271 +0,0 @@ -/* XPM */ -static const char *tee_formula_xpm[] = { -/* columns rows colors chars-per-pixel */ -"255 248 17 1", -"X c Black", -"> c #D9D9D9", -"* c #E1E1E1", -"= c #F0F0F0", -" c #FFFFFF", -"o c #E9E9E9", -": c #BDBDBD", -"O c #4D4D4D", -"+ c #A7A7A7", -"# c #7C7C7C", -"& c #9A9A9A", -"@ c #C7C7C7", -". c #C0C0C0", -"- c #8C8C8C", -"; c #B2B2B2", -"% c #D0D0D0", -"$ c #686868", -/* pixels */ -" ", -" ", -" .............................................................. ", -" . . ", -" . X . ", -" . XX . ", -" . X X . ", -" . X X . ", -" . XXX . ", -" . X X . ", -" . XXX XXX . ", -" . . ", -" . . ", -" . XXXXXXXXXXXX . ", -" . . ", -" . XX XX . ", -" . X X X X . ", -" . X X X . ", -" . XXXX X X XX X X X . X X oO X X X XXXXXX ", -" . XX XXX XXX X X X X X . XX +X@ XX X X ", -" . X X X X X X X X X . X X #X$ X X X X X X ", -" . X X X X X XXXX XX . X X %@&X% X X X X X X ", -" . X *XXXXXXXXX X X X . XXX XXX XXX X XXXX X XX #=*X- XXXXXXXXX XXX XXXXXXXX XXX X XX XX XX XXX XXXX X XX X XX X X XX XX X X X ", -" . X XXXX X X X . X X X XX X XX X o& #X* X X X X X X XXX X X X X X X XX X X XXX X XX XXX X X XX XXXXX ", -" . X X X X X . X X X X X X X +% %X+ XX X X XXXXX X X X X XX X X X X X X X X X X X X X ", -" . X X *XXXXXXXXX X X X . X X X X X X X X OXXXXXX= XXXXXXXXX XX X X X X X X X X XX X X X X X X X X X X X X X X ", -" . X X X X X . X X X X X X X X @; ;X+ X X X X X X X X X X X X X X X X X X X X X X X X ", -" . X X X X X . XX XX X X X X X *O* =XX% X XX X X X X X X X X X XXX X XX X X X X X X X X X X X XXX X X ", -" . XXXXXX XXX XX . X X XXX XX XXX XXX *XXX: *XXXX: XXX XX XX XX XXX XXX XXX XX X XXX XX XX XXX XX XXX XXX XXX XXX XXX XX X XXXXXXX ", -" . . ", -" . . ", -" . . ", -" .............................................................. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" XXXXXXX X X X X X X X ", -" X X XX XX XX ", -" X X X X X X ", -" X X X X X ", -" X X X XX XXXXXXXXX XX X XXX XXX X X XX XXX XX X X X XX X XX XX XX XXXX X X XX XX X XX XXX XX X XXX X XX XXX XXX ", -" X XX XXX X X XX X X X X XX XXX X X X XX XX XXX X XXX X X X X XX XXX XX X XXX X X X X XX X X XXX X X X X X ", -" X X X X X X XXXXX X X X XXXXX X X X X X X X X X X X X X X X X XXXXX X X XX X X X XXXXX ", -" X X X X XXXXXXXXX X X X XX X X X X X X X X X X X X X X X X X X X X X X XX X X X X X ", -" X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X ", -" X X X X X X XXX X X X X X X X X X XXX X X X XX X X XXX X X X X X X XX X X X X XXX X XX X X X X X X ", -" XXXXXXXX XXX XXX XXX XX X XXX XXX XXXXXX XXX XX X XXX XXX XXX X XX XX X XX XXX XXX XXX XXX X XX XXX XX X XXX XXXXX XXX XXX XXX ", -" X X ", -" X X ", -" XXX XXX ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" XXXXXXX X X X X X ", -" X X XX XX XX ", -" X X X X X X X X ", -" X X X X X X X ", -" X XX XX XX XXXX XXXXXXXXX XX X XXX XXX X X XX XXX XX X XX XX XX XXXX X XX XX XX XXXX X X XX XX X XX XXX XX X XXX X XX XXX XXX ", -" X X X X X X X XX X X X X XX XXX X X X XX X X X X X XXX X X X X XX XXX XX X XXX X X X X XX X X XXX X X X X X ", -" X X X X X X X X XXXXX X X X XXXXX X X X X X X X X X X X X X X X X X X XXXXX X X XX X X X XXXXX ", -" X X X X X X XXXXXXXXX X X X XX X X X X X X X X X X X X X X X X X X X X X X X X XX X X X X X ", -" X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X ", -" X X X X X XXX X X X XXX X X X X X X X X X XXX X X X XXX X X XX X X XXX X X X X X X XX X X X X XXX X XX X X X X X X ", -" XXXXXXXX XX XX X XX XX X XXX XXX XXXXXX XXX XX X XX XX X XX X XX XX X XX XXX XXX XXX XXX X XX XXX XX X XXX XXXXX XXX XXX XXX ", -" X X ", -" X X ", -" XXX XXX ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ................................................................................................................................................................ ", -" . ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX . ", -" . ; . ", -" . ; . ", -" . *> . ", -" . XXX := XXXXXXX XXXXXXX XXXX X . ", -" . X X + X X X X X XX XXX . ", -" . X X + X X X X X X X . ", -" . X -* *@ X -* X X -* X X . ", -" . X =; &*o; > :o X XXX XX XX =; &*o; X XXX XX X XXX =; &*o; X . ", -" . X =+#&;$% @-o - X X X X X =+#&;$% X XX X X X X X =+#&;$% X XXXX . ", -" . X %O$= >+ - X X XX X %O$= X X X X X X %O$= X X . ", -" . X o$;;%#+ # o: X X XX X o$;;%#+ X X X X X X o$;;%#+ X X . ", -" . X > -* > ;>@> X X X X X > -* > X X X X X XX X > -* > X X . ", -" . XXXXX XXX X X ;o =&& X X X X X X X ;o X X X XX X XX X X X ;o X X . ", -" . X X X X XXXXXX #- XXXXXXX XX X XX XXXXXXX XXX XXX XX XXX XXXXXX . ", -" . X X X %+ . ", -" . X X X . ", -" . X X X *XXXXXXXXX . ", -" . XXXX X . ", -" . X X X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX . ", -" . X X X *XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX . ", -" . X X X . ", -" . X X X X o% %o . ", -" . XXXX XX XXXXX + + . ", -" . o; XXXX X X ;= . ", -" . :% XX XXX XXX %@ . ", -" . -* X X X *& . ", -" . $ X X X # . ", -" . X X X X . ", -" . X X XXXX X X . ", -" . X X X *XXXXXXXXX X X . ", -" . X X X X X . ", -" . # X X X $ . ", -" . -* X X X *- . ", -" . @% XXXXXX XXX %: . ", -" . =; ;o . ", -" . + + . ", -" . o> >o . ", -" ................................................................................................................................................................ ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ........................................................................................................................................................ ", -" . . ", -" . . ", -" . XXXX X X . ", -" . XX XXX o XXX . ", -" . X X - X . ", -" . X X - X . ", -" . X - X . ", -" . X XXXX - X . ", -" . X X o----O---- X . ", -" . X X - X . ", -" . X X - X . ", -" . XXXXX XX XXXXXXX X X - X XXXXX XXX . ", -" . X X X X X X XXXXXX - XXX X X X X . ", -" . X X X X X X X X X . ", -" . X X X X X -* X X X . ", -" . X X X *XXXXXXXXX X XXX XX X XXX =; &*o; X X X . ", -" . XXXX XX X XX X X X X X =+#&;$% XXXX X . ", -" . X X X X X X X X X %O$= *XXXXXXXXX X X X . ", -" . X X X *XXXXXXXXX X X X X X X o$;;%#+ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X X . ", -" . X X X X X X X X XX X > -* > XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X X . ", -" . X X X X X X X XX X XX X X X ;o X X X X . ", -" . XXXX XX XXX XXXXXXX XXX XXX XX XXX XXXX XX XXXXX . ", -" . XXXX X X . ", -" . XX XXX XXX . ", -" . X X X . ", -" . X X X . ", -" . X X . ", -" . X XXXX X . ", -" . X X *XXXXXXXXX X . ", -" . X X X . ", -" . X X X . ", -" . X X X . ", -" . XXXXXX XXX . ", -" . . ", -" . . ", -" . . ", -" ........................................................................................................................................................ ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" .............................................................................................................................................. ", -" . . ", -" . . ", -" . XXXX X X . ", -" . XX XXX o XXX . ", -" . X X - X . ", -" . X X - X . ", -" . X - X . ", -" . X XXXX - X . ", -" . X X o----O---- X . ", -" . X X - X . ", -" . X X - X . ", -" . XXXXX XX XXXXXXX X X - X XXXXX XXX . ", -" . X X X X X X XXXXXX - XXX X X X X . ", -" . X X X X X X X X . ", -" . X X X X -* X X X . ", -" . X X X *XXXXXXXXX X XXX XX XX =; &*o; X X X . ", -" . XXXX X X X X X X =+#&;$% XXXX X . ", -" . X X X X X XX X %O$= *XXXXXXXXX X X X . ", -" . X X X *XXXXXXXXX X X XX X o$;;%#+ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X X . ", -" . X X X X X X X X > -* > XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X X . ", -" . X X X X X X X X X X ;o X X X X . ", -" . XXXX XX XXXX XXXXXXX XX X XX XXXX XX XXXXX . ", -" . XXXX X X . ", -" . XX XXX XXX . ", -" . X X X . ", -" . X X X . ", -" . X X . ", -" . X XXXX X . ", -" . X X *XXXXXXXXX X . ", -" . X X X . ", -" . X X X . ", -" . X X X . ", -" . XXXXXX XXX . ", -" . . ", -" . . ", -" . . ", -" .............................................................................................................................................. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; diff --git a/pcb_calculator/dialogs/dialog_regulator_data.fbp b/pcb_calculator/dialogs/dialog_regulator_data.fbp index 1b92c149b2..b3051a1ee0 100644 --- a/pcb_calculator/dialogs/dialog_regulator_data.fbp +++ b/pcb_calculator/dialogs/dialog_regulator_data.fbp @@ -1,6 +1,6 @@ - + C++ @@ -20,67 +20,35 @@ . 1 + 1 1 1 + UI 0 0 - 1 - 1 - 1 - 1 - 0 - - - - + wxAUI_MGR_DEFAULT - - 1 wxBOTH - 0 - 1 1 - 0 - Dock - 0 - Left 1 impl_virtual - 1 - 0 0 wxID_ANY - - 0 - - 0 - 1 DIALOG_EDITOR_DATA_BASE - 1 - - - 1 - Resizable - 1 - 310,210 + 292,200 wxDEFAULT_DIALOG_STYLE DIALOG_SHIM; dialog_shim.h Regulator Parameters - 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -195,10 +163,6 @@ 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -383,10 +347,6 @@ 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -561,10 +521,6 @@ 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -648,10 +604,6 @@ 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -833,10 +785,6 @@ 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -1011,10 +959,6 @@ 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -1046,6 +990,16 @@
+ + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + 5 wxEXPAND | wxALL @@ -1099,10 +1053,6 @@ 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -1133,7 +1083,7 @@ 5 - wxEXPAND + wxEXPAND|wxALL 0 0 @@ -1148,7 +1098,7 @@ m_sdbSizerButtons protected - OnCancelClick + diff --git a/pcb_calculator/dialogs/dialog_regulator_data_base.cpp b/pcb_calculator/dialogs/dialog_regulator_data_base.cpp index f504f05e8a..6984ce9163 100644 --- a/pcb_calculator/dialogs/dialog_regulator_data_base.cpp +++ b/pcb_calculator/dialogs/dialog_regulator_data_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 17 2012) +// C++ code generated with wxFormBuilder (version Jan 1 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -71,6 +71,9 @@ DIALOG_EDITOR_DATA_BASE::DIALOG_EDITOR_DATA_BASE( wxWindow* parent, wxWindowID i bSizerMain->Add( fgSizerPrms, 0, wxEXPAND, 5 ); + + bSizerMain->Add( 0, 0, 1, wxEXPAND, 5 ); + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bSizerMain->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); @@ -81,7 +84,7 @@ DIALOG_EDITOR_DATA_BASE::DIALOG_EDITOR_DATA_BASE( wxWindow* parent, wxWindowID i m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); m_sdbSizerButtons->Realize(); - bSizerMain->Add( m_sdbSizerButtons, 0, wxEXPAND, 5 ); + bSizerMain->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALL, 5 ); this->SetSizer( bSizerMain ); @@ -91,7 +94,6 @@ DIALOG_EDITOR_DATA_BASE::DIALOG_EDITOR_DATA_BASE( wxWindow* parent, wxWindowID i // Connect Events m_choiceRegType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnRegTypeSelection ), NULL, this ); - m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnCancelClick ), NULL, this ); m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnOKClick ), NULL, this ); } @@ -99,7 +101,6 @@ DIALOG_EDITOR_DATA_BASE::~DIALOG_EDITOR_DATA_BASE() { // Disconnect Events m_choiceRegType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnRegTypeSelection ), NULL, this ); - m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnCancelClick ), NULL, this ); m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDITOR_DATA_BASE::OnOKClick ), NULL, this ); } diff --git a/pcb_calculator/dialogs/dialog_regulator_data_base.h b/pcb_calculator/dialogs/dialog_regulator_data_base.h index c52b57e464..e3993d70ed 100644 --- a/pcb_calculator/dialogs/dialog_regulator_data_base.h +++ b/pcb_calculator/dialogs/dialog_regulator_data_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 17 2012) +// C++ code generated with wxFormBuilder (version Jan 1 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,8 @@ #include #include #include +class DIALOG_SHIM; + #include "dialog_shim.h" #include #include @@ -53,13 +55,12 @@ class DIALOG_EDITOR_DATA_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnRegTypeSelection( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); } public: - DIALOG_EDITOR_DATA_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Regulator Parameters"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 310,210 ), long style = wxDEFAULT_DIALOG_STYLE ); + DIALOG_EDITOR_DATA_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Regulator Parameters"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 292,200 ), long style = wxDEFAULT_DIALOG_STYLE ); ~DIALOG_EDITOR_DATA_BASE(); }; diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp index 5682d2da30..fc7d81fce6 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp @@ -518,7 +518,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_panelTrackWidth->SetSizer( bSizerTrackWidth ); m_panelTrackWidth->Layout(); bSizerTrackWidth->Fit( m_panelTrackWidth ); - m_Notebook->AddPage( m_panelTrackWidth, _("Track Width"), true ); + m_Notebook->AddPage( m_panelTrackWidth, _("Track Width"), false ); m_panelElectricalSpacing = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerElectricalClearance; bSizerElectricalClearance = new wxBoxSizer( wxHORIZONTAL ); @@ -1161,9 +1161,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow wxStaticBoxSizer* sbRightSizerFormula; sbRightSizerFormula = new wxStaticBoxSizer( new wxStaticBox( sbSizerAtt->GetStaticBox(), wxID_ANY, _("Formula") ), wxVERTICAL ); - m_panelAttFormula = new wxPanel( sbRightSizerFormula->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); - m_panelAttFormula->SetMinSize( wxSize( 200,-1 ) ); - + m_panelAttFormula = new wxHtmlWindow( sbRightSizerFormula->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); sbRightSizerFormula->Add( m_panelAttFormula, 1, wxALL|wxEXPAND, 5 ); @@ -1173,7 +1171,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_panelAttenuators->SetSizer( sbSizerAtt ); m_panelAttenuators->Layout(); sbSizerAtt->Fit( m_panelAttenuators ); - m_Notebook->AddPage( m_panelAttenuators, _("RF Attenuators"), false ); + m_Notebook->AddPage( m_panelAttenuators, _("RF Attenuators"), true ); m_panelColorCode = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerPanelColorCode; bSizerPanelColorCode = new wxBoxSizer( wxHORIZONTAL ); @@ -1349,7 +1347,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_AttenuatorsSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnAttenuatorSelection ), NULL, this ); m_panelDisplayAttenuator->Connect( wxEVT_PAINT, wxPaintEventHandler( PCB_CALCULATOR_FRAME_BASE::OnPaintAttenuatorPanel ), NULL, this ); m_buttonAlcAtt->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateAttenuator ), NULL, this ); - m_panelAttFormula->Connect( wxEVT_PAINT, wxPaintEventHandler( PCB_CALCULATOR_FRAME_BASE::OnPaintAttFormulaPanel ), NULL, this ); m_rbToleranceSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnToleranceSelection ), NULL, this ); m_BoardClassesUnitsSelector->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnBoardClassesUnitsSelection ), NULL, this ); } @@ -1390,7 +1387,6 @@ PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE() m_AttenuatorsSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnAttenuatorSelection ), NULL, this ); m_panelDisplayAttenuator->Disconnect( wxEVT_PAINT, wxPaintEventHandler( PCB_CALCULATOR_FRAME_BASE::OnPaintAttenuatorPanel ), NULL, this ); m_buttonAlcAtt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateAttenuator ), NULL, this ); - m_panelAttFormula->Disconnect( wxEVT_PAINT, wxPaintEventHandler( PCB_CALCULATOR_FRAME_BASE::OnPaintAttFormulaPanel ), NULL, this ); m_rbToleranceSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnToleranceSelection ), NULL, this ); m_BoardClassesUnitsSelector->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnBoardClassesUnitsSelection ), NULL, this ); diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp index 12ba002568..258bfdd361 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp @@ -3269,7 +3269,7 @@ Track Width - 1 + 0 1 1 @@ -15262,7 +15262,7 @@ RF Attenuators - 0 + 1 1 1 @@ -17506,11 +17506,11 @@ 1 none - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -17543,7 +17543,7 @@ 0 - 200,-1 + 1 m_panelAttFormula 1 @@ -17554,16 +17554,20 @@ Resizable 1 - -1,-1 + + wxHW_SCROLLBAR_AUTO 0 - wxSIMPLE_BORDER|wxTAB_TRAVERSAL + + + + @@ -17577,7 +17581,7 @@ - OnPaintAttFormulaPanel + diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.h b/pcb_calculator/dialogs/pcb_calculator_frame_base.h index 24dd80c26a..2fa282855e 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.h +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.h @@ -252,7 +252,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER wxStaticText* m_attR3Unit; wxStaticText* m_staticTextAttMsg; wxHtmlWindow* m_Attenuator_Messages; - wxPanel* m_panelAttFormula; + wxHtmlWindow* m_panelAttFormula; wxPanel* m_panelColorCode; wxRadioBox* m_rbToleranceSelection; wxStaticText* m_staticText31; @@ -298,7 +298,6 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER virtual void OnAttenuatorSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnPaintAttenuatorPanel( wxPaintEvent& event ) { event.Skip(); } virtual void OnCalculateAttenuator( wxCommandEvent& event ) { event.Skip(); } - virtual void OnPaintAttFormulaPanel( wxPaintEvent& event ) { event.Skip(); } virtual void OnToleranceSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnBoardClassesUnitsSelection( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcb_calculator/pcb_calculator.h b/pcb_calculator/pcb_calculator.h index 05cc6348df..3c685cbd0a 100644 --- a/pcb_calculator/pcb_calculator.h +++ b/pcb_calculator/pcb_calculator.h @@ -84,7 +84,6 @@ private: // icons that show the current item on the specific panels void OnPaintTranslinePanel( wxPaintEvent& event ); void OnPaintAttenuatorPanel( wxPaintEvent& event ); - void OnPaintAttFormulaPanel( wxPaintEvent& event ); // Config read-write, virtual from EDA_BASE_FRAME void LoadSettings( wxConfigBase* aCfg ); diff --git a/pcb_calculator/regulators_funct.cpp b/pcb_calculator/regulators_funct.cpp index a0ee082275..0d957031d2 100644 --- a/pcb_calculator/regulators_funct.cpp +++ b/pcb_calculator/regulators_funct.cpp @@ -106,24 +106,25 @@ void DIALOG_EDITOR_DATA::OnOKClick( wxCommandEvent& event ) bool DIALOG_EDITOR_DATA::IsOK() { - bool ok = true; + bool success = true; + if( m_textCtrlName->GetValue().IsEmpty() ) - ok = false; + success = false; if( m_textCtrlVref->GetValue().IsEmpty() ) - ok = false; + success = false; else { double vref = DoubleFromString( m_textCtrlVref->GetValue() ); if( fabs(vref) < 0.01 ) - ok = false; + success = false; } if( m_choiceRegType->GetSelection() == 1 ) { if( m_RegulIadjValue->GetValue().IsEmpty() ) - ok = false; + success = false; } - return ok; + return success; } void DIALOG_EDITOR_DATA::CopyRegulatorDataToDialog( REGULATOR_DATA * aItem ) diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index ae09495a12..fdbf2d874b 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -178,7 +178,7 @@ void DIALOG_BLOCK_OPTIONS::ExecuteCommand( wxCommandEvent& event ) } -int PCB_EDIT_FRAME::BlockCommand( int aKey ) +int PCB_EDIT_FRAME::BlockCommand( EDA_KEY aKey ) { int cmd = 0; diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index 47a5dc54be..c156cc7119 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -78,7 +78,7 @@ static void MoveMarkedItems( MODULE* module, wxPoint offset ); static void DeleteMarkedItems( MODULE* module ); -int FOOTPRINT_EDIT_FRAME::BlockCommand( int key ) +int FOOTPRINT_EDIT_FRAME::BlockCommand( EDA_KEY key ) { int cmd; @@ -88,7 +88,14 @@ int FOOTPRINT_EDIT_FRAME::BlockCommand( int key ) cmd = key & 0xFF; break; - case - 1: + case EDA_KEY_C( 0xffffffff ): // -1 + // Historically, -1 has been used as a key, which can cause bit flag + // clashes with unaware code. On debug builds, catch any old code that + // might still be doing this. TODO: remove if sure all this old code is gone. + wxFAIL_MSG( "negative EDA_KEY value should be converted to GR_KEY_INVALID" ); + // fall through on release builds + + case GR_KEY_INVALID: cmd = BLOCK_PRESELECT_MOVE; break; diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 0367c14a9a..262ae7a8f0 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -252,7 +252,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) // Calculate dimension value measure = KiROUND( hypot( deltax, deltay ) ); - angle = atan2( deltay, deltax ); + angle = atan2( (double)deltay, (double)deltax ); // Calculation of parameters X and Y dimensions of the arrows and lines. hx = hy = ii; diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index d12a597741..93e5e8b776 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -166,7 +166,7 @@ public: { wxPoint delta( m_featureLineDO - m_featureLineGO ); - return atan2( delta.y, delta.x ); + return atan2( (double)delta.y, (double)delta.x ); } /** diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index bd1ac7356c..c9ceb6ffa1 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -391,8 +391,8 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKGREEN ) ); // angle counter-clockwise from 3'o-clock - const double deg = RAD2DEG( atan2( m_Start.y - m_End.y, - m_End.x - m_Start.x ) ); + const double deg = RAD2DEG( atan2( (double)( m_Start.y - m_End.y ), + (double)( m_End.x - m_Start.x ) ) ); msg.Printf( wxT( "%.1f" ), deg ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) ); } @@ -564,7 +564,8 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy case S_ARC: radius = hypot( (double)( GetEnd().x - GetStart().x ), (double)( GetEnd().y - GetStart().y ) ); - theta = std::atan2( GetEnd().y - GetStart().y , GetEnd().x - GetStart().x ); + theta = std::atan2( (double)( GetEnd().y - GetStart().y ), + (double)( GetEnd().x - GetStart().x ) ); //Approximate the arc with two lines. This should be accurate enough for selection. p1.x = radius * std::cos( theta + M_PI/4 ) + GetStart().x; diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index f26bc00ce3..d3e5cabd70 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -690,7 +690,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, if( delta.y ) // lower and upper segment is horizontal { // Calculate angle of left (or right) segment with vertical axis - angle = atan2( m_DeltaSize.y, m_Size.y ); + angle = atan2( (double) m_DeltaSize.y, (double) m_Size.y ); // left and right sides are moved by aInflateValue.x in their perpendicular direction // We must calculate the corresponding displacement on the horizontal axis @@ -706,7 +706,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, else if( delta.x ) // left and right segment is vertical { // Calculate angle of lower (or upper) segment with horizontal axis - angle = atan2( m_DeltaSize.x, m_Size.x ); + angle = atan2( (double) m_DeltaSize.x, (double) m_Size.x ); // lower and upper sides are moved by aInflateValue.x in their perpendicular direction // We must calculate the corresponding displacement on the vertical axis diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index feb2af2f91..17d041f450 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -485,6 +485,7 @@ void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor ) { KIGFX::VIEW* view = myframe->GetGalCanvas()->GetView(); view->GetPainter()->GetSettings()->ImportLegacyColors( myframe->GetBoard()->GetColorsSettings() ); + view->UpdateLayerColor( aId ); } myframe->GetCanvas()->Refresh(); diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index d9475f2179..c7b231b9fa 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -282,7 +282,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) } -bool PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +bool PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) { bool eventHandled = true; diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 1bd7e003a9..9c95569ee1 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -38,14 +38,15 @@ */ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) { - char line[1024]; - wxString msg; - wxString modName; - char* idcmd; - char* text; - MODULE* module = 0; - BOARD* pcb = GetBoard(); - wxPoint pos; + char line[1024]; + wxString msg; + wxString modName; + char* idcmd; + char* text; + MODULE* module = NULL; + D_PAD* pad = NULL; + BOARD* pcb = GetBoard(); + wxPoint pos; strncpy( line, cmdline, sizeof(line) - 1 ); line[sizeof(line) - 1] = 0; @@ -75,7 +76,6 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) else if( strcmp( idcmd, "$PIN:" ) == 0 ) { wxString pinName; - D_PAD* pad = NULL; int netcode = -1; pinName = FROM_UTF8( text ); @@ -132,7 +132,12 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) { if( IsGalCanvasActive() ) { - GetToolManager()->RunAction( COMMON_ACTIONS::crossProbeSchToPcb, true, module ); + GetToolManager()->RunAction( COMMON_ACTIONS::crossProbeSchToPcb, + true, + pad ? + static_cast( pad ) : + static_cast( module ) + ); } else { diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index a893c18dc5..ad9d9cac7c 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -804,9 +804,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) if( m_plotOpts.GetFormat() == PLOT_FORMAT_GERBER && m_useGerberExtensions->GetValue() ) file_ext = GetGerberProtelExtension( layer ); - // Create file name (from the English default layer name for non copper layers). BuildPlotFileName( &fn, outputDir.GetPath(), -// m_board->GetStandardLayerName( layer ), m_board->GetLayerName( layer ), file_ext ); diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index b9002f8368..57eaeba786 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -43,6 +43,9 @@ #include #include +#include +#include + #include #include @@ -54,6 +57,7 @@ void DRC::ShowDialog() { if( !m_ui ) { + m_mainWindow->GetToolManager()->RunAction( COMMON_ACTIONS::selectionClear, true ); m_ui = new DIALOG_DRC_CONTROL( this, m_mainWindow ); updatePointers(); diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index 11b43972e3..47bb737535 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -452,7 +452,7 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event ) } -bool FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +bool FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) { bool eventHandled = true; diff --git a/pcbnew/footprint_wizard_frame.h b/pcbnew/footprint_wizard_frame.h index a8ca4cb1d4..65e6d0d78d 100644 --- a/pcbnew/footprint_wizard_frame.h +++ b/pcbnew/footprint_wizard_frame.h @@ -151,7 +151,7 @@ private: void ClickOnPageList( wxCommandEvent& event ); void OnSetRelativeOffset( wxCommandEvent& event ); - bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ); void LoadSettings( wxConfigBase* aCfg ); // override virtual void SaveSettings( wxConfigBase* aCfg ); // override virtual diff --git a/pcbnew/github/github_plugin.cpp b/pcbnew/github/github_plugin.cpp index eea64109c0..9fa4e628fe 100644 --- a/pcbnew/github/github_plugin.cpp +++ b/pcbnew/github/github_plugin.cpp @@ -542,6 +542,7 @@ void GITHUB_PLUGIN::remoteGetZip( const wxString& aRepoURL ) throw( IO_ERROR ) catch( const IO_ERROR& ioe ) { // https "GET" has faild, report this to API caller. + // Note: kcurl.Perform() does not return an error if the file to download is not found UTF8 fmt( _( "%s\nCannot get/download Zip archive: '%s'\nfor library path: '%s'.\nReason: '%s'" ) ); std::string msg = StrPrintf( fmt.c_str(), diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 5ae07fd9ad..2902a037e0 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -65,7 +65,7 @@ static const wxString traceFootprintLibrary( wxT( "KicadFootprintLib" ) ); ///> Removes empty nets (i.e. with node count equal zero) from net classes void filterNetClass( const BOARD& aBoard, NETCLASS& aNetClass ) { - for( NETCLASS::const_iterator it = aNetClass.begin(); it != aNetClass.end(); ) + for( NETCLASS::iterator it = aNetClass.begin(); it != aNetClass.end(); ) { NETINFO_ITEM* netinfo = aBoard.FindNet( *it ); diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 15798f1137..d07f82b407 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -210,12 +210,12 @@ wxBitmapButton* LAYER_WIDGET::makeColorButton( wxWindow* aParent, EDA_COLOR_T aC // then create a wxBitmapButton from it. wxBitmap bitmap = makeBitmap( aColor ); -#ifndef __WXMAC__ +#ifdef __WXMAC__ wxBitmapButton* ret = new wxBitmapButton( aParent, aID, bitmap, - wxDefaultPosition, wxSize(BUTT_SIZE_X, BUTT_SIZE_Y), wxBORDER_RAISED ); + wxDefaultPosition, wxSize(BUTT_SIZE_X, BUTT_SIZE_Y), wxBORDER_NONE ); #else wxBitmapButton* ret = new wxBitmapButton( aParent, aID, bitmap, - wxDefaultPosition, wxSize(BUTT_SIZE_X, BUTT_SIZE_Y)); + wxDefaultPosition, wxSize(BUTT_SIZE_X, BUTT_SIZE_Y), wxBORDER_RAISED ); #endif // save the color value in the name, no where else to put it. ret->SetName( makeColorTxt( aColor ) ); @@ -422,9 +422,9 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) // column 1 (COLUMN_COLORBM) col = COLUMN_COLORBM; wxBitmapButton* bmb = makeColorButton( m_LayerScrolledWindow, aSpec.color, encodeId( col, aSpec.id ) ); - bmb->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this ); + bmb->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnMiddleDownLayerColor ), NULL, this ); bmb->Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnMiddleDownLayerColor ), NULL, this ); - bmb->SetToolTip( _("Left click to select, middle click for color change, right click for menu" ) ); + bmb->SetToolTip( _("Left click for color change, right click for menu" ) ); m_LayersFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags ); // column 2 (COLUMN_COLOR_LYR_CB) @@ -458,8 +458,9 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) if( aSpec.color != -1 ) { wxBitmapButton* bmb = makeColorButton( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ) ); + bmb->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnMiddleDownRenderColor ), NULL, this ); bmb->Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnMiddleDownRenderColor ), NULL, this ); - bmb->SetToolTip( _( "Middle click for color change" ) ); + bmb->SetToolTip( _( "Left click for color change" ) ); m_RenderFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags ); // could add a left click handler on the color button that toggles checkbox. diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index ce32a2ef18..9d81f4876c 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -167,7 +167,7 @@ public: */ void Show3D_Frame( wxCommandEvent& event ); - bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ); void OnVerticalToolbar( wxCommandEvent& aEvent ); void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ); @@ -242,7 +242,7 @@ public: bool Clear_Pcb( bool aQuery ); /* handlers for block commands */ - virtual int BlockCommand( int key ); + virtual int BlockCommand( EDA_KEY key ); /** * Function HandleBlockPlace diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 5eb232c387..4e3f822199 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -696,7 +696,7 @@ void FOOTPRINT_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event ) } -bool FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +bool FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) { bool eventHandled = true; diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index 6a39ae98fe..ef2a97e9dc 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -591,7 +591,7 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event ) } -bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) +bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) { bool eventHandled = true; diff --git a/pcbnew/modview_frame.h b/pcbnew/modview_frame.h index f0cf28d551..2e1909b6d3 100644 --- a/pcbnew/modview_frame.h +++ b/pcbnew/modview_frame.h @@ -104,7 +104,7 @@ private: void DClickOnFootprintList( wxCommandEvent& event ); void OnSetRelativeOffset( wxCommandEvent& event ); - bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 ); + bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ); ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription() EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const; diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index 4e551b35a6..aec5d69740 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -68,10 +68,16 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, bool aErase ); -int BuildCornersList_S_Shape( std::vector & aBuffer, +static int BuildCornersList_S_Shape( std::vector & aBuffer, wxPoint aStartPoint, wxPoint aEndPoint, int aLength, int aWidth ); +/** + * Creates a self-shaped coil for microwave applications. + */ +static MODULE* CreateMicrowaveInductor( PCB_EDIT_FRAME* aPcbFrame, wxString& aErrorMessage ); + + class MUWAVE_INDUCTOR { public: @@ -155,7 +161,28 @@ void PCB_EDIT_FRAME::Begin_Self( wxDC* DC ) { if( s_inductor_pattern.m_Flag ) { - Genere_Self( DC ); + m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); + m_canvas->SetMouseCapture( NULL, NULL ); + + wxString errorMessage; + + // Prepare parameters for inductor + // s_inductor_pattern.m_Start is already initialized, + // when s_inductor_pattern.m_Flag == false + s_inductor_pattern.m_Width = GetDesignSettings().GetCurrentTrackWidth(); + s_inductor_pattern.m_End = GetCrossHairPosition(); + + MODULE* footprint = CreateMicrowaveInductor( this, errorMessage ); + + if( footprint ) + { + SetMsgPanel( footprint ); + footprint->Draw( m_canvas, DC, GR_OR ); + } + + else if( !errorMessage.IsEmpty() ) + DisplayError( this, errorMessage ); + return; } @@ -173,32 +200,57 @@ void PCB_EDIT_FRAME::Begin_Self( wxDC* DC ) } -MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) + +MODULE* CreateMicrowaveInductor( PCB_EDIT_FRAME* aPcbFrame, wxString& aErrorMessage ) { + /* Build a microwave inductor footprint. + * - Length Mself.lng + * - Extremities Mself.m_Start and Mself.m_End + * We must determine: + * Mself.nbrin = number of segments perpendicular to the direction + * (The coil nbrin will demicercles + 1 + 2 1 / 4 circle) + * Mself.lbrin = length of a strand + * Mself.radius = radius of rounded parts of the coil + * Mself.delta = segments extremities connection between him and the coil even + * + * The equations are + * Mself.m_Size.x = 2 * Mself.radius + Mself.lbrin + * Mself.m_Size.y * Mself.delta = 2 + 2 * Mself.nbrin * Mself.radius + * Mself.lng = 2 * Mself.delta / / connections to the coil + + (Mself.nbrin-2) * Mself.lbrin / / length of the strands except 1st and last + + (Mself.nbrin 1) * (PI * Mself.radius) / / length of rounded + * Mself.lbrin + / 2 - Melf.radius * 2) / / length of 1st and last bit + * + * The constraints are: + * Nbrin >= 2 + * Mself.radius < Mself.m_Size.x + * Mself.m_Size.y = Mself.radius * 4 + 2 * Mself.raccord + * Mself.lbrin> Mself.radius * 2 + * + * The calculation is conducted in the following way: + * Initially: + * Nbrin = 2 + * Radius = 4 * m_Size.x (arbitrarily fixed value) + * Then: + * Increasing the number of segments to the desired length + * (Radius decreases if necessary) + */ + D_PAD* pad; int ll; wxString msg; - m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); - m_canvas->SetMouseCapture( NULL, NULL ); - - if( s_inductor_pattern.m_Flag == false ) - { - DisplayError( this, wxT( "Starting point not init.." ) ); - return NULL; - } + wxASSERT( s_inductor_pattern.m_Flag ); s_inductor_pattern.m_Flag = false; - s_inductor_pattern.m_End = GetCrossHairPosition(); - wxPoint pt = s_inductor_pattern.m_End - s_inductor_pattern.m_Start; int min_len = KiROUND( EuclideanNorm( pt ) ); s_inductor_pattern.m_lenght = min_len; // Enter the desired length. msg = StringFromValue( g_UserUnit, s_inductor_pattern.m_lenght ); - wxTextEntryDialog dlg( this, wxEmptyString, _( "Length of Trace:" ), msg ); + wxTextEntryDialog dlg( NULL, wxEmptyString, _( "Length of Trace:" ), msg ); if( dlg.ShowModal() != wxID_OK ) return NULL; // canceled by user @@ -209,13 +261,11 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) // Control values (ii = minimum length) if( s_inductor_pattern.m_lenght < min_len ) { - DisplayError( this, _( "Requested length < minimum length" ) ); + aErrorMessage = _( "Requested length < minimum length" ); return NULL; } // Calculate the elements. - s_inductor_pattern.m_Width = GetDesignSettings().GetCurrentTrackWidth(); - std::vector buffer; ll = BuildCornersList_S_Shape( buffer, s_inductor_pattern.m_Start, s_inductor_pattern.m_End, s_inductor_pattern.m_lenght, @@ -223,19 +273,19 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) if( !ll ) { - DisplayError( this, _( "Requested length too large" ) ); + aErrorMessage = _( "Requested length too large" ); return NULL; } // Generate footprint. the value is also used as footprint name. msg.Empty(); - wxTextEntryDialog cmpdlg( this, wxEmptyString, _( "Component Value:" ), msg ); + wxTextEntryDialog cmpdlg( NULL, wxEmptyString, _( "Component Value:" ), msg ); cmpdlg.SetTextValidator( FILE_NAME_CHAR_VALIDATOR( &msg ) ); if( ( cmpdlg.ShowModal() != wxID_OK ) || msg.IsEmpty() ) return NULL; // Aborted by user - MODULE* module = CreateNewModule( msg ); + MODULE* module = aPcbFrame->CreateNewModule( msg ); // here the module is already in the BOARD, CreateNewModule() does that. module->SetFPID( FPID( std::string( "mw_inductor" ) ) ); @@ -283,8 +333,6 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) pad->SetPos0( pad->GetPosition() - module->GetPosition() ); // Modify text positions. - SetMsgPanel( module ); - wxPoint refPos( ( s_inductor_pattern.m_Start.x + s_inductor_pattern.m_End.x ) / 2, ( s_inductor_pattern.m_Start.y + s_inductor_pattern.m_End.y ) / 2 ); @@ -296,8 +344,6 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) module->Value().SetPosition( valPos ); module->CalculateBoundingBox(); - module->Draw( m_canvas, DC, GR_OR ); - return module; } diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 1c33effe09..07dcd11ee7 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2013 CERN + * Copyright (C) 2013-2016 CERN * @author Tomasz Wlostowski * @author Maciej Suminski * @@ -1001,20 +1001,25 @@ void PCB_PAINTER::draw( const PCB_TARGET* aTarget ) void PCB_PAINTER::draw( const MARKER_PCB* aMarker ) { - const BOARD_ITEM* item = aMarker->GetItem(); + const int scale = 100000; + const VECTOR2D arrow[] = { + VECTOR2D( 0 * scale, 0 * scale ), + VECTOR2D( 8 * scale, 1 * scale ), + VECTOR2D( 4 * scale, 3 * scale ), + VECTOR2D( 13 * scale, 8 * scale ), + VECTOR2D( 9 * scale, 9 * scale ), + VECTOR2D( 8 * scale, 13 * scale ), + VECTOR2D( 3 * scale, 4 * scale ), + VECTOR2D( 1 * scale, 8 * scale ) + }; - if( item ) // By default draw an item in a different color - { - Draw( item, ITEM_GAL_LAYER( DRC_VISIBLE ) ); - } - else // If there is no item associated - draw a circle marking the DRC error - { - m_gal->SetStrokeColor( COLOR4D( 1.0, 0.0, 0.0, 1.0 ) ); - m_gal->SetIsFill( false ); - m_gal->SetIsStroke( true ); - m_gal->SetLineWidth( 10000 ); - m_gal->DrawCircle( VECTOR2D( aMarker->GetPosition() ), 200000 ); - } + m_gal->Save(); + m_gal->Translate( aMarker->GetPosition() ); + m_gal->SetFillColor( COLOR4D( 1.0, 0.0, 0.0, 1.0 ) ); + m_gal->SetIsFill( true ); + m_gal->SetIsStroke( false ); + m_gal->DrawPolygon( arrow, sizeof( arrow ) / sizeof( VECTOR2D ) ); + m_gal->Restore(); } diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 1ea9537567..17ce79e660 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -481,7 +481,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent ) { delta = cursorPos - firstItem->GetPosition(); - for( KIGFX::VIEW_GROUP::iter it = preview.Begin(), end = preview.End(); it != end; ++it ) + for( KIGFX::VIEW_GROUP::const_iter it = preview.Begin(), end = preview.End(); it != end; ++it ) static_cast( *it )->Move( wxPoint( delta.x, delta.y ) ); preview.ViewUpdate(); @@ -491,7 +491,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent ) { if( evt->IsAction( &COMMON_ACTIONS::rotate ) ) { - for( KIGFX::VIEW_GROUP::iter it = preview.Begin(), end = preview.End(); it != end; ++it ) + for( KIGFX::VIEW_GROUP::const_iter it = preview.Begin(), end = preview.End(); it != end; ++it ) static_cast( *it )->Rotate( wxPoint( cursorPos.x, cursorPos.y ), m_frame->GetRotationAngle() ); @@ -499,7 +499,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent ) } else if( evt->IsAction( &COMMON_ACTIONS::flip ) ) { - for( KIGFX::VIEW_GROUP::iter it = preview.Begin(), end = preview.End(); it != end; ++it ) + for( KIGFX::VIEW_GROUP::const_iter it = preview.Begin(), end = preview.End(); it != end; ++it ) static_cast( *it )->Flip( wxPoint( cursorPos.x, cursorPos.y ) ); preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); @@ -520,7 +520,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent ) m_frame->SaveCopyInUndoList( m_board->m_Modules, UR_MODEDIT ); m_board->m_Modules->SetLastEditTime(); - for( KIGFX::VIEW_GROUP::iter it = preview.Begin(), end = preview.End(); it != end; ++it ) + for( KIGFX::VIEW_GROUP::const_iter it = preview.Begin(), end = preview.End(); it != end; ++it ) { BOARD_ITEM* item = static_cast( *it ); BOARD_ITEM* converted = NULL; @@ -561,7 +561,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent ) { PICKED_ITEMS_LIST picklist; - for( KIGFX::VIEW_GROUP::iter it = preview.Begin(), end = preview.End(); it != end; ++it ) + for( KIGFX::VIEW_GROUP::const_iter it = preview.Begin(), end = preview.End(); it != end; ++it ) { BOARD_ITEM* item = static_cast( *it ); m_board->Add( item ); diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 75b37bae44..15a0fc67b6 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -642,7 +642,18 @@ int PCB_EDITOR_CONTROL::CrossProbeSchToPcb( const TOOL_EVENT& aEvent ) m_probingSchToPcb = true; getView()->SetCenter( VECTOR2D( item->GetPosition() ) ); m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true ); - m_toolMgr->RunAction( COMMON_ACTIONS::selectItem, true, item ); + + // If it is a pad and the net highlighting tool is enabled, highlight the net + if( item->Type() == PCB_PAD_T && m_frame->GetToolId() == ID_PCB_HIGHLIGHT_BUTT ) + { + int net = static_cast( item )->GetNetCode(); + m_toolMgr->RunAction( COMMON_ACTIONS::highlightNet, false, net ); + } + else + // Otherwise simply select the corresponding item + { + m_toolMgr->RunAction( COMMON_ACTIONS::selectItem, true, item ); + } } return 0; @@ -714,7 +725,19 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition ) int PCB_EDITOR_CONTROL::HighlightNet( const TOOL_EVENT& aEvent ) { - highlightNet( m_toolMgr, getView()->ToWorld( getViewControls()->GetMousePosition() ) ); + int netcode = aEvent.Parameter(); + + if( netcode > 0 ) + { + KIGFX::RENDER_SETTINGS* render = m_toolMgr->GetView()->GetPainter()->GetSettings(); + render->SetHighlight( true, netcode ); + m_toolMgr->GetView()->UpdateAllLayersColor(); + } + else + { + // No net code specified, pick the net code belonging to the item under the cursor + highlightNet( m_toolMgr, getView()->ToWorld( getViewControls()->GetMousePosition() ) ); + } return 0; } diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index f96ff9e14b..c2493eae6d 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -316,16 +316,12 @@ int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::HighContrastInc( const TOOL_EVENT& aEvent ) { - std::cout << __PRETTY_FUNCTION__ << std::endl; - return 0; } int PCBNEW_CONTROL::HighContrastDec( const TOOL_EVENT& aEvent ) { - std::cout << __PRETTY_FUNCTION__ << std::endl; - return 0; } diff --git a/pcbnew/tools/picker_tool.cpp b/pcbnew/tools/picker_tool.cpp index 42bbd98f8a..62343468d3 100644 --- a/pcbnew/tools/picker_tool.cpp +++ b/pcbnew/tools/picker_tool.cpp @@ -69,11 +69,14 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) if( !getNext ) break; else - setControls(); + m_toolMgr->PassEvent(); } else if( evt->IsCancel() || evt->IsActivate() ) break; + + else + m_toolMgr->PassEvent(); } reset(); diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index b31d933ac7..cb7d9f7b0f 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2013-2015 CERN + * Copyright (C) 2013-2016 CERN * @author Tomasz Wlostowski * @author Maciej Suminski * @@ -121,6 +121,10 @@ bool SELECTION_TOOL::Init() void SELECTION_TOOL::Reset( RESET_REASON aReason ) { + m_frame = getEditFrame(); + m_locked = true; + m_preliminary = true; + if( aReason == TOOL_BASE::MODEL_RELOAD ) { // Remove pointers to the selected items from containers @@ -133,10 +137,6 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason ) // Restore previous properties of selected items and remove them from containers clearSelection(); - m_frame = getEditFrame(); - m_locked = true; - m_preliminary = true; - // Reinsert the VIEW_GROUP, in case it was removed from the VIEW getView()->Remove( m_selection.group ); getView()->Add( m_selection.group ); @@ -302,6 +302,26 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) } +const SELECTION& SELECTION_TOOL::GetSelection() +{ + // The selected items list has been requested, so it is no longer preliminary + m_preliminary = false; + + // Filter out not modifiable items + for( int i = 0; i < m_selection.Size(); ) + { + BOARD_ITEM* item = m_selection.Item( i ); + + if( !modifiable( item ) ) + m_selection.items.RemovePicker( i ); + else + ++i; + } + + return m_selection; +} + + void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem ) { if( aItem->IsSelected() ) @@ -466,11 +486,9 @@ bool SELECTION_TOOL::selectMultiple() else m_frame->SetCurItem( NULL ); + // Inform other potentially interested tools if( !m_selection.Empty() ) - { - // Inform other potentially interested tools m_toolMgr->ProcessEvent( SelectedEvent ); - } break; // Stop waiting for events } @@ -604,14 +622,10 @@ int SELECTION_TOOL::selectConnection( const TOOL_EVENT& aEvent ) return 0; BOARD_CONNECTED_ITEM* item = m_selection.Item( 0 ); + clearSelection(); if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T ) - { - clearSelection(); return 0; - } - - clearSelection(); int segmentCount; TRACK* trackList = getModel()->MarkTrace( static_cast( item ), &segmentCount, @@ -627,8 +641,7 @@ int SELECTION_TOOL::selectConnection( const TOOL_EVENT& aEvent ) } // Inform other potentially interested tools - TOOL_EVENT selectEvent( SelectedEvent ); - m_toolMgr->ProcessEvent( selectEvent ); + m_toolMgr->ProcessEvent( SelectedEvent ); return 0; } @@ -640,17 +653,14 @@ int SELECTION_TOOL::selectCopper( const TOOL_EVENT& aEvent ) return 0; BOARD_CONNECTED_ITEM* item = m_selection.Item( 0 ); + clearSelection(); if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T ) - { - clearSelection(); return 0; - } std::list itemsList; RN_DATA* ratsnest = getModel()->GetRatsnest(); - clearSelection(); ratsnest->GetConnectedItems( item, itemsList, (RN_ITEM_TYPE)( RN_TRACKS | RN_VIAS ) ); BOOST_FOREACH( BOARD_CONNECTED_ITEM* i, itemsList ) @@ -658,10 +668,7 @@ int SELECTION_TOOL::selectCopper( const TOOL_EVENT& aEvent ) // Inform other potentially interested tools if( itemsList.size() > 0 ) - { - TOOL_EVENT selectEvent( SelectedEvent ); - m_toolMgr->ProcessEvent( selectEvent ); - } + m_toolMgr->ProcessEvent( SelectedEvent ); return 0; } @@ -686,10 +693,7 @@ int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent ) // Inform other potentially interested tools if( itemsList.size() > 0 ) - { - TOOL_EVENT selectEvent( SelectedEvent ); - m_toolMgr->ProcessEvent( selectEvent ); - } + m_toolMgr->ProcessEvent( SelectedEvent ); return 0; } @@ -742,9 +746,6 @@ int SELECTION_TOOL::findMove( const TOOL_EVENT& aEvent ) void SELECTION_TOOL::clearSelection() { - if( m_selection.Empty() ) - return; - KIGFX::VIEW_GROUP::const_iter it, it_end; // Restore the initial properties @@ -756,6 +757,7 @@ void SELECTION_TOOL::clearSelection() item->ClearSelected(); item->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ) ; } + m_selection.clear(); m_frame->SetCurItem( NULL ); @@ -928,7 +930,6 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const return aItem->ViewIsVisible() && board->IsLayerVisible( aItem->GetLayer() ); - // These are not selectable case PCB_MODULE_EDGE_T: case PCB_PAD_T: { @@ -942,6 +943,7 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const break; } + // These are not selectable case NOT_USED: case TYPE_NOT_INIT: return false; @@ -955,8 +957,20 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const } +bool SELECTION_TOOL::modifiable( const BOARD_ITEM* aItem ) const +{ + if( aItem->Type() == PCB_MARKER_T ) + return false; + + return true; +} + + void SELECTION_TOOL::select( BOARD_ITEM* aItem ) { + if( aItem->IsSelected() ) + return; + // Modules are treated in a special way - when they are selected, we have to mark // all the parts that make the module as selected if( aItem->Type() == PCB_MODULE_T ) @@ -992,6 +1006,9 @@ void SELECTION_TOOL::select( BOARD_ITEM* aItem ) void SELECTION_TOOL::unselect( BOARD_ITEM* aItem ) { + if( !aItem->IsSelected() ) + return; + // Modules are treated in a special way - when they are selected, we have to // unselect all the parts that make the module, not the module itself if( aItem->Type() == PCB_MODULE_T ) @@ -1011,9 +1028,6 @@ void SELECTION_TOOL::unselect( BOARD_ITEM* aItem ) m_frame->SetCurItem( NULL ); m_locked = true; } - - // Inform other potentially interested tools - m_toolMgr->ProcessEvent( UnselectedEvent ); } @@ -1379,11 +1393,23 @@ bool SELECTION_TOOL::SanitizeSelection() } } - BOOST_FOREACH( BOARD_ITEM* item, rejected ) - unselect( item ); + if( !rejected.empty() ) + { + BOOST_FOREACH( BOARD_ITEM* item, rejected ) + unselect( item ); - BOOST_FOREACH( BOARD_ITEM* item, added ) - select( item ); + // Inform other potentially interested tools + m_toolMgr->ProcessEvent( UnselectedEvent ); + } + + if( !added.empty() ) + { + BOOST_FOREACH( BOARD_ITEM* item, added ) + select( item ); + + // Inform other potentially interested tools + m_toolMgr->ProcessEvent( UnselectedEvent ); + } return true; } diff --git a/pcbnew/tools/selection_tool.h b/pcbnew/tools/selection_tool.h index 8acc9f2a82..4e7046c7ed 100644 --- a/pcbnew/tools/selection_tool.h +++ b/pcbnew/tools/selection_tool.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2013-2015 CERN + * Copyright (C) 2013-2016 CERN * @author Tomasz Wlostowski * @author Maciej Suminski * @@ -135,12 +135,7 @@ public: * * Returns the set of currently selected items. */ - inline const SELECTION& GetSelection() - { - // The selected items list has been requested, so it is no longer preliminary - m_preliminary = false; - return m_selection; - } + const SELECTION& GetSelection(); /** * Function EditModules() @@ -277,6 +272,15 @@ private: */ bool selectable( const BOARD_ITEM* aItem ) const; + /** + * Function modifiable() + * Checks if an item might be modified. This function is used to filter out items + * from the selection when it is passed to other tools. + * + * @return True if the item fulfills conditions to be modified. + */ + bool modifiable( const BOARD_ITEM* aItem ) const; + /** * Function select() * Takes necessary action mark an item as selected. diff --git a/utils/idftools/idf_helpers.cpp b/utils/idftools/idf_helpers.cpp index 798ea0c058..a9ab11e409 100644 --- a/utils/idftools/idf_helpers.cpp +++ b/utils/idftools/idf_helpers.cpp @@ -37,7 +37,7 @@ bool IDF3::FetchIDFLine( std::ifstream& aModel, std::string& aLine, bool& isComm aLine = ""; aFilePos = aModel.tellg(); - if( aFilePos == -1 ) + if( aModel.fail() ) return false; std::getline( aModel, aLine );