Fixed very minor issues.
Fixed compil warning under wxWidgets 2.9.1. File beautification Statring using wxTextEntryDialog instead of Get_Message (because Get_Message does not handle properly cancel option)
This commit is contained in:
parent
2fb1de809f
commit
5605ce89ff
|
@ -639,7 +639,8 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
|
||||||
if( wxTheClipboard->Open() )
|
if( wxTheClipboard->Open() )
|
||||||
{
|
{
|
||||||
if( !wxTheClipboard->SetData( dobjBmp ) )
|
if( !wxTheClipboard->SetData( dobjBmp ) )
|
||||||
wxLogError( _T( "Failed to copy image to clipboard" ) );
|
wxMessageBox( _( "Failed to copy image to clipboard" ) );
|
||||||
|
|
||||||
wxTheClipboard->Flush(); /* the data in clipboard will stay
|
wxTheClipboard->Flush(); /* the data in clipboard will stay
|
||||||
* available after the
|
* available after the
|
||||||
* application exits */
|
* application exits */
|
||||||
|
@ -653,7 +654,7 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
|
||||||
if( !image.SaveFile( FullFileName,
|
if( !image.SaveFile( FullFileName,
|
||||||
fmt_is_jpeg ? wxBITMAP_TYPE_JPEG :
|
fmt_is_jpeg ? wxBITMAP_TYPE_JPEG :
|
||||||
wxBITMAP_TYPE_PNG ) )
|
wxBITMAP_TYPE_PNG ) )
|
||||||
wxLogError( wxT( "Can't save file" ) );
|
wxMessageBox( _( "Can't save file" ) );
|
||||||
|
|
||||||
image.Destroy();
|
image.Destroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,6 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED
|
||||||
* New name cannot be the root name, and must not exists
|
* New name cannot be the root name, and must not exists
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString Line;
|
|
||||||
wxString aliasname;
|
wxString aliasname;
|
||||||
LIB_COMPONENT* component = m_Parent->GetComponent();
|
LIB_COMPONENT* component = m_Parent->GetComponent();
|
||||||
CMP_LIBRARY* library = m_Parent->GetLibrary();
|
CMP_LIBRARY* library = m_Parent->GetLibrary();
|
||||||
|
@ -236,12 +235,15 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED
|
||||||
if( component == NULL )
|
if( component == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( Get_Message( _( "New alias:" ),
|
wxTextEntryDialog dlg( this, _( "New alias:" ), _( "Component Alias" ), aliasname );
|
||||||
_( "Component Alias" ), Line, this ) != 0 )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
return;
|
return; // cancelled by user
|
||||||
|
|
||||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
aliasname = dlg.GetValue( );
|
||||||
aliasname = Line;
|
|
||||||
|
aliasname.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
|
if( aliasname.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
if( m_PartAliasListCtrl->FindString( aliasname ) != wxNOT_FOUND
|
if( m_PartAliasListCtrl->FindString( aliasname ) != wxNOT_FOUND
|
||||||
|| library->FindEntry( aliasname ) != NULL )
|
|| library->FindEntry( aliasname ) != NULL )
|
||||||
|
@ -405,8 +407,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter(
|
||||||
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNUSED (event) )
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNUSED (event) )
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
|
||||||
/* Add a new name to the alias list box
|
/* Add a new name to the footprint filter list box
|
||||||
* New name cannot be the root name, and must not exists
|
* Obvioulsy, cannot be void
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString Line;
|
wxString Line;
|
||||||
|
@ -415,12 +417,16 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNU
|
||||||
if( component == NULL )
|
if( component == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( Get_Message( _( "Add Footprint Filter" ), _( "Footprint Filter" ),
|
wxTextEntryDialog dlg( this, _( "Add Footprint Filter" ), _( "Footprint Filter" ), Line );
|
||||||
Line, this ) != 0 )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
return;
|
return; // cancelled by user
|
||||||
|
|
||||||
|
Line = dlg.GetValue( );
|
||||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
|
|
||||||
|
if( Line.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
/* test for an existing name: */
|
/* test for an existing name: */
|
||||||
int index = m_FootprintFilterListBox->FindString( Line );
|
int index = m_FootprintFilterListBox->FindString( Line );
|
||||||
|
|
||||||
|
|
|
@ -128,9 +128,15 @@ modified!\nYou must create a new power" ) );
|
||||||
|
|
||||||
wxString newtext = Field->m_Text;
|
wxString newtext = Field->m_Text;
|
||||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||||
Get_Message( Field->m_Name, _( "Component field text" ), newtext, this );
|
|
||||||
|
wxTextEntryDialog dlg( this, Field->m_Name, _( "Component field text" ), newtext );
|
||||||
|
int diag = dlg.ShowModal();
|
||||||
|
newtext = dlg.GetValue( );
|
||||||
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||||
|
if ( diag != wxID_OK )
|
||||||
|
return; // cancelled by user
|
||||||
|
|
||||||
Field->m_AddExtraText = flag;
|
Field->m_AddExtraText = flag;
|
||||||
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
|
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
|
||||||
|
@ -295,7 +301,11 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC
|
||||||
flag = 1;
|
flag = 1;
|
||||||
|
|
||||||
wxString ref = Cmp->GetRef( GetSheet() );
|
wxString ref = Cmp->GetRef( GetSheet() );
|
||||||
Get_Message( _( "Reference" ), _( "Component reference" ), ref, this );
|
wxTextEntryDialog dlg( this, _( "Reference" ), _( "Component reference" ), ref );
|
||||||
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
|
return; // cancelled by user
|
||||||
|
|
||||||
|
ref = dlg.GetValue( );
|
||||||
|
|
||||||
if( !ref.IsEmpty() ) // New text entered
|
if( !ref.IsEmpty() ) // New text entered
|
||||||
{
|
{
|
||||||
|
@ -335,8 +345,12 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
|
||||||
SCH_FIELD* TextField = Cmp->GetField( VALUE );
|
SCH_FIELD* TextField = Cmp->GetField( VALUE );
|
||||||
|
|
||||||
message = TextField->m_Text;
|
message = TextField->m_Text;
|
||||||
if( Get_Message( _( "Value" ), _( "Component value" ), message, this ) )
|
|
||||||
message.Empty(); //allow the user to remove the value.
|
wxTextEntryDialog dlg( this, _( "Value" ), _( "Component value" ), message );
|
||||||
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
|
return; // cancelled by user
|
||||||
|
|
||||||
|
message = dlg.GetValue( );
|
||||||
|
|
||||||
if( !message.IsEmpty() )
|
if( !message.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -371,8 +385,11 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
|
||||||
SCH_FIELD* TextField = Cmp->GetField( FOOTPRINT );
|
SCH_FIELD* TextField = Cmp->GetField( FOOTPRINT );
|
||||||
message = TextField->m_Text;
|
message = TextField->m_Text;
|
||||||
|
|
||||||
if( Get_Message( _( "Footprint" ), _( "Component footprint" ), message, this ) )
|
wxTextEntryDialog dlg( this, _( "Footprint" ), _( "Component footprint" ), message );
|
||||||
return; // edition cancelled by user.
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
|
return; // cancelled by user
|
||||||
|
|
||||||
|
message = dlg.GetValue( );
|
||||||
|
|
||||||
bool wasEmpty = false;
|
bool wasEmpty = false;
|
||||||
if( TextField->m_Text.IsEmpty() )
|
if( TextField->m_Text.IsEmpty() )
|
||||||
|
|
|
@ -211,8 +211,18 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
DrawPanel->DrawBackGround( DC );
|
DrawPanel->DrawBackGround( DC );
|
||||||
|
|
||||||
if( m_component )
|
if( m_component )
|
||||||
|
{
|
||||||
|
// display reference like in schematic (a reference U is shown U? or U?A)
|
||||||
|
// although it is stored without ? and part id.
|
||||||
|
// So temporary change the reference by a schematic like reference
|
||||||
|
LIB_FIELD* Field = m_component->GetField( REFERENCE );
|
||||||
|
wxString fieldText = Field->m_Text;
|
||||||
|
wxString fieldfullText = Field->GetFullText( m_unit );
|
||||||
|
Field->m_Text = fieldfullText;
|
||||||
m_component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit,
|
m_component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit,
|
||||||
m_convert, GR_DEFAULT_DRAWMODE );
|
m_convert, GR_DEFAULT_DRAWMODE );
|
||||||
|
Field->m_Text = fieldText;
|
||||||
|
}
|
||||||
|
|
||||||
GetScreen()->ClrRefreshReq();
|
GetScreen()->ClrRefreshReq();
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ static void AbortMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
Panel->ManageCurseur = NULL;
|
Panel->ManageCurseur = NULL;
|
||||||
Panel->ForceCloseManageCurseur = NULL;
|
Panel->ForceCloseManageCurseur = NULL;
|
||||||
|
|
||||||
WinEDA_LibeditFrame* parent = ( WinEDA_LibeditFrame* ) Panel->GetParent();
|
WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) Panel->GetParent();
|
||||||
|
|
||||||
if( parent == NULL )
|
if( parent == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -37,7 +37,7 @@ static void AbortMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
if( item == NULL )
|
if( item == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxPoint curpos = Panel->GetScreen()->m_Curseur;
|
wxPoint curpos = Panel->GetScreen()->m_Curseur;
|
||||||
|
|
||||||
Panel->GetScreen()->m_Curseur = s_InitialPosition;
|
Panel->GetScreen()->m_Curseur = s_InitialPosition;
|
||||||
ShowMoveField( Panel, DC, true );
|
ShowMoveField( Panel, DC, true );
|
||||||
|
@ -54,9 +54,9 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field )
|
||||||
if( ( m_component == NULL ) || ( field == NULL ) )
|
if( ( m_component == NULL ) || ( field == NULL ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_drawItem = field;
|
m_drawItem = field;
|
||||||
s_InitialPosition = field->m_Pos;
|
s_InitialPosition = field->m_Pos;
|
||||||
NEGATE(s_InitialPosition.y);
|
NEGATE( s_InitialPosition.y );
|
||||||
m_drawItem->m_Flags |= IS_MOVED;
|
m_drawItem->m_Flags |= IS_MOVED;
|
||||||
|
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( DC );
|
||||||
|
@ -90,7 +90,7 @@ static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString text = Field->GetFullText( parent->GetUnit() );
|
wxString text = Field->GetFullText( parent->GetUnit() );
|
||||||
wxPoint offset ;
|
wxPoint offset;
|
||||||
offset.x = s_LastPosition.x - Field->m_Pos.x;
|
offset.x = s_LastPosition.x - Field->m_Pos.x;
|
||||||
offset.y = s_LastPosition.y + Field->m_Pos.y;
|
offset.y = s_LastPosition.y + Field->m_Pos.y;
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LIB_FIELD* Field )
|
||||||
&fieldText, DefaultTransformMatrix );
|
&fieldText, DefaultTransformMatrix );
|
||||||
|
|
||||||
DrawPanel->CursorOn( DC );
|
DrawPanel->CursorOn( DC );
|
||||||
OnModify( );
|
OnModify();
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
m_drawItem = NULL;
|
m_drawItem = NULL;
|
||||||
|
@ -132,8 +132,9 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LIB_FIELD* Field )
|
||||||
|
|
||||||
void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field )
|
void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field )
|
||||||
{
|
{
|
||||||
wxString Text;
|
wxString Text;
|
||||||
wxString title;
|
wxString title;
|
||||||
|
bool save = true;
|
||||||
|
|
||||||
if( Field == NULL )
|
if( Field == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -141,11 +142,11 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field )
|
||||||
switch( Field->m_FieldId )
|
switch( Field->m_FieldId )
|
||||||
{
|
{
|
||||||
case REFERENCE:
|
case REFERENCE:
|
||||||
title = wxT( "Reference:" );
|
title = _( "Reference:" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VALUE:
|
case VALUE:
|
||||||
title = wxT( "Component Name / Value:" );
|
title = _( "Component Name / Value:" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -154,10 +155,25 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field )
|
||||||
|
|
||||||
Text = Field->m_Text;
|
Text = Field->m_Text;
|
||||||
|
|
||||||
/* FIXME: Use wxTextEntry dialog here and check for cancel button. */
|
{
|
||||||
Get_Message( title, _( "Edit field" ), Text, this );
|
wxTextEntryDialog dlg( this, title, _( "Edit field" ), Text );
|
||||||
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
|
return; // cancelled by user
|
||||||
|
Text = dlg.GetValue( );
|
||||||
|
}
|
||||||
|
|
||||||
Text.Replace( wxT( " " ), wxT( "_" ) );
|
Text.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
|
|
||||||
|
if( Field->m_FieldId == REFERENCE || Field->m_FieldId == VALUE )
|
||||||
|
{
|
||||||
|
if( Text.IsEmpty ( ) )
|
||||||
|
{
|
||||||
|
DisplayError( this, _( "Value or Reference cannot be void. Aborted" ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString fieldText = Field->GetFullText( m_unit );
|
wxString fieldText = Field->GetFullText( m_unit );
|
||||||
|
|
||||||
/* If the value field is changed, this is equivalent to creating a new
|
/* If the value field is changed, this is equivalent to creating a new
|
||||||
|
@ -172,11 +188,12 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field )
|
||||||
/* Test for an existing name in the current components alias list. */
|
/* Test for an existing name in the current components alias list. */
|
||||||
if( Field->GetParent()->m_AliasList.Index( Text, false ) != wxNOT_FOUND )
|
if( Field->GetParent()->m_AliasList.Index( Text, false ) != wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "The field name <%s> is an existing alias of the \
|
msg.Printf( _(
|
||||||
|
"The field name <%s> is an existing alias of the \
|
||||||
component <%s>.\nPlease choose another name that does not conflict with any \
|
component <%s>.\nPlease choose another name that does not conflict with any \
|
||||||
names in the alias list." ),
|
names in the alias list." ),
|
||||||
GetChars( Text ),
|
GetChars( Text ),
|
||||||
GetChars( Field->GetParent()->GetName() ) );
|
GetChars( Field->GetParent()->GetName() ) );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -186,15 +203,18 @@ names in the alias list." ),
|
||||||
*/
|
*/
|
||||||
if( m_library && m_library->FindEntry( Text ) != NULL )
|
if( m_library && m_library->FindEntry( Text ) != NULL )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "The field name <%s> conflicts with an existing \
|
msg.Printf( _(
|
||||||
|
"The field name <%s> conflicts with an existing \
|
||||||
entry in the component library <%s>.\nPlease choose another name that does \
|
entry in the component library <%s>.\nPlease choose another name that does \
|
||||||
not conflict with any library entries." ),
|
not conflict with any library entries." ),
|
||||||
GetChars( Text ),
|
GetChars( Text ),
|
||||||
GetChars( m_library->GetName() ) );
|
GetChars( m_library->GetName() ) );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SaveCopyInUndoList( Field->GetParent() );
|
||||||
|
save = false;
|
||||||
Field->GetParent()->SetName( Text );
|
Field->GetParent()->SetName( Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +223,8 @@ not conflict with any library entries." ),
|
||||||
|
|
||||||
if( !Text.IsEmpty() )
|
if( !Text.IsEmpty() )
|
||||||
{
|
{
|
||||||
SaveCopyInUndoList( Field->GetParent() );
|
if( save )
|
||||||
|
SaveCopyInUndoList( Field->GetParent() );
|
||||||
Field->m_Text = Text;
|
Field->m_Text = Text;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -220,7 +241,7 @@ not conflict with any library entries." ),
|
||||||
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, drawMode, &fieldText,
|
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, drawMode, &fieldText,
|
||||||
DefaultTransformMatrix );
|
DefaultTransformMatrix );
|
||||||
|
|
||||||
OnModify( );
|
OnModify();
|
||||||
UpdateAliasSelectList();
|
UpdateAliasSelectList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,11 +254,10 @@ not conflict with any library entries." ),
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::RotateField( wxDC* DC, LIB_FIELD* Field )
|
void WinEDA_LibeditFrame::RotateField( wxDC* DC, LIB_FIELD* Field )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( Field == NULL )
|
if( Field == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
OnModify( );
|
OnModify();
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( DC );
|
||||||
GRSetDrawMode( DC, g_XorMode );
|
GRSetDrawMode( DC, g_XorMode );
|
||||||
|
|
||||||
|
@ -247,9 +267,9 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LIB_FIELD* Field )
|
||||||
ShowMoveField( DrawPanel, DC, false );
|
ShowMoveField( DrawPanel, DC, false );
|
||||||
else
|
else
|
||||||
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText,
|
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText,
|
||||||
DefaultTransformMatrix );
|
DefaultTransformMatrix );
|
||||||
|
|
||||||
if( Field->m_Orient == TEXT_ORIENT_VERT)
|
if( Field->m_Orient == TEXT_ORIENT_VERT )
|
||||||
Field->m_Orient = TEXT_ORIENT_HORIZ;
|
Field->m_Orient = TEXT_ORIENT_HORIZ;
|
||||||
else
|
else
|
||||||
Field->m_Orient = TEXT_ORIENT_VERT;
|
Field->m_Orient = TEXT_ORIENT_VERT;
|
||||||
|
@ -263,7 +283,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LIB_FIELD* Field )
|
||||||
ShowMoveField( DrawPanel, DC, false );
|
ShowMoveField( DrawPanel, DC, false );
|
||||||
else
|
else
|
||||||
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, drawMode, &fieldText,
|
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, drawMode, &fieldText,
|
||||||
DefaultTransformMatrix );
|
DefaultTransformMatrix );
|
||||||
|
|
||||||
DrawPanel->CursorOn( DC );
|
DrawPanel->CursorOn( DC );
|
||||||
}
|
}
|
||||||
|
|
|
@ -853,8 +853,13 @@ void TREE_PROJECT_FRAME::OnRenameFile( wxCommandEvent& )
|
||||||
wxString buffer = m_TreeProject->GetItemText( curr_item );
|
wxString buffer = m_TreeProject->GetItemText( curr_item );
|
||||||
wxString msg = _( "Change filename: " ) + tree_data->m_FileName;
|
wxString msg = _( "Change filename: " ) + tree_data->m_FileName;
|
||||||
|
|
||||||
if( Get_Message( msg, _( "Change filename" ), buffer, this ) != 0 )
|
wxTextEntryDialog dlg( this, msg, _( "Change filename" ), buffer );
|
||||||
return; //Abort command
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
|
return; // cancelled by user
|
||||||
|
|
||||||
|
buffer = dlg.GetValue( );
|
||||||
|
if( buffer.IsEmpty() )
|
||||||
|
return; // empty file name not allowed
|
||||||
|
|
||||||
if( tree_data->Rename( buffer, true ) )
|
if( tree_data->Rename( buffer, true ) )
|
||||||
m_TreeProject->SetItemText( curr_item, buffer );
|
m_TreeProject->SetItemText( curr_item, buffer );
|
||||||
|
|
|
@ -128,7 +128,9 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
|
||||||
netclass = net->GetNetClass();
|
netclass = net->GetNetClass();
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
if( netclass == NULL )
|
if( netclass == NULL )
|
||||||
|
{
|
||||||
wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetNetClass(): NULL netclass") );
|
wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetNetClass(): NULL netclass") );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ MODULE::MODULE( BOARD* parent ) :
|
||||||
m_CntRot90 = m_CntRot180 = 0;
|
m_CntRot90 = m_CntRot180 = 0;
|
||||||
m_Surface = 0.0;
|
m_Surface = 0.0;
|
||||||
m_Link = 0;
|
m_Link = 0;
|
||||||
m_LastEdit_Time = time( NULL );
|
m_LastEdit_Time = time( NULL );
|
||||||
m_LocalClearance = 0;
|
m_LocalClearance = 0;
|
||||||
m_LocalSolderMaskMargin = 0;
|
m_LocalSolderMaskMargin = 0;
|
||||||
m_LocalSolderPasteMargin = 0;
|
m_LocalSolderPasteMargin = 0;
|
||||||
|
@ -59,6 +59,7 @@ MODULE::~MODULE()
|
||||||
delete m_Value;
|
delete m_Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Draw the anchor cross (vertical)
|
/* Draw the anchor cross (vertical)
|
||||||
* Must be done after the pads, because drawing the hole will erase overwrite
|
* Must be done after the pads, because drawing the hole will erase overwrite
|
||||||
* every thing already drawn.
|
* every thing already drawn.
|
||||||
|
@ -76,7 +77,7 @@ void MODULE::DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset
|
||||||
|
|
||||||
if( GetBoard()->IsElementVisible( ANCHOR_VISIBLE ) )
|
if( GetBoard()->IsElementVisible( ANCHOR_VISIBLE ) )
|
||||||
{
|
{
|
||||||
int color = g_ColorsSettings.GetItemColor(ANCHOR_VISIBLE);
|
int color = g_ColorsSettings.GetItemColor( ANCHOR_VISIBLE );
|
||||||
GRLine( &panel->m_ClipBox, DC,
|
GRLine( &panel->m_ClipBox, DC,
|
||||||
m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y,
|
m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y,
|
||||||
m_Pos.x - offset.x + anchor_size, m_Pos.y - offset.y,
|
m_Pos.x - offset.x + anchor_size, m_Pos.y - offset.y,
|
||||||
|
@ -158,9 +159,9 @@ void MODULE::Copy( MODULE* aModule )
|
||||||
if( item->m_Shape3DName.IsEmpty() ) // do not copy empty shapes.
|
if( item->m_Shape3DName.IsEmpty() ) // do not copy empty shapes.
|
||||||
continue;
|
continue;
|
||||||
S3D_MASTER* t3d = m_3D_Drawings;
|
S3D_MASTER* t3d = m_3D_Drawings;
|
||||||
if( t3d && t3d->m_Shape3DName.IsEmpty() ) // The first entry can
|
if( t3d && t3d->m_Shape3DName.IsEmpty() ) // The first entry can
|
||||||
// exist, but is empty :
|
// exist, but is empty :
|
||||||
// use it.
|
// use it.
|
||||||
t3d->Copy( item );
|
t3d->Copy( item );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -196,7 +197,7 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
pad->Draw( panel, DC, draw_mode, offset );
|
pad->Draw( panel, DC, draw_mode, offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
BOARD * brd = GetBoard();
|
BOARD* brd = GetBoard();
|
||||||
|
|
||||||
// Draws footprint anchor
|
// Draws footprint anchor
|
||||||
DrawAncre( panel, DC, offset, DIM_ANCRE_MODULE, draw_mode );
|
DrawAncre( panel, DC, offset, DIM_ANCRE_MODULE, draw_mode );
|
||||||
|
@ -302,13 +303,13 @@ bool MODULE::Save( FILE* aFile ) const
|
||||||
fprintf( aFile, "AR %s\n", CONV_TO_UTF8( m_Path ) );
|
fprintf( aFile, "AR %s\n", CONV_TO_UTF8( m_Path ) );
|
||||||
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
|
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
|
||||||
if( m_LocalSolderMaskMargin != 0 )
|
if( m_LocalSolderMaskMargin != 0 )
|
||||||
fprintf( aFile, ".SolderMask %d\n",m_LocalSolderMaskMargin );
|
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
|
||||||
if( m_LocalSolderPasteMargin != 0 )
|
if( m_LocalSolderPasteMargin != 0 )
|
||||||
fprintf( aFile, ".SolderPaste %d\n",m_LocalSolderPasteMargin);
|
fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
|
||||||
if( m_LocalSolderPasteMarginRatio != 0)
|
if( m_LocalSolderPasteMarginRatio != 0 )
|
||||||
fprintf( aFile, ".SolderPasteRatio %g\n",m_LocalSolderPasteMarginRatio);
|
fprintf( aFile, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
|
||||||
if( m_LocalClearance != 0 )
|
if( m_LocalClearance != 0 )
|
||||||
fprintf( aFile, ".LocalClearance %d\n",m_LocalClearance );
|
fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance );
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
if( m_Attributs != MOD_DEFAULT )
|
if( m_Attributs != MOD_DEFAULT )
|
||||||
|
@ -489,7 +490,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
|
||||||
{
|
{
|
||||||
D_PAD* pad = new D_PAD( this );
|
D_PAD* pad = new D_PAD( this );
|
||||||
pad->ReadDescr( File, LineNum );
|
pad->ReadDescr( File, LineNum );
|
||||||
RotatePoint( &pad->m_Pos.x, &pad->m_Pos.y, m_Orient );
|
RotatePoint( &pad->m_Pos, m_Orient );
|
||||||
pad->m_Pos.x += m_Pos.x;
|
pad->m_Pos.x += m_Pos.x;
|
||||||
pad->m_Pos.y += m_Pos.y;
|
pad->m_Pos.y += m_Pos.y;
|
||||||
|
|
||||||
|
@ -507,7 +508,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
|
||||||
|
|
||||||
/* Decode the first code of the current line and read the
|
/* Decode the first code of the current line and read the
|
||||||
* corresponding data
|
* corresponding data
|
||||||
*/
|
*/
|
||||||
switch( Line[0] )
|
switch( Line[0] )
|
||||||
{
|
{
|
||||||
case 'P':
|
case 'P':
|
||||||
|
@ -602,20 +603,21 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '.': /* Read specific data */
|
case '.': /* Read specific data */
|
||||||
if( strnicmp(Line, ".SolderMask ", 12 ) == 0 )
|
if( strnicmp( Line, ".SolderMask ", 12 ) == 0 )
|
||||||
m_LocalSolderMaskMargin = atoi(Line+12);
|
m_LocalSolderMaskMargin = atoi( Line + 12 );
|
||||||
else if( strnicmp(Line, ".SolderPaste ", 13) == 0 )
|
else if( strnicmp( Line, ".SolderPaste ", 13 ) == 0 )
|
||||||
m_LocalSolderPasteMargin = atoi(Line+13);
|
m_LocalSolderPasteMargin = atoi( Line + 13 );
|
||||||
else if( strnicmp(Line, ".SolderPasteRatio ", 18) == 0 )
|
else if( strnicmp( Line, ".SolderPasteRatio ", 18 ) == 0 )
|
||||||
m_LocalSolderPasteMarginRatio = atof(Line+18);
|
m_LocalSolderPasteMarginRatio = atof( Line + 18 );
|
||||||
else if( strnicmp(Line, ".LocalClearance ", 16 ) == 0 )
|
else if( strnicmp( Line, ".LocalClearance ", 16 ) == 0 )
|
||||||
m_LocalClearance = atoi(Line+16);
|
m_LocalClearance = atoi( Line + 16 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recalculate the bounding box */
|
/* Recalculate the bounding box */
|
||||||
Set_Rectangle_Encadrement();
|
Set_Rectangle_Encadrement();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -640,51 +642,53 @@ void MODULE::Set_Rectangle_Encadrement()
|
||||||
xmin = ymin = -250;
|
xmin = ymin = -250;
|
||||||
xmax = ymax = 250;
|
xmax = ymax = 250;
|
||||||
|
|
||||||
for( EDGE_MODULE* pt_edge_mod = (EDGE_MODULE*) m_Drawings.GetFirst();
|
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst();
|
||||||
pt_edge_mod; pt_edge_mod = pt_edge_mod->Next() )
|
edge; edge = edge->Next() )
|
||||||
{
|
{
|
||||||
if( pt_edge_mod->Type() != TYPE_EDGE_MODULE )
|
if( edge->Type() != TYPE_EDGE_MODULE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
width = pt_edge_mod->m_Width / 2;
|
width = edge->m_Width / 2;
|
||||||
|
|
||||||
switch( pt_edge_mod->m_Shape )
|
switch( edge->m_Shape )
|
||||||
{
|
{
|
||||||
case S_ARC:
|
case S_ARC:
|
||||||
case S_CIRCLE:
|
case S_CIRCLE:
|
||||||
{
|
{
|
||||||
cx = pt_edge_mod->m_Start0.x;
|
cx = edge->m_Start0.x;
|
||||||
cy = pt_edge_mod->m_Start0.y; // center
|
cy = edge->m_Start0.y; // center
|
||||||
uxf = pt_edge_mod->m_End0.x; uyf = pt_edge_mod->m_End0.y;
|
uxf = edge->m_End0.x;
|
||||||
rayon = (int) hypot( (double) (cx - uxf), (double) (cy - uyf) );
|
uyf = edge->m_End0.y;
|
||||||
|
rayon = (int) hypot( (double) ( cx - uxf ), (double) ( cy - uyf ) );
|
||||||
rayon += width;
|
rayon += width;
|
||||||
xmin = MIN( xmin, cx - rayon );
|
xmin = MIN( xmin, cx - rayon );
|
||||||
ymin = MIN( ymin, cy - rayon );
|
ymin = MIN( ymin, cy - rayon );
|
||||||
xmax = MAX( xmax, cx + rayon );
|
xmax = MAX( xmax, cx + rayon );
|
||||||
ymax = MAX( ymax, cy + rayon );
|
ymax = MAX( ymax, cy + rayon );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case S_SEGMENT:
|
case S_SEGMENT:
|
||||||
xmin = MIN( xmin, pt_edge_mod->m_Start0.x - width );
|
xmin = MIN( xmin, edge->m_Start0.x - width );
|
||||||
xmin = MIN( xmin, pt_edge_mod->m_End0.x - width );
|
xmin = MIN( xmin, edge->m_End0.x - width );
|
||||||
ymin = MIN( ymin, pt_edge_mod->m_Start0.y - width );
|
ymin = MIN( ymin, edge->m_Start0.y - width );
|
||||||
ymin = MIN( ymin, pt_edge_mod->m_End0.y - width );
|
ymin = MIN( ymin, edge->m_End0.y - width );
|
||||||
xmax = MAX( xmax, pt_edge_mod->m_Start0.x + width );
|
xmax = MAX( xmax, edge->m_Start0.x + width );
|
||||||
xmax = MAX( xmax, pt_edge_mod->m_End0.x + width );
|
xmax = MAX( xmax, edge->m_End0.x + width );
|
||||||
ymax = MAX( ymax, pt_edge_mod->m_Start0.y + width );
|
ymax = MAX( ymax, edge->m_Start0.y + width );
|
||||||
ymax = MAX( ymax, pt_edge_mod->m_End0.y + width );
|
ymax = MAX( ymax, edge->m_End0.y + width );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_POLYGON:
|
case S_POLYGON:
|
||||||
for( unsigned ii = 0; ii < pt_edge_mod->m_PolyPoints.size(); ii++ )
|
for( unsigned ii = 0; ii < edge->m_PolyPoints.size(); ii++ )
|
||||||
{
|
{
|
||||||
wxPoint pt = pt_edge_mod->m_PolyPoints[ii];
|
wxPoint pt = edge->m_PolyPoints[ii];
|
||||||
xmin = MIN( xmin, (pt.x - width) );
|
xmin = MIN( xmin, (pt.x - width) );
|
||||||
ymin = MIN( ymin, (pt.y - width) );
|
ymin = MIN( ymin, (pt.y - width) );
|
||||||
xmax = MAX( xmax, (pt.x + width) );
|
xmax = MAX( xmax, (pt.x + width) );
|
||||||
ymax = MAX( ymax, (pt.y + width) );
|
ymax = MAX( ymax, (pt.y + width) );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -696,10 +700,10 @@ void MODULE::Set_Rectangle_Encadrement()
|
||||||
rayon = pad->m_Rayon;
|
rayon = pad->m_Rayon;
|
||||||
cx = pad->m_Pos0.x;
|
cx = pad->m_Pos0.x;
|
||||||
cy = pad->m_Pos0.y;
|
cy = pad->m_Pos0.y;
|
||||||
xmin = MIN( xmin, cx - rayon );
|
xmin = MIN( xmin, cx - rayon );
|
||||||
ymin = MIN( ymin, cy - rayon );
|
ymin = MIN( ymin, cy - rayon );
|
||||||
xmax = MAX( xmax, cx + rayon );
|
xmax = MAX( xmax, cx + rayon );
|
||||||
ymax = MAX( ymax, cy + rayon );
|
ymax = MAX( ymax, cy + rayon );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_BoundaryBox.m_Pos.x = xmin;
|
m_BoundaryBox.m_Pos.x = xmin;
|
||||||
|
@ -721,24 +725,24 @@ void MODULE::SetRectangleExinscrit()
|
||||||
m_RealBoundaryBox.Inflate( 500 ); // Give a min size
|
m_RealBoundaryBox.Inflate( 500 ); // Give a min size
|
||||||
|
|
||||||
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst();
|
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst();
|
||||||
edge; edge = edge->Next() )
|
edge; edge = edge->Next() )
|
||||||
{
|
{
|
||||||
if( edge->Type() != TYPE_EDGE_MODULE ) // Shoud not occur
|
if( edge->Type() != TYPE_EDGE_MODULE ) // Shoud not occur
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
EDA_Rect rect = edge->GetBoundingBox();
|
EDA_Rect rect = edge->GetBoundingBox();
|
||||||
m_RealBoundaryBox.Merge(rect);
|
m_RealBoundaryBox.Merge( rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
EDA_Rect rect = pad->GetBoundingBox();
|
EDA_Rect rect = pad->GetBoundingBox();
|
||||||
m_RealBoundaryBox.Merge(rect);
|
m_RealBoundaryBox.Merge( rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Surface = ABS( (double) m_RealBoundaryBox.GetWidth()
|
m_Surface = ABS( (double) m_RealBoundaryBox.GetWidth()
|
||||||
* m_RealBoundaryBox.GetHeight() );
|
* m_RealBoundaryBox.GetHeight() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -762,7 +766,7 @@ EDA_Rect MODULE::GetBoundingBox()
|
||||||
area.Merge( text_area );
|
area.Merge( text_area );
|
||||||
|
|
||||||
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge;
|
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge;
|
||||||
edge = edge->Next() )
|
edge = edge->Next() )
|
||||||
{
|
{
|
||||||
if( edge->Type() != TYPE_TEXTE_MODULE )
|
if( edge->Type() != TYPE_TEXTE_MODULE )
|
||||||
continue;
|
continue;
|
||||||
|
@ -914,6 +918,7 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return pad;
|
return pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -656,11 +656,13 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString class_name;
|
wxString class_name;
|
||||||
|
|
||||||
if( Get_Message( _( "New Net Class Name:" ),
|
wxTextEntryDialog dlg( this, _( "New Net Class Name:" ), wxEmptyString, class_name );
|
||||||
wxEmptyString,
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
class_name,
|
return; // cancelled by user
|
||||||
this ) )
|
|
||||||
return;
|
class_name = dlg.GetValue( );
|
||||||
|
if( class_name.IsEmpty() )
|
||||||
|
return; // empty name not allowed
|
||||||
|
|
||||||
// The name must dot exists:
|
// The name must dot exists:
|
||||||
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
|
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
|
||||||
|
|
|
@ -30,8 +30,11 @@ void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
|
||||||
int selection;
|
int selection;
|
||||||
|
|
||||||
netFilter = wxT( "*" );
|
netFilter = wxT( "*" );
|
||||||
Get_Message( _( "Filter for net names:" ), _( "Net Filter" ),
|
wxTextEntryDialog dlg( this, _( "Filter for net names:" ), _( "Net Filter" ), netFilter );
|
||||||
netFilter, this );
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
|
return; // cancelled by user
|
||||||
|
|
||||||
|
netFilter = dlg.GetValue( );
|
||||||
if( netFilter.IsEmpty() )
|
if( netFilter.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue