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"
......@@ -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 */
{
DISPLAY_OPTIONS save_opt;
save_opt = DisplayOpt;
if( printmasklayer & ALL_CU_LAYERS ) DisplayOpt.DisplayPadFill = FILLED;
else DisplayOpt.DisplayPadFill = SKETCH;
DisplayOpt.DisplayPadNum = 0;
DisplayOpt.DisplayPadNoConn = 0;
DisplayOpt.DisplayPadIsol = 0;
DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED;
DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayTrackIsol = 0;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZones = 1;
((WinEDA_GerberFrame*)m_Parent)->Trace_Gerber(DC, GR_COPY);
if ( Print_Sheet_Ref )
m_Parent->TraceWorkSheet(DC, GetScreen(), 0);
DisplayOpt = save_opt;
DISPLAY_OPTIONS save_opt;
save_opt = DisplayOpt;
if( printmasklayer & ALL_CU_LAYERS )
DisplayOpt.DisplayPadFill = FILLED;
else
DisplayOpt.DisplayPadFill = SKETCH;
DisplayOpt.DisplayPadNum = 0;
DisplayOpt.DisplayPadNoConn = 0;
DisplayOpt.DisplayPadIsol = 0;
DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED;
DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayTrackIsol = 0;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZones = 1;
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY );
if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, GetScreen(), 0 );
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 .. )
*/
*/
{
PCB_SCREEN * screen = GetScreen();
if ( ! m_Pcb ) return;
ActiveScreen = screen;
GRSetDrawMode(DC, GR_COPY);
PCB_SCREEN* screen = GetScreen();
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);
TraceWorkSheet(DC, screen, 0);
Affiche_Status_Box();
DrawPanel->DrawBackGround( DC );
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur(DrawPanel, DC, FALSE);
Trace_Gerber( DC, GR_OR );
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*/
{
if ( ! m_Pcb ) return;
// Draw tracks and flashes
Trace_Pistes(DrawPanel, DC, m_Pcb, mode);
// Draw filled polygons
#define NBMAX 2000
TRACK * track;
int nbpoints = 0;
int nbpointsmax = NBMAX;
int * coord = (int*) malloc(nbpointsmax * sizeof (int) * 2);
int * ptcoord = coord;
track = m_Pcb->m_Zone;
for ( ; track != NULL ; track = track->Next() )
{
if ( track->m_NetCode == 0 ) // StartPoint
{
if ( nbpoints )
{
int Color = g_DesignSettings.m_LayerColor[track->m_Layer];
GRClosedPoly(&DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color);
}
nbpoints = 2;
ptcoord = coord;
* ptcoord = track->m_Start.x; ptcoord++;
* ptcoord = track->m_Start.y; ptcoord++;
* ptcoord = track->m_End.x; ptcoord++;
* ptcoord = track->m_End.y; ptcoord++;
}
else
{
if ( nbpoints >= nbpointsmax )
{
nbpointsmax *= 2;
coord = (int*) realloc(coord, nbpointsmax * sizeof (int) * 2);
ptcoord = coord + nbpointsmax;
}
nbpoints++;
* ptcoord = track->m_End.x; ptcoord++;
* ptcoord = track->m_End.y; ptcoord++;
}
if ( track->Next() == NULL ) // Last point
{
int Color = g_DesignSettings.m_LayerColor[track->m_Layer];
GRClosedPoly(&DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color);
}
}
free(coord);
if ( DisplayOpt.DisplayPadNum )
Affiche_DCodes_Pistes(DrawPanel, DC, m_Pcb, GR_COPY);
GetScreen()->ClrRefreshReq();
if( !m_Pcb )
return;
// Draw tracks and flashes
Trace_Pistes( DrawPanel, DC, m_Pcb, mode );
// Draw filled polygons
#define NBMAX 2000
TRACK* track;
int nbpoints = 0;
int nbpointsmax = NBMAX;
int* coord = (int*) malloc( nbpointsmax * sizeof(int) * 2 );
int* ptcoord = coord;
track = m_Pcb->m_Zone;
for( ; track != NULL; track = track->Next() )
{
if( track->m_NetCode == 0 ) // StartPoint
{
if( nbpoints )
{
int Color = g_DesignSettings.m_LayerColor[track->m_Layer];
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color );
}
nbpoints = 2;
ptcoord = coord;
*ptcoord = track->m_Start.x; ptcoord++;
*ptcoord = track->m_Start.y; ptcoord++;
*ptcoord = track->m_End.x; ptcoord++;
*ptcoord = track->m_End.y; ptcoord++;
}
else
{
if( nbpoints >= nbpointsmax )
{
nbpointsmax *= 2;
coord = (int*) realloc( coord, nbpointsmax * sizeof(int) * 2 );
ptcoord = coord + nbpointsmax;
}
nbpoints++;
*ptcoord = track->m_End.x; ptcoord++;
*ptcoord = track->m_End.y; ptcoord++;
}
if( track->Next() == NULL ) // Last point
{
int Color = g_DesignSettings.m_LayerColor[track->m_Layer];
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color );
}
}
free( coord );
if( DisplayOpt.DisplayPadNum )
Affiche_DCodes_Pistes( DrawPanel, DC, m_Pcb, GR_COPY );
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__
#pragma implementation
......@@ -12,13 +13,13 @@
#include "macros.h"
#include "id.h"
/* defines locaux */
#define CURSOR_SIZE 12 /* taille de la croix du curseur PCB */
// defines locaux
#define CURSOR_SIZE 12 // taille de la croix du curseur PCB
/* Variables locales */
// Variables locales
/* table des evenements captes par un WinEDA_DrawPanel */
BEGIN_EVENT_TABLE(WinEDA_DrawPanel, EDA_DRAW_PANEL)
// table des evenements captes par un WinEDA_DrawPanel
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL )
EVT_LEAVE_WINDOW(WinEDA_DrawPanel::OnMouseLeaving)
EVT_MOUSE_EVENTS(WinEDA_DrawPanel::OnMouseEvent)
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,
WinEDA_DrawPanel::Process_Popup_Zoom)
END_EVENT_TABLE()
/***********************************************************/
/* 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;
}
/*********************************************************************************/
void WinEDA_DrawPanel::Trace_Curseur(wxDC * DC, int color)
/*********************************************************************************/
......@@ -109,6 +107,7 @@ wxPoint Cursor = GetScreen()->m_Curseur;
}
}
/*******************************************************************/
void WinEDA_DrawPanel::CursorOff(wxDC * DC)
/*******************************************************************/
......@@ -120,6 +119,7 @@ void WinEDA_DrawPanel::CursorOff(wxDC * DC)
--m_CursorLevel;
}
/*******************************************************************/
void WinEDA_DrawPanel::CursorOn(wxDC * DC)
/*******************************************************************/
......@@ -142,6 +142,7 @@ int WinEDA_DrawPanel::GetZoom(void)
return GetScreen()->GetZoom();
}
/***************************************/
void WinEDA_DrawPanel::SetZoom(int zoom)
/***************************************/
......@@ -149,6 +150,7 @@ void WinEDA_DrawPanel::SetZoom(int zoom)
GetScreen()->SetZoom(zoom);
}
/************************************/
wxSize WinEDA_DrawPanel::GetGrid(void)
/************************************/
......@@ -211,6 +213,7 @@ wxPoint curpos;
return curpos;
}
/********************************************************/
bool WinEDA_DrawPanel::IsPointOnDisplay(wxPoint ref_pos)
/********************************************************/
......@@ -262,6 +265,7 @@ wxPoint curpos = GetScreen()->m_Curseur;
return curpos;
}
/*********************************************************/
wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition(void)
/*********************************************************/
......@@ -292,6 +296,7 @@ wxPoint Mouse = CursorScreenPosition();
MouseTo(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)
if( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) )
g_DrawBgColor = BLACK;
if( g_DrawBgColor == WHITE )
{
g_XorMode = GR_NXOR;
g_GhostColor = BLACK;
......@@ -487,26 +495,28 @@ BASE_SCREEN * Screen = GetScreen();
}
#ifdef WX_ZOOM
int zoom = GetZoom();
double f_scale = 1.0/(double)zoom;
int zoom = GetZoom();
double f_scale = 1.0/(double)zoom;
DC->SetUserScale(f_scale, f_scale);
#endif
if(erasebg) PrepareGraphicContext(DC);
DC->SetFont(* g_StdFont);
if(erasebg)
PrepareGraphicContext(DC);
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_Blue ));
ColorRefs[g_DrawBgColor].m_Blue ) );
GRResetPenAndBrush(DC);
GRResetPenAndBrush( DC );
DC->SetBackground(*wxBLACK_BRUSH );
DC->SetBackgroundMode(wxTRANSPARENT);
m_Parent->RedrawActiveWindow(DC, erasebg);
DC->SetBackground( *wxBLACK_BRUSH );
DC->SetBackgroundMode( wxTRANSPARENT );
m_Parent->RedrawActiveWindow( DC, erasebg );
}
/***********************************************/
void WinEDA_DrawPanel::DrawBackGround(wxDC * DC)
/***********************************************/
......@@ -622,6 +632,7 @@ BASE_SCREEN * screen = GetScreen();
0, Color );
}
/*******************************************************/
void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event)
/*******************************************************/
......@@ -721,7 +732,6 @@ static WinEDA_DrawPanel * LastPanel;
if( event.MiddleDown()) localbutt = GR_M_MIDDLE_DOWN;
if( event.ButtonDClick(2)) {}; // Unused
localrealbutt |= localbutt; /* compensation defaut wxGTK */
/* Compute absolute m_MousePosition in pixel units: */
......@@ -919,7 +929,11 @@ BASE_SCREEN * Screen = GetScreen();
ForceCloseManageCurseur(this, &DC);
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);
......@@ -928,6 +942,3 @@ BASE_SCREEN * Screen = GetScreen();
event.Skip(); // Allow menu shortcut processing
#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