Gerbview: remove dependencies from Pcbnew.

Should allow Pcbnew code easier to change and Gerbview code more understandable and easier to maintain.
Code cleaning (remove dead code, add comments).
Minor other enhancements.
This commit is contained in:
jean-pierre charras 2012-05-04 20:16:13 +02:00
commit 687a127b97
61 changed files with 2406 additions and 2256 deletions

View File

@ -412,6 +412,7 @@ set( BMAPS_MID
pin_to
pin
plot_hpg
plot_pdf
plot_ps
plot
polar_coord

View File

@ -36,6 +36,7 @@ set(COMMON_SRCS
build_version.cpp
class_bitmap_base.cpp
class_colors_design_settings.cpp
class_layer_box_selector.cpp
class_marker_base.cpp
class_plotter.cpp
class_undoredo_container.cpp
@ -89,7 +90,6 @@ set(PCB_COMMON_SRCS
class_page_info.cpp
pcbcommon.cpp
footprint_info.cpp
class_layer_box_selector.cpp
../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp
../pcbnew/class_board_connected_item.cpp

View File

@ -40,7 +40,7 @@
#include <base_units.h>
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA )
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW )
#define IU_TO_MM( x ) ( x / IU_PER_MM )
#define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 )
#define MM_TO_IU( x ) ( x * IU_PER_MM )

View File

@ -1,19 +1,13 @@
#include <common.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
#include <colors_selection.h>
#include <layers_id_colors_and_visibility.h>
#include <bitmaps.h>
#include <hotkeys.h>
#include <help_common_strings.h>
#include <class_board.h>
#include <colors.h>
#include <wx/wx.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/bmpcbox.h>
#include <wx/wx.h>
#include <wx/aui/aui.h>
#include <class_layer_box_selector.h>
@ -101,79 +95,30 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( int layer )
return -1;
}
// Reload the Layers
void LAYER_BOX_SELECTOR::Resync()
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
wxASSERT( board != NULL );
Clear();
static DECLARE_LAYERS_ORDER_LIST( layertranscode );
static DECLARE_LAYERS_HOTKEY( layerhk );
for( int i = 0; i < LAYER_COUNT; i++ )
{
wxBitmap layerbmp( 14, 14 );
wxMemoryDC bmpDC;
wxBrush brush;
wxString layername;
int layerid = i;
if( m_layerorder )
layerid = layertranscode[i];
if( !board->IsLayerEnabled( layerid ) )
continue;
// Prepare Bitmap
bmpDC.SelectObject( layerbmp );
brush.SetColour( MakeColour( board->GetLayerColor( layerid ) ) );
brush.SetStyle( wxSOLID );
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
bmpDC.SetPen( *wxBLACK_PEN );
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
layername = board->GetLayerName( layerid );
if( m_layerhotkeys && m_hotkeys != NULL )
layername = AddHotkeyName( layername, m_hotkeys, layerhk[layerid], IS_COMMENT );
Append( layername, layerbmp, (void*) layerid );
}
}
void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
int elements = GetCount();
for( int i = 0; i < elements; i++ )
{
wxBitmap layerbmp( 14, 14 );
wxMemoryDC bmpDC;
wxBrush brush;
wxString layername;
int layerid = i;
// Prepare Bitmap
bmpDC.SelectObject( layerbmp );
brush.SetColour( MakeColour( board->GetLayerColor( layerid ) ) );
brush.SetStyle( wxSOLID );
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
bmpDC.SetPen( *wxBLACK_PEN );
bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
SetItemBitmap(i, layerbmp);
wxBitmap layerbmp( 14, 14 );
SetBitmapLayer( layerbmp, i );
}
}
void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, int aLayerIndex )
{
wxMemoryDC bmpDC;
wxBrush brush;
// Prepare Bitmap
bmpDC.SelectObject( aLayerbmp );
brush.SetColour( MakeColour( GetLayerColor( aLayerIndex ) ) );
brush.SetStyle( wxSOLID );
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
bmpDC.SetPen( *wxBLACK_PEN );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
}

View File

@ -151,7 +151,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_PDF,
_( "Plot PDF" ),
_( "Plot schematic sheet in PDF format" ),
KiBitmap( plot_ps_xpm ) );
KiBitmap( plot_pdf_xpm ) );
// Plot HPGL
AddMenuItem( choice_plot_fmt,

View File

@ -1,4 +1,4 @@
add_definitions(-DGERBVIEW -DPCBNEW)
add_definitions(-DGERBVIEW)
###
# Includes
@ -22,10 +22,11 @@ set(DIALOGS_SRCS
dialogs/gerbview_dialog_display_options_frame_base.cpp
dialogs/gerbview_dialog_display_options_frame.cpp
dialogs/dialog_layers_select_to_pcb_base.cpp
dialogs/dialog_show_page_borders.cpp
dialogs/dialog_show_page_borders_base.cpp
dialogs/dialog_print_using_printer.cpp
dialogs/dialog_print_using_printer_base.cpp
dialogs/dialog_select_one_pcb_layer.cpp
dialogs/dialog_show_page_borders.cpp
dialogs/dialog_show_page_borders_base.cpp
)
set(GERBVIEW_SRCS
@ -34,9 +35,11 @@ set(GERBVIEW_SRCS
class_aperture_macro.cpp
class_DCodeSelectionbox.cpp
class_gbr_screen.cpp
class_gbr_layout.cpp
class_GERBER.cpp
class_gerber_draw_item.cpp
class_gerbview_layer_widget.cpp
class_gbr_layer_box_selector.cpp
controle.cpp
dcode.cpp
draw_gerber_screen.cpp
@ -53,7 +56,6 @@ set(GERBVIEW_SRCS
menubar.cpp
onleftclick.cpp
onrightclick.cpp
options.cpp
pcbplot.cpp
readgerb.cpp
rs274_read_XY_and_IJ_coordinates.cpp
@ -67,10 +69,12 @@ set(GERBVIEW_SRCS
# We need some extra sources from common and pcbnew
###
set(GERBVIEW_EXTRA_SRCS
../common/base_screen.cpp
../common/base_units.cpp
../common/class_layer_box_selector.cpp
../common/class_page_info.cpp
../pcbnew/layer_widget.cpp
../pcbnew/printout_controler.cpp
../pcbnew/class_drc_item.cpp
)
###
@ -117,7 +121,7 @@ endif(APPLE)
###
# Link executable target gerbview with correct libraries
###
target_link_libraries(gerbview pcbcommon common 3d-viewer polygon bitmaps kbool
target_link_libraries(gerbview common polygon bitmaps kbool
${OPENGL_LIBRARIES}
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES})

View File

@ -91,27 +91,7 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_COPY: /* Copy */
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
Block_Duplicate( DC );
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_PASTE:
case BLOCK_DRAG:
case BLOCK_PRESELECT_MOVE:
case BLOCK_ZOOM:
case BLOCK_ROTATE:
case BLOCK_FLIP:
case BLOCK_DELETE:
case BLOCK_SAVE:
case BLOCK_ABORT:
case BLOCK_SELECT_ITEMS_ONLY:
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y:
case BLOCK_IDLE:
default:
wxFAIL_MSG( wxT("HandleBlockPlace: Unexpected block command") );
break;
}
@ -136,7 +116,6 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
switch( GetScreen()->m_BlockLocate.GetCommand() )
{
case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
nextcmd = true;
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
@ -144,27 +123,11 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
break;
case BLOCK_DELETE: /* Delete */
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
Block_Delete( DC );
break;
case BLOCK_ZOOM: /* Window Zoom */
zoom_command = true;
break;
case BLOCK_PRESELECT_MOVE: /* Move with preselection list */
case BLOCK_DRAG:
case BLOCK_IDLE:
case BLOCK_MIRROR_X: /* Mirror, unused*/
case BLOCK_ROTATE: /* Unused */
case BLOCK_FLIP: /* Flip, unused */
case BLOCK_SAVE: /* Save (not used)*/
case BLOCK_PASTE:
case BLOCK_ABORT:
case BLOCK_SELECT_ITEMS_ONLY:
case BLOCK_MIRROR_Y:
default:
wxFAIL_MSG( wxT("HandleBlockEnd: Unexpected block command") );
break;
}
@ -228,31 +191,6 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
}
void GERBVIEW_FRAME::Block_Delete( wxDC* DC )
{
if( !IsOK( this, _( "Ok to delete block ?" ) ) )
return;
GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize();
GetScreen()->SetCurItem( NULL );
BOARD_ITEM* item = GetBoard()->m_Drawings;
BOARD_ITEM* nextitem;
for( ; item; item = nextitem )
{
nextitem = item->Next();
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
gerb_item->DeleteStructure();
}
Refresh();
}
void GERBVIEW_FRAME::Block_Move( wxDC* DC )
{
wxPoint delta;
@ -270,9 +208,7 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC )
delta = GetScreen()->m_BlockLocate.GetMoveVector();
/* Move items in block */
BOARD_ITEM* item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() )
for( GERBER_DRAW_ITEM* item = GetItemsList(); item; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
@ -282,38 +218,3 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC )
m_canvas->Refresh( true );
}
void GERBVIEW_FRAME::Block_Duplicate( wxDC* DC )
{
wxPoint delta;
wxPoint oldpos;
oldpos = GetScreen()->GetCrossHairPosition();
m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->SetCrossHairPosition( oldpos );
m_canvas->MoveCursorToCrossHair();
GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize();
delta = GetScreen()->m_BlockLocate.GetMoveVector();
/* Copy items in block */
BOARD_ITEM* item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
{
/* this item must be duplicated */
GERBER_DRAW_ITEM* new_item = gerb_item->Copy();
new_item->MoveAB( delta );
GetBoard()->m_Drawings.PushFront( new_item );
}
}
m_canvas->Refresh();
}

View File

@ -95,8 +95,6 @@ GERBER_IMAGE::GERBER_IMAGE( GERBVIEW_FRAME* aParent, int aLayer )
for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ )
m_Aperture_List[ii] = 0;
m_Pcb = aParent->GetBoard();
}
@ -108,10 +106,16 @@ GERBER_IMAGE::~GERBER_IMAGE()
// m_Aperture_List[ii] = NULL;
}
delete m_Pcb;
}
/*
* Function GetItemsList
* returns the first GERBER_DRAW_ITEM * item of the items list
*/
GERBER_DRAW_ITEM * GERBER_IMAGE::GetItemsList()
{
return m_Parent->GetItemsList();
}
D_CODE* GERBER_IMAGE::GetDCODE( int aDCODE, bool create )
{
@ -206,18 +210,16 @@ bool GERBER_IMAGE::HasNegativeItems()
else
{
m_hasNegativeItems = 0;
for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
for( GERBER_DRAW_ITEM* item = GetItemsList(); item; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer() != m_GraphicLayer )
if( item->GetLayer() != m_GraphicLayer )
continue;
if( gerb_item->HasNegativeItems() )
if( item->HasNegativeItems() )
{
m_hasNegativeItems = 1;
break;
}
}
// TODO search for items in list
}
}
return m_hasNegativeItems == 1;
@ -306,7 +308,7 @@ void GERBER_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem )
move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y,
GetLayerParams().m_StepForRepeatMetric );
dupItem->MoveXY( move_vector );
m_Parent->GetBoard()->m_Drawings.Append( dupItem );
m_Parent->GetLayout()->m_Drawings.Append( dupItem );
}
}
}

View File

@ -17,7 +17,6 @@
|| ( (x) == '-' ) || ( (x) == '+' ) || ( (x) == '.' ) )
class GERBVIEW_FRAME;
class BOARD;
class D_CODE;
/* gerber files have different parameters to define units and how items must be plotted.
@ -74,10 +73,9 @@ private:
*/
class GERBER_IMAGE
{
GERBVIEW_FRAME* m_Parent; // the parent GERBVIEW_FRAME (used to display messages...)
GERBVIEW_FRAME* m_Parent; // the parent GERBVIEW_FRAME (used to display messages...)
D_CODE* m_Aperture_List[TOOLS_MAX_COUNT]; ///< Dcode (Aperture) List for this layer (max 999)
bool m_Exposure; ///< whether an aperture macro tool is flashed on or off
BOARD* m_Pcb;
GERBER_LAYER m_GBRLayerParams; // hold params for the current gerber layer
@ -155,6 +153,12 @@ public:
return m_Parent;
}
/**
* Function GetItemsList
* @return the first GERBER_DRAW_ITEM * item of the items list
*/
GERBER_DRAW_ITEM * GetItemsList();
/**
* Function GetLayerParams
* @return the current layers params

View File

@ -53,7 +53,7 @@ enum drill_G_code_t {
// Helper struct to analyse Excellon commands
struct EXCELLON_CMD
{
string m_Name; // key string
std::string m_Name; // key string
int m_Code; // internal code, used as id in functions
int m_asParams; // 0 = no param, -1 = skip params, 1 = read params
};

View File

@ -0,0 +1,80 @@
/**
* @file class_gbr_layer_box_selector.cpp
* @brief a derived class of LAYER_BOX_SELECTOR to handle the layer box selector
* in GerbView
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 Jean-Pierre Charras <jean-pierre.charras@ujf-grenoble.fr>
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <common.h>
#include <colors_selection.h>
#include <layers_id_colors_and_visibility.h>
#include <gerbview_frame.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/bmpcbox.h>
#include <wx/wx.h>
#include <class_gbr_layer_box_selector.h>
void GBR_LAYER_BOX_SELECTOR::Resync()
{
Clear();
for( int layerid = 0; layerid < LAYER_COUNT; layerid++ )
{
wxBitmap layerbmp( 14, 14 );
wxString layername;
if( !IsLayerEnabled( layerid ) )
continue;
// Prepare Bitmap
SetBitmapLayer( layerbmp, layerid );
layername = GetLayerName( layerid );
Append( layername, layerbmp, (void*) layerid );
}
}
// Returns a color index from the layer id
int GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex )
{
GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent();
return frame->GetLayerColor( aLayerIndex );
}
// Returns the name of the layer id
const wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( int aLayerIndex )
{
wxString name;
name.Printf( _( "Layer %d" ), aLayerIndex + 1 );
return name;
}

View File

@ -0,0 +1,51 @@
#ifndef CLASS_GBR_LAYER_BOX_SELECTOR_H
#define CLASS_GBR_LAYER_BOX_SELECTOR_H 1
#include <class_layer_box_selector.h>
/* class to display a layer list in GerbView.
*
*/
class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{
public:
GBR_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL )
:LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{
m_layerhotkeys = false;
m_layerorder = false;
}
GBR_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices )
:LAYER_BOX_SELECTOR( parent, id, pos, size, choices )
{
m_layerhotkeys = false;
m_layerorder = false;
}
// Reload the Layers names and bitmaps
// Virtual function
void Resync();
// Returns a color index from the layer id
// Virtual function
int GetLayerColor( int aLayerIndex );
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
bool IsLayerEnabled( int aLayerIndex ) { return true; };
// Returns the name of the layer id
// Virtual function
const wxString GetLayerName( int aLayerIndex );
};
#endif //CLASS_GBR_LAYER_BOX_SELECTOR_H

View File

@ -0,0 +1,45 @@
/**
* @file class_gbr_layout.cpp
* @brief GBR_LAYOUT class functions.
*/
#include <limits.h>
#include <algorithm>
#include <fctsys.h>
#include <common.h>
#include <class_gbr_layout.h>
GBR_LAYOUT::GBR_LAYOUT()
{
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
m_printLayersMask = -1;
}
GBR_LAYOUT::~GBR_LAYOUT()
{
}
/* Function IsLayerVisible
* tests whether a given layer is visible
* param aLayerIndex = The index of the layer to be tested
* return bool - true if the layer is visible.
*/
bool GBR_LAYOUT::IsLayerVisible( int aLayerIndex ) const
{
return m_printLayersMask & (1 << aLayerIndex );
}
EDA_RECT GBR_LAYOUT::ComputeBoundingBox()
{
EDA_RECT bbox;
for( GERBER_DRAW_ITEM* gerb_item = m_Drawings; gerb_item; gerb_item = gerb_item->Next() )
bbox.Merge( gerb_item->GetBoundingBox() );
SetBoundingBox( bbox );
return bbox;
}

112
gerbview/class_gbr_layout.h Normal file
View File

@ -0,0 +1,112 @@
/**
* @file class_gbr_layout.h
* @brief Class CLASS_GBR_LAYOUT to handle a board.
*/
#ifndef CLASS_GBR_LAYOUT_H
#define CLASS_GBR_LAYOUT_H
#include <dlist.h>
// #include <layers_id_colors_and_visibility.h>
#include <class_colors_design_settings.h>
#include <common.h> // PAGE_INFO
#include <class_title_block.h>
#include <class_gerber_draw_item.h>
/**
* Class GBR_LAYOUT
* holds list of GERBER_DRAW_ITEM currently loaded.
*/
class GBR_LAYOUT
{
private:
EDA_RECT m_BoundingBox;
PAGE_INFO m_paper;
TITLE_BLOCK m_titles;
wxPoint m_originAxisPosition;
int m_printLayersMask; // When printing: the list of layers to print
public:
DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items
GBR_LAYOUT();
~GBR_LAYOUT();
const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
const wxPoint& GetOriginAxisPosition() const
{
return m_originAxisPosition;
}
void SetOriginAxisPosition( const wxPoint& aPosition )
{
m_originAxisPosition = aPosition;
}
TITLE_BLOCK& GetTitleBlock()
{
return m_titles;
}
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
{
m_titles = aTitleBlock;
}
/**
* Function ComputeBoundingBox
* calculates the bounding box containing all Gerber items.
* @return EDA_RECT - the full item list bounding box
*/
EDA_RECT ComputeBoundingBox();
/**
* Function GetBoundingBox
* may be called soon after ComputeBoundingBox() to return the same EDA_RECT,
* as long as the CLASS_GBR_LAYOUT has not changed.
*/
EDA_RECT GetBoundingBox() const { return m_BoundingBox; } // override
void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; }
/**
* Function Draw.
* Redraw the CLASS_GBR_LAYOUT items but not cursors, axis or grid.
* @param aPanel = the panel relative to the board
* @param aDC = the current device context
* @param aDrawMode = GR_COPY, GR_OR ... (not always used)
* @param aOffset = an draw offset value
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
int aDrawMode, const wxPoint& aOffset );
/**
* Function SetVisibleLayers
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( int aLayerMask )
{
m_printLayersMask = aLayerMask;
}
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( int aLayerIndex ) const;
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload
#endif
};
#endif // #ifndef CLASS_GBR_LAYOUT_H

View File

@ -88,18 +88,13 @@ static GRID_TYPE gbrGridList[] =
};
GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) :
PCB_SCREEN( aPageSizeIU )
GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) : BASE_SCREEN( SCREEN_T )
{
// Replace zoom and grid lists already set by PCB_SCREEN ctor
m_ZoomList.Clear();
for( unsigned i = 0; i < DIM( gbrZoomList ); ++i )
m_ZoomList.Add( gbrZoomList[i] );
GRIDS gridlist;
for( unsigned i = 0; i < DIM( gbrGridList ); ++i )
gridlist.push_back( gbrGridList[i] );
SetGridList( gridlist );
AddGrid( gbrGridList[i] );
// Set the working grid size to a reasonnable value (in 1/10000 inch)
SetGrid( DMIL_GRID( 500 ) );
@ -107,11 +102,14 @@ GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) :
m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
SetZoom( ZOOM_FACTOR( 350 ) ); // a default value for zoom
InitDataPoints( aPageSizeIU );
}
GBR_SCREEN::~GBR_SCREEN()
{
ClearUndoRedoList();
}
@ -120,3 +118,13 @@ int GBR_SCREEN::MilsToIuScalar()
{
return (int)IU_PER_MILS;
}
/* Virtual function needed by classes derived from BASE_SCREEN
* this is a virtual pure function in BASE_SCREEN
* do nothing in GerbView
* could be removed later
*/
void GBR_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int )
{
}

View File

@ -7,16 +7,16 @@
#include <base_units.h>
#include <class_pcb_screen.h>
#include <class_base_screen.h>
#define ZOOM_FACTOR( x ) ( x * IU_PER_DECIMILS )
/* Handle info to display a board */
class GBR_SCREEN : public PCB_SCREEN
class GBR_SCREEN : public BASE_SCREEN
{
public:
int m_Active_Layer;
/**
* Constructor
* @param aPageSizeIU is the size of the initial paper page in internal units.
@ -27,7 +27,18 @@ public:
GBR_SCREEN* Next() { return (GBR_SCREEN*) Pnext; }
// void SetNextZoom();
// void SetPreviousZoom();
// void SetLastZoom();
virtual int MilsToIuScalar();
/**
* Function ClearUndoORRedoList
* virtual pure in BASE_SCREEN, so it must be defined here
*/
void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 );
};
#endif // CLASS_GBR_SCREEN_H_

View File

@ -32,18 +32,15 @@
#include <common.h>
#include <trigo.h>
#include <class_drawpanel.h>
#include <drawtxt.h>
#include <macros.h>
#include <gerbview.h>
#include <class_board_design_settings.h>
#include <colors_selection.h>
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( BOARD_ITEM* aParent, GERBER_IMAGE* aGerberparams ) :
BOARD_ITEM( aParent, TYPE_GERBER_DRAW_ITEM )
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_IMAGE* aGerberparams ) :
EDA_ITEM( (EDA_ITEM*)aParent, TYPE_GERBER_DRAW_ITEM )
{
m_imageParams = aGerberparams;
m_Layer = 0;
@ -64,7 +61,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( BOARD_ITEM* aParent, GERBER_IMAGE* aGerberpa
// Copy constructor
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
BOARD_ITEM( aSource )
EDA_ITEM( aSource )
{
m_imageParams = aSource.m_imageParams;
m_Shape = aSource.m_Shape;
@ -316,16 +313,16 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
int radius;
int halfPenWidth;
static bool show_err;
BOARD* brd = GetBoard();
D_CODE* d_codeDescr = GetDcodeDescr();
GERBVIEW_FRAME* gerbFrame = (GERBVIEW_FRAME*) aPanel->GetParent();
if( d_codeDescr == NULL )
d_codeDescr = &dummyD_CODE;
if( brd->IsLayerVisible( GetLayer() ) == false )
if( gerbFrame->IsLayerVisible( GetLayer() ) == false )
return;
color = brd->GetLayerColor( GetLayer() );
color = gerbFrame->GetLayerColor( GetLayer() );
if( aDrawMode & GR_HIGHLIGHT )
{
@ -354,12 +351,12 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
GRSetDrawMode( aDC, aDrawMode );
isFilled = DisplayOpt.DisplayPcbTrackFill ? true : false;
isFilled = gerbFrame->m_DisplayOptions.m_DisplayLinesFill;
switch( m_Shape )
{
case GBR_POLYGON:
isFilled = (g_DisplayPolygonsModeSketch == false);
isFilled = gerbFrame->m_DisplayOptions.m_DisplayPolygonsFill;
if( !isDark )
isFilled = true;
@ -419,7 +416,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
case GBR_SPOT_OVAL:
case GBR_SPOT_POLY:
case GBR_SPOT_MACRO:
isFilled = DisplayOpt.DisplayPadFill ? true : false;
isFilled = gerbFrame->m_DisplayOptions.m_DisplayFlashedItemsFill;
d_codeDescr->DrawFlashedShape( this, aPanel->GetClipBox(), aDC, color, alt_color,
m_Start, isFilled );
break;

View File

@ -30,10 +30,12 @@
#define CLASS_GERBER_DRAW_ITEM_H
#include <base_struct.h>
#include <class_board_item.h>
#include <dlist.h>
class GERBER_IMAGE;
class GBR_LAYOUT;
class D_CODE;
/* Shapes id for basic shapes ( .m_Shape member ) */
@ -52,7 +54,7 @@ enum Gbr_Basic_Shapes {
/***/
class GERBER_DRAW_ITEM : public BOARD_ITEM
class GERBER_DRAW_ITEM : public EDA_ITEM
{
// make SetNext() and SetBack() private so that they may not be called from anywhere.
// list management is done on GERBER_DRAW_ITEMs using DLIST<GERBER_DRAW_ITEM> only.
@ -86,6 +88,8 @@ public:
* redundancy for these parameters
*/
private:
int m_Layer;
// These values are used to draw this item, according to gerber layers parameters
// Because they can change inside a gerber image, they are stored here
// for each item
@ -98,7 +102,7 @@ private:
double m_lyrRotation; // Fine rotation, from OR parameter, in degrees
public:
GERBER_DRAW_ITEM( BOARD_ITEM* aParent, GERBER_IMAGE* aGerberparams );
GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_IMAGE* aGerberparams );
GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource );
~GERBER_DRAW_ITEM();
@ -113,6 +117,21 @@ public:
GERBER_DRAW_ITEM* Next() const { return (GERBER_DRAW_ITEM*) Pnext; }
GERBER_DRAW_ITEM* Back() const { return (GERBER_DRAW_ITEM*) Pback; }
/**
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
* is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialization
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
int ReturnMaskLayer()
{
return 1 << m_Layer;
@ -203,7 +222,7 @@ public:
void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
int aDrawMode,
const wxPoint&aOffset = ZeroOffset );
const wxPoint&aOffset );
/**
* Function ConvertSegmentToPolygon
@ -270,6 +289,28 @@ public:
*/
bool Save( FILE* aFile ) const;
/**
* Function UnLink
* detaches this object from its owner.
*/
void UnLink()
{
DLIST<GERBER_DRAW_ITEM>* list = (DLIST<GERBER_DRAW_ITEM>*) GetList();
wxASSERT( list );
if( list )
list->Remove( this );
}
/**
* Function DeleteStructure
* deletes this object after UnLink()ing it from its owner.
*/
void DeleteStructure()
{
UnLink();
delete this;
}
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override
#endif

View File

@ -34,7 +34,7 @@
#include <class_drawpanel.h>
#include <pcbstruct.h>
#include <macros.h>
#include <class_layer_box_selector.h>
#include <class_gbr_layer_box_selector.h>
#include <gerbview.h>
#include <class_GERBER.h>
@ -91,7 +91,6 @@ void GERBER_LAYER_WIDGET::SetLayersManagerTabsText( )
*/
void GERBER_LAYER_WIDGET::ReFillRender()
{
BOARD* board = myframe->GetBoard();
ClearRenderRows();
// Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color
@ -111,10 +110,9 @@ void GERBER_LAYER_WIDGET::ReFillRender()
{
if( renderRows[row].color != -1 ) // does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRows[row].color = board->GetVisibleElementColor( renderRows[row].id );
renderRows[row].color = myframe->GetVisibleElementColor( renderRows[row].id );
}
renderRows[row].state = board->IsElementVisible( renderRows[row].id );
renderRows[row].state = myframe->IsElementVisible( renderRows[row].id );
}
AppendRenderRows( renderRows, DIM(renderRows) );
@ -184,7 +182,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
visibleLayers &= ~(1 << row);
}
myframe->GetBoard()->SetVisibleLayers( visibleLayers );
myframe->SetVisibleLayers( visibleLayers );
myframe->GetCanvas()->Refresh();
break;
}
@ -194,16 +192,15 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
void GERBER_LAYER_WIDGET::ReFill()
{
BOARD* brd = myframe->GetBoard();
int layer;
ClearLayerRows();
for( layer = 0; layer < LAYER_COUNT; layer++ )
for( layer = 0; layer < GERBVIEW_LAYER_COUNT; layer++ )
{
wxString msg;
msg.Printf( _("Layer %d"), layer+1 );
AppendLayerRow( LAYER_WIDGET::ROW( msg, layer,
brd->GetLayerColor( layer ), wxEmptyString, true ) );
myframe->GetLayerColor( layer ), wxEmptyString, true ) );
}
installRightLayerClickHandler();
@ -213,7 +210,7 @@ void GERBER_LAYER_WIDGET::ReFill()
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, int aColor )
{
myframe->GetBoard()->SetLayerColor( aLayer, aColor );
myframe->SetLayerColor( aLayer, aColor );
myframe->m_SelLayerBox->ResyncBitmapOnly();
myframe->GetCanvas()->Refresh();
}
@ -234,15 +231,14 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
int visibleLayers = brd->GetVisibleLayers();
int visibleLayers = myframe->GetVisibleLayers();
if( isVisible )
visibleLayers |= (1 << aLayer);
else
visibleLayers &= ~(1 << aLayer);
brd->SetVisibleLayers( visibleLayers );
myframe->SetVisibleLayers( visibleLayers );
if( isFinal )
myframe->GetCanvas()->Refresh();
@ -250,15 +246,13 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, int aColor )
{
myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
myframe->SetVisibleElementColor( aId, aColor );
myframe->GetCanvas()->Refresh();
}
void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
BOARD* brd = myframe->GetBoard();
brd->SetElementVisibility( aId, isEnabled );
myframe->SetElementVisibility( aId, isEnabled );
myframe->GetCanvas()->Refresh();
}

View File

@ -286,11 +286,9 @@ void GERBVIEW_FRAME::CopyDCodesSizeToItems()
{
static D_CODE dummy( 999 ); //Used if D_CODE not found in list
BOARD_ITEM* item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() )
GERBER_DRAW_ITEM* gerb_item = GetItemsList();
for( ; gerb_item; gerb_item = gerb_item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
D_CODE* dcode = gerb_item->GetDcodeDescr();
wxASSERT( dcode );
if( dcode == NULL )

View File

@ -134,7 +134,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
/************************************************************************/
{
SetFocus();
int layer_max = NB_LAYERS;
int layer_max = GERBVIEW_LAYER_COUNT;
wxString msg;
if( g_pageSetupData == NULL )
@ -204,17 +204,6 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
}
}
// Disable checkboxes if the corresponding layer is not enabled
BOARD* board = ((PCB_BASE_FRAME*)m_Parent)->GetBoard();
for( int layer = 0; layer<NB_LAYERS; layer++, mask <<= 1 )
{
if( ! board->IsLayerEnabled( layer ) )
{
m_BoxSelectLayer[layer]->Enable( false );
m_BoxSelectLayer[layer]->SetValue( false );
}
}
m_ScaleOption->SetSelection( scale_idx );
scale_idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[scale_idx];
@ -274,7 +263,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
int page_count;
s_Parameters.m_PrintMaskLayer = 0;
int ii;
for( ii = 0, page_count = 0; ii < LAYER_COUNT; ii++ )
for( ii = 0, page_count = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
{
if( m_BoxSelectLayer[ii]->IsChecked() )
{
@ -303,7 +292,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
m_Config->Write( OPTKEY_PRINT_PAGE_FRAME, s_Parameters.m_Print_Sheet_Ref);
m_Config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White);
wxString layerKey;
for( int layer = 0; layer < LAYER_COUNT; ++layer )
for( int layer = 0; layer < GERBVIEW_LAYER_COUNT; ++layer )
{
layerKey.Printf( OPTKEY_LAYERBASE, layer );
m_Config->Write( layerKey, m_BoxSelectLayer[layer]->IsChecked() );

View File

@ -0,0 +1,229 @@
/**
* @file select_pcb_layer.cpp
* @brief Set up a dialog to choose a PCB Layer.
*/
#include <fctsys.h>
#include <gerbview_frame.h>
#include <select_layers_to_pcb.h>
// Exported function
const wxString GetPCBDefaultLayerName( int aLayerNumber );
enum layer_sel_id {
ID_LAYER_SELECT_TOP = 1800,
ID_LAYER_SELECT_BOTTOM,
ID_LAYER_SELECT
};
class SELECT_LAYER_DIALOG : public wxDialog
{
private:
GERBVIEW_FRAME* m_Parent;
wxRadioBox* m_LayerList;
int m_LayerId[NB_LAYERS + 1]; // One extra element for "(Deselect)" radiobutton
public:
// Constructor and destructor
SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, int aDefaultLayer,
int aCopperLayerCount, bool aShowDeselectOption );
~SELECT_LAYER_DIALOG() { };
private:
void OnLayerSelected( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE( SELECT_LAYER_DIALOG, wxDialog )
EVT_BUTTON( wxID_OK, SELECT_LAYER_DIALOG::OnLayerSelected )
EVT_BUTTON( wxID_CANCEL, SELECT_LAYER_DIALOG::OnCancelClick )
EVT_RADIOBOX( ID_LAYER_SELECT, SELECT_LAYER_DIALOG::OnLayerSelected )
END_EVENT_TABLE()
/** Install the dialog box for layer selection
* @param aDefaultLayer = Preselection (NB_LAYERS for "(Deselect)" layer)
* @param aCopperLayerCount = number of copper layers
* @param aShowDeselectOption = display a "(Deselect)" radiobutton (when set to true)
* @return new layer value (NB_LAYERS when "(Deselect)" radiobutton selected),
* or -1 if canceled
*
* Providing the option to also display a "(Deselect)" radiobutton makes the
* GerbView's "Export to Pcbnew" command) more "user friendly",
* by permitting any layer to be "deselected" immediately after its
* corresponding radiobutton has been clicked on. (It would otherwise be
* necessary to first cancel the "Select Layer:" dialog box (invoked after a
* different radiobutton is clicked on) prior to then clicking on the "Deselect"
* button provided within the "Layer selection:" dialog box).
*/
int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption )
{
int layer;
SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, aDefaultLayer,
aCopperLayerCount,
aShowDeselectOption );
layer = frame->ShowModal();
frame->Destroy();
return layer;
}
/*
* The "OK" and "Cancel" buttons are positioned (in a horizontal line)
* beneath the "Layer" radiobox, unless that contains only one column of
* radiobuttons, in which case they are positioned (in a vertical line)
* to the right of that radiobox.
*/
SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
int aDefaultLayer, int aCopperLayerCount,
bool aShowDeselectOption ) :
wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ),
wxSize( 470, 250 ),
DIALOG_STYLE )
{
wxButton* Button;
int ii;
wxString LayerList[NB_LAYERS + 1]; // One extra element for "(Deselect)"
// radiobutton
int LayerCount, LayerSelect = -1;
m_Parent = parent;
// Build the layer list; first build copper layers list
LayerCount = 0;
for( ii = 0; ii < BOARD_COPPER_LAYERS_MAX_COUNT; ii++ )
{
m_LayerId[ii] = 0;
if( ii == 0 || ii == BOARD_COPPER_LAYERS_MAX_COUNT-1 || ii < aCopperLayerCount-1 )
{
LayerList[LayerCount] = GetPCBDefaultLayerName( ii );
if( ii == aDefaultLayer )
LayerSelect = LayerCount;
m_LayerId[LayerCount] = ii;
LayerCount++;
}
}
// Build the layer list; build copper layers list
for( ; ii < NB_LAYERS; ii++ )
{
m_LayerId[ii] = 0;
LayerList[LayerCount] = GetPCBDefaultLayerName( ii );
if( ii == aDefaultLayer )
LayerSelect = LayerCount;
m_LayerId[LayerCount] = ii;
LayerCount++;
}
// When appropriate, also provide a "(Deselect)" radiobutton
if( aShowDeselectOption )
{
LayerList[LayerCount] = _( "(Deselect)" );
if( NB_LAYERS == aDefaultLayer )
LayerSelect = LayerCount;
m_LayerId[LayerCount] = NB_LAYERS;
LayerCount++;
}
m_LayerList = new wxRadioBox( this, ID_LAYER_SELECT, _( "Layer" ),
wxPoint( -1, -1 ), wxSize( -1, -1 ),
LayerCount, LayerList,
(LayerCount < 8) ? LayerCount : 8,
wxRA_SPECIFY_ROWS );
if( LayerSelect >= 0 )
m_LayerList->SetSelection( LayerSelect );
wxBoxSizer* FrameBoxSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( FrameBoxSizer );
FrameBoxSizer->Add( m_LayerList, 0, wxALIGN_TOP | wxALL, 5 );
wxBoxSizer* ButtonBoxSizer = new wxBoxSizer( wxVERTICAL );
FrameBoxSizer->Add( ButtonBoxSizer, 0, wxALIGN_BOTTOM | wxALL, 0 );
Button = new wxButton( this, wxID_OK, _( "OK" ) );
Button->SetDefault();
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
ButtonBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
SetFocus();
GetSizer()->SetSizeHints( this );
Center();
}
void SELECT_LAYER_DIALOG::OnLayerSelected( wxCommandEvent& event )
{
int ii = m_LayerId[m_LayerList->GetSelection()];
EndModal( ii );
}
void SELECT_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event )
{
EndModal( -1 );
}
const wxString GetPCBDefaultLayerName( int aLayerNumber )
{
const wxChar* txt;
// These are only default layer names. For Pcbnew the copper names
// may be over-ridden in the BOARD (*.brd) file.
// Use a switch to explicitly show the mapping more clearly
switch( aLayerNumber )
{
case LAYER_N_FRONT: txt = _( "Front" ); break;
case LAYER_N_2: txt = _( "Inner2" ); break;
case LAYER_N_3: txt = _( "Inner3" ); break;
case LAYER_N_4: txt = _( "Inner4" ); break;
case LAYER_N_5: txt = _( "Inner5" ); break;
case LAYER_N_6: txt = _( "Inner6" ); break;
case LAYER_N_7: txt = _( "Inner7" ); break;
case LAYER_N_8: txt = _( "Inner8" ); break;
case LAYER_N_9: txt = _( "Inner9" ); break;
case LAYER_N_10: txt = _( "Inner10" ); break;
case LAYER_N_11: txt = _( "Inner11" ); break;
case LAYER_N_12: txt = _( "Inner12" ); break;
case LAYER_N_13: txt = _( "Inner13" ); break;
case LAYER_N_14: txt = _( "Inner14" ); break;
case LAYER_N_15: txt = _( "Inner15" ); break;
case LAYER_N_BACK: txt = _( "Back" ); break;
case ADHESIVE_N_BACK: txt = _( "Adhes_Back" ); break;
case ADHESIVE_N_FRONT: txt = _( "Adhes_Front" ); break;
case SOLDERPASTE_N_BACK: txt = _( "SoldP_Back" ); break;
case SOLDERPASTE_N_FRONT: txt = _( "SoldP_Front" ); break;
case SILKSCREEN_N_BACK: txt = _( "SilkS_Back" ); break;
case SILKSCREEN_N_FRONT: txt = _( "SilkS_Front" ); break;
case SOLDERMASK_N_BACK: txt = _( "Mask_Back" ); break;
case SOLDERMASK_N_FRONT: txt = _( "Mask_Front" ); break;
case DRAW_N: txt = _( "Drawings" ); break;
case COMMENT_N: txt = _( "Comments" ); break;
case ECO1_N: txt = _( "Eco1" ); break;
case ECO2_N: txt = _( "Eco2" ); break;
case EDGE_N: txt = _( "PCB_Edges" ); break;
default: txt = _( "BAD INDEX" ); break;
}
return wxString( txt );
}

View File

@ -72,9 +72,6 @@ void DIALOG_PAGE_SHOW_PAGE_BORDERS::OnCancelButtonClick( wxCommandEvent& event )
void DIALOG_PAGE_SHOW_PAGE_BORDERS::OnOKBUttonClick( wxCommandEvent& event )
{
m_Parent->m_DisplayPadFill = m_Parent->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_Parent->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
int idx = m_ShowPageLimits->GetSelection();
m_Parent->SetShowBorderAndTitleBlock( idx > 0 ? true : false );

View File

@ -69,16 +69,16 @@ void DIALOG_DISPLAY_OPTIONS::OnCancelButtonClick( wxCommandEvent& event )
void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
{
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
m_PolarDisplay->SetSelection( m_Parent->m_DisplayOptions.m_DisplayPolarCood ? 1 : 0 );
m_BoxUnits->SetSelection( g_UserUnit ? 1 : 0 );
m_CursorShape->SetSelection( m_Parent->GetCursorShape() ? 1 : 0 );
// Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
m_OptDisplayLines->SetSelection( DisplayOpt.DisplayPcbTrackFill ? 1 : 0 );
m_OptDisplayFlashedItems->SetSelection( DisplayOpt.DisplayPadFill ? 1 : 0);
m_OptDisplayLines->SetSelection( m_Parent->m_DisplayOptions.m_DisplayLinesFill ? 1 : 0 );
m_OptDisplayFlashedItems->SetSelection( m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill ? 1 : 0);
// Show Option Draw polygons
m_OptDisplayPolygons->SetSelection( g_DisplayPolygonsModeSketch ? 0 : 1 );
m_OptDisplayPolygons->SetSelection( m_Parent->m_DisplayOptions.m_DisplayPolygonsFill ? 1 : 0 );
m_ShowPageLimits->SetSelection(0);
@ -106,38 +106,33 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
{
DisplayOpt.DisplayPolarCood =
m_Parent->m_DisplayOptions.m_DisplayPolarCood =
(m_PolarDisplay->GetSelection() == 0) ? false : true;
g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES;
m_Parent->SetCursorShape( m_CursorShape->GetSelection() );
if( m_OptDisplayLines->GetSelection() == 1 )
DisplayOpt.DisplayPcbTrackFill = true;
m_Parent->m_DisplayOptions.m_DisplayLinesFill = true;
else
DisplayOpt.DisplayPcbTrackFill = false;
m_Parent->m_DisplayOptions.m_DisplayLinesFill = false;
if( m_OptDisplayFlashedItems->GetSelection() == 1 )
{
DisplayOpt.DisplayPadFill = true;
DisplayOpt.DisplayViaFill = true;
m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = true;
}
else
{
DisplayOpt.DisplayViaFill = false;
DisplayOpt.DisplayPadFill = false;
m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = false;
}
if( m_OptDisplayPolygons->GetSelection() == 0 )
g_DisplayPolygonsModeSketch = 1;
m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = false;
else
g_DisplayPolygonsModeSketch = 0;
m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = true;
m_Parent->SetElementVisibility( DCODES_VISIBLE, m_OptDisplayDCodes->GetValue() );
m_Parent->m_DisplayPadFill = m_Parent->m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_Parent->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
int idx = m_ShowPageLimits->GetSelection();
m_Parent->SetShowBorderAndTitleBlock( idx > 0 ? true : false );

View File

@ -36,7 +36,6 @@
#include <base_units.h>
#include <gerbview.h>
#include <class_board_design_settings.h>
#include <colors_selection.h>
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
@ -46,35 +45,34 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, int aPrintMasklayer,
bool aPrintMirrorMode, void* aData )
{
// Save current draw options, because print mode has specific options:
int DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
int visiblemask = GetBoard()->GetVisibleLayers();
DISPLAY_OPTIONS save_opt = DisplayOpt;
int visiblemask = GetVisibleLayers();
GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
// Set draw options for printing:
GetBoard()->SetVisibleLayers( aPrintMasklayer );
DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0;
g_DisplayPolygonsModeSketch = 0;
SetVisibleLayers( aPrintMasklayer );
m_DisplayOptions.m_DisplayFlashedItemsFill = true;
m_DisplayOptions.m_DisplayLinesFill = true;
m_DisplayOptions.m_DisplayPolygonsFill = true;
m_DisplayOptions.m_DisplayDCodes = false;
m_DisplayOptions.m_IsPrinting = true;
m_canvas->SetPrintMirrored( aPrintMirrorMode );
GetBoard()->Draw( m_canvas, aDC, -1, wxPoint( 0, 0 ) );
GetLayout()->Draw( m_canvas, aDC, -1, wxPoint( 0, 0 ) );
m_canvas->SetPrintMirrored( false );
// Restore draw options:
GetBoard()->SetVisibleLayers( visiblemask );
DisplayOpt = save_opt;
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;
SetVisibleLayers( visiblemask );
m_DisplayOptions = imgDisplayOptions;
}
void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
PCB_SCREEN* screen = (PCB_SCREEN*) GetScreen();
GBR_SCREEN* screen = (GBR_SCREEN*) GetScreen();
if( !GetBoard() )
if( !GetLayout() )
return;
wxBusyCursor dummy;
@ -97,7 +95,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
}
// Draw according to the current setting. This needs to be GR_COPY or GR_OR.
GetBoard()->Draw( m_canvas, DC, drawMode, wxPoint( 0, 0 ) );
GetLayout()->Draw( m_canvas, DC, drawMode, wxPoint( 0, 0 ) );
// Draw the "background" now, i.e. grid and axis after gerber layers
// because most of time the actual background is erased by successive drawings of each gerber
@ -123,7 +121,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*
* Redraw All GerbView layers, using a buffered mode or not
*/
void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoint& aOffset )
void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoint& aOffset )
{
// Because Images can be negative (i.e with background filled in color) items are drawn
// graphic layer per graphic layer, after the background is filled
@ -202,7 +200,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
layer = active_layer;
}
if( !GetBoard()->IsLayerVisible( layer ) )
if( !gerbFrame->IsLayerVisible( layer ) )
continue;
GERBER_IMAGE* gerber = g_GERBER_List[layer];
@ -259,7 +257,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
if( gerber->m_ImageNegative )
{
// Draw background negative (i.e. in graphic layer color) for negative images.
int color = GetBoard()->GetLayerColor( layer );
int color = gerbFrame->GetLayerColor( layer );
GRSetDrawMode( &layerDC, GR_COPY );
GRFilledRect( &drawBox, plotDC, drawBox.GetX(), drawBox.GetY(),
@ -282,19 +280,17 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
// Now we can draw the current layer to the bitmap buffer
// When needed, the previous bitmap is already copied to the screen buffer.
for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = item->Next() )
for( GERBER_DRAW_ITEM* item = gerbFrame->GetItemsList(); item; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer() != layer )
if( item->GetLayer() != layer )
continue;
int drawMode = layerdrawMode;
if( dcode_highlight && dcode_highlight == gerb_item->m_DCode )
if( dcode_highlight && dcode_highlight == item->m_DCode )
drawMode |= GR_HIGHLIGHT;
gerb_item->Draw( aPanel, plotDC, drawMode );
item->Draw( aPanel, plotDC, drawMode, wxPoint(0,0) );
doBlit = true;
}
}
@ -355,47 +351,44 @@ void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
wxString Line;
GRSetDrawMode( aDC, aDrawMode );
BOARD_ITEM* item = GetBoard()->m_Drawings;
for( ; item != NULL; item = item->Next() )
for( GERBER_DRAW_ITEM* item = GetItemsList(); item != NULL; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( GetBoard()->IsLayerVisible( gerb_item->GetLayer() ) == false )
if( IsLayerVisible( item->GetLayer() ) == false )
continue;
if( gerb_item->m_DCode <= 0 )
if( item->m_DCode <= 0 )
continue;
if( gerb_item->m_Flashed || gerb_item->m_Shape == GBR_ARC )
if( item->m_Flashed || item->m_Shape == GBR_ARC )
{
pos = gerb_item->m_Start;
pos = item->m_Start;
}
else
{
pos.x = (gerb_item->m_Start.x + gerb_item->m_End.x) / 2;
pos.y = (gerb_item->m_Start.y + gerb_item->m_End.y) / 2;
pos.x = (item->m_Start.x + item->m_End.x) / 2;
pos.y = (item->m_Start.y + item->m_End.y) / 2;
}
pos = gerb_item->GetABPosition( pos );
pos = item->GetABPosition( pos );
Line.Printf( wxT( "D%d" ), gerb_item->m_DCode );
Line.Printf( wxT( "D%d" ), item->m_DCode );
if( gerb_item->GetDcodeDescr() )
width = gerb_item->GetDcodeDescr()->GetShapeDim( gerb_item );
if( item->GetDcodeDescr() )
width = item->GetDcodeDescr()->GetShapeDim( item );
else
width = min( gerb_item->m_Size.x, gerb_item->m_Size.y );
width = std::min( item->m_Size.x, item->m_Size.y );
orient = TEXT_ORIENT_HORIZ;
if( gerb_item->m_Flashed )
if( item->m_Flashed )
{
// A reasonable size for text is width/3 because most of time this text has 3 chars.
width /= 3;
}
else // this item is a line
{
wxPoint delta = gerb_item->m_Start - gerb_item->m_End;
wxPoint delta = item->m_Start - item->m_End;
if( abs( delta.x ) < abs( delta.y ) )
orient = TEXT_ORIENT_VERT;
@ -405,7 +398,7 @@ void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
width /= 2;
}
int color = g_ColorsSettings.GetItemColor( DCODES_VISIBLE );
int color = GetVisibleElementColor( DCODES_VISIBLE );
DrawGraphicText( m_canvas, aDC, pos, (EDA_COLOR_T) color, Line,
orient, wxSize( width, width ),
@ -413,32 +406,3 @@ void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
0, false, false );
}
}
/* Virtual function needed by the PCB_SCREEN class derived from BASE_SCREEN
* this is a virtual pure function in BASE_SCREEN
* do nothing in GerbView
* could be removed later
*/
void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int )
{
}
/* dummy_functions
*
* These functions are used in some classes.
* they are useful in Pcbnew, but have no meaning or are never used
* in CvPcb or GerbView.
* but they must exist because they appear in some classes, and here, no nothing.
*/
TRACK* MarkTrace( BOARD* aPcb,
TRACK* aStartSegm,
int* aSegmCount,
int* aTrackLen,
int* aLenDie,
bool aReorder )
{
return NULL;
}

View File

@ -22,7 +22,7 @@
// Event table:
BEGIN_EVENT_TABLE( GERBVIEW_FRAME, PCB_BASE_FRAME )
BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_CLOSE( GERBVIEW_FRAME::OnCloseWindow )
EVT_SIZE( GERBVIEW_FRAME::OnSize )
@ -85,6 +85,7 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, PCB_BASE_FRAME )
GERBVIEW_FRAME::Process_Special_Functions )
// Option toolbar
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar )
@ -94,6 +95,7 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, PCB_BASE_FRAME )
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
GERBVIEW_FRAME::OnSelectDisplayMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnUpdateCoordType )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnUpdateLinesDrawMode )
@ -310,3 +312,66 @@ void GERBVIEW_FRAME::SetLanguage( wxCommandEvent& event )
ReFillLayerWidget();
}
/**
* Function OnSelectOptionToolbar
* called to validate current choices
*/
void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
bool state;
switch( id )
{
case ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG:
state = ! m_show_layer_manager_tools;
id = ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR;
break;
default:
state = m_optionsToolBar->GetToolToggled( id );
break;
}
switch( id )
{
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
m_DisplayOptions.m_DisplayPolarCood = state;
break;
case ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH:
m_DisplayOptions.m_DisplayFlashedItemsFill = not state;
m_canvas->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_LINES_SKETCH:
m_DisplayOptions.m_DisplayLinesFill = not state;
m_canvas->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
m_DisplayOptions.m_DisplayPolygonsFill = not state;
m_canvas->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_DCODES:
SetElementVisibility( DCODES_VISIBLE, state );
m_canvas->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
// show/hide auxiliary Vertical layers and visibility manager toolbar
m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update();
GetMenuBar()->SetLabel( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
m_show_layer_manager_tools ?
_("Hide &Layers Manager" ) : _("Show &Layers Manager" ));
break;
default:
wxMessageBox( wxT( "GERBVIEW_FRAME::OnSelectOptionToolbar error" ) );
break;
}
}

View File

@ -475,8 +475,8 @@ bool EXCELLON_IMAGE::Execute_Drill_Command( char*& text )
ReportMessage( msg );
return false;
}
gbritem = new GERBER_DRAW_ITEM( GetParent()->GetBoard(), this );
GetParent()->GetBoard()->m_Drawings.Append( gbritem );
gbritem = new GERBER_DRAW_ITEM( GetParent()->GetLayout(), this );
GetParent()->GetLayout()->m_Drawings.Append( gbritem );
if( m_SlotOn ) // Oval hole
{
fillLineGBRITEM( gbritem,

View File

@ -3,67 +3,115 @@
* @brief Export the layers to Pcbnew.
*/
#include <vector>
#include <fctsys.h>
#include <common.h>
#include <class_drawpanel.h>
// #include <class_drawpanel.h>
#include <confirm.h>
#include <macros.h>
#include <kicad_string.h>
#include <gestfich.h>
#include <trigo.h>
#include <../pcbnew/class_track.h>
#include <../pcbnew/class_drawsegment.h>
#include <io_mgr.h>
#include <gerbview.h>
#include <class_board_design_settings.h>
#include <class_gerber_draw_item.h>
#include <select_layers_to_pcb.h>
#include <build_version.h>
#include <wildcards_and_files_ext.h>
#define TO_PCB_UNIT( x ) KiROUND( x / IU_PER_DECIMILS )
#define TRACK_TYPE 0
#define VIA_TYPE 1
/* A helper class to export a Gerber set of files to Pcbnew
*/
*/
class GBR_TO_PCB_EXPORTER
{
private:
GERBVIEW_FRAME* m_gerbview_frame; // the main gerber frame
wxString m_pcb_file_name; // BOARD file to write to
FILE* m_fp; // the board file
int m_pcbCopperLayersCount;
std::vector<wxPoint> m_vias_coordinates; // list of already generated vias,
// used to export only once a via
// having a given coordinate
public:
GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString& aFileName );
~GBR_TO_PCB_EXPORTER();
/**
* Function ExportPcb
* saves a board from a gerber load.
* saves a board from a set of Gerber images.
*/
bool ExportPcb( int* LayerLookUpTable );
BOARD* GetBoard() { return m_pcb; }
bool ExportPcb( int* LayerLookUpTable );
private:
void export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void cleanBoard();
/**
* Function export_non_copper_item
* write a non copper line or arc to the board file.
* @param aGbrItem = the Gerber item (line, arc) to export
* @param aLayer = the technical layer to use
*/
void export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
GERBVIEW_FRAME* m_gerbview_frame; // the maint gerber frame
wxString m_file_name; // BOARD file to write to
BOARD* m_pcb; // the board to populate and export
/**
* Function export_copper_item
* write a track or via) to the board file.
* @param aGbrItem = the Gerber item (line, arc, flashed) to export
* @param aLayer = the copper layer to use
*/
void export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
/**
* Function export_flashed_copper_item
* write a via to the board file (always uses a via through).
* @param aGbrItem = the flashed Gerber item to export
*/
void export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItemr );
/**
* Function export_segline_copper_item
* write a track (not via) to the board file.
* @param aGbrItem = the Gerber item (line only) to export
* @param aLayer = the copper layer to use
*/
void export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
/**
* Function export_segarc_copper_item
* write a set of tracks (arcs are approximated by track segments)
* to the board file.
* @param aGbrItem = the Gerber item (arc only) to export
* @param aLayer = the copper layer to use
*/
void export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
/**
* function writePcbLineItem
* basic write function to write a DRAWSEGMENT item or a TRACK/VIA item
* to the board file
*/
void writePcbLineItem( int aShape, int aType, wxPoint& aStart, wxPoint& aEnd,
int aWidth, int aLayer, int aDrill, int aAngle = 0 );
/**
* function writePcbHeader
* Write a very basic header to the board file
*/
void writePcbHeader();
};
GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString& aFileName )
{
m_gerbview_frame = aFrame;
m_file_name = aFileName;
m_pcb = new BOARD();
m_gerbview_frame = aFrame;
m_pcb_file_name = aFileName;
}
GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER()
{
delete m_pcb;
}
@ -75,11 +123,10 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
int layercount = 0;
// Count the Gerber layers which are actually currently used
for( int ii = 0; ii < 32; ii++ )
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
{
if( g_GERBER_List[ii] != NULL )
layercount++;
}
if( layercount == 0 )
@ -89,12 +136,12 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
return;
}
wxString fileName;
wxString path = wxGetCwd();;
wxString fileName;
wxString path = wxGetCwd();;
wxFileDialog filedlg( this, _( "Board file name:" ),
path, fileName, LegacyPcbFileWildcard,
wxFD_OPEN );
wxFileDialog filedlg( this, _( "Board file name:" ),
path, fileName, LegacyPcbFileWildcard,
wxFD_OPEN );
if( filedlg.ShowModal() == wxID_CANCEL )
return;
@ -117,52 +164,34 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
return;
}
GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName );
GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName );
gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable() );
}
void GBR_TO_PCB_EXPORTER::cleanBoard()
{
// delete redundant vias
for( TRACK * track = m_pcb->m_Track; track; track = track->Next() )
{
if( track->m_Shape != VIA_THROUGH )
continue;
// Search and delete others vias
TRACK* next_track;
TRACK* alt_track = track->Next();
for( ; alt_track; alt_track = next_track )
{
next_track = alt_track->Next();
if( alt_track->m_Shape != VIA_THROUGH )
continue;
if( alt_track->m_Start != track->m_Start )
continue;
// delete track
alt_track->UnLink();
delete alt_track;
}
}
}
bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
{
BOARD* gerberPcb = m_gerbview_frame->GetBoard();
m_fp = wxFopen( m_pcb_file_name, wxT( "wt" ) );
if( m_fp == NULL )
{
wxString msg;
msg.Printf( _( "Cannot create file <%s>" ), GetChars( m_pcb_file_name ) );
DisplayError( m_gerbview_frame, msg );
return false;
}
m_pcbCopperLayersCount = LayerLookUpTable[GERBVIEW_LAYER_COUNT];
writePcbHeader();
// create an image of gerber data
BOARD_ITEM* item = gerberPcb->m_Drawings;
// First: non copper layers:
GERBER_DRAW_ITEM* gerb_item = m_gerbview_frame->GetItemsList();
for( ; item; item = item->Next() )
for( ; gerb_item; gerb_item = gerb_item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
int layer = gerb_item->GetLayer();
int pcb_layer_number = LayerLookUpTable[layer];
@ -171,70 +200,66 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
if( pcb_layer_number > LAST_COPPER_LAYER )
export_non_copper_item( gerb_item, pcb_layer_number );
}
// Copper layers
fprintf( m_fp, "$TRACK\n" );
gerb_item = m_gerbview_frame->GetItemsList();
for( ; gerb_item; gerb_item = gerb_item->Next() )
{
int layer = gerb_item->GetLayer();
int pcb_layer_number = LayerLookUpTable[layer];
if( pcb_layer_number < 0 || pcb_layer_number > LAST_COPPER_LAYER )
continue;
else
export_copper_item( gerb_item, pcb_layer_number );
}
cleanBoard();
m_pcb->SetCopperLayerCount( LayerLookUpTable[32] );
try
{
wxFileName pcbFileName( m_file_name );
PROPERTIES props;
wxString header = wxString::Format(
wxT( "PCBNEW-BOARD Version %d date %s\n\n# Created by GerbView%s\n\n" ),
LEGACY_BOARD_FILE_VERSION, DateAndTime().GetData(),
GetBuildVersion().GetData() );
props["header"] = header;
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
pi->Save( m_file_name, m_pcb, &props );
}
catch( IO_ERROR ioe )
{
DisplayError( m_gerbview_frame, ioe.errorText );
return false;
}
fprintf( m_fp, "$EndTRACK\n" );
fprintf( m_fp, "$EndBOARD\n" );
fclose( m_fp );
m_fp = NULL;
return true;
}
void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
DRAWSEGMENT* drawitem = new DRAWSEGMENT( m_pcb, PCB_LINE_T );
#define SEG_SHAPE 0
#define ARC_SHAPE 2
int shape = SEG_SHAPE;
int angle = 0;
wxPoint seg_start, seg_end;
drawitem->SetLayer( aLayer );
drawitem->SetStart( aGbrItem->m_Start );
drawitem->SetEnd( aGbrItem->m_End );
drawitem->SetWidth( aGbrItem->m_Size.x );
seg_start = aGbrItem->m_Start;
seg_end = aGbrItem->m_End;
if( aGbrItem->m_Shape == GBR_ARC )
{
double a = atan2( (double)( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y),
(double)( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
double b = atan2( (double)( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ),
(double)( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) );
double a = atan2( (double) ( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y),
(double) ( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
double b = atan2( (double) ( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ),
(double) ( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) );
drawitem->SetShape( S_ARC );
drawitem->SetAngle( KiROUND( (a - b) / M_PI * 1800.0 ) );
drawitem->SetStart( aGbrItem->m_ArcCentre );
shape = ARC_SHAPE;
angle = KiROUND( (a - b) / M_PI * 1800.0 );
seg_start = aGbrItem->m_ArcCentre;
if( drawitem->GetAngle() < 0 )
if( angle < 0 )
{
drawitem->SetAngle( -drawitem->GetAngle() );
drawitem->SetEnd( aGbrItem->m_Start );
NEGATE( angle );
seg_end = aGbrItem->m_Start;
}
}
// Reverse Y axis:
drawitem->SetStartY( -drawitem->GetStart().y );
drawitem->SetEndY( -drawitem->GetEnd().y );
m_pcb->Add( drawitem );
NEGATE( seg_start.y );
NEGATE( seg_end.y );
writePcbLineItem( shape, 0, seg_start, seg_end, aGbrItem->m_Size.x, aLayer, -2, angle );
}
@ -242,91 +267,87 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aL
{
switch( aGbrItem->m_Shape )
{
case GBR_SPOT_CIRCLE:
case GBR_SPOT_RECT:
case GBR_SPOT_OVAL:
// replace spots with vias when possible
export_flashed_copper_item( aGbrItem, aLayer );
break;
case GBR_SPOT_CIRCLE:
case GBR_SPOT_RECT:
case GBR_SPOT_OVAL:
// replace spots with vias when possible
export_flashed_copper_item( aGbrItem );
break;
case GBR_ARC:
export_segarc_copper_item( aGbrItem, aLayer );
break;
case GBR_ARC:
export_segarc_copper_item( aGbrItem, aLayer );
break;
default:
export_segline_copper_item( aGbrItem, aLayer );
break;
default:
export_segline_copper_item( aGbrItem, aLayer );
break;
}
}
void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
TRACK * newtrack = new TRACK( m_pcb );
newtrack->SetLayer( aLayer );
newtrack->m_Start = aGbrItem->m_Start;
newtrack->m_End = aGbrItem->m_End;
newtrack->m_Width = aGbrItem->m_Size.x;
wxPoint seg_start, seg_end;
seg_start = aGbrItem->m_Start;
seg_end = aGbrItem->m_End;
// Reverse Y axis:
NEGATE( newtrack->m_Start.y );
NEGATE( newtrack->m_End.y );
NEGATE( seg_start.y );
NEGATE( seg_end.y );
m_pcb->Add( newtrack );
writePcbLineItem( 0, TRACK_TYPE, seg_start, seg_end, aGbrItem->m_Size.x, aLayer, -1 );
}
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
double a = atan2( (double)( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
(double)( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
double b = atan2( (double)( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ),
(double)( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) );
double a = atan2( (double) ( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
(double) ( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
double b = atan2( (double) ( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ),
(double) ( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) );
wxPoint start = aGbrItem->m_Start;
wxPoint end = aGbrItem->m_End;
wxPoint start = aGbrItem->m_Start;
wxPoint end = aGbrItem->m_End;
/* Because Pcbnew does not know arcs in tracks,
* approximate arc by segments (SEG_COUNT__CIRCLE segment per 360 deg)
* The arc is drawn in an anticlockwise direction from the start point to the end point.
*/
#define SEG_COUNT_CIRCLE 16
#define DELTA_ANGLE 2*M_PI/SEG_COUNT_CIRCLE
#define SEG_COUNT_CIRCLE 16
#define DELTA_ANGLE 2 * M_PI / SEG_COUNT_CIRCLE
// calculate the number of segments from a to b.
// we want CNT_PER_360 segments fo a circle
if( a > b )
b += 2*M_PI;
b += 2 * M_PI;
wxPoint curr_start = start;
wxPoint seg_start, seg_end;
int ii = 1;
int ii = 1;
for( double rot = a; rot < (b - DELTA_ANGLE); rot += DELTA_ANGLE, ii++ )
{
TRACK * newtrack = new TRACK( m_pcb );
newtrack->SetLayer( aLayer );
newtrack->m_Start = curr_start;
seg_start = curr_start;
wxPoint curr_end = start;
RotatePoint( &curr_end, aGbrItem->m_ArcCentre, -(int)(DELTA_ANGLE * ii * 1800 / M_PI) );
newtrack->m_End = curr_end;
newtrack->m_Width = aGbrItem->m_Size.x;
RotatePoint( &curr_end, aGbrItem->m_ArcCentre, -(int) (DELTA_ANGLE * ii * 1800 / M_PI) );
seg_end = curr_end;
// Reverse Y axis:
NEGATE( newtrack->m_Start.y );
NEGATE( newtrack->m_End.y );
m_pcb->Add( newtrack );
NEGATE( seg_start.y );
NEGATE( seg_end.y );
writePcbLineItem( 0, TRACK_TYPE, seg_start, seg_end, aGbrItem->m_Size.x, aLayer, -1 );
curr_start = curr_end;
}
if( end != curr_start )
{
TRACK * newtrack = new TRACK( m_pcb );
newtrack->SetLayer( aLayer );
newtrack->m_Start = curr_start;
newtrack->m_End = end;
newtrack->m_Width = aGbrItem->m_Size.x;
seg_start = curr_start;
seg_end = end;
// Reverse Y axis:
NEGATE( newtrack->m_Start.y );
NEGATE( newtrack->m_End.y );
m_pcb->Add( newtrack );
NEGATE( seg_start.y );
NEGATE( seg_end.y );
writePcbLineItem( 0, TRACK_TYPE, seg_start, seg_end, aGbrItem->m_Size.x, aLayer, -1 );
}
}
@ -336,17 +357,74 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem,
* Flashed items are usually pads or vias, so we try to export all of them
* using vias
*/
void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem )
{
SEGVIA * newtrack = new SEGVIA( m_pcb );
// First, explore already created vias, before creating a new via
for( unsigned ii = 0; ii < m_vias_coordinates.size(); ii++ )
{
if( m_vias_coordinates[ii] == aGbrItem->m_Start ) // Already created
return;
}
newtrack->m_Shape = VIA_THROUGH;
newtrack->SetLayer( 0x0F ); // Layers are 0 to 15 (Cu/Cmp)
newtrack->SetDrillDefault();
newtrack->m_Start = newtrack->m_End = aGbrItem->m_Start;
newtrack->m_Width = (aGbrItem->m_Size.x + aGbrItem->m_Size.y) / 2;
m_vias_coordinates.push_back( aGbrItem->m_Start );
wxPoint via_pos;
int width;
via_pos = aGbrItem->m_Start;
width = (aGbrItem->m_Size.x + aGbrItem->m_Size.y) / 2;
// Reverse Y axis:
NEGATE( newtrack->m_Start.y );
NEGATE( newtrack->m_End.y );
m_pcb->Add( newtrack );
NEGATE( via_pos.y );
// Layers are 0 to 15 (Cu/Cmp) = 0x0F
#define IS_VIA 1
#define SHAPE_VIA_THROUGH 3
writePcbLineItem( SHAPE_VIA_THROUGH, IS_VIA, via_pos, via_pos, width, 0x0F, -1 );
}
void GBR_TO_PCB_EXPORTER::writePcbHeader()
{
fprintf( m_fp, "PCBNEW-BOARD Version 1 date %s\n\n# Created by GerbView %s\n\n",
TO_UTF8( DateAndTime() ), TO_UTF8( GetBuildVersion() ) );
fprintf( m_fp, "$GENERAL\n" );
fprintf( m_fp, "encoding utf-8\n" );
fprintf( m_fp, "Units deci-mils\n" );
// Write copper layer count
fprintf( m_fp, "LayerCount %d\n", m_pcbCopperLayersCount );
// Write enabled layer mask:
int lmask = ALL_NO_CU_LAYERS | EXTERNAL_LAYERS;
for( int ii = 0; ii < m_pcbCopperLayersCount - 2; ii++ )
lmask |= 2 << ii;
fprintf( m_fp, "EnabledLayers %08X\n", lmask );
fprintf( m_fp, "$EndGENERAL\n\n" );
// Creates void setup
fprintf( m_fp, "$SETUP\n" );
fprintf( m_fp, "$EndSETUP\n\n" );
}
void GBR_TO_PCB_EXPORTER::writePcbLineItem( int aShape, int aType, wxPoint& aStart, wxPoint& aEnd,
int aWidth, int aLayer, int aDrill, int aAngle )
{
if( aDrill <= -2 )
fprintf( m_fp, "$DRAWSEGMENT\n" );
fprintf( m_fp, "Po %d %d %d %d %d %d\n", aShape,
TO_PCB_UNIT( aStart.x ), TO_PCB_UNIT( aStart.y ),
TO_PCB_UNIT( aEnd.x ), TO_PCB_UNIT( aEnd.y ),
TO_PCB_UNIT( aWidth ) );
fprintf( m_fp, "De %d %d %d %lX %X",
aLayer, aType, aAngle, 0l, 0 );
if( aDrill > -2 )
fprintf( m_fp, " %d", aDrill );
fprintf( m_fp, "\n" );
if( aDrill <= -2 )
fprintf( m_fp, "$EndDRAWSEGMENT\n" );
}

View File

@ -31,14 +31,10 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <gestfich.h>
#include <gr_basic.h>
//#include <gr_basic.h>
#include <gerbview.h>
#include <gerbview_id.h>
#include <pcbplot.h>
#include <zones.h>
#include <class_board_design_settings.h>
#include <colors_selection.h>
#include <hotkeys.h>
#include <build_version.h>
@ -48,9 +44,8 @@
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
int g_Default_GERBER_Format;
int g_DisplayPolygonsModeSketch;
extern int g_DrawBgColor;
int g_Default_GERBER_Format;
const wxChar* g_GerberPageSizeList[] = {
@ -114,12 +109,6 @@ bool EDA_APP::OnInit()
/* Gerbview mainframe title */
frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() );
// Initialize some display options
DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning here
// Track and via clearance has no meaning here.
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
SetTopWindow( frame ); // Set GerbView mainframe on top
frame->Show( true ); // Show GerbView mainframe
frame->Zoom_Automatique( true ); // Zoom fit in frame
@ -139,7 +128,7 @@ bool EDA_APP::OnInit()
// Load all files specified on the command line.
int jj = 0;
for( int ii = 1; ii < argc && ii <= LAYER_COUNT; ++ii )
for( int ii = 1; ii < argc && ii <= GERBVIEW_LAYER_COUNT; ++ii )
{
fn = wxFileName( argv[ii] );

View File

@ -16,10 +16,15 @@
#define CURSEUR_OFF_GRILLE 1
class GERBVIEW_FRAME;
//class BOARD;
class GERBER_IMAGE;
class PAGE_INFO;
/**
* size of single line of a text from a gerber file.
* warning: some files can have very long lines, so the buffer must be large.
*/
#define GERBER_BUFZ 4000
#define GERBVIEW_LAYER_COUNT 32 // Number of different layers shown by GerbView
/// List of page sizes
extern const wxChar* g_GerberPageSizeList[8];
@ -29,14 +34,14 @@ extern const wxChar* g_GerberPageSizeList[8];
#define GERB_STOP_DRAW 2 // Extinguish light (lift pen)
#define GERB_FLASH 3 // Flash
/*
enum PlotFormat
{
FORMAT_HPGL,
FORMAT_GERBER,
FORMAT_POST
};
*/
/**
* Enum ITEM_VISIBLE
@ -49,14 +54,6 @@ enum GERBER_VISIBLE
END_GERBER_VISIBLE_LIST // sentinel
};
/**
* size of single line of a text from a gerber file.
* warning: some files can have very long lines, so the buffer must be large.
*/
#define GERBER_BUFZ 4000
extern int g_DisplayPolygonsModeSketch;
extern const wxString GerbviewProjectFileExt;
extern const wxString GerbviewProjectFileWildcard;
@ -110,7 +107,6 @@ enum Gerb_Analyse_Cmd
bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file );
extern GERBER_IMAGE* g_GERBER_List[32];
#include <pcbcommon.h>
#include <gerbview_frame.h>
#endif // ifndef GERBVIEW_H

View File

@ -34,13 +34,11 @@
#include <common.h>
#include <class_drawpanel.h>
#include <gestfich.h>
#include <pcbcommon.h>
#include <param_config.h>
#include <colors_selection.h>
#include <gerbview.h>
#include <hotkeys.h>
#include <class_board_design_settings.h>
#include <dialog_hotkeys_editor.h>
@ -100,7 +98,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
m_configSettings.push_back( new PARAM_CFG_BOOL( true,
wxT( "DisplayPolarCoordinates" ),
&DisplayOpt.DisplayPolarCood,
&m_DisplayOptions.m_DisplayPolarCood,
false ) );
// Default colors for layers 0 to 31

View File

@ -33,7 +33,8 @@
#include <build_version.h>
#include <macros.h>
#include <base_units.h>
#include <class_layer_box_selector.h>
#include <colors_selection.h>
#include <class_gbr_layer_box_selector.h>
#include <gerbview.h>
#include <class_gerber_draw_item.h>
@ -47,31 +48,32 @@
#include <class_gbr_screen.h>
// Config keywords
static const wxString cfgShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
static const wxString cfgShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
/*************************************/
/* class GERBVIEW_FRAME for GerbView */
/*************************************/
GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style ) :
PCB_BASE_FRAME( father, GERBER_FRAME, title, pos, size, style )
EDA_DRAW_FRAME( father, GERBER_FRAME, title, pos, size, style )
{
m_colorsSettings = &g_ColorsSettings;
m_Layout = NULL;
m_FrameName = wxT( "GerberFrame" );
m_show_layer_manager_tools = true;
m_showAxis = true; // true to show X and Y axis on screen
m_showBorderAndTitleBlock = false; // true for reference drawings.
m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr;
m_showBorderAndTitleBlock = false; // true for reference drawings.
m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr;
m_SelLayerBox = NULL;
m_DCodeSelector = NULL;
m_displayMode = 0;
@ -85,21 +87,16 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
SetIcon( icon );
SetBoard( new BOARD() );
SetLayout( new GBR_LAYOUT() );
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
GetBoard()->SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible.
SetVisibleLayers( -1 ); // All 32 layers visible.
// BOARD was constructed with "A3", change to "GERBER"
PAGE_INFO pageInfo( wxT( "GERBER" ) );
GetBoard()->SetPageSettings( pageInfo );
SetScreen( new GBR_SCREEN( GetLayout()->GetPageSettings().GetSizeIU() ) );
SetScreen( new GBR_SCREEN( pageInfo.GetSizeIU() ) );
// Create the PCB_LAYER_WIDGET *after* SetBoard():
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int pointSize = font.GetPointSize();
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
// Create the PCB_LAYER_WIDGET *after* SetLayout():
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int pointSize = font.GetPointSize();
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
if( screenHeight <= 900 )
pointSize = (pointSize * 8) / 10;
@ -118,16 +115,16 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
m_auimgr.SetManagedWindow( this );
EDA_PANEINFO horiz;
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
EDA_PANEINFO vert;
EDA_PANEINFO vert;
vert.VerticalToolbarPane();
EDA_PANEINFO mesg;
EDA_PANEINFO mesg;
mesg.MessageToolbarPane();
EDA_PANEINFO lyrs;
EDA_PANEINFO lyrs;
lyrs.LayersToolbarPane();
lyrs.MinSize( m_LayersManager->GetBestSize() );
lyrs.BestSize( m_LayersManager->GetBestSize() );
@ -155,7 +152,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
if( m_messagePanel )
m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer( 10 ) );
ReFillLayerWidget(); // this is near end because contents establish size
m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
@ -178,28 +175,21 @@ void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
double GERBVIEW_FRAME::BestZoom()
{
GERBER_DRAW_ITEM* item = GetLayout()->m_Drawings;
// gives a minimal value to zoom, if no item in list
if( GetBoard()->m_Drawings == NULL )
return ZOOM_FACTOR( 160.0 );
if( item == NULL )
return ZOOM_FACTOR( 350.0 );
EDA_RECT bbox;
BOARD_ITEM* item = GetBoard()->m_Drawings;
EDA_RECT bbox = GetLayout()->ComputeBoundingBox();
bbox = ( (GERBER_DRAW_ITEM*) item )->GetBoundingBox();
wxSize size = m_canvas->GetClientSize();
for( ; item; item = item->Next() )
{
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
bbox.Merge( gerb_item->GetBoundingBox() );
}
wxSize size = m_canvas->GetClientSize();
double x = (double) bbox.GetWidth() / (double) size.x;
double y = (double) bbox.GetHeight() / (double) size.y;
double x = (double) bbox.GetWidth() / (double) size.x;
double y = (double) bbox.GetHeight() / (double) size.y;
GetScreen()->SetScrollCenterPosition( bbox.Centre() );
double best_zoom = MAX( x, y );
double best_zoom = MAX( x, y );
return best_zoom;
}
@ -211,18 +201,17 @@ void GERBVIEW_FRAME::LoadSettings()
if( config == NULL )
return;
// PCB_BASE_FRAME::LoadSettings();
EDA_DRAW_FRAME::LoadSettings();
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
PAGE_INFO pageInfo( wxT( "GERBER" ) );
PAGE_INFO pageInfo( wxT( "GERBER" ) );
config->Read( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false );
if( m_showBorderAndTitleBlock )
{
wxString pageType;
wxString pageType;
config->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
@ -239,14 +228,14 @@ void GERBVIEW_FRAME::LoadSettings()
// because we have 2 file historues, we must read this one
// using a specific path
config->SetPath( wxT("drl_files") );
config->SetPath( wxT( "drl_files" ) );
m_drillFileHistory.Load( *config );
config->SetPath( wxT("..") );
config->SetPath( wxT( ".." ) );
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
// when reading doubles in config,
// but forget to back to current locale. So we call SetLocaleTo_Default
SetLocaleTo_Default( );
SetLocaleTo_Default();
}
@ -257,7 +246,6 @@ void GERBVIEW_FRAME::SaveSettings()
if( config == NULL )
return;
// PCB_BASE_FRAME::SaveSettings();
EDA_DRAW_FRAME::SaveSettings();
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
@ -269,9 +257,9 @@ void GERBVIEW_FRAME::SaveSettings()
// Save the drill file history list.
// Because we have 2 file histories, we must save this one
// in a specific path
config->SetPath(wxT("drl_files") );
config->SetPath( wxT( "drl_files" ) );
m_drillFileHistory.Save( *config );
config->SetPath( wxT("..") );
config->SetPath( wxT( ".." ) );
}
@ -279,9 +267,9 @@ void GERBVIEW_FRAME::ReFillLayerWidget()
{
m_LayersManager->ReFill();
wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
wxSize bestz = m_LayersManager->GetBestSize();
wxSize bestz = m_LayersManager->GetBestSize();
lyrs.MinSize( bestz );
lyrs.BestSize( bestz );
@ -295,60 +283,29 @@ void GERBVIEW_FRAME::ReFillLayerWidget()
syncLayerWidget();
}
/**
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
bool GERBVIEW_FRAME::IsGridVisible()
{
return IsElementVisible( GERBER_GRID_VISIBLE );
}
/**
* Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visiblity in configuration.
* @param aVisible = true if the grid must be shown
*/
void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
{
SetElementVisibility( GERBER_GRID_VISIBLE, aVisible );
}
/**
* Function GetGridColor() , virtual
* @return the color of the grid
*/
int GERBVIEW_FRAME::GetGridColor()
{
return GetBoard()->GetVisibleElementColor( GERBER_GRID_VISIBLE );
}
/**
* Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
void GERBVIEW_FRAME::SetGridColor( int aColor )
{
GetBoard()->SetVisibleElementColor( GERBER_GRID_VISIBLE, aColor );
}
/**
* Function SetElementVisibility
* changes the visibility of an element category
* @param aGERBER_VISIBLE is from the enum by the same name
* @param aItemIdVisible is from the enum by the same name
* @param aNewState = The new visibility state of the element category
* @see enum aGERBER_VISIBLE
*/
void GERBVIEW_FRAME::SetElementVisibility( int aGERBER_VISIBLE, bool aNewState )
void GERBVIEW_FRAME::SetElementVisibility( int aItemIdVisible, bool aNewState )
{
GetBoard()->SetElementVisibility( aGERBER_VISIBLE, aNewState );
m_LayersManager->SetRenderState( aGERBER_VISIBLE, aNewState );
switch( aItemIdVisible )
{
case DCODES_VISIBLE:
m_DisplayOptions.m_DisplayDCodes = aNewState;
break;
case GERBER_GRID_VISIBLE:
SetGridVisibility( aNewState );
break;
default:
wxLogDebug( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aItemIdVisible );
}
m_LayersManager->SetRenderState( aItemIdVisible, aNewState );
}
@ -356,7 +313,7 @@ int GERBVIEW_FRAME::getNextAvailableLayer( int aLayer ) const
{
int layer = aLayer;
for( int i = 0; i < LAYER_COUNT; i++ )
for( int i = 0; i < GERBVIEW_LAYER_COUNT; i++ )
{
GERBER_IMAGE* gerber = g_GERBER_List[ layer ];
@ -365,7 +322,7 @@ int GERBVIEW_FRAME::getNextAvailableLayer( int aLayer ) const
layer++;
if( layer >= LAYER_COUNT )
if( layer >= GERBVIEW_LAYER_COUNT )
layer = 0;
}
@ -389,8 +346,8 @@ void GERBVIEW_FRAME::syncLayerWidget()
void GERBVIEW_FRAME::syncLayerBox()
{
m_SelLayerBox->SetSelection( getActiveLayer() );
int dcodeSelected = -1;
GERBER_IMAGE* gerber = g_GERBER_List[getActiveLayer()];
int dcodeSelected = -1;
GERBER_IMAGE* gerber = g_GERBER_List[getActiveLayer()];
if( gerber )
dcodeSelected = gerber->m_Selected_Tool;
@ -407,12 +364,12 @@ void GERBVIEW_FRAME::syncLayerBox()
void GERBVIEW_FRAME::Liste_D_Codes()
{
int ii, jj;
D_CODE* pt_D_code;
wxString Line;
wxArrayString list;
double scale = IU_PER_MILS * 1000;
int curr_layer = getActiveLayer();
int ii, jj;
D_CODE* pt_D_code;
wxString Line;
wxArrayString list;
double scale = IU_PER_MILS * 1000;
int curr_layer = getActiveLayer();
for( int layer = 0; layer < 32; layer++ )
{
@ -461,11 +418,11 @@ void GERBVIEW_FRAME::Liste_D_Codes()
}
#if wxCHECK_VERSION( 2, 9, 4 )
wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (void**)NULL,
wxCHOICEDLG_STYLE & ~wxCANCEL );
wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (void**) NULL,
wxCHOICEDLG_STYLE & ~wxCANCEL );
#else
wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (char**)NULL,
wxCHOICEDLG_STYLE & ~wxCANCEL );
wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (char**) NULL,
wxCHOICEDLG_STYLE & ~wxCANCEL );
#endif
dlg.ShowModal();
@ -483,8 +440,8 @@ void GERBVIEW_FRAME::Liste_D_Codes()
*/
void GERBVIEW_FRAME::UpdateTitleAndInfo()
{
GERBER_IMAGE* gerber = g_GERBER_List[ getActiveLayer() ];
wxString text;
GERBER_IMAGE* gerber = g_GERBER_List[ getActiveLayer() ];
wxString text;
// Display the gerber filename
if( gerber == NULL )
@ -520,3 +477,365 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
m_TextInfo->SetValue( text );
}
/*
* Function IsElementVisible
* tests whether a given element category is visible. Keep this as an
* inline function.
* @param aGERBER_VISIBLE is from the enum by the same name
* @return bool - true if the element is visible.
* @see enum PCB_VISIBLE
*/
bool GERBVIEW_FRAME::IsElementVisible( int aItemIdVisible )
{
switch( aItemIdVisible )
{
case DCODES_VISIBLE:
return m_DisplayOptions.m_DisplayDCodes;
break;
case GERBER_GRID_VISIBLE:
return IsGridVisible();
break;
default:
wxLogDebug( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ), aItemIdVisible );
}
return true;
}
/**
* Function SetVisibleAlls
* Set the status of all layers to VISIBLE
*/
void GERBVIEW_FRAME::SetVisibleAlls()
{
}
/**
* Function GetVisibleLayers
* is a proxy function that calls the correspondent function in m_BoardSettings
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
int GERBVIEW_FRAME::GetVisibleLayers() const
{
return -1; // TODO
}
/**
* Function SetVisibleLayers
* is a proxy function that calls the correspondent function in m_BoardSettings
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void GERBVIEW_FRAME::SetVisibleLayers( int aLayerMask )
{
GetLayout()->SetVisibleLayers( aLayerMask );
}
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool GERBVIEW_FRAME::IsLayerVisible( int aLayerIndex ) const
{
if( ! m_DisplayOptions.m_IsPrinting )
return m_LayersManager->IsLayerVisible( aLayerIndex );
else
return GetLayout()->IsLayerVisible( aLayerIndex );
}
/**
* Function GetVisibleElementColor
* returns the color of a pcb visible element.
* @see enum PCB_VISIBLE
*/
int GERBVIEW_FRAME::GetVisibleElementColor( int aItemIdVisible )
{
int color = -1;
switch( aItemIdVisible )
{
case DCODES_VISIBLE:
color = m_colorsSettings->GetItemColor( aItemIdVisible );
break;
case GERBER_GRID_VISIBLE:
color = GetGridColor();
break;
default:
wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ), aItemIdVisible );
}
return color;
}
/*
* Virtual from EDA_DRAW_FRAME
*/
void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
{
EDA_DRAW_FRAME::SetGridVisibility( aVisible );
m_LayersManager->SetRenderState( GERBER_GRID_VISIBLE, aVisible );
}
void GERBVIEW_FRAME::SetVisibleElementColor( int aItemIdVisible, int aColor )
{
switch( aItemIdVisible )
{
case DCODES_VISIBLE:
m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
break;
case GERBER_GRID_VISIBLE:
SetGridColor( aColor );
m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
break;
default:
wxLogDebug( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ), aItemIdVisible );
}
}
/**
* Function GetLayerColor
* gets a layer color for any valid layer, including non-copper ones.
*/
int GERBVIEW_FRAME::GetLayerColor( int aLayer )
{
return m_colorsSettings->GetLayerColor( aLayer );
}
/**
* Function SetLayerColor
* changes a layer color for any valid layer, including non-copper ones.
*/
void GERBVIEW_FRAME::SetLayerColor( int aLayer, int aColor )
{
m_colorsSettings->SetLayerColor( aLayer, aColor );
}
/**
* Function getActiveLayer
* returns the active layer
*/
int GERBVIEW_FRAME::getActiveLayer()
{
return ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer;
}
/**
* Function setActiveLayer
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void GERBVIEW_FRAME::setActiveLayer( int aLayer, bool doLayerWidgetUpdate )
{
( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
if( doLayerWidgetUpdate )
m_LayersManager->SelectLayer( getActiveLayer() );
}
void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
wxASSERT( m_Layout );
m_Layout->SetPageSettings( aPageSettings );
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
}
const PAGE_INFO& GERBVIEW_FRAME::GetPageSettings() const
{
wxASSERT( m_Layout );
return m_Layout->GetPageSettings();
}
const wxSize GERBVIEW_FRAME::GetPageSizeIU() const
{
wxASSERT( m_Layout );
// this function is only needed because EDA_DRAW_FRAME is not compiled
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
// into an application specific source file.
return m_Layout->GetPageSettings().GetSizeIU();
}
const TITLE_BLOCK& GERBVIEW_FRAME::GetTitleBlock() const
{
wxASSERT( m_Layout );
return m_Layout->GetTitleBlock();
}
void GERBVIEW_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
{
wxASSERT( m_Layout );
m_Layout->SetTitleBlock( aTitleBlock );
}
const wxPoint& GERBVIEW_FRAME::GetOriginAxisPosition() const
{
wxASSERT( m_Layout );
return m_Layout->GetOriginAxisPosition();
}
void GERBVIEW_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
{
wxASSERT( m_Layout );
m_Layout->SetOriginAxisPosition( aPosition );
}
void GERBVIEW_FRAME::SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo )
{
GetScreen()->SetCurItem( aItem );
if( aItem )
{
if( aDisplayInfo )
aItem->DisplayInfo( this );
}
else
EraseMsgBox();
}
/*
* Function GetLayoutBoundingBox
* returns the bounding box containing all gerber items.
*/
EDA_RECT GERBVIEW_FRAME::GetLayoutBoundingBox()
{
GetLayout()->ComputeBoundingBox();
return GetLayout()->GetBoundingBox();
}
/*
* Update the status bar information.
*/
void GERBVIEW_FRAME::UpdateStatusBar()
{
EDA_DRAW_FRAME::UpdateStatusBar();
GBR_SCREEN* screen = (GBR_SCREEN*) GetScreen();
if( !screen )
return;
int dx;
int dy;
double dXpos;
double dYpos;
wxString line;
wxString locformatter;
if( m_DisplayOptions.m_DisplayPolarCood ) // display relative polar coordinates
{
double theta, ro;
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
if( dx==0 && dy==0 )
theta = 0.0;
else
theta = atan2( (double) -dy, (double) dx );
theta = theta * 180.0 / M_PI;
ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
wxString formatter;
switch( g_UserUnit )
{
case INCHES:
formatter = wxT( "Ro %.4f Th %.1f" );
break;
case MILLIMETRES:
formatter = wxT( "Ro %.3f Th %.1f" );
break;
case UNSCALED_UNITS:
formatter = wxT( "Ro %f Th %f" );
break;
}
line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta );
SetStatusText( line, 3 );
}
// Display absolute coordinates:
dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x );
dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y );
if ( g_UserUnit == MILLIMETRES )
{
dXpos = RoundTo0( dXpos, 1000.0 );
dYpos = RoundTo0( dYpos, 1000.0 );
}
// The following sadly is an if Eeschema/if Pcbnew
wxString absformatter;
switch( g_UserUnit )
{
case INCHES:
absformatter = wxT( "X %.4f Y %.4f" );
locformatter = wxT( "dx %.4f dy %.4f d %.4f" );
break;
case MILLIMETRES:
absformatter = wxT( "X %.3f Y %.3f" );
locformatter = wxT( "dx %.3f dy %.3f d %.3f" );
break;
case UNSCALED_UNITS:
absformatter = wxT( "X %f Y %f" );
locformatter = wxT( "dx %f dy %f d %f" );
break;
}
line.Printf( absformatter, dXpos, dYpos );
SetStatusText( line, 2 );
if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates
{
// Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx );
dYpos = To_User_Unit( g_UserUnit, dy );
if ( g_UserUnit == MILLIMETRES )
{
dXpos = RoundTo0( dXpos, 1000.0 );
dYpos = RoundTo0( dYpos, 1000.0 );
}
// We already decided the formatter above
line.Printf( locformatter, dXpos, dYpos, sqrt( dXpos * dXpos + dYpos * dYpos ) );
SetStatusText( line, 3 );
}
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2007 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
@ -32,19 +32,43 @@
#include <param_config.h>
#include <wxBasePcbFrame.h>
#include <wxstruct.h>
#include <../pcbnew/class_board.h>
#include <class_gbr_layout.h>
#include <class_gbr_screen.h>
#define NO_AVAILABLE_LAYERS -1
class DCODE_SELECTION_BOX;
class GERBER_LAYER_WIDGET;
class LAYER_BOX_SELECTOR;
class GBR_LAYER_BOX_SELECTOR;
class GERBER_DRAW_ITEM;
#define NO_AVAILABLE_LAYERS -1
/**
* Class GBR_DISPLAY_OPTIONS
* A helper class to handle display options.
*/
class GBR_DISPLAY_OPTIONS
{
public:
bool m_DisplayFlashedItemsFill;
bool m_DisplayLinesFill;
bool m_DisplayPolygonsFill;
bool m_DisplayPolarCood;
bool m_DisplayDCodes;
bool m_IsPrinting;
public:
GBR_DISPLAY_OPTIONS()
{
m_DisplayFlashedItemsFill = true;
m_DisplayLinesFill = true;
m_DisplayPolygonsFill = true;
m_DisplayPolarCood = false;
m_DisplayDCodes = true;
m_IsPrinting = false;
}
};
/**
@ -52,52 +76,129 @@ class GERBER_DRAW_ITEM;
* is the main window used in GerbView.
*/
class GERBVIEW_FRAME : public PCB_BASE_FRAME
class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME
{
GBR_LAYOUT* m_Layout;
public:
GBR_DISPLAY_OPTIONS m_DisplayOptions;
/**
* Function SetLayout
* sets the m_Layout member in such as way as to ensure deleting any previous
* GBR_LAYOUT.
* @param aLayout The GBR_LAYOUT to put into the frame.
*/
void SetLayout( GBR_LAYOUT* aLayout )
{
delete m_Layout;
m_Layout = aLayout;
}
GBR_LAYOUT* GetLayout() const
{
wxASSERT( m_Layout );
return m_Layout;
}
/**
* Function GetItemsList
* @return the first GERBER_DRAW_ITEM * item of the items list
*/
GERBER_DRAW_ITEM* GetItemsList()
{
GERBER_DRAW_ITEM* item = GetLayout()->m_Drawings;
return (GERBER_DRAW_ITEM*) item;
}
/**
* Function GetLayoutBoundingBox
* calculates the bounding box containing all gerber items.
* @return EDA_RECT - the items bounding box
*/
EDA_RECT GetLayoutBoundingBox();
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload
const PAGE_INFO& GetPageSettings() const; // overload
const wxSize GetPageSizeIU() const; // overload
const wxPoint& GetOriginAxisPosition() const; // overload
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload
const TITLE_BLOCK& GetTitleBlock() const; // overload
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload
/**
* Function SetCurItem
* sets the currently selected item and displays it in the MsgPanel.
* If the given item is NULL then the MsgPanel is erased and there is no
* currently selected item. This function is intended to make the process
* of "selecting" an item more formal, and to indivisibly tie the operation
* of selecting an item to displaying it using GERBER_DRAW_ITEM::Display_Infos().
* @param aItem The GERBER_DRAW_ITEM to make the selected item or NULL if none.
* @param aDisplayInfo = true to display item info, false if not (default = true)
*/
void SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo = true );
/** Install the dialog box for layer selection
* @param aDefaultLayer = Preselection (NB_LAYERS for "(Deselect)" layer)
* @param aCopperLayerCount = number of copper layers
* @param aShowDeselectOption = display a "(Deselect)" radiobutton (when set to true)
* @return new layer value (NB_LAYERS when "(Deselect)" radiobutton selected),
* or -1 if canceled
*
* Providing the option to also display a "(Deselect)" radiobutton makes the
* GerbView's "Export to Pcbnew" command) more "user friendly",
* by permitting any layer to be "deselected" immediately after its
* corresponding radiobutton has been clicked on. (It would otherwise be
* necessary to first cancel the "Select Layer:" dialog box (invoked after a
* different radiobutton is clicked on) prior to then clicking on the "Deselect"
* button provided within the "Layer selection:" dialog box).
*/
int SelectPCBLayer( int aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false );
protected:
GERBER_LAYER_WIDGET* m_LayersManager;
GERBER_LAYER_WIDGET* m_LayersManager;
// Auxiliary file history used to store drill files history.
wxFileHistory m_drillFileHistory;
wxFileHistory m_drillFileHistory;
public:
LAYER_BOX_SELECTOR* m_SelLayerBox;
DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to highlight.
wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about
// gerber data (format..)
wxArrayString m_DCodesList; // an array string containing all decodes Id (10 to 999)
GBR_LAYER_BOX_SELECTOR* m_SelLayerBox;
DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to highlight.
wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about
// gerber data (format..)
wxArrayString m_DCodesList; // an array string containing all decodes Id (10 to 999)
private:
// list of PARAM_CFG_xxx to read/write parameters saved in config
PARAM_CFG_ARRAY m_configSettings;
PARAM_CFG_ARRAY m_configSettings;
COLORS_DESIGN_SETTINGS* m_colorsSettings;
int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn:
// - in fast mode (write mode) but if there are negative
// - in fast mode (write mode) but if there are negative
// items only the last image is correctly drawn (no
// problem to see only one image or when no negative items)
// - in "exact" mode (but slower) in write mode:
// last image covers previous images
// - in "exact" mode (also slower) in OR mode
// (transparency mode)
// - in "exact" mode (but slower) in write mode:
// last image covers previous images
// - in "exact" mode (also slower) in OR mode
// (transparency mode)
// m_displayMode = 0, 1 or 2
bool m_show_layer_manager_tools;
bool m_show_layer_manager_tools;
// An array string to store warning messages when reading a gerber file.
wxArrayString m_Messages;
public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
// An array sting to store warning messages when reaging a gerber file.
wxArrayString m_Messages;
public:
GERBVIEW_FRAME( wxWindow* father, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~GERBVIEW_FRAME();
void OnCloseWindow( wxCloseEvent& Event );
void OnCloseWindow( wxCloseEvent& Event );
// Virtual basic functions:
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
/**
* Function ReCreateVToolbar
@ -105,18 +206,19 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
*
* @note This is currently not used.
*/
void ReCreateVToolbar();
void ReCreateVToolbar();
/**
* Create or update the left vertical toolbar (option toolbar
*/
void ReCreateOptToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
double BestZoom();
void ReCreateMenuBar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
double BestZoom();
void UpdateStatusBar();
/**
* Function ReportMessage
@ -129,7 +231,6 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
m_Messages.Add( aMessage );
}
/**
* Function ClearMessageList
* Clear the message list
@ -140,7 +241,6 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
m_Messages.Clear();
}
/**
* Function GetDisplayMode
* @return 0 for fast mode (not fully compatible with negative objects)
@ -157,32 +257,6 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
*/
void SetDisplayMode( int aMode ) { m_displayMode = aMode; }
/**
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
virtual bool IsGridVisible();
/**
* Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown
*/
virtual void SetGridVisibility( bool aVisible );
/**
* Function GetGridColor() , virtual
* @return the color of the grid
*/
virtual int GetGridColor();
/**
* Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
virtual void SetGridColor( int aColor );
/**
* Function IsElementVisible
* tests whether a given element category is visible. Keep this as an
@ -191,11 +265,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* @return bool - true if the element is visible.
* @see enum PCB_VISIBLE
*/
bool IsElementVisible( int aGERBER_VISIBLE )
{
return GetBoard()->IsElementVisible( aGERBER_VISIBLE );
}
bool IsElementVisible( int aGERBER_VISIBLE );
/**
* Function SetElementVisibility
@ -204,44 +274,85 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* @param aNewState = The new visibility state of the element category
* @see enum PCB_VISIBLE
*/
void SetElementVisibility( int aGERBER_VISIBLE, bool aNewState );
void SetElementVisibility( int aGERBER_VISIBLE, bool aNewState );
/**
* Function SetVisibleAlls
* Set the status of all visible element categories and layers to VISIBLE
*/
void SetVisibleAlls();
void SetVisibleAlls();
/**
* Function SetGridVisibility(), virtual from EDA_DRAW_FRAME
* It may be overloaded by derived classes
* @param aVisible = true if the grid must be shown
*/
void SetGridVisibility( bool aVisible );
/**
* Function GetVisibleLayers
* is a proxy function that calls the correspondent function in m_BoardSettings
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
int GetVisibleLayers() const;
/**
* Function SetVisibleLayers
* is a proxy function that calls the correspondent function in m_BoardSettings
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( int aLayerMask );
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayerIndex = The index of the layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( int aLayerIndex ) const;
/**
* Function GetVisibleElementColor
* returns the color of a pcb visible element.
* @see enum PCB_VISIBLE
*/
int GetVisibleElementColor( int aItemIdVisible );
void SetVisibleElementColor( int aItemIdVisible, int aColor );
/**
* Function GetLayerColor
* gets a layer color for any valid layer, including non-copper ones.
*/
int GetLayerColor( int aLayer );
/**
* Function SetLayerColor
* changes a layer color for any valid layer, including non-copper ones.
*/
void SetLayerColor( int aLayer, int aColor );
/**
* Function ReFillLayerWidget
* changes out all the layers in m_Layers and may be called upon
* loading a new BOARD.
*/
void ReFillLayerWidget();
void ReFillLayerWidget();
/**
* Function setActiveLayer
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true )
{
( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
if( doLayerWidgetUpdate )
syncLayerWidget();
}
void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true );
/**
* Function getActiveLayer
* returns the active layer
*/
int getActiveLayer()
{
return ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer;
}
int getActiveLayer();
/**
* Function getNextAvailableLayer
@ -250,9 +361,12 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* @param aLayer The first layer to search.
* @return The first empty layer found or NO_AVAILABLE_LAYERS.
*/
int getNextAvailableLayer( int aLayer = 0 ) const;
int getNextAvailableLayer( int aLayer = 0 ) const;
bool hasAvailableLayers() const { return getNextAvailableLayer() != NO_AVAILABLE_LAYERS; }
bool hasAvailableLayers() const
{
return getNextAvailableLayer() != NO_AVAILABLE_LAYERS;
}
/**
* Function syncLayerWidget
@ -262,7 +376,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* This function cannot be inline without including layer_widget.h in
* here and we do not want to do that.
*/
void syncLayerWidget();
void syncLayerWidget();
/**
* Function syncLayerBox
@ -270,7 +384,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* The currently active layer, as defined by the return value of
* getActiveLayer(). And updates the colored icon in the toolbar.
*/
void syncLayerBox();
void syncLayerBox();
/**
* Function UpdateTitleAndInfo
@ -281,7 +395,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* Name of the Image (found in the gerber file: IN &ltname&gt command) in the status bar
* and other data in toolbar
*/
void UpdateTitleAndInfo();
void UpdateTitleAndInfo();
/**
* Function GetConfigurationSettings
@ -292,7 +406,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* GerbView source code (mainly in dialogs). If you need to define a configuration
* setting that need to be loaded at run time, this is the place to define it.
*/
PARAM_CFG_ARRAY& GetConfigurationSettings( void );
PARAM_CFG_ARRAY& GetConfigurationSettings( void );
/**
* Load applications settings specific to the Pcbnew.
@ -303,7 +417,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* drawing frames. Please put your application settings for Pcbnew here
* to avoid having application settings loaded all over the place.
*/
virtual void LoadSettings();
virtual void LoadSettings();
/**
* Save applications settings common to PCB draw frame objects.
@ -314,23 +428,23 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* drawing frames. Please put your application settings for Pcbnew here
* to avoid having application settings saved all over the place.
*/
virtual void SaveSettings();
virtual void SaveSettings();
/**
* Function SetLanguage
* called on a language menu selection
*/
virtual void SetLanguage( wxCommandEvent& event );
virtual void SetLanguage( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
/**
* Function OnSelectActiveDCode
* Selects the active DCode for the current active layer.
* Items using this DCode are highlighted.
*/
void OnSelectActiveDCode( wxCommandEvent& event );
void OnSelectActiveDCode( wxCommandEvent& event );
/**
* Function OnSelectActiveLayer
@ -338,14 +452,14 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* - if a file is loaded, it is loaded in this layer
* _ this layer is displayed on top of other layers
*/
void OnSelectActiveLayer( wxCommandEvent& event );
void OnSelectActiveLayer( wxCommandEvent& event );
/**
* Function OnShowGerberSourceFile
* Call the preferred editor to show (and edit) the gerber source file
* loaded in the active layer
*/
void OnShowGerberSourceFile( wxCommandEvent& event );
void OnShowGerberSourceFile( wxCommandEvent& event );
/**
* Function OnSelectDisplayMode
@ -353,48 +467,49 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* Mode selection can be fast display,
* or exact mode with stacked images or with transparency
*/
void OnSelectDisplayMode( wxCommandEvent& event );
void OnSelectDisplayMode( wxCommandEvent& event );
/**
* Function OnQuit
* called on request of application quit
*/
void OnQuit( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event );
/**
* Function OnHotKey
* called when on hotkey trigger
*/
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay();
GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc );
GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay();
GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc );
void Process_Settings( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void InstallGerberOptionsDialog( wxCommandEvent& event );
void Process_Settings( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void InstallGerberOptionsDialog( wxCommandEvent& event );
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowDCodes( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowDCodes( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
/**
* Function ReturnBlockCommand
* returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
* the \a aKey (ALT, SHIFT ALT ..)
*/
virtual int ReturnBlockCommand( int key );
virtual int ReturnBlockCommand( int key );
/**
* Function HandleBlockPlace
* handles the block place command.
*/
virtual void HandleBlockPlace( wxDC* DC );
virtual void HandleBlockPlace( wxDC* DC );
/**
* Function HandleBlockEnd( )
@ -407,16 +522,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later.
*/
virtual bool HandleBlockEnd( wxDC* DC );
/**
* Function Block_Delete
* deletes all tracks and segments within the selected block.
* Defined separately in Pcbnew and GerbView
*
* @param DC A device context to draw on.
*/
void Block_Delete( wxDC* DC );
virtual bool HandleBlockEnd( wxDC* DC );
/**
* Function Block_Move
@ -427,58 +533,47 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
*
* @param DC A device context to draw on.
*/
void Block_Move( wxDC* DC );
/**
* Function Block_Duplicate
* copies-and-moves all tracks and segments within the selected block.
* New location is determined by the current offset from the selected
* block's original location.
* Defined separately in Pcbnew and GerbView
*
* @param DC A device context to draw on.
*/
void Block_Duplicate( wxDC* DC );
void Block_Move( wxDC* DC );
/**
* Function ToPlotter
* Open a dialog frame to create plot and drill files
* relative to the current board
*/
void ToPlotter( wxCommandEvent& event );
void ToPlotter( wxCommandEvent& event );
/**
* Function ToPrinter
* Open a dialog frame to print layers
*/
void ToPrinter( wxCommandEvent& event );
void ToPrinter( wxCommandEvent& event );
void Genere_HPGL( const wxString& FullFileName, int Layers );
void Genere_GERBER( const wxString& FullFileName, int Layers );
void Genere_PS( const wxString& FullFileName, int Layers );
void Plot_Layer_HPGL( FILE* File, int masque_layer,int garde, bool trace_via,
EDA_DRAW_MODE_T trace_mode );
void Plot_Layer_GERBER( FILE* File, int masque_layer, int garde, bool trace_via,
EDA_DRAW_MODE_T trace_mode );
int Gen_D_CODE_File( const wxString& Name_File );
void Plot_Layer_PS( FILE* File, int masque_layer, int garde, bool trace_via,
EDA_DRAW_MODE_T trace_mode );
void Files_io( wxCommandEvent& event );
/* void Genere_HPGL( const wxString& FullFileName, int Layers );
* void Genere_GERBER( const wxString& FullFileName, int Layers );
* void Genere_PS( const wxString& FullFileName, int Layers );
* void Plot_Layer_HPGL( FILE* File, int masque_layer, int garde, bool trace_via,
* EDA_DRAW_MODE_T trace_mode );
* void Plot_Layer_GERBER( FILE* File, int masque_layer, int garde, bool trace_via,
* EDA_DRAW_MODE_T trace_mode );
* int Gen_D_CODE_File( const wxString& Name_File );
* void Plot_Layer_PS( FILE* File, int masque_layer, int garde, bool trace_via,
* EDA_DRAW_MODE_T trace_mode );
*/
void Files_io( wxCommandEvent& event );
/**
* Function OnGbrFileHistory
* deletes the current data and loads a Gerber file selected from history list on
* current layer.
*/
void OnGbrFileHistory( wxCommandEvent& event );
void OnGbrFileHistory( wxCommandEvent& event );
/**
* Function OnDrlFileHistory
* deletes the current data and load a drill file in Excellon format selected from
* history list on current layer.
*/
void OnDrlFileHistory( wxCommandEvent& event );
void OnDrlFileHistory( wxCommandEvent& event );
/**
* function LoadGerberFiles
@ -488,10 +583,10 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* if void string: user will be prompted for filename(s)
* @return true if file was opened successfully.
*/
bool LoadGerberFiles( const wxString& aFileName );
int ReadGerberFile( FILE* File, bool Append );
bool Read_GERBER_File( const wxString& GERBER_FullFileName,
const wxString& D_Code_FullFileName );
bool LoadGerberFiles( const wxString& aFileName );
int ReadGerberFile( FILE* File, bool Append );
bool Read_GERBER_File( const wxString& GERBER_FullFileName,
const wxString& D_Code_FullFileName );
/**
* function LoadDrllFiles
@ -501,10 +596,10 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* if void string: user will be prompted for filename(s)
* @return true if file was opened successfully.
*/
bool LoadExcellonFiles( const wxString& aFileName );
bool Read_EXCELLON_File( const wxString& aFullFileName );
bool LoadExcellonFiles( const wxString& aFileName );
bool Read_EXCELLON_File( const wxString& aFullFileName );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
/**
* Read a DCode file (not used with RX274X files , just with RS274D old files).
@ -515,7 +610,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* @ aparm aFullFileName = name of file to load.
* if empty, or if the file does not exist, a file dialog is opened
*/
bool LoadDCodeFile( const wxString& aFullFileName );
bool LoadDCodeFile( const wxString& aFullFileName );
/**
* Function ReadDCodeDefinitionFile
@ -540,28 +635,27 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* g_GERBER_List[]<br>
* 1 = read OK<br>
*/
int ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName );
int ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName );
/**
* Set Size Items (Lines, Flashes) from DCodes List
*/
void CopyDCodesSizeToItems();
void Liste_D_Codes();
void CopyDCodesSizeToItems();
void Liste_D_Codes();
// PCB handling
bool Clear_Pcb( bool query );
void Erase_Current_Layer( bool query );
bool Clear_Pcb( bool query );
void Erase_Current_Layer( bool query );
// Conversion function
void ExportDataInPcbnewFormat( wxCommandEvent& event );
void ExportDataInPcbnewFormat( wxCommandEvent& event );
/* SaveCopyInUndoList() virtual
* currently: do nothing in GerbView.
* but must be defined because it is a pure virtual in PCB_BASE_FRAME
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
UNDO_REDO_T aTypeCommand = UR_UNSPECIFIED,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) { }
void SaveCopyInUndoList( GERBER_DRAW_ITEM* aItemToCopy,
UNDO_REDO_T aTypeCommand = UR_UNSPECIFIED,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) { }
/**
* Function SaveCopyInUndoList (overloaded).
@ -572,9 +666,9 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* @param aTransformPoint = the reference point of the transformation,
* for commands like move
*/
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UNDO_REDO_T aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UNDO_REDO_T aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
{
// currently: do nothing in GerbView.
}
@ -586,8 +680,8 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, int aPrintMasklayer, bool aPrintMirrorMode,
void* aData = NULL );
virtual void PrintPage( wxDC* aDC, int aPrintMasklayer, bool aPrintMirrorMode,
void* aData = NULL );
/**
* Function DrawItemsDCodeID
@ -596,9 +690,9 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* @param aDC = the current device context
* @param aDrawMode = GR_COPY, GR_OR ...
*/
void DrawItemsDCodeID( wxDC* aDC, int aDrawMode );
void DrawItemsDCodeID( wxDC* aDC, int aDrawMode );
DECLARE_EVENT_TABLE()
};
#endif /* WX_GERBER_STRUCT_H */
#endif /* WX_GERBER_STRUCT_H */

View File

@ -136,8 +136,7 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
break;
case HK_SWITCH_GBR_ITEMS_DISPLAY_MODE:
DisplayOpt.DisplayPcbTrackFill ^= 1;
DisplayOpt.DisplayPcbTrackFill &= 1;
m_DisplayOptions.m_DisplayLinesFill = not m_DisplayOptions.m_DisplayLinesFill;
m_canvas->Refresh();
break;

View File

@ -35,13 +35,13 @@
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
#include <class_gerbview_layer_widget.h>
#include <class_gbr_layout.h>
bool GERBVIEW_FRAME::Clear_Pcb( bool query )
{
int layer;
if( GetBoard() == NULL )
if( GetLayout() == NULL )
return false;
if( query && GetScreen()->IsModify() )
@ -50,10 +50,9 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
return false;
}
SetCurItem( NULL );
GetBoard()->m_Drawings.DeleteAll();
GetLayout()->m_Drawings.DeleteAll();
for( layer = 0; layer < LAYER_COUNT; layer++ )
for( layer = 0; layer < GERBVIEW_LAYER_COUNT; layer++ )
{
if( g_GERBER_List[layer] )
{
@ -62,15 +61,11 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
}
}
GetBoard()->SetBoundingBox( EDA_RECT() );
GetLayout()->SetBoundingBox( EDA_RECT() );
GetBoard()->m_Status_Pcb = 0;
GetBoard()->m_NbNodes = 0;
GetBoard()->m_NbNoconnect = 0;
SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
setActiveLayer(FIRST_COPPER_LAYER);
setActiveLayer(0);
m_LayersManager->UpdateLayerIcons();
syncLayerBox();
return true;
@ -89,18 +84,17 @@ void GERBVIEW_FRAME::Erase_Current_Layer( bool query )
SetCurItem( NULL );
BOARD_ITEM* item = GetBoard()->m_Drawings;
BOARD_ITEM * next;
GERBER_DRAW_ITEM* item = GetLayout()->m_Drawings;
GERBER_DRAW_ITEM * next;
for( ; item; item = next )
{
next = item->Next();
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer() != layer )
if( item->GetLayer() != layer )
continue;
gerb_item->DeleteStructure();
item->DeleteStructure();
}
if( g_GERBER_List[layer] )

View File

@ -46,13 +46,10 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
int layer = getActiveLayer();
// Search first on active layer
BOARD_ITEM* item = GetBoard()->m_Drawings;
GERBER_DRAW_ITEM* gerb_item = NULL;
GERBER_DRAW_ITEM* gerb_item = GetItemsList();
for( ; item; item = item->Next() )
for( ; gerb_item; gerb_item = gerb_item->Next() )
{
gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer()!= layer )
continue;
@ -65,12 +62,8 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
if( !found ) // Search on all layers
{
item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() )
for( gerb_item = GetItemsList(); gerb_item; gerb_item = gerb_item->Next() )
{
gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( ref ) )
{
found = true;

View File

@ -21,7 +21,7 @@
*/
void GERBVIEW_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{
EDA_ITEM* DrawStruct = GetScreen()->GetCurItem();
GERBER_DRAW_ITEM* DrawStruct = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
wxString msg;
if( GetToolId() == ID_NO_TOOL_SELECTED )
@ -36,7 +36,7 @@ void GERBVIEW_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
else
{
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
GetScreen()->SetCurItem( (BOARD_ITEM*)DrawStruct );
GetScreen()->SetCurItem( DrawStruct );
if( DrawStruct == NULL )
{
GERBER_IMAGE* gerber = g_GERBER_List[getActiveLayer() ];

View File

@ -16,7 +16,7 @@
*/
bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{
EDA_ITEM* DrawStruct = GetScreen()->GetCurItem();
GERBER_DRAW_ITEM* DrawStruct = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
wxString msg;
bool BlockActive = !GetScreen()->m_BlockLocate.IsIdle();
bool busy = DrawStruct && DrawStruct->GetFlags();
@ -71,7 +71,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
return true;
if( DrawStruct )
GetScreen()->SetCurItem( (BOARD_ITEM*)DrawStruct );
GetScreen()->SetCurItem( DrawStruct );
return true;
}

View File

@ -35,31 +35,17 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id )
{
case ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH:
if( state )
DisplayOpt.DisplayPadFill = false;
else
DisplayOpt.DisplayPadFill = true;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayOptions.m_DisplayFlashedItemsFill = not state;
m_canvas->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_LINES_SKETCH:
if(state )
DisplayOpt.DisplayPcbTrackFill = false;
else
DisplayOpt.DisplayPcbTrackFill = true;
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayOptions.m_DisplayLinesFill = not state;
m_canvas->Refresh( true );
break;
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
if( state ) // Polygons filled asked
g_DisplayPolygonsModeSketch = 1;
else
g_DisplayPolygonsModeSketch = 0;
m_DisplayOptions.m_DisplayPolygonsFill = not state;
m_canvas->Refresh( true );
break;
@ -79,7 +65,7 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
default:
wxMessageBox( wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
wxMessageBox( wxT( "GERBVIEW_FRAME::OnSelectOptionToolbar error" ) );
break;
}
}

View File

@ -303,7 +303,6 @@ static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, int aL
* <li> absolute angle 180 to 270 (quadrant 3) or
* <li> absolute angle 270 to 0 (quadrant 4)
* </ul><p>
* @param aPcb is the board.
* @param aGbrItem is the GBRITEM to fill in.
* @param aStart is the starting point
* @param aEnd is the ending point
@ -316,7 +315,7 @@ static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, int aL
* false when arc is inside one quadrant
* @param aLayerNegative = true if the current layer is negative
*/
static void fillArcPOLY( BOARD* aPcb, GERBER_DRAW_ITEM* aGbrItem,
static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem,
const wxPoint& aStart, const wxPoint& aEnd,
const wxPoint& rel_center,
bool aClockwise, bool aMultiquadrant,
@ -517,10 +516,9 @@ bool GERBER_IMAGE::Execute_G_Command( char*& text, int G_command )
break;
case GC_TURN_OFF_POLY_FILL:
if( m_Exposure && m_Parent->GetBoard()->m_Drawings ) // End of polygon
if( m_Exposure && m_Parent->GetLayout()->m_Drawings ) // End of polygon
{
GERBER_DRAW_ITEM * gbritem =
(GERBER_DRAW_ITEM*)( m_Parent->GetBoard()->m_Drawings.GetLast() );
GERBER_DRAW_ITEM * gbritem = m_Parent->GetLayout()->m_Drawings.GetLast();
StepAndRepeatItem( *gbritem );
}
m_Exposure = false;
@ -549,7 +547,7 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
APERTURE_T aperture = APT_CIRCLE;
GERBER_DRAW_ITEM* gbritem;
BOARD* pcb = m_Parent->GetBoard();
GBR_LAYOUT* layout = m_Parent->GetLayout();
int activeLayer = m_Parent->getActiveLayer();
@ -587,8 +585,8 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
if( !m_Exposure )
{
m_Exposure = true;
gbritem = new GERBER_DRAW_ITEM( pcb, this );
pcb->m_Drawings.Append( gbritem );
gbritem = new GERBER_DRAW_ITEM( layout, this );
layout->m_Drawings.Append( gbritem );
gbritem->m_Shape = GBR_POLYGON;
gbritem->SetLayer( activeLayer );
gbritem->m_Flashed = false;
@ -598,20 +596,20 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
{
case GERB_INTERPOL_ARC_NEG:
case GERB_INTERPOL_ARC_POS:
gbritem = (GERBER_DRAW_ITEM*)( pcb->m_Drawings.GetLast() );
gbritem = layout->m_Drawings.GetLast();
// D( printf( "Add arc poly %d,%d to %d,%d fill %d interpol %d 360_enb %d\n",
// m_PreviousPos.x, m_PreviousPos.y, m_CurrentPos.x,
// m_CurrentPos.y, m_PolygonFillModeState,
// m_Iterpolation, m_360Arc_enbl ); )
fillArcPOLY( pcb, gbritem, m_PreviousPos,
fillArcPOLY( gbritem, m_PreviousPos,
m_CurrentPos, m_IJPos,
( m_Iterpolation == GERB_INTERPOL_ARC_NEG ) ? false : true,
m_360Arc_enbl, GetLayerParams().m_LayerNegative );
break;
default:
gbritem = (GERBER_DRAW_ITEM*)( pcb->m_Drawings.GetLast() );
gbritem = layout->m_Drawings.GetLast();
// D( printf( "Add poly edge %d,%d to %d,%d fill %d\n",
// m_PreviousPos.x, m_PreviousPos.y,
@ -631,9 +629,9 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
break;
case 2: // code D2: exposure OFF (i.e. "move to")
if( m_Exposure && pcb->m_Drawings ) // End of polygon
if( m_Exposure && layout->m_Drawings ) // End of polygon
{
gbritem = (GERBER_DRAW_ITEM*)( pcb->m_Drawings.GetLast() );
gbritem = layout->m_Drawings.GetLast();
StepAndRepeatItem( *gbritem );
}
m_Exposure = false;
@ -663,8 +661,8 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
switch( m_Iterpolation )
{
case GERB_INTERPOL_LINEAR_1X:
gbritem = new GERBER_DRAW_ITEM( pcb, this );
pcb->m_Drawings.Append( gbritem );
gbritem = new GERBER_DRAW_ITEM( layout, this );
layout->m_Drawings.Append( gbritem );
// D( printf( "Add line %d,%d to %d,%d\n",
// m_PreviousPos.x, m_PreviousPos.y,
@ -682,8 +680,8 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
case GERB_INTERPOL_ARC_NEG:
case GERB_INTERPOL_ARC_POS:
gbritem = new GERBER_DRAW_ITEM( pcb, this );
pcb->m_Drawings.Append( gbritem );
gbritem = new GERBER_DRAW_ITEM( layout, this );
layout->m_Drawings.Append( gbritem );
// D( printf( "Add arc %d,%d to %d,%d center %d, %d interpol %d 360_enb %d\n",
// m_PreviousPos.x, m_PreviousPos.y, m_CurrentPos.x,
@ -720,8 +718,8 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
aperture = tool->m_Shape;
}
gbritem = new GERBER_DRAW_ITEM( pcb, this );
pcb->m_Drawings.Append( gbritem );
gbritem = new GERBER_DRAW_ITEM( layout, this );
layout->m_Drawings.Append( gbritem );
fillFlashedGBRITEM( gbritem, aperture,
dcode, activeLayer, m_CurrentPos,
size, GetLayerParams().m_LayerNegative );

View File

@ -1,28 +1,46 @@
/*******************************************************/
/* Dialog frame to choose gerber layers and pcb layers */
/*******************************************************/
/**
* @file select_layers_to_pcb.cpp
* @brief Dialog to choose equivalence between gerber layers and pcb layers
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2010 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <common.h>
#include <appl_wxstruct.h>
#include <gerbview.h>
#include <gerbview_id.h>
#include <class_board_design_settings.h>
#include <class_GERBER.h>
#include <wx/statline.h>
#include <select_layers_to_pcb.h>
#define LAYER_UNSELECTED NB_LAYERS
// Imported function
extern const wxString GetPCBDefaultLayerName( int aLayerNumber );
enum swap_layer_id {
ID_LAYERS_MAP_DIALOG = ID_GERBER_END_LIST,
ID_BUTTON_0,
ID_TEXT_0 = ID_BUTTON_0 + 32
ID_TEXT_0 = ID_BUTTON_0 + GERBVIEW_LAYER_COUNT
};
/*
@ -32,11 +50,12 @@ enum swap_layer_id {
*/
BEGIN_EVENT_TABLE( LAYERS_MAP_DIALOG, LAYERS_MAP_DIALOG_BASE )
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + 31,
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + GERBVIEW_LAYER_COUNT-1,
wxEVT_COMMAND_BUTTON_CLICKED,
LAYERS_MAP_DIALOG::OnSelectLayer )
END_EVENT_TABLE()
int LAYERS_MAP_DIALOG::m_exportBoardCopperLayersCount = 2;
LAYERS_MAP_DIALOG::LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent ) :
LAYERS_MAP_DIALOG_BASE( parent )
@ -80,22 +99,17 @@ void LAYERS_MAP_DIALOG::initDialog()
// the above code should be modified as required in the event that those
// buttons should be some other size in that version.
// Compute a reasonable number of copper layers
m_exportBoardCopperLayersCount = 0;
for( int ii = 0; ii < 32; ii++ )
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
{
if( g_GERBER_List[ii] != NULL )
m_exportBoardCopperLayersCount++;
// Specify the default value for each member of these arrays.
m_buttonTable[ii] = -1;
m_layersLookUpTable[ii] = LAYER_UNSELECTED;
}
// Ensure we have:
// at least 2 copper layers and NB_COPPER_LAYERS copper layers max
// at least 2 copper layers and BOARD_COPPER_LAYERS_MAX_COUNT copper layers max
// and even layers count because a board *must* have even layers count
// and maxi NB_COPPER_LAYERS copper layers count
// and maxi BOARD_COPPER_LAYERS_MAX_COUNT copper layers count
normalizeBrdLayersCount();
int idx = ( m_exportBoardCopperLayersCount / 2 ) - 1;
@ -103,7 +117,7 @@ void LAYERS_MAP_DIALOG::initDialog()
int pcb_layer_num = 0;
m_itemsCount = 0;
for( int ii = 0; ii < 32; ii++ )
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
{
if( g_GERBER_List[ii] == NULL )
continue;
@ -118,7 +132,7 @@ void LAYERS_MAP_DIALOG::initDialog()
pcb_layer_num++;
}
if( m_itemsCount <= 16 ) // Only one list is enough
if( m_itemsCount <= GERBVIEW_LAYER_COUNT/2 ) // Only one list is enough
{
m_staticlineSep->Hide();
}
@ -160,7 +174,7 @@ void LAYERS_MAP_DIALOG::initDialog()
// is nb_items; otherwise, the number of rows is 16 (with two
// separate columns of controls being used if nb_items > 16).
if( ii == 16 )
if( ii == GERBVIEW_LAYER_COUNT/2 )
flexColumnBoxSizer = m_flexRightColumnBoxSizer;
// Provide a text string to identify the Gerber layer
@ -208,19 +222,19 @@ void LAYERS_MAP_DIALOG::initDialog()
wxDefaultSize, 0 );
goodSize = text->GetSize();
for( int jj = 0; jj < NB_LAYERS; jj++ )
for( int jj = 0; jj < BOARD_LAYERS_MAX_COUNT; jj++ )
{
text->SetLabel( BOARD::GetDefaultLayerName( jj ) );
text->SetLabel( GetPCBDefaultLayerName( jj ) );
if( goodSize.x < text->GetSize().x )
goodSize.x = text->GetSize().x;
}
msg = BOARD::GetDefaultLayerName( m_layersLookUpTable[m_buttonTable[ii]] );
msg = GetPCBDefaultLayerName( m_layersLookUpTable[m_buttonTable[ii]] );
text->SetLabel( msg );
}
else
{
msg = BOARD::GetDefaultLayerName( m_layersLookUpTable[m_buttonTable[ii]] );
msg = GetPCBDefaultLayerName( m_layersLookUpTable[m_buttonTable[ii]] );
text = new wxStaticText( this, item_ID, msg, wxDefaultPosition,
wxDefaultSize, 0 );
}
@ -233,7 +247,7 @@ void LAYERS_MAP_DIALOG::initDialog()
}
}
/* Ensure m_exportBoardCopperLayersCount = 2 to NB_COPPER_LAYERS
/* Ensure m_exportBoardCopperLayersCount = 2 to BOARD_COPPER_LAYERS_MAX_COUNT
* and it is an even value because Boards have always an even layer count
*/
void LAYERS_MAP_DIALOG::normalizeBrdLayersCount()
@ -241,8 +255,8 @@ void LAYERS_MAP_DIALOG::normalizeBrdLayersCount()
if( ( m_exportBoardCopperLayersCount & 1 ) )
m_exportBoardCopperLayersCount++;
if( m_exportBoardCopperLayersCount > NB_COPPER_LAYERS )
m_exportBoardCopperLayersCount = NB_COPPER_LAYERS;
if( m_exportBoardCopperLayersCount > BOARD_COPPER_LAYERS_MAX_COUNT )
m_exportBoardCopperLayersCount = BOARD_COPPER_LAYERS_MAX_COUNT;
if( m_exportBoardCopperLayersCount < 2 )
m_exportBoardCopperLayersCount = 2;
@ -271,7 +285,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
&& (m_exportBoardCopperLayersCount > 1) )
layer = LAYER_N_FRONT;
m_layersLookUpTable[ii] = layer;
msg = BOARD::GetDefaultLayerName( layer );
msg = GetPCBDefaultLayerName( layer );
m_layersList[ii]->SetLabel( msg );
m_layersList[ii]->SetForegroundColour( wxNullColour );
m_buttonTable[ii] = ii;
@ -284,10 +298,10 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
{
wxConfig* config = wxGetApp().GetSettings();
config->Write( wxT("BrdLayersCount"), m_itemsCount );
config->Write( wxT("BrdLayersCount"), m_exportBoardCopperLayersCount );
wxString key;
for( int ii = 0; ii < 32; ii++ )
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
{
key.Printf( wxT("GbrLyr%dToPcb"), ii );
config->Write( key, m_layersLookUpTable[ii] );
@ -305,7 +319,7 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
m_comboCopperLayersCount->SetSelection( idx );
wxString key;
for( int ii = 0; ii < 32; ii++ )
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
{
key.Printf( wxT("GbrLyr%dToPcb"), ii );
config->Read( key, &m_layersLookUpTable[ii] );
@ -321,7 +335,7 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
}
else
{
m_layersList[ii]->SetLabel( BOARD::GetDefaultLayerName( layer ) );
m_layersList[ii]->SetLabel( GetPCBDefaultLayerName( layer ) );
m_layersList[ii]->SetForegroundColour( wxColour( 255, 0, 128 ) );
}
}
@ -331,18 +345,19 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
{
int ii, jj;
ii = event.GetId();
if( ii < ID_BUTTON_0 || ii >= ID_BUTTON_0 + 32 )
return;
ii = event.GetId() - ID_BUTTON_0;
if( (ii < 0) || (ii >= GERBVIEW_LAYER_COUNT) )
{
wxFAIL_MSG( wxT("Bad layer id") );
return;
}
jj = m_layersLookUpTable[m_buttonTable[ii]];
if( ( jj < 0 ) || ( jj > LAYER_UNSELECTED ) )
jj = LAYER_N_BACK; // (Defaults to "Copper" layer.)
jj = m_Parent->SelectLayer( jj, -1, -1, true );
jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, true );
if( ( jj < 0 ) || ( jj > LAYER_UNSELECTED ) )
return;
@ -360,7 +375,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
}
else
{
m_layersList[ii]->SetLabel( BOARD::GetDefaultLayerName( jj ) );
m_layersList[ii]->SetLabel( GetPCBDefaultLayerName( jj ) );
// Change the text color to fuchsia (to highlight
// that this layer *is* being exported)
@ -384,7 +399,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
normalizeBrdLayersCount();
int inner_layer_max = 0;
for( int ii = 0; ii < 32; ii++ )
for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ )
{
if( m_layersLookUpTable[ii] < LAYER_N_FRONT )
{
@ -402,6 +417,6 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
_("The exported board has not enough copper layers to handle selected inner layers") );
return;
}
m_layersLookUpTable[32] = m_exportBoardCopperLayersCount;
m_layersLookUpTable[GERBVIEW_LAYER_COUNT] = m_exportBoardCopperLayersCount;
EndModal( wxID_OK );
}

View File

@ -1,7 +1,3 @@
/*******************************************************/
/* Dialog frame to choose gerber layers and pcb layers */
/*******************************************************/
/**
* @file select_layers_to_pcb.h
*/
@ -9,23 +5,23 @@
#ifndef _SELECT_LAYERS_TO_PCB_H_
#define _SELECT_LAYERS_TO_PCB_H_
#include <wx/statline.h>
#include <dialogs/dialog_layers_select_to_pcb_base.h>
#include <layers_id_colors_and_visibility.h>
#define LAYER_UNSELECTED NB_LAYERS
#define BOARD_LAYERS_MAX_COUNT NB_LAYERS
#define BOARD_COPPER_LAYERS_MAX_COUNT NB_COPPER_LAYERS
#define LAYER_UNSELECTED BOARD_LAYERS_MAX_COUNT
/*
* This dialog shows the gerber files loaded, and allows user to choose:
* what gerber file and what board layer are used
* the number of copper layers
* This dialog shows the gerber files loaded, and allows user to choose
* equivalence tbetween gerber layers and pcb layers
*/
class LAYERS_MAP_DIALOG : public LAYERS_MAP_DIALOG_BASE
{
private:
GERBVIEW_FRAME* m_Parent;
int m_itemsCount;
int m_exportBoardCopperLayersCount;
static int m_exportBoardCopperLayersCount;
wxFlexGridSizer* m_flexRightColumnBoxSizer; // An extra wxFlexGridSizer used
// when we have more than 16 gerber files loaded
int m_layersLookUpTable[32+1]; // Indexes Gerber layers to PCB file layers

View File

@ -37,7 +37,7 @@
#include <gerbview_id.h>
#include <hotkeys.h>
#include <class_GERBER.h>
#include <class_layer_box_selector.h>
#include <class_gbr_layer_box_selector.h>
#include <class_DCodeSelectionbox.h>
#include <dialog_helpers.h>
@ -87,16 +87,10 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
m_mainToolBar->AddSeparator();
wxArrayString choices;
m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
wxDefaultPosition, wxSize( 150, -1 ), 0,NULL);
m_SelLayerBox->Resync();
for( ii = 0; ii < 32; ii++ )
{
msg.Printf( _( "Layer %d" ), ii + 1 );
choices.Add( msg );
}
m_SelLayerBox = new LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
wxDefaultPosition, wxSize( 150, -1 ), choices );
m_mainToolBar->AddControl( m_SelLayerBox );
m_mainToolBar->AddSeparator();
@ -241,21 +235,26 @@ void GERBVIEW_FRAME::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
}
void GERBVIEW_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_DisplayOptions.m_DisplayPolarCood );
}
void GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayPadFill );
aEvent.Check( !m_DisplayOptions.m_DisplayFlashedItemsFill );
}
void GERBVIEW_FRAME::OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( !m_DisplayPcbTrackFill );
aEvent.Check( !m_DisplayOptions.m_DisplayLinesFill );
}
void GERBVIEW_FRAME::OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent )
{
aEvent.Check( g_DisplayPolygonsModeSketch != 0 );
aEvent.Check( !m_DisplayOptions.m_DisplayPolygonsFill );
}

View File

@ -28,7 +28,7 @@ static FILE *Input = NULL; /* input stream */
static FILE *Error = NULL; /* error stream */
static int LineNumber; /* current input line number */
global struct inst *insts, *iptr;
global struct inst *insts, *iptr;
global struct con *cons, *cptr;
global int pass2;
global float scale;
@ -43,7 +43,7 @@ struct plst *pl, zplst = {0,0,NULL};
struct st refI, valI;
struct st *ref=&refI, *val=&valI;
struct pwr *stp, *pwrSym=NULL; // power syms or page names
struct pwr *pptr=NULL, *pgs=NULL;
struct pwr *pptr=NULL, *pgs=NULL;
int convert=1; // normal
int savtext=0; // debug - no text
float a,b,c,d,e,f,k,h;
@ -58,12 +58,12 @@ char MfgPart[MFG_PART_LEN + 1];
struct FigGrpStruct *pfg=NULL, *pfgHead=NULL;
char cur_fg[20];
char *libRef=NULL, *cellRef=NULL, *cur_pnam, *cur_nname, cur_Orient=PIN_N;
char *libRef=NULL, *cellRef=NULL, *cur_pnam, *cur_nname, cur_Orient=PIN_N;
%}
%union {
int n;
%union {
int n;
float f;
struct st *st;
struct pt *pt;
@ -75,36 +75,36 @@ char *libRef=NULL, *cellRef=NULL, *cur_pnam, *cur_nname, cur_Orient=PIN_N;
%type <n> True False
%type <f> ScaledInt
%type <pl> Rectangle BoundBox PointList _PointList Path _Path Polygon _Polygon
%type <pl> Rectangle BoundBox PointList _PointList Path _Path Polygon _Polygon
%type <pl> Circle PageSize
%type <pl> Origin Point _Point PointValue _Rectangle Dot _Dot _DisplayOrg _TransOrg
%type <st> StrDisplay _StrDisplay PropDisp _PropDisp KeywordDisp _KeywordDisp
%type <st> StrDisplay _StrDisplay PropDisp _PropDisp KeywordDisp _KeywordDisp
%type <st> Designator _Designator Annotate _Annotate
%type <st> Display
%type <st> _Display
%type <st> CommGraph _CommGraph
%type <st> PropNameRef
%type <st> _Display
%type <st> CommGraph _CommGraph
%type <st> PropNameRef
%type <st> Str String _String KeywordName
%type <st> Str String _String KeywordName
%type <st> Ident Name _Name NameDef NameRef EdifFileName
%type <st> NetNameDef Array
%type <st> CellNameDef CellNameRef CellRef _CellRef Cell
%type <st> Transform
%type <st> CellNameDef CellNameRef CellRef _CellRef Cell
%type <st> Transform
%type <st> Rename _Rename __Rename
%type <st> FigGrp _FigGrp
%type <st> FigGrpNameDef FigGrpOver _FigGrpOver FigGrpNameRef
%type <st> FigGrp _FigGrp
%type <st> FigGrpNameDef FigGrpOver _FigGrpOver FigGrpNameRef
%type <st> View _View Contents _Contents ViewNameDef ViewType Page _Page
%type <st> ViewRef _ViewRef ViewNameRef ViewList _ViewList
%type <st> ViewRef _ViewRef ViewNameRef ViewList _ViewList
// %type <st> View ValueNameDef
%type <st> Instance _Instance InstanceRef _InstanceRef InstNameDef InstNameRef
%type <st> LibNameDef LibraryRef LibNameRef
%type <st> Port _Port PortNameDef PortNameRef PortRef _PortRef Member
%type <st> LibNameDef LibraryRef LibNameRef
%type <st> Port _Port PortNameDef PortNameRef PortRef _PortRef Member
%type <st> Design _Design DesignNameDef
%type <st> PortImpl _PortImpl ConnectLoc _ConnectLoc PropNameDef
%type <st> Interface _Interface
%type <st> Interface _Interface
%type <st> Boolean _Boolean Integer _Integer MiNoMa _MiNoMa Number _Number
%type <st> TypedValue Property _Property Owner
%type <st> TypedValue Property _Property Owner
%type <st> Symbol _Symbol Figure _Figure Comment _Comment
%type <st> Justify _Justify _DisplayJust Net _Net Joined _Joined
@ -452,15 +452,15 @@ _After : MiNoMaValue
;
Annotate : ANNOTATE _Annotate PopC
{$$=$2;
{$$=$2;
if(bug>2)fprintf(Error," ANNOTATE: '%s' %d %d oxy=%d,d\n",$2->s, $2->p->x, $2->p->y,ox,oy);
New->U.Text.Text = $2->s;
New->U.Text.size = TextSize ;
New->U.Text.size = TextSize ;
//New->U.Text.x = $2->p->x + ox +(New->U.Text.size * (strlen(New->U.Text.Text)+1)/2);
New->U.Text.x = $2->p->x + ox;
New->U.Text.y = $2->p->y - oy;
New->U.Text.y = $2->p->y - oy;
}
;
@ -471,13 +471,13 @@ _Annotate : STR
if(bug>2)fprintf(Error," _Annotate StrDisp:'%s' '%s' %d %d \n",cur_pnam, $1->s, $1->p->x, $1->p->y);
if(bug>2)fprintf(Error," New TEXT_DRAW_TYPE %s\n", cur_pnam);
New = (LibraryDrawEntryStruct *) Malloc(sizeof(LibraryDrawEntryStruct));
New->DrawType = TEXT_DRAW_TYPE;
New->DrawType = TEXT_DRAW_TYPE;
New->Convert = convert;
New->nxt = LibEntry->Drawings;
LibEntry->Drawings = New;
New->Unit = 0;
New->U.Text.Horiz = 0;
New->U.Text.Text = cur_pnam;
New->U.Text.Text = cur_pnam;
}
;
@ -498,15 +498,15 @@ Arc : ARC PointValue PointValue PointValue PopC
New->nxt = LibEntry->Drawings;
LibEntry->Drawings = New; New->Unit = 0; New->Convert = convert;
New->DrawType = ARC_DRAW_TYPE;
New->DrawType = ARC_DRAW_TYPE;
a=$2->x; b= $2->y; c=$3->x; d= $3->y; e=$4->x; f= $4->y;
h = ((a*a+b*b)*(f-d)+(c*c+d*d)*(b-f)+(e*e+f*f)*(d-b))/(a*(f-d)+c*(b-f)+e*(d-b))/2;
k = ((a*a+b*b)*(e-c)+(c*c+d*d)*(a-e)+(e*e+f*f)*(c-a))/(b*(e-c)+d*(a-e)+f*(c-a))/2;
New->U.Arc.x = (int) h ;
New->U.Arc.y = (int) k ;
New->U.Arc.r = sqrt((a-h)*(a-h) + (b-k)*(b-k));
if(bug>3)fprintf(Error," a=%06f b=%06f c=%06f d=%06f e=%06f f=%06f : h=%06f k=%06f x %d y %d r %d\n",
if(bug>3)fprintf(Error," a=%06f b=%06f c=%06f d=%06f e=%06f f=%06f : h=%06f k=%06f x %d y %d r %d\n",
a,b,c,d,e,f,h,k, New->U.Arc.x, New->U.Arc.y, New->U.Arc.r);
New->U.Arc.t1 = (int)(atan2(b-k, a-h) * 1800 /M_PI);
@ -593,7 +593,7 @@ _BooleanDisp : BooleanValue
BooleanMap : BOOLEANMAP BooleanValue PopC
;
BooleanValue : True
BooleanValue : True
{$$=1;}
| False
{$$=0;}
@ -612,15 +612,15 @@ BoundBox : BOUNDINGBOX Rectangle PopC
;
CellNameDef : NameDef
{if(bug>2)fprintf(Error," currlib: %s \n", CurrentLib->Name);
if(bug>1)fprintf(Error," CellNameDef: %s \n", $1->s );
{if(bug>2)fprintf(Error," currlib: %s \n", CurrentLib->Name);
if(bug>1)fprintf(Error," CellNameDef: %s \n", $1->s );
InCell=1;
LibEntry = (LibraryEntryStruct *) Malloc(sizeof(LibraryEntryStruct));
LibEntry->Type = ROOT;
LibEntry->PrefixPosX = 0; LibEntry->PrefixPosY = 0; LibEntry->PrefixSize = DEFAULT_SIZE_TEXT/scale;
LibEntry->NamePosX = 0; LibEntry->NamePosY = 0; LibEntry->NameSize = DEFAULT_SIZE_TEXT/scale;
LibEntry->Prefix[0] = 'U';
LibEntry->Prefix[1] = 0;
LibEntry->Prefix[1] = 0;
LibEntry->DrawPinNum = 1; LibEntry->DrawPinName = 1; LibEntry->DrawName = 1; LibEntry->DrawPrefix = 1;
LibEntry->TextInside = 30;
LibEntry->NumOfUnits = 1;
@ -636,7 +636,7 @@ CellNameDef : NameDef
}
;
Cell : CELL CellNameDef _Cell PopC
{$$=$2; if(bug>1)fprintf(Error," CELL: '%s'\n", $2->s);
{$$=$2; if(bug>1)fprintf(Error," CELL: '%s'\n", $2->s);
InCell=0;
}
;
@ -665,17 +665,17 @@ _Cell : CellType
;
CellNameRef : NameRef
{if(bug>1)fprintf(Error," currDesign: %s \n", CurrentLib->Name);
{if(bug>1)fprintf(Error," currDesign: %s \n", CurrentLib->Name);
}
;
CellRef : CELLREF CellNameRef _CellRef PopC
{$$=$2;
{$$=$2;
cellRef = $2->s;
ref->s = 0; val->s = 0; Foot[0] = 0;
strncpy(schName, $2->s, PART_NAME_LEN);
if(bug>1 && $3==NULL)fprintf(Error," CellRef: '%s'\n", $2->s);
if(bug>1 && $3!=NULL)fprintf(Error," CellRef: '%s' LibNameRef:'%s'\n", $2->s, $3->s);
if(bug>1 && $3==NULL)fprintf(Error," CellRef: '%s'\n", $2->s);
if(bug>1 && $3!=NULL)fprintf(Error," CellRef: '%s' LibNameRef:'%s'\n", $2->s, $3->s);
}
;
@ -684,7 +684,7 @@ LibNameRef : NameRef
;
LibraryRef : LIBRARYREF LibNameRef PopC
{$$=$2;
{$$=$2;
libRef = $2->s;}
;
@ -719,8 +719,8 @@ Circle : CIRCLE PointValue PointValue _Circle PopC
{
$$=(struct plst *)Malloc(sizeof(struct plst));
pl=(struct plst *)Malloc(sizeof(struct plst));
$$->x=$2->x; $$->y=$2->y; $$->nxt=pl;
pl->x=$3->x; pl->y=$3->y; pl->nxt=NULL;
$$->x=$2->x; $$->y=$2->y; $$->nxt=pl;
pl->x=$3->x; pl->y=$3->y; pl->nxt=NULL;
}
;
@ -891,9 +891,9 @@ DesignNameDef : NameDef
Design : DESIGN DesignNameDef _Design PopC
{$$=$2;
if(bug>0 && $3 != NULL)fprintf(Error,"Design: '%s' '%s'\n\n", $2->s, $3->s);
if(bug>0 && $3 == NULL)fprintf(Error,"Design: '%s' '' \n\n", $2->s);
if(bug>0 && $3 != NULL)fprintf(Error,"Design: '%s' '%s'\n\n", $2->s, $3->s);
if(bug>0 && $3 == NULL)fprintf(Error,"Design: '%s' '' \n\n", $2->s);
DesignName = CurrentLib;
OutPro(Libs);
strncpy(schName, $2->s, PART_NAME_LEN);
@ -922,7 +922,7 @@ _Designator : Str
if(bug>2)fprintf(Error," _Designator Str '%s'\n",$1->s);}
| StrDisplay
{$$=$1;
if(bug>2)fprintf(Error," _Designator StrDisp:'%s' %d %d\n",$1->s, $1->p->x, $1->p->y);
if(bug>2)fprintf(Error," _Designator StrDisp:'%s' %d %d\n",$1->s, $1->p->x, $1->p->y);
if(bug>2 && $1->nxt)fprintf(Error," ='%s' \n",$1->nxt->s);
}
;
@ -982,7 +982,7 @@ Display : DISPLAY _Display _DisplayJust _DisplayOrien _DisplayOrg PopC
cur_Orient = $4;
// find Pin to add Orient
for( LDptr=New ; LDptr != NULL ; LDptr=LDptr->nxt ) {
if(bug>6)fprintf(Error," Check '%s' '%s' %s\n",
if(bug>6)fprintf(Error," Check '%s' '%s' %s\n",
$$->s, LDptr->U.Pin.Name, LDptr->U.Pin.ReName);
if( LDptr->DrawType != PIN_DRAW_TYPE)
continue;
@ -990,7 +990,7 @@ Display : DISPLAY _Display _DisplayJust _DisplayOrien _DisplayOrg PopC
break;
}
if( LDptr != NULL ){
if(bug>3)fprintf(Error," Display Found %s Orient %c\n",
if(bug>3)fprintf(Error," Display Found %s Orient %c\n",
LDptr->U.Pin.Name, $4);
LDptr->U.Pin.Orient = $4;
}
@ -1126,8 +1126,8 @@ FigGrp : FIGUREGROUP _FigGrp PopC
;
_FigGrp : FigGrpNameDef
{$$->p=NULL;
if(bug>5)fprintf(Error,"%5d _FigGrp: FigGrpNameDef cur_fg:%s\n", LineNumber, $1->s);
{$$->p=NULL;
if(bug>5)fprintf(Error,"%5d _FigGrp: FigGrpNameDef cur_fg:%s\n", LineNumber, $1->s);
strncpy(cur_fg, $1->s, 20);
for( pfg=pfgHead ; pfg != NULL ; pfg=pfg->nxt )
if( !strcmp($1->s, pfg->Name) )
@ -1142,16 +1142,16 @@ _FigGrp : FigGrpNameDef
| _FigGrp CornerType
| _FigGrp EndType
| _FigGrp PathWidth
{$$->n=$2; if(bug>5)fprintf(Error,"%5d _FigGrp: PathWidth %d\n", LineNumber, $2);
pfg->PathWidth = $2;
{$$->n=$2; if(bug>5)fprintf(Error,"%5d _FigGrp: PathWidth %d\n", LineNumber, $2);
pfg->PathWidth = $2;
}
| _FigGrp BorderWidth
| _FigGrp Color
| _FigGrp FillPattern
| _FigGrp BorderPat
| _FigGrp TextHeight
{$$->n=$2; if(bug>5)fprintf(Error,"%5d _FigGrp: TextHeight %d\n", LineNumber, $2);
pfg->TextHeight = $2;
{$$->n=$2; if(bug>5)fprintf(Error,"%5d _FigGrp: TextHeight %d\n", LineNumber, $2);
pfg->TextHeight = $2;
}
| _FigGrp Visible
{$$->n=$2; if(bug>5)fprintf(Error,"%5d _FigGrp: Visible %d\n", LineNumber, $2); }
@ -1176,7 +1176,7 @@ FigGrpOver : FIGUREGROUPOVERRIDE _FigGrpOver PopC
;
_FigGrpOver : FigGrpNameRef
{$$->p=NULL;
{$$->p=NULL;
if(bug>5)fprintf(Error,"%5d _FigGrpOver: FigGrpNameRef %s\n", LineNumber, $1->s); }
| _FigGrpOver CornerType
| _FigGrpOver EndType
@ -1186,10 +1186,10 @@ _FigGrpOver : FigGrpNameRef
| _FigGrpOver FillPattern
| _FigGrpOver BorderPat
| _FigGrpOver TextHeight
{$$->n=$2;
{$$->n=$2;
if(bug>5)fprintf(Error,"%5d _FigGrpOver: TextHeight %d\n", LineNumber, $2); }
| _FigGrpOver Visible
{$$->n=$2;
{$$->n=$2;
if(bug>5)fprintf(Error,"%5d _FigGrpOver: Visible=%d\n", LineNumber, $2); }
| _FigGrpOver Comment
{if(bug>5)fprintf(Error,"%5d _FigGrpOver: Comment \n", LineNumber); }
@ -1210,10 +1210,10 @@ Figure : FIGURE _Figure PopC
;
_Figure : FigGrpNameDef
{$$->p=NULL;
{$$->p=NULL;
if(bug>4)fprintf(Error,"%5d _Figure: FigGrpNameDef %s\n", LineNumber, $1->s);}
| FigGrpOver
{$$->p=NULL;
{$$->p=NULL;
}
| _Figure Circle
{
@ -1227,8 +1227,8 @@ _Figure : FigGrpNameDef
New->U.Circ.y = (($2->y+$2->nxt->y)/2);
a=$2->x - $2->nxt->x;
b=$2->y - $2->nxt->y;
New->U.Circ.r = (int) sqrt((a*a)+(b*b));
New->U.Circ.width = 0;
New->U.Circ.r = (int) sqrt((a*a)+(b*b));
New->U.Circ.width = 0;
New->Unit = 0;
}
| _Figure Dot
@ -1242,8 +1242,8 @@ _Figure : FigGrpNameDef
New->DrawType = CIRCLE_DRAW_TYPE;
New->U.Circ.x = $2->x ;
New->U.Circ.y = $2->y ;
New->U.Circ.r = 5;
New->U.Circ.width = 0;
New->U.Circ.r = 5;
New->U.Circ.width = 0;
New->Unit = 0;
#endif
}
@ -1260,13 +1260,13 @@ _Figure : FigGrpNameDef
LibEntry->Drawings = New; New->Unit = 0; New->Convert = convert;
New->U.Poly.width = 0;
New->DrawType = POLYLINE_DRAW_TYPE;
New->DrawType = POLYLINE_DRAW_TYPE;
for( pl = $2; pl != NULL ; pl=pl->nxt )
New->U.Poly.n++;
Poly = New->U.Poly.PolyList = (int*) Malloc( 2*New->U.Poly.n * sizeof(int) );
for( ; $2 != NULL ; $2=$2->nxt ){
*Poly++ = (int)( $2->x );
*Poly++ = (int)( $2->y );
*Poly++ = (int)( $2->x );
*Poly++ = (int)( $2->y );
}
}
| _Figure Polygon
@ -1277,13 +1277,13 @@ _Figure : FigGrpNameDef
LibEntry->Drawings = New; New->Unit = 0; New->Convert = convert;
New->U.Poly.width = 0;
New->DrawType = POLYLINE_DRAW_TYPE;
New->DrawType = POLYLINE_DRAW_TYPE;
for( pl = $2; pl != NULL ; pl=pl->nxt )
New->U.Poly.n++;
Poly = New->U.Poly.PolyList = (int*) Malloc( 2*New->U.Poly.n * sizeof(int) );
for( ; $2 != NULL ; $2=$2->nxt ){
*Poly++ = (int)( $2->x );
*Poly++ = (int)( $2->y );
*Poly++ = (int)( $2->x );
*Poly++ = (int)( $2->y );
}
}
| _Figure Rectangle
@ -1294,13 +1294,13 @@ _Figure : FigGrpNameDef
New->nxt = LibEntry->Drawings;
LibEntry->Drawings = New; New->Unit = 0; New->Convert = convert;
New->DrawType = SQUARE_DRAW_TYPE;
New->DrawType = SQUARE_DRAW_TYPE;
New->U.Sqr.width = 0;
New->U.Sqr.x1 = $2->x;
New->U.Sqr.y1 = $2->y;
New->U.Sqr.x2 = $2->nxt->x;
New->U.Sqr.y2 = $2->nxt->y;
if(bug>4)fprintf(Error," _Fig Rect %d %d %d %d\n",
if(bug>4)fprintf(Error," _Fig Rect %d %d %d %d\n",
New->U.Sqr.x1, New->U.Sqr.y1, New->U.Sqr.x2, New->U.Sqr.y2);
}
| _Figure Shape
@ -1412,7 +1412,7 @@ Initial : INITIAL PopC
InstNameDef : NameDef
{
if(bug>3)fprintf(Error,"%5d InstNameDef: '%s'\n", LineNumber, $1->s);
if(bug>3)fprintf(Error,"%5d InstNameDef: '%s'\n", LineNumber, $1->s);
tx=ty=0; ox=oy=0;
inst_pin_name_vis=1, inst_pin_num_vis=1;
Foot[0] = 0;
@ -1426,11 +1426,11 @@ InstNameDef : NameDef
Instance : INSTANCE InstNameDef _Instance PopC
{
int fcr;
$$=$2; ox=oy=0;
$$=$2; ox=oy=0;
if(bug>1){
fprintf(Error," INSTANCE:%s cellRef '%s' ", $2->s, cellRef);
if(ref->s) fprintf(Error,"ref '%s' ", ref->s);
if(val->s) fprintf(Error,"val '%s' ", val->s);
if(val->s) fprintf(Error,"val '%s' ", val->s);
fprintf(Error,"\n");
}
if(ref->s && !val->s )
@ -1473,26 +1473,26 @@ Instance : INSTANCE InstNameDef _Instance PopC
}
if( stp != NULL ){ // power Symbol
sprintf(refdesg,"#PWR%d", nPwr++);
if(bug>1)fprintf(Error," OutInst '%-24s' '%s' '%s' '%s' %d (%d,%d) [%d %d %d %d] oxy=%d %d\n",
cellRef, refdesg, val->s, null, TextSize, tx, -ty,
if(bug>1)fprintf(Error," OutInst '%-24s' '%s' '%s' '%s' %d (%d,%d) [%d %d %d %d] oxy=%d %d\n",
cellRef, refdesg, val->s, null, TextSize, tx, -ty,
IRot[0][0], IRot[0][1], IRot[1][0], IRot[1][1], ox, oy );
OutInst(cellRef, refdesg, val->s, null, MfgName, MfgPart, TextSize, tx+ox, -ty-oy,
OutInst(cellRef, refdesg, val->s, null, MfgName, MfgPart, TextSize, tx+ox, -ty-oy,
tx, -ty, tx, -ty, 0, 1, IRot);
}else{
if(bug>2)fprintf(Error," Check Power NOT '%s' '%s'\n", ref->s, val->s);
if( ref->s ){ // normal symbol
if(bug>1)fprintf(Error," OutInst '%s' '%s' '%s' '%s' %d %d,%d %d,%d %d,%d [%d %d %d %d]\n",
cellRef, ref->s, val->s, Foot, TextSize, tx, -ty,
ox+ref->p->x, -oy-ref->p->y, ox+val->p->x, -oy-val->p->y,
if(bug>1)fprintf(Error," OutInst '%s' '%s' '%s' '%s' %d %d,%d %d,%d %d,%d [%d %d %d %d]\n",
cellRef, ref->s, val->s, Foot, TextSize, tx, -ty,
ox+ref->p->x, -oy-ref->p->y, ox+val->p->x, -oy-val->p->y,
IRot[0][0], IRot[0][1], IRot[1][0], IRot[1][1] );
OutInst(cellRef, ref->s, val->s, Foot, MfgName, MfgPart, TextSize, tx, -ty,
OutInst(cellRef, ref->s, val->s, Foot, MfgName, MfgPart, TextSize, tx, -ty,
ox+ref->p->x, -oy-ref->p->y, ox+val->p->x, -oy-val->p->y, 0, 0, IRot);
} else {
sprintf(refdesg,"#ND%d", nPwr++);
if(bug>1)fprintf(Error," OutInst '%s' '%s' '%s' '%s' %d (%d,%d) [%d %d %d %d]\n",
cellRef, refdesg, null, null, TextSize, tx, -ty,
if(bug>1)fprintf(Error," OutInst '%s' '%s' '%s' '%s' %d (%d,%d) [%d %d %d %d]\n",
cellRef, refdesg, null, null, TextSize, tx, -ty,
IRot[0][0], IRot[0][1], IRot[1][0], IRot[1][1] );
OutInst(cellRef, refdesg, null, null, MfgName, MfgPart, TextSize, tx, -ty,
OutInst(cellRef, refdesg, null, null, MfgName, MfgPart, TextSize, tx, -ty,
tx, -ty, tx, -ty, 0, 0, IRot);
}
}
@ -1507,8 +1507,8 @@ Instance : INSTANCE InstNameDef _Instance PopC
_Instance : ViewRef
| ViewList
| _Instance Transform
{
// see ^Transform tx=$2->p->x; ty=$2->p->y;
{
// see ^Transform tx=$2->p->x; ty=$2->p->y;
if( $2->n != PIN_N ){
IRot[0][0] = Rot[0][0]; IRot[0][1] = Rot[0][1];
@ -1528,19 +1528,19 @@ _Instance : ViewRef
| _Instance Property
{if(bug>2)fprintf(Error," _Instance Property: '%s'='%s'\n", $2->s, $2->nxt->s);
if( !strcmp($2->s, "PIN_NAMES_VISIBLE") && !strcmp($2->nxt->s,"False"))
inst_pin_name_vis=0;
inst_pin_name_vis=0;
if( !strcmp($2->s, "PIN_NUMBERS_VISIBLE")&& !strcmp($2->nxt->s,"False"))
inst_pin_num_vis=0;
inst_pin_num_vis=0;
if( !strcmp($2->s, "PCB_FOOTPRINT") || !strcmp($2->s, "PCB_32_FOOTPRINT") )
strncpy(Foot, $2->nxt->s, FOOT_NAME_LEN);
strncpy(Foot, $2->nxt->s, FOOT_NAME_LEN);
if( !strcmp($2->s, "MFG") )
strncpy(MfgName, $2->nxt->s, MFG_NAME_LEN);
if( !strcmp($2->s, "MFG") )
strncpy(MfgName, $2->nxt->s, MFG_NAME_LEN);
if( !strcmp($2->s, "MFG_32_PART_35_") )
strncpy(MfgPart, $2->nxt->s, MFG_PART_LEN);
if( !strcmp($2->s, "MFG_32_PART_35_") )
strncpy(MfgPart, $2->nxt->s, MFG_PART_LEN);
}
| _Instance Comment
| _Instance UserData
@ -1630,7 +1630,7 @@ _Interface :
| _Interface Simulate
| _Interface Designator
{$$=$2; if(bug>4)fprintf(Error," _Interface Desig '%s'\n", $2->s);
strcpy(LibEntry->Prefix, $2->s);
strcpy(LibEntry->Prefix, $2->s);
}
| _Interface Property
| _Interface Comment
@ -1712,7 +1712,7 @@ _Justify : CENTERCENTER
;
KeywordDisp : KEYWORDDISPLAY _KeywordDisp PopC
{$$=$2;
{$$=$2;
if(bug>4 && $2->nxt != NULL )fprintf(Error,"%5d KEYWDISP: %s %s %d %d\n",
LineNumber, $2->s, $2->nxt->s, $2->p->x, $2->p->y);
if(bug>4 && $2->nxt == NULL )fprintf(Error,"%5d KEYWDISP: %s '' %d %d\n",
@ -1764,8 +1764,8 @@ LibNameDef : NameDef
CurrentLib = (LibraryStruct *) Malloc(sizeof(LibraryStruct));
CurrentLib->Name = strdup($1->s);
CurrentLib->isSheet = 0;
CurrentLib->Entries = NULL; CurrentLib->NumOfParts=0;
CurrentLib->isSheet = 0;
CurrentLib->Entries = NULL; CurrentLib->NumOfParts=0;
CurrentLib->nxt = Libs;
Libs=CurrentLib;
}
@ -2191,7 +2191,7 @@ _OpenShape : Curve
;
Orientation : ORIENTATION _Orientation PopC
{$$=$2;
{$$=$2;
if(bug>4)fprintf(Error," Orient %c\n",$2);
cur_Orient = $2;
}
@ -2234,18 +2234,18 @@ _Orientation : R0
#endif
}
| MYR90
{$$=PIN_RIGHT;
{$$=PIN_RIGHT;
Rot[0][0] = 0; Rot[0][1] = -1; Rot[1][0] = 1; Rot[1][1] = 0;
}
| MXR90
{$$=PIN_RIGHT;
{$$=PIN_RIGHT;
Rot[0][0] = 0; Rot[0][1] = 1; Rot[1][0] = -1; Rot[1][1] = 0;
}
;
Origin : ORIGIN PointValue PopC
{$$=$2; if(bug>6)fprintf(Error,"ORGIN: %d %d\n", $2->x, $2->y);
}
;
@ -2287,17 +2287,17 @@ Page : PAGE _Page PopC
_Page : InstNameDef
{if(bug>3)fprintf(Error,"\n _Page: InstNameDef? '%s'\n\n", $1->s);
// CurrentLib->Name = strdup($1->s);
CurrentLib->isSheet = 1;
strcpy(schName, $1->s);
CurrentLib->isSheet = 1;
strcpy(schName, $1->s);
CurrentLib = (LibraryStruct *) Malloc(sizeof(LibraryStruct));
CurrentLib->Name = strdup($1->s);
CurrentLib->isSheet = 1;
SchHead = 1;
CurrentLib->Entries = NULL; CurrentLib->NumOfParts=0;
SchHead = 1;
CurrentLib->Entries = NULL; CurrentLib->NumOfParts=0;
CurrentLib->nxt = Libs;
Libs=CurrentLib;
pptr = (struct pwr *) Malloc(sizeof(struct pwr));
pptr->s = $1->s;
pptr->s = $1->s;
pptr->r = NULL;
pptr->nxt = pgs;
pgs = pptr;
@ -2341,7 +2341,7 @@ Path : PATH _Path PopC
{$$=$2;
if(!SchHead){
for( pl=$2 ; pl->nxt != NULL ; pl=pl->nxt ){
if(bug>4)fprintf(Error," OutWire %d %d %d %d\n",
if(bug>4)fprintf(Error," OutWire %d %d %d %d\n",
pl->x, -pl->y, pl->nxt->x, -pl->nxt->y);
OutWire(pl->x, -pl->y, pl->nxt->x, -pl->nxt->y);
}
@ -2355,7 +2355,7 @@ _Path : PointList
fprintf(Error," _Path PointList ");
for( pl=$1 ; pl->nxt != NULL ; pl=pl->nxt )
fprintf(Error,"%d %d %d %d", pl->x, -pl->y, pl->nxt->x, -pl->nxt->y);
fprintf(Error,"\n");
fprintf(Error,"\n");
}
}
| _Path Property
@ -2414,10 +2414,10 @@ PointList : POINTLIST _PointList PopC
_PointList :
{$$=NULL;}
| _PointList PointValue
{
pl=(struct plst *)Malloc(sizeof(struct plst));
pl->x=$2->x;
pl->y=$2->y;
{
pl=(struct plst *)Malloc(sizeof(struct plst));
pl->x=$2->x;
pl->y=$2->y;
pl->nxt=$$;
$$ = pl;
}
@ -2426,15 +2426,15 @@ _PointList :
PointValue : '(' PT Int Int ')' PopC
{
if(bug>4)fprintf(Error,"PtVal %d %d\n", $3,$4);
$$=(struct plst *)Malloc(sizeof(struct plst));
$$=(struct plst *)Malloc(sizeof(struct plst));
$$->x=$3; $$->y=$4;
}
| PT Int Int PopC
{
if(bug>4)fprintf(Error,"PtVal %d %d\n", $2,$3);
$$=(struct plst *)Malloc(sizeof(struct plst));
$$=(struct plst *)Malloc(sizeof(struct plst));
$$->x=$2; $$->y=$3;
}
;
@ -2464,7 +2464,7 @@ PortNameDef : NameDef
New->DrawType = PIN_DRAW_TYPE; New->Convert = convert;
New->nxt = LibEntry->Drawings;
LibEntry->Drawings = New;
New->Unit = 1; // PartPerPack-ii;
New->Unit = 1; // PartPerPack-ii;
New->U.Pin.Len = 300;
New->U.Pin.PinShape = NONE; // NONE, DOT, CLOCK, SHORT
New->U.Pin.PinType = PIN_UNSPECIFIED;
@ -2493,7 +2493,7 @@ _Port : PortNameDef
| _Port Designator
{
$$=$2; if(bug>2)fprintf(Error," _Port Designator '%s'\n", $2->s);
// memset(New->U.Pin.Num, 0, 5); New->U.Pin.Num[0]='0';
// memset(New->U.Pin.Num, 0, 5); New->U.Pin.Num[0]='0';
if(!strcmp($2->s, "") ){
LibEntry->DrawPinNum=0;
}else
@ -2506,11 +2506,11 @@ _Port : PortNameDef
| _Port AcLoad
| _Port Property
{
$$=$2; if(bug>4)fprintf(Error," _Port Prop '%s'='%s' '%s' PShape %x\n",
$$=$2; if(bug>4)fprintf(Error," _Port Prop '%s'='%s' '%s' PShape %x\n",
$2->s, $2->nxt->s, New->U.Pin.Name, New->U.Pin.PinShape);
if( !strcmp($2->s, "PORTTYPE") && !strcmp($2->nxt->s, "supply") ){
if(bug>2)fprintf(Error,"fwb '%s':'%s'\n", New->U.Pin.Name, New->U.Pin.ReName);
New->U.Pin.PinType = PIN_POWER;
New->U.Pin.PinType = PIN_POWER;
for( stp=pwrSym ; stp !=NULL ; stp=stp->nxt) {
if( !strcmp(New->U.Pin.Name, stp->s)){
if(bug>4)fprintf(Error," Check Power '%s' '%s' \n", New->U.Pin.Name, stp->s);
@ -2594,25 +2594,25 @@ PortImpl : PORTIMPLEMENTATION _PortImpl PopC
;
_PortImpl : Name
{$$=$1;
{$$=$1;
if(bug>4 ){
fprintf(Error," _PortImpl Name '%s' ", $1->s);
if($1->nxt->s != NULL)fprintf(Error,"'%s' ", $1->nxt->s);
if($1->p != NULL)fprintf(Error,"'%s' (%d,%d)", $1->s, $1->p->x, $1->p->y);
fprintf(Error,"\n");
fprintf(Error," _PortImpl Name '%s' ", $1->s);
if($1->nxt->s != NULL)fprintf(Error,"'%s' ", $1->nxt->s);
if($1->p != NULL)fprintf(Error,"'%s' (%d,%d)", $1->s, $1->p->x, $1->p->y);
fprintf(Error,"\n");
}
cur_pnam = $1->s;
cur_pnam = $1->s;
}
| Ident
{if(bug>4)fprintf(Error," _PortImpl Ident '%s'\n", $1->s);
cur_pnam = $1->s;
}
| _PortImpl Figure
{$$=$2;
pl=$2->p;
{$$=$2;
pl=$2->p;
}
| _PortImpl ConnectLoc
{$$=$2; if(bug>4)fprintf(Error," _PortImpl ConnLoc:\n libRef '%s'\n cellRef '%s' cur_pnam '%s' %d,%d\n",
{$$=$2; if(bug>4)fprintf(Error," _PortImpl ConnLoc:\n libRef '%s'\n cellRef '%s' cur_pnam '%s' %d,%d\n",
libRef, cellRef, cur_pnam, $2->p->x, $2->p->y );
hx = $2->p->x; hy = $2->p->y;
val = $2;
@ -2681,7 +2681,7 @@ PortRef : PORTREF PortNameRef _PortRef PopC
if($3 != NULL)fprintf(Error,"InstRef:'%s' ", $3->s);
fprintf(Error,"\n");
}
if(cptr != NULL && $3 != NULL)
if(cptr != NULL && $3 != NULL)
cptr->pin = $2->s;
}
;
@ -2690,7 +2690,7 @@ _PortRef :
{$$=NULL;}
| PortRef
| InstanceRef
{$$=$1;
{$$=$1;
if(bug>4)fprintf(Error,"new cptr, InstRef: %8s curr_nnam '%s'\n", $1->s, cur_nnam);
cptr = (struct con *) malloc (sizeof (struct con));
@ -2710,7 +2710,7 @@ _Program :
;
PropDisp : PROPERTYDISPLAY _PropDisp PopC
{$$=$2;
{$$=$2;
if(bug>2 && $2->nxt->s != NULL)fprintf(Error,"%5d PropDisp: %s %s %d %d\n",
LineNumber, $2->s, $2->nxt->s, $2->p->x, $2->p->y);
if(bug>2 && $2->nxt->s == NULL)fprintf(Error,"%5d PropDisp: %s '' %d %d\n",
@ -2719,7 +2719,7 @@ PropDisp : PROPERTYDISPLAY _PropDisp PopC
if(!strcmp($2->s, "VALUE")){
LibEntry->NamePosX=$2->p->x; LibEntry->NamePosY=$2->p->y;
}
if(savtext && New!=NULL){
New->U.Text.Text = $2->s;
if( New->U.Text.Text == NULL )
@ -2757,10 +2757,10 @@ Property : PROPERTY PropNameDef _Property PopC
if( !strcmp($2->s, "PIN_32_NUMBERS_32_VISIBLE") && !strcmp($3->s, "False") ){
LibEntry->DrawPinNum = 0;
}
if( !strcmp($2->s, "EDIFHOTSPOT") ){
sscanf($3->s,"(pt_%d_%d", &x, &y);
if(bug>1)fprintf(Error," Property %s '%s' '%s' %d %d\n",
if(bug>1)fprintf(Error," Property %s '%s' '%s' %d %d\n",
LibEntry->Name, $2->s, $3->s, x,y);
LibEntry->PrefixPosX=x; LibEntry->PrefixPosY=y;
@ -2802,7 +2802,7 @@ Property : PROPERTY PropNameDef _Property PopC
}
;
_Property : TypedValue
_Property : TypedValue
| _Property Owner
| _Property Unit
| _Property Property
@ -2843,8 +2843,8 @@ _RangeVector :
;
Rectangle : RECTANGLE PointValue _Rectangle PopC
{
if(bug>4)fprintf(Error," RECTANGLE [%d %d][%d %d]\n", $2->x, $2->y, $3->x, $3->y);
{
if(bug>4)fprintf(Error," RECTANGLE [%d %d][%d %d]\n", $2->x, $2->y, $3->x, $3->y);
$$=$2; $$->nxt=$3;
}
;
@ -2896,7 +2896,7 @@ ScaledInt : Int
;
Scale : SCALE ScaledInt ScaledInt Unit PopC
{
{
scale = 100000.0 * $3 / (2.54 * $2);
if(bug>4)fprintf(stderr, "SCALE %f %g %f\n", $2, $3, scale);
// scale =1.0;
@ -3000,8 +3000,8 @@ _Steady : Duration
StrDisplay : STRINGDISPLAY _StrDisplay PopC
{$$=$2;
if(bug>3)fprintf(Error," STRINGDISPLAY _StrDiaplay '%s' ",$2->s);
if(bug>3 && $2->nxt)fprintf(Error," ='%s'\n",$2->nxt->s);
if(bug>3)fprintf(Error," STRINGDISPLAY _StrDiaplay '%s' ",$2->s);
if(bug>3 && $2->nxt)fprintf(Error," ='%s'\n",$2->nxt->s);
if(bug>3)fprintf(Error,"\n");
if(savtext && New!=NULL){
New->U.Text.Text = $2->s;
@ -3018,8 +3018,8 @@ StrDisplay : STRINGDISPLAY _StrDisplay PopC
_StrDisplay : STR
{$$=$1;
if(bug>3)fprintf(Error," _StrDisplay STR: '%s' \n",$1->s);
if(bug>3 && $1->nxt)fprintf(Error," = '%s' \n",$1->nxt->s);
if(bug>3)fprintf(Error," _StrDisplay STR: '%s' \n",$1->s);
if(bug>3 && $1->nxt)fprintf(Error," = '%s' \n",$1->nxt->s);
}
| _StrDisplay Display
{$$=$2;$1->nxt=$2;
@ -3027,16 +3027,16 @@ _StrDisplay : STR
$$->p=$2->p;
if(bug>4)
fprintf(Error,"%5d _StrDisplay Disp: '%s' '%s' %d %d ts=%d\n",
LineNumber, $1->s, $2->s, $2->p->x, $2->p->y, TextSize );
LineNumber, $1->s, $2->s, $2->p->x, $2->p->y, TextSize );
if( !strcmp($2->s, "PARTREFERENCE"))
ref->s=$1->s;
ref->s=$1->s;
if( !strcmp($2->s, "PARTVALUE"))
val->s=$1->s;
}else{
if(bug>4)
fprintf(Error,"%5d _StrDisplay Disp: '%s' NULL NULL ts=%d\n",
LineNumber, $1->s, TextSize );
LineNumber, $1->s, TextSize );
}
if(!SchHead && !InInstance){
@ -3046,7 +3046,7 @@ _StrDisplay : STR
if(bug>3)fprintf(Error," Searching '%s' %d\n", pfg->Name, pfg->TextHeight);
}
if( pfg != NULL ){
TextSize = pfg->TextHeight ;
TextSize = pfg->TextHeight ;
if(bug>4)fprintf(Error," Property Found '%s' %d\n", pfg->Name, pfg->TextHeight);
}else
TextSize=SIZE_PIN_TEXT;
@ -3055,7 +3055,7 @@ _StrDisplay : STR
if(inst_pin_num_vis==1 || inst_pin_name_vis==1){
if(bug>1)fprintf(Error,"%5d OutText D '%s' %d %d %d\n", LineNumber,
s, $2->p->x +ox, $2->p->y +oy, TextSize);
OutText(0, s, $2->p->x +ox, -$2->p->y +oy, TextSize);
OutText(0, s, $2->p->x +ox, -$2->p->y +oy, TextSize);
}
ox=oy=0;
}
@ -3157,7 +3157,7 @@ _Technology : NumberDefn
;
TextHeight : TEXTHEIGHT Int PopC
{$$=$2; TextSize = $2 ;
{$$=$2; TextSize = $2 ;
if(bug>4)fprintf(Error," TextHeight %d\n", $2);
}
;
@ -3193,7 +3193,7 @@ Transform : TRANSFORM _TransX _TransY _TransDelta _TransOrien _TransOrg PopC
$$->p=$6;
INew = New; // Instance position
if(bug>3)fprintf(Error,"%5d Transform: %c %d %d\n", LineNumber, $5, $6->x, $6->y);
tx=$6->x; ty=$6->y; // fwb
}
;
@ -3322,12 +3322,12 @@ ViewNameDef : NameDef
;
View : VIEW ViewNameDef ViewType _View PopC
{$$=$2;
{$$=$2;
if(bug>3){
if($4 == NULL)
fprintf(Error," VIEW: %s \n", $2->s);
if($4 == NULL)
fprintf(Error," VIEW: %s \n", $2->s);
else
fprintf(Error," VIEW: %s %s\n", $2->s, $4->s);
fprintf(Error," VIEW: %s %s\n", $2->s, $4->s);
}
if( $4 != NULL )
$$->nxt = $4;
@ -3338,7 +3338,7 @@ _View : Interface
{ if(bug>3)fprintf(Error," _view Interface: \n");}
| _View Status
| _View Contents
{$$=$2;
{$$=$2;
if( $2 != NULL ){
if(bug>3)fprintf(Error," _view Contents: '%s'\n", $2->s);
if( strstr($2->s, "PAGEBORDER") !=NULL || strstr($2->s, "TITLEBLOCK") !=NULL ) {
@ -3426,7 +3426,7 @@ _ViewType : MASKLAYOUT
;
Visible : VISIBLE BooleanValue PopC
{$$=$2;}
{$$=$2;}
;
VoltageMap : VOLTAGEMAP MiNoMaValue PopC
@ -3474,7 +3474,7 @@ _Written : TimeStamp
Name : NAME _Name PopC
{$$=$2;
if(bug>4){
fprintf(Error,"%5d NAME _Name: %s ", LineNumber, $2->s);
fprintf(Error,"%5d NAME _Name: %s ", LineNumber, $2->s);
// if( $2->nxt != NULL)fprintf(Error,"%s ", $2->nxt->s);
// if( $2->p != NULL)fprintf(Error,"%s ", $2->p->x, $2->p->y);
fprintf(Error,"\n");
@ -3485,8 +3485,8 @@ Name : NAME _Name PopC
_Name : Ident
{if(bug>4)fprintf(Error,"%5d _Name: Ident '%s'\n", LineNumber, $1->s); }
| _Name Display
{if(bug>4 && $2->p == NULL)fprintf(Error,"%5d _Name: Display '%s'\n", LineNumber, $1->s);
if(bug>4 && $2->p != NULL)fprintf(Error,"%5d _Name: Display '%s' (%d,%d)\n", LineNumber, $1->s, $2->p->x, $2->p->y);
{if(bug>4 && $2->p == NULL)fprintf(Error,"%5d _Name: Display '%s'\n", LineNumber, $1->s);
if(bug>4 && $2->p != NULL)fprintf(Error,"%5d _Name: Display '%s' (%d,%d)\n", LineNumber, $1->s, $2->p->x, $2->p->y);
$$=$1; $$->p = $2->p; $$->nxt=$2;
if($2->p != NULL){
@ -3497,7 +3497,7 @@ _Name : Ident
for( LDptr=LEptr->Drawings ; LDptr != NULL && !stop ; LDptr=LDptr->nxt ){
if( LDptr->DrawType != PIN_DRAW_TYPE)
continue;
if(bug>4)fprintf(Error," _Name Check '%s' '%s' %s\n",
if(bug>4)fprintf(Error," _Name Check '%s' '%s' %s\n",
s, LDptr->U.Pin.Name, LDptr->U.Pin.ReName);
if( !strcmp(s, LDptr->U.Pin.Name )){
if( LDptr->U.Pin.ReName != NULL )
@ -3510,11 +3510,11 @@ _Name : Ident
// Global Label or Normal
if(inst_pin_num_vis==1 || inst_pin_name_vis==1){
if( $1->nxt != NULL && !strcmp($1->nxt->s, "OFFPAGECONNECTOR")) {
if(bug>1)fprintf(Error," OutText G '%s' %d %d %d\n",
if(bug>1)fprintf(Error," OutText G '%s' %d %d %d\n",
s, $2->p->x +ox, $2->p->y +oy, TextSize);
OutText(1, s, $2->p->x +ox, -$2->p->y +oy, TextSize);
} else {
if(bug>1)fprintf(Error," OutText L '%s' %d %d %d\n",
if(bug>1)fprintf(Error," OutText L '%s' %d %d %d\n",
s, $2->p->x +ox, $2->p->y +oy, TextSize);
OutText(0, s, $2->p->x +ox, -$2->p->y +oy, TextSize);
}
@ -3555,10 +3555,10 @@ if(bug>2) {
if(libRef !=NULL)fprintf(Error,"libRef '%s'\n", libRef);
if(cellRef !=NULL)fprintf(Error," cellRef '%s'", cellRef);
if(cur_pnam !=NULL)fprintf(Error," cur_pnam '%s'", cur_pnam);
fprintf(Error," txy:(%d,%d) hxy:(%d,%d)",tx,ty, hx,hy);
fprintf(Error," txy:(%d,%d) hxy:(%d,%d)",tx,ty, hx,hy);
if(pl !=NULL)fprintf(Error," pl:(%d,%d)", pl->x, pl->y);
if(pl!=NULL && pl->nxt!=NULL)fprintf(Error," plnxt:(%d,%d)", pl->nxt->x, pl->nxt->y);
fprintf(Error,"\n");
fprintf(Error,"\n");
}
if( cur_pnam != NULL ){
@ -3573,7 +3573,7 @@ if( cur_pnam != NULL ){
}
if( LDptr != NULL) {
if(bug>3)fprintf(Error," cur_pname:%s LDptr:%s hxy:(%d,%d) txy:(%d,%d)\n\n ",
cur_pnam,LDptr->U.Pin.Name, hx,hy, tx,ty);
cur_pnam,LDptr->U.Pin.Name, hx,hy, tx,ty);
LDptr->U.Pin.posX = hx;
LDptr->U.Pin.posY = hy;
@ -3615,7 +3615,7 @@ if( cur_pnam != NULL ){
break;
}
if( fcr && LDptr == NULL ){ // new (Power) Pin if it doesn't already exist
if(bug>2)fprintf(Error," new Power Pin:%s hxy:(%d,%d) txy:(%d,%d)\n\n",cur_pnam, hx,hy, tx,ty);
if(bug>2)fprintf(Error," new Power Pin:%s hxy:(%d,%d) txy:(%d,%d)\n\n",cur_pnam, hx,hy, tx,ty);
// OrCad 10 puts HOTSPOTS in Instance, S/B pin posX in Cell definition
New = (LibraryDrawEntryStruct *) Malloc(sizeof(LibraryDrawEntryStruct));
New->DrawType = PIN_DRAW_TYPE; New->Convert = convert;
@ -5161,7 +5161,7 @@ int yylex()
for (s = L_START, l = 0; 1; ){
c = Getc(Input);
if( c !='&' )
yytext[l++] = c;
yytext[l++] = c;
if (c == '\n' && s==L_START){
LineNumber++ ;
}
@ -5217,7 +5217,7 @@ int yylex()
return (c);
}
// yylval.s = strcpy((char *)Malloc(l + 1),yytext);
// st->s = strdup(yytext);
// st->s = strdup(yytext);
st = (struct st *)Malloc(sizeof (struct st));
if(l>0 && st != NULL){
st->s = (char *)Malloc(l + 1); st->nxt=NULL;
@ -5258,7 +5258,7 @@ int yylex()
}
// yylval.s = strcpy((char *)Malloc(l + 1),yytext);
st = (struct st *)Malloc(sizeof (struct st));
st->s = strdup(yytext); st->nxt=NULL;
st->s = strdup(yytext); st->nxt=NULL;
yylval.st = st ;
Stack(yytext, KEYWORD);
return (KEYWORD);
@ -5273,8 +5273,8 @@ int yylex()
else if (c == '"' || c == EOF){
st = (struct st *)Malloc(sizeof (struct st));
st->s = FormString(); st->nxt=NULL;
// st->s = strdup(yytext);
yylval.st = st ;
// st->s = strdup(yytext);
yylval.st = st ;
Stack(yytext, STR);
return (STR);
// } else if (c == '%'){ // fwb

View File

@ -20,17 +20,17 @@ e2net : ed.h eelibsl.h e2net.o edif.o savelib.o
e2sch : ed.h eelibsl.h e2sch.o edif.o savelib.o
gcc $(CFLAGS) e2sch.o edif.o savelib.o -o e2sch -lm
savelib : fctsys.h eelibsl.h savelib.o
savelib : fctsys.h eelibsl.h savelib.o
gcc $(CFLAGS) -c savelib.c
edif : ed.h eelibsl.h edif.o
edif : ed.h eelibsl.h edif.o
gcc $(CFLAGS) -c edif.c
// main.o : main.c
edif.o : edif.c
edif.c : edif.y
bison -t -v -d edif.y
bison -t -v -d edif.y
cp edif.tab.c edif.c
# mv y.tab.c edif.c
@ -39,5 +39,5 @@ edif.c : edif.y
# cat edif.y.1 edif.y.2 > edif.y
clean :
rm *.o edif.c edif.output edif.tab.c edif.tab.h e2sch e2net ppedif
rm *.o edif.c edif.output edif.tab.c edif.tab.h e2sch e2net ppedif
rm e2net.exe e2sch.exe ppedif.exe

View File

@ -13,12 +13,10 @@
FILE *FileEdf, *FileNet, *FileEESchema, *FileKiPro ;
extern char FileNameKiPro[], FileNameEESchema[], FileNameLib[];
extern float scale;
char *cwd;
OutPro(LibraryStruct * Libs)
{
int i;
cwd = (char *)get_current_dir_name();
sprintf(FileNameKiPro,"%s.pro", schName);
if( (FileKiPro = fopen( FileNameKiPro, "wt" )) == NULL ) {
@ -29,7 +27,6 @@ OutPro(LibraryStruct * Libs)
fprintf(FileKiPro,"last_client=eeschema\n");
fprintf(FileKiPro,"[eeschema]\n");
fprintf(FileKiPro,"version=1\n");
//fprintf(FileKiPro,"LibDir=%s\n", cwd ); //"."
fprintf(FileKiPro,"LibDir=\n"); //"."
fprintf(FileKiPro,"NetFmt=1\n");
fprintf(FileKiPro,"HPGLSpd=20\n");
@ -62,7 +59,7 @@ OutPro(LibraryStruct * Libs)
OutHead(LibraryStruct *Libs)
{
OutEnd(); // close if previous open
sprintf(FileNameEESchema,"%s.sch", schName);
if( (FileEESchema = fopen( FileNameEESchema, "wt" )) == NULL ) {
fprintf(stderr, " %s impossible to create\n", FileNameEESchema);
@ -143,7 +140,7 @@ int g, x,y;
// modify bus range
for( st=s ; ; s++,t++ ){
if(*s == ':'){
*t++ = '.'; *t = '.';
*t++ = '.'; *t = '.';
}else
*t = *s;
if(*s == '\0')
@ -154,7 +151,7 @@ int g, x,y;
st[0] = '{';
for( t=st; *t ; t++){
if( *t == ']' )
*t = '}';
*t = '}';
}
}
fx = OFF + scale * (float)x; fy = OFF + scale * (float)y;
@ -287,7 +284,7 @@ LibraryEntryStruct *LibEntry;
int ii;
LibEntry = (LibraryEntryStruct *) CurrentLib->Entries;
ii = CurrentLib->NumOfParts ;
ii = CurrentLib->NumOfParts ;
fprintf(stderr, "%03d #parts %s\n", ii, CurrentLib->Name);
for( ; ii > 0; ii-- ) {
if(LibEntry != NULL) {
@ -343,8 +340,8 @@ int x1,y1,x2,y2,r;
LibEntry->NumOfUnits, UNUSED, 'N');
/* Position / orientation / visibilite des champs */
x1 = scale*(float)LibEntry->PrefixPosX;
y1 = scale*(float)LibEntry->PrefixPosY;
x1 = scale*(float)LibEntry->PrefixPosX;
y1 = scale*(float)LibEntry->PrefixPosY;
fprintf(ExportFile,"F0 \"%s\" %d %d %d %c %c\n",
LibEntry->Prefix,
x1, y1,
@ -352,8 +349,8 @@ int x1,y1,x2,y2,r;
LibEntry->PrefixOrient == 0 ? 'H' : 'V',
LibEntry->DrawPrefix ? 'V' : 'I' );
x1 = scale*(float)LibEntry->NamePosX;
y1 = scale*(float)LibEntry->NamePosY;
x1 = scale*(float)LibEntry->NamePosX;
y1 = scale*(float)LibEntry->NamePosY;
fprintf(ExportFile,"F1 \"%s\" %d %d %d %c %c\n",
LibEntry->Name,
x1, y1,

View File

@ -389,6 +389,7 @@ EXTERN_BITMAP( pintype_noconnect_xpm )
EXTERN_BITMAP( pin_to_xpm )
EXTERN_BITMAP( pin_xpm )
EXTERN_BITMAP( plot_hpg_xpm )
EXTERN_BITMAP( plot_pdf_xpm )
EXTERN_BITMAP( plot_ps_xpm )
EXTERN_BITMAP( plot_xpm )
EXTERN_BITMAP( polar_coord_xpm )

View File

@ -14,9 +14,14 @@ class wxAuiToolBar;
class LAYER_BOX_SELECTOR : public wxBitmapComboBox
{
private:
protected:
bool m_layerhotkeys;
bool m_layerorder;
public:
// Hotkey Info
struct EDA_HOTKEY_CONFIG* m_hotkeys;
public:
LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
@ -27,7 +32,19 @@ public:
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices );
// Get Current Item #
// Returns a color index from the layer id
// Virtual function because GerbView uses its own functions in a derived class
virtual int GetLayerColor( int aLayerIndex ) = 0;
// Returns the name of the layer id
// Virtual pure function because GerbView uses its own functions in a derived class
virtual const wxString GetLayerName( int aLayerIndex ) = 0;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function pure because GerbView uses its own functions in a derived class
virtual bool IsLayerEnabled( int aLayerIndex ) = 0;
// Get Current Item #
int GetChoice();
// Get Current Layer
@ -37,13 +54,18 @@ public:
int SetLayerSelection(int layer);
// Reload the Layers
void Resync();
// Virtual pure function because GerbView uses its own functions in a derived class
virtual void Resync() = 0;
// Reload the Layers bitmaps colors
void ResyncBitmapOnly();
bool SetLayersOrdered(bool value);
bool SetLayersHotkeys(bool value);
// Hotkey Info
struct EDA_HOTKEY_CONFIG* m_hotkeys;
protected:
// Fills the layer bitmap aLayerbmp with the layer color
void SetBitmapLayer( wxBitmap& aLayerbmp, int aLayerIndex );
};
#define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \
@ -65,5 +87,4 @@ public:
HK_SWITCH_LAYER_TO_INNER14, \
HK_SWITCH_LAYER_TO_COMPONENT \
};
#endif //CLASS_LAYER_BOX_SELECTOR_H

View File

@ -32,7 +32,6 @@
#include <wxBasePcbFrame.h>
#include <param_config.h>
#include <class_layer_box_selector.h>
#include <class_macros_record.h>
#include <class_undoredo_container.h>
#include <zones.h>
@ -63,6 +62,7 @@ class GENERAL_COLLECTORS_GUIDE;
class PCB_LAYER_WIDGET;
class MARKER_PCB;
class BOARD_ITEM;
class PCB_LAYER_BOX_SELECTOR;
/**
@ -201,7 +201,7 @@ protected:
int propagate();
public:
LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
wxComboBox* m_SelTrackWidthBox; // a combo box to display and select current track width
wxComboBox* m_SelViaSizeBox; // a combo box to display and select current via diameter
@ -495,7 +495,7 @@ public:
void ReCreateMicrowaveVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
LAYER_BOX_SELECTOR* ReCreateLayerBox( wxAuiToolBar* parent );
PCB_LAYER_BOX_SELECTOR* ReCreateLayerBox( wxAuiToolBar* parent );
/**
* Function OnModify

View File

@ -97,6 +97,7 @@ set(PCBNEW_SRCS
block_module_editor.cpp
build_BOM_from_board.cpp
# class_footprint_library.cpp
class_pcb_layer_box_selector.cpp
class_pcb_layer_widget.cpp
clean.cpp
connect.cpp

View File

@ -597,50 +597,12 @@ void PCB_BASE_FRAME::UpdateStatusBar()
line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta );
SetStatusText( line, 2 );
}
else
{
// Display absolute coordinates:
dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x );
dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y );
if ( g_UserUnit == MILLIMETRES )
{
dXpos = RoundTo0( dXpos, 1000.0 );
dYpos = RoundTo0( dYpos, 1000.0 );
}
// The following sadly is an if Eeschema/if Pcbnew
wxString absformatter;
switch( g_UserUnit )
{
case INCHES:
absformatter = wxT( "X %.4f Y %.4f" );
locformatter = wxT( "dx %.4f dy %.4f d %.4f" );
break;
case MILLIMETRES:
absformatter = wxT( "X %.3f Y %.3f" );
locformatter = wxT( "dx %.3f dy %.3f d %.3f" );
break;
case UNSCALED_UNITS:
absformatter = wxT( "X %f Y %f" );
locformatter = wxT( "dx %f dy %f d %f" );
break;
}
line.Printf( absformatter, dXpos, dYpos );
SetStatusText( line, 2 );
SetStatusText( line, 3 );
}
// Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx );
dYpos = To_User_Unit( g_UserUnit, dy );
// Display absolute coordinates:
dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x );
dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y );
if ( g_UserUnit == MILLIMETRES )
{
@ -648,9 +610,48 @@ void PCB_BASE_FRAME::UpdateStatusBar()
dYpos = RoundTo0( dYpos, 1000.0 );
}
// We already decided the formatter above
line.Printf( locformatter, dXpos, dYpos, sqrt( dXpos * dXpos + dYpos * dYpos ) );
SetStatusText( line, 3 );
// The following sadly is an if Eeschema/if Pcbnew
wxString absformatter;
switch( g_UserUnit )
{
case INCHES:
absformatter = wxT( "X %.4f Y %.4f" );
locformatter = wxT( "dx %.4f dy %.4f d %.4f" );
break;
case MILLIMETRES:
absformatter = wxT( "X %.3f Y %.3f" );
locformatter = wxT( "dx %.3f dy %.3f d %.3f" );
break;
case UNSCALED_UNITS:
absformatter = wxT( "X %f Y %f" );
locformatter = wxT( "dx %f dy %f d %f" );
break;
}
line.Printf( absformatter, dXpos, dYpos );
SetStatusText( line, 2 );
if( !DisplayOpt.DisplayPolarCood ) // display relative cartesian coordinates
{
// Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx );
dYpos = To_User_Unit( g_UserUnit, dy );
if ( g_UserUnit == MILLIMETRES )
{
dXpos = RoundTo0( dXpos, 1000.0 );
dYpos = RoundTo0( dYpos, 1000.0 );
}
// We already decided the formatter above
line.Printf( locformatter, dXpos, dYpos, sqrt( dXpos * dXpos + dYpos * dYpos ) );
SetStatusText( line, 3 );
}
}

View File

@ -0,0 +1,112 @@
/**
* @file class_pcb_layer_box_selector.cpp
* @brief a derived class of LAYER_BOX_SELECTOR to handle the layer box selector
* in Pcbnew
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 Jean-Pierre Charras <jean-pierre.charras@ujf-grenoble.fr>
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <common.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
#include <colors_selection.h>
#include <layers_id_colors_and_visibility.h>
#include <class_board.h>
#include <hotkeys.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/bmpcbox.h>
#include <wx/wx.h>
#include <class_pcb_layer_box_selector.h>
/* class to display a layer list.
*
*/
// Reload the Layers
void PCB_LAYER_BOX_SELECTOR::Resync()
{
Clear();
static DECLARE_LAYERS_ORDER_LIST( layertranscode );
static DECLARE_LAYERS_HOTKEY( layerhk );
for( int i = 0; i < LAYER_COUNT; i++ )
{
wxBitmap layerbmp( 14, 14 );
wxString layername;
int layerid = i;
if( m_layerorder )
layerid = layertranscode[i];
if( ! IsLayerEnabled( layerid ) )
continue;
SetBitmapLayer( layerbmp, layerid );
layername = GetLayerName( layerid );
if( m_layerhotkeys && m_hotkeys != NULL )
layername = AddHotkeyName( layername, m_hotkeys, layerhk[layerid], IS_COMMENT );
Append( layername, layerbmp, (void*) layerid );
}
}
// Returns true if the layer id is enabled (i.e. is it should be displayed)
bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( int aLayerIndex )
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
wxASSERT( board != NULL );
return board->IsLayerEnabled( aLayerIndex );
}
// Returns a color index from the layer id
int PCB_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex )
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
wxASSERT( board != NULL );
return board->GetLayerColor( aLayerIndex );
}
// Returns the name of the layer id
const wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( int aLayerIndex )
{
PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
BOARD* board = pcbFrame->GetBoard();
wxASSERT( board != NULL );
return board->GetLayerName( aLayerIndex );
}

View File

@ -0,0 +1,73 @@
#ifndef CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H
#define CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H 1
#include <class_layer_box_selector.h>
/* class to display a layer list in Pcbnew.
*
*/
/* class to display a layer list.
*
*/
class PCB_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{
public:
// Hotkey Info
struct EDA_HOTKEY_CONFIG* m_hotkeys;
public:
PCB_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL )
:LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{
}
PCB_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices )
:LAYER_BOX_SELECTOR( parent, id, pos, size, choices )
{
}
// Reload the Layers names and bitmaps
// Virtual function
void Resync();
// Returns a color index from the layer id
// Virtual function
int GetLayerColor( int aLayerIndex );
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
bool IsLayerEnabled( int aLayerIndex );
// Returns the name of the layer id
// Virtual function
const wxString GetLayerName( int aLayerIndex );
};
#define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \
{ \
HK_SWITCH_LAYER_TO_COPPER, \
HK_SWITCH_LAYER_TO_INNER1, \
HK_SWITCH_LAYER_TO_INNER2, \
HK_SWITCH_LAYER_TO_INNER3, \
HK_SWITCH_LAYER_TO_INNER4, \
HK_SWITCH_LAYER_TO_INNER5, \
HK_SWITCH_LAYER_TO_INNER6, \
HK_SWITCH_LAYER_TO_INNER7, \
HK_SWITCH_LAYER_TO_INNER8, \
HK_SWITCH_LAYER_TO_INNER9, \
HK_SWITCH_LAYER_TO_INNER10, \
HK_SWITCH_LAYER_TO_INNER11, \
HK_SWITCH_LAYER_TO_INNER12, \
HK_SWITCH_LAYER_TO_INNER13, \
HK_SWITCH_LAYER_TO_INNER14, \
HK_SWITCH_LAYER_TO_COMPONENT \
};
#endif //CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H

View File

@ -0,0 +1,57 @@
// Do not edit this file, it is autogenerated by CMake from an HTML file
"<html>"
"<!-- This file is used to autogenerate a *.h file, but you can load it into a browser to preview -->"
"<h1>Freerouter Guidelines:</h1>"
"<ol>"
"<li> in pcbnew, using the Layers Setup dialog:</li><br>"
" <li>choose the number of layers, and enter the name of each layer.</li><br><br>"
" These should look something like this (if a 6 layer board):"
"<ul>"
" <li>Front - signal</li>"
" <li>Ground - power</li>"
" <li>H1_Signal - signal</li>"
" <li>V2_Signal - signal</li>"
" <li>Power - power</li>"
" <li>Back - signal</li>"
"</ul><br>"
" Notice that after the layer name there is a layer type field, either 'signal' or 'power', typically."
" Any layer identified as 'power' will be removed from the layer menu in Freerouter,"
" as this will be assumed to contain a power zone."
"</li><br><br>"
"<li> in pcbnew: establish board perimeter.</li><br>"
"<li> in pcbnew: load in the netlist so you have all the components defined and instantiated.</li><br>"
"<li> in pcbnew: establish any zones, inclusive of net association.</li><br>"
"<li> in pcbnew: do the degree of component placements you are comfortable with."
" It is a little easier to accurately position components in pcbnew than in"
" freerouter, but either will work.</li><br>"
"<li> in pcbnew: set up the netclasses. Power traces might be a little thicker"
" than signal traces. If so, add a netclass called 'power'."
" Make its traces thicker than what you establish for netclass 'Default'."
" Set trace width, spacing and vias for each netclass.</li><br>"
"<li> in pcbnew: export to DSN.</li><br>"
"<li> load up freerouter (keep it running for any subsequent iterations of 5) through 16) here).</li><br>"
"<li> in freerouter: load the project's *.dsn file. Immediately after a load, all"
" components and traces (if any) will initially be 'fixed'. This is a 'lock"
" in place' toggle that you can undo by selecting a region with your mouse"
" and then selecting 'Unfix' from the menu. Occassionally you may want to"
" re-fix a trace or a part, if only temporarily. This keeps it locked in"
" place."
"</li><br>"
"<li> useful, not mandatory: in freerouter: set your move snap modulus, which seems"
" to default to 1 internal unit."
" 20 mils in x and in y is about reasonable.</li><br>"
"<li> in freerouter: finish placing any components, you can change sides of a part"
" here also, rotate, whatever.</li><br>"
"<li> in freerouter: route the board, and save frequently to a *.dsn file while"
" routing in case of power loss. Pick the menu option for saving a full *.dsn"
" file, not a session file (yet). The full freerouter *.dsn file is a superset"
" format, one that can be reloaded in the event of a power loss. Whereas the"
" *.ses file is not a complete design, but only with the *.brd file"
" constitutes a full design. So it is important to backup your work to a"
" *.dsn file while routing in case of power loss.</li><br>"
"<li> in freerouter: when done, or when you want to back import, then save as a session file, *.ses.</li><br>"
"<li> in pcbnew: backimport the session file</li><br>"
"<li> in pcbnew: at this point the zones have to be refilled. One way to do that"
" is to simply run DRC.</li>"
"</ol>"
"</html>"

View File

@ -48,6 +48,7 @@
#include <class_track.h>
#include <class_zone.h>
#include <modview_frame.h>
#include <class_pcb_layer_box_selector.h>
#include <dialog_drc.h>

View File

@ -32,15 +32,19 @@
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <gr_basic.h>
#include <wxBasePcbFrame.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <base_units.h>
#include <class_board.h>
#include <pcbnew.h>
#include <protos.h>
#ifdef PCBNEW
#include <wxBasePcbFrame.h>
#include <class_board.h>
#include <pcbnew.h>
#else
#include <wxstruct.h>
#include <class_base_screen.h>
#include <layers_id_colors_and_visibility.h>
#include <gerbview_frame.h>
#endif
#include <printout_controler.h>
// This class is an helper to pass print parameters to print functions
@ -76,10 +80,11 @@ BOARD_PRINTOUT_CONTROLER::BOARD_PRINTOUT_CONTROLER( const PRINT_PARAMETERS& prin
bool BOARD_PRINTOUT_CONTROLER::OnPrintPage( int page )
{
#ifdef PCBNEW
int layers_count = NB_LAYERS;
if( m_Parent->IsType( GERBER_FRAME ) )
layers_count = 32;
#else
int layers_count = LAYER_COUNT;
#endif
int mask_layer = m_PrintParams.m_PrintMaskLayer;
@ -106,9 +111,11 @@ bool BOARD_PRINTOUT_CONTROLER::OnPrintPage( int page )
if( m_PrintParams.m_PrintMaskLayer == 0 )
return false;
#ifdef PCBNEW
// In Pcbnew we can want the layer EDGE always printed
if( m_PrintParams.m_Flags == 1 )
m_PrintParams.m_PrintMaskLayer |= EDGE_LAYER;
#endif
DrawPage();
@ -147,7 +154,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
double userscale;
double DrawZoom = 1;
wxDC* dc = GetDC();
PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen();
BASE_SCREEN* screen = m_Parent->GetScreen();
bool printMirror = m_PrintParams.m_PrintMirror;
wxBusyCursor dummy;
@ -162,10 +169,13 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
PCB_BASE_FRAME* pcbframe = (PCB_BASE_FRAME*) m_Parent;
#ifdef PCBNEW
EDA_RECT bbbox= ((PCB_BASE_FRAME*) m_Parent)->GetBoard()->ComputeBoundingBox();
#else
EDA_RECT bbbox = ((GERBVIEW_FRAME*) m_Parent)->GetLayoutBoundingBox();
#endif
wxSize pageSizeIU = pcbframe->GetPageSizeIU(); // internal units
EDA_RECT bbbox = pcbframe->GetBoard()->ComputeBoundingBox();
wxSize pageSizeIU = m_Parent->GetPageSizeIU(); // internal units
// In module editor, the module is located at 0,0 but for printing
// it is moved to pageSizeIU.x/2, pageSizeIU.y/2.
@ -181,7 +191,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
if( userscale == 0 ) // fit in page
{
// Margin = 10mm
int extra_margin = int( 10 * IU_PER_MM ); // deci-mils
int extra_margin = int( 10 * IU_PER_MM );
pageSizeIU.x = bbbox.GetWidth() + extra_margin * 2;
pageSizeIU.y = bbbox.GetHeight() + extra_margin * 2;

View File

@ -40,6 +40,7 @@
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <hotkeys.h>
#include <class_pcb_layer_box_selector.h>
#include <wx/wupdlock.h>
@ -273,7 +274,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator();
if( m_SelLayerBox == NULL )
m_SelLayerBox = new LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_PCB_SELECT_LAYER );
m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_PCB_SELECT_LAYER );
ReCreateLayerBox( m_mainToolBar );
m_mainToolBar->AddControl( m_SelLayerBox );
@ -644,7 +645,7 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox()
}
LAYER_BOX_SELECTOR* PCB_EDIT_FRAME::ReCreateLayerBox( wxAuiToolBar* parent )
PCB_LAYER_BOX_SELECTOR* PCB_EDIT_FRAME::ReCreateLayerBox( wxAuiToolBar* parent )
{
if( m_SelLayerBox == NULL )
return NULL;

View File

@ -41,6 +41,7 @@
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <drc_stuff.h>
#include <class_pcb_layer_box_selector.h>
void PCB_EDIT_FRAME::OnUpdateLayerPair( wxUpdateUIEvent& aEvent )

View File

@ -1,4 +1,5 @@
set(ZLIB_SRCS
adler32.c
compress.c
crc32.c
deflate.c

View File

@ -1,855 +0,0 @@
ChangeLog file for zlib
Changes in 1.2.3 (18 July 2005)
- Apply security vulnerability fixes to contrib/infback9 as well
- Clean up some text files (carriage returns, trailing space)
- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
Changes in 1.2.2.4 (11 July 2005)
- Add inflatePrime() function for starting inflation at bit boundary
- Avoid some Visual C warnings in deflate.c
- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit
compile
- Fix some spelling errors in comments [Betts]
- Correct inflateInit2() error return documentation in zlib.h
- Added zran.c example of compressed data random access to examples
directory, shows use of inflatePrime()
- Fix cast for assignments to strm->state in inflate.c and infback.c
- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
- Move declarations of gf2 functions to right place in crc32.c [Oberhumer]
- Add cast in trees.c t avoid a warning [Oberhumer]
- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer]
- Update make_vms.com [Zinser]
- Initialize state->write in inflateReset() since copied in inflate_fast()
- Be more strict on incomplete code sets in inflate_table() and increase
ENOUGH and MAXD -- this repairs a possible security vulnerability for
invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for
discovering the vulnerability and providing test cases.
- Add ia64 support to configure for HP-UX [Smith]
- Add error return to gzread() for format or i/o error [Levin]
- Use malloc.h for OS/2 [Necasek]
Changes in 1.2.2.3 (27 May 2005)
- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile
- Typecast fread() return values in gzio.c [Vollant]
- Remove trailing space in minigzip.c outmode (VC++ can't deal with it)
- Fix crc check bug in gzread() after gzungetc() [Heiner]
- Add the deflateTune() function to adjust internal compression parameters
- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack)
- Remove an incorrect assertion in examples/zpipe.c
- Add C++ wrapper in infback9.h [Donais]
- Fix bug in inflateCopy() when decoding fixed codes
- Note in zlib.h how much deflateSetDictionary() actually uses
- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used)
- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer]
- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer]
- Add gzdirect() function to indicate transparent reads
- Update contrib/minizip [Vollant]
- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer]
- Add casts in crc32.c to avoid warnings [Oberhumer]
- Add contrib/masmx64 [Vollant]
- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant]
Changes in 1.2.2.2 (30 December 2004)
- Replace structure assignments in deflate.c and inflate.c with zmemcpy to
avoid implicit memcpy calls (portability for no-library compilation)
- Increase sprintf() buffer size in gzdopen() to allow for large numbers
- Add INFLATE_STRICT to check distances against zlib header
- Improve WinCE errno handling and comments [Chang]
- Remove comment about no gzip header processing in FAQ
- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
- Add updated make_vms.com [Coghlan], update README
- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html.
- Add FAQ entry and comments in deflate.c on uninitialized memory access
- Add Solaris 9 make options in configure [Gilbert]
- Allow strerror() usage in gzio.c for STDC
- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer]
- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant]
- Use z_off_t for adler32_combine() and crc32_combine() lengths
- Make adler32() much faster for small len
- Use OS_CODE in deflate() default gzip header
Changes in 1.2.2.1 (31 October 2004)
- Allow inflateSetDictionary() call for raw inflate
- Fix inflate header crc check bug for file names and comments
- Add deflateSetHeader() and gz_header structure for custom gzip headers
- Add inflateGetheader() to retrieve gzip headers
- Add crc32_combine() and adler32_combine() functions
- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list
- Use zstreamp consistently in zlib.h (inflate_back functions)
- Remove GUNZIP condition from definition of inflate_mode in inflate.h
and in contrib/inflate86/inffast.S [Truta, Anderson]
- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson]
- Update projects/README.projects and projects/visualc6 [Truta]
- Update win32/DLL_FAQ.txt [Truta]
- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta]
- Deprecate Z_ASCII; use Z_TEXT instead [Truta]
- Use a new algorithm for setting strm->data_type in trees.c [Truta]
- Do not define an exit() prototype in zutil.c unless DEBUG defined
- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta]
- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate()
- Fix Darwin build version identification [Peterson]
Changes in 1.2.2 (3 October 2004)
- Update zlib.h comments on gzip in-memory processing
- Set adler to 1 in inflateReset() to support Java test suite [Walles]
- Add contrib/dotzlib [Ravn]
- Update win32/DLL_FAQ.txt [Truta]
- Update contrib/minizip [Vollant]
- Move contrib/visual-basic.txt to old/ [Truta]
- Fix assembler builds in projects/visualc6/ [Truta]
Changes in 1.2.1.2 (9 September 2004)
- Update INDEX file
- Fix trees.c to update strm->data_type (no one ever noticed!)
- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown]
- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE)
- Add limited multitasking protection to DYNAMIC_CRC_TABLE
- Add NO_vsnprintf for VMS in zutil.h [Mozilla]
- Don't declare strerror() under VMS [Mozilla]
- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize
- Update contrib/ada [Anisimkov]
- Update contrib/minizip [Vollant]
- Fix configure to not hardcode directories for Darwin [Peterson]
- Fix gzio.c to not return error on empty files [Brown]
- Fix indentation; update version in contrib/delphi/ZLib.pas and
contrib/pascal/zlibpas.pas [Truta]
- Update mkasm.bat in contrib/masmx86 [Truta]
- Update contrib/untgz [Truta]
- Add projects/README.projects [Truta]
- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta]
- Update win32/DLL_FAQ.txt [Truta]
- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta]
- Remove an unnecessary assignment to curr in inftrees.c [Truta]
- Add OS/2 to exe builds in configure [Poltorak]
- Remove err dummy parameter in zlib.h [Kientzle]
Changes in 1.2.1.1 (9 January 2004)
- Update email address in README
- Several FAQ updates
- Fix a big fat bug in inftrees.c that prevented decoding valid
dynamic blocks with only literals and no distance codes --
Thanks to "Hot Emu" for the bug report and sample file
- Add a note to puff.c on no distance codes case.
Changes in 1.2.1 (17 November 2003)
- Remove a tab in contrib/gzappend/gzappend.c
- Update some interfaces in contrib for new zlib functions
- Update zlib version number in some contrib entries
- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta]
- Support shared libraries on Hurd and KFreeBSD [Brown]
- Fix error in NO_DIVIDE option of adler32.c
Changes in 1.2.0.8 (4 November 2003)
- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas
- Add experimental NO_DIVIDE #define in adler32.c
- Possibly faster on some processors (let me know if it is)
- Correct Z_BLOCK to not return on first inflate call if no wrap
- Fix strm->data_type on inflate() return to correctly indicate EOB
- Add deflatePrime() function for appending in the middle of a byte
- Add contrib/gzappend for an example of appending to a stream
- Update win32/DLL_FAQ.txt [Truta]
- Delete Turbo C comment in README [Truta]
- Improve some indentation in zconf.h [Truta]
- Fix infinite loop on bad input in configure script [Church]
- Fix gzeof() for concatenated gzip files [Johnson]
- Add example to contrib/visual-basic.txt [Michael B.]
- Add -p to mkdir's in Makefile.in [vda]
- Fix configure to properly detect presence or lack of printf functions
- Add AS400 support [Monnerat]
- Add a little Cygwin support [Wilson]
Changes in 1.2.0.7 (21 September 2003)
- Correct some debug formats in contrib/infback9
- Cast a type in a debug statement in trees.c
- Change search and replace delimiter in configure from % to # [Beebe]
- Update contrib/untgz to 0.2 with various fixes [Truta]
- Add build support for Amiga [Nikl]
- Remove some directories in old that have been updated to 1.2
- Add dylib building for Mac OS X in configure and Makefile.in
- Remove old distribution stuff from Makefile
- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X
- Update links in README
Changes in 1.2.0.6 (13 September 2003)
- Minor FAQ updates
- Update contrib/minizip to 1.00 [Vollant]
- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
- Update POSTINC comment for 68060 [Nikl]
- Add contrib/infback9 with deflate64 decoding (unsupported)
- For MVS define NO_vsnprintf and undefine FAR [van Burik]
- Add pragma for fdopen on MVS [van Burik]
Changes in 1.2.0.5 (8 September 2003)
- Add OF to inflateBackEnd() declaration in zlib.h
- Remember start when using gzdopen in the middle of a file
- Use internal off_t counters in gz* functions to properly handle seeks
- Perform more rigorous check for distance-too-far in inffast.c
- Add Z_BLOCK flush option to return from inflate at block boundary
- Set strm->data_type on return from inflate
- Indicate bits unused, if at block boundary, and if in last block
- Replace size_t with ptrdiff_t in crc32.c, and check for correct size
- Add condition so old NO_DEFLATE define still works for compatibility
- FAQ update regarding the Windows DLL [Truta]
- INDEX update: add qnx entry, remove aix entry [Truta]
- Install zlib.3 into mandir [Wilson]
- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta]
- Adapt the zlib interface to the new DLL convention guidelines [Truta]
- Introduce ZLIB_WINAPI macro to allow the export of functions using
the WINAPI calling convention, for Visual Basic [Vollant, Truta]
- Update msdos and win32 scripts and makefiles [Truta]
- Export symbols by name, not by ordinal, in win32/zlib.def [Truta]
- Add contrib/ada [Anisimkov]
- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta]
- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant]
- Add contrib/masm686 [Truta]
- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm
[Truta, Vollant]
- Update contrib/delphi; rename to contrib/pascal; add example [Truta]
- Remove contrib/delphi2; add a new contrib/delphi [Truta]
- Avoid inclusion of the nonstandard <memory.h> in contrib/iostream,
and fix some method prototypes [Truta]
- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip
[Truta]
- Avoid the use of backslash (\) in contrib/minizip [Vollant]
- Fix file time handling in contrib/untgz; update makefiles [Truta]
- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines
[Vollant]
- Remove contrib/vstudio/vc15_16 [Vollant]
- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta]
- Update README.contrib [Truta]
- Invert the assignment order of match_head and s->prev[...] in
INSERT_STRING [Truta]
- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings
[Truta]
- Compare function pointers with 0, not with NULL or Z_NULL [Truta]
- Fix prototype of syncsearch in inflate.c [Truta]
- Introduce ASMINF macro to be enabled when using an ASM implementation
of inflate_fast [Truta]
- Change NO_DEFLATE to NO_GZCOMPRESS [Truta]
- Modify test_gzio in example.c to take a single file name as a
parameter [Truta]
- Exit the example.c program if gzopen fails [Truta]
- Add type casts around strlen in example.c [Truta]
- Remove casting to sizeof in minigzip.c; give a proper type
to the variable compared with SUFFIX_LEN [Truta]
- Update definitions of STDC and STDC99 in zconf.h [Truta]
- Synchronize zconf.h with the new Windows DLL interface [Truta]
- Use SYS16BIT instead of __32BIT__ to distinguish between
16- and 32-bit platforms [Truta]
- Use far memory allocators in small 16-bit memory models for
Turbo C [Truta]
- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in
zlibCompileFlags [Truta]
- Cygwin has vsnprintf [Wilson]
- In Windows16, OS_CODE is 0, as in MSDOS [Truta]
- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson]
Changes in 1.2.0.4 (10 August 2003)
- Minor FAQ updates
- Be more strict when checking inflateInit2's windowBits parameter
- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well
- Add gzip wrapper option to deflateInit2 using windowBits
- Add updated QNX rule in configure and qnx directory [Bonnefoy]
- Make inflate distance-too-far checks more rigorous
- Clean up FAR usage in inflate
- Add casting to sizeof() in gzio.c and minigzip.c
Changes in 1.2.0.3 (19 July 2003)
- Fix silly error in gzungetc() implementation [Vollant]
- Update contrib/minizip and contrib/vstudio [Vollant]
- Fix printf format in example.c
- Correct cdecl support in zconf.in.h [Anisimkov]
- Minor FAQ updates
Changes in 1.2.0.2 (13 July 2003)
- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
- Attempt to avoid warnings in crc32.c for pointer-int conversion
- Add AIX to configure, remove aix directory [Bakker]
- Add some casts to minigzip.c
- Improve checking after insecure sprintf() or vsprintf() calls
- Remove #elif's from crc32.c
- Change leave label to inf_leave in inflate.c and infback.c to avoid
library conflicts
- Remove inflate gzip decoding by default--only enable gzip decoding by
special request for stricter backward compatibility
- Add zlibCompileFlags() function to return compilation information
- More typecasting in deflate.c to avoid warnings
- Remove leading underscore from _Capital #defines [Truta]
- Fix configure to link shared library when testing
- Add some Windows CE target adjustments [Mai]
- Remove #define ZLIB_DLL in zconf.h [Vollant]
- Add zlib.3 [Rodgers]
- Update RFC URL in deflate.c and algorithm.txt [Mai]
- Add zlib_dll_FAQ.txt to contrib [Truta]
- Add UL to some constants [Truta]
- Update minizip and vstudio [Vollant]
- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h
- Expand use of NO_DUMMY_DECL to avoid all dummy structures
- Added iostream3 to contrib [Schwardt]
- Replace rewind() with fseek() for WinCE [Truta]
- Improve setting of zlib format compression level flags
- Report 0 for huffman and rle strategies and for level == 0 or 1
- Report 2 only for level == 6
- Only deal with 64K limit when necessary at compile time [Truta]
- Allow TOO_FAR check to be turned off at compile time [Truta]
- Add gzclearerr() function [Souza]
- Add gzungetc() function
Changes in 1.2.0.1 (17 March 2003)
- Add Z_RLE strategy for run-length encoding [Truta]
- When Z_RLE requested, restrict matches to distance one
- Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE
- Correct FASTEST compilation to allow level == 0
- Clean up what gets compiled for FASTEST
- Incorporate changes to zconf.in.h [Vollant]
- Refine detection of Turbo C need for dummy returns
- Refine ZLIB_DLL compilation
- Include additional header file on VMS for off_t typedef
- Try to use _vsnprintf where it supplants vsprintf [Vollant]
- Add some casts in inffast.c
- Enchance comments in zlib.h on what happens if gzprintf() tries to
write more than 4095 bytes before compression
- Remove unused state from inflateBackEnd()
- Remove exit(0) from minigzip.c, example.c
- Get rid of all those darn tabs
- Add "check" target to Makefile.in that does the same thing as "test"
- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in
- Update contrib/inflate86 [Anderson]
- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant]
- Add msdos and win32 directories with makefiles [Truta]
- More additions and improvements to the FAQ
Changes in 1.2.0 (9 March 2003)
- New and improved inflate code
- About 20% faster
- Does not allocate 32K window unless and until needed
- Automatically detects and decompresses gzip streams
- Raw inflate no longer needs an extra dummy byte at end
- Added inflateBack functions using a callback interface--even faster
than inflate, useful for file utilities (gzip, zip)
- Added inflateCopy() function to record state for random access on
externally generated deflate streams (e.g. in gzip files)
- More readable code (I hope)
- New and improved crc32()
- About 50% faster, thanks to suggestions from Rodney Brown
- Add deflateBound() and compressBound() functions
- Fix memory leak in deflateInit2()
- Permit setting dictionary for raw deflate (for parallel deflate)
- Fix const declaration for gzwrite()
- Check for some malloc() failures in gzio.c
- Fix bug in gzopen() on single-byte file 0x1f
- Fix bug in gzread() on concatenated file with 0x1f at end of buffer
and next buffer doesn't start with 0x8b
- Fix uncompress() to return Z_DATA_ERROR on truncated input
- Free memory at end of example.c
- Remove MAX #define in trees.c (conflicted with some libraries)
- Fix static const's in deflate.c, gzio.c, and zutil.[ch]
- Declare malloc() and free() in gzio.c if STDC not defined
- Use malloc() instead of calloc() in zutil.c if int big enough
- Define STDC for AIX
- Add aix/ with approach for compiling shared library on AIX
- Add HP-UX support for shared libraries in configure
- Add OpenUNIX support for shared libraries in configure
- Use $cc instead of gcc to build shared library
- Make prefix directory if needed when installing
- Correct Macintosh avoidance of typedef Byte in zconf.h
- Correct Turbo C memory allocation when under Linux
- Use libz.a instead of -lz in Makefile (assure use of compiled library)
- Update configure to check for snprintf or vsnprintf functions and their
return value, warn during make if using an insecure function
- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that
is lost when library is used--resolution is to build new zconf.h
- Documentation improvements (in zlib.h):
- Document raw deflate and inflate
- Update RFCs URL
- Point out that zlib and gzip formats are different
- Note that Z_BUF_ERROR is not fatal
- Document string limit for gzprintf() and possible buffer overflow
- Note requirement on avail_out when flushing
- Note permitted values of flush parameter of inflate()
- Add some FAQs (and even answers) to the FAQ
- Add contrib/inflate86/ for x86 faster inflate
- Add contrib/blast/ for PKWare Data Compression Library decompression
- Add contrib/puff/ simple inflate for deflate format description
Changes in 1.1.4 (11 March 2002)
- ZFREE was repeated on same allocation on some error conditions.
This creates a security problem described in
http://www.zlib.org/advisory-2002-03-11.txt
- Returned incorrect error (Z_MEM_ERROR) on some invalid data
- Avoid accesses before window for invalid distances with inflate window
less than 32K.
- force windowBits > 8 to avoid a bug in the encoder for a window size
of 256 bytes. (A complete fix will be available in 1.1.5).
Changes in 1.1.3 (9 July 1998)
- fix "an inflate input buffer bug that shows up on rare but persistent
occasions" (Mark)
- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
- fix gzseek(..., SEEK_SET) in write mode
- fix crc check after a gzeek (Frank Faubert)
- fix miniunzip when the last entry in a zip file is itself a zip file
(J Lillge)
- add contrib/asm586 and contrib/asm686 (Brian Raiter)
See http://www.muppetlabs.com/~breadbox/software/assembly.html
- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
- added a FAQ file
- Support gzdopen on Mac with Metrowerks (Jason Linhart)
- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
- avoid some warnings with Borland C (Tom Tanner)
- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant)
- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
- use libdir and includedir in Makefile.in (Tim Mooney)
- support shared libraries on OSF1 V4 (Tim Mooney)
- remove so_locations in "make clean" (Tim Mooney)
- fix maketree.c compilation error (Glenn, Mark)
- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
- new Makefile.riscos (Rich Walker)
- initialize static descriptors in trees.c for embedded targets (Nick Smith)
- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
- fix maketree.c to allow clean compilation of inffixed.h (Mark)
- fix parameter check in deflateCopy (Gunther Nikl)
- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
- Many portability patches by Christian Spieler:
. zutil.c, zutil.h: added "const" for zmem*
. Make_vms.com: fixed some typos
. Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
. msdos/Makefile.msc: remove "default rtl link library" info from obj files
. msdos/Makefile.*: use model-dependent name for the built zlib library
. msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
- replace __far with _far for better portability (Christian Spieler, Tom Lane)
- fix test for errno.h in configure (Tim Newsham)
Changes in 1.1.2 (19 March 98)
- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
See http://www.winimage.com/zLibDll/unzip.html
- preinitialize the inflate tables for fixed codes, to make the code
completely thread safe (Mark)
- some simplifications and slight speed-up to the inflate code (Mark)
- fix gzeof on non-compressed files (Allan Schrum)
- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
- do not wrap extern "C" around system includes (Tom Lane)
- mention zlib binding for TCL in README (Andreas Kupries)
- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
- allow "configure --prefix $HOME" (Tim Mooney)
- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
- move Makefile.sas to amiga/Makefile.sas
Changes in 1.1.1 (27 Feb 98)
- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson)
- remove block truncation heuristic which had very marginal effect for zlib
(smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
compression ratio on some files. This also allows inlining _tr_tally for
matches in deflate_slow.
- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
Changes in 1.1.0 (24 Feb 98)
- do not return STREAM_END prematurely in inflate (John Bowler)
- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
- compile with -DFASTEST to get compression code optimized for speed only
- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
on Sun but significant on HP)
- add a pointer to experimental unzip library in README (Gilles Vollant)
- initialize variable gcc in configure (Chris Herborth)
Changes in 1.0.9 (17 Feb 1998)
- added gzputs and gzgets functions
- do not clear eof flag in gzseek (Mark Diekhans)
- fix gzseek for files in transparent mode (Mark Diekhans)
- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
- replace EXPORT with ZEXPORT to avoid conflict with other programs
- added compress2 in zconf.h, zlib.def, zlib.dnt
- new asm code from Gilles Vollant in contrib/asm386
- simplify the inflate code (Mark):
. Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
. ZALLOC the length list in inflate_trees_fixed() instead of using stack
. ZALLOC the value area for huft_build() instead of using stack
. Simplify Z_FINISH check in inflate()
- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
the declaration of FAR (Gilles VOllant)
- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
- read_buf buf parameter of type Bytef* instead of charf*
- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
- fix check for presence of directories in "make install" (Ian Willis)
Changes in 1.0.8 (27 Jan 1998)
- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
- added compress2() to allow setting the compression level
- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
- use constant arrays for the static trees in trees.c instead of computing
them at run time (thanks to Ken Raeburn for this suggestion). To create
trees.h, compile with GEN_TREES_H and run "make test".
- check return code of example in "make test" and display result
- pass minigzip command line options to file_compress
- simplifying code of inflateSync to avoid gcc 2.8 bug
- support CC="gcc -Wall" in configure -s (QingLong)
- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
- fix test for shared library support to avoid compiler warnings
- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
- do not use fdopen for Metrowerks on Mac (Brad Pettit))
- add checks for gzputc and gzputc in example.c
- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
- use const for the CRC table (Ken Raeburn)
- fixed "make uninstall" for shared libraries
- use Tracev instead of Trace in infblock.c
- in example.c use correct compressed length for test_sync
- suppress +vnocompatwarnings in configure for HPUX (not always supported)
Changes in 1.0.7 (20 Jan 1998)
- fix gzseek which was broken in write mode
- return error for gzseek to negative absolute position
- fix configure for Linux (Chun-Chung Chen)
- increase stack space for MSC (Tim Wegner)
- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
- define EXPORTVA for gzprintf (Gilles Vollant)
- added man page zlib.3 (Rick Rodgers)
- for contrib/untgz, fix makedir() and improve Makefile
- check gzseek in write mode in example.c
- allocate extra buffer for seeks only if gzseek is actually called
- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
- add inflateSyncPoint in zconf.h
- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
Changes in 1.0.6 (19 Jan 1998)
- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
- Fix a deflate bug occurring only with compression level 0 (thanks to
Andy Buckler for finding this one).
- In minigzip, pass transparently also the first byte for .Z files.
- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
- check Z_FINISH in inflate (thanks to Marc Schluper)
- Implement deflateCopy (thanks to Adam Costello)
- make static libraries by default in configure, add --shared option.
- move MSDOS or Windows specific files to directory msdos
- suppress the notion of partial flush to simplify the interface
(but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
- suppress history buffer provided by application to simplify the interface
(this feature was not implemented anyway in 1.0.4)
- next_in and avail_in must be initialized before calling inflateInit or
inflateInit2
- add EXPORT in all exported functions (for Windows DLL)
- added Makefile.nt (thanks to Stephen Williams)
- added the unsupported "contrib" directory:
contrib/asm386/ by Gilles Vollant <info@winimage.com>
386 asm code replacing longest_match().
contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
A C++ I/O streams interface to the zlib gz* functions
contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
Another C++ I/O streams interface
contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
A very simple tar.gz file extractor using zlib
contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
How to use compress(), uncompress() and the gz* functions from VB.
- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
level) in minigzip (thanks to Tom Lane)
- use const for rommable constants in deflate
- added test for gzseek and gztell in example.c
- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
- add undocumented function zError to convert error code to string
(for Tim Smithers)
- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
- Use default memcpy for Symantec MSDOS compiler.
- Add EXPORT keyword for check_func (needed for Windows DLL)
- add current directory to LD_LIBRARY_PATH for "make test"
- create also a link for libz.so.1
- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
- added -soname for Linux in configure (Chun-Chung Chen,
- assign numbers to the exported functions in zlib.def (for Windows DLL)
- add advice in zlib.h for best usage of deflateSetDictionary
- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
- allow compilation with ANSI keywords only enabled for TurboC in large model
- avoid "versionString"[0] (Borland bug)
- add NEED_DUMMY_RETURN for Borland
- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
- allow compilation with CC
- defined STDC for OS/2 (David Charlap)
- limit external names to 8 chars for MVS (Thomas Lund)
- in minigzip.c, use static buffers only for 16-bit systems
- fix suffix check for "minigzip -d foo.gz"
- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
- added makelcc.bat for lcc-win32 (Tom St Denis)
- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
- check for unistd.h in configure (for off_t)
- remove useless check parameter in inflate_blocks_free
- avoid useless assignment of s->check to itself in inflate_blocks_new
- do not flush twice in gzclose (thanks to Ken Raeburn)
- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
- work around buggy fclose on pipes for HP/UX
- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
- fix configure if CC is already equal to gcc
Changes in 1.0.5 (3 Jan 98)
- Fix inflate to terminate gracefully when fed corrupted or invalid data
- Use const for rommable constants in inflate
- Eliminate memory leaks on error conditions in inflate
- Removed some vestigial code in inflate
- Update web address in README
Changes in 1.0.4 (24 Jul 96)
- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
bit, so the decompressor could decompress all the correct data but went
on to attempt decompressing extra garbage data. This affected minigzip too.
- zlibVersion and gzerror return const char* (needed for DLL)
- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
- use z_error only for DEBUG (avoid problem with DLLs)
Changes in 1.0.3 (2 Jul 96)
- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
small and medium models; this makes the library incompatible with previous
versions for these models. (No effect in large model or on other systems.)
- return OK instead of BUF_ERROR if previous deflate call returned with
avail_out as zero but there is nothing to do
- added memcmp for non STDC compilers
- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
- better check for 16-bit mode MSC (avoids problem with Symantec)
Changes in 1.0.2 (23 May 96)
- added Windows DLL support
- added a function zlibVersion (for the DLL support)
- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
- Bytef is define's instead of typedef'd only for Borland C
- avoid reading uninitialized memory in example.c
- mention in README that the zlib format is now RFC1950
- updated Makefile.dj2
- added algorithm.doc
Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
- fix array overlay in deflate.c which sometimes caused bad compressed data
- fix inflate bug with empty stored block
- fix MSDOS medium model which was broken in 0.99
- fix deflateParams() which could generated bad compressed data.
- Bytef is define'd instead of typedef'ed (work around Borland bug)
- added an INDEX file
- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
- speed up adler32 for modern machines without auto-increment
- added -ansi for IRIX in configure
- static_init_done in trees.c is an int
- define unlink as delete for VMS
- fix configure for QNX
- add configure branch for SCO and HPUX
- avoid many warnings (unused variables, dead assignments, etc...)
- no fdopen for BeOS
- fix the Watcom fix for 32 bit mode (define FAR as empty)
- removed redefinition of Byte for MKWERKS
- work around an MWKERKS bug (incorrect merge of all .h files)
Changes in 0.99 (27 Jan 96)
- allow preset dictionary shared between compressor and decompressor
- allow compression level 0 (no compression)
- add deflateParams in zlib.h: allow dynamic change of compression level
and compression strategy.
- test large buffers and deflateParams in example.c
- add optional "configure" to build zlib as a shared library
- suppress Makefile.qnx, use configure instead
- fixed deflate for 64-bit systems (detected on Cray)
- fixed inflate_blocks for 64-bit systems (detected on Alpha)
- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
- always return Z_BUF_ERROR when deflate() has nothing to do
- deflateInit and inflateInit are now macros to allow version checking
- prefix all global functions and types with z_ with -DZ_PREFIX
- make falloc completely reentrant (inftrees.c)
- fixed very unlikely race condition in ct_static_init
- free in reverse order of allocation to help memory manager
- use zlib-1.0/* instead of zlib/* inside the tar.gz
- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
-Wconversion -Wstrict-prototypes -Wmissing-prototypes"
- allow gzread on concatenated .gz files
- deflateEnd now returns Z_DATA_ERROR if it was premature
- deflate is finally (?) fully deterministic (no matches beyond end of input)
- Document Z_SYNC_FLUSH
- add uninstall in Makefile
- Check for __cpluplus in zlib.h
- Better test in ct_align for partial flush
- avoid harmless warnings for Borland C++
- initialize hash_head in deflate.c
- avoid warning on fdopen (gzio.c) for HP cc -Aa
- include stdlib.h for STDC compilers
- include errno.h for Cray
- ignore error if ranlib doesn't exist
- call ranlib twice for NeXTSTEP
- use exec_prefix instead of prefix for libz.a
- renamed ct_* as _tr_* to avoid conflict with applications
- clear z->msg in inflateInit2 before any error return
- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
- fixed typo in zconf.h (_GNUC__ => __GNUC__)
- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
- in fcalloc, normalize pointer if size > 65520 bytes
- don't use special fcalloc for 32 bit Borland C++
- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
- use Z_BINARY instead of BINARY
- document that gzclose after gzdopen will close the file
- allow "a" as mode in gzopen.
- fix error checking in gzread
- allow skipping .gz extra-field on pipes
- added reference to Perl interface in README
- put the crc table in FAR data (I dislike more and more the medium model :)
- added get_crc_table
- added a dimension to all arrays (Borland C can't count).
- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
- guard against multiple inclusion of *.h (for precompiled header on Mac)
- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
- don't use unsized arrays to avoid silly warnings by Visual C++:
warning C4746: 'inflate_mask' : unsized array treated as '__far'
(what's wrong with far data in far model?).
- define enum out of inflate_blocks_state to allow compilation with C++
Changes in 0.95 (16 Aug 95)
- fix MSDOS small and medium model (now easier to adapt to any compiler)
- inlined send_bits
- fix the final (:-) bug for deflate with flush (output was correct but
not completely flushed in rare occasions).
- default window size is same for compression and decompression
(it's now sufficient to set MAX_WBITS in zconf.h).
- voidp -> voidpf and voidnp -> voidp (for consistency with other
typedefs and because voidnp was not near in large model).
Changes in 0.94 (13 Aug 95)
- support MSDOS medium model
- fix deflate with flush (could sometimes generate bad output)
- fix deflateReset (zlib header was incorrectly suppressed)
- added support for VMS
- allow a compression level in gzopen()
- gzflush now calls fflush
- For deflate with flush, flush even if no more input is provided.
- rename libgz.a as libz.a
- avoid complex expression in infcodes.c triggering Turbo C bug
- work around a problem with gcc on Alpha (in INSERT_STRING)
- don't use inline functions (problem with some gcc versions)
- allow renaming of Byte, uInt, etc... with #define.
- avoid warning about (unused) pointer before start of array in deflate.c
- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
- avoid reserved word 'new' in trees.c
Changes in 0.93 (25 June 95)
- temporarily disable inline functions
- make deflate deterministic
- give enough lookahead for PARTIAL_FLUSH
- Set binary mode for stdin/stdout in minigzip.c for OS/2
- don't even use signed char in inflate (not portable enough)
- fix inflate memory leak for segmented architectures
Changes in 0.92 (3 May 95)
- don't assume that char is signed (problem on SGI)
- Clear bit buffer when starting a stored block
- no memcpy on Pyramid
- suppressed inftest.c
- optimized fill_window, put longest_match inline for gcc
- optimized inflate on stored blocks.
- untabify all sources to simplify patches
Changes in 0.91 (2 May 95)
- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
- Document the memory requirements in zconf.h
- added "make install"
- fix sync search logic in inflateSync
- deflate(Z_FULL_FLUSH) now works even if output buffer too short
- after inflateSync, don't scare people with just "lo world"
- added support for DJGPP
Changes in 0.9 (1 May 95)
- don't assume that zalloc clears the allocated memory (the TurboC bug
was Mark's bug after all :)
- let again gzread copy uncompressed data unchanged (was working in 0.71)
- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
- added a test of inflateSync in example.c
- moved MAX_WBITS to zconf.h because users might want to change that.
- document explicitly that zalloc(64K) on MSDOS must return a normalized
pointer (zero offset)
- added Makefiles for Microsoft C, Turbo C, Borland C++
- faster crc32()
Changes in 0.8 (29 April 95)
- added fast inflate (inffast.c)
- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
is incompatible with previous versions of zlib which returned Z_OK.
- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
(actually that was not a compiler bug, see 0.81 above)
- gzread no longer reads one extra byte in certain cases
- In gzio destroy(), don't reference a freed structure
- avoid many warnings for MSDOS
- avoid the ERROR symbol which is used by MS Windows
Changes in 0.71 (14 April 95)
- Fixed more MSDOS compilation problems :( There is still a bug with
TurboC large model.
Changes in 0.7 (14 April 95)
- Added full inflate support.
- Simplified the crc32() interface. The pre- and post-conditioning
(one's complement) is now done inside crc32(). WARNING: this is
incompatible with previous versions; see zlib.h for the new usage.
Changes in 0.61 (12 April 95)
- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
Changes in 0.6 (11 April 95)
- added minigzip.c
- added gzdopen to reopen a file descriptor as gzFile
- added transparent reading of non-gziped files in gzread.
- fixed bug in gzread (don't read crc as data)
- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
- don't allocate big arrays in the stack (for MSDOS)
- fix some MSDOS compilation problems
Changes in 0.5:
- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
not yet Z_FULL_FLUSH.
- support decompression but only in a single step (forced Z_FINISH)
- added opaque object for zalloc and zfree.
- added deflateReset and inflateReset
- added a variable zlib_version for consistency checking.
- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
Changes in 0.4:
- avoid "zip" everywhere, use zlib instead of ziplib.
- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
if compression method == 8.
- added adler32 and crc32
- renamed deflateOptions as deflateInit2, call one or the other but not both
- added the method parameter for deflateInit2.
- added inflateInit2
- simplied considerably deflateInit and inflateInit by not supporting
user-provided history buffer. This is supported only in deflateInit2
and inflateInit2.
Changes in 0.3:
- prefix all macro names with Z_
- use Z_FINISH instead of deflateEnd to finish compression.
- added Z_HUFFMAN_ONLY
- added gzerror()

View File

@ -1,159 +0,0 @@
.TH ZLIB 3 "18 July 2005"
.SH NAME
zlib \- compression/decompression library
.SH SYNOPSIS
[see
.I zlib.h
for full description]
.SH DESCRIPTION
The
.I zlib
library is a general purpose data compression library.
The code is thread safe.
It provides in-memory compression and decompression functions,
including integrity checks of the uncompressed data.
This version of the library supports only one compression method (deflation)
but other algorithms will be added later
and will have the same stream interface.
.LP
Compression can be done in a single step if the buffers are large enough
(for example if an input file is mmap'ed),
or can be done by repeated calls of the compression function.
In the latter case,
the application must provide more input and/or consume the output
(providing more output space) before each call.
.LP
The library also supports reading and writing files in
.IR gzip (1)
(.gz) format
with an interface similar to that of stdio.
.LP
The library does not install any signal handler.
The decoder checks the consistency of the compressed data,
so the library should never crash even in case of corrupted input.
.LP
All functions of the compression library are documented in the file
.IR zlib.h .
The distribution source includes examples of use of the library
in the files
.I example.c
and
.IR minigzip.c .
.LP
Changes to this version are documented in the file
.I ChangeLog
that accompanies the source,
and are concerned primarily with bug fixes and portability enhancements.
.LP
A Java implementation of
.I zlib
is available in the Java Development Kit 1.1:
.IP
http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
.LP
A Perl interface to
.IR zlib ,
written by Paul Marquess (pmqs@cpan.org),
is available at CPAN (Comprehensive Perl Archive Network) sites,
including:
.IP
http://www.cpan.org/modules/by-module/Compress/
.LP
A Python interface to
.IR zlib ,
written by A.M. Kuchling (amk@magnet.com),
is available in Python 1.5 and later versions:
.IP
http://www.python.org/doc/lib/module-zlib.html
.LP
A
.I zlib
binding for
.IR tcl (1),
written by Andreas Kupries (a.kupries@westend.com),
is availlable at:
.IP
http://www.westend.com/~kupries/doc/trf/man/man.html
.LP
An experimental package to read and write files in .zip format,
written on top of
.I zlib
by Gilles Vollant (info@winimage.com),
is available at:
.IP
http://www.winimage.com/zLibDll/unzip.html
and also in the
.I contrib/minizip
directory of the main
.I zlib
web site.
.SH "SEE ALSO"
The
.I zlib
web site can be found at either of these locations:
.IP
http://www.zlib.org
.br
http://www.gzip.org/zlib/
.LP
The data format used by the zlib library is described by RFC
(Request for Comments) 1950 to 1952 in the files:
.IP
http://www.ietf.org/rfc/rfc1950.txt (concerning zlib format)
.br
http://www.ietf.org/rfc/rfc1951.txt (concerning deflate format)
.br
http://www.ietf.org/rfc/rfc1952.txt (concerning gzip format)
.LP
These documents are also available in other formats from:
.IP
ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
.LP
Mark Nelson (markn@ieee.org) wrote an article about
.I zlib
for the Jan. 1997 issue of Dr. Dobb's Journal;
a copy of the article is available at:
.IP
http://dogma.net/markn/articles/zlibtool/zlibtool.htm
.SH "REPORTING PROBLEMS"
Before reporting a problem,
please check the
.I zlib
web site to verify that you have the latest version of
.IR zlib ;
otherwise,
obtain the latest version and see if the problem still exists.
Please read the
.I zlib
FAQ at:
.IP
http://www.gzip.org/zlib/zlib_faq.html
.LP
before asking for help.
Send questions and/or comments to zlib@gzip.org,
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
.SH AUTHORS
Version 1.2.3
Copyright (C) 1995-2005 Jean-loup Gailly (jloup@gzip.org)
and Mark Adler (madler@alumni.caltech.edu).
.LP
This software is provided "as-is,"
without any express or implied warranty.
In no event will the authors be held liable for any damages
arising from the use of this software.
See the distribution directory with respect to requirements
governing redistribution.
The deflate format used by
.I zlib
was defined by Phil Katz.
The deflate and
.I zlib
specifications were written by L. Peter Deutsch.
Thanks to all the people who reported problems and suggested various
improvements in
.IR zlib ;
who are too numerous to cite here.
.LP
UNIX manual page by R. P. C. Rodgers,
U.S. National Library of Medicine (rodgers@nlm.nih.gov).
.\" end of man page