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;
......
/*********************************************************************/ /*********************************************************************/
/* EESchema */
/* edit_label.cpp: label, global label and text creation or edition */ /* edit_label.cpp: label, global label and text creation or edition */
/*********************************************************************/ /*********************************************************************/
...@@ -12,10 +11,12 @@ ...@@ -12,10 +11,12 @@
#include "confirm.h" #include "confirm.h"
#include "class_sch_screen.h" #include "class_sch_screen.h"
#include "wxEeschemaStruct.h" #include "wxEeschemaStruct.h"
#include "kicad_device_context.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "sch_text.h" #include "sch_text.h"
#include "eeschema_id.h"
static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
...@@ -32,114 +33,112 @@ static bool lastTextBold = false; ...@@ -32,114 +33,112 @@ static bool lastTextBold = false;
static bool lastTextItalic = false; static bool lastTextItalic = false;
void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ) void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* aTextItem, wxDC* aDC )
{ {
if( TextStruct == NULL ) if( aTextItem == NULL )
return; return;
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
if( !TextStruct->IsNew() ) if( !aTextItem->IsNew() )
{ {
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = TextStruct->Clone(); g_ItemToUndoCopy = aTextItem->Clone();
} }
TextStruct->m_Flags |= IS_MOVED; aTextItem->SetFlags( IS_MOVED );
switch( TextStruct->Type() ) switch( aTextItem->Type() )
{ {
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T: case SCH_TEXT_T:
ItemInitialPosition = TextStruct->m_Pos; ItemInitialPosition = aTextItem->m_Pos;
OldSize = TextStruct->m_Size; OldSize = aTextItem->m_Size;
OldOrient = TextStruct->GetSchematicTextOrientation(); OldOrient = aTextItem->GetOrientation();
break; break;
default: default:
break; break;
} }
DrawPanel->CrossHairOff( DC ); DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( ItemInitialPosition ); GetScreen()->SetCrossHairPosition( ItemInitialPosition );
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
OnModify( ); OnModify();
DrawPanel->SetMouseCapture( ShowWhileMoving,ExitMoveTexte ); DrawPanel->SetMouseCapture( ShowWhileMoving, ExitMoveTexte );
GetScreen()->SetCurItem( TextStruct ); GetScreen()->SetCurItem( aTextItem );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->CrossHairOn( DC ); DrawPanel->CrossHairOn( aDC );
} }
void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC )
{ {
if( TextStruct == NULL ) if( aTextItem == NULL )
TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->GetCrossHairPosition(), aTextItem = (SCH_TEXT*) PickStruct( GetScreen()->GetCrossHairPosition(),
GetScreen(), TEXT_T | LABEL_T ); GetScreen(), TEXT_T | LABEL_T );
if( TextStruct == NULL ) if( aTextItem == NULL )
return; return;
/* save old text in undo list if is not already in edit */ /* save old text in undo list if is not already in edit */
if( TextStruct->m_Flags == 0 ) if( aTextItem->GetFlags() == 0 )
SaveCopyInUndoList( TextStruct, UR_CHANGED ); SaveCopyInUndoList( aTextItem, UR_CHANGED );
/* Erase old text */ /* Erase old text */
DrawPanel->CrossHairOff( DC ); DrawPanel->CrossHairOff( aDC );
TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); aTextItem->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
int orient; int orient;
switch( TextStruct->Type() ) switch( aTextItem->Type() )
{ {
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T: case SCH_TEXT_T:
orient = TextStruct->GetSchematicTextOrientation() + 1; orient = aTextItem->GetOrientation() + 1;
orient &= 3; orient &= 3;
TextStruct->SetSchematicTextOrientation( orient ); aTextItem->SetOrientation( orient );
break; break;
default: default:
break; break;
} }
OnModify( ); OnModify();
TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); aTextItem->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
DrawPanel->CrossHairOn( DC ); DrawPanel->CrossHairOn( aDC );
} }
/* Routine to create new text struct (GraphicText, label or Glabel). SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
*/
SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
{ {
SCH_TEXT* NewText = NULL; SCH_TEXT* textItem = NULL;
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
switch( type ) switch( aType )
{ {
case LAYER_NOTES: case LAYER_NOTES:
NewText = new SCH_TEXT( GetScreen()->GetCrossHairPosition() ); textItem = new SCH_TEXT( GetScreen()->GetCrossHairPosition() );
break; break;
case LAYER_LOCLABEL: case LAYER_LOCLABEL:
NewText = new SCH_LABEL( GetScreen()->GetCrossHairPosition() ); textItem = new SCH_LABEL( GetScreen()->GetCrossHairPosition() );
break; break;
case LAYER_HIERLABEL: case LAYER_HIERLABEL:
NewText = new SCH_HIERLABEL( GetScreen()->GetCrossHairPosition() ); textItem = new SCH_HIERLABEL( GetScreen()->GetCrossHairPosition() );
NewText->m_Shape = lastGlobalLabelShape; textItem->m_Shape = lastGlobalLabelShape;
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
NewText = new SCH_GLOBALLABEL( GetScreen()->GetCrossHairPosition() ); textItem = new SCH_GLOBALLABEL( GetScreen()->GetCrossHairPosition() );
NewText->m_Shape = lastGlobalLabelShape; textItem->m_Shape = lastGlobalLabelShape;
break; break;
default: default:
...@@ -147,104 +146,99 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type ) ...@@ -147,104 +146,99 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
return NULL; return NULL;
} }
NewText->m_Bold = lastTextBold; textItem->m_Bold = lastTextBold;
NewText->m_Italic = lastTextItalic; textItem->m_Italic = lastTextItalic;
NewText->SetSchematicTextOrientation( lastTextOrientation ); textItem->SetOrientation( lastTextOrientation );
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize; textItem->m_Size.x = textItem->m_Size.y = g_DefaultTextLabelSize;
NewText->m_Flags = IS_NEW | IS_MOVED; textItem->SetFlags( IS_NEW | IS_MOVED );
NewText->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); textItem->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
EditSchematicText( NewText ); EditSchematicText( textItem );
if( NewText->m_Text.IsEmpty() ) if( textItem->m_Text.IsEmpty() )
{ {
SAFE_DELETE( NewText ); SAFE_DELETE( textItem );
return NULL; return NULL;
} }
lastTextBold = NewText->m_Bold; lastTextBold = textItem->m_Bold;
lastTextItalic = NewText->m_Italic; lastTextItalic = textItem->m_Italic;
lastTextOrientation = NewText->GetSchematicTextOrientation(); lastTextOrientation = textItem->GetOrientation();
if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL ) if( aType == LAYER_GLOBLABEL || aType == LAYER_HIERLABEL )
{ {
lastGlobalLabelShape = NewText->m_Shape; lastGlobalLabelShape = textItem->m_Shape;
} }
NewText->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); textItem->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->SetMouseCapture( ShowWhileMoving, ExitMoveTexte ); DrawPanel->SetMouseCapture( ShowWhileMoving, ExitMoveTexte );
GetScreen()->SetCurItem( NewText ); GetScreen()->SetCurItem( textItem );
return NewText; return textItem;
} }
/************************************/
/* Redraw a Text while moving */
/************************************/
static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
SCH_ITEM* TextStruct = (SCH_ITEM*) aPanel->GetScreen()->GetCurItem(); SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_ITEM* textItem = screen->GetCurItem();
/* "Undraw" the current text at its old position*/ // Erase the current text at its current position.
if( aErase ) if( aErase )
TextStruct->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); textItem->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
/* redraw the text */ // Draw the text item at it's new position.
switch( TextStruct->Type() ) switch( textItem->Type() )
{ {
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T: case SCH_TEXT_T:
( (SCH_TEXT*) TextStruct )->m_Pos = aPanel->GetScreen()->GetCrossHairPosition(); ( (SCH_TEXT*) textItem )->m_Pos = screen->GetCrossHairPosition();
break; break;
default: default:
break; break;
} }
TextStruct->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); textItem->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
/* Abort function for the command move text */ /* Abort function for the command move text */
static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC ) static void ExitMoveTexte( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{ {
BASE_SCREEN* screen = Panel->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem(); SCH_ITEM* item = screen->GetCurItem();
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent(); SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) aPanel->GetParent();
parent->SetRepeatItem( NULL ); parent->SetRepeatItem( NULL );
if( Struct == NULL ) /* no current item */ if( item == NULL ) /* no current item */
{
return; return;
}
/* "Undraw" the text, and delete it if new (i.e. it was being just // Erase the text item and delete it if new (i.e. it was being just created).
* created)*/ item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
Struct->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( Struct->IsNew() ) if( item->IsNew() )
{ {
SAFE_DELETE( Struct ); SAFE_DELETE( item );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
} }
else /* this was a move command on "old" text: restore its old settings. */ else // this was a move command on "old" text: restore its old settings.
{ {
switch( Struct->Type() ) switch( item->Type() )
{ {
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T: case SCH_TEXT_T:
{ {
SCH_TEXT* Text = (SCH_TEXT*) Struct; SCH_TEXT* text = (SCH_TEXT*) item;
Text->m_Pos = ItemInitialPosition; text->m_Pos = ItemInitialPosition;
Text->m_Size = OldSize; text->m_Size = OldSize;
Text->SetSchematicTextOrientation( OldOrient ); text->SetOrientation( OldOrient );
} }
break; break;
...@@ -252,62 +246,88 @@ static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -252,62 +246,88 @@ static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC )
break; break;
} }
Struct->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); item->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
Struct->m_Flags = 0; item->ClearFlags();
} }
} }
/* Routine to change a text type to an other one (GraphicText, label or Glabel). void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
* A new test, label or hierarchical or global label is created from the old text.
* the old text is deleted
*/
void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
{ {
if( Text == NULL ) SCH_SCREEN* screen = GetScreen();
SCH_TEXT* text = (SCH_TEXT*) screen->GetCurItem();
wxCHECK_RET( (text != NULL) && text->CanIncrementLabel(),
wxT( "Cannot convert text type." ) );
KICAD_T type;
switch( aEvent.GetId() )
{
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
type = SCH_LABEL_T;
break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
type = SCH_GLOBAL_LABEL_T;
break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
type = SCH_HIERARCHICAL_LABEL_T;
break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
type = SCH_TEXT_T;
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "Invalid text type command ID %d." ),
aEvent.GetId() ) );
return;
}
if( text->Type() == type )
return; return;
SCH_TEXT* newtext; SCH_TEXT* newtext;
switch( newtype ) switch( type )
{ {
case SCH_LABEL_T: case SCH_LABEL_T:
newtext = new SCH_LABEL( Text->m_Pos, Text->m_Text ); newtext = new SCH_LABEL( text->m_Pos, text->m_Text );
break; break;
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
newtext = new SCH_GLOBALLABEL( Text->m_Pos, Text->m_Text ); newtext = new SCH_GLOBALLABEL( text->m_Pos, text->m_Text );
break; break;
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
newtext = new SCH_HIERLABEL( Text->m_Pos, Text->m_Text ); newtext = new SCH_HIERLABEL( text->m_Pos, text->m_Text );
break; break;
case SCH_TEXT_T: case SCH_TEXT_T:
newtext = new SCH_TEXT( Text->m_Pos, Text->m_Text ); newtext = new SCH_TEXT( text->m_Pos, text->m_Text );
break; break;
default: default:
newtext = NULL; newtext = NULL;
DisplayError( this, wxT( "ConvertTextType: Internal error" ) ); wxFAIL_MSG( wxString::Format( wxT( "Cannot convert text type to %d" ), type ) );
return; return;
} }
/* copy the old text settings /* Copy the old text item settings to the new one. Justifications are not copied because
* Justifications are not copied because they are not used in labels, * they are not used in labels. Justifications will be set to default value in the new
* and can be used in texts * text item type.
* So they will be set to default in conversion.
*/ */
newtext->m_Shape = Text->m_Shape; newtext->m_Shape = text->m_Shape;
newtext->SetSchematicTextOrientation( Text->GetSchematicTextOrientation() ); newtext->SetOrientation( text->GetOrientation() );
newtext->m_Size = Text->m_Size; newtext->m_Size = text->m_Size;
newtext->m_Thickness = Text->m_Thickness; newtext->m_Thickness = text->m_Thickness;
newtext->m_Italic = Text->m_Italic; newtext->m_Italic = text->m_Italic;
newtext->m_Bold = Text->m_Bold; newtext->m_Bold = text->m_Bold;
// save current text flag: // save current text flag:
int flags = Text->m_Flags; int flags = text->GetFlags();
/* add the new text in linked list if old text is in list */ /* add the new text in linked list if old text is in list */
if( (flags & IS_NEW) == 0 ) if( (flags & IS_NEW) == 0 )
...@@ -317,21 +337,18 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype ) ...@@ -317,21 +337,18 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
OnModify(); OnModify();
} }
/* now delete the old text INSTALL_UNBUFFERED_DC( dc, DrawPanel );
* If it is a text flagged IS_NEW it will be deleted by m_endMouseCaptureCallback()
* If not, we must delete it. /* Delete the old text item. If it is a text flagged as new it will be deleted by
* ending the mouse capture.
*/ */
if( DrawPanel->m_mouseCaptureCallback && DrawPanel->m_endMouseCaptureCallback ) if( DrawPanel->IsMouseCaptured() )
{ DrawPanel->EndMouseCapture();
DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC );
}
if( (flags & IS_NEW) == 0 ) // Remove old text from current list and if( (flags & IS_NEW) == 0 ) // Remove old text from current list and save it in undo list
// save it in undo list
{ {
Text->m_Flags = 0; text->ClearFlags();
DeleteStruct( DrawPanel, DC, Text ); // old text is really saved in DeleteStruct( DrawPanel, &dc, text ); // old text is really saved in undo list
// undo list
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
} }
...@@ -341,7 +358,7 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype ) ...@@ -341,7 +358,7 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = NULL; g_ItemToUndoCopy = NULL;
DrawPanel->CrossHairOff( DC ); // Erase schematic cursor DrawPanel->CrossHairOff( &dc ); // Erase schematic cursor
/* Save the new text in undo list if the old text was not itself a "new created text" /* Save the new text in undo list if the old text was not itself a "new created text"
* In this case, the old text is already in undo list as a deleted item. * In this case, the old text is already in undo list as a deleted item.
...@@ -355,16 +372,15 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype ) ...@@ -355,16 +372,15 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
else else
{ {
GetScreen()->SetCurItem( newtext ); GetScreen()->SetCurItem( newtext );
newtext->m_Flags = IS_NEW; newtext->SetFlags( IS_NEW );
} }
if( (flags & IS_MOVED) != 0 ) if( (flags & IS_MOVED) != 0 )
{ {
GetScreen()->SetCurItem( newtext ); GetScreen()->SetCurItem( newtext );
StartMoveTexte( newtext, DC ); StartMoveTexte( newtext, &dc );
} }
newtext->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); newtext->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CrossHairOn( DC ); // redraw schematic cursor DrawPanel->CrossHairOn( &dc ); // redraw schematic cursor
} }
...@@ -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