Commit ea6eeca1 authored by dickelbeck's avatar dickelbeck

beautification

parent 0f406d3f
/*****************************************/ /*****************************************/
/* Routines generales d'affichage du PCB */ /* Routines generales d'affichage du PCB */
/*****************************************/ /*****************************************/
/* fichier TRACEPCB.CPP */
/* fichier TRACEPCB.CPP */
/* /*
Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ... * Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
*/ */
#include "fctsys.h" #include "fctsys.h"
...@@ -22,15 +23,17 @@ ...@@ -22,15 +23,17 @@
/**********************************************************************************/ /**********************************************************************************/
void WinEDA_DrawPanel::PrintPage(wxDC *DC, bool Print_Sheet_Ref, int printmasklayer) void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmasklayer )
/**********************************************************************************/ /**********************************************************************************/
/* routine de trace du pcb, avec selection des couches */ /* routine de trace du pcb, avec selection des couches */
{ {
DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt;
save_opt = DisplayOpt; save_opt = DisplayOpt;
if( printmasklayer & ALL_CU_LAYERS ) DisplayOpt.DisplayPadFill = FILLED; if( printmasklayer & ALL_CU_LAYERS )
else DisplayOpt.DisplayPadFill = SKETCH; DisplayOpt.DisplayPadFill = FILLED;
else
DisplayOpt.DisplayPadFill = SKETCH;
DisplayOpt.DisplayPadNum = 0; DisplayOpt.DisplayPadNum = 0;
DisplayOpt.DisplayPadNoConn = 0; DisplayOpt.DisplayPadNoConn = 0;
DisplayOpt.DisplayPadIsol = 0; DisplayOpt.DisplayPadIsol = 0;
...@@ -41,103 +44,105 @@ DISPLAY_OPTIONS save_opt; ...@@ -41,103 +44,105 @@ DISPLAY_OPTIONS save_opt;
DisplayOpt.DisplayDrawItems = FILLED; DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZones = 1; DisplayOpt.DisplayZones = 1;
((WinEDA_GerberFrame*)m_Parent)->Trace_Gerber(DC, GR_COPY); ( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY );
if ( Print_Sheet_Ref ) if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet(DC, GetScreen(), 0); m_Parent->TraceWorkSheet( DC, GetScreen(), 0 );
DisplayOpt = save_opt; DisplayOpt = save_opt;
} }
/*******************************************************************/ /*******************************************************************/
void WinEDA_GerberFrame::RedrawActiveWindow(wxDC * DC, bool EraseBg) void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*******************************************************************/ /*******************************************************************/
/* Trace le PCB, et les elements complementaires ( axes, grille .. ) /* Trace le PCB, et les elements complementaires ( axes, grille .. )
*/ */
{ {
PCB_SCREEN * screen = GetScreen(); PCB_SCREEN* screen = GetScreen();
if ( ! m_Pcb ) return; if( !m_Pcb )
return;
ActiveScreen = screen; ActiveScreen = screen;
GRSetDrawMode(DC, GR_COPY); GRSetDrawMode( DC, GR_COPY );
if ( EraseBg ) DrawPanel->EraseScreen(DC); if( EraseBg )
DrawPanel->EraseScreen( DC );
DrawPanel->DrawBackGround(DC); DrawPanel->DrawBackGround( DC );
Trace_Gerber(DC, GR_OR); Trace_Gerber( DC, GR_OR );
TraceWorkSheet(DC, screen, 0); TraceWorkSheet( DC, screen, 0 );
Affiche_Status_Box(); Affiche_Status_Box();
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur(DrawPanel, DC, FALSE); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->Trace_Curseur(DC); DrawPanel->Trace_Curseur( DC );
} }
/********************************************************/ /********************************************************/
void WinEDA_GerberFrame::Trace_Gerber(wxDC * DC, int mode) void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int mode )
/********************************************************/ /********************************************************/
/* Trace l'ensemble des elements du PCB sur l'ecran actif*/ /* Trace l'ensemble des elements du PCB sur l'ecran actif*/
{ {
if( !m_Pcb )
if ( ! m_Pcb ) return; return;
// Draw tracks and flashes // Draw tracks and flashes
Trace_Pistes(DrawPanel, DC, m_Pcb, mode); Trace_Pistes( DrawPanel, DC, m_Pcb, mode );
// Draw filled polygons // Draw filled polygons
#define NBMAX 2000 #define NBMAX 2000
TRACK * track; TRACK* track;
int nbpoints = 0; int nbpoints = 0;
int nbpointsmax = NBMAX; int nbpointsmax = NBMAX;
int * coord = (int*) malloc(nbpointsmax * sizeof (int) * 2); int* coord = (int*) malloc( nbpointsmax * sizeof(int) * 2 );
int * ptcoord = coord; int* ptcoord = coord;
track = m_Pcb->m_Zone; track = m_Pcb->m_Zone;
for ( ; track != NULL ; track = track->Next() ) for( ; track != NULL; track = track->Next() )
{ {
if ( track->m_NetCode == 0 ) // StartPoint if( track->m_NetCode == 0 ) // StartPoint
{ {
if ( nbpoints ) if( nbpoints )
{ {
int Color = g_DesignSettings.m_LayerColor[track->m_Layer]; int Color = g_DesignSettings.m_LayerColor[track->m_Layer];
GRClosedPoly(&DrawPanel->m_ClipBox, DC, nbpoints, coord, GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color); 1, Color, Color );
} }
nbpoints = 2; nbpoints = 2;
ptcoord = coord; ptcoord = coord;
* ptcoord = track->m_Start.x; ptcoord++; *ptcoord = track->m_Start.x; ptcoord++;
* ptcoord = track->m_Start.y; ptcoord++; *ptcoord = track->m_Start.y; ptcoord++;
* ptcoord = track->m_End.x; ptcoord++; *ptcoord = track->m_End.x; ptcoord++;
* ptcoord = track->m_End.y; ptcoord++; *ptcoord = track->m_End.y; ptcoord++;
} }
else else
{ {
if ( nbpoints >= nbpointsmax ) if( nbpoints >= nbpointsmax )
{ {
nbpointsmax *= 2; nbpointsmax *= 2;
coord = (int*) realloc(coord, nbpointsmax * sizeof (int) * 2); coord = (int*) realloc( coord, nbpointsmax * sizeof(int) * 2 );
ptcoord = coord + nbpointsmax; ptcoord = coord + nbpointsmax;
} }
nbpoints++; nbpoints++;
* ptcoord = track->m_End.x; ptcoord++; *ptcoord = track->m_End.x; ptcoord++;
* ptcoord = track->m_End.y; ptcoord++; *ptcoord = track->m_End.y; ptcoord++;
} }
if ( track->Next() == NULL ) // Last point if( track->Next() == NULL ) // Last point
{ {
int Color = g_DesignSettings.m_LayerColor[track->m_Layer]; int Color = g_DesignSettings.m_LayerColor[track->m_Layer];
GRClosedPoly(&DrawPanel->m_ClipBox, DC, nbpoints, coord, GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color); 1, Color, Color );
} }
} }
free(coord); free( coord );
if ( DisplayOpt.DisplayPadNum ) if( DisplayOpt.DisplayPadNum )
Affiche_DCodes_Pistes(DrawPanel, DC, m_Pcb, GR_COPY); Affiche_DCodes_Pistes( DrawPanel, DC, m_Pcb, GR_COPY );
GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
} }
This diff is collapsed.
/******************************************************************/ /******************************************************************/
/* drawpanel.cpp - fonctions des classes du type WinEDA_DrawPanel */ /* drawpanel.cpp - fonctions des classes du type WinEDA_DrawPanel */
/******************************************************************/ /******************************************************************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
...@@ -12,13 +13,13 @@ ...@@ -12,13 +13,13 @@
#include "macros.h" #include "macros.h"
#include "id.h" #include "id.h"
/* defines locaux */ // defines locaux
#define CURSOR_SIZE 12 /* taille de la croix du curseur PCB */ #define CURSOR_SIZE 12 // taille de la croix du curseur PCB
/* Variables locales */ // Variables locales
/* table des evenements captes par un WinEDA_DrawPanel */ // table des evenements captes par un WinEDA_DrawPanel
BEGIN_EVENT_TABLE(WinEDA_DrawPanel, EDA_DRAW_PANEL) BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL )
EVT_LEAVE_WINDOW(WinEDA_DrawPanel::OnMouseLeaving) EVT_LEAVE_WINDOW(WinEDA_DrawPanel::OnMouseLeaving)
EVT_MOUSE_EVENTS(WinEDA_DrawPanel::OnMouseEvent) EVT_MOUSE_EVENTS(WinEDA_DrawPanel::OnMouseEvent)
EVT_CHAR(WinEDA_DrawPanel::OnKeyEvent) EVT_CHAR(WinEDA_DrawPanel::OnKeyEvent)
...@@ -31,12 +32,8 @@ BEGIN_EVENT_TABLE(WinEDA_DrawPanel, EDA_DRAW_PANEL) ...@@ -31,12 +32,8 @@ BEGIN_EVENT_TABLE(WinEDA_DrawPanel, EDA_DRAW_PANEL)
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
WinEDA_DrawPanel::Process_Popup_Zoom) WinEDA_DrawPanel::Process_Popup_Zoom)
END_EVENT_TABLE() END_EVENT_TABLE()
/***********************************************************/ /***********************************************************/
/* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */ /* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */
/***********************************************************/ /***********************************************************/
...@@ -73,6 +70,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id, ...@@ -73,6 +70,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id,
m_CursorLevel = 0; m_CursorLevel = 0;
} }
/*********************************************************************************/ /*********************************************************************************/
void WinEDA_DrawPanel::Trace_Curseur(wxDC * DC, int color) void WinEDA_DrawPanel::Trace_Curseur(wxDC * DC, int color)
/*********************************************************************************/ /*********************************************************************************/
...@@ -109,6 +107,7 @@ wxPoint Cursor = GetScreen()->m_Curseur; ...@@ -109,6 +107,7 @@ wxPoint Cursor = GetScreen()->m_Curseur;
} }
} }
/*******************************************************************/ /*******************************************************************/
void WinEDA_DrawPanel::CursorOff(wxDC * DC) void WinEDA_DrawPanel::CursorOff(wxDC * DC)
/*******************************************************************/ /*******************************************************************/
...@@ -120,6 +119,7 @@ void WinEDA_DrawPanel::CursorOff(wxDC * DC) ...@@ -120,6 +119,7 @@ void WinEDA_DrawPanel::CursorOff(wxDC * DC)
--m_CursorLevel; --m_CursorLevel;
} }
/*******************************************************************/ /*******************************************************************/
void WinEDA_DrawPanel::CursorOn(wxDC * DC) void WinEDA_DrawPanel::CursorOn(wxDC * DC)
/*******************************************************************/ /*******************************************************************/
...@@ -142,6 +142,7 @@ int WinEDA_DrawPanel::GetZoom(void) ...@@ -142,6 +142,7 @@ int WinEDA_DrawPanel::GetZoom(void)
return GetScreen()->GetZoom(); return GetScreen()->GetZoom();
} }
/***************************************/ /***************************************/
void WinEDA_DrawPanel::SetZoom(int zoom) void WinEDA_DrawPanel::SetZoom(int zoom)
/***************************************/ /***************************************/
...@@ -149,6 +150,7 @@ void WinEDA_DrawPanel::SetZoom(int zoom) ...@@ -149,6 +150,7 @@ void WinEDA_DrawPanel::SetZoom(int zoom)
GetScreen()->SetZoom(zoom); GetScreen()->SetZoom(zoom);
} }
/************************************/ /************************************/
wxSize WinEDA_DrawPanel::GetGrid(void) wxSize WinEDA_DrawPanel::GetGrid(void)
/************************************/ /************************************/
...@@ -211,6 +213,7 @@ wxPoint curpos; ...@@ -211,6 +213,7 @@ wxPoint curpos;
return curpos; return curpos;
} }
/********************************************************/ /********************************************************/
bool WinEDA_DrawPanel::IsPointOnDisplay(wxPoint ref_pos) bool WinEDA_DrawPanel::IsPointOnDisplay(wxPoint ref_pos)
/********************************************************/ /********************************************************/
...@@ -262,6 +265,7 @@ wxPoint curpos = GetScreen()->m_Curseur; ...@@ -262,6 +265,7 @@ wxPoint curpos = GetScreen()->m_Curseur;
return curpos; return curpos;
} }
/*********************************************************/ /*********************************************************/
wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition(void) wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition(void)
/*********************************************************/ /*********************************************************/
...@@ -292,6 +296,7 @@ wxPoint Mouse = CursorScreenPosition(); ...@@ -292,6 +296,7 @@ wxPoint Mouse = CursorScreenPosition();
MouseTo(Mouse); MouseTo(Mouse);
} }
/****************************************************/ /****************************************************/
void WinEDA_DrawPanel::MouseTo(const wxPoint & Mouse) void WinEDA_DrawPanel::MouseTo(const wxPoint & Mouse)
/****************************************************/ /****************************************************/
...@@ -467,15 +472,18 @@ wxPoint org; ...@@ -467,15 +472,18 @@ wxPoint org;
} }
/****************************************************/ /****************************************************/
void WinEDA_DrawPanel::ReDraw(wxDC * DC, bool erasebg) void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
/****************************************************/ /****************************************************/
{ {
BASE_SCREEN * Screen = GetScreen(); BASE_SCREEN * Screen = GetScreen();
if( Screen == NULL )
return;
if ( Screen == NULL ) return; if( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) )
g_DrawBgColor = BLACK;
if ( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) ) g_DrawBgColor = BLACK; if( g_DrawBgColor == WHITE )
if(g_DrawBgColor == WHITE)
{ {
g_XorMode = GR_NXOR; g_XorMode = GR_NXOR;
g_GhostColor = BLACK; g_GhostColor = BLACK;
...@@ -487,26 +495,28 @@ BASE_SCREEN * Screen = GetScreen(); ...@@ -487,26 +495,28 @@ BASE_SCREEN * Screen = GetScreen();
} }
#ifdef WX_ZOOM #ifdef WX_ZOOM
int zoom = GetZoom(); int zoom = GetZoom();
double f_scale = 1.0/(double)zoom; double f_scale = 1.0/(double)zoom;
DC->SetUserScale(f_scale, f_scale); DC->SetUserScale(f_scale, f_scale);
#endif #endif
if(erasebg)
PrepareGraphicContext(DC);
if(erasebg) PrepareGraphicContext(DC); DC->SetFont( *g_StdFont );
DC->SetFont(* g_StdFont);
SetBackgroundColour(wxColour(ColorRefs[g_DrawBgColor].m_Red, SetBackgroundColour( wxColour(ColorRefs[g_DrawBgColor].m_Red,
ColorRefs[g_DrawBgColor].m_Green, ColorRefs[g_DrawBgColor].m_Green,
ColorRefs[g_DrawBgColor].m_Blue )); ColorRefs[g_DrawBgColor].m_Blue ) );
GRResetPenAndBrush(DC); GRResetPenAndBrush( DC );
DC->SetBackground(*wxBLACK_BRUSH ); DC->SetBackground( *wxBLACK_BRUSH );
DC->SetBackgroundMode(wxTRANSPARENT); DC->SetBackgroundMode( wxTRANSPARENT );
m_Parent->RedrawActiveWindow(DC, erasebg); m_Parent->RedrawActiveWindow( DC, erasebg );
} }
/***********************************************/ /***********************************************/
void WinEDA_DrawPanel::DrawBackGround(wxDC * DC) void WinEDA_DrawPanel::DrawBackGround(wxDC * DC)
/***********************************************/ /***********************************************/
...@@ -622,6 +632,7 @@ BASE_SCREEN * screen = GetScreen(); ...@@ -622,6 +632,7 @@ BASE_SCREEN * screen = GetScreen();
0, Color ); 0, Color );
} }
/*******************************************************/ /*******************************************************/
void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event) void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event)
/*******************************************************/ /*******************************************************/
...@@ -721,7 +732,6 @@ static WinEDA_DrawPanel * LastPanel; ...@@ -721,7 +732,6 @@ static WinEDA_DrawPanel * LastPanel;
if( event.MiddleDown()) localbutt = GR_M_MIDDLE_DOWN; if( event.MiddleDown()) localbutt = GR_M_MIDDLE_DOWN;
if( event.ButtonDClick(2)) {}; // Unused if( event.ButtonDClick(2)) {}; // Unused
localrealbutt |= localbutt; /* compensation defaut wxGTK */ localrealbutt |= localbutt; /* compensation defaut wxGTK */
/* Compute absolute m_MousePosition in pixel units: */ /* Compute absolute m_MousePosition in pixel units: */
...@@ -919,7 +929,11 @@ BASE_SCREEN * Screen = GetScreen(); ...@@ -919,7 +929,11 @@ BASE_SCREEN * Screen = GetScreen();
ForceCloseManageCurseur(this, &DC); ForceCloseManageCurseur(this, &DC);
SetCursor(m_PanelCursor = m_PanelDefaultCursor); SetCursor(m_PanelCursor = m_PanelDefaultCursor);
} }
else m_Parent->SetToolID(0, m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW, wxEmptyString); else
{
m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW;
m_Parent->SetToolID(0, m_PanelCursor, wxEmptyString);
}
} }
m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels); m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels);
...@@ -928,6 +942,3 @@ BASE_SCREEN * Screen = GetScreen(); ...@@ -928,6 +942,3 @@ BASE_SCREEN * Screen = GetScreen();
event.Skip(); // Allow menu shortcut processing event.Skip(); // Allow menu shortcut processing
#endif #endif
} }
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