Commit edf64afc authored by charras's avatar charras

Eeschema: Added patch from Torsten Huter addeing hotkeys and enhancements in libeditor

Some fixes.
parent ac97a574
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -514,6 +514,10 @@ void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList ) ...@@ -514,6 +514,10 @@ void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList )
/* save the new list: */ /* save the new list: */
ITEM_PICKER item; ITEM_PICKER item;
// In list the wrapper is owner of the shematic item, we can use the UR_DELETED
// status for the picker because pickers with this status are owner of the picked item
// (or TODO ?: create a new status like UR_DUPLICATE)
item.m_UndoRedoStatus = UR_DELETED;
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ ) for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{ {
/* Make a copy of the original picked item. */ /* Make a copy of the original picked item. */
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "protos.h" #include "protos.h"
#include "classes_body_items.h" #include "classes_body_items.h"
static int fill_tab[3] = { 'N', 'F', 'f' }; static int fill_tab[3] = { 'N', 'F', 'f' };
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs //#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
...@@ -231,13 +230,12 @@ bool LIB_ARC::HitTest( const wxPoint& aRefPoint ) ...@@ -231,13 +230,12 @@ bool LIB_ARC::HitTest( const wxPoint& aRefPoint )
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
// Have a minimal tolerance for hit test // Have a minimal tolerance for hit test
if( mindist < 3 ) if( mindist < MINIMUM_SELECTION_DISTANCE )
mindist = 3; // = 3 mils mindist = MINIMUM_SELECTION_DISTANCE;
return HitTest( aRefPoint, mindist, DefaultTransformMatrix ); return HitTest( aRefPoint, mindist, DefaultTransformMatrix );
} }
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is near this object * @return true if the point aPosRef is near this object
* @param aRefPoint = a wxPoint to test * @param aRefPoint = a wxPoint to test
...@@ -245,38 +243,45 @@ bool LIB_ARC::HitTest( const wxPoint& aRefPoint ) ...@@ -245,38 +243,45 @@ bool LIB_ARC::HitTest( const wxPoint& aRefPoint )
* of a line) * of a line)
* @param aTransMat = the transform matrix * @param aTransMat = the transform matrix
*/ */
bool LIB_ARC::HitTest( wxPoint aRefPoint, int aThreshold, bool LIB_ARC::HitTest( wxPoint aReferencePoint, int aThreshold,
const int aTransMat[2][2] ) const int aTransformationMatrix[2][2] )
{ {
// TODO: use aTransMat to calculmates parameters // TODO: use aTransMat to calculmates parameters
wxPoint relpos = aRefPoint; wxPoint relativePosition = aReferencePoint;
NEGATE( relpos.y ); // reverse Y axis NEGATE( relativePosition.y ); // reverse Y axis
relpos -= m_Pos; int distance = wxRound( EuclideanNorm(TwoPointVector(m_Pos, relativePosition) ) );
int dist = wxRound( sqrt( ( (double) relpos.x * (double) relpos.x ) +
( (double) relpos.y * (double) relpos.y ) ) );
if( abs( dist - m_Radius ) > aThreshold ) if( abs( distance - m_Radius ) > aThreshold )
return false; return false;
// We are on the circle, ensure we are only on the arc, i.e. between // We are on the circle, ensure we are only on the arc, i.e. between
// m_ArcStart and m_ArcEnd // m_ArcStart and m_ArcEnd
int astart = m_t1; // arc starting point ( in 0.1 degree)
int aend = m_t2; // arc ending point ( in 0.1 degree)
int atest = wxRound( atan2( (double) relpos.y,
(double) relpos.x ) * 1800.0 / M_PI );
NORMALIZE_ANGLE_180( atest );
NORMALIZE_ANGLE_180( astart );
NORMALIZE_ANGLE_180( aend );
if( astart > aend )
EXCHG( astart, aend );
if( atest >= astart && atest <= aend )
return true;
return false; wxPoint startEndVector = TwoPointVector( m_ArcStart, m_ArcEnd);
wxPoint startRelativePositionVector = TwoPointVector( m_ArcStart, relativePosition);
wxPoint centerStartVector = TwoPointVector( m_Pos, m_ArcStart);
wxPoint centerEndVector = TwoPointVector( m_Pos, m_ArcEnd);
wxPoint centerRelativePositionVector = TwoPointVector( m_Pos, relativePosition);
// Compute the cross product to check if the point is in the sector
int crossProductStart = CrossProduct(centerStartVector, centerRelativePositionVector);
int crossProductEnd = CrossProduct(centerEndVector, centerRelativePositionVector);
// The cross products need to be exchanged, depending on which side the center point
// relative to the start point to end point vector lies
if (CrossProduct(startEndVector, startRelativePositionVector) < 0 ){
EXCHG(crossProductStart, crossProductEnd);
}
// When the cross products have a different sign, the point lies in sector
// also check, if the reference is near start or end point
return HitTestPoints(m_ArcStart, relativePosition, MINIMUM_SELECTION_DISTANCE) ||
HitTestPoints(m_ArcEnd, relativePosition, MINIMUM_SELECTION_DISTANCE) ||
(crossProductStart <= 0 && crossProductEnd >= 0);
} }
...@@ -603,8 +608,8 @@ bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef ) ...@@ -603,8 +608,8 @@ bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef )
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
// Have a minimal tolerance for hit test // Have a minimal tolerance for hit test
if( mindist < 3 ) if( mindist < MINIMUM_SELECTION_DISTANCE )
mindist = 3; // = 3 mils mindist = MINIMUM_SELECTION_DISTANCE;
return HitTest( aPosRef, mindist, DefaultTransformMatrix ); return HitTest( aPosRef, mindist, DefaultTransformMatrix );
} }
...@@ -811,6 +816,9 @@ LIB_RECTANGLE::LIB_RECTANGLE( LIB_COMPONENT* aParent ) : ...@@ -811,6 +816,9 @@ LIB_RECTANGLE::LIB_RECTANGLE( LIB_COMPONENT* aParent ) :
m_Fill = NO_FILL; m_Fill = NO_FILL;
m_isFillable = true; m_isFillable = true;
m_typeName = _( "Rectangle" ); m_typeName = _( "Rectangle" );
m_isHeightLocked = false;
m_isWidthLocked = false;
m_isStartPointSelected = false;
} }
...@@ -1037,8 +1045,8 @@ bool LIB_RECTANGLE::HitTest( const wxPoint& aRefPoint ) ...@@ -1037,8 +1045,8 @@ bool LIB_RECTANGLE::HitTest( const wxPoint& aRefPoint )
int mindist = (m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2) + 1; int mindist = (m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2) + 1;
// Have a minimal tolerance for hit test // Have a minimal tolerance for hit test
if( mindist < 3 ) if( mindist < MINIMUM_SELECTION_DISTANCE )
mindist = 3; // = 3 mils mindist = MINIMUM_SELECTION_DISTANCE;
return HitTest( aRefPoint, mindist, DefaultTransformMatrix ); return HitTest( aRefPoint, mindist, DefaultTransformMatrix );
} }
...@@ -1079,8 +1087,9 @@ bool LIB_RECTANGLE::HitTest( wxPoint aRefPoint, int aThreshold, ...@@ -1079,8 +1087,9 @@ bool LIB_RECTANGLE::HitTest( wxPoint aRefPoint, int aThreshold,
return true; return true;
// locate left segment // locate left segment
start.x = actualStart.x; start = actualStart;
end.x = actualStart.y; end.x = actualStart.x;
end.y = actualEnd.y;
if( TestSegmentHit( aRefPoint, start, end, aThreshold ) ) if( TestSegmentHit( aRefPoint, start, end, aThreshold ) )
return true; return true;
...@@ -1282,8 +1291,8 @@ bool LIB_SEGMENT::HitTest( const wxPoint& aPosRef ) ...@@ -1282,8 +1291,8 @@ bool LIB_SEGMENT::HitTest( const wxPoint& aPosRef )
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
// Have a minimal tolerance for hit test // Have a minimal tolerance for hit test
if( mindist < 3 ) if( mindist < MINIMUM_SELECTION_DISTANCE )
mindist = 3; // = 3 mils mindist = MINIMUM_SELECTION_DISTANCE;
return HitTest( aPosRef, mindist, DefaultTransformMatrix ); return HitTest( aPosRef, mindist, DefaultTransformMatrix );
} }
...@@ -1613,8 +1622,8 @@ bool LIB_POLYLINE::HitTest( const wxPoint& aRefPos ) ...@@ -1613,8 +1622,8 @@ bool LIB_POLYLINE::HitTest( const wxPoint& aRefPos )
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
// Have a minimal tolerance for hit test // Have a minimal tolerance for hit test
if( mindist < 3 ) if( mindist < MINIMUM_SELECTION_DISTANCE )
mindist = 3; // = 3 mils mindist = MINIMUM_SELECTION_DISTANCE;
return HitTest( aRefPos, mindist, DefaultTransformMatrix ); return HitTest( aRefPos, mindist, DefaultTransformMatrix );
} }
...@@ -1980,8 +1989,8 @@ bool LIB_BEZIER::HitTest( const wxPoint& aRefPos ) ...@@ -1980,8 +1989,8 @@ bool LIB_BEZIER::HitTest( const wxPoint& aRefPos )
{ {
int mindist = m_Width ? m_Width /2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width /2 : g_DrawDefaultLineThickness / 2;
// Have a minimal tolerance for hit test // Have a minimal tolerance for hit test
if ( mindist < 3 ) if ( mindist < MINIMUM_SELECTION_DISTANCE )
mindist = 3; // = 3 mils mindist = MINIMUM_SELECTION_DISTANCE;
return HitTest( aRefPos, mindist, DefaultTransformMatrix ); return HitTest( aRefPos, mindist, DefaultTransformMatrix );
} }
......
...@@ -32,7 +32,7 @@ class LIB_PIN; ...@@ -32,7 +32,7 @@ class LIB_PIN;
#define CLOCK_PIN_DIM 40 /* Dim of clock pin symbol. */ #define CLOCK_PIN_DIM 40 /* Dim of clock pin symbol. */
#define IEEE_SYMBOL_PIN_DIM 40 /* Dim of special pin symbol. */ #define IEEE_SYMBOL_PIN_DIM 40 /* Dim of special pin symbol. */
#define MINIMUM_SELECTION_DISTANCE 15 // Minimum selection distance in mils
/** /**
* The component library pin object electrical types used in ERC tests. * The component library pin object electrical types used in ERC tests.
...@@ -978,6 +978,9 @@ public: ...@@ -978,6 +978,9 @@ public:
wxPoint m_End; /* Rectangle end point. */ wxPoint m_End; /* Rectangle end point. */
wxPoint m_Pos; /* Rectangle start point. */ wxPoint m_Pos; /* Rectangle start point. */
int m_Width; /* Line width */ int m_Width; /* Line width */
bool m_isWidthLocked; /* Flag: Keep width locked */
bool m_isHeightLocked; /* Flag: Keep height locked */
bool m_isStartPointSelected; /* Flag: is the upper left edge selected ? */
public: public:
LIB_RECTANGLE(LIB_COMPONENT * aParent); LIB_RECTANGLE(LIB_COMPONENT * aParent);
...@@ -1146,6 +1149,7 @@ class LIB_POLYLINE : public LIB_DRAW_ITEM ...@@ -1146,6 +1149,7 @@ class LIB_POLYLINE : public LIB_DRAW_ITEM
public: public:
int m_Width; /* Line width */ int m_Width; /* Line width */
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2) std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
int m_ModifyIndex; // Index of the polyline point to modify
public: public:
LIB_POLYLINE(LIB_COMPONENT * aParent); LIB_POLYLINE(LIB_COMPONENT * aParent);
......
This diff is collapsed.
This diff is collapsed.
...@@ -25,8 +25,8 @@ enum hotkey_id_commnand { ...@@ -25,8 +25,8 @@ enum hotkey_id_commnand {
HK_UNDO, HK_UNDO,
HK_REDO, HK_REDO,
HK_MOVEBLOCK_TO_DRAGBLOCK, HK_MOVEBLOCK_TO_DRAGBLOCK,
HK_ROTATE_COMPONENT_OR_ITEM, HK_ROTATE,
HK_EDIT_COMPONENT_OR_LABEL, HK_EDIT,
HK_EDIT_COMPONENT_VALUE, HK_EDIT_COMPONENT_VALUE,
HK_EDIT_COMPONENT_FOOTPRINT, HK_EDIT_COMPONENT_FOOTPRINT,
HK_MIRROR_X_COMPONENT, HK_MIRROR_X_COMPONENT,
...@@ -34,7 +34,7 @@ enum hotkey_id_commnand { ...@@ -34,7 +34,7 @@ enum hotkey_id_commnand {
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,
HK_DRAG_COMPONENT, HK_DRAG,
HK_ADD_NEW_COMPONENT, HK_ADD_NEW_COMPONENT,
HK_BEGIN_WIRE HK_BEGIN_WIRE
}; };
......
...@@ -30,7 +30,9 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -30,7 +30,9 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
if( DrawEntry && DrawEntry->m_Flags ) if( DrawEntry && DrawEntry->m_Flags )
{ {
SaveCopyInUndoList( m_component ); // Don't put copy in undo list while resizing (because it's already done)
if (!(DrawEntry->m_Flags & IS_RESIZED))
SaveCopyInUndoList( m_component );
switch( DrawEntry->Type() ) switch( DrawEntry->Type() )
{ {
......
...@@ -84,9 +84,17 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos, ...@@ -84,9 +84,17 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
msg, move_arc_xpm ); msg, move_arc_xpm );
msg = AddHotkeyName( _( "Drag Arc Size" ), s_Libedit_Hokeys_Descr,
HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
msg, move_arc_xpm );
} }
msg = AddHotkeyName( _( "Edit Arc Options" ), s_Libedit_Hokeys_Descr,
HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
_( "Arc Options" ), options_arc_xpm ); msg, options_arc_xpm );
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Delete Arc " ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Arc " ), s_Libedit_Hokeys_Descr,
...@@ -104,8 +112,20 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos, ...@@ -104,8 +112,20 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
msg, move_circle_xpm ); msg, move_circle_xpm );
} }
if( DrawEntry->m_Flags == 0 )
{
msg = AddHotkeyName( _( "Drag Circle Outline" ), s_Libedit_Hokeys_Descr,
HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
msg, move_rectangle_xpm );
}
msg = AddHotkeyName( _( "Edit Circle Options" ), s_Libedit_Hokeys_Descr,
HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
_( "Circle Options" ), options_circle_xpm ); msg, options_circle_xpm );
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Delete Circle " ), msg = AddHotkeyName( _( "Delete Circle " ),
...@@ -118,20 +138,33 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos, ...@@ -118,20 +138,33 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Move Rect " ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Rectangle " ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
msg, move_rectangle_xpm ); msg, move_rectangle_xpm );
} }
msg = AddHotkeyName( _( "Edit Rectangle Options" ), s_Libedit_Hokeys_Descr,
HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
_( "Rect Options" ), options_rectangle_xpm ); msg, options_rectangle_xpm );
if( DrawEntry->m_Flags == 0 )
{
msg = AddHotkeyName( _( "Drag Rectangle Edge" ), s_Libedit_Hokeys_Descr,
HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
msg, move_rectangle_xpm );
}
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Delete Rect " ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Rectangle " ), s_Libedit_Hokeys_Descr,
HK_DELETE_PIN ); HK_DELETE_PIN );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM,
msg, delete_rectangle_xpm ); msg, delete_rectangle_xpm );
} }
break; break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
...@@ -142,10 +175,17 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos, ...@@ -142,10 +175,17 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
msg, move_text_xpm ); msg, move_text_xpm );
} }
msg = AddHotkeyName( _( "Edit Text " ), s_Libedit_Hokeys_Descr,
HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
_( "Text Editor" ), edit_text_xpm ); msg, edit_text_xpm );
msg = AddHotkeyName( _( "Rotate Text " ), s_Libedit_Hokeys_Descr,
HK_ROTATE );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT,
_( "Rotate Text" ), edit_text_xpm ); msg, edit_text_xpm );
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Delete Text " ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Text " ), s_Libedit_Hokeys_Descr,
...@@ -162,14 +202,23 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos, ...@@ -162,14 +202,23 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST,
msg, move_line_xpm ); msg, move_line_xpm );
msg = AddHotkeyName( _( "Drag Edge Point" ), s_Libedit_Hokeys_Descr,
HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM,
msg, move_line_xpm );
} }
if( DrawEntry->m_Flags & IS_NEW ) if( DrawEntry->m_Flags & IS_NEW )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_END_CREATE_ITEM, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_END_CREATE_ITEM,
_( "Line End" ), apply_xpm ); _( "Line End" ), apply_xpm );
} }
msg = AddHotkeyName( _( "Edit Line Options" ), s_Libedit_Hokeys_Descr,
HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM,
_( "Line Options" ), options_segment_xpm ); msg, options_segment_xpm );
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
msg = AddHotkeyName( _( "Delete Line " ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Line " ), s_Libedit_Hokeys_Descr,
...@@ -188,6 +237,7 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos, ...@@ -188,6 +237,7 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
msg, delete_segment_xpm ); msg, delete_segment_xpm );
} }
} }
break; break;
case COMPONENT_FIELD_DRAW_TYPE: case COMPONENT_FIELD_DRAW_TYPE:
...@@ -236,10 +286,10 @@ void AddMenusForPin( wxMenu* PopMenu, ...@@ -236,10 +286,10 @@ void AddMenusForPin( wxMenu* PopMenu,
msg, move_xpm ); msg, move_xpm );
} }
msg = AddHotkeyName( _( "Edit Pin " ), s_Libedit_Hokeys_Descr, HK_EDIT_PIN ); msg = AddHotkeyName( _( "Edit Pin " ), s_Libedit_Hokeys_Descr, HK_EDIT);
ADD_MENUITEM( PopMenu, ID_LIBEDIT_EDIT_PIN, msg, edit_xpm ); ADD_MENUITEM( PopMenu, ID_LIBEDIT_EDIT_PIN, msg, edit_xpm );
msg = AddHotkeyName( _( "Rotate Pin " ), s_Libedit_Hokeys_Descr, HK_LIBEDIT_ROTATE_PIN ); msg = AddHotkeyName( _( "Rotate Pin " ), s_Libedit_Hokeys_Descr, HK_ROTATE );
ADD_MENUITEM( PopMenu, ID_LIBEDIT_ROTATE_PIN, msg, rotate_pin_xpm ); ADD_MENUITEM( PopMenu, ID_LIBEDIT_ROTATE_PIN, msg, rotate_pin_xpm );
if( not_in_move ) if( not_in_move )
......
This diff is collapsed.
This diff is collapsed.
...@@ -247,7 +247,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) ...@@ -247,7 +247,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
} }
msg = AddHotkeyName( _( "Rotate Field" ), msg = AddHotkeyName( _( "Rotate Field" ),
s_Schematic_Hokeys_Descr, HK_ROTATE_COMPONENT_OR_ITEM ); s_Schematic_Hokeys_Descr, HK_ROTATE );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_FIELD, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_FIELD,
msg, rotate_field_xpm ); msg, rotate_field_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_FIELD, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_FIELD,
...@@ -285,14 +285,14 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ) ...@@ -285,14 +285,14 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST,
msg, move_xpm ); msg, move_xpm );
msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr,
HK_DRAG_COMPONENT ); HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST,
msg, move_xpm ); msg, move_xpm );
} }
wxMenu* orientmenu = new wxMenu; wxMenu* orientmenu = new wxMenu;
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr,
HK_ROTATE_COMPONENT_OR_ITEM ); HK_ROTATE );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE, ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE,
msg, rotate_pos_xpm ); msg, rotate_pos_xpm );
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE,
...@@ -312,7 +312,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ) ...@@ -312,7 +312,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
wxMenu* editmenu = new wxMenu; wxMenu* editmenu = new wxMenu;
msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_OR_LABEL ); HK_EDIT );
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CMP, msg, ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CMP, msg,
edit_component_xpm ); edit_component_xpm );
...@@ -393,11 +393,11 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel ) ...@@ -393,11 +393,11 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
msg, copy_button ); msg, copy_button );
} }
msg = AddHotkeyName( _( "Rotate Global Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Rotate Global Label" ), s_Schematic_Hokeys_Descr,
HK_ROTATE_COMPONENT_OR_ITEM ); HK_ROTATE );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT,
msg, rotate_glabel_xpm ); msg, rotate_glabel_xpm );
msg = AddHotkeyName( _( "Edit Global Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Global Label" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_OR_LABEL ); HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT,
msg, edit_text_xpm ); msg, edit_text_xpm );
msg = AddHotkeyName( _( "Delete Global Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Global Label" ), s_Schematic_Hokeys_Descr,
...@@ -437,11 +437,11 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel ) ...@@ -437,11 +437,11 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
msg, copy_button ); msg, copy_button );
} }
msg = AddHotkeyName( _( "Rotate Hierarchical Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Rotate Hierarchical Label" ), s_Schematic_Hokeys_Descr,
HK_ROTATE_COMPONENT_OR_ITEM ); HK_ROTATE );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT,
_( "Rotate Hierarchical Label" ), rotate_glabel_xpm ); _( "Rotate Hierarchical Label" ), rotate_glabel_xpm );
msg = AddHotkeyName( _( "Edit Hierarchical Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Hierarchical Label" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_OR_LABEL ); HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT,
_( "Edit Hierarchical Label" ), edit_text_xpm ); _( "Edit Hierarchical Label" ), edit_text_xpm );
msg = AddHotkeyName( _( "Delete Hierarchical Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Hierarchical Label" ), s_Schematic_Hokeys_Descr,
...@@ -480,11 +480,11 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label ) ...@@ -480,11 +480,11 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
msg, copy_button ); msg, copy_button );
} }
msg = AddHotkeyName( _( "Rotate Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Rotate Label" ), s_Schematic_Hokeys_Descr,
HK_ROTATE_COMPONENT_OR_ITEM ); HK_ROTATE );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT,
msg, rotate_pos_xpm ); msg, rotate_pos_xpm );
msg = AddHotkeyName( _( "Edit Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Label" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_OR_LABEL ); HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT,
msg, edit_text_xpm ); msg, edit_text_xpm );
msg = AddHotkeyName( _( "Delete Label" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Label" ), s_Schematic_Hokeys_Descr,
...@@ -524,11 +524,11 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text ) ...@@ -524,11 +524,11 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
msg, copy_button ); msg, copy_button );
} }
msg = AddHotkeyName( _( "Rotate Text" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Rotate Text" ), s_Schematic_Hokeys_Descr,
HK_ROTATE_COMPONENT_OR_ITEM ); HK_ROTATE );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg,
rotate_pos_xpm ); rotate_pos_xpm );
msg = AddHotkeyName( _( "Edit Text" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Edit Text" ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_OR_LABEL ); HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg,
edit_text_xpm ); edit_text_xpm );
msg = AddHotkeyName( _( "Delete Text" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Delete Text" ), s_Schematic_Hokeys_Descr,
...@@ -601,7 +601,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, ...@@ -601,7 +601,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire,
} }
msg = AddHotkeyName( _( "Drag Wire" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Drag Wire" ), s_Schematic_Hokeys_Descr,
HK_DRAG_COMPONENT ); HK_DRAG );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, msg, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, msg,
move_track_xpm ); move_track_xpm );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
...@@ -688,7 +688,7 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet ) ...@@ -688,7 +688,7 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
else else
{ {
msg = AddHotkeyName( _( "Edit Sheet" ), msg = AddHotkeyName( _( "Edit Sheet" ),
s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_OR_LABEL ); s_Schematic_Hokeys_Descr, HK_EDIT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_SHEET, msg, ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_SHEET, msg,
edit_sheet_xpm ); edit_sheet_xpm );
......
This diff is collapsed.
...@@ -22,6 +22,36 @@ int ArcTangente( int dy, int dx ); ...@@ -22,6 +22,36 @@ int ArcTangente( int dy, int dx );
bool DistanceTest( int seuil, int dx, int dy, int spot_cX, int spot_cY ); bool DistanceTest( int seuil, int dx, int dy, int spot_cX, int spot_cY );
//! @brief Compute the distance between a line and a reference point
//! Reference: http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html
//! @param linePointA Point on line
//! @param linePointB Point on line
//! @param referencePoint Reference point
double DistanceLinePoint(wxPoint linePointA, wxPoint linePointB, wxPoint referencePoint);
//! @brief Euclidean norm of a 2D vector
//! @param vector Two-dimensional vector
//! @return Euclidean norm of the vector
double EuclideanNorm(wxPoint vector);
//! @brief Vector between two points
//! @param startPoint The start point
//! @param endPoint The end point
//! @return Vector between the points
wxPoint TwoPointVector(wxPoint startPoint, wxPoint endPoint);
//! @brief Test, if two points are near each other
//! @param pointA First point
//! @param pointB Second point
//! @param threshold The maximum distance
//! @return True or false
bool HitTestPoints(wxPoint pointA, wxPoint pointB, double threshold);
//! @brief Determine the cross product
//! @param vectorA Two-dimensional vector
//! @param vectorB Two-dimensional vector
int CrossProduct(wxPoint vectorA, wxPoint vectorB);
/** Function TestSegmentHit /** Function TestSegmentHit
* test for hit on line segment * test for hit on line segment
...@@ -34,6 +64,8 @@ bool DistanceTest( int seuil, int dx, int dy, int spot_cX, int spot_cY ); ...@@ -34,6 +64,8 @@ bool DistanceTest( int seuil, int dx, int dy, int spot_cX, int spot_cY );
bool TestSegmentHit( wxPoint aRefPoint, wxPoint aStart, wxPoint aEnd, bool TestSegmentHit( wxPoint aRefPoint, wxPoint aStart, wxPoint aEnd,
int aDist ); int aDist );
/*******************/ /*******************/
/* Macro NEW_COORD */ /* Macro NEW_COORD */
/*******************/ /*******************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment