7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-14 16:19:36 +00:00

Gerbview: code cleanup: remove dead code and obsolete options. Coding policy class naming fixes.

others: fix minor issues.
This commit is contained in:
jean-pierre charras 2011-03-12 10:50:21 +01:00
parent 669db0ff8a
commit f6669b7845
39 changed files with 324 additions and 902 deletions

View File

@ -39,7 +39,6 @@ E4) Change add component dialog search text control to combobox and add compone
search history save and restore capability. Also add session save and restore
to component history list control. Add advanced search capability similar to
new find dialog.
E5) Make escape key work correctly in add component dialog.
E6) Start initial work for changing component library file format to use Dick's
dsnlexer. See note C2 above. Come up with a workable library file format to
handle the wishes of the library implementation group. Add initial clipboard
@ -48,55 +47,13 @@ E6) Start initial work for changing component library file format to use Dick's
GerbView
--------
* Need work as good as gerbv from gEDA
* Named layers
* List control for layer sort on the fly
* List control for layer sort on the fly
* Add excellon2 drill file support (small good library)
* Fix the polygon bug.
* Switch to use ZONE instead of SEGZONE for polygons.
* Separate application settings and project configuration settings by converting
static list of parameters in gerbview_config.h to dynamically created lists of
settings. See eeschema/eeschema_config.cpp for an example.
PCBNew
------
Dick:
P2) Write accessors for all items in PCB_VISIBLE such as grid control, so that
the write accessor can fire change notifications to known listeners.
(Accessors should always be used in general for every class, but in the case
of PCB_VISIBLE I think we need them in WinEDA_PcbFrame, BOARD and
EDA_Settings.
<class>::IsElementVisible( aPCB_VISIBLE );
<class>::SetElementVisiblity( aPCB_VISIBLE, bool isVisible );
Two of the 3 classes already have these functions. Once the functions are
in place, it is a simple matter to decide and move where the actual data
is stored without affecting client code. The top most access point should
be WinEDA_PcbVisible, because some data is best retained there and this is
the "controller" part of MVC in PCBNEW. Some data is best saved in the BOARD.
We should go through the list of PCB_VISIBLE and decide on this in a separate email.
* Fix block copy/move preview to not view only a border, we should
see the moved/copied parts.
* Fix DIALOG_PAD_PROPERTIES_BASE class to use actual layer names in the BOARD.
* Use BOARD_ITEM::MenuIcon() in the onrightclick.cpp
* Add ARC support to gerber polygons.
* Need to add polygon aperture type.
Then example 2 in RS274xrevd_e.pdf will draw properly.
LAYER_WIDGET for PCBNEW (Dick)
-----------------------
L6) Test, and fix up any remaining issues with the PCB_VISIBLE support after P2)
is done. This way we can fire change notifications to multiple GUI items
all interested in the same setting, such as the two grid buttons which
have to remain synchronized. Using accessors makes this easy.
L8) LAYER_WIDGET::GetBestSize() needs platform independence.
L9) On board load, ReFill() is called, this should also update the Render
checkboxes and colors.

View File

@ -664,11 +664,13 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident,
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
wxString* ptparam,
const wxString& default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_WXSTRING, group )
{
m_Pt_param = ptparam;
m_Setup = Insetup;
m_default = default_val;
}
@ -680,7 +682,7 @@ void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig )
{
if( m_Pt_param == NULL || aConfig == NULL )
return;
*m_Pt_param = aConfig->Read( m_Ident );
*m_Pt_param = aConfig->Read( m_Ident, m_default );
}

View File

@ -16,7 +16,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
set(DIALOGS_SRCS
dialogs/gerbview_dialog_display_options_frame_base.cpp
dialogs/gerbview_dialog_display_options_frame.cpp
dialogs/dialog_gerber_config.cpp
dialogs/dialog_print_using_printer.cpp
dialogs/dialog_print_using_printer_base.cpp
)
@ -31,7 +30,6 @@ set(GERBVIEW_SRCS
class_gerbview_layer_widget.cpp
controle.cpp
dcode.cpp
deltrack.cpp
dummy_functions.cpp
draw_gerber_screen.cpp
edit.cpp

View File

@ -47,7 +47,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
* the key (ALT, SHIFT ALT ..)
*/
int WinEDA_GerberFrame::ReturnBlockCommand( int key )
int GERBVIEW_FRAME::ReturnBlockCommand( int key )
{
int cmd = 0;
@ -85,7 +85,7 @@ int WinEDA_GerberFrame::ReturnBlockCommand( int key )
/* Routine to handle the BLOCK PLACE command */
void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
{
bool err = false;
@ -162,7 +162,7 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
{
bool nextcmd = false;
bool zoom_command = false;
@ -274,7 +274,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
/*
* Erase the selected block.
*/
void WinEDA_GerberFrame::Block_Delete( wxDC* DC )
void GERBVIEW_FRAME::Block_Delete( wxDC* DC )
{
if( !IsOK( this, _( "Ok to delete block ?" ) ) )
return;
@ -300,7 +300,7 @@ void WinEDA_GerberFrame::Block_Delete( wxDC* DC )
/*
* Function to move items in the current selected block
*/
void WinEDA_GerberFrame::Block_Move( wxDC* DC )
void GERBVIEW_FRAME::Block_Move( wxDC* DC )
{
wxPoint delta;
wxPoint oldpos;
@ -332,7 +332,7 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC )
/*
* Function to duplicate items in the current selected block
*/
void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC )
void GERBVIEW_FRAME::Block_Duplicate( wxDC* DC )
{
wxPoint delta;
wxPoint oldpos;

View File

@ -83,7 +83,7 @@ void GERBER_LAYER::ResetDefaultValues()
}
GERBER_IMAGE::GERBER_IMAGE( WinEDA_GerberFrame* aParent, int aLayer )
GERBER_IMAGE::GERBER_IMAGE( GERBVIEW_FRAME* aParent, int aLayer )
{
m_Parent = aParent;
m_GraphicLayer = aLayer; // Graphic layer Number

View File

@ -16,7 +16,7 @@
#define IsNumber( x ) ( ( ( (x) >= '0' ) && ( (x) <='9' ) ) \
|| ( (x) == '-' ) || ( (x) == '+' ) || ( (x) == '.' ) )
class WinEDA_GerberFrame;
class GERBVIEW_FRAME;
class BOARD;
class D_CODE;
@ -74,7 +74,7 @@ private:
*/
class GERBER_IMAGE
{
WinEDA_GerberFrame* m_Parent; // the parent WinEDA_GerberFrame (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;
@ -138,7 +138,7 @@ private:
// 1 = have negative items found
public:
GERBER_IMAGE( WinEDA_GerberFrame* aParent, int layer );
GERBER_IMAGE( GERBVIEW_FRAME* aParent, int layer );
~GERBER_IMAGE();
void Clear_GERBER_IMAGE();
int ReturnUsedDcodeNumber();

View File

@ -41,12 +41,12 @@
/*
* Class GERBER_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they
* may be tied into the WinEDA_GerberFrame's data and so we can add a popup
* may be tied into the GERBVIEW_FRAME's data and so we can add a popup
* menu which is specific to PCBNEW's needs.
*/
GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( WinEDA_GerberFrame* aParent, wxWindow* aFocusOwner, int aPointSize ) :
GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize ) :
LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
myframe( aParent )
{

View File

@ -36,12 +36,12 @@
/**
* Class GERBER_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they
* may be tied into the WinEDA_GerberFrame's data and so we can add a popup
* may be tied into the GERBVIEW_FRAME's data and so we can add a popup
* menu which is specific to PCBNEW's needs.
*/
class GERBER_LAYER_WIDGET : public LAYER_WIDGET
{
WinEDA_GerberFrame* myframe;
GERBVIEW_FRAME* myframe;
// popup menu ids.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST
@ -69,7 +69,7 @@ public:
* effectively sets the overal size of the widget via the row height and bitmap
* button sizes.
*/
GERBER_LAYER_WIDGET( WinEDA_GerberFrame* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize = 10 );
void ReFill();

View File

@ -8,7 +8,7 @@
#include "gerbview.h"
void WinEDA_GerberFrame::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
{
wxRealPoint gridSize;
wxPoint oldpos;

View File

@ -147,7 +147,7 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
* tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)]
* ex: 1, 12, 12, 0, 0, 0, 3 ; D10
*/
int WinEDA_GerberFrame::Read_D_Code_File( const wxString& D_Code_FullFileName )
int GERBVIEW_FRAME::Read_D_Code_File( const wxString& D_Code_FullFileName )
{
int current_Dcode, ii, dcode_scale;
char* ptcar;
@ -269,7 +269,7 @@ int WinEDA_GerberFrame::Read_D_Code_File( const wxString& D_Code_FullFileName )
/* Set Size Items (Lines, Flashes) from DCodes List
*/
void WinEDA_GerberFrame::CopyDCodesSizeToItems()
void GERBVIEW_FRAME::CopyDCodesSizeToItems()
{
static D_CODE dummy( 999 ); //Used if D_CODE not found in list
@ -318,7 +318,7 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems()
break;
default:
wxMessageBox( wxT( "WinEDA_GerberFrame::CopyDCodesSizeToItems() error" ) );
wxMessageBox( wxT( "GERBVIEW_FRAME::CopyDCodesSizeToItems() error" ) );
break;
}
}

View File

@ -1,37 +0,0 @@
/*********************************************/
/* Edit Track: Erase functions */
/*********************************************/
#include "fctsys.h"
#include "common.h"
#include "gerbview.h"
#include "class_gerber_draw_item.h"
void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC,
int dcode_value,
int layer_number )
{
if( dcode_value < FIRST_DCODE ) // No tool selected
return;
BOARD_ITEM* item = GetBoard()->m_Drawings;
BOARD_ITEM * next;
for( ; item; item = next )
{
next = item->Next();
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( dcode_value != gerb_item->m_DCode )
continue;
if( layer_number >= 0 && layer_number != gerb_item->GetLayer() )
continue;
// TODO: Delete_Item( DC, item );
}
GetScreen()->SetCurItem( NULL );
}

View File

@ -1,146 +0,0 @@
/*****************************/
/* dialog_gerber_config.cpp */
/****************************/
/*
* Options for file extensions
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "gerbview.h"
#include "dialog_helpers.h"
enum
{
ID_SAVE_CFG = 1000
};
class WinEDA_ConfigFrame : public wxDialog
{
private:
WinEDA_GerberFrame* m_Parent;
wxListBox* ListLibr;
int LibModified;
WinEDA_EnterText* TextDrillExt;
WinEDA_EnterText* TextPhotoExt;
WinEDA_EnterText* TextPenExt;
public:
WinEDA_ConfigFrame( WinEDA_GerberFrame* parent, const wxPoint& pos );
~WinEDA_ConfigFrame() { };
private:
void SaveCfg( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE( WinEDA_ConfigFrame, wxDialog )
EVT_BUTTON( ID_SAVE_CFG, WinEDA_ConfigFrame::SaveCfg )
EVT_BUTTON( wxID_OK, WinEDA_ConfigFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_ConfigFrame::OnCancelClick )
END_EVENT_TABLE()
/**
* Function InstallConfigFrame
* install the dialog box to configure some gerbview options
* mainly the default file extensions
*/
void WinEDA_GerberFrame::InstallConfigFrame( const wxPoint& pos )
{
WinEDA_ConfigFrame* CfgFrame = new WinEDA_ConfigFrame( this, pos );
CfgFrame->ShowModal();
CfgFrame->Destroy();
}
WinEDA_ConfigFrame::WinEDA_ConfigFrame( WinEDA_GerberFrame* parent,
const wxPoint& framepos ) :
wxDialog( parent, -1, wxEmptyString, framepos, wxSize( 300, 180 ),
wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT )
{
const int LEN_EXT = 100;
wxString title;
m_Parent = parent;
/* Shows the config filename currently used : */
title = _( "from " ) + wxGetApp().m_CurrentOptionFile;
SetTitle( title );
LibModified = FALSE;
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( MainBoxSizer );
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
/* Created the buttons */
wxButton* Button = new wxButton( this, ID_SAVE_CFG, _( "Save Cfg..." ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
// Provide a spacer to improve appearance of dialog box
RightBoxSizer->AddSpacer( 20 );
Button = new wxButton( this, wxID_OK, _( "OK" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
wxSize size;
size.x = LEN_EXT;
size.y = -1;
TextDrillExt = new WinEDA_EnterText( this,
_( "Drill File Ext:" ),
g_DrillFilenameExt,
LeftBoxSizer, size );
TextPhotoExt = new WinEDA_EnterText( this,
_( "Gerber File Ext:" ),
g_PhotoFilenameExt,
LeftBoxSizer, size );
TextPenExt = new WinEDA_EnterText( this,
_( "D code File Ext:" ),
g_PenFilenameExt,
LeftBoxSizer, size );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
void WinEDA_ConfigFrame::OnOkClick( wxCommandEvent& event )
{
g_DrillFilenameExt = TextDrillExt->GetValue();
g_PhotoFilenameExt = TextPhotoExt->GetValue();
g_PenFilenameExt = TextPenExt->GetValue();
EndModal( 1 );
}
void WinEDA_ConfigFrame::OnCancelClick( wxCommandEvent& event )
{
EndModal( -1 );
}
void WinEDA_ConfigFrame::SaveCfg( wxCommandEvent& event )
{
m_Parent->Update_config();
}

View File

@ -44,14 +44,14 @@ static PRINT_PARAMETERS s_Parameters;
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base
{
private:
WinEDA_GerberFrame* m_Parent;
GERBVIEW_FRAME* m_Parent;
wxConfig* m_Config;
wxCheckBox* m_BoxSelectLayer[32];
static wxPoint s_LastPos;
static wxSize s_LastSize;
public:
DIALOG_PRINT_USING_PRINTER( WinEDA_GerberFrame* parent );
DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent );
~DIALOG_PRINT_USING_PRINTER() {};
private:
@ -80,7 +80,7 @@ wxSize DIALOG_PRINT_USING_PRINTER::s_LastSize;
/*******************************************************/
void WinEDA_GerberFrame::ToPrinter( wxCommandEvent& event )
void GERBVIEW_FRAME::ToPrinter( wxCommandEvent& event )
/*******************************************************/
/* Virtual function:
@ -106,7 +106,7 @@ void WinEDA_GerberFrame::ToPrinter( wxCommandEvent& event )
/*************************************************************************************/
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_GerberFrame* parent ) :
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent ) :
DIALOG_PRINT_USING_PRINTER_base( parent )
/*************************************************************************************/
{

View File

@ -19,11 +19,11 @@
class DIALOG_DISPLAY_OPTIONS : public DIALOG_DISPLAY_OPTIONS_BASE
{
private:
WinEDA_GerberFrame* m_Parent;
GERBVIEW_FRAME* m_Parent;
public:
DIALOG_DISPLAY_OPTIONS( WinEDA_GerberFrame* parent );
DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME* parent );
~DIALOG_DISPLAY_OPTIONS() {};
private:
@ -33,7 +33,7 @@ private:
};
void WinEDA_GerberFrame::InstallGerberOptionsDialog( wxCommandEvent& event )
void GERBVIEW_FRAME::InstallGerberOptionsDialog( wxCommandEvent& event )
{
DIALOG_DISPLAY_OPTIONS dlg( this );
int opt = dlg.ShowModal();
@ -41,7 +41,7 @@ void WinEDA_GerberFrame::InstallGerberOptionsDialog( wxCommandEvent& event )
DrawPanel->Refresh();
}
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( WinEDA_GerberFrame *parent) :
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) :
DIALOG_DISPLAY_OPTIONS_BASE( parent, wxID_ANY )
{
m_Parent = parent;

View File

@ -28,7 +28,7 @@
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (not used here: can be NULL)
*/
void WinEDA_GerberFrame::PrintPage( wxDC* aDC, int aPrintMasklayer,
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, int aPrintMasklayer,
bool aPrintMirrorMode, void* aData )
{
// Save current draw options, because print mode has specfic options:
@ -58,7 +58,7 @@ void WinEDA_GerberFrame::PrintPage( wxDC* aDC, int aPrintMasklayer,
/* Redraws the full screen, including axis and grid
*/
void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{
PCB_SCREEN* screen = (PCB_SCREEN*) GetScreen();
@ -267,7 +267,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
* Draw the DCode value (if exists) corresponding to gerber item
* Polygons do not have a DCode
*/
void WinEDA_GerberFrame::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
{
wxPoint pos;
int width, orient;

View File

@ -20,7 +20,7 @@
/* Process the command triggered by the left button of the mouse when a tool
* is already selected.
*/
void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
void GERBVIEW_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg;
@ -29,7 +29,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{
if( DrawStruct && DrawStruct->m_Flags )
{
msg.Printf( wxT( "WinEDA_GerberFrame::ProcessCommand err: Struct %d, m_Flags = %X" ),
msg.Printf( wxT( "GERBVIEW_FRAME::ProcessCommand err: Struct %d, m_Flags = %X" ),
(unsigned) DrawStruct->Type(),
(unsigned) DrawStruct->m_Flags );
DisplayError( this, msg );
@ -52,9 +52,6 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
case ID_NO_TOOL_SELECTED:
break;
case ID_GERBVIEW_DELETE_ITEM_BUTT:
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
if( DrawStruct == NULL )
break;
/* TODO:
@ -65,7 +62,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
break;
default:
DisplayError( this, wxT( "WinEDA_GerberFrame::ProcessCommand error" ) );
DisplayError( this, wxT( "GERBVIEW_FRAME::ProcessCommand error" ) );
break;
}
}
@ -73,7 +70,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
/* Handles the selection of tools, menu, and popup menu commands.
*/
void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
int id = event.GetId();
int layer = GetScreen()->m_Active_Layer;
@ -140,10 +137,6 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_CANCEL_CURRENT_COMMAND:
break;
case ID_GERBVIEW_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, wxT( "Delete item" ) );
break;
case ID_TOOLBARH_GERBVIEW_SELECT_LAYER:
setActiveLayer(m_SelLayerBox->GetChoice());
DrawPanel->Refresh();
@ -196,14 +189,8 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
HandleBlockEnd( &dc );
break;
case ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS:
if( gerber_layer )
Delete_DCode_Items( &dc, gerber_layer->m_Selected_Tool,
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
break;
default:
wxMessageBox( wxT( "WinEDA_GerberFrame::Process_Special_Functions error" ) );
wxMessageBox( wxT( "GERBVIEW_FRAME::Process_Special_Functions error" ) );
break;
}
}
@ -211,7 +198,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
/* Called on a double click of left mouse button.
*/
void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
void GERBVIEW_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
{
// Currently: no nothing
}

View File

@ -15,13 +15,13 @@
#include "class_board_design_settings.h"
#include "class_gerber_draw_item.h"
static int SavePcbFormatAscii( WinEDA_GerberFrame* frame,
static int SavePcbFormatAscii( GERBVIEW_FRAME* frame,
FILE* File, int* LayerLookUpTable );
/* Export data in pcbnew format
*/
void WinEDA_GerberFrame::ExportDataInPcbnewFormat( wxCommandEvent& event )
void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
{
int ii = 0;
bool no_used_layers = true; // Changed to false if any used layer found
@ -124,7 +124,7 @@ static bool WriteGeneralDescrPcb( BOARD* Pcb, FILE* File )
* @param LayerLookUpTable = look up table: pcbnew layer for each gerber layer
* @return 1 if OK, 0 if fail
*/
static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* aFile,
static int SavePcbFormatAscii( GERBVIEW_FRAME* frame, FILE* aFile,
int* LayerLookUpTable )
{
char line[256];

View File

@ -10,14 +10,14 @@
#include "gerbview.h"
static void LoadDCodeFile( WinEDA_GerberFrame* frame,
static void LoadDCodeFile( GERBVIEW_FRAME* frame,
const wxString& FullFileName );
/* Load a Gerber file selected from history list on current layer
* Previous data is deleted
*/
void WinEDA_GerberFrame::OnFileHistory( wxCommandEvent& event )
void GERBVIEW_FRAME::OnFileHistory( wxCommandEvent& event )
{
wxString fn;
@ -32,7 +32,7 @@ void WinEDA_GerberFrame::OnFileHistory( wxCommandEvent& event )
/* File commands. */
void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
void GERBVIEW_FRAME::Files_io( wxCommandEvent& event )
{
int id = event.GetId();
@ -89,7 +89,7 @@ clear an existing layer to load any new layers." ), NB_LAYERS );
}
bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
{
wxString filetypes;
wxArrayString filenamesList;
@ -164,9 +164,6 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
if( !filename.IsAbsolute() )
filename.SetPath( currentPath );
if( !filename.HasExt() )
filename.SetExt( g_PenFilenameExt );
GetScreen()->SetFileName( filename.GetFullPath() );
setActiveLayer( layer, false );
@ -208,19 +205,16 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
* 0 if file not read (cancellation of order ...)
* 1 if OK
*/
static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileName )
static void LoadDCodeFile( GERBVIEW_FRAME* frame, const wxString& FullFileName )
{
wxString wildcard;
wxFileName fn = FullFileName;
if( !fn.IsOk() )
{
wildcard.Printf( _( "Gerber DCODE files (%s)|*.%s" ),
GetChars( g_PenFilenameExt ),
GetChars( g_PenFilenameExt ) );
wildcard = _( "Gerber DCODE files" );
wildcard += AllFilesWildcard;
fn = frame->GetScreen()->GetFileName();
fn.SetExt( g_PenFilenameExt );
wxFileDialog dlg( (wxWindow*) frame, _( "Load GERBER DCODE File" ),
fn.GetPath(), fn.GetFullName(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );

View File

@ -21,106 +21,108 @@
#include "build_version.h"
// Config keywords
const wxString GerbviewShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) );
/****************************************/
/* class WinEDA_GerberFrame for GerbView*/
/* class GERBVIEW_FRAME for GerbView*/
/****************************************/
BEGIN_EVENT_TABLE( WinEDA_GerberFrame, PCB_BASE_FRAME )
EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize )
BEGIN_EVENT_TABLE( GERBVIEW_FRAME, PCB_BASE_FRAME )
EVT_CLOSE( GERBVIEW_FRAME::OnCloseWindow )
EVT_SIZE( GERBVIEW_FRAME::OnSize )
EVT_TOOL( wxID_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io )
EVT_TOOL( wxID_FILE, GERBVIEW_FRAME::Files_io )
EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, GERBVIEW_FRAME::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, GERBVIEW_FRAME::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, GERBVIEW_FRAME::Files_io )
EVT_TOOL( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io )
// Menu Files:
EVT_MENU( wxID_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_GEN_PLOT, WinEDA_GerberFrame::ToPlotter )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, WinEDA_GerberFrame::ExportDataInPcbnewFormat )
EVT_MENU( wxID_FILE, GERBVIEW_FRAME::Files_io )
EVT_MENU( ID_MENU_INC_LAYER_AND_APPEND_FILE, GERBVIEW_FRAME::Files_io )
EVT_MENU( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io )
EVT_MENU( ID_GEN_PLOT, GERBVIEW_FRAME::ToPlotter )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, GERBVIEW_FRAME::ExportDataInPcbnewFormat )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_GerberFrame::OnFileHistory )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, GERBVIEW_FRAME::OnFileHistory )
EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_EXIT, GERBVIEW_FRAME::Process_Special_Functions )
// menu Preferences
EVT_MENU( ID_CONFIG_REQ, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_CONFIG_SAVE, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_CONFIG_REQ, GERBVIEW_FRAME::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
WinEDA_GerberFrame::Process_Config )
GERBVIEW_FRAME::Process_Config )
EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_MENU( ID_GERBVIEW_OPTIONS_SETUP, WinEDA_GerberFrame::InstallGerberOptionsDialog )
GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_MENU( ID_GERBVIEW_OPTIONS_SETUP, GERBVIEW_FRAME::InstallGerberOptionsDialog )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EDA_DRAW_FRAME::SetLanguage )
// menu Postprocess
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, GERBVIEW_FRAME::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, GERBVIEW_FRAME::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, GERBVIEW_FRAME::Process_Special_Functions )
// menu Miscellaneous
EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE, GERBVIEW_FRAME::Process_Special_Functions )
// Menu Help
EVT_MENU( ID_GENERAL_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )
EVT_TOOL( wxID_CUT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_COPY, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_UNDO, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_PRINT, WinEDA_GerberFrame::ToPrinter )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_CUT, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_COPY, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_UNDO, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_PRINT, GERBVIEW_FRAME::ToPrinter )
EVT_TOOL( ID_FIND_ITEMS, GERBVIEW_FRAME::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
WinEDA_GerberFrame::Process_Special_Functions )
GERBVIEW_FRAME::Process_Special_Functions )
EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_TOOL,
WinEDA_GerberFrame::Process_Special_Functions )
GERBVIEW_FRAME::Process_Special_Functions )
// Vertical toolbar:
EVT_TOOL( ID_NO_TOOL_SELECTED, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_GerberFrame::Process_Special_Functions )
GERBVIEW_FRAME::Process_Special_Functions )
// Pop up menu
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, GERBVIEW_FRAME::Process_Special_Functions )
// Option toolbar
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, WinEDA_GerberFrame::OnSelectOptionToolbar )
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 )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, WinEDA_GerberFrame::OnSelectOptionToolbar )
GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
WinEDA_GerberFrame::OnSelectDisplayMode )
GERBVIEW_FRAME::OnSelectDisplayMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
WinEDA_GerberFrame::OnUpdateFlashedItemsDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, WinEDA_GerberFrame::OnUpdateLinesDrawMode )
GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnUpdateLinesDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
WinEDA_GerberFrame::OnUpdatePolygonsDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_DCODES, WinEDA_GerberFrame::OnUpdateShowDCodes )
GERBVIEW_FRAME::OnUpdatePolygonsDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnUpdateShowDCodes )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
WinEDA_GerberFrame::OnUpdateShowLayerManager )
GERBVIEW_FRAME::OnUpdateShowLayerManager )
EVT_UPDATE_UI( ID_TOOLBARH_GERBER_SELECT_TOOL, WinEDA_GerberFrame::OnUpdateSelectDCode )
EVT_UPDATE_UI( ID_TOOLBARH_GERBVIEW_SELECT_LAYER, WinEDA_GerberFrame::OnUpdateLayerSelectBox )
EVT_UPDATE_UI( ID_TOOLBARH_GERBER_SELECT_TOOL, GERBVIEW_FRAME::OnUpdateSelectDCode )
EVT_UPDATE_UI( ID_TOOLBARH_GERBVIEW_SELECT_LAYER, GERBVIEW_FRAME::OnUpdateLayerSelectBox )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
WinEDA_GerberFrame::OnUpdateDrawMode )
GERBVIEW_FRAME::OnUpdateDrawMode )
END_EVENT_TABLE()
WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
@ -221,22 +223,21 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
}
WinEDA_GerberFrame::~WinEDA_GerberFrame()
GERBVIEW_FRAME::~GERBVIEW_FRAME()
{
SetScreen( ScreenPcb );
extern PARAM_CFG_BASE* ParamCfgList[];
wxGetApp().SaveCurrentSetupValues( ParamCfgList );
wxGetApp().SaveCurrentSetupValues( m_configSettings );
}
void WinEDA_GerberFrame::OnCloseWindow( wxCloseEvent& Event )
void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
SaveSettings();
Destroy();
}
int WinEDA_GerberFrame::BestZoom()
int GERBVIEW_FRAME::BestZoom()
{
// gives a minimal value to zoom, if no item in list
if( GetBoard()->m_Drawings == NULL )
@ -265,7 +266,7 @@ int WinEDA_GerberFrame::BestZoom()
}
void WinEDA_GerberFrame::LoadSettings()
void GERBVIEW_FRAME::LoadSettings()
{
wxConfig* config = wxGetApp().m_EDA_Config;
@ -273,7 +274,9 @@ void WinEDA_GerberFrame::LoadSettings()
return;
PCB_BASE_FRAME::LoadSettings();
config->Read( GerbviewDrawModeOption, &m_displayMode, 0l );
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
long pageSize_opt;
config->Read( GerbviewShowPageSizeOption, &pageSize_opt, 0l );
int imax = 0;
@ -297,7 +300,7 @@ void WinEDA_GerberFrame::LoadSettings()
}
void WinEDA_GerberFrame::SaveSettings()
void GERBVIEW_FRAME::SaveSettings()
{
wxConfig* config = wxGetApp().m_EDA_Config;
@ -306,6 +309,8 @@ void WinEDA_GerberFrame::SaveSettings()
PCB_BASE_FRAME::SaveSettings();
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
wxRealPoint GridSize = GetScreen()->GetGridSize();
long pageSize_opt = 0;
@ -322,13 +327,12 @@ void WinEDA_GerberFrame::SaveSettings()
}
}
config->Write( GerbviewDrawModeOption, m_displayMode );
config->Write( GerbviewShowPageSizeOption, pageSize_opt );
config->Write( GerbviewShowDCodes, IsElementVisible( DCODES_VISIBLE ) );
}
void WinEDA_GerberFrame::ReFillLayerWidget()
void GERBVIEW_FRAME::ReFillLayerWidget()
{
m_LayersManager->ReFill();
@ -353,7 +357,7 @@ void WinEDA_GerberFrame::ReFillLayerWidget()
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
bool WinEDA_GerberFrame::IsGridVisible()
bool GERBVIEW_FRAME::IsGridVisible()
{
return IsElementVisible( GERBER_GRID_VISIBLE );
}
@ -365,7 +369,7 @@ bool WinEDA_GerberFrame::IsGridVisible()
* if you want to store/retrieve the grid visiblity in configuration.
* @param aVisible = true if the grid must be shown
*/
void WinEDA_GerberFrame::SetGridVisibility( bool aVisible )
void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
{
SetElementVisibility( GERBER_GRID_VISIBLE, aVisible );
}
@ -375,7 +379,7 @@ void WinEDA_GerberFrame::SetGridVisibility( bool aVisible )
* Function GetGridColor() , virtual
* @return the color of the grid
*/
int WinEDA_GerberFrame::GetGridColor()
int GERBVIEW_FRAME::GetGridColor()
{
return GetBoard()->GetVisibleElementColor( GERBER_GRID_VISIBLE );
}
@ -385,7 +389,7 @@ int WinEDA_GerberFrame::GetGridColor()
* Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
void WinEDA_GerberFrame::SetGridColor( int aColor )
void GERBVIEW_FRAME::SetGridColor( int aColor )
{
GetBoard()->SetVisibleElementColor( GERBER_GRID_VISIBLE, aColor );
}
@ -398,14 +402,14 @@ void WinEDA_GerberFrame::SetGridColor( int aColor )
* @param aNewState = The new visibility state of the element category
* @see enum aGERBER_VISIBLE
*/
void WinEDA_GerberFrame::SetElementVisibility( int aGERBER_VISIBLE, bool aNewState )
void GERBVIEW_FRAME::SetElementVisibility( int aGERBER_VISIBLE, bool aNewState )
{
GetBoard()->SetElementVisibility( aGERBER_VISIBLE, aNewState );
m_LayersManager->SetRenderState( aGERBER_VISIBLE, aNewState );
}
int WinEDA_GerberFrame::getNextAvailableLayer( int aLayer ) const
int GERBVIEW_FRAME::getNextAvailableLayer( int aLayer ) const
{
int layer = aLayer;
@ -426,7 +430,7 @@ int WinEDA_GerberFrame::getNextAvailableLayer( int aLayer ) const
}
void WinEDA_GerberFrame::syncLayerWidget()
void GERBVIEW_FRAME::syncLayerWidget()
{
m_LayersManager->SelectLayer( getActiveLayer() );
UpdateTitleAndInfo();
@ -439,7 +443,7 @@ void WinEDA_GerberFrame::syncLayerWidget()
* The currently active layer, as defined by the return value of
* getActiveLayer(). And updates the colored icon in the toolbar.
*/
void WinEDA_GerberFrame::syncLayerBox()
void GERBVIEW_FRAME::syncLayerBox()
{
m_SelLayerBox->SetSelection( getActiveLayer() );
int dcodeSelected = -1;
@ -463,7 +467,7 @@ void WinEDA_GerberFrame::syncLayerBox()
* called on a language menu selection
* Update Layer manager title and tabs texts
*/
void WinEDA_GerberFrame::SetLanguage( wxCommandEvent& event )
void GERBVIEW_FRAME::SetLanguage( wxCommandEvent& event )
{
EDA_DRAW_FRAME::SetLanguage( event );
m_LayersManager->SetLayersManagerTabsText();
@ -475,7 +479,7 @@ void WinEDA_GerberFrame::SetLanguage( wxCommandEvent& event )
}
void WinEDA_GerberFrame::Liste_D_Codes()
void GERBVIEW_FRAME::Liste_D_Codes()
{
int ii, jj;
D_CODE* pt_D_code;
@ -549,7 +553,7 @@ void WinEDA_GerberFrame::Liste_D_Codes()
* Note layer name can change when reading a gerber file, and the layer name is the last found.
* So, show the layer name is not very useful, and can be seen as a debug feature.
*/
void WinEDA_GerberFrame::UpdateTitleAndInfo()
void GERBVIEW_FRAME::UpdateTitleAndInfo()
{
GERBER_IMAGE* gerber = g_GERBER_List[ GetScreen()->m_Active_Layer ];
wxString text;
@ -592,7 +596,7 @@ void WinEDA_GerberFrame::UpdateTitleAndInfo()
/* Function OnSelectDisplayMode: called to select display mode
* (fast display, or exact mode with stacked images or with transparency
*/
void WinEDA_GerberFrame::OnSelectDisplayMode( wxCommandEvent& event )
void GERBVIEW_FRAME::OnSelectDisplayMode( wxCommandEvent& event )
{
int oldMode = GetDisplayMode();

View File

@ -24,26 +24,12 @@
#include <wx/file.h>
#include <wx/snglinst.h>
extern bool Read_Config();
wxString g_PhotoFilenameExt;
wxString g_DrillFilenameExt;
wxString g_PenFilenameExt;
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
int g_Default_GERBER_Format;
int g_DisplayPolygonsModeSketch;
const wxString GerbviewProjectFileExt( wxT( "cnf" ) );
const wxString GerbviewProjectFileWildcard( _( "GerbView project files (.cnf)|*.cnf" ) );
// Config keywords
const wxString GerbviewDrawModeOption( wxT( "DrawModeOption" ) );
const wxString GerbviewShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) );
GERBER_IMAGE* g_GERBER_List[32];
// List of page sizes
@ -65,7 +51,7 @@ IMPLEMENT_APP( WinEDA_App )
void WinEDA_App::MacOpenFile(const wxString &fileName)
{
wxFileName filename = fileName;
WinEDA_GerberFrame * frame = ((WinEDA_GerberFrame*)GetTopWindow());
GERBVIEW_FRAME * frame = ((GERBVIEW_FRAME*)GetTopWindow());
if( !filename.FileExists() )
return;
@ -77,7 +63,7 @@ void WinEDA_App::MacOpenFile(const wxString &fileName)
bool WinEDA_App::OnInit()
{
wxFileName fn;
WinEDA_GerberFrame* frame = NULL;
GERBVIEW_FRAME* frame = NULL;
#ifdef __WXMAC__
wxApp::s_macAboutMenuItemId = ID_KICAD_ABOUT;
@ -99,16 +85,13 @@ bool WinEDA_App::OnInit()
bool reopenLastUsedDirectory = argc == 1;
GetSettings( reopenLastUsedDirectory );
extern PARAM_CFG_BASE* ParamCfgList[];
wxGetApp().ReadCurrentSetupValues( ParamCfgList );
g_DrawBgColor = BLACK;
/* Must be called before creating the main frame in order to
* display the real hotkeys in menus or tool tips */
ReadHotkeyConfig( wxT("GerberFrame"), s_Gerbview_Hokeys_Descr );
frame = new WinEDA_GerberFrame( NULL, wxT( "GerbView" ),
frame = new GERBVIEW_FRAME( NULL, wxT( "GerbView" ),
wxPoint( 0, 0 ),
wxSize( 600, 400 ) );
@ -126,8 +109,6 @@ bool WinEDA_App::OnInit()
frame->Zoom_Automatique( true ); // Zoom fit in frame
frame->GetScreen()->m_FirstRedraw = false;
Read_Config();
if( argc <= 1 )
return true;

View File

@ -15,7 +15,7 @@
#define CURSEUR_ON_GRILLE 0
#define CURSEUR_OFF_GRILLE 1
class WinEDA_GerberFrame;
class GERBVIEW_FRAME;
//class BOARD;
class GERBER_IMAGE;
@ -50,10 +50,6 @@ enum GERBER_VISIBLE
*/
#define GERBER_BUFZ 4000
extern wxString g_PhotoFilenameExt;
extern wxString g_DrillFilenameExt;
extern wxString g_PenFilenameExt;
extern int g_DisplayPolygonsModeSketch;
extern const wxString GerbviewProjectFileExt;
@ -61,11 +57,6 @@ extern const wxString GerbviewProjectFileWildcard;
extern Ki_PageDescr* g_GerberPageSizeList[];
// Config keywords
extern const wxString GerbviewDrawModeOption;
extern const wxString GerbviewShowPageSizeOption;
extern const wxString GerbviewShowDCodes;
// Interpolation type
enum Gerb_Interpolation
{

View File

@ -16,7 +16,7 @@
#include "gerbview_config.h"
#include "dialog_hotkeys_editor.h"
void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
{
int id = event.GetId();
wxPoint pos;
@ -28,17 +28,7 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
switch( id )
{
case ID_CONFIG_REQ:
{
InstallConfigFrame( pos );
break;
}
case ID_CONFIG_SAVE:
Update_config();
break;
/* Hotkey IDs */
/* Hotkey IDs */
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_Gerbview_Hokeys_Descr );
break;
@ -52,50 +42,88 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
break;
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
// Display current hotkey list for eeschema.
DisplayHotkeyList( this, s_Gerbview_Hokeys_Descr );
break;
default:
DisplayError( this,
wxT( "WinEDA_GerberFrame::Process_Config internal error" ) );
wxT( "GERBVIEW_FRAME::Process_Config internal error" ) );
}
}
/* Read configuration, if it has not already read.
* 1 - bed gerbview.cnf
* 2 - if no bed is path> gerbview.exe> / gerbview.cnf
* 3 - If not found: init variables to default values
/*
* Return the Gerbview applications settings list.
* (list of parameters that must be saved in Gerbview parameters)
*
* This replaces the old statically define list that had the project
* file settings and the application settings mixed together. This
* was confusing and caused some settings to get saved and loaded
* incorrectly. Currently, only the settings that are needed at start
* up by the main window are defined here. There are other locally used
* settings scattered thoughout the EESchema source code. If you need
* to define a configuration setting that need to be loaded at run time,
* this is the place to define it.
*
* TODO: Define the configuration variables as member variables instead of
* global variables or move them to the object class where they are
* used.
*/
bool Read_Config()
PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
{
wxGetApp().ReadProjectConfig( wxT( "gerbview.cnf" ), GROUP, ParamCfgList,
FALSE );
if( !m_configSettings.empty() )
return m_configSettings;
if( g_PhotoFilenameExt.IsEmpty() )
g_PhotoFilenameExt = wxT( "pho" );
if( g_DrillFilenameExt.IsEmpty() )
g_DrillFilenameExt = wxT( "drl" );
if( g_PenFilenameExt.IsEmpty() )
g_PenFilenameExt = wxT( "pen" );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
(int*) &g_UserUnit, 0, 0, 1 ) );
return TRUE;
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
&m_displayMode, 2, 0, 2 ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
wxT( "DCodeColor" ),
&g_ColorsSettings.m_ItemsColors[
DCODES_VISIBLE],
WHITE ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true,
wxT( "DisplayPolairCoordinates" ),
&DisplayOpt.DisplayPolarCood,
false ) );
// Color select parameters:
static const int color_default[32] = // Default values for color layers 0 to 31
{
GREEN, BLUE, LIGHTGRAY, MAGENTA,
RED, DARKGREEN, BROWN, MAGENTA,
LIGHTGRAY, BLUE, GREEN, CYAN,
LIGHTRED, LIGHTMAGENTA, YELLOW, RED,
BLUE, BROWN, LIGHTCYAN, RED,
MAGENTA, CYAN, BROWN, MAGENTA,
LIGHTGRAY, BLUE, GREEN, DARKCYAN,
YELLOW, LIGHTMAGENTA, YELLOW, LIGHTGRAY
};
// List of keywords used as identifiers in config
// they *must* be static const and not temporary created,
// because the parameter list that used these keywords does not store them,
// just points on them
static const wxChar * keys[32] =
{
wxT("ColorLayer0"), wxT("ColorLayer1"), wxT("ColorLayer2"), wxT("ColorLayer3"),
wxT("ColorLayer4"), wxT("ColorLayer5"), wxT("ColorLayer6"), wxT("ColorLayer7"),
wxT("ColorLayer8"), wxT("ColorLayer9"), wxT("ColorLayer10"), wxT("ColorLayer11"),
wxT("ColorLayer12"), wxT("ColorLaye13"), wxT("ColorLayer14"), wxT("ColorLayer15")
};
for( unsigned ii = 0; ii < 32; ii++ )
{
int * prm = &g_ColorsSettings.m_LayersColors[1];
PARAM_CFG_SETCOLOR * prm_entry =
new PARAM_CFG_SETCOLOR( true, keys[ii], prm, color_default[1] );
m_configSettings.push_back( prm_entry );
}
return m_configSettings;
}
void WinEDA_GerberFrame::Update_config()
{
wxFileName fn = wxFileName( wxEmptyString, wxT( "gerbview" ),
GerbviewProjectFileExt );
wxFileDialog dlg( this, _( "Save GerbView Project File" ), wxEmptyString,
fn.GetFullName(), GerbviewProjectFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP, ParamCfgList );
}

View File

@ -8,352 +8,3 @@
#define GROUP wxT("/gerbview")
#define INSETUP TRUE
/* Useful macro : */
#define LOC_COLOR(numlayer) &g_ColorsSettings.m_LayersColors[numlayer]
/* Config parameters list */
static PARAM_CFG_WXSTRING PhotoExtBufCfg
(
INSETUP,
wxT("GerberFileExt"),
&g_PhotoFilenameExt
);
static PARAM_CFG_WXSTRING PenExtBufCfg
(
INSETUP,
wxT("PenFileExt"),
&g_PenFilenameExt
);
static PARAM_CFG_WXSTRING DrillExtBufCfg
(
INSETUP,
wxT("DrillFileExt"),
&g_DrillFilenameExt
);
static PARAM_CFG_INT UnitsSelectionOptCfg // Units; 0 inches, 1 mm
(
INSETUP,
wxT("Units"),
(int*)&g_UserUnit,
MILLIMETRES
);
static PARAM_CFG_SETCOLOR ColorLayer0Cfg
(
INSETUP,
wxT("ColLay0"),
LOC_COLOR(0),
GREEN
);
static PARAM_CFG_SETCOLOR ColorLayer1Cfg
(
INSETUP,
wxT("ColLay1"),
LOC_COLOR(1),
BLUE
);
static PARAM_CFG_SETCOLOR ColorLayer2Cfg
(
INSETUP,
wxT("ColLay2"),
LOC_COLOR(2),
LIGHTGRAY
);
static PARAM_CFG_SETCOLOR ColorLayer3Cfg
(
INSETUP,
wxT("ColLay3"),
LOC_COLOR(3),
5
);
static PARAM_CFG_SETCOLOR ColorLayer4Cfg
(
INSETUP,
wxT("ColLay4"),
LOC_COLOR(4),
4
);
static PARAM_CFG_SETCOLOR ColorLayer5Cfg
(
INSETUP,
wxT("ColLay5"),
LOC_COLOR(5),
5
);
static PARAM_CFG_SETCOLOR ColorLayer6Cfg
(
INSETUP,
wxT("ColLay6"),
LOC_COLOR(6),
6
);
static PARAM_CFG_SETCOLOR ColorLayer7Cfg
(
INSETUP,
wxT("ColLay7"),
LOC_COLOR(7),
5
);
static PARAM_CFG_SETCOLOR ColorLayer8Cfg
(
INSETUP,
wxT("ColLay8"),
LOC_COLOR(8),
7
);
static PARAM_CFG_SETCOLOR ColorLayer9Cfg
(
INSETUP,
wxT("ColLay9"),
LOC_COLOR(9),
1
);
static PARAM_CFG_SETCOLOR ColorLayer10Cfg
(
INSETUP,
wxT("ColLayA"),
LOC_COLOR(10),
2
);
static PARAM_CFG_SETCOLOR ColorLayer11Cfg
(
INSETUP,
wxT("ColLayB"),
LOC_COLOR(11),
3
);
static PARAM_CFG_SETCOLOR ColorLayer12Cfg
(
INSETUP,
wxT("ColLayC"),
LOC_COLOR(12),
12
);
static PARAM_CFG_SETCOLOR ColorLayer13Cfg
(
INSETUP,
wxT("ColLayD"),
LOC_COLOR(13),
13
);
static PARAM_CFG_SETCOLOR ColorLayer14Cfg
(
INSETUP,
wxT("ColLayE"),
LOC_COLOR(14),
14
);
static PARAM_CFG_SETCOLOR ColorLayer15Cfg
(
INSETUP,
wxT("ColLayF"),
LOC_COLOR(15),
RED
);
static PARAM_CFG_SETCOLOR ColorLayer16Cfg
(
INSETUP,
wxT("ColLayG"),
LOC_COLOR(16),
1
);
static PARAM_CFG_SETCOLOR ColorLayer17Cfg
(
INSETUP,
wxT("ColLayH"),
LOC_COLOR(17),
5
);
static PARAM_CFG_SETCOLOR ColorLayer18Cfg
(
INSETUP,
wxT("ColLayI"),
LOC_COLOR(18),
11
);
static PARAM_CFG_SETCOLOR ColorLayer19Cfg
(
INSETUP,
wxT("ColLayJ"),
LOC_COLOR(19),
4
);
static PARAM_CFG_SETCOLOR ColorLayer20Cfg
(
INSETUP,
wxT("ColLayK"),
LOC_COLOR(20),
5
);
static PARAM_CFG_SETCOLOR ColorLayer21Cfg
(
INSETUP,
wxT("ColLayL"),
LOC_COLOR(21),
3
);
static PARAM_CFG_SETCOLOR ColorLayer22Cfg
(
INSETUP,
wxT("ColLayM"),
LOC_COLOR(22),
6
);
static PARAM_CFG_SETCOLOR ColorLayer23Cfg
(
INSETUP,
wxT("ColLayN"),
LOC_COLOR(23),
5
);
static PARAM_CFG_SETCOLOR ColorLayer24Cfg
(
INSETUP,
wxT("ColLayO"),
LOC_COLOR(24),
LIGHTGRAY
);
static PARAM_CFG_SETCOLOR ColorLayer25Cfg
(
INSETUP,
wxT("ColLayP"),
LOC_COLOR(25),
1
);
static PARAM_CFG_SETCOLOR ColorLayer26Cfg
(
INSETUP,
wxT("ColLayQ"),
LOC_COLOR(26),
2
);
static PARAM_CFG_SETCOLOR ColorLayer27Cfg
(
INSETUP,
wxT("ColLayR"),
LOC_COLOR(27),
14
);
static PARAM_CFG_SETCOLOR ColorLayer28Cfg
(
INSETUP,
wxT("ColLayS"),
LOC_COLOR(28),
YELLOW
);
static PARAM_CFG_SETCOLOR ColorLayer29Cfg
(
INSETUP,
wxT("ColLayT"),
LOC_COLOR(29),
13
);
static PARAM_CFG_SETCOLOR ColorLayer30Cfg
(
INSETUP,
wxT("ColLayU"),
LOC_COLOR(30),
14
);
static PARAM_CFG_SETCOLOR ColorLayer31Cfg
(
INSETUP,
wxT("ColLayV"),
LOC_COLOR(31),
7
);
static PARAM_CFG_SETCOLOR DCodesDisplayOptCfg
(
INSETUP,
wxT("DCodeVisible"),
&g_ColorsSettings.m_ItemsColors[DCODES_VISIBLE],
WHITE
);
static PARAM_CFG_BOOL DisplayPolairCoordinatesOptCfg
(
INSETUP,
wxT("DisplayPolairCoordinates"),
&DisplayOpt.DisplayPolarCood,
FALSE
);
PARAM_CFG_BASE * ParamCfgList[] =
{
& PhotoExtBufCfg,
& PenExtBufCfg,
& DrillExtBufCfg,
& UnitsSelectionOptCfg,
& ColorLayer0Cfg,
& ColorLayer1Cfg,
& ColorLayer2Cfg,
& ColorLayer3Cfg,
& ColorLayer4Cfg,
& ColorLayer5Cfg,
& ColorLayer6Cfg,
& ColorLayer7Cfg,
& ColorLayer8Cfg,
& ColorLayer9Cfg,
& ColorLayer10Cfg,
& ColorLayer11Cfg,
& ColorLayer12Cfg,
& ColorLayer13Cfg,
& ColorLayer14Cfg,
& ColorLayer15Cfg,
& ColorLayer16Cfg,
& ColorLayer17Cfg,
& ColorLayer18Cfg,
& ColorLayer19Cfg,
& ColorLayer20Cfg,
& ColorLayer21Cfg,
& ColorLayer22Cfg,
& ColorLayer23Cfg,
& ColorLayer24Cfg,
& ColorLayer25Cfg,
& ColorLayer26Cfg,
& ColorLayer27Cfg,
& ColorLayer28Cfg,
& ColorLayer29Cfg,
& ColorLayer30Cfg,
& ColorLayer31Cfg,
& DCodesDisplayOptCfg,
& DisplayPolairCoordinatesOptCfg,
NULL
};

View File

@ -18,7 +18,6 @@ enum gerbview_ids
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
ID_GERBVIEW_DELETE_ITEM_BUTT,
ID_GERBVIEW_GLOBAL_DELETE,
ID_GERBVIEW_OPTIONS_SETUP,
ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,

View File

@ -69,7 +69,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Gerbview_Hokeys_Descr[] =
/***********************************************************/
void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
/***********************************************************/
/* Hot keys. Some commands are relatives to the item under the mouse cursor

Some files were not shown because too many files have changed in this diff Show More