It's "internal units", not "user interface".
This commit is contained in:
parent
867ca2d0da
commit
d6a862cafe
|
@ -80,7 +80,7 @@ DS_DATA_ITEM::~DS_DATA_ITEM()
|
||||||
|
|
||||||
void DS_DATA_ITEM::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
|
void DS_DATA_ITEM::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
|
||||||
{
|
{
|
||||||
int pensize = GetPenSizeUi();
|
int pensize = GetPenSizeIU();
|
||||||
|
|
||||||
if( pensize == 0 )
|
if( pensize == 0 )
|
||||||
pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
|
pensize = aCollector ? aCollector->GetDefaultPenSize() : 0;
|
||||||
|
@ -131,7 +131,7 @@ void DS_DATA_ITEM::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aV
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int DS_DATA_ITEM::GetPenSizeUi()
|
int DS_DATA_ITEM::GetPenSizeIU()
|
||||||
{
|
{
|
||||||
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ int DS_DATA_ITEM::GetPenSizeUi()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DS_DATA_ITEM::MoveToUi( const VECTOR2I& aPosition )
|
void DS_DATA_ITEM::MoveToIU( const VECTOR2I& aPosition )
|
||||||
{
|
{
|
||||||
VECTOR2D pos_mm;
|
VECTOR2D pos_mm;
|
||||||
pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
|
pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
|
||||||
|
@ -201,7 +201,7 @@ void DS_DATA_ITEM::MoveStartPointTo( const VECTOR2D& aPosition )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DS_DATA_ITEM::MoveStartPointToUi( const VECTOR2I& aPosition )
|
void DS_DATA_ITEM::MoveStartPointToIU( const VECTOR2I& aPosition )
|
||||||
{
|
{
|
||||||
VECTOR2D pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
|
VECTOR2D pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
|
||||||
aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
|
aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
|
||||||
|
@ -253,7 +253,7 @@ void DS_DATA_ITEM::MoveEndPointTo( const VECTOR2D& aPosition )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DS_DATA_ITEM::MoveEndPointToUi( const VECTOR2I& aPosition )
|
void DS_DATA_ITEM::MoveEndPointToIU( const VECTOR2I& aPosition )
|
||||||
{
|
{
|
||||||
VECTOR2D pos_mm;
|
VECTOR2D pos_mm;
|
||||||
pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
|
pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
|
||||||
|
@ -405,7 +405,7 @@ void DS_DATA_ITEM_POLYGONS::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX:
|
||||||
if( j > 0 && !IsInsidePage( j ) )
|
if( j > 0 && !IsInsidePage( j ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int pensize = GetPenSizeUi();
|
int pensize = GetPenSizeIU();
|
||||||
auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosIU( j ), pensize );
|
auto poly_shape = new DS_DRAW_ITEM_POLYPOLYGONS( this, j, GetStartPosIU( j ), pensize );
|
||||||
poly_shape->SetFlags( itemFlags[ j ] );
|
poly_shape->SetFlags( itemFlags[ j ] );
|
||||||
m_drawItems.push_back( poly_shape );
|
m_drawItems.push_back( poly_shape );
|
||||||
|
@ -422,7 +422,7 @@ void DS_DATA_ITEM_POLYGONS::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX:
|
||||||
polygons.NewOutline();
|
polygons.NewOutline();
|
||||||
|
|
||||||
while( ist <= iend )
|
while( ist <= iend )
|
||||||
polygons.Append( GetCornerPositionUi( ist++, j ) );
|
polygons.Append( GetCornerPositionIU( ist++, j ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aCollector )
|
if( aCollector )
|
||||||
|
@ -434,7 +434,7 @@ void DS_DATA_ITEM_POLYGONS::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int DS_DATA_ITEM_POLYGONS::GetPenSizeUi()
|
int DS_DATA_ITEM_POLYGONS::GetPenSizeIU()
|
||||||
{
|
{
|
||||||
return KiROUND( m_LineWidth * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
|
return KiROUND( m_LineWidth * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ bool DS_DATA_ITEM_POLYGONS::IsInsidePage( int ii ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const
|
const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionIU( unsigned aIdx, int aRepeat ) const
|
||||||
{
|
{
|
||||||
VECTOR2D pos = GetCornerPosition( aIdx, aRepeat );
|
VECTOR2D pos = GetCornerPosition( aIdx, aRepeat );
|
||||||
pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
|
pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
|
||||||
|
@ -531,7 +531,7 @@ DS_DATA_ITEM_TEXT::DS_DATA_ITEM_TEXT( const wxString& aTextBase ) :
|
||||||
|
|
||||||
void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
|
void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView )
|
||||||
{
|
{
|
||||||
int pensize = GetPenSizeUi();
|
int pensize = GetPenSizeIU();
|
||||||
bool multilines = false;
|
bool multilines = false;
|
||||||
|
|
||||||
if( DS_DATA_MODEL::GetTheInstance().m_EditMode )
|
if( DS_DATA_MODEL::GetTheInstance().m_EditMode )
|
||||||
|
@ -583,9 +583,8 @@ void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
|
||||||
EDA_IU_SCALE iuscale = aCollector ? aCollector->GetIuScale()
|
EDA_IU_SCALE iuscale = aCollector ? aCollector->GetIuScale()
|
||||||
: DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
|
: DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
|
||||||
|
|
||||||
text = new DS_DRAW_ITEM_TEXT( iuscale, this, j, m_FullText,
|
text = new DS_DRAW_ITEM_TEXT( iuscale, this, j, m_FullText, GetStartPosIU( j ), textsize,
|
||||||
GetStartPosIU( j ), textsize, pensize, m_Font, m_Italic,
|
pensize, m_Font, m_Italic, m_Bold, m_TextColor );
|
||||||
m_Bold, m_TextColor );
|
|
||||||
|
|
||||||
text->SetFlags( itemFlags[ j ] );
|
text->SetFlags( itemFlags[ j ] );
|
||||||
m_drawItems.push_back( text );
|
m_drawItems.push_back( text );
|
||||||
|
@ -608,7 +607,7 @@ void DS_DATA_ITEM_TEXT::SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int DS_DATA_ITEM_TEXT::GetPenSizeUi()
|
int DS_DATA_ITEM_TEXT::GetPenSizeIU()
|
||||||
{
|
{
|
||||||
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ public:
|
||||||
const VECTOR2D GetStartPos( int ii = 0 ) const;
|
const VECTOR2D GetStartPos( int ii = 0 ) const;
|
||||||
const VECTOR2D GetEndPos( int ii = 0 ) const;
|
const VECTOR2D GetEndPos( int ii = 0 ) const;
|
||||||
|
|
||||||
virtual int GetPenSizeUi();
|
virtual int GetPenSizeIU();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move item to a new position.
|
* Move item to a new position.
|
||||||
|
@ -153,7 +153,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param aPosition the new position of the starting point in graphic units.
|
* @param aPosition the new position of the starting point in graphic units.
|
||||||
*/
|
*/
|
||||||
void MoveToUi( const VECTOR2I& aPosition );
|
void MoveToIU( const VECTOR2I& aPosition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the starting point of the item to a new position.
|
* Move the starting point of the item to a new position.
|
||||||
|
@ -167,7 +167,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param aPosition is the new position of item in graphic units.
|
* @param aPosition is the new position of item in graphic units.
|
||||||
*/
|
*/
|
||||||
void MoveStartPointToUi( const VECTOR2I& aPosition );
|
void MoveStartPointToIU( const VECTOR2I& aPosition );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,7 +186,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param aPosition is the new position of the ending point in graphic units
|
* @param aPosition is the new position of the ending point in graphic units
|
||||||
*/
|
*/
|
||||||
void MoveEndPointToUi( const VECTOR2I& aPosition );
|
void MoveEndPointToIU( const VECTOR2I& aPosition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the item is inside the rectangle defined by the 4 corners, false otherwise.
|
* @return true if the item is inside the rectangle defined by the 4 corners, false otherwise.
|
||||||
|
@ -219,7 +219,7 @@ public:
|
||||||
|
|
||||||
void SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
|
void SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
|
||||||
|
|
||||||
virtual int GetPenSizeUi() override;
|
virtual int GetPenSizeIU() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a corner in corner list.
|
* Add a corner in corner list.
|
||||||
|
@ -275,7 +275,7 @@ public:
|
||||||
* @return the coordinate (in draw/plot units) of the corner \a aIdx and the repeated
|
* @return the coordinate (in draw/plot units) of the corner \a aIdx and the repeated
|
||||||
* item \a aRepeat
|
* item \a aRepeat
|
||||||
*/
|
*/
|
||||||
const VECTOR2I GetCornerPositionUi( unsigned aIdx, int aRepeat = 0 ) const;
|
const VECTOR2I GetCornerPositionIU( unsigned aIdx, int aRepeat = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the bounding box of the set polygons.
|
* Calculate the bounding box of the set polygons.
|
||||||
|
@ -301,7 +301,7 @@ public:
|
||||||
|
|
||||||
void SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
|
void SyncDrawItems( DS_DRAW_ITEM_LIST* aCollector, KIGFX::VIEW* aView ) override;
|
||||||
|
|
||||||
virtual int GetPenSizeUi() override;
|
virtual int GetPenSizeIU() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to build text which is an increment of m_TextBase
|
* Try to build text which is an increment of m_TextBase
|
||||||
|
|
|
@ -168,7 +168,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
||||||
// ... and second click places:
|
// ... and second click places:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item->GetPeer()->MoveStartPointToUi( cursorPos );
|
item->GetPeer()->MoveStartPointToIU( cursorPos );
|
||||||
item->SetPosition( item->GetPeer()->GetStartPosIU( 0 ) );
|
item->SetPosition( item->GetPeer()->GetStartPosIU( 0 ) );
|
||||||
item->ClearEditFlags();
|
item->ClearEditFlags();
|
||||||
getView()->Update( item );
|
getView()->Update( item );
|
||||||
|
@ -193,7 +193,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||||
{
|
{
|
||||||
item->GetPeer()->MoveStartPointToUi( cursorPos );
|
item->GetPeer()->MoveStartPointToIU( cursorPos );
|
||||||
item->SetPosition( item->GetPeer()->GetStartPosIU( 0 ) );
|
item->SetPosition( item->GetPeer()->GetStartPosIU( 0 ) );
|
||||||
getView()->Update( item );
|
getView()->Update( item );
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
|
m_toolMgr->RunAction( PL_ACTIONS::clearSelection );
|
||||||
|
|
||||||
DS_DATA_ITEM* dataItem = m_frame->AddDrawingSheetItem( type );
|
DS_DATA_ITEM* dataItem = m_frame->AddDrawingSheetItem( type );
|
||||||
dataItem->MoveToUi( cursorPos );
|
dataItem->MoveToIU( cursorPos );
|
||||||
|
|
||||||
item = dataItem->GetDrawItems()[0];
|
item = dataItem->GetDrawItems()[0];
|
||||||
item->SetFlags( IS_NEW );
|
item->SetFlags( IS_NEW );
|
||||||
|
@ -305,7 +305,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
item->GetPeer()->MoveEndPointToUi( cursorPos );
|
item->GetPeer()->MoveEndPointToIU( cursorPos );
|
||||||
item->SetEnd( item->GetPeer()->GetEndPosIU( 0 ) );
|
item->SetEnd( item->GetPeer()->GetEndPosIU( 0 ) );
|
||||||
getView()->Update( item );
|
getView()->Update( item );
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
void PL_EDIT_TOOL::moveItem( DS_DATA_ITEM* aItem, const VECTOR2I& aDelta )
|
void PL_EDIT_TOOL::moveItem( DS_DATA_ITEM* aItem, const VECTOR2I& aDelta )
|
||||||
{
|
{
|
||||||
aItem->MoveToUi( aItem->GetStartPosIU() + aDelta );
|
aItem->MoveToIU( aItem->GetStartPosIU() + aDelta );
|
||||||
|
|
||||||
for( DS_DRAW_ITEM_BASE* item : aItem->GetDrawItems() )
|
for( DS_DRAW_ITEM_BASE* item : aItem->GetDrawItems() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -338,8 +338,8 @@ void PL_POINT_EDITOR::updateItem() const
|
||||||
VECTOR2I move_startpoint = m_editPoints->Point( LINE_START ).GetPosition() - line->GetStart();
|
VECTOR2I move_startpoint = m_editPoints->Point( LINE_START ).GetPosition() - line->GetStart();
|
||||||
VECTOR2I move_endpoint = m_editPoints->Point( LINE_END ).GetPosition() - line->GetEnd();
|
VECTOR2I move_endpoint = m_editPoints->Point( LINE_END ).GetPosition() - line->GetEnd();
|
||||||
|
|
||||||
dataItem->MoveStartPointToUi( dataItem->GetStartPosIU() + move_startpoint );
|
dataItem->MoveStartPointToIU( dataItem->GetStartPosIU() + move_startpoint );
|
||||||
dataItem->MoveEndPointToUi( dataItem->GetEndPosIU() + move_endpoint );
|
dataItem->MoveEndPointToIU( dataItem->GetEndPosIU() + move_endpoint );
|
||||||
|
|
||||||
for( DS_DRAW_ITEM_BASE* draw_item : dataItem->GetDrawItems() )
|
for( DS_DRAW_ITEM_BASE* draw_item : dataItem->GetDrawItems() )
|
||||||
{
|
{
|
||||||
|
@ -389,8 +389,8 @@ void PL_POINT_EDITOR::updateItem() const
|
||||||
end_delta.x = botRight.x - rect->GetEnd().x;
|
end_delta.x = botRight.x - rect->GetEnd().x;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataItem->MoveStartPointToUi( dataItem->GetStartPosIU() + start_delta );
|
dataItem->MoveStartPointToIU( dataItem->GetStartPosIU() + start_delta );
|
||||||
dataItem->MoveEndPointToUi( dataItem->GetEndPosIU() + end_delta );
|
dataItem->MoveEndPointToIU( dataItem->GetEndPosIU() + end_delta );
|
||||||
|
|
||||||
for( DS_DRAW_ITEM_BASE* draw_item : dataItem->GetDrawItems() )
|
for( DS_DRAW_ITEM_BASE* draw_item : dataItem->GetDrawItems() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue