Commit f6669b78 authored by jean-pierre charras's avatar jean-pierre charras

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

others: fix minor issues.
parent 669db0ff
...@@ -39,7 +39,6 @@ E4) Change add component dialog search text control to combobox and add compone ...@@ -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 search history save and restore capability. Also add session save and restore
to component history list control. Add advanced search capability similar to to component history list control. Add advanced search capability similar to
new find dialog. 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 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 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 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 ...@@ -48,55 +47,13 @@ E6) Start initial work for changing component library file format to use Dick's
GerbView GerbView
-------- --------
* Need work as good as gerbv from gEDA * List control for layer sort on the fly
* Named layers
* List control for layer sort on the fly
* Add excellon2 drill file support (small good library) * 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 PCBNew
------ ------
Dick: 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 * 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.
...@@ -664,11 +664,13 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident, ...@@ -664,11 +664,13 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident,
PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident, PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
wxString* ptparam, wxString* ptparam,
const wxString& default_val,
const wxChar* group ) : const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_WXSTRING, group ) PARAM_CFG_BASE( ident, PARAM_WXSTRING, group )
{ {
m_Pt_param = ptparam; m_Pt_param = ptparam;
m_Setup = Insetup; m_Setup = Insetup;
m_default = default_val;
} }
...@@ -680,7 +682,7 @@ void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) ...@@ -680,7 +682,7 @@ void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig )
{ {
if( m_Pt_param == NULL || aConfig == NULL ) if( m_Pt_param == NULL || aConfig == NULL )
return; return;
*m_Pt_param = aConfig->Read( m_Ident ); *m_Pt_param = aConfig->Read( m_Ident, m_default );
} }
......
...@@ -16,7 +16,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ...@@ -16,7 +16,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
set(DIALOGS_SRCS set(DIALOGS_SRCS
dialogs/gerbview_dialog_display_options_frame_base.cpp dialogs/gerbview_dialog_display_options_frame_base.cpp
dialogs/gerbview_dialog_display_options_frame.cpp dialogs/gerbview_dialog_display_options_frame.cpp
dialogs/dialog_gerber_config.cpp
dialogs/dialog_print_using_printer.cpp dialogs/dialog_print_using_printer.cpp
dialogs/dialog_print_using_printer_base.cpp dialogs/dialog_print_using_printer_base.cpp
) )
...@@ -31,7 +30,6 @@ set(GERBVIEW_SRCS ...@@ -31,7 +30,6 @@ set(GERBVIEW_SRCS
class_gerbview_layer_widget.cpp class_gerbview_layer_widget.cpp
controle.cpp controle.cpp
dcode.cpp dcode.cpp
deltrack.cpp
dummy_functions.cpp dummy_functions.cpp
draw_gerber_screen.cpp draw_gerber_screen.cpp
edit.cpp edit.cpp
......
...@@ -47,7 +47,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -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 /* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
* the key (ALT, SHIFT ALT ..) * the key (ALT, SHIFT ALT ..)
*/ */
int WinEDA_GerberFrame::ReturnBlockCommand( int key ) int GERBVIEW_FRAME::ReturnBlockCommand( int key )
{ {
int cmd = 0; int cmd = 0;
...@@ -85,7 +85,7 @@ int WinEDA_GerberFrame::ReturnBlockCommand( int key ) ...@@ -85,7 +85,7 @@ int WinEDA_GerberFrame::ReturnBlockCommand( int key )
/* Routine to handle the BLOCK PLACE command */ /* Routine to handle the BLOCK PLACE command */
void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC ) void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
{ {
bool err = false; bool err = false;
...@@ -162,7 +162,7 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC ) ...@@ -162,7 +162,7 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
* @return false if no item selected, or command finished, * @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later * 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 nextcmd = false;
bool zoom_command = false; bool zoom_command = false;
...@@ -274,7 +274,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -274,7 +274,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
/* /*
* Erase the selected block. * 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 ?" ) ) ) if( !IsOK( this, _( "Ok to delete block ?" ) ) )
return; return;
...@@ -300,7 +300,7 @@ void WinEDA_GerberFrame::Block_Delete( wxDC* DC ) ...@@ -300,7 +300,7 @@ void WinEDA_GerberFrame::Block_Delete( wxDC* DC )
/* /*
* Function to move items in the current selected block * 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 delta;
wxPoint oldpos; wxPoint oldpos;
...@@ -332,7 +332,7 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC ) ...@@ -332,7 +332,7 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC )
/* /*
* Function to duplicate items in the current selected block * 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 delta;
wxPoint oldpos; wxPoint oldpos;
......
...@@ -83,7 +83,7 @@ void GERBER_LAYER::ResetDefaultValues() ...@@ -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_Parent = aParent;
m_GraphicLayer = aLayer; // Graphic layer Number m_GraphicLayer = aLayer; // Graphic layer Number
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define IsNumber( x ) ( ( ( (x) >= '0' ) && ( (x) <='9' ) ) \ #define IsNumber( x ) ( ( ( (x) >= '0' ) && ( (x) <='9' ) ) \
|| ( (x) == '-' ) || ( (x) == '+' ) || ( (x) == '.' ) ) || ( (x) == '-' ) || ( (x) == '+' ) || ( (x) == '.' ) )
class WinEDA_GerberFrame; class GERBVIEW_FRAME;
class BOARD; class BOARD;
class D_CODE; class D_CODE;
...@@ -74,7 +74,7 @@ private: ...@@ -74,7 +74,7 @@ private:
*/ */
class GERBER_IMAGE 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) 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 bool m_Exposure; ///< whether an aperture macro tool is flashed on or off
BOARD* m_Pcb; BOARD* m_Pcb;
...@@ -138,7 +138,7 @@ private: ...@@ -138,7 +138,7 @@ private:
// 1 = have negative items found // 1 = have negative items found
public: public:
GERBER_IMAGE( WinEDA_GerberFrame* aParent, int layer ); GERBER_IMAGE( GERBVIEW_FRAME* aParent, int layer );
~GERBER_IMAGE(); ~GERBER_IMAGE();
void Clear_GERBER_IMAGE(); void Clear_GERBER_IMAGE();
int ReturnUsedDcodeNumber(); int ReturnUsedDcodeNumber();
......
...@@ -41,12 +41,12 @@ ...@@ -41,12 +41,12 @@
/* /*
* Class GERBER_LAYER_WIDGET * Class GERBER_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they * 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. * 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 ), LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
myframe( aParent ) myframe( aParent )
{ {
......
...@@ -36,12 +36,12 @@ ...@@ -36,12 +36,12 @@
/** /**
* Class GERBER_LAYER_WIDGET * Class GERBER_LAYER_WIDGET
* is here to implement the abtract functions of LAYER_WIDGET so they * 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. * menu which is specific to PCBNEW's needs.
*/ */
class GERBER_LAYER_WIDGET : public LAYER_WIDGET class GERBER_LAYER_WIDGET : public LAYER_WIDGET
{ {
WinEDA_GerberFrame* myframe; GERBVIEW_FRAME* myframe;
// popup menu ids. // popup menu ids.
#define ID_SHOW_ALL_COPPERS wxID_HIGHEST #define ID_SHOW_ALL_COPPERS wxID_HIGHEST
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
* effectively sets the overal size of the widget via the row height and bitmap * effectively sets the overal size of the widget via the row height and bitmap
* button sizes. * 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(); void ReFill();
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "gerbview.h" #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; wxRealPoint gridSize;
wxPoint oldpos; wxPoint oldpos;
......
...@@ -147,7 +147,7 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent ) ...@@ -147,7 +147,7 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
* tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)] * tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)]
* ex: 1, 12, 12, 0, 0, 0, 3 ; D10 * 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; int current_Dcode, ii, dcode_scale;
char* ptcar; char* ptcar;
...@@ -269,7 +269,7 @@ int WinEDA_GerberFrame::Read_D_Code_File( const wxString& D_Code_FullFileName ) ...@@ -269,7 +269,7 @@ int WinEDA_GerberFrame::Read_D_Code_File( const wxString& D_Code_FullFileName )
/* Set Size Items (Lines, Flashes) from DCodes List /* 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 static D_CODE dummy( 999 ); //Used if D_CODE not found in list
...@@ -318,7 +318,7 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems() ...@@ -318,7 +318,7 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems()
break; break;
default: default:
wxMessageBox( wxT( "WinEDA_GerberFrame::CopyDCodesSizeToItems() error" ) ); wxMessageBox( wxT( "GERBVIEW_FRAME::CopyDCodesSizeToItems() error" ) );
break; break;
} }
} }
......
/*********************************************/
/* 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 );
}
/*****************************/
/* 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();
}
...@@ -44,14 +44,14 @@ static PRINT_PARAMETERS s_Parameters; ...@@ -44,14 +44,14 @@ static PRINT_PARAMETERS s_Parameters;
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base
{ {
private: private:
WinEDA_GerberFrame* m_Parent; GERBVIEW_FRAME* m_Parent;
wxConfig* m_Config; wxConfig* m_Config;
wxCheckBox* m_BoxSelectLayer[32]; wxCheckBox* m_BoxSelectLayer[32];
static wxPoint s_LastPos; static wxPoint s_LastPos;
static wxSize s_LastSize; static wxSize s_LastSize;
public: public:
DIALOG_PRINT_USING_PRINTER( WinEDA_GerberFrame* parent ); DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent );
~DIALOG_PRINT_USING_PRINTER() {}; ~DIALOG_PRINT_USING_PRINTER() {};
private: private:
...@@ -80,7 +80,7 @@ wxSize DIALOG_PRINT_USING_PRINTER::s_LastSize; ...@@ -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: /* Virtual function:
...@@ -106,7 +106,7 @@ void WinEDA_GerberFrame::ToPrinter( wxCommandEvent& event ) ...@@ -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 ) DIALOG_PRINT_USING_PRINTER_base( parent )
/*************************************************************************************/ /*************************************************************************************/
{ {
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
class DIALOG_DISPLAY_OPTIONS : public DIALOG_DISPLAY_OPTIONS_BASE class DIALOG_DISPLAY_OPTIONS : public DIALOG_DISPLAY_OPTIONS_BASE
{ {
private: private:
WinEDA_GerberFrame* m_Parent; GERBVIEW_FRAME* m_Parent;
public: public:
DIALOG_DISPLAY_OPTIONS( WinEDA_GerberFrame* parent ); DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME* parent );
~DIALOG_DISPLAY_OPTIONS() {}; ~DIALOG_DISPLAY_OPTIONS() {};
private: private:
...@@ -33,7 +33,7 @@ private: ...@@ -33,7 +33,7 @@ private:
}; };
void WinEDA_GerberFrame::InstallGerberOptionsDialog( wxCommandEvent& event ) void GERBVIEW_FRAME::InstallGerberOptionsDialog( wxCommandEvent& event )
{ {
DIALOG_DISPLAY_OPTIONS dlg( this ); DIALOG_DISPLAY_OPTIONS dlg( this );
int opt = dlg.ShowModal(); int opt = dlg.ShowModal();
...@@ -41,7 +41,7 @@ void WinEDA_GerberFrame::InstallGerberOptionsDialog( wxCommandEvent& event ) ...@@ -41,7 +41,7 @@ void WinEDA_GerberFrame::InstallGerberOptionsDialog( wxCommandEvent& event )
DrawPanel->Refresh(); 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 ) DIALOG_DISPLAY_OPTIONS_BASE( parent, wxID_ANY )
{ {
m_Parent = parent; m_Parent = parent;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* @param aPrintMirrorMode = true to plot mirrored * @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer to an optional data (not used here: can be NULL) * @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 ) bool aPrintMirrorMode, void* aData )
{ {
// Save current draw options, because print mode has specfic options: // Save current draw options, because print mode has specfic options:
...@@ -58,7 +58,7 @@ void WinEDA_GerberFrame::PrintPage( wxDC* aDC, int aPrintMasklayer, ...@@ -58,7 +58,7 @@ void WinEDA_GerberFrame::PrintPage( wxDC* aDC, int aPrintMasklayer,
/* Redraws the full screen, including axis and grid /* 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(); PCB_SCREEN* screen = (PCB_SCREEN*) GetScreen();
...@@ -267,7 +267,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin ...@@ -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 * Draw the DCode value (if exists) corresponding to gerber item
* Polygons do not have a DCode * Polygons do not have a DCode
*/ */
void WinEDA_GerberFrame::DrawItemsDCodeID( wxDC* aDC, int aDrawMode ) void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
{ {
wxPoint pos; wxPoint pos;
int width, orient; int width, orient;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/* Process the command triggered by the left button of the mouse when a tool /* Process the command triggered by the left button of the mouse when a tool
* is already selected. * 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(); BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg; wxString msg;
...@@ -29,7 +29,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) ...@@ -29,7 +29,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{ {
if( DrawStruct && DrawStruct->m_Flags ) 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->Type(),
(unsigned) DrawStruct->m_Flags ); (unsigned) DrawStruct->m_Flags );
DisplayError( this, msg ); DisplayError( this, msg );
...@@ -52,9 +52,6 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) ...@@ -52,9 +52,6 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
case ID_NO_TOOL_SELECTED: case ID_NO_TOOL_SELECTED:
break; break;
case ID_GERBVIEW_DELETE_ITEM_BUTT:
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
/* TODO: /* TODO:
...@@ -65,7 +62,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) ...@@ -65,7 +62,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_GerberFrame::ProcessCommand error" ) ); DisplayError( this, wxT( "GERBVIEW_FRAME::ProcessCommand error" ) );
break; break;
} }
} }
...@@ -73,7 +70,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) ...@@ -73,7 +70,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
/* Handles the selection of tools, menu, and popup menu commands. /* 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 id = event.GetId();
int layer = GetScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
...@@ -140,10 +137,6 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -140,10 +137,6 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
break; break;
case ID_GERBVIEW_DELETE_ITEM_BUTT:
SetToolID( id, wxCURSOR_BULLSEYE, wxT( "Delete item" ) );
break;
case ID_TOOLBARH_GERBVIEW_SELECT_LAYER: case ID_TOOLBARH_GERBVIEW_SELECT_LAYER:
setActiveLayer(m_SelLayerBox->GetChoice()); setActiveLayer(m_SelLayerBox->GetChoice());
DrawPanel->Refresh(); DrawPanel->Refresh();
...@@ -196,14 +189,8 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -196,14 +189,8 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; 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: default:
wxMessageBox( wxT( "WinEDA_GerberFrame::Process_Special_Functions error" ) ); wxMessageBox( wxT( "GERBVIEW_FRAME::Process_Special_Functions error" ) );
break; break;
} }
} }
...@@ -211,7 +198,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -211,7 +198,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
/* Called on a double click of left mouse button. /* 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 // Currently: no nothing
} }
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "class_gerber_draw_item.h" #include "class_gerber_draw_item.h"
static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, static int SavePcbFormatAscii( GERBVIEW_FRAME* frame,
FILE* File, int* LayerLookUpTable ); FILE* File, int* LayerLookUpTable );
/* Export data in pcbnew format /* Export data in pcbnew format
*/ */
void WinEDA_GerberFrame::ExportDataInPcbnewFormat( wxCommandEvent& event ) void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
{ {
int ii = 0; int ii = 0;
bool no_used_layers = true; // Changed to false if any used layer found bool no_used_layers = true; // Changed to false if any used layer found
...@@ -124,7 +124,7 @@ static bool WriteGeneralDescrPcb( BOARD* Pcb, FILE* File ) ...@@ -124,7 +124,7 @@ static bool WriteGeneralDescrPcb( BOARD* Pcb, FILE* File )
* @param LayerLookUpTable = look up table: pcbnew layer for each gerber layer * @param LayerLookUpTable = look up table: pcbnew layer for each gerber layer
* @return 1 if OK, 0 if fail * @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 ) int* LayerLookUpTable )
{ {
char line[256]; char line[256];
......
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
#include "gerbview.h" #include "gerbview.h"
static void LoadDCodeFile( WinEDA_GerberFrame* frame, static void LoadDCodeFile( GERBVIEW_FRAME* frame,
const wxString& FullFileName ); const wxString& FullFileName );
/* Load a Gerber file selected from history list on current layer /* Load a Gerber file selected from history list on current layer
* Previous data is deleted * Previous data is deleted
*/ */
void WinEDA_GerberFrame::OnFileHistory( wxCommandEvent& event ) void GERBVIEW_FRAME::OnFileHistory( wxCommandEvent& event )
{ {
wxString fn; wxString fn;
...@@ -32,7 +32,7 @@ void WinEDA_GerberFrame::OnFileHistory( wxCommandEvent& event ) ...@@ -32,7 +32,7 @@ void WinEDA_GerberFrame::OnFileHistory( wxCommandEvent& event )
/* File commands. */ /* File commands. */
void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) void GERBVIEW_FRAME::Files_io( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
...@@ -89,7 +89,7 @@ clear an existing layer to load any new layers." ), NB_LAYERS ); ...@@ -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; wxString filetypes;
wxArrayString filenamesList; wxArrayString filenamesList;
...@@ -164,9 +164,6 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName ) ...@@ -164,9 +164,6 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
if( !filename.IsAbsolute() ) if( !filename.IsAbsolute() )
filename.SetPath( currentPath ); filename.SetPath( currentPath );
if( !filename.HasExt() )
filename.SetExt( g_PenFilenameExt );
GetScreen()->SetFileName( filename.GetFullPath() ); GetScreen()->SetFileName( filename.GetFullPath() );
setActiveLayer( layer, false ); setActiveLayer( layer, false );
...@@ -208,19 +205,16 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName ) ...@@ -208,19 +205,16 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
* 0 if file not read (cancellation of order ...) * 0 if file not read (cancellation of order ...)
* 1 if OK * 1 if OK
*/ */
static void LoadDCodeFile( WinEDA_GerberFrame* frame, const wxString& FullFileName ) static void LoadDCodeFile( GERBVIEW_FRAME* frame, const wxString& FullFileName )
{ {
wxString wildcard; wxString wildcard;
wxFileName fn = FullFileName; wxFileName fn = FullFileName;
if( !fn.IsOk() ) if( !fn.IsOk() )
{ {
wildcard.Printf( _( "Gerber DCODE files (%s)|*.%s" ), wildcard = _( "Gerber DCODE files" );
GetChars( g_PenFilenameExt ),
GetChars( g_PenFilenameExt ) );
wildcard += AllFilesWildcard; wildcard += AllFilesWildcard;
fn = frame->GetScreen()->GetFileName(); fn = frame->GetScreen()->GetFileName();
fn.SetExt( g_PenFilenameExt );
wxFileDialog dlg( (wxWindow*) frame, _( "Load GERBER DCODE File" ), wxFileDialog dlg( (wxWindow*) frame, _( "Load GERBER DCODE File" ),
fn.GetPath(), fn.GetFullName(), wildcard, fn.GetPath(), fn.GetFullName(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
......
This diff is collapsed.
...@@ -24,26 +24,12 @@ ...@@ -24,26 +24,12 @@
#include <wx/file.h> #include <wx/file.h>
#include <wx/snglinst.h> #include <wx/snglinst.h>
extern bool Read_Config();
wxString g_PhotoFilenameExt;
wxString g_DrillFilenameExt;
wxString g_PenFilenameExt;
// Colors for layers and items // Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings; COLORS_DESIGN_SETTINGS g_ColorsSettings;
int g_Default_GERBER_Format; int g_Default_GERBER_Format;
int g_DisplayPolygonsModeSketch; 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]; GERBER_IMAGE* g_GERBER_List[32];
// List of page sizes // List of page sizes
...@@ -65,7 +51,7 @@ IMPLEMENT_APP( WinEDA_App ) ...@@ -65,7 +51,7 @@ IMPLEMENT_APP( WinEDA_App )
void WinEDA_App::MacOpenFile(const wxString &fileName) void WinEDA_App::MacOpenFile(const wxString &fileName)
{ {
wxFileName filename = fileName; wxFileName filename = fileName;
WinEDA_GerberFrame * frame = ((WinEDA_GerberFrame*)GetTopWindow()); GERBVIEW_FRAME * frame = ((GERBVIEW_FRAME*)GetTopWindow());
if( !filename.FileExists() ) if( !filename.FileExists() )
return; return;
...@@ -77,7 +63,7 @@ void WinEDA_App::MacOpenFile(const wxString &fileName) ...@@ -77,7 +63,7 @@ void WinEDA_App::MacOpenFile(const wxString &fileName)
bool WinEDA_App::OnInit() bool WinEDA_App::OnInit()
{ {
wxFileName fn; wxFileName fn;
WinEDA_GerberFrame* frame = NULL; GERBVIEW_FRAME* frame = NULL;
#ifdef __WXMAC__ #ifdef __WXMAC__
wxApp::s_macAboutMenuItemId = ID_KICAD_ABOUT; wxApp::s_macAboutMenuItemId = ID_KICAD_ABOUT;
...@@ -99,16 +85,13 @@ bool WinEDA_App::OnInit() ...@@ -99,16 +85,13 @@ bool WinEDA_App::OnInit()
bool reopenLastUsedDirectory = argc == 1; bool reopenLastUsedDirectory = argc == 1;
GetSettings( reopenLastUsedDirectory ); GetSettings( reopenLastUsedDirectory );
extern PARAM_CFG_BASE* ParamCfgList[];
wxGetApp().ReadCurrentSetupValues( ParamCfgList );
g_DrawBgColor = BLACK; g_DrawBgColor = BLACK;
/* Must be called before creating the main frame in order to /* Must be called before creating the main frame in order to
* display the real hotkeys in menus or tool tips */ * display the real hotkeys in menus or tool tips */
ReadHotkeyConfig( wxT("GerberFrame"), s_Gerbview_Hokeys_Descr ); ReadHotkeyConfig( wxT("GerberFrame"), s_Gerbview_Hokeys_Descr );
frame = new WinEDA_GerberFrame( NULL, wxT( "GerbView" ), frame = new GERBVIEW_FRAME( NULL, wxT( "GerbView" ),
wxPoint( 0, 0 ), wxPoint( 0, 0 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
...@@ -126,8 +109,6 @@ bool WinEDA_App::OnInit() ...@@ -126,8 +109,6 @@ bool WinEDA_App::OnInit()
frame->Zoom_Automatique( true ); // Zoom fit in frame frame->Zoom_Automatique( true ); // Zoom fit in frame
frame->GetScreen()->m_FirstRedraw = false; frame->GetScreen()->m_FirstRedraw = false;
Read_Config();
if( argc <= 1 ) if( argc <= 1 )
return true; return true;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#define CURSEUR_ON_GRILLE 0 #define CURSEUR_ON_GRILLE 0
#define CURSEUR_OFF_GRILLE 1 #define CURSEUR_OFF_GRILLE 1
class WinEDA_GerberFrame; class GERBVIEW_FRAME;
//class BOARD; //class BOARD;
class GERBER_IMAGE; class GERBER_IMAGE;
...@@ -50,10 +50,6 @@ enum GERBER_VISIBLE ...@@ -50,10 +50,6 @@ enum GERBER_VISIBLE
*/ */
#define GERBER_BUFZ 4000 #define GERBER_BUFZ 4000
extern wxString g_PhotoFilenameExt;
extern wxString g_DrillFilenameExt;
extern wxString g_PenFilenameExt;
extern int g_DisplayPolygonsModeSketch; extern int g_DisplayPolygonsModeSketch;
extern const wxString GerbviewProjectFileExt; extern const wxString GerbviewProjectFileExt;
...@@ -61,11 +57,6 @@ extern const wxString GerbviewProjectFileWildcard; ...@@ -61,11 +57,6 @@ extern const wxString GerbviewProjectFileWildcard;
extern Ki_PageDescr* g_GerberPageSizeList[]; extern Ki_PageDescr* g_GerberPageSizeList[];
// Config keywords
extern const wxString GerbviewDrawModeOption;
extern const wxString GerbviewShowPageSizeOption;
extern const wxString GerbviewShowDCodes;
// Interpolation type // Interpolation type
enum Gerb_Interpolation enum Gerb_Interpolation
{ {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "gerbview_config.h" #include "gerbview_config.h"
#include "dialog_hotkeys_editor.h" #include "dialog_hotkeys_editor.h"
void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event ) void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
...@@ -28,17 +28,7 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event ) ...@@ -28,17 +28,7 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_CONFIG_REQ: /* Hotkey IDs */
{
InstallConfigFrame( pos );
break;
}
case ID_CONFIG_SAVE:
Update_config();
break;
/* Hotkey IDs */
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG: case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_Gerbview_Hokeys_Descr ); ExportHotkeyConfigToFile( s_Gerbview_Hokeys_Descr );
break; break;
...@@ -52,50 +42,88 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event ) ...@@ -52,50 +42,88 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
break; break;
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST: case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
// Display current hotkey list for eeschema. // Display current hotkey list for eeschema.
DisplayHotkeyList( this, s_Gerbview_Hokeys_Descr ); DisplayHotkeyList( this, s_Gerbview_Hokeys_Descr );
break; break;
default: default:
DisplayError( this, 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 * Return the Gerbview applications settings list.
* 2 - if no bed is path> gerbview.exe> / gerbview.cnf * (list of parameters that must be saved in Gerbview parameters)
* 3 - If not found: init variables to default values *
* 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()
{
wxGetApp().ReadProjectConfig( wxT( "gerbview.cnf" ), GROUP, ParamCfgList,
FALSE );
if( g_PhotoFilenameExt.IsEmpty() ) PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
g_PhotoFilenameExt = wxT( "pho" );
if( g_DrillFilenameExt.IsEmpty() )
g_DrillFilenameExt = wxT( "drl" );
if( g_PenFilenameExt.IsEmpty() )
g_PenFilenameExt = wxT( "pen" );
return TRUE;
}
void WinEDA_GerberFrame::Update_config()
{ {
wxFileName fn = wxFileName( wxEmptyString, wxT( "gerbview" ), if( !m_configSettings.empty() )
GerbviewProjectFileExt ); return m_configSettings;
wxFileDialog dlg( this, _( "Save GerbView Project File" ), wxEmptyString, m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
fn.GetFullName(), GerbviewProjectFileWildcard, (int*) &g_UserUnit, 0, 0, 1 ) );
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
if( dlg.ShowModal() == wxID_CANCEL ) &m_displayMode, 2, 0, 2 ) );
return; 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 );
}
wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP, ParamCfgList ); return m_configSettings;
} }
...@@ -8,352 +8,3 @@ ...@@ -8,352 +8,3 @@
#define GROUP wxT("/gerbview") #define GROUP wxT("/gerbview")
#define INSETUP TRUE #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
};
...@@ -18,7 +18,6 @@ enum gerbview_ids ...@@ -18,7 +18,6 @@ enum gerbview_ids
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER, ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
ID_GERBVIEW_DELETE_ITEM_BUTT,
ID_GERBVIEW_GLOBAL_DELETE, ID_GERBVIEW_GLOBAL_DELETE,
ID_GERBVIEW_OPTIONS_SETUP, ID_GERBVIEW_OPTIONS_SETUP,
ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
......
...@@ -69,7 +69,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Gerbview_Hokeys_Descr[] = ...@@ -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 /* Hot keys. Some commands are relatives to the item under the mouse cursor
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
/******* initpcb.cpp ********************/ /******* initpcb.cpp ********************/
/****************************************/ /****************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
...@@ -13,7 +12,7 @@ ...@@ -13,7 +12,7 @@
#include "class_GERBER.h" #include "class_GERBER.h"
bool WinEDA_GerberFrame::Clear_Pcb( bool query ) bool GERBVIEW_FRAME::Clear_Pcb( bool query )
{ {
int layer; int layer;
...@@ -52,7 +51,7 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query ) ...@@ -52,7 +51,7 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
} }
void WinEDA_GerberFrame::Erase_Current_Layer( bool query ) void GERBVIEW_FRAME::Erase_Current_Layer( bool query )
{ {
int layer = getActiveLayer(); int layer = getActiveLayer();
wxString msg; wxString msg;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
/* localize a gerber item and return a pointer to it. /* localize a gerber item and return a pointer to it.
* Display info about this item * Display info about this item
*/ */
GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( const wxPoint& aPosition, int aTypeloc ) GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc )
{ {
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
wxPoint ref = aPosition; wxPoint ref = aPosition;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "hotkeys.h" #include "hotkeys.h"
void WinEDA_GerberFrame::ReCreateMenuBar( void ) void GERBVIEW_FRAME::ReCreateMenuBar( void )
{ {
wxMenuBar *menuBar = GetMenuBar(); wxMenuBar *menuBar = GetMenuBar();
...@@ -63,8 +63,6 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -63,8 +63,6 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
// Configuration and preferences: // Configuration and preferences:
wxMenu* configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&File Ext" ),
_( "Set files extensions" ), config_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, ADD_MENUITEM_WITH_HELP( configmenu, ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_( "Hide &Layers Manager" ), _( "Hide &Layers Manager" ),
_( "Show/hide the layers manager toolbar" ), _( "Show/hide the layers manager toolbar" ),
...@@ -80,11 +78,6 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -80,11 +78,6 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
AddHotkeyConfigMenu( configmenu ); AddHotkeyConfigMenu( configmenu );
configmenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, _( "&Save Setup" ),
_( "Save application preferences" ),
save_setup_xpm );
wxMenu* miscellaneous_menu = new wxMenu; wxMenu* miscellaneous_menu = new wxMenu;
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_LIST_DCODES, ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_LIST_DCODES,
_( "&List DCodes" ), _( "&List DCodes" ),
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
/* Prepare the right-click pullup menu. /* Prepare the right-click pullup menu.
* The menu already has a list of zoom commands. * The menu already has a list of zoom commands.
*/ */
bool WinEDA_GerberFrame::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg; wxString msg;
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h"
#include "gerbview.h" #include "gerbview.h"
#include "gerbview_id.h" #include "gerbview_id.h"
...@@ -20,7 +19,7 @@ ...@@ -20,7 +19,7 @@
* Function OnSelectOptionToolbar * Function OnSelectOptionToolbar
* called to validate current choices * called to validate current choices
*/ */
void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event ) void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
bool state; bool state;
...@@ -85,7 +84,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -85,7 +84,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) ); wxMessageBox( wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error" ) );
break; break;
} }
} }
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "pcbplot.h" #include "pcbplot.h"
/* The group of plot options - sadly global XXX */ /* The group of plot options - sadly global XXX */
PCB_Plot_Options g_pcb_plot_options; PCB_Plot_Options g_pcb_plot_options;
...@@ -19,7 +18,7 @@ PCB_Plot_Options g_pcb_plot_options; ...@@ -19,7 +18,7 @@ PCB_Plot_Options g_pcb_plot_options;
/***************************************************************/ /***************************************************************/
/** TODO */ /** TODO */
void WinEDA_GerberFrame::ToPlotter(wxCommandEvent& event) void GERBVIEW_FRAME::ToPlotter(wxCommandEvent& event)
{ {
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
/* Read a gerber file, RS274D or RS274X format. /* Read a gerber file, RS274D or RS274X format.
*/ */
bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName, bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
const wxString& D_Code_FullFileName ) const wxString& D_Code_FullFileName )
{ {
int G_commande = 0; // command number for G commands like G04 int G_commande = 0; // command number for G commands like G04
...@@ -149,6 +149,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName, ...@@ -149,6 +149,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName,
} }
} }
fclose( gerber->m_Current_File ); fclose( gerber->m_Current_File );
SetLocaleTo_Default();
// Display errors list // Display errors list
if( m_Messages.size() > 0 ) if( m_Messages.size() > 0 )
...@@ -158,8 +159,6 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName, ...@@ -158,8 +159,6 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName,
dlg.ShowModal(); dlg.ShowModal();
} }
SetLocaleTo_Default();
/* Init DCodes list and perhaps read a DCODES file, /* Init DCodes list and perhaps read a DCODES file,
* if the gerber file is only a RS274D file * if the gerber file is only a RS274D file
* (i.e. without any aperture information) * (i.e. without any aperture information)
...@@ -173,10 +172,8 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName, ...@@ -173,10 +172,8 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName,
wxString wildcard; wxString wildcard;
fn = GERBER_FullFileName; fn = GERBER_FullFileName;
fn.SetExt( g_PenFilenameExt ); fn.SetExt( wxEmptyString );
wildcard.Printf( _( "Gerber DCODE files (%s)|*.%s" ), wildcard = _( "Gerber DCODE files" );
GetChars( g_PenFilenameExt ),
GetChars( g_PenFilenameExt ) );
wildcard += AllFilesWildcard; wildcard += AllFilesWildcard;
wxFileDialog dlg( this, _( "Load GERBER DCODE File" ), wxFileDialog dlg( this, _( "Load GERBER DCODE File" ),
......
...@@ -25,10 +25,10 @@ enum swap_layer_id { ...@@ -25,10 +25,10 @@ enum swap_layer_id {
}; };
class WinEDA_SwapLayerFrame : public wxDialog class SWAP_LAYERS_DIALOG : public wxDialog
{ {
private: private:
WinEDA_GerberFrame* m_Parent; GERBVIEW_FRAME* m_Parent;
wxBoxSizer* OuterBoxSizer; wxBoxSizer* OuterBoxSizer;
wxBoxSizer* MainBoxSizer; wxBoxSizer* MainBoxSizer;
wxFlexGridSizer* FlexColumnBoxSizer; wxFlexGridSizer* FlexColumnBoxSizer;
...@@ -40,8 +40,8 @@ private: ...@@ -40,8 +40,8 @@ private:
public: public:
WinEDA_SwapLayerFrame( WinEDA_GerberFrame* parent ); SWAP_LAYERS_DIALOG( GERBVIEW_FRAME* parent );
~WinEDA_SwapLayerFrame() {}; ~SWAP_LAYERS_DIALOG() {};
private: private:
void OnSelectLayer( wxCommandEvent& event ); void OnSelectLayer( wxCommandEvent& event );
...@@ -52,12 +52,12 @@ private: ...@@ -52,12 +52,12 @@ private:
}; };
BEGIN_EVENT_TABLE( WinEDA_SwapLayerFrame, wxDialog ) BEGIN_EVENT_TABLE( SWAP_LAYERS_DIALOG, wxDialog )
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + 31, EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + 31,
wxEVT_COMMAND_BUTTON_CLICKED, wxEVT_COMMAND_BUTTON_CLICKED,
WinEDA_SwapLayerFrame::OnSelectLayer ) SWAP_LAYERS_DIALOG::OnSelectLayer )
EVT_BUTTON( wxID_OK, WinEDA_SwapLayerFrame::OnOkClick ) EVT_BUTTON( wxID_OK, SWAP_LAYERS_DIALOG::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SwapLayerFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, SWAP_LAYERS_DIALOG::OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -65,9 +65,9 @@ END_EVENT_TABLE() ...@@ -65,9 +65,9 @@ END_EVENT_TABLE()
* between gerber layers and pcbnew layers * between gerber layers and pcbnew layers
* return the "lookup table" if ok, or NULL * return the "lookup table" if ok, or NULL
*/ */
int* WinEDA_GerberFrame::InstallDialogLayerPairChoice( ) int* GERBVIEW_FRAME::InstallDialogLayerPairChoice( )
{ {
WinEDA_SwapLayerFrame* frame = new WinEDA_SwapLayerFrame( this ); SWAP_LAYERS_DIALOG* frame = new SWAP_LAYERS_DIALOG( this );
int ii = frame->ShowModal(); int ii = frame->ShowModal();
...@@ -79,7 +79,7 @@ int* WinEDA_GerberFrame::InstallDialogLayerPairChoice( ) ...@@ -79,7 +79,7 @@ int* WinEDA_GerberFrame::InstallDialogLayerPairChoice( )
} }
WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_GerberFrame* parent ) : SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( GERBVIEW_FRAME* parent ) :
wxDialog( parent, -1, _( "Layer selection:" ), wxPoint( -1, -1 ), wxDialog( parent, -1, _( "Layer selection:" ), wxPoint( -1, -1 ),
wxDefaultSize, wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER ) wxDefaultSize, wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER )
{ {
...@@ -323,7 +323,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_GerberFrame* parent ) : ...@@ -323,7 +323,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_GerberFrame* parent ) :
} }
void WinEDA_SwapLayerFrame::OnSelectLayer( wxCommandEvent& event ) void SWAP_LAYERS_DIALOG::OnSelectLayer( wxCommandEvent& event )
{ {
int ii, jj; int ii, jj;
...@@ -365,13 +365,13 @@ void WinEDA_SwapLayerFrame::OnSelectLayer( wxCommandEvent& event ) ...@@ -365,13 +365,13 @@ void WinEDA_SwapLayerFrame::OnSelectLayer( wxCommandEvent& event )
} }
void WinEDA_SwapLayerFrame::OnCancelClick( wxCommandEvent& event ) void SWAP_LAYERS_DIALOG::OnCancelClick( wxCommandEvent& event )
{ {
EndModal( -1 ); EndModal( -1 );
} }
void WinEDA_SwapLayerFrame::OnOkClick( wxCommandEvent& event ) void SWAP_LAYERS_DIALOG::OnOkClick( wxCommandEvent& event )
{ {
int ii; int ii;
bool AsCmpLayer = false; bool AsCmpLayer = false;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "class_DCodeSelectionbox.h" #include "class_DCodeSelectionbox.h"
#include "dialog_helpers.h" #include "dialog_helpers.h"
void WinEDA_GerberFrame::ReCreateHToolbar( void ) void GERBVIEW_FRAME::ReCreateHToolbar( void )
{ {
int layer = 0; int layer = 0;
GERBER_IMAGE* gerber = NULL; GERBER_IMAGE* gerber = NULL;
...@@ -106,8 +106,9 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) ...@@ -106,8 +106,9 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
/** /**
* Create or update the right vertical toolbar * Create or update the right vertical toolbar
* Current no used
*/ */
void WinEDA_GerberFrame::ReCreateVToolbar( void ) void GERBVIEW_FRAME::ReCreateVToolbar( void )
{ {
if( m_VToolBar ) if( m_VToolBar )
return; return;
...@@ -117,8 +118,6 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void ) ...@@ -117,8 +118,6 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void )
// Set up toolbar // Set up toolbar
m_VToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, wxBitmap( cursor_xpm ) ); m_VToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, wxBitmap( cursor_xpm ) );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_GERBVIEW_DELETE_ITEM_BUTT, wxEmptyString, wxBitmap( delete_body_xpm ),
_( "Delete items" ) );
m_VToolBar->Realize(); m_VToolBar->Realize();
} }
...@@ -127,7 +126,7 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void ) ...@@ -127,7 +126,7 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void )
/** /**
* Create or update the left vertical toolbar (option toolbar * Create or update the left vertical toolbar (option toolbar
*/ */
void WinEDA_GerberFrame::ReCreateOptToolbar( void ) void GERBVIEW_FRAME::ReCreateOptToolbar( void )
{ {
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
...@@ -203,7 +202,7 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void ) ...@@ -203,7 +202,7 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void )
} }
void WinEDA_GerberFrame::OnUpdateDrawMode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
{ {
switch( aEvent.GetId() ) switch( aEvent.GetId() )
{ {
...@@ -225,31 +224,31 @@ void WinEDA_GerberFrame::OnUpdateDrawMode( wxUpdateUIEvent& aEvent ) ...@@ -225,31 +224,31 @@ void WinEDA_GerberFrame::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
} }
void WinEDA_GerberFrame::OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( !m_DisplayPadFill ); aEvent.Check( !m_DisplayPadFill );
} }
void WinEDA_GerberFrame::OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( !m_DisplayPcbTrackFill ); aEvent.Check( !m_DisplayPcbTrackFill );
} }
void WinEDA_GerberFrame::OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( g_DisplayPolygonsModeSketch != 0 ); aEvent.Check( g_DisplayPolygonsModeSketch != 0 );
} }
void WinEDA_GerberFrame::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( IsElementVisible( DCODES_VISIBLE ) ); aEvent.Check( IsElementVisible( DCODES_VISIBLE ) );
} }
void WinEDA_GerberFrame::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( m_show_layer_manager_tools ); aEvent.Check( m_show_layer_manager_tools );
...@@ -263,7 +262,7 @@ void WinEDA_GerberFrame::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent ) ...@@ -263,7 +262,7 @@ void WinEDA_GerberFrame::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
} }
void WinEDA_GerberFrame::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
{ {
int layer = GetScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
GERBER_IMAGE* gerber = g_GERBER_List[layer]; GERBER_IMAGE* gerber = g_GERBER_List[layer];
...@@ -276,7 +275,7 @@ void WinEDA_GerberFrame::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent ) ...@@ -276,7 +275,7 @@ void WinEDA_GerberFrame::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
} }
void WinEDA_GerberFrame::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
{ {
if( m_SelLayerBox && (m_SelLayerBox->GetSelection() != GetScreen()->m_Active_Layer) ) if( m_SelLayerBox && (m_SelLayerBox->GetSelection() != GetScreen()->m_Active_Layer) )
{ {
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include "id.h" #include "id.h"
#include "param_config.h"
#include "class_gerbview_layer_widget.h" #include "class_gerbview_layer_widget.h"
#include "class_layerchoicebox.h" #include "class_layerchoicebox.h"
...@@ -39,10 +41,10 @@ class DCODE_SELECTION_BOX; ...@@ -39,10 +41,10 @@ class DCODE_SELECTION_BOX;
/****************************************************************** /******************************************************************
* class WinEDA_GerberFrame: this is the main window used in gerbview * class GERBVIEW_FRAME: this is the main window used in gerbview
******************************************************************/ ******************************************************************/
class WinEDA_GerberFrame : public PCB_BASE_FRAME class GERBVIEW_FRAME : public PCB_BASE_FRAME
{ {
friend class PCB_LAYER_WIDGET; friend class PCB_LAYER_WIDGET;
...@@ -57,6 +59,7 @@ public: ...@@ -57,6 +59,7 @@ public:
wxArrayString m_DCodesList; // an array string containing all decodes Id (10 to 999) wxArrayString m_DCodesList; // an array string containing all decodes Id (10 to 999)
private: private:
PARAM_CFG_ARRAY m_configSettings; // list of PARAM_CFG_xxx to read/write parameters saved in config
int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn: 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 // items only the last image is correctly drawn (no
...@@ -70,13 +73,12 @@ private: ...@@ -70,13 +73,12 @@ private:
wxArrayString m_Messages; // An array sting to store warning messages when reaging wxArrayString m_Messages; // An array sting to store warning messages when reaging
// a gerber file // a gerber file
public: WinEDA_GerberFrame( wxWindow* father, const wxString& title, public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_GerberFrame(); ~GERBVIEW_FRAME();
void Update_config();
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
/** /**
...@@ -244,6 +246,18 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title, ...@@ -244,6 +246,18 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
*/ */
void UpdateTitleAndInfo(); void UpdateTitleAndInfo();
/**
* Function GetConfigurationSettings
* Populates the Gerbview applications settings list.
* (list of parameters that must be saved in Gerbview parameters)
* 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 Gerbview source code (mainle 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 );
/** /**
* Load applications settings specific to the PCBNew. * Load applications settings specific to the PCBNew.
* *
...@@ -298,9 +312,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title, ...@@ -298,9 +312,7 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
void Process_Settings( wxCommandEvent& event ); void Process_Settings( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void InstallConfigFrame( const wxPoint& pos );
void InstallGerberOptionsDialog( wxCommandEvent& event ); void InstallGerberOptionsDialog( wxCommandEvent& event );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent );
...@@ -423,7 +435,6 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title, ...@@ -423,7 +435,6 @@ public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
// PCB handling // PCB handling
bool Clear_Pcb( bool query ); bool Clear_Pcb( bool query );
void Erase_Current_Layer( bool query ); void Erase_Current_Layer( bool query );
void Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number );
// Conversion function // Conversion function
void ExportDataInPcbnewFormat( wxCommandEvent& event ); void ExportDataInPcbnewFormat( wxCommandEvent& event );
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
/** Type of parameter in the configuration file */ /** Type of parameter in the configuration file */
enum paramcfg_id enum paramcfg_id {
{
PARAM_INT, PARAM_INT,
PARAM_SETCOLOR, PARAM_SETCOLOR,
PARAM_DOUBLE, PARAM_DOUBLE,
...@@ -25,8 +24,8 @@ enum paramcfg_id ...@@ -25,8 +24,8 @@ enum paramcfg_id
PARAM_FIELDNAME_LIST PARAM_FIELDNAME_LIST
}; };
#define MAX_COLOR 0x8001F #define MAX_COLOR 0x8001F
#define IS_VALID_COLOR( c ) ( ( c >= 0 ) && ( c <= 0x8001F ) ) #define IS_VALID_COLOR( c ) ( ( c >= 0 ) && ( c <= 0x8001F ) )
#define INT_MINVAL 0x80000000 #define INT_MINVAL 0x80000000
#define INT_MAXVAL 0x7FFFFFFF #define INT_MAXVAL 0x7FFFFFFF
...@@ -46,8 +45,7 @@ public: ...@@ -46,8 +45,7 @@ public:
const wxChar* m_Group; ///< Group name (this is like a path in the config data) const wxChar* m_Group; ///< Group name (this is like a path in the config data)
bool m_Setup; ///< Install or Project based parameter, true == install bool m_Setup; ///< Install or Project based parameter, true == install
public: public: PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, const wxChar* group = NULL );
PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, const wxChar* group = NULL );
/** /**
* Function ReadParam * Function ReadParam
...@@ -76,10 +74,9 @@ public: ...@@ -76,10 +74,9 @@ public:
int m_Min, m_Max; ///< Minimum and maximum values of the param type int m_Min, m_Max; ///< Minimum and maximum values of the param type
int m_Default; ///< The default value of the parameter int m_Default; ///< The default value of the parameter
public: public: PARAM_CFG_INT( const wxChar* ident, int* ptparam,
PARAM_CFG_INT( const wxChar* ident, int* ptparam, int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL, const wxChar* group = NULL );
const wxChar* group = NULL );
PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam, PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL, int default_val = 0, int min = INT_MINVAL, int max = INT_MAXVAL,
const wxChar* group = NULL ); const wxChar* group = NULL );
...@@ -99,9 +96,8 @@ public: ...@@ -99,9 +96,8 @@ public:
int* m_Pt_param; ///< Pointer to the parameter value int* m_Pt_param; ///< Pointer to the parameter value
int m_Default; ///< The default value of the parameter int m_Default; ///< The default value of the parameter
public: public: PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam,
PARAM_CFG_SETCOLOR( const wxChar* ident, int* ptparam, int default_val, const wxChar* group = NULL );
int default_val, const wxChar* group = NULL );
PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, int* ptparam, PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, int* ptparam,
int default_val, const wxChar* group = NULL ); int default_val, const wxChar* group = NULL );
...@@ -117,14 +113,13 @@ public: ...@@ -117,14 +113,13 @@ public:
class PARAM_CFG_DOUBLE : public PARAM_CFG_BASE class PARAM_CFG_DOUBLE : public PARAM_CFG_BASE
{ {
public: public:
double* m_Pt_param; ///< Pointer to the parameter value double* m_Pt_param; ///< Pointer to the parameter value
double m_Default; ///< The default value of the parameter double m_Default; ///< The default value of the parameter
double m_Min, m_Max; ///< Minimum and maximum values of the param type double m_Min, m_Max; ///< Minimum and maximum values of the param type
public: public: PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam,
PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam, double default_val = 0.0, double min = 0.0, double max = 10000.0,
double default_val = 0.0, double min = 0.0, double max = 10000.0, const wxChar* group = NULL );
const wxChar* group = NULL );
PARAM_CFG_DOUBLE( bool Insetup, const wxChar* ident, double* ptparam, PARAM_CFG_DOUBLE( bool Insetup, const wxChar* ident, double* ptparam,
double default_val = 0.0, double min = 0.0, double max = 10000.0, double default_val = 0.0, double min = 0.0, double max = 10000.0,
const wxChar* group = NULL ); const wxChar* group = NULL );
...@@ -141,12 +136,11 @@ public: ...@@ -141,12 +136,11 @@ public:
class PARAM_CFG_BOOL : public PARAM_CFG_BASE class PARAM_CFG_BOOL : public PARAM_CFG_BASE
{ {
public: public:
bool* m_Pt_param; ///< Pointer to the parameter value bool* m_Pt_param; ///< Pointer to the parameter value
int m_Default; ///< The default value of the parameter int m_Default; ///< The default value of the parameter
public: public: PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam, int default_val = FALSE, const wxChar* group = NULL );
int default_val = FALSE, const wxChar* group = NULL );
PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam, PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam,
int default_val = FALSE, const wxChar* group = NULL ); int default_val = FALSE, const wxChar* group = NULL );
...@@ -162,14 +156,15 @@ public: ...@@ -162,14 +156,15 @@ public:
class PARAM_CFG_WXSTRING : public PARAM_CFG_BASE class PARAM_CFG_WXSTRING : public PARAM_CFG_BASE
{ {
public: public:
wxString* m_Pt_param; ///< Pointer to the parameter value wxString* m_Pt_param; ///< Pointer to the parameter value
wxString m_default; ///< The default value of the parameter
public: public: PARAM_CFG_WXSTRING( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
PARAM_CFG_WXSTRING( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL ); PARAM_CFG_WXSTRING( bool Insetup,
PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
const wxChar* ident, wxString* ptparam,
wxString* ptparam, const wxString& default_val = wxEmptyString,
const wxChar* group = NULL ); const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ); virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig ); virtual void SaveParam( wxConfigBase* aConfig );
...@@ -186,23 +181,20 @@ class PARAM_CFG_FILENAME : public PARAM_CFG_BASE ...@@ -186,23 +181,20 @@ class PARAM_CFG_FILENAME : public PARAM_CFG_BASE
public: public:
wxString* m_Pt_param; ///< Pointer to the parameter value wxString* m_Pt_param; ///< Pointer to the parameter value
public: public: PARAM_CFG_FILENAME( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
PARAM_CFG_FILENAME( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ); virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig ); virtual void SaveParam( wxConfigBase* aConfig );
}; };
class PARAM_CFG_LIBNAME_LIST : public PARAM_CFG_BASE class PARAM_CFG_LIBNAME_LIST : public PARAM_CFG_BASE
{ {
public: public:
wxArrayString* m_Pt_param; ///< Pointer to the parameter value wxArrayString* m_Pt_param; ///< Pointer to the parameter value
public: public: PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
PARAM_CFG_LIBNAME_LIST( const wxChar* ident, wxArrayString* ptparam,
wxArrayString* ptparam, const wxChar* group = NULL );
const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ); virtual void ReadParam( wxConfigBase* aConfig );
virtual void SaveParam( wxConfigBase* aConfig ); virtual void SaveParam( wxConfigBase* aConfig );
...@@ -210,6 +202,6 @@ public: ...@@ -210,6 +202,6 @@ public:
/** A list of parameters type */ /** A list of parameters type */
typedef boost::ptr_vector< PARAM_CFG_BASE > PARAM_CFG_ARRAY; typedef boost::ptr_vector<PARAM_CFG_BASE> PARAM_CFG_ARRAY;
#endif /* __PARAM_CONFIG_H__ */ #endif /* __PARAM_CONFIG_H__ */
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
#include <vector> #include <vector>
#include <cmath> #include <cmath>
/* helper function:
* some characters cannot be used in names,
* this function change them to "_"
*/
static void ChangeIllegalCharacters( wxString & aFileName, bool aDirSepIsIllegal );
/* the dialog to create VRML files, derived from DIALOG_EXPORT_3DFILE_BASE, /* the dialog to create VRML files, derived from DIALOG_EXPORT_3DFILE_BASE,
...@@ -641,8 +646,7 @@ static void vrml_text_callback( int x0, int y0, int xf, int yf ) ...@@ -641,8 +646,7 @@ static void vrml_text_callback( int x0, int y0, int xf, int yf )
} }
static void export_vrml_pcbtext( TEXTE_PCB* text ) /*{{{*/ static void export_vrml_pcbtext( TEXTE_PCB* text )
/*************************************************************/
{ {
/* Coupling by globals! Ewwww... */ /* Coupling by globals! Ewwww... */
s_text_layer = text->GetLayer(); s_text_layer = text->GetLayer();
...@@ -1037,11 +1041,9 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule, ...@@ -1037,11 +1041,9 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
fname.Replace(wxT("\\"), wxT("/" ) ); fname.Replace(wxT("\\"), wxT("/" ) );
wxString source_fname = fname; wxString source_fname = fname;
if( aExport3DFiles ) // Change dangerous characters in filenames if( aExport3DFiles ) // Change illegal characters in short filename
{ {
fname.Replace(wxT("/"), wxT("_" ) ); ChangeIllegalCharacters( fname, true );
fname.Replace(wxT(":_"), wxT("_" ) );
fname.Replace(wxT(" "), wxT("_" ) );
fname = a3D_Subdir + wxT("/") + fname; fname = a3D_Subdir + wxT("/") + fname;
if( !wxFileExists( fname ) ) if( !wxFileExists( fname ) )
wxCopyFile( source_fname, fname ); wxCopyFile( source_fname, fname );
...@@ -1192,10 +1194,14 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName, ...@@ -1192,10 +1194,14 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName,
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
/* Begin with the usual VRML boilerplate */ /* Begin with the usual VRML boilerplate */
wxString name = aFullFileName;
name.Replace(wxT("\\"), wxT("/" ) );
ChangeIllegalCharacters( name, false );
fprintf( output_file, "#VRML V2.0 utf8\n" fprintf( output_file, "#VRML V2.0 utf8\n"
"WorldInfo {\n" "WorldInfo {\n"
" title \"%s - Generated by PCBNEW\"\n" " title \"%s - Generated by PCBNEW\"\n"
"}\n", TO_UTF8( aFullFileName ) ); "}\n", TO_UTF8( name ) );
/* The would be in decimils and not in meters, as the standard wants. /* The would be in decimils and not in meters, as the standard wants.
* It is trivial to embed everything in a transform node to * It is trivial to embed everything in a transform node to
...@@ -1272,3 +1278,15 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName, ...@@ -1272,3 +1278,15 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName,
return true; return true;
} }
/*
* some characters cannot be used in filenames,
* this function change them to "_"
*/
static void ChangeIllegalCharacters( wxString & aFileName, bool aDirSepIsIllegal )
{
if( aDirSepIsIllegal )
aFileName.Replace(wxT("/"), wxT("_" ) );
aFileName.Replace(wxT(" "), wxT("_" ) );
aFileName.Replace(wxT(":"), wxT("_" ) );
}
...@@ -124,6 +124,8 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -124,6 +124,8 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case TYPE_PAD: case TYPE_PAD:
GetBoard()->SetCurrentNetClass( GetBoard()->SetCurrentNetClass(
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() ); ((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
break; break;
default: default:
......
...@@ -393,6 +393,8 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) ...@@ -393,6 +393,8 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
wxString msg; wxString msg;
GetBoard()->SetCurrentNetClass( Track->GetNetClassName() ); GetBoard()->SetCurrentNetClass( Track->GetNetClassName() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
int flags = Track->m_Flags; int flags = Track->m_Flags;
...@@ -712,6 +714,8 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) ...@@ -712,6 +714,8 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
return; return;
GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() ); GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() );
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
wxString msg = Pad->MenuText( GetBoard() ); wxString msg = Pad->MenuText( GetBoard() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment