Commit 8d5a6531 authored by faa's avatar faa

pcbnew: remove old of two To_User_Unit(), redraw ratsnest on/off, magnetic...

pcbnew: remove old of two To_User_Unit(), redraw ratsnest on/off, magnetic cursor to start move/drag module
parent 4b846e1f
......@@ -323,7 +323,7 @@ wxString ReturnStringFromValue( int aUnits, int aValue, int aInternal_Unit,
StringValue << aValue;
else
{
value_to_print = To_User_Unit( (bool) aUnits, aValue, aInternal_Unit );
value_to_print = To_User_Unit( (bool) aUnits, (double) aValue, aInternal_Unit );
StringValue.Printf( ( aInternal_Unit > 1000 ) ? wxT( "%.4f" ) : wxT( "%.3f" ),
value_to_print );
}
......@@ -407,33 +407,7 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter )
/******************************************************************/
double To_User_Unit( bool is_metric, int val, int internal_unit_value )
/******************************************************************/
/**
* Function To_User_Unit
* Convert in inch or mm the variable "val" (double)given in internal units
* @return the converted value, in double
* @param is_metric : true if the result must be returned in mm , false if inches
* @param val : integer : the given value
* @param internal_unit_value = internal units per inch
*/
{
double value;
if( is_metric )
value = (double) ( val ) * 25.4 / internal_unit_value;
else
value = (double) ( val ) / internal_unit_value;
return value;
}
/******************************************************************/
double To_User_Unit( bool is_metric,
double val,
int internal_unit_value )
double To_User_Unit( bool is_metric, double val, int internal_unit_value )
/******************************************************************/
/**
......
......@@ -113,6 +113,7 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
{
g_Show_Ratsnest = m_ShowGlobalRatsnest->GetValue();
m_Parent->Ratsnest_On_Off( m_DC );
m_Parent->RedrawActiveWindow( m_DC, TRUE);
}
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
......@@ -208,6 +209,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext( &dc );
Ratsnest_On_Off( &dc );
RedrawActiveWindow( &dc, TRUE);
}
break;
......
......@@ -65,8 +65,6 @@ void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
{
GetBoard()->m_FullRatsnest[ii].m_Status |= CH_VISIBLE;
}
DrawGeneralRatsnest( DC, 0 );
}
else
{
......
......@@ -98,6 +98,9 @@ MODULE* WinEDA_BasePcbFrame::GetModuleByName()
void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
/**********************************************************************/
{
wxPoint Mouse;
if( module == NULL )
return;
......@@ -107,6 +110,11 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
ModuleInitOrient = module->m_Orient;
ModuleInitLayer = module->GetLayer();
GetScreen()->m_Curseur = module->m_Pos;
Mouse.x = wxRound( module->m_Pos.x );
Mouse.y = wxRound( module->m_Pos.y );
DrawPanel->MouseTo( Mouse );
/* Effacement chevelu general si necessaire */
if( g_Show_Ratsnest )
DrawGeneralRatsnest( DC );
......@@ -330,6 +338,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
// redraw the area where the module was
if( DC )
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
RedrawActiveWindow( DC, TRUE);
return TRUE;
}
......@@ -463,6 +472,9 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
if( !aDoNotRecreateRatsnest )
Compile_Ratsnest( DC, true );
if( DC )
RedrawActiveWindow( DC, TRUE);
module->DisplayInfo( this );
DrawPanel->ManageCurseur = NULL;
......@@ -539,6 +551,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
DrawModuleOutlines( DrawPanel, DC, module );
Dessine_Segments_Dragges( DrawPanel, DC );
}
RedrawActiveWindow( DC, TRUE);
}
}
......
......@@ -298,7 +298,7 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{
double value = To_User_Unit( g_UnitMetric,
(int)GetScreen()->m_GridList[i].m_Size.x,
GetScreen()->m_GridList[i].m_Size.x,
PCB_INTERNAL_UNIT );
if( GetScreen()->m_GridList[i].m_Id != ID_POPUP_GRID_USER )
{
......
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