Commit 9e0e43e4 authored by Wayne Stambaugh's avatar Wayne Stambaugh

EESchema and other minor code improvements.

* Change EDA_ITEM set flag function to set flag bits using logical or
  instead of assignment.
* Add clear flag function to EDA_ITEM to clear flag bit using inverted
  logical and.
* Factor change schematic text type code out of switch statement into
  a single function call.
* Schematic text orientation function renaming improvements.
* Lots of small coding policy changes to updated files.
parent bd99012a
...@@ -128,7 +128,7 @@ void DialogLabelEditor::InitDialog() ...@@ -128,7 +128,7 @@ void DialogLabelEditor::InitDialog()
EnsureTextCtrlWidth( m_textLabel, &textWidth ); EnsureTextCtrlWidth( m_textLabel, &textWidth );
// Set validators // Set validators
m_TextOrient->SetSelection( m_CurrentText->GetSchematicTextOrientation() ); m_TextOrient->SetSelection( m_CurrentText->GetOrientation() );
m_TextShape->SetSelection( m_CurrentText->m_Shape ); m_TextShape->SetSelection( m_CurrentText->m_Shape );
int style = 0; int style = 0;
...@@ -205,7 +205,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent ) ...@@ -205,7 +205,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
else if( (m_CurrentText->m_Flags & IS_NEW) == 0 ) else if( (m_CurrentText->m_Flags & IS_NEW) == 0 )
DisplayError( this, _( "Empty Text!" ) ); DisplayError( this, _( "Empty Text!" ) );
m_CurrentText->SetSchematicTextOrientation( m_TextOrient->GetSelection() ); m_CurrentText->SetOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue(); text = m_TextSize->GetValue();
value = ReturnValueFromString( g_UserUnit, text, m_Parent->m_InternalUnits ); value = ReturnValueFromString( g_UserUnit, text, m_Parent->m_InternalUnits );
m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value; m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value;
......
This diff is collapsed.
...@@ -87,17 +87,12 @@ enum id_eeschema_frm ...@@ -87,17 +87,12 @@ enum id_eeschema_frm
ID_POPUP_SCH_EDIT_CONVERT_CMP, ID_POPUP_SCH_EDIT_CONVERT_CMP,
ID_POPUP_SCH_ROTATE_FIELD, ID_POPUP_SCH_ROTATE_FIELD,
ID_POPUP_SCH_EDIT_FIELD, ID_POPUP_SCH_EDIT_FIELD,
ID_POPUP_SCH_CHANGE_TYPE_TEXT,
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
ID_POPUP_SCH_DISPLAYDOC_CMP, ID_POPUP_SCH_DISPLAYDOC_CMP,
ID_POPUP_SCH_ENTER_SHEET, ID_POPUP_SCH_ENTER_SHEET,
ID_POPUP_SCH_LEAVE_SHEET, ID_POPUP_SCH_LEAVE_SHEET,
ID_POPUP_SCH_ADD_JUNCTION, ID_POPUP_SCH_ADD_JUNCTION,
ID_POPUP_SCH_ADD_LABEL, ID_POPUP_SCH_ADD_LABEL,
ID_POPUP_SCH_ADD_GLABEL, ID_POPUP_SCH_ADD_GLABEL,
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
ID_POPUP_SCH_GETINFO_MARKER, ID_POPUP_SCH_GETINFO_MARKER,
ID_POPUP_END_RANGE, ID_POPUP_END_RANGE,
...@@ -130,6 +125,13 @@ enum id_eeschema_frm ...@@ -130,6 +125,13 @@ enum id_eeschema_frm
ID_POPUP_SCH_SELECT_UNIT25, ID_POPUP_SCH_SELECT_UNIT25,
ID_POPUP_SCH_SELECT_UNIT26, ID_POPUP_SCH_SELECT_UNIT26,
// Change text type context menu command IDs.
ID_POPUP_SCH_CHANGE_TYPE_TEXT,
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
// Schematic editor commmands. These are command IDs that are generated by multiple // Schematic editor commmands. These are command IDs that are generated by multiple
// events (menus, toolbar, context menu, etc.) that result in the same event handler. // events (menus, toolbar, context menu, etc.) that result in the same event handler.
ID_CANCEL_CURRENT_COMMAND, ID_CANCEL_CURRENT_COMMAND,
......
...@@ -709,7 +709,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -709,7 +709,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
int oldFlags = m_drawItem->GetFlags(); int oldFlags = m_drawItem->GetFlags();
m_drawItem->SetFlags( 0 ); m_drawItem->ClearFlags();
m_drawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); m_drawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) ); ( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) );
m_drawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); m_drawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
......
...@@ -62,7 +62,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -62,7 +62,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
default: default:
wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick error. Item type <" ) + wxFAIL_MSG( wxT( "SCH_EDIT_FRAME::OnLeftClick error. Item type <" ) +
item->GetClass() + wxT( "> is already being edited." ) ); item->GetClass() + wxT( "> is already being edited." ) );
item->SetFlags( 0 ); item->ClearFlags();
} }
} }
else else
......
...@@ -123,22 +123,22 @@ void SCH_SHEET_PIN::SetEdge( int aEdge ) ...@@ -123,22 +123,22 @@ void SCH_SHEET_PIN::SetEdge( int aEdge )
{ {
case 0: /* pin on left side*/ case 0: /* pin on left side*/
m_Pos.x = Sheet->m_Pos.x; m_Pos.x = Sheet->m_Pos.x;
SetSchematicTextOrientation( 2 ); /* Orientation horiz inverse */ SetOrientation( 2 ); /* Orientation horiz inverse */
break; break;
case 1: /* pin on right side*/ case 1: /* pin on right side*/
m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x; m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x;
SetSchematicTextOrientation( 0 ); /* Orientation horiz normal */ SetOrientation( 0 ); /* Orientation horiz normal */
break; break;
case 2: /* pin on top side*/ case 2: /* pin on top side*/
m_Pos.y = Sheet->m_Pos.y; m_Pos.y = Sheet->m_Pos.y;
SetSchematicTextOrientation( 3 ); /* Orientation vert BOTTOM */ SetOrientation( 3 ); /* Orientation vert BOTTOM */
break; break;
case 3: /* pin on bottom side*/ case 3: /* pin on bottom side*/
m_Pos.y = Sheet->m_Pos.y + Sheet->m_Size.y; m_Pos.y = Sheet->m_Pos.y + Sheet->m_Size.y;
SetSchematicTextOrientation( 1 ); /* Orientation vert UP */ SetOrientation( 1 ); /* Orientation vert UP */
break; break;
} }
} }
......
...@@ -165,7 +165,7 @@ void SCH_TEXT::Mirror_Y( int aYaxis_position ) ...@@ -165,7 +165,7 @@ void SCH_TEXT::Mirror_Y( int aYaxis_position )
int px = m_Pos.x; int px = m_Pos.x;
int dx; int dx;
switch( GetSchematicTextOrientation() ) switch( GetOrientation() )
{ {
case 0: /* horizontal text */ case 0: /* horizontal text */
dx = LenSize( m_Text ) / 2; dx = LenSize( m_Text ) / 2;
...@@ -206,7 +206,7 @@ void SCH_TEXT::Mirror_X( int aXaxis_position ) ...@@ -206,7 +206,7 @@ void SCH_TEXT::Mirror_X( int aXaxis_position )
int py = m_Pos.y; int py = m_Pos.y;
int dy; int dy;
switch( GetSchematicTextOrientation() ) switch( GetOrientation() )
{ {
case 0: /* horizontal text */ case 0: /* horizontal text */
dy = -m_Size.y / 2; dy = -m_Size.y / 2;
...@@ -243,8 +243,9 @@ void SCH_TEXT::Rotate( wxPoint rotationPoint ) ...@@ -243,8 +243,9 @@ void SCH_TEXT::Rotate( wxPoint rotationPoint )
int dy; int dy;
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, rotationPoint, 900 );
SetSchematicTextOrientation( (GetSchematicTextOrientation() + 1) % 4 ); SetOrientation( (GetOrientation() + 1) % 4 );
switch( GetSchematicTextOrientation() )
switch( GetOrientation() )
{ {
case 0: /* horizontal text */ case 0: /* horizontal text */
dy = m_Size.y; dy = m_Size.y;
...@@ -271,9 +272,9 @@ void SCH_TEXT::Rotate( wxPoint rotationPoint ) ...@@ -271,9 +272,9 @@ void SCH_TEXT::Rotate( wxPoint rotationPoint )
} }
void SCH_TEXT::SetSchematicTextOrientation( int aSchematicOrientation ) void SCH_TEXT::SetOrientation( int aOrientation )
{ {
m_SchematicOrientation = aSchematicOrientation; m_SchematicOrientation = aOrientation;
switch( m_SchematicOrientation ) switch( m_SchematicOrientation )
{ {
...@@ -491,7 +492,7 @@ bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -491,7 +492,7 @@ bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg )
m_Text = val; m_Text = val;
m_Size.x = m_Size.y = size; m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient ); SetOrientation( orient );
if( isdigit( Name3[0] ) ) if( isdigit( Name3[0] ) )
{ {
...@@ -681,9 +682,9 @@ wxPoint SCH_LABEL::GetSchematicTextOffset() ...@@ -681,9 +682,9 @@ wxPoint SCH_LABEL::GetSchematicTextOffset()
} }
void SCH_LABEL::SetSchematicTextOrientation( int aSchematicOrientation ) void SCH_LABEL::SetOrientation( int aOrientation )
{ {
SCH_TEXT::SetSchematicTextOrientation( aSchematicOrientation ); SCH_TEXT::SetOrientation( aOrientation );
} }
...@@ -705,7 +706,7 @@ void SCH_LABEL::Mirror_X( int aXaxis_position ) ...@@ -705,7 +706,7 @@ void SCH_LABEL::Mirror_X( int aXaxis_position )
void SCH_LABEL::Rotate( wxPoint rotationPoint ) void SCH_LABEL::Rotate( wxPoint rotationPoint )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, rotationPoint, 900 );
SetSchematicTextOrientation( (GetSchematicTextOrientation() + 1) % 4 ); SetOrientation( (GetOrientation() + 1) % 4 );
} }
...@@ -774,7 +775,7 @@ bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -774,7 +775,7 @@ bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
m_Text = FROM_UTF8( text ); m_Text = FROM_UTF8( text );
m_Size.x = m_Size.y = size; m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient ); SetOrientation( orient );
if( isdigit( Name3[0] ) ) if( isdigit( Name3[0] ) )
{ {
...@@ -940,7 +941,7 @@ bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -940,7 +941,7 @@ bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
m_Text = FROM_UTF8( text ); m_Text = FROM_UTF8( text );
m_Size.x = m_Size.y = size; m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient ); SetOrientation( orient );
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
m_Bold = ( thickness != 0 ); m_Bold = ( thickness != 0 );
m_Thickness = m_Bold ? GetPenSizeForBold( size ) : 0; m_Thickness = m_Bold ? GetPenSizeForBold( size ) : 0;
...@@ -971,14 +972,14 @@ void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position ) ...@@ -971,14 +972,14 @@ void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position )
* for a vertical label, the schematic orientation is not changed. * for a vertical label, the schematic orientation is not changed.
* and the label is moved to a suitable position * and the label is moved to a suitable position
*/ */
switch( GetSchematicTextOrientation() ) switch( GetOrientation() )
{ {
case 0: /* horizontal text */ case 0: /* horizontal text */
SetSchematicTextOrientation( 2 ); SetOrientation( 2 );
break; break;
case 2: /* invert horizontal text*/ case 2: /* invert horizontal text*/
SetSchematicTextOrientation( 0 ); SetOrientation( 0 );
break; break;
} }
...@@ -990,14 +991,14 @@ void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position ) ...@@ -990,14 +991,14 @@ void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position )
void SCH_GLOBALLABEL::Mirror_X( int aXaxis_position ) void SCH_GLOBALLABEL::Mirror_X( int aXaxis_position )
{ {
switch( GetSchematicTextOrientation() ) switch( GetOrientation() )
{ {
case 1: /* vertical text */ case 1: /* vertical text */
SetSchematicTextOrientation( 3 ); SetOrientation( 3 );
break; break;
case 3: /* invert vertical text*/ case 3: /* invert vertical text*/
SetSchematicTextOrientation( 1 ); SetOrientation( 1 );
break; break;
} }
...@@ -1010,7 +1011,7 @@ void SCH_GLOBALLABEL::Mirror_X( int aXaxis_position ) ...@@ -1010,7 +1011,7 @@ void SCH_GLOBALLABEL::Mirror_X( int aXaxis_position )
void SCH_GLOBALLABEL::Rotate( wxPoint rotationPoint ) void SCH_GLOBALLABEL::Rotate( wxPoint rotationPoint )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, rotationPoint, 900 );
SetSchematicTextOrientation( (GetSchematicTextOrientation() + 3) % 4 ); SetOrientation( (GetOrientation() + 3) % 4 );
} }
...@@ -1063,9 +1064,9 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() ...@@ -1063,9 +1064,9 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset()
} }
void SCH_GLOBALLABEL::SetSchematicTextOrientation( int aSchematicOrientation ) void SCH_GLOBALLABEL::SetOrientation( int aOrientation )
{ {
m_SchematicOrientation = aSchematicOrientation; m_SchematicOrientation = aOrientation;
switch( m_SchematicOrientation ) switch( m_SchematicOrientation )
{ {
...@@ -1366,7 +1367,7 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1366,7 +1367,7 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
m_Text = FROM_UTF8( text ); m_Text = FROM_UTF8( text );
m_Size.x = m_Size.y = size; m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient ); SetOrientation( orient );
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
m_Bold = ( thickness != 0 ); m_Bold = ( thickness != 0 );
m_Thickness = m_Bold ? GetPenSizeForBold( size ) : 0; m_Thickness = m_Bold ? GetPenSizeForBold( size ) : 0;
...@@ -1390,9 +1391,9 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1390,9 +1391,9 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
} }
void SCH_HIERLABEL::SetSchematicTextOrientation( int aSchematicOrientation ) void SCH_HIERLABEL::SetOrientation( int aOrientation )
{ {
m_SchematicOrientation = aSchematicOrientation; m_SchematicOrientation = aOrientation;
switch( m_SchematicOrientation ) switch( m_SchematicOrientation )
{ {
...@@ -1578,14 +1579,14 @@ void SCH_HIERLABEL::Mirror_Y( int aYaxis_position ) ...@@ -1578,14 +1579,14 @@ void SCH_HIERLABEL::Mirror_Y( int aYaxis_position )
* and the label is moved to a suitable position. * and the label is moved to a suitable position.
*/ */
switch( GetSchematicTextOrientation() ) switch( GetOrientation() )
{ {
case 0: /* horizontal text */ case 0: /* horizontal text */
SetSchematicTextOrientation( 2 ); SetOrientation( 2 );
break; break;
case 2: /* invert horizontal text*/ case 2: /* invert horizontal text*/
SetSchematicTextOrientation( 0 ); SetOrientation( 0 );
break; break;
} }
...@@ -1597,14 +1598,14 @@ void SCH_HIERLABEL::Mirror_Y( int aYaxis_position ) ...@@ -1597,14 +1598,14 @@ void SCH_HIERLABEL::Mirror_Y( int aYaxis_position )
void SCH_HIERLABEL::Mirror_X( int aXaxis_position ) void SCH_HIERLABEL::Mirror_X( int aXaxis_position )
{ {
switch( GetSchematicTextOrientation() ) switch( GetOrientation() )
{ {
case 1: /* vertical text */ case 1: /* vertical text */
SetSchematicTextOrientation( 3 ); SetOrientation( 3 );
break; break;
case 3: /* invert vertical text*/ case 3: /* invert vertical text*/
SetSchematicTextOrientation( 1 ); SetOrientation( 1 );
break; break;
} }
...@@ -1617,7 +1618,7 @@ void SCH_HIERLABEL::Mirror_X( int aXaxis_position ) ...@@ -1617,7 +1618,7 @@ void SCH_HIERLABEL::Mirror_X( int aXaxis_position )
void SCH_HIERLABEL::Rotate( wxPoint rotationPoint ) void SCH_HIERLABEL::Rotate( wxPoint rotationPoint )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, rotationPoint, 900 );
SetSchematicTextOrientation( (GetSchematicTextOrientation() + 3) % 4 ); SetOrientation( (GetOrientation() + 3) % 4 );
} }
......
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
void IncrementLabel(); void IncrementLabel();
/** /**
* Function SetTextOrientAndJustifyParmeters * Function SetOrientation
* Set m_SchematicOrientation, and initialize * Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of * m_orient,m_HJustified and m_VJustified, according to the value of
* m_SchematicOrientation (for a text ) * m_SchematicOrientation (for a text )
...@@ -85,9 +85,9 @@ public: ...@@ -85,9 +85,9 @@ public:
* position of 0 * position of 0
* 3 = bottom . This can be seen as the mirrored position of up * 3 = bottom . This can be seen as the mirrored position of up
*/ */
virtual void SetSchematicTextOrientation( int aSchematicOrientation ); virtual void SetOrientation( int aSchematicOrientation );
int GetSchematicTextOrientation() { return m_SchematicOrientation; } int GetOrientation() { return m_SchematicOrientation; }
/** /**
* Function GetSchematicTextOffset (virtual) * Function GetSchematicTextOffset (virtual)
...@@ -234,7 +234,7 @@ public: ...@@ -234,7 +234,7 @@ public:
} }
/** /**
* Function SetTextOrientAndJustifyParmeters * Function SetOrientation
* Set m_SchematicOrientation, and initialize * Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of * m_orient,m_HJustified and m_VJustified, according to the value of
* m_SchematicOrientation (for a label) * m_SchematicOrientation (for a label)
...@@ -246,7 +246,7 @@ public: ...@@ -246,7 +246,7 @@ public:
* position of 0 * position of 0
* 3 = bottom . This can be seen as the mirrored position of up * 3 = bottom . This can be seen as the mirrored position of up
*/ */
virtual void SetSchematicTextOrientation( int aSchematicOrientation ); virtual void SetOrientation( int aSchematicOrientation );
/** /**
* Function GetSchematicTextOffset (virtual) * Function GetSchematicTextOffset (virtual)
...@@ -319,7 +319,7 @@ public: ...@@ -319,7 +319,7 @@ public:
} }
/** /**
* Function SetTextOrientAndJustifyParmeters * Function SetOrientation
* Set m_SchematicOrientation, and initialize * Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of * m_orient,m_HJustified and m_VJustified, according to the value of
* m_SchematicOrientation * m_SchematicOrientation
...@@ -331,7 +331,7 @@ public: ...@@ -331,7 +331,7 @@ public:
* position of 0 * position of 0
* 3 = bottom . This can be seen as the mirrored position of up * 3 = bottom . This can be seen as the mirrored position of up
*/ */
virtual void SetSchematicTextOrientation( int aSchematicOrientation ); virtual void SetOrientation( int aSchematicOrientation );
/** /**
* Function GetSchematicTextOffset (virtual) * Function GetSchematicTextOffset (virtual)
...@@ -420,7 +420,7 @@ public: ...@@ -420,7 +420,7 @@ public:
} }
/** /**
* Function SetTextOrientAndJustifyParmeters * Function SetOrientation
* Set m_SchematicOrientation, and initialize * Set m_SchematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of * m_orient,m_HJustified and m_VJustified, according to the value of
* m_SchematicOrientation * m_SchematicOrientation
...@@ -432,7 +432,7 @@ public: ...@@ -432,7 +432,7 @@ public:
* position of 0 * position of 0
* 3 = bottom . This can be seen as the mirrored position of up * 3 = bottom . This can be seen as the mirrored position of up
*/ */
virtual void SetSchematicTextOrientation( int aSchematicOrientation ); virtual void SetOrientation( int aSchematicOrientation );
/** /**
* Function GetSchematicTextOffset (virtual) * Function GetSchematicTextOffset (virtual)
......
...@@ -42,10 +42,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -42,10 +42,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH: case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
case ID_POPUP_END_LINE: case ID_POPUP_END_LINE:
case ID_POPUP_SCH_EDIT_TEXT: case ID_POPUP_SCH_EDIT_TEXT:
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
case ID_POPUP_SCH_SET_SHAPE_TEXT: case ID_POPUP_SCH_SET_SHAPE_TEXT:
case ID_POPUP_SCH_ROTATE_TEXT: case ID_POPUP_SCH_ROTATE_TEXT:
case ID_POPUP_SCH_EDIT_SHEET: case ID_POPUP_SCH_EDIT_SHEET:
...@@ -160,26 +156,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -160,26 +156,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
ChangeTextOrient( (SCH_TEXT*) screen->GetCurItem(), &dc ); ChangeTextOrient( (SCH_TEXT*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
DrawPanel->MoveCursorToCrossHair();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_LABEL_T );
break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
DrawPanel->MoveCursorToCrossHair();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_GLOBAL_LABEL_T );
break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
DrawPanel->MoveCursorToCrossHair();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_HIERARCHICAL_LABEL_T );
break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
DrawPanel->MoveCursorToCrossHair();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_TEXT_T );
break;
case ID_POPUP_SCH_SET_SHAPE_TEXT: case ID_POPUP_SCH_SET_SHAPE_TEXT:
// Not used // Not used
...@@ -197,7 +173,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -197,7 +173,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_DELETE_NODE: case ID_POPUP_SCH_DELETE_NODE:
case ID_POPUP_SCH_DELETE_CONNECTION: case ID_POPUP_SCH_DELETE_CONNECTION:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE ); DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION ? true : false );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
screen->TestDanglingEnds( DrawPanel, &dc ); screen->TestDanglingEnds( DrawPanel, &dc );
...@@ -514,7 +490,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -514,7 +490,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
......
...@@ -118,9 +118,10 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -118,9 +118,10 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
SCH_EDIT_FRAME::Process_Special_Functions ) SCH_EDIT_FRAME::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_SCH_SELECT_UNIT1, ID_POPUP_SCH_SELECT_UNIT26, EVT_MENU_RANGE( ID_POPUP_SCH_SELECT_UNIT1, ID_POPUP_SCH_SELECT_UNIT26,
SCH_EDIT_FRAME::OnSelectUnit ) SCH_EDIT_FRAME::OnSelectUnit )
EVT_MENU_RANGE( ID_POPUP_SCH_CHANGE_TYPE_TEXT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
SCH_EDIT_FRAME::OnConvertTextType )
/* Handle user interface update events. */ /* Handle user interface update events. */
EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected ) EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected )
......
...@@ -319,6 +319,8 @@ class DHEAD; ...@@ -319,6 +319,8 @@ class DHEAD;
#define END_ONPAD (1 << 23) ///< Pcbnew: flag set for track segment ending on a pad #define END_ONPAD (1 << 23) ///< Pcbnew: flag set for track segment ending on a pad
#define BUSY (1 << 24) ///< Pcbnew: flag indicating that the structure has #define BUSY (1 << 24) ///< Pcbnew: flag indicating that the structure has
// already been edited, in some functions // already been edited, in some functions
#define EDA_ITEM_ALL_FLAGS -1
class EDA_ITEM class EDA_ITEM
{ {
...@@ -425,9 +427,9 @@ public: ...@@ -425,9 +427,9 @@ public:
m_Status = new_status; m_Status = new_status;
} }
void SetFlags( int aFlags ) { m_Flags = aFlags; } void SetFlags( int aMask ) { m_Flags |= aMask; }
void ClearFlags( int aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; }
int GetFlags() { return m_Flags; } int GetFlags() const { return m_Flags; }
/** /**
* Function DisplayInfo * Function DisplayInfo
...@@ -435,7 +437,7 @@ public: ...@@ -435,7 +437,7 @@ public:
* information about this object into the frame's message panel. * information about this object into the frame's message panel.
* @param frame A EDA_DRAW_FRAME in which to print status information. * @param frame A EDA_DRAW_FRAME in which to print status information.
*/ */
virtual void DisplayInfo( EDA_DRAW_FRAME* frame ) virtual void DisplayInfo( EDA_DRAW_FRAME* frame )
{ {
// derived classes may implement this // derived classes may implement this
} }
...@@ -446,7 +448,7 @@ public: ...@@ -446,7 +448,7 @@ public:
* @param refPos A wxPoint to test * @param refPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
virtual bool HitTest( const wxPoint& refPos ) virtual bool HitTest( const wxPoint& refPos )
{ {
return false; // derived classes should override this function return false; // derived classes should override this function
} }
......
...@@ -459,11 +459,18 @@ private: ...@@ -459,11 +459,18 @@ private:
SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = FALSE ); SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = FALSE );
// Text ,label, glabel // Text ,label, glabel
SCH_TEXT* CreateNewText( wxDC* DC, int type ); SCH_TEXT* CreateNewText( wxDC* aDC, int aType );
void EditSchematicText( SCH_TEXT* TextStruct ); void EditSchematicText( SCH_TEXT* TextStruct );
void ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ); void ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC );
void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ); void StartMoveTexte( SCH_TEXT* aTextItem, wxDC* aDC );
void ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype );
/**
* Function OnCovertTextType
* is a command event handler to change a text type to an other one. The new text,
* label, hierarchical label, or global label is created from the old text and the
* old text is deleted.
*/
void OnConvertTextType( wxCommandEvent& aEvent );
// Wire, Bus // Wire, Bus
void BeginSegment( wxDC* DC, int type ); void BeginSegment( wxDC* DC, int type );
......
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