beautification

This commit is contained in:
dickelbeck 2007-08-15 02:43:57 +00:00
parent 0f406d3f89
commit ea6eeca17f
3 changed files with 731 additions and 653 deletions

View File

@ -1,11 +1,12 @@
/*****************************************/ /*****************************************/
/* 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,122 +23,126 @@
/**********************************************************************************/ /**********************************************************************************/
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;
DisplayOpt.DisplayPadNum = 0; else
DisplayOpt.DisplayPadNoConn = 0; DisplayOpt.DisplayPadFill = SKETCH;
DisplayOpt.DisplayPadIsol = 0; DisplayOpt.DisplayPadNum = 0;
DisplayOpt.DisplayModEdge = FILLED; DisplayOpt.DisplayPadNoConn = 0;
DisplayOpt.DisplayModText = FILLED; DisplayOpt.DisplayPadIsol = 0;
DisplayOpt.DisplayPcbTrackFill = FILLED; DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayTrackIsol = 0; DisplayOpt.DisplayModText = FILLED;
DisplayOpt.DisplayDrawItems = FILLED; DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayZones = 1; DisplayOpt.DisplayTrackIsol = 0;
DisplayOpt.DisplayDrawItems = FILLED;
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;
ActiveScreen = screen;
GRSetDrawMode(DC, GR_COPY);
if ( EraseBg ) DrawPanel->EraseScreen(DC); if( !m_Pcb )
return;
ActiveScreen = screen;
GRSetDrawMode( DC, GR_COPY );
DrawPanel->DrawBackGround(DC); if( EraseBg )
DrawPanel->EraseScreen( DC );
Trace_Gerber(DC, GR_OR); DrawPanel->DrawBackGround( DC );
TraceWorkSheet(DC, screen, 0);
Affiche_Status_Box();
if( DrawPanel->ManageCurseur ) Trace_Gerber( DC, GR_OR );
DrawPanel->ManageCurseur(DrawPanel, DC, FALSE); TraceWorkSheet( DC, screen, 0 );
Affiche_Status_Box();
DrawPanel->Trace_Curseur(DC); if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
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 )
return;
if ( ! m_Pcb ) return; // Draw tracks and flashes
Trace_Pistes( DrawPanel, DC, m_Pcb, mode );
// Draw tracks and flashes
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();
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
/******************************************************************/ /******************************************************************/
/* 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 @@
#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)
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,
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;
} }
} }
/*******************************************************************/ /*******************************************************************/
void WinEDA_DrawPanel::CursorOff(wxDC * DC) 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)
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)
GetScreen()->SetZoom(zoom); GetScreen()->SetZoom(zoom);
} }
/************************************/ /************************************/
wxSize WinEDA_DrawPanel::GetGrid(void) wxSize WinEDA_DrawPanel::GetGrid(void)
/************************************/ /************************************/
@ -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;
return curpos; return curpos;
} }
/*********************************************************/ /*********************************************************/
wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition(void) wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition(void)
/*********************************************************/ /*********************************************************/
@ -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;
} }
/****************************************************/ /****************************************************/
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) )
if(g_DrawBgColor == WHITE) g_DrawBgColor = BLACK;
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();
} }
#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)
if(erasebg) PrepareGraphicContext(DC); 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();
0, Color ); 0, Color );
} }
/*******************************************************/ /*******************************************************/
void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event) void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event)
/*******************************************************/ /*******************************************************/
@ -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();
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();
event.Skip(); // Allow menu shortcut processing event.Skip(); // Allow menu shortcut processing
#endif #endif
} }