beautified
This commit is contained in:
parent
ede37ecfa7
commit
8bb93b8d48
|
@ -3,8 +3,9 @@
|
|||
/********************************************************/
|
||||
|
||||
/* fichier controle.cpp */
|
||||
|
||||
/*
|
||||
Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
|
||||
* Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
|
||||
*/
|
||||
|
||||
#include "fctsys.h"
|
||||
|
@ -23,8 +24,9 @@
|
|||
/**********************************/
|
||||
void RemoteCommand( char* cmdline )
|
||||
/**********************************/
|
||||
|
||||
/* Read a remote command send by eeschema via a socket,
|
||||
port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
|
||||
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
|
||||
*/
|
||||
{
|
||||
char Line[1024];
|
||||
|
@ -37,18 +39,21 @@ WinEDA_PcbFrame * frame = EDA_Appl->m_PcbFrame;
|
|||
|
||||
idcmd = strtok( Line, " \n\r" );
|
||||
text = strtok( NULL, " \n\r" );
|
||||
if ( (idcmd == NULL) || (text == NULL) ) return;
|
||||
if( (idcmd == NULL) || (text == NULL) )
|
||||
return;
|
||||
|
||||
if( strcmp( idcmd, "$PART:" ) == 0 )
|
||||
{
|
||||
MODULE* Module;
|
||||
msg = CONV_FROM_UTF8( text );
|
||||
Module = ReturnModule( frame->m_Pcb, msg );
|
||||
msg.Printf(_("Locate module %s %s"),msg.GetData(), Module ? wxT("Ok") : wxT("not found"));
|
||||
msg.Printf( _( "Locate module %s %s" ), msg.GetData(),
|
||||
Module ? wxT( "Ok" ) : wxT( "not found" ) );
|
||||
frame->Affiche_Message( msg );
|
||||
if( Module )
|
||||
{
|
||||
wxClientDC dc( frame->DrawPanel );
|
||||
|
||||
frame->DrawPanel->PrepareGraphicContext( &dc );
|
||||
frame->DrawPanel->CursorOff( &dc );
|
||||
frame->GetScreen()->m_Curseur = Module->m_Pos;
|
||||
|
@ -64,19 +69,24 @@ WinEDA_PcbFrame * frame = EDA_Appl->m_PcbFrame;
|
|||
int netcode = -1;
|
||||
PinName = CONV_FROM_UTF8( text );
|
||||
text = strtok( NULL, " \n\r" );
|
||||
if(text && strcmp(text, "$PART:") == 0 ) text = strtok(NULL,"\n\r");
|
||||
if( text && strcmp( text, "$PART:" ) == 0 )
|
||||
text = strtok( NULL, "\n\r" );
|
||||
|
||||
wxClientDC dc( frame->DrawPanel );
|
||||
|
||||
frame->DrawPanel->PrepareGraphicContext( &dc );
|
||||
|
||||
ModName = CONV_FROM_UTF8( text );
|
||||
Module = ReturnModule( frame->m_Pcb, ModName );
|
||||
if( Module ) Pad = ReturnPad(Module, PinName);
|
||||
if( Pad ) netcode = Pad->m_NetCode;
|
||||
if( Module )
|
||||
Pad = ReturnPad( Module, PinName );
|
||||
if( Pad )
|
||||
netcode = Pad->m_NetCode;
|
||||
if( netcode > 0 )
|
||||
{
|
||||
/* effacement surbrillance ancienne */
|
||||
if(g_HightLigt_Status) frame->Hight_Light(&dc);
|
||||
if( g_HightLigt_Status )
|
||||
frame->Hight_Light( &dc );
|
||||
g_HightLigth_NetCode = netcode;
|
||||
frame->Hight_Light( &dc );
|
||||
frame->DrawPanel->CursorOff( &dc );
|
||||
|
@ -98,12 +108,14 @@ wxClientDC dc(frame->DrawPanel);
|
|||
/***********************************************************************/
|
||||
EDA_BaseStruct* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( void )
|
||||
/***********************************************************************/
|
||||
|
||||
/* Search an item under the mouse cursor.
|
||||
items are searched first on the current working layer.
|
||||
if nothing found, an item will be searched without layer restriction
|
||||
* items are searched first on the current working layer.
|
||||
* if nothing found, an item will be searched without layer restriction
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* item;
|
||||
|
||||
item = Locate( CURSEUR_OFF_GRILLE, GetScreen()->m_Active_Layer );
|
||||
if( item == NULL )
|
||||
item = Locate( CURSEUR_OFF_GRILLE, -1 );
|
||||
|
@ -150,8 +162,10 @@ int CurrentTime = time(NULL);
|
|||
|
||||
delta.x = (int) round( (double) GetScreen()->GetGrid().x / zoom );
|
||||
delta.y = (int) round( (double) GetScreen()->GetGrid().y / zoom );
|
||||
if( delta.x <= 0 ) delta.x = 1;
|
||||
if( delta.y <= 0 ) delta.y = 1;
|
||||
if( delta.x <= 0 )
|
||||
delta.x = 1;
|
||||
if( delta.y <= 0 )
|
||||
delta.y = 1;
|
||||
|
||||
switch( g_KeyPressed )
|
||||
{
|
||||
|
@ -159,30 +173,37 @@ int CurrentTime = time(NULL);
|
|||
case WXK_SUBTRACT:
|
||||
case '-':
|
||||
ll = GetScreen()->m_Active_Layer;
|
||||
if(ll > CMP_N) break;
|
||||
if(ll <= CUIVRE_N) break;
|
||||
if( ll > CMP_N )
|
||||
break;
|
||||
if( ll <= CUIVRE_N )
|
||||
break;
|
||||
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 ) // Single layer
|
||||
ll = CUIVRE_N;
|
||||
if( ll == CMP_N )
|
||||
ll = MAX( CUIVRE_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
|
||||
else if ( ll > CUIVRE_N) ll--;
|
||||
else if( ll > CUIVRE_N )
|
||||
ll--;
|
||||
GetScreen()->m_Active_Layer = ll;
|
||||
if ( DisplayOpt.ContrastModeDisplay ) DrawPanel->Refresh(TRUE);
|
||||
if( DisplayOpt.ContrastModeDisplay )
|
||||
DrawPanel->Refresh( TRUE );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD_ADD:
|
||||
case WXK_ADD:
|
||||
case '+':
|
||||
ll = GetScreen()->m_Active_Layer;
|
||||
if(ll >= CMP_N) break;
|
||||
if( ll >= CMP_N )
|
||||
break;
|
||||
ll++;
|
||||
if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
|
||||
ll = CMP_N;
|
||||
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 ) // Single layer
|
||||
ll = CUIVRE_N;
|
||||
GetScreen()->m_Active_Layer = ll;
|
||||
if ( DisplayOpt.ContrastModeDisplay ) DrawPanel->Refresh(TRUE);
|
||||
if( DisplayOpt.ContrastModeDisplay )
|
||||
DrawPanel->Refresh( TRUE );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD0:
|
||||
case WXK_PAGEUP:
|
||||
SwitchLayer( DC, CMP_N );
|
||||
|
@ -296,7 +317,8 @@ int CurrentTime = time(NULL);
|
|||
DrawPanel->MouseTo( Mouse );
|
||||
break;
|
||||
|
||||
default: hotkey = g_KeyPressed;
|
||||
default:
|
||||
hotkey = g_KeyPressed;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -304,37 +326,41 @@ int CurrentTime = time(NULL);
|
|||
GetScreen()->m_Curseur = curpos;
|
||||
|
||||
/* Put cursor on grid or a pad centre if requested
|
||||
But if the tool DELETE is active the cursor is left off grid
|
||||
this is better to reach items to delete off grid
|
||||
* But if the tool DELETE is active the cursor is left off grid
|
||||
* this is better to reach items to delete off grid
|
||||
*/
|
||||
D_PAD* pad;
|
||||
bool keep_on_grid = TRUE;
|
||||
if (m_ID_current_state == ID_PCB_DELETE_ITEM_BUTT) keep_on_grid = FALSE;
|
||||
if( m_ID_current_state == ID_PCB_DELETE_ITEM_BUTT )
|
||||
keep_on_grid = FALSE;
|
||||
/* Cursor is left off grid if no block in progress and no moving object */
|
||||
if( GetScreen()->BlockLocate.m_State != STATE_NO_BLOCK )
|
||||
keep_on_grid = TRUE;
|
||||
EDA_BaseStruct* DrawStruct = GetScreen()->m_CurrentItem;
|
||||
if ( DrawStruct && DrawStruct->m_Flags ) keep_on_grid = TRUE;
|
||||
if( DrawStruct && DrawStruct->m_Flags )
|
||||
keep_on_grid = TRUE;
|
||||
|
||||
switch( g_MagneticPadOption )
|
||||
{
|
||||
case capture_cursor_in_track_tool:
|
||||
case capture_always:
|
||||
pad = Locate_Any_Pad( m_Pcb, CURSEUR_OFF_GRILLE, TRUE );
|
||||
if ( (m_ID_current_state != ID_TRACK_BUTT ) &&
|
||||
(g_MagneticPadOption == capture_cursor_in_track_tool) )
|
||||
if( (m_ID_current_state != ID_TRACK_BUTT )
|
||||
&& (g_MagneticPadOption == capture_cursor_in_track_tool) )
|
||||
pad = NULL;
|
||||
if( keep_on_grid )
|
||||
{
|
||||
if( pad ) // Put cursor on the pad
|
||||
GetScreen()->m_Curseur = curpos = pad->m_Pos;
|
||||
else // Put cursor on grid
|
||||
else
|
||||
// Put cursor on grid
|
||||
PutOnGrid( &GetScreen()->m_Curseur );
|
||||
}
|
||||
break;
|
||||
|
||||
case no_effect:
|
||||
default:
|
||||
|
||||
// If we are not in delete function, put cursor on grid
|
||||
if( keep_on_grid )
|
||||
PutOnGrid( &GetScreen()->m_Curseur );
|
||||
|
|
Loading…
Reference in New Issue