Commit 89535a13 authored by charras's avatar charras

some enhancements and cleanup. Fixed problem when deleting Netclasses in Design rules dialog window

parent ae12e698
......@@ -150,8 +150,9 @@ public:
* of "selecting" an item more formal, and to indivisibly tie the operation
* of selecting an item to displaying it using BOARD_ITEM::Display_Infos().
* @param aItem The BOARD_ITEM to make the selected item or NULL if none.
* @param aDisplayInfo = true to display item info, false if not (default = true)
*/
void SetCurItem( BOARD_ITEM* aItem );
void SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo = true );
BOARD_ITEM* GetCurItem();
/**
......
......@@ -126,7 +126,6 @@ set(PCBNEW_SRCS
plot_rtn.cpp
queue.cpp
ratsnest.cpp
router.cpp
set_color.cpp
set_grid.cpp
solve.cpp
......
......@@ -245,13 +245,14 @@ void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event )
/*****************************************************************/
void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem )
void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo )
/*****************************************************************/
{
GetScreen()->SetCurItem( aItem );
if( aItem )
{
if( aDisplayInfo )
aItem->DisplayInfo( this );
#if 0 && defined(DEBUG)
......
......@@ -133,7 +133,7 @@ int TRACK::GetDrillValue() const
double TRACK::GetLength()
{
wxPoint delta = m_End - m_Start;
return sqrt( (double)delta.x*delta.x + (double)delta.y*delta.y );
return sqrt( ((double)delta.x*delta.x) + ((double)delta.y*delta.y ) );
}
/***********************/
......@@ -906,6 +906,31 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
wxString msg;
BOARD* board = ( (WinEDA_BasePcbFrame*) frame )->GetBoard();
// Display basic infos
DisplayInfoBase( frame );
// Display full track length (in pcbnew)
if( frame->m_Ident == PCB_FRAME )
{
int trackLen = 0;
Marque_Une_Piste( board, this, NULL, &trackLen, false );
valeur_param( trackLen, msg );
frame->MsgPanel->AppendMessage( _( "Track Len" ), msg, DARKCYAN );
}
}
/*
* Function DisplayInfoBase
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Display info about the track segment only, and does not calculate the full track length
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
{
wxString msg;
BOARD* board = ( (WinEDA_BasePcbFrame*) frame )->GetBoard();
frame->MsgPanel->EraseMsgBox();
switch( Type() )
......@@ -1018,15 +1043,6 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
valeur_param( wxRound( GetLength() ), msg );
frame->MsgPanel->AppendMessage( _( "Seg Len" ), msg, DARKCYAN );
}
// Display full track length (in pcbnew)
if( frame->m_Ident == PCB_FRAME )
{
int trackLen;
Marque_Une_Piste( board, this, NULL, &trackLen, false );
valeur_param( trackLen, msg );
frame->MsgPanel->AppendMessage( _( "Track Len" ), msg, DARKCYAN );
}
}
......
......@@ -201,10 +201,19 @@ public:
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* Display info about the track segment and the full track length
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void DisplayInfo( WinEDA_DrawFrame* frame );
/**
* Function DisplayInfoBase
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Display info about the track segment only, and does not calculate the full track length
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void DisplayInfoBase( WinEDA_DrawFrame* frame );
/**
* Function ShowWidth
......
......@@ -57,9 +57,9 @@ void RemoteCommand( const char* cmdline )
module = frame->GetBoard()->FindModuleByReference( modName );
if( module )
msg.Printf( _( "%s found" ), modName.GetData() );
msg.Printf( _( "%s found" ), GetChars( modName ) );
else
msg.Printf( _( "%s not found" ), modName.GetData() );
msg.Printf( _( "%s not found" ), GetChars( modName ) );
frame->Affiche_Message( msg );
if( module )
......@@ -103,17 +103,17 @@ void RemoteCommand( const char* cmdline )
}
if( module == NULL )
msg.Printf( _( "%s not found" ), modName.GetData() );
msg.Printf( _( "%s not found" ), GetChars( modName ) );
else if( pad == NULL )
{
msg.Printf( _( "%s pin %s not found" ),
modName.GetData(), pinName.GetData() );
GetChars( modName ), GetChars( pinName ) );
frame->SetCurItem( module );
}
else
{
msg.Printf( _( "%s pin %s found" ),
modName.GetData(), pinName.GetData() );
GetChars( modName ), GetChars( pinName ) );
frame->SetCurItem( pad );
}
......
......@@ -205,7 +205,7 @@ bool DIALOG_COPPER_LAYERS_SETUP::TestDataValidity()
wxString text;
text.Printf( _(
"<small>This layer name <b>%s</b> is already existing<br>" ),
value.GetData() );
GetChars( value ) );
m_MessagesList->AppendToPage( text );
success = false;
}
......
......@@ -119,9 +119,9 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings( )
}
/**************************************/
/******************************************/
void DIALOG_DESIGN_RULES::InitDialogRules()
/**************************************/
/******************************************/
{
SetFocus();
SetReturnCode( 0 );
......@@ -470,28 +470,51 @@ void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
InitializeRulesSelectionBoxes();
}
// Sort function for wxArrayInt. Itelms (ints) are sorted by decreasing value
// used in DIALOG_DESIGN_RULES::OnRemoveNetclassClick
int sort_int(int *first, int *second)
{
return * second - *first;
}
/**************************************************************************/
void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event )
/**************************************************************************/
{
wxArrayInt select = m_grid->GetSelectedRows();
for( int ii = select.GetCount() - 1; ii >= 0; ii-- )
// Sort selection by decreasing index order:
select.Sort(sort_int);
bool reinit = false;
// rows labels seem have problems when deleting rows: they are not deleted properly.
// Workaround: store them, delete rows and reinit row labels (wxWidgets <= 2.9 )
wxArrayString labels;
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
labels.Add(m_grid->GetRowLabelValue(ii));
// Delete rows from last to first (this is the order wxArrayInt select after sorting) )
// This order is Ok when removing rows
for( unsigned ii = 0; ii < select.GetCount(); ii++ )
{
int grid_row = select[ii];
if( grid_row != 0 ) // Do not remove the default class
{
wxString classname = m_grid->GetRowLabelValue( grid_row );
m_grid->DeleteRows( grid_row );
labels.RemoveAt(grid_row);
reinit = true;
// reset the net class to default for members of the removed class
swapNetClass( classname, NETCLASS::Default );
}
else
wxMessageBox(_("The defaut Netclass cannot be removed") );
}
if( reinit )
{
// Workaround: reinit labels (wxWidgets <= 2.9 )
for( unsigned ii = 1; ii < labels.GetCount(); ii++ )
m_grid->SetRowLabelValue(ii, labels[ii]);
InitializeRulesSelectionBoxes();
}
}
/*
......
......@@ -84,8 +84,8 @@ void DialogEditModuleText::Init( )
{
wxString format = m_ModuleInfoText->GetLabel();
msg.Printf( format,
m_Module->m_Reference->m_Text.GetData(),
m_Module->m_Value->m_Text.GetData(),
GetChars( m_Module->m_Reference->m_Text ),
GetChars( m_Module->m_Value->m_Text ),
(float) m_Module->m_Orient / 10 );
}
......
......@@ -598,7 +598,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
// If the current Item is a pad, text module ...: Get the parent
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
......@@ -622,7 +622,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DELETE_MODULE:
DrawPanel->MouseToCursorSchema();
// If the current Item is a pad, text module ...: Get the parent
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
......@@ -637,7 +637,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
DrawPanel->MouseToCursorSchema();
// If the current Item is a pad, text module ...: Get the parent
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
......@@ -652,7 +652,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
DrawPanel->MouseToCursorSchema();
// If the current Item is a pad, text module ...: Get the parent
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
......@@ -666,7 +666,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
DrawPanel->MouseToCursorSchema();
// If the current Item is a pad, text module ...: Get the parent
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
......@@ -680,7 +680,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_MODULE:
// If the current Item is a pad, text module ...: Get the parent
// If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE )
SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
......@@ -941,14 +941,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
Swap_Layers( event );
break;
case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER:
GlobalRoute( &dc );
break;
case ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA:
ReadAutoroutedTracks( &dc );
break;
case ID_PCB_USER_GRID_SETUP:
InstallGridFrame( pos );
break;
......
......@@ -55,7 +55,7 @@ static void Exit_Editrack( WinEDA_DrawPanel* Panel, wxDC* DC )
frame->MsgPanel->EraseMsgBox();
// Undo pending changes (mainly a lock point cretion) and clear the undo picker list:
frame->PutDataInPreviousState(&s_ItemsListPicker, false, false);
frame->PutDataInPreviousState( &s_ItemsListPicker, false, false );
s_ItemsListPicker.ClearListAndDeleteItems();
// Delete current (new) track
......@@ -135,7 +135,8 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
else // no starting point, but a filled zone area can exist. This is also a good starting point.
{
ZONE_CONTAINER* zone = GetBoard()->HitTestForAnyFilledArea( pos,
GetScreen()->m_Active_Layer );
GetScreen()->
m_Active_Layer );
if( zone )
g_HightLigth_NetCode = zone->GetNet();
}
......@@ -188,8 +189,8 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
D( g_CurrentTrackList.VerifyListIntegrity(); );
g_CurrentTrackSegment->DisplayInfo( this );
SetCurItem( g_CurrentTrackSegment );
g_CurrentTrackSegment->DisplayInfoBase( this );
SetCurItem( g_CurrentTrackSegment, false );
DrawPanel->ManageCurseur( DrawPanel, DC, false );
if( Drc_On )
......@@ -272,10 +273,9 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
/* Show the new position */
ShowNewTrackWhenMovingCursor( DrawPanel, DC, false );
}
g_CurrentTrackSegment->DisplayInfo( this );
}
SetCurItem( g_CurrentTrackSegment );
SetCurItem( g_CurrentTrackSegment, false );
return g_CurrentTrackSegment;
}
......@@ -476,7 +476,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
LockPoint = CreateLockPoint( g_CurrentTrackSegment->m_End,
adr_buf,
g_CurrentTrackSegment,
&s_ItemsListPicker);
&s_ItemsListPicker );
}
}
......@@ -514,9 +514,9 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
// erase the old track, if exists
if( g_AutoDeleteOldTrack )
{
EraseRedundantTrack( DC, firstTrack, newCount, & s_ItemsListPicker );
EraseRedundantTrack( DC, firstTrack, newCount, &s_ItemsListPicker );
}
SaveCopyInUndoList(s_ItemsListPicker, UR_UNSPECIFIED);
SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
/* compute the new rastnest : */
......@@ -670,6 +670,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
D( g_CurrentTrackList.VerifyListIntegrity(); );
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen();
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
bool Track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.DisplayPcbTrackFill = true;
......@@ -685,7 +686,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
{
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
( (WinEDA_BasePcbFrame*)(panel->m_Parent) )->trace_ratsnest_pad( DC );
frame->trace_ratsnest_pad( DC );
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) // Show the via area
{
......@@ -760,13 +761,35 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
color );
}
/* Display info about currrent segment and the full new track:
* Choose the interesting segment: because we are using a 2 segments step,
* the last segment can be null, and the previous segment can be the interesting segment.
*/
TRACK* isegm = g_CurrentTrackSegment;
if( isegm->GetLength() == 0 && g_CurrentTrackSegment->Back() )
isegm = g_CurrentTrackSegment->Back();
// display interesting segment info only:
isegm->DisplayInfoBase( frame );
// Add current track length
int trackLen = 0;
wxString msg;
for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() )
trackLen += track->GetLength();
valeur_param( trackLen, msg );
frame->MsgPanel->AppendMessage( _( "Track Len" ), msg, DARKCYAN );
// Add current segments count (number of segments in this new track):
msg.Printf( wxT( "%d" ), g_CurrentTrackList.GetCount() );
frame->MsgPanel->AppendMessage( _( "Segs Count" ), msg, DARKCYAN );
DisplayOpt.ShowTrackClearanceMode = showTrackClearanceMode;
DisplayOpt.DisplayPcbTrackFill = Track_fill_copy;
( (WinEDA_BasePcbFrame*)(panel->m_Parent) )->
build_ratsnest_pad( NULL, g_CurrentTrackSegment->m_End, false );
( (WinEDA_BasePcbFrame*)(panel->m_Parent) )->trace_ratsnest_pad( DC );
frame->build_ratsnest_pad( NULL, g_CurrentTrackSegment->m_End, false );
frame->trace_ratsnest_pad( DC );
}
......
......@@ -464,7 +464,8 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
pad->ReturnStringPadName( padname );
msg.Printf( wxT( "NODE %s %.4s" ),
module->m_Reference->m_Text.GetData(), padname.GetData() );
GetChars( module->m_Reference->m_Text ),
GetChars( padname ) );
fputs( CONV_TO_UTF8( msg ), file );
fputs( "\n", file );
......
......@@ -108,8 +108,8 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
case ID_NEW_BOARD:
Clear_Pcb( true );
GetScreen()->m_FileName.Printf( wxT( "%s%cnoname%s" ),
wxGetCwd().GetData(), DIR_SEP,
PcbExtBuffer.GetData() );
GetChars( wxGetCwd() ), DIR_SEP,
GetChars( PcbExtBuffer ) );
SetTitle( GetScreen()->m_FileName );
ReCreateLayerBox( NULL );
break;
......@@ -187,7 +187,7 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append
if( source == NULL )
{
msg.Printf( _( "File <%s> not found" ),
GetScreen()->m_FileName.GetData() );
GetChars( GetScreen()->m_FileName ) );
DisplayError( this, msg );
return false;
}
......
......@@ -116,7 +116,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
if( FindMarker )
msg = _( "Marker found" );
else
msg.Printf( _( "<%s> Found" ), s_OldStringFound.GetData() );
msg.Printf( _( "<%s> Found" ), GetChars( s_OldStringFound ) );
m_Parent->Affiche_Message( msg );
......@@ -131,7 +131,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
if( FindMarker )
msg = _( "Marker not found" );
else
msg.Printf( _( "<%s> Not Found" ), s_OldStringFound.GetData() );
msg.Printf( _( "<%s> Not Found" ), GetChars( s_OldStringFound ) );
DisplayError( this, msg, 10 );
EndModal( 0 );
......
......@@ -448,7 +448,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event )
}
fprintf( rptfile, "$EndMODULE %s\n\n",
(const char*) Module->m_Reference->m_Text.GetData() );
CONV_TO_UTF8(Module->m_Reference->m_Text ) );
}
/* Write board Edges */
......
......@@ -208,7 +208,7 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
/* Mise a jour des caract de la pastille : */
Import_Pad_Settings( Pad, false );
Pad->SetNetname(wxEmptyString);
Pad->SetNetname( wxEmptyString );
Pad->m_Pos = GetScreen()->m_Curseur;
......@@ -222,8 +222,8 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
/* Increment automatique de la reference courante Current_PadName */
long num = 0; int ponder = 1;
while( g_Current_PadName.Len() && g_Current_PadName.Last() >= '0' &&
g_Current_PadName.Last() <= '9' )
while( g_Current_PadName.Len() && g_Current_PadName.Last() >= '0'
&& g_Current_PadName.Last() <= '9' )
{
num += (g_Current_PadName.Last() - '0') * ponder;
g_Current_PadName.RemoveLast();
......@@ -237,7 +237,7 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
/* Redessin du module */
Module->Set_Rectangle_Encadrement();
Pad->DisplayInfo( this );
if ( draw )
if( draw )
DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
}
......@@ -257,7 +257,8 @@ void WinEDA_BasePcbFrame::DeletePad( D_PAD* Pad )
Module->m_LastEdit_Time = time( NULL );
line.Printf( _( "Delete Pad (module %s %s) " ),
Module->m_Reference->m_Text.GetData(), Module->m_Value->m_Text.GetData() );
GetChars( Module->m_Reference->m_Text ),
GetChars( Module->m_Value->m_Text ) );
if( !IsOK( this, line ) )
return;
......@@ -318,13 +319,14 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
Module = (MODULE*) Pad->GetParent();
ITEM_PICKER picker(NULL, UR_CHANGED);
ITEM_PICKER picker( NULL, UR_CHANGED );
PICKED_ITEMS_LIST pickList;
/* Save dragged track segments in undo list */
for( DRAG_SEGM* pt_drag = g_DragSegmentList; pt_drag; pt_drag = pt_drag->Pnext )
{
Track = pt_drag->m_Segm;
// Set the old state
wxPoint t_start = Track->m_Start;
wxPoint t_end = Track->m_End;
......@@ -334,23 +336,23 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
Track->m_End = Pad_OldPos;
picker.m_PickedItem = Track;
pickList.PushItem(picker);
pickList.PushItem( picker );
}
/* Save old module and old items values */
wxPoint pad_curr_position = Pad->m_Pos;
Pad->m_Pos = Pad_OldPos;
if ( g_DragSegmentList == NULL )
if( g_DragSegmentList == NULL )
SaveCopyInUndoList( Module, UR_CHANGED );
else
{
picker.m_PickedItem = Module;
pickList.PushItem(picker);
pickList.PushItem( picker );
}
if ( g_DragSegmentList )
if( g_DragSegmentList )
SaveCopyInUndoList( pickList, UR_CHANGED );
/* Placement du pad */
......@@ -362,6 +364,7 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
for( DRAG_SEGM* pt_drag = g_DragSegmentList; pt_drag; pt_drag = pt_drag->Pnext )
{
Track = pt_drag->m_Segm;
// Set the new state
if( pt_drag->m_Pad_Start )
Track->m_Start = Pad->m_Pos;
......@@ -369,7 +372,7 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
Track->m_End = Pad->m_Pos;
Track->SetState( EDIT, OFF );
if ( DC )
if( DC )
Track->Draw( DrawPanel, DC, GR_OR );
}
......@@ -383,7 +386,7 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
Pad->m_Flags = 0;
if ( DC )
if( DC )
Pad->Draw( DrawPanel, DC, GR_OR );
Module->Set_Rectangle_Encadrement();
......@@ -417,7 +420,7 @@ void WinEDA_BasePcbFrame::RotatePad( D_PAD* Pad, wxDC* DC )
GetScreen()->SetModify();
if ( DC )
if( DC )
Module->Draw( DrawPanel, DC, GR_XOR );
EXCHG( Pad->m_Size.x, Pad->m_Size.y );
......@@ -432,6 +435,6 @@ void WinEDA_BasePcbFrame::RotatePad( D_PAD* Pad, wxDC* DC )
Module->Set_Rectangle_Encadrement();
Pad->DisplayInfo( this );
if ( DC )
if( DC )
Module->Draw( DrawPanel, DC, GR_OR );
}
......@@ -190,6 +190,9 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
DisplayOpt.DisplayPcbTrackFill = track_fill_copy;
// Display track length
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
Track->DisplayInfo( frame );
}
......@@ -439,6 +442,9 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
tSegmentToStart->Draw( panel, DC, draw_mode );
if( tSegmentToEnd )
tSegmentToEnd->Draw( panel, DC, draw_mode );
// Display track length
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
Track->DisplayInfo( frame );
}
......
......@@ -114,7 +114,7 @@ bool OpenNetlistFile( const wxString& aFullFileName )
if( source == 0 )
{
wxString msg;
msg.Printf( _( "Netlist file %s not found" ), aFullFileName.GetData() );
msg.Printf( _( "Netlist file %s not found" ), GetChars( aFullFileName ) );
DisplayError( NULL, msg );
return FALSE;
}
......@@ -486,8 +486,9 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
msg.Printf(
_(
"Component \"%s\": Mismatch! module is [%s] and netlist said [%s]\n" ),
TextCmpName.GetData(), Module->m_LibRef.GetData(),
NameLibCmp.GetData() );
GetChars( TextCmpName ),
GetChars( Module->m_LibRef ),
GetChars( NameLibCmp ) );
if( aMessageWindow )
aMessageWindow->AppendText( msg );
......@@ -520,7 +521,7 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
if( aMessageWindow )
{
wxString msg;
msg.Printf( _( "Component [%s] not found" ), TextCmpName.GetData() );
msg.Printf( _( "Component [%s] not found" ), GetChars( TextCmpName ) );
aMessageWindow->AppendText( msg + wxT( "\n" ) );
}
}
......@@ -586,7 +587,8 @@ int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMes
{
wxString pin_name = CONV_FROM_UTF8( TextPinName );
Msg.Printf( _( "Module [%s]: Pad [%s] not found" ),
Module->m_Reference->m_Text.GetData(), pin_name.GetData() );
GetChars( Module->m_Reference->m_Text ),
GetChars( pin_name ) );
aMessageWindow->AppendText( Msg + wxT( "\n" ) );
}
}
......@@ -870,7 +872,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
{
wxString msg;
msg.Printf( _( "File <%s> not found, use Netlist for lib module selection" ),
CmpFullFileName.GetData() );
GetChars( CmpFullFileName ) );
DisplayError( NULL, msg, 20 );
return 0;
}
......@@ -1001,7 +1003,8 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
{
wxString msg;
msg.Printf( _( "Component [%s]: footprint <%s> not found" ),
cmp->m_CmpName.GetData(), cmp->m_LibName.GetData() );
GetChars( cmp->m_CmpName ),
GetChars( cmp->m_LibName ) );
DisplayError( NULL, msg );
continue;
}
......
......@@ -215,8 +215,10 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
else if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
{
TRACK* track = Begin_Route( (TRACK*) DrawStruct, DC );
if( track ) // c'est a dire si OK
SetCurItem( DrawStruct = track );
// SetCurItem() must not write to the msg panel
// because a track info is displayed while moving the mouse cursor
if( track ) // A new segment was created
SetCurItem( DrawStruct = track, false );
DrawPanel->m_AutoPAN_Request = true;
}
break;
......
......@@ -153,7 +153,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
{
if( !flags )
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _( "Autoroute" ) );
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _( "Autoroute Module" ) );
}
break;
......@@ -345,21 +345,13 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
{
wxMenu* commands = new wxMenu;
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Global Autoroute" ), commands );
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Autoroute" ), commands );
ADD_MENUITEM( commands, ID_POPUP_PCB_SELECT_LAYER_PAIR,
_( "Select Layer Pair" ), select_layer_pair_xpm );
commands->AppendSeparator();
commands->Append( ID_POPUP_PCB_AUTOROUTE_ALL_MODULES, _( "Autoroute All Modules" ) );
commands->AppendSeparator();
commands->Append( ID_POPUP_PCB_AUTOROUTE_RESET_UNROUTED, _( "Reset Unrouted" ) );
if( GetBoard()->m_Modules )
{
commands->AppendSeparator();
commands->Append( ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER,
_( "Global AutoRouter" ) );
commands->Append( ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA,
_( "Read Global AutoRouter Data" ) );
}
aPopMenu->AppendSeparator();
}
......
......@@ -125,8 +125,6 @@ enum pcbnew_ids
ID_POPUP_PCB_LOCK_OFF_NET,
ID_POPUP_PCB_SETFLAGS_TRACK_MNU,
ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER,
ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA,
ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE,
ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE,
ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE,
......
......@@ -143,7 +143,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
errMsg.Printf(
_( "Your BOARD has a bad layer number of %u for module\n %s's \"reference\" text." ),
textLayer, Module->GetReference().GetData() );
textLayer, GetChars( Module->GetReference() ) );
DisplayError( this, errMsg );
return;
}
......@@ -163,7 +163,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
errMsg.Printf(
_( "Your BOARD has a bad layer number of %u for module\n %s's \"value\" text." ),
textLayer, Module->GetReference().GetData() );
textLayer, GetChars( Module->GetReference() ) );
DisplayError( this, errMsg );
return;
}
......@@ -201,7 +201,8 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter,
errMsg.Printf(
_(
"Your BOARD has a bad layer number of %u for module\n %s's \"module text\" text of %s." ),
textLayer, Module->GetReference().GetData(), pt_texte->m_Text.GetData() );
textLayer, GetChars( Module->GetReference() ),
GetChars( pt_texte->m_Text ) );
DisplayError( this, errMsg );
return;
}
......@@ -582,8 +583,8 @@ void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
for( unsigned iseg = 0; iseg < aZone->m_FillSegmList.size(); iseg++ )
{
wxPoint start = aZone->m_FillSegmList[iseg].m_Start;
wxPoint end = aZone->m_FillSegmList[iseg].m_End ;
plotter->thick_segment(start, end, aZone->m_ZoneMinThickness, trace_mode );
wxPoint end = aZone->m_FillSegmList[iseg].m_End;
plotter->thick_segment( start, end, aZone->m_ZoneMinThickness, trace_mode );
}
}
......
This diff is collapsed.
......@@ -251,7 +251,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides )
net = GetBoard()->FindNet( current_net_code );
if( net )
{
msg.Printf( wxT( "[%8.8s]" ), net->GetNetname().GetData() );
msg.Printf( wxT( "[%8.8s]" ), GetChars( net->GetNetname() ) );
Affiche_1_Parametre( this, 1, wxT( "Net route" ), msg, BROWN );
msg.Printf( wxT( "%d / %d" ), Ncurrent, Ntotal );
Affiche_1_Parametre( this, 12, wxT( "Activity" ), msg, BROWN );
......
......@@ -45,7 +45,7 @@ void WinEDA_PcbFrame::ListNetsAndSelect( wxCommandEvent& event )
continue;
Line.Printf( wxT( "net_code = %3.3d [%.16s] " ), net->GetNet(),
net->GetNetname().GetData() );
GetChars( net->GetNetname() ) );
List.Append( Line );
}
......
......@@ -53,6 +53,9 @@ TRACK* Marque_Une_Piste( BOARD* aPcb,
if( aSegmCount )
*aSegmCount = 0;
if( aTrackLen )
*aTrackLen = 0;
if( aStartSegm == NULL )
return NULL;
......@@ -259,7 +262,6 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
/* Set the BUSY flag of all connected segments, first search starting at aRef_pos
* Search ends when:
* - a pad is found (end of a track)
* - a segment found is flagged "EDIT"
* - a segment end has more than one other segment end connected
* - and obviously when no connected item found
* Vias are a special case, because we must see others segment connected on others layers
......@@ -284,9 +286,6 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
pt_via = Fast_Locate_Via( aPcb->m_Track, NULL, aRef_pos, aLayerMask );
if( pt_via )
{
if( pt_via->GetState( EDIT ) )
return;
aLayerMask = pt_via->ReturnMaskLayer();
aList->push_back( pt_via );
......@@ -302,9 +301,6 @@ static void Marque_Chaine_segments( BOARD* aPcb, wxPoint aRef_pos, int aLayerMas
while( ( pt_segm = Fast_Locate_Piste( pt_segm, NULL,
aRef_pos, aLayerMask ) ) != NULL )
{
if( pt_segm->GetState( EDIT ) ) // End of track
return;
if( pt_segm->GetState( BUSY ) ) // already found and selected: skip it
{
pt_segm = pt_segm->Next();
......
......@@ -296,14 +296,14 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
check_module_value = true;
value = m_CurrentModule->m_Value->m_Text;
msg.Printf( _( "Change modules <%s> -> <%s> (val = %s)?" ),
m_CurrentModule->m_LibRef.GetData(),
newmodulename.GetData(),
m_CurrentModule->m_Value->m_Text.GetData() );
GetChars( m_CurrentModule->m_LibRef ),
GetChars( newmodulename ),
GetChars( m_CurrentModule->m_Value->m_Text ) );
}
else
{
msg.Printf( _( "Change modules <%s> -> <%s> ?" ),
lib_reference.GetData(), newmodulename.GetData() );
GetChars( lib_reference ), GetChars( newmodulename ) );
}
if( !IsOK( this, msg ) )
......@@ -327,7 +327,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue )
if( value.CmpNoCase( Module->m_Value->m_Text ) != 0 )
continue;
}
if( Change_1_Module( Module, newmodulename.GetData(), &pickList, ShowErr ) )
if( Change_1_Module( Module, newmodulename, &pickList, ShowErr ) )
change = true;
else if( ShowErr )
ShowErr--;
......@@ -376,7 +376,7 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleAll()
for( ; Module && ( Module->Type() == TYPE_MODULE ); Module = PtBack )
{
PtBack = Module->Back();
if( Change_1_Module( Module, Module->m_LibRef.GetData(), &pickList, ShowErr ) )
if( Change_1_Module( Module, Module->m_LibRef, &pickList, ShowErr ) )
change = true;
else if( ShowErr )
ShowErr--;
......@@ -424,7 +424,7 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module,
/* Chargement du module */
Line.Printf( _( "Change module %s (%s) " ),
Module->m_Reference->m_Text.GetData(), oldnamecmp.GetData() );
GetChars( Module->m_Reference->m_Text ), GetChars( oldnamecmp ) );
m_WinMessages->AppendText( Line );
namecmp.Trim( true );
......
......@@ -256,7 +256,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
{
wxString str;
str.Printf( wxT( "Area %8.8X of net \"%s\" has arcs intersecting other sides.\n" ),
aCurrArea->m_TimeStamp, aCurrArea->m_Netname.GetData() );
aCurrArea->m_TimeStamp, GetChars( aCurrArea->m_Netname ) );
str += wxT( "This may cause problems with other editing operations,\n" );
str += wxT( "such as adding cutouts. It can't be fixed automatically.\n" );
str += wxT( "Manual correction is recommended." );
......@@ -279,7 +279,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
wxString str;
str.Printf( wxT(
"Area %8.8X of net \"%s\" is self-intersecting and will be clipped.\n" ),
aCurrArea->m_TimeStamp, aCurrArea->m_Netname.GetData() );
aCurrArea->m_TimeStamp, GetChars( aCurrArea->m_Netname ) );
str += wxT( "This may result in splitting the area.\n" );
str += wxT( "If the area is complex, this may take a few seconds." );
wxMessageBox( str );
......@@ -445,7 +445,7 @@ int BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode,
"Areas %d and %d of net \"%s\" intersect, but some of the intersecting sides are arcs.\n" ),
ia1 + 1,
ia2 + 1,
curr_area->m_Netname.GetData() );
GetChars( curr_area->m_Netname ) );
str += wxT( "Therefore, these areas can't be combined." );
wxMessageBox( str );
}
......
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