Eeschema: add missing rotate and mirror sheet in sheet context menu (these transforms were possible in block commands, but not from the sheet menu).
Fix a i18n issue in field names when loading a component, if the language was changed during a session, and kicad not restarted (see Bug #1448654). However changing the language needs restarting kicad, in order to have all messages or menus translated.
This commit is contained in:
parent
26c320db57
commit
3084c0aa0b
|
@ -162,9 +162,9 @@ static EDA_HOTKEY HkAddGraphicPolyLine( _HKI( "Add Graphic PolyLine" ), HK_ADD_G
|
||||||
'I', ID_LINE_COMMENT_BUTT );
|
'I', ID_LINE_COMMENT_BUTT );
|
||||||
static EDA_HOTKEY HkAddGraphicText( _HKI( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T',
|
static EDA_HOTKEY HkAddGraphicText( _HKI( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T',
|
||||||
ID_TEXT_COMMENT_BUTT );
|
ID_TEXT_COMMENT_BUTT );
|
||||||
static EDA_HOTKEY HkMirrorY( _HKI( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT, 'Y',
|
static EDA_HOTKEY HkMirrorY( _HKI( "Mirror Y" ), HK_MIRROR_Y, 'Y',
|
||||||
ID_SCH_MIRROR_Y );
|
ID_SCH_MIRROR_Y );
|
||||||
static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X Component" ), HK_MIRROR_X_COMPONENT, 'X',
|
static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X" ), HK_MIRROR_X, 'X',
|
||||||
ID_SCH_MIRROR_X );
|
ID_SCH_MIRROR_X );
|
||||||
static EDA_HOTKEY HkOrientNormalComponent( _HKI( "Orient Normal Component" ),
|
static EDA_HOTKEY HkOrientNormalComponent( _HKI( "Orient Normal Component" ),
|
||||||
HK_ORIENT_NORMAL_COMPONENT, 'N', ID_SCH_ORIENT_NORMAL );
|
HK_ORIENT_NORMAL_COMPONENT, 'N', ID_SCH_ORIENT_NORMAL );
|
||||||
|
@ -556,8 +556,8 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
|
case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
|
||||||
case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
|
case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
|
||||||
case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
|
case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
|
||||||
case HK_MIRROR_Y_COMPONENT: // Mirror Y
|
case HK_MIRROR_Y: // Mirror Y
|
||||||
case HK_MIRROR_X_COMPONENT: // Mirror X
|
case HK_MIRROR_X: // Mirror X
|
||||||
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
|
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
|
||||||
case HK_ROTATE: // Rotate schematic item.
|
case HK_ROTATE: // Rotate schematic item.
|
||||||
case HK_EDIT_COMPONENT_WITH_LIBEDIT: // Call Libedit and load the current component
|
case HK_EDIT_COMPONENT_WITH_LIBEDIT: // Call Libedit and load the current component
|
||||||
|
|
|
@ -51,8 +51,8 @@ enum hotkey_id_commnand {
|
||||||
HK_EDIT_COMPONENT_REFERENCE,
|
HK_EDIT_COMPONENT_REFERENCE,
|
||||||
HK_EDIT_COMPONENT_FOOTPRINT,
|
HK_EDIT_COMPONENT_FOOTPRINT,
|
||||||
HK_EDIT_COMPONENT_WITH_LIBEDIT,
|
HK_EDIT_COMPONENT_WITH_LIBEDIT,
|
||||||
HK_MIRROR_X_COMPONENT,
|
HK_MIRROR_X,
|
||||||
HK_MIRROR_Y_COMPONENT,
|
HK_MIRROR_Y,
|
||||||
HK_ORIENT_NORMAL_COMPONENT,
|
HK_ORIENT_NORMAL_COMPONENT,
|
||||||
HK_MOVE_COMPONENT_OR_ITEM,
|
HK_MOVE_COMPONENT_OR_ITEM,
|
||||||
HK_COPY_COMPONENT_OR_LABEL,
|
HK_COPY_COMPONENT_OR_LABEL,
|
||||||
|
|
|
@ -100,15 +100,6 @@ bool LIB_FIELD::Save( OUTPUTFORMATTER& aFormatter )
|
||||||
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
||||||
vjustify = 'T';
|
vjustify = 'T';
|
||||||
|
|
||||||
/* Dick 24-May-2013:
|
|
||||||
What the hell is this?. There was no comment here.
|
|
||||||
Hell no. You don't want this in the *.lib files, it is crap. Fields get read
|
|
||||||
back in and they have a tilda in them.
|
|
||||||
|
|
||||||
if( text.IsEmpty() )
|
|
||||||
text = wxT( "~" );
|
|
||||||
*/
|
|
||||||
|
|
||||||
aFormatter.Print( 0, "F%d %s %d %d %d %c %c %c %c%c%c",
|
aFormatter.Print( 0, "F%d %s %d %d %d %c %c %c %c%c%c",
|
||||||
m_id,
|
m_id,
|
||||||
EscapedUTF8( text ).c_str(), // wraps in quotes
|
EscapedUTF8( text ).c_str(), // wraps in quotes
|
||||||
|
|
|
@ -373,9 +373,9 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_LIBS*
|
||||||
AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
||||||
AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
|
AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
|
||||||
KiBitmap( rotate_ccw_xpm ) );
|
KiBitmap( rotate_ccw_xpm ) );
|
||||||
msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT );
|
msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X );
|
||||||
AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
||||||
msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT );
|
msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y );
|
||||||
AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
||||||
msg = AddHotkeyName( _( "Normal" ), g_Schematic_Hokeys_Descr, HK_ORIENT_NORMAL_COMPONENT );
|
msg = AddHotkeyName( _( "Normal" ), g_Schematic_Hokeys_Descr, HK_ORIENT_NORMAL_COMPONENT );
|
||||||
AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
|
AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
|
||||||
|
@ -757,6 +757,21 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Drag Sheet" ), g_Schematic_Hokeys_Descr, HK_DRAG );
|
msg = AddHotkeyName( _( "Drag Sheet" ), g_Schematic_Hokeys_Descr, HK_DRAG );
|
||||||
AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_sheet_xpm ) );
|
AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_sheet_xpm ) );
|
||||||
|
|
||||||
|
wxMenu* orientmenu = new wxMenu;
|
||||||
|
msg = AddHotkeyName( _( "Rotate Sheet CW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
||||||
|
AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
||||||
|
|
||||||
|
AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Sheet CCW" ),
|
||||||
|
KiBitmap( rotate_ccw_xpm ) );
|
||||||
|
|
||||||
|
msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X );
|
||||||
|
AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
||||||
|
msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y );
|
||||||
|
AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
||||||
|
|
||||||
|
AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
|
||||||
|
_( "Orient Sheet" ), KiBitmap( orient_xpm ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Sheet->GetFlags() )
|
if( Sheet->GetFlags() )
|
||||||
|
@ -831,10 +846,10 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
|
||||||
AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( move_xpm ) );
|
AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( move_xpm ) );
|
||||||
AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) );
|
AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) );
|
||||||
msg = AddHotkeyName( _( "Mirror Block ||" ), g_Schematic_Hokeys_Descr,
|
msg = AddHotkeyName( _( "Mirror Block ||" ), g_Schematic_Hokeys_Descr,
|
||||||
HK_MIRROR_Y_COMPONENT );
|
HK_MIRROR_Y );
|
||||||
AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
||||||
msg = AddHotkeyName( _( "Mirror Block --" ), g_Schematic_Hokeys_Descr,
|
msg = AddHotkeyName( _( "Mirror Block --" ), g_Schematic_Hokeys_Descr,
|
||||||
HK_MIRROR_X_COMPONENT );
|
HK_MIRROR_X );
|
||||||
AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
||||||
msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
||||||
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
||||||
|
@ -871,10 +886,10 @@ void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
|
||||||
msg = AddHotkeyName( _( "Rotate Image" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
msg = AddHotkeyName( _( "Rotate Image" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
||||||
AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
||||||
msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr,
|
msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr,
|
||||||
HK_MIRROR_X_COMPONENT );
|
HK_MIRROR_X );
|
||||||
AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
||||||
msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr,
|
msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr,
|
||||||
HK_MIRROR_Y_COMPONENT );
|
HK_MIRROR_Y );
|
||||||
AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
||||||
msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
||||||
AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
|
AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
|
||||||
|
|
|
@ -194,6 +194,7 @@ const KICAD_T SCH_COLLECTOR::SheetsAndSheetLabels[] = {
|
||||||
const KICAD_T SCH_COLLECTOR::OrientableItems[] = {
|
const KICAD_T SCH_COLLECTOR::OrientableItems[] = {
|
||||||
SCH_COMPONENT_T,
|
SCH_COMPONENT_T,
|
||||||
SCH_BITMAP_T,
|
SCH_BITMAP_T,
|
||||||
|
SCH_SHEET_T,
|
||||||
EOT
|
EOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -148,8 +148,18 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit,
|
||||||
if( it->GetName().IsEmpty() )
|
if( it->GetName().IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// See if field by same name already exists.
|
// See if field already exists (mandatory fields always exist).
|
||||||
SCH_FIELD* schField = FindField( it->GetName() );
|
// for mandatory fields, the name and field id are fixed, so we use the
|
||||||
|
// known and fixed id to get them (more reliable than names, which can be translated)
|
||||||
|
// for other fields (custom fields), locate the field by same name
|
||||||
|
// (field id has no known meaning for custom fields)
|
||||||
|
int idx = it->GetId();
|
||||||
|
SCH_FIELD* schField;
|
||||||
|
|
||||||
|
if( idx < MANDATORY_FIELDS )
|
||||||
|
schField = GetField( idx );
|
||||||
|
else
|
||||||
|
schField = FindField( it->GetName() );
|
||||||
|
|
||||||
if( !schField )
|
if( !schField )
|
||||||
{
|
{
|
||||||
|
@ -158,9 +168,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit,
|
||||||
}
|
}
|
||||||
|
|
||||||
schField->SetTextPosition( m_Pos + it->GetTextPosition() );
|
schField->SetTextPosition( m_Pos + it->GetTextPosition() );
|
||||||
|
|
||||||
schField->ImportValues( *it );
|
schField->ImportValues( *it );
|
||||||
|
|
||||||
schField->SetText( it->GetText() );
|
schField->SetText( it->GetText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +240,7 @@ void SCH_COMPONENT::Init( const wxPoint& pos )
|
||||||
AddField( field );
|
AddField( field );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_prefix = wxString( _( "U" ) );
|
m_prefix = wxString( wxT( "U" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -457,14 +457,12 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
case SCH_MARKER_T:
|
case SCH_MARKER_T:
|
||||||
// Moving a marker has no sense
|
// Moving a marker has no sense
|
||||||
wxFAIL_MSG( wxString::Format( wxT( "Cannot move item type %s" ),
|
|
||||||
GetChars( item->GetClass() ) ) );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Unknown items cannot be moved
|
// Unknown items cannot be moved
|
||||||
wxFAIL_MSG( wxString::Format(
|
wxFAIL_MSG( wxString::Format(
|
||||||
wxT( "Cannot move unknown item type %d" ), item->Type() ) );
|
wxT( "Cannot move item type %d" ), item->Type() ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,8 +839,25 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
|
||||||
RotateImage( (SCH_BITMAP*) item );
|
RotateImage( (SCH_BITMAP*) item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCH_SHEET_T: /// @todo allow sheet rotate on hotkey
|
case SCH_SHEET_T:
|
||||||
|
if( !item->IsNew() ) // rotate a sheet during its creation has no sense
|
||||||
|
{
|
||||||
|
bool retCCW = ( aEvent.GetId() == ID_SCH_ROTATE_COUNTERCLOCKWISE );
|
||||||
|
RotateHierarchicalSheet( static_cast<SCH_SHEET*>( item ), retCCW );
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCH_JUNCTION_T:
|
||||||
|
case SCH_NO_CONNECT_T:
|
||||||
|
// these items are not rotated, because rotation does not change them.
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
// Other items (wires...) cannot be rotated, at least during creation
|
||||||
|
if( item->IsNew() )
|
||||||
|
break;
|
||||||
|
|
||||||
wxFAIL_MSG( wxString::Format( wxT( "Cannot rotate schematic item type %s." ),
|
wxFAIL_MSG( wxString::Format( wxT( "Cannot rotate schematic item type %s." ),
|
||||||
GetChars( item->GetClass() ) ) );
|
GetChars( item->GetClass() ) ) );
|
||||||
}
|
}
|
||||||
|
@ -1112,6 +1127,14 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SCH_SHEET_T:
|
||||||
|
if( aEvent.GetId() == ID_SCH_MIRROR_X )
|
||||||
|
MirrorSheet( (SCH_SHEET*) item, true );
|
||||||
|
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
|
||||||
|
MirrorSheet( (SCH_SHEET*) item, false );
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( wxString::Format( wxT( "Schematic object type %s cannot be oriented." ),
|
wxFAIL_MSG( wxString::Format( wxT( "Schematic object type %s cannot be oriented." ),
|
||||||
GetChars( item->GetClass() ) ) );
|
GetChars( item->GetClass() ) ) );
|
||||||
|
|
|
@ -930,6 +930,25 @@ private:
|
||||||
SCH_SHEET* CreateSheet( wxDC* DC );
|
SCH_SHEET* CreateSheet( wxDC* DC );
|
||||||
void ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC );
|
void ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotate a sheet on itself. Sheets do not have a anchor point.
|
||||||
|
* Because rotating it from its origin or its end is not friendly,
|
||||||
|
* Rotation is made around its centre
|
||||||
|
* @param aSheet the hierarchical sheet to rotate
|
||||||
|
* @param aRotCCW = true to rotate CCW, false to rotate CW
|
||||||
|
*/
|
||||||
|
void RotateHierarchicalSheet( SCH_SHEET* aSheet, bool aRotCCW );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function MirrorSheet
|
||||||
|
* Mirror a hierarchical sheet
|
||||||
|
* Mirroring is made around its centre
|
||||||
|
* @param aSheet = the SCH_SHEET to mirror
|
||||||
|
* @param aFromXaxis = true to mirror relative to Horizontal axis
|
||||||
|
* false to mirror relative to vertical axis
|
||||||
|
*/
|
||||||
|
void MirrorSheet( SCH_SHEET* aSheet, bool aFromXaxis );
|
||||||
|
|
||||||
/// Loads the cache library associated to the aFileName
|
/// Loads the cache library associated to the aFileName
|
||||||
bool LoadCacheLibrary( const wxString& aFileName );
|
bool LoadCacheLibrary( const wxString& aFileName );
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -392,3 +392,52 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
|
||||||
SetUndoItem( aSheet );
|
SetUndoItem( aSheet );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define GRID_SIZE_REF 50
|
||||||
|
void SCH_EDIT_FRAME::RotateHierarchicalSheet( SCH_SHEET* aSheet, bool aRotCCW )
|
||||||
|
{
|
||||||
|
if( aSheet == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Save old sheet in undo list if not already in edit, or moving.
|
||||||
|
if( aSheet->GetFlags() == 0 )
|
||||||
|
SaveCopyInUndoList( aSheet, UR_CHANGED );
|
||||||
|
|
||||||
|
// Rotate the sheet on itself. Sheets do not have a anchor point.
|
||||||
|
// Rotation is made around it center
|
||||||
|
wxPoint rotPoint = aSheet->GetBoundingBox().Centre();
|
||||||
|
|
||||||
|
// rotate CCW, or CW. to rotate CW, rotate 3 times
|
||||||
|
aSheet->Rotate( rotPoint );
|
||||||
|
|
||||||
|
if( !aRotCCW )
|
||||||
|
{
|
||||||
|
aSheet->Rotate( rotPoint );
|
||||||
|
aSheet->Rotate( rotPoint );
|
||||||
|
}
|
||||||
|
|
||||||
|
GetCanvas()->Refresh();
|
||||||
|
OnModify();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_EDIT_FRAME::MirrorSheet( SCH_SHEET* aSheet, bool aFromXaxis )
|
||||||
|
{
|
||||||
|
if( aSheet == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Save old sheet in undo list if not already in edit, or moving.
|
||||||
|
if( aSheet->GetFlags() == 0 )
|
||||||
|
SaveCopyInUndoList( aSheet, UR_CHANGED );
|
||||||
|
|
||||||
|
// Mirror the sheet on itself. Sheets do not have a anchor point.
|
||||||
|
// Mirroring is made around it center
|
||||||
|
wxPoint mirrorPoint = aSheet->GetBoundingBox().Centre();
|
||||||
|
|
||||||
|
if( aFromXaxis ) // mirror relative to Horizontal axis
|
||||||
|
aSheet->MirrorX( mirrorPoint.y );
|
||||||
|
else // Mirror relative to vertical axis
|
||||||
|
aSheet->MirrorY( mirrorPoint.x );
|
||||||
|
|
||||||
|
GetCanvas()->Refresh();
|
||||||
|
OnModify();
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -29,27 +29,32 @@
|
||||||
|
|
||||||
using namespace TFIELD_T;
|
using namespace TFIELD_T;
|
||||||
|
|
||||||
wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx )
|
const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx )
|
||||||
{
|
{
|
||||||
// Fixed values for the first few default fields used by EESCHEMA
|
// Fixed values for the first few default fields used by EESCHEMA
|
||||||
static const wxString fixedNames[] = {
|
// (mandatory fields)
|
||||||
_( "Reference" ), // The component reference, R1, C1, etc.
|
switch( aFieldNdx )
|
||||||
_( "Value" ), // The component value + name
|
|
||||||
_( "Footprint" ), // The footprint for use with Pcbnew
|
|
||||||
_( "Datasheet" ), // Link to a datasheet for component
|
|
||||||
};
|
|
||||||
|
|
||||||
if( (unsigned) aFieldNdx < DIM(fixedNames) )
|
|
||||||
return fixedNames[aFieldNdx];
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
wxString fieldName = _( "Field" );
|
case REFERENCE:
|
||||||
|
return _( "Reference" ); // The component reference, R1, C1, etc.
|
||||||
|
|
||||||
fieldName << aFieldNdx;
|
case VALUE:
|
||||||
|
return _( "Value" ); // The component value + name
|
||||||
|
|
||||||
return fieldName;
|
case FOOTPRINT:
|
||||||
|
return _( "Footprint" ); // The footprint for use with Pcbnew
|
||||||
|
|
||||||
|
case DATASHEET:
|
||||||
|
return _( "Datasheet" ); // Link to a datasheet for component
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Other fields are use fields, give a default name:
|
||||||
|
wxString fieldName = _( "Field" );
|
||||||
|
fieldName << aFieldNdx;
|
||||||
|
return fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TEMPLATE_FIELDNAME::Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IO_ERROR )
|
void TEMPLATE_FIELDNAME::Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IO_ERROR )
|
||||||
|
|
|
@ -120,7 +120,7 @@ struct TEMPLATE_FIELDNAME
|
||||||
* These fieldnames are not modifiable, but template fieldnames are.
|
* These fieldnames are not modifiable, but template fieldnames are.
|
||||||
* @param aFieldNdx The field number index, > 0
|
* @param aFieldNdx The field number index, > 0
|
||||||
*/
|
*/
|
||||||
static wxString GetDefaultFieldName( int aFieldNdx );
|
static const wxString GetDefaultFieldName( int aFieldNdx );
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector< TEMPLATE_FIELDNAME > TEMPLATE_FIELDNAMES;
|
typedef std::vector< TEMPLATE_FIELDNAME > TEMPLATE_FIELDNAMES;
|
||||||
|
|
|
@ -53,7 +53,7 @@ FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( int aIndex )
|
||||||
|
|
||||||
FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( wxString aName )
|
FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( wxString aName )
|
||||||
{
|
{
|
||||||
int max = GetSize();
|
int max = GetWizardsCount();
|
||||||
|
|
||||||
for( int i = 0; i<max; i++ )
|
for( int i = 0; i<max; i++ )
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( wxString aName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int FOOTPRINT_WIZARDS::GetSize()
|
int FOOTPRINT_WIZARDS::GetWizardsCount()
|
||||||
{
|
{
|
||||||
return m_FootprintWizards.size();
|
return m_FootprintWizards.size();
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ void FOOTPRINT_WIZARDS::register_wizard( FOOTPRINT_WIZARD* aWizard )
|
||||||
|
|
||||||
bool FOOTPRINT_WIZARDS::deregister_object( void* aObject )
|
bool FOOTPRINT_WIZARDS::deregister_object( void* aObject )
|
||||||
{
|
{
|
||||||
int max = GetSize();
|
int max = GetWizardsCount();
|
||||||
|
|
||||||
for( int i = 0; i<max; i++ )
|
for( int i = 0; i<max; i++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file pcbnew_footprint_wizards.h
|
* @file class_footprint_wizard.h
|
||||||
* @brief Class PCBNEW_FOOTPRINT_WIZARDS
|
* @brief Class PCBNEW_FOOTPRINT_WIZARDS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -130,7 +130,6 @@ public:
|
||||||
* Function register_wizard
|
* Function register_wizard
|
||||||
* It's the standard method of a "FOOTPRINT_WIZARD" to register itself into
|
* It's the standard method of a "FOOTPRINT_WIZARD" to register itself into
|
||||||
* the FOOTPRINT_WIZARDS singleton manager
|
* the FOOTPRINT_WIZARDS singleton manager
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
void register_wizard();
|
void register_wizard();
|
||||||
};
|
};
|
||||||
|
@ -143,6 +142,7 @@ private:
|
||||||
* FOOTPRINT_WIZARD system wide static list
|
* FOOTPRINT_WIZARD system wide static list
|
||||||
*/
|
*/
|
||||||
static std::vector<FOOTPRINT_WIZARD*> m_FootprintWizards;
|
static std::vector<FOOTPRINT_WIZARD*> m_FootprintWizards;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +151,6 @@ public:
|
||||||
* into the system wizards
|
* into the system wizards
|
||||||
*
|
*
|
||||||
* @param aWizard is the footprint wizard to be registered
|
* @param aWizard is the footprint wizard to be registered
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static void register_wizard( FOOTPRINT_WIZARD* aWizard );
|
static void register_wizard( FOOTPRINT_WIZARD* aWizard );
|
||||||
|
|
||||||
|
@ -162,7 +161,6 @@ public:
|
||||||
* and deleted
|
* and deleted
|
||||||
*
|
*
|
||||||
* @param aObject is the footprint wizard object to be deregistered
|
* @param aObject is the footprint wizard object to be deregistered
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static bool deregister_object( void* aObject );
|
static bool deregister_object( void* aObject );
|
||||||
|
|
||||||
|
@ -170,7 +168,6 @@ public:
|
||||||
* Function GetWizard
|
* Function GetWizard
|
||||||
* @param aName is the footprint wizard name
|
* @param aName is the footprint wizard name
|
||||||
* @return a wizard object by it's name or NULL if it isn't available.
|
* @return a wizard object by it's name or NULL if it isn't available.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static FOOTPRINT_WIZARD* GetWizard( wxString aName );
|
static FOOTPRINT_WIZARD* GetWizard( wxString aName );
|
||||||
|
|
||||||
|
@ -178,15 +175,14 @@ public:
|
||||||
* Function GetWizard
|
* Function GetWizard
|
||||||
* @return a wizard object by it's number or NULL if it isn't available.
|
* @return a wizard object by it's number or NULL if it isn't available.
|
||||||
* @param aIndex is the wizard index in list
|
* @param aIndex is the wizard index in list
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static FOOTPRINT_WIZARD* GetWizard( int aIndex );
|
static FOOTPRINT_WIZARD* GetWizard( int aIndex );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetSize
|
* Function GetWizardsCount
|
||||||
* @return the number of wizards available into the system
|
* @return the number of wizards available into the system
|
||||||
*/
|
*/
|
||||||
static int GetSize();
|
static int GetWizardsCount();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PCBNEW_FOOTPRINT_WIZARDS_H */
|
#endif /* PCBNEW_FOOTPRINT_WIZARDS_H */
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
|
||||||
: DIALOG_FOOTPRINT_WIZARD_LIST_BASE( aParent )
|
: DIALOG_FOOTPRINT_WIZARD_LIST_BASE( aParent )
|
||||||
{
|
{
|
||||||
int n_wizards = FOOTPRINT_WIZARDS::GetSize();
|
int n_wizards = FOOTPRINT_WIZARDS::GetWizardsCount();
|
||||||
|
|
||||||
// Current wizard selection, empty or first
|
// Current wizard selection, empty or first
|
||||||
m_FootprintWizard = NULL;
|
m_FootprintWizard = NULL;
|
||||||
|
|
Loading…
Reference in New Issue