Commit c09bc26d authored by Wayne Stambaugh's avatar Wayne Stambaugh

Minor PCBNew code fixes.

* Translate French code names and comments.
* Dead code removal.
* Hot key object and structure coding style policy fixes.
* Doxygen comment warning fixes.
parent eaf17c59
/* /**
dialog_hotkeys_editor.cpp * @file dialog_hotkeys_editor.cpp
*/ */
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
...@@ -32,8 +33,7 @@ dialog_hotkeys_editor.cpp ...@@ -32,8 +33,7 @@ dialog_hotkeys_editor.cpp
#include "dialog_hotkeys_editor.h" #include "dialog_hotkeys_editor.h"
void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys )
Ki_HotkeyInfoSectionDescriptor* hotkeys )
{ {
HOTKEYS_EDITOR_DIALOG dialog( parent, hotkeys ); HOTKEYS_EDITOR_DIALOG dialog( parent, hotkeys );
...@@ -46,8 +46,8 @@ void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, ...@@ -46,8 +46,8 @@ void InstallHotkeyFrame( EDA_DRAW_FRAME* parent,
} }
HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent,
Ki_HotkeyInfoSectionDescriptor* hotkeys ) : EDA_HOTKEY_CONFIG* hotkeys ) :
HOTKEYS_EDITOR_DIALOG_BASE( parent ) HOTKEYS_EDITOR_DIALOG_BASE( parent )
{ {
m_parent = parent; m_parent = parent;
...@@ -78,18 +78,21 @@ void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event ) ...@@ -78,18 +78,21 @@ void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event )
/* edit the live hotkey table */ /* edit the live hotkey table */
HotkeyGridTable::hotkey_spec_vector& hotkey_vec = m_table->getHotkeys(); HotkeyGridTable::hotkey_spec_vector& hotkey_vec = m_table->getHotkeys();
Ki_HotkeyInfoSectionDescriptor* section; EDA_HOTKEY_CONFIG* section;
for( section = m_hotkeys; section->m_HK_InfoList; section++ ) for( section = m_hotkeys; section->m_HK_InfoList; section++ )
{ {
wxString sectionTag = *section->m_SectionTag; wxString sectionTag = *section->m_SectionTag;
EDA_HOTKEY** info_ptr;
Ki_HotkeyInfo** info_ptr;
for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ )
{ {
Ki_HotkeyInfo* info = *info_ptr; EDA_HOTKEY* info = *info_ptr;
/* find the corresponding hotkey */ /* find the corresponding hotkey */
HotkeyGridTable::hotkey_spec_vector::iterator i; HotkeyGridTable::hotkey_spec_vector::iterator i;
for( i = hotkey_vec.begin(); i != hotkey_vec.end(); ++i ) for( i = hotkey_vec.begin(); i != hotkey_vec.end(); ++i )
{ {
if( i->first == sectionTag if( i->first == sectionTag
...@@ -122,6 +125,7 @@ void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& event ) ...@@ -122,6 +125,7 @@ void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& event )
{ {
m_table->RestoreFrom( m_hotkeys ); m_table->RestoreFrom( m_hotkeys );
m_curEditingRow = -1; m_curEditingRow = -1;
for( int i = 0; i < m_hotkeyGrid->GetNumberRows(); ++i ) for( int i = 0; i < m_hotkeyGrid->GetNumberRows(); ++i )
SetHotkeyCellState( i, false ); SetHotkeyCellState( i, false );
...@@ -153,6 +157,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event ) ...@@ -153,6 +157,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event )
SetHotkeyCellState( m_curEditingRow, false ); SetHotkeyCellState( m_curEditingRow, false );
int newRow = event.GetRow(); int newRow = event.GetRow();
if( ( event.GetCol() != 1 ) || ( m_table->isHeader( newRow ) ) ) if( ( event.GetCol() != 1 ) || ( m_table->isHeader( newRow ) ) )
{ {
m_curEditingRow = -1; m_curEditingRow = -1;
...@@ -166,6 +171,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event ) ...@@ -166,6 +171,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event )
Update(); Update();
} }
/** OnRightClickOnCell /** OnRightClickOnCell
* If a cell is selected, display a list of keys for selection * If a cell is selected, display a list of keys for selection
* The list is restricted to keys that cannot be entered: * The list is restricted to keys that cannot be entered:
...@@ -194,18 +200,19 @@ void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event ) ...@@ -194,18 +200,19 @@ void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event )
wxT("Alt+Space"), wxT("Alt+Space"),
}; };
wxString keyname = wxGetSingleChoice( wxString keyname = wxGetSingleChoice( _( "Special keys only. For others keys, use keyboard" ),
_("Special keys only. For others keys, use keyboard"), _( "Select a key" ), C_COUNT, choices, this );
_("Select a key"), C_COUNT, choices, this);
int key = ReturnKeyCodeFromKeyName( keyname ); int key = ReturnKeyCodeFromKeyName( keyname );
if( key == 0 ) if( key == 0 )
return; return;
m_table->SetKeyCode( m_curEditingRow, key ); m_table->SetKeyCode( m_curEditingRow, key );
m_hotkeyGrid->Refresh(); m_hotkeyGrid->Refresh();
Update(); Update();
} }
void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event ) void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event )
{ {
if( m_curEditingRow != -1 ) if( m_curEditingRow != -1 )
...@@ -222,8 +229,10 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event ) ...@@ -222,8 +229,10 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event )
default: default:
if( event.ControlDown() ) if( event.ControlDown() )
key |= GR_KB_CTRL; key |= GR_KB_CTRL;
if( event.AltDown() ) if( event.AltDown() )
key |= GR_KB_ALT; key |= GR_KB_ALT;
if( event.ShiftDown() && (key > 256) ) if( event.ShiftDown() && (key > 256) )
key |= GR_KB_SHIFT; key |= GR_KB_SHIFT;
...@@ -243,12 +252,16 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event ) ...@@ -243,12 +252,16 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event )
// See if this key code is handled in hotkeys names list // See if this key code is handled in hotkeys names list
bool exists; bool exists;
ReturnKeyNameFromKeyCode( key, &exists ); ReturnKeyNameFromKeyCode( key, &exists );
if( !exists ) // not handled, see hotkeys_basic.cpp if( !exists ) // not handled, see hotkeys_basic.cpp
wxMessageBox( _("Hotkey code not handled" ) ); {
wxMessageBox( _( "Hotkey code not handled" ) );
}
else else
{ {
m_table->SetKeyCode( m_curEditingRow, key ); m_table->SetKeyCode( m_curEditingRow, key );
} }
break; break;
} }
} }
......
...@@ -4,24 +4,23 @@ ...@@ -4,24 +4,23 @@
* Reads the hotkey table from its stored format into a format suitable * Reads the hotkey table from its stored format into a format suitable
* for a wxGrid. * for a wxGrid.
*/ */
HotkeyGridTable::HotkeyGridTable( struct HotkeyGridTable::HotkeyGridTable( struct EDA_HOTKEY_CONFIG* origin ) :
Ki_HotkeyInfoSectionDescriptor* origin ) :
wxGridTableBase(), wxGridTableBase(),
m_hotkeys() m_hotkeys()
{ {
Ki_HotkeyInfoSectionDescriptor* section; EDA_HOTKEY_CONFIG* section;
for( section = origin; section->m_HK_InfoList; section++ ) for( section = origin; section->m_HK_InfoList; section++ )
{ {
hotkey_spec spec( *section->m_SectionTag, new Ki_HotkeyInfo( NULL, 0, 0 ) ); hotkey_spec spec( *section->m_SectionTag, new EDA_HOTKEY( NULL, 0, 0 ) );
m_hotkeys.push_back( spec ); m_hotkeys.push_back( spec );
Ki_HotkeyInfo** info_ptr; EDA_HOTKEY** info_ptr;
for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ )
{ {
Ki_HotkeyInfo* info = *info_ptr; EDA_HOTKEY* info = *info_ptr;
hotkey_spec spec( *section->m_SectionTag, hotkey_spec spec( *section->m_SectionTag, new EDA_HOTKEY( info ) );
new Ki_HotkeyInfo( info ) );
m_hotkeys.push_back( spec ); m_hotkeys.push_back( spec );
} }
} }
...@@ -165,19 +164,19 @@ void HotkeyGridTable::SetKeyCode( int row, long key ) ...@@ -165,19 +164,19 @@ void HotkeyGridTable::SetKeyCode( int row, long key )
} }
void HotkeyGridTable::RestoreFrom( struct void HotkeyGridTable::RestoreFrom( struct EDA_HOTKEY_CONFIG* origin )
Ki_HotkeyInfoSectionDescriptor* origin )
{ {
int row = 0; int row = 0;
Ki_HotkeyInfoSectionDescriptor* section; EDA_HOTKEY_CONFIG* section;
for( section = origin; section->m_HK_InfoList; section++ ) for( section = origin; section->m_HK_InfoList; section++ )
{ {
++row; ++row;
Ki_HotkeyInfo** info_ptr; EDA_HOTKEY** info_ptr;
for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ )
{ {
Ki_HotkeyInfo* info = *info_ptr; EDA_HOTKEY* info = *info_ptr;
m_hotkeys[row++].second->m_KeyCode = info->m_KeyCode; m_hotkeys[row++].second->m_KeyCode = info->m_KeyCode;
} }
} }
......
This diff is collapsed.
This diff is collapsed.
/***************/ /**
/* hotkeys.h */ * eeschema/hotkeys.h
/***************/ */
#ifndef KOTKEYS_H #ifndef KOTKEYS_H
#define KOTKEYS_H #define KOTKEYS_H
...@@ -46,15 +46,15 @@ enum hotkey_id_commnand { ...@@ -46,15 +46,15 @@ enum hotkey_id_commnand {
}; };
// List of hotkey descriptors for eeschema // List of hotkey descriptors for eeschema
extern struct Ki_HotkeyInfoSectionDescriptor s_Eeschema_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG s_Eeschema_Hokeys_Descr[];
// List of hotkey descriptors for the schematic editor only // List of hotkey descriptors for the schematic editor only
extern struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG s_Schematic_Hokeys_Descr[];
// List of hotkey descriptors for the lib editor only // List of hotkey descriptors for the lib editor only
extern struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG s_Libedit_Hokeys_Descr[];
// List of hotkey descriptors for the lib browser only // List of hotkey descriptors for the lib browser only
extern struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG s_Viewlib_Hokeys_Descr[];
#endif // KOTKEYS_H #endif // KOTKEYS_H
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
/* How to add a new hotkey: /* How to add a new hotkey:
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION. * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION.
* add a new Ki_HotkeyInfo entry like: * add a new EDA_HOTKEY entry like:
* static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value); * static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value);
* "Command Label" is the name used in hotkey list display, and the identifier in the * "Command Label" is the name used in hotkey list display, and the identifier in the
* hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch * hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch
* in OnHotKey() function. default key value is the default hotkey for this command. * in OnHotKey() function. default key value is the default hotkey for this command.
...@@ -33,25 +33,25 @@ ...@@ -33,25 +33,25 @@
/* local variables */ /* local variables */
/* Hotkey list: */ /* Hotkey list: */
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ), static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
HK_RESET_LOCAL_COORD, ' ' ); HK_RESET_LOCAL_COORD, ' ' );
static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME ); static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' ); static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
static Ki_HotkeyInfo HkTrackDisplayMode( wxT( "Track Display Mode" ), static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ),
HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' ); HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' );
static Ki_HotkeyInfo HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ),
HK_SWITCH_LAYER_TO_NEXT, '+' ); HK_SWITCH_LAYER_TO_NEXT, '+' );
static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ), static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ),
HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
// List of common hotkey descriptors // List of common hotkey descriptors
Ki_HotkeyInfo* s_Gerbview_Hotkey_List[] = { EDA_HOTKEY* s_Gerbview_Hotkey_List[] = {
&HkHelp, &HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord, &HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord,
...@@ -63,7 +63,7 @@ Ki_HotkeyInfo* s_Gerbview_Hotkey_List[] = { ...@@ -63,7 +63,7 @@ Ki_HotkeyInfo* s_Gerbview_Hotkey_List[] = {
// list of sections and corresponding hotkey list for pcbnew (used to create an hotkey config file) // list of sections and corresponding hotkey list for pcbnew (used to create an hotkey config file)
struct Ki_HotkeyInfoSectionDescriptor s_Gerbview_Hokeys_Descr[] = struct EDA_HOTKEY_CONFIG s_Gerbview_Hokeys_Descr[] =
{ {
{ &g_CommonSectionTag, s_Gerbview_Hotkey_List, NULL }, { &g_CommonSectionTag, s_Gerbview_Hotkey_List, NULL },
{ NULL, NULL, NULL } { NULL, NULL, NULL }
...@@ -86,8 +86,10 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -86,8 +86,10 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
if( (hotkey >= 'a') && (hotkey <= 'z') ) if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a'; hotkey += 'A' - 'a';
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Gerbview_Hotkey_List ); EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Gerbview_Hotkey_List );
if( HK_Descr == NULL ) return;
if( HK_Descr == NULL )
return;
switch( HK_Descr->m_Idcommand ) switch( HK_Descr->m_Idcommand )
{ {
......
/***************/ /**
/* hotkeys.h */ * gerbview/hotkeys.h
/***************/ */
#ifndef KOTKEYS_H #ifndef KOTKEYS_H
#define KOTKEYS_H #define KOTKEYS_H
...@@ -17,6 +18,6 @@ enum hotkey_id_commnand { ...@@ -17,6 +18,6 @@ enum hotkey_id_commnand {
}; };
// List of hotkey descriptors for pcbnew // List of hotkey descriptors for pcbnew
extern struct Ki_HotkeyInfoSectionDescriptor s_Gerbview_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG s_Gerbview_Hokeys_Descr[];
#endif // KOTKEYS_H #endif // KOTKEYS_H
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
bool SetLayersOrdered(bool value); bool SetLayersOrdered(bool value);
bool SetLayersHotkeys(bool value); bool SetLayersHotkeys(bool value);
// Hotkey Info // Hotkey Info
struct Ki_HotkeyInfoSectionDescriptor* m_hotkeys; struct EDA_HOTKEY_CONFIG* m_hotkeys;
}; };
#define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \ #define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \
......
...@@ -25,13 +25,13 @@ class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE ...@@ -25,13 +25,13 @@ class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE
{ {
protected: protected:
EDA_DRAW_FRAME* m_parent; EDA_DRAW_FRAME* m_parent;
struct Ki_HotkeyInfoSectionDescriptor* m_hotkeys; struct EDA_HOTKEY_CONFIG* m_hotkeys;
HotkeyGridTable* m_table; HotkeyGridTable* m_table;
int m_curEditingRow; int m_curEditingRow;
public: public:
HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, Ki_HotkeyInfoSectionDescriptor* hotkeys ); HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys );
~HOTKEYS_EDITOR_DIALOG() {}; ~HOTKEYS_EDITOR_DIALOG() {};
...@@ -45,6 +45,6 @@ private: ...@@ -45,6 +45,6 @@ private:
void SetHotkeyCellState( int aRow, bool aHightlight ); void SetHotkeyCellState( int aRow, bool aHightlight );
}; };
void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, Ki_HotkeyInfoSectionDescriptor* hotkeys ); void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys );
#endif #endif
...@@ -18,10 +18,10 @@ class HotkeyGridTable : public wxGridTableBase ...@@ -18,10 +18,10 @@ class HotkeyGridTable : public wxGridTableBase
{ {
public: public:
typedef std::pair< wxString, Ki_HotkeyInfo* > hotkey_spec; typedef std::pair< wxString, EDA_HOTKEY* > hotkey_spec;
typedef std::vector< hotkey_spec > hotkey_spec_vector; typedef std::vector< hotkey_spec > hotkey_spec_vector;
HotkeyGridTable( struct Ki_HotkeyInfoSectionDescriptor* origin ); HotkeyGridTable( struct EDA_HOTKEY_CONFIG* origin );
virtual ~HotkeyGridTable(); virtual ~HotkeyGridTable();
hotkey_spec_vector& getHotkeys(); hotkey_spec_vector& getHotkeys();
...@@ -47,7 +47,7 @@ private: ...@@ -47,7 +47,7 @@ private:
public: public:
virtual bool isHeader( int row ); virtual bool isHeader( int row );
virtual void SetKeyCode( int row, long key ); virtual void SetKeyCode( int row, long key );
virtual void RestoreFrom( struct Ki_HotkeyInfoSectionDescriptor* origin ); virtual void RestoreFrom( struct EDA_HOTKEY_CONFIG* origin );
protected: protected:
std::vector< hotkey_spec > m_hotkeys; std::vector< hotkey_spec > m_hotkeys;
......
/*******************/ /**
/* hotkeys_basic.h */ * @file hotkeys_basic.h
/*******************/ */
/* Some functions to handle hotkeys in kicad /* Some functions to handle hotkeys in kicad
*/ */
...@@ -17,39 +17,42 @@ class EDA_DRAW_FRAME; ...@@ -17,39 +17,42 @@ class EDA_DRAW_FRAME;
/* Class to handle hotkey commands. hotkeys have a default value /* Class to handle hotkey commands. hotkeys have a default value
* This class allows the real key code changed by user(from a key code list file) * This class allows the real key code changed by user(from a key code list file)
*/ */
class Ki_HotkeyInfo class EDA_HOTKEY
{ {
public: public:
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
wxString m_InfoMsg; // info message. wxString m_InfoMsg; // info message.
int m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list) int m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list)
int m_IdMenuEvent; // id to call the corresponding event (if any) (see id.h) int m_IdMenuEvent; // id to call the corresponding event (if any) (see id.h)
public: public:
Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent = 0 ); EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent = 0 );
Ki_HotkeyInfo( const Ki_HotkeyInfo* base); EDA_HOTKEY( const EDA_HOTKEY* base);
}; };
/* handle a Section name and the corresponding list of hotkeys (Ki_HotkeyInfo list)
/**
* Structure EDA_HOTKEY_CONFIG
* contains the information required to save hot key information to a configuration file.
* a Section name and the corresponding list of hotkeys (EDA_HOTKEY list)
* hotkeys are grouped by section. * hotkeys are grouped by section.
* a section is a list of hotkey infos ( a Ki_HotkeyInfo list). * a section is a list of hotkey infos ( a EDA_HOTKEY list).
* A full list of hoteys can used one or many sections * A full list of hotkeys can used one or many sections
* for instance: * for instance:
* the schematic editor uses a common section (zoom hotkeys list ..) and a specific section * the schematic editor uses a common section (zoom hotkeys list ..) and a specific section
* the library editor uses the same common section and a specific section * the library editor uses the same common section and a specific section
* this feature avoid duplications and made hotkey file config easier to understand and edit * this feature avoid duplications and made hotkey file config easier to understand and edit
*/ */
struct Ki_HotkeyInfoSectionDescriptor struct EDA_HOTKEY_CONFIG
{ {
public: public:
wxString* m_SectionTag; // The section name wxString* m_SectionTag; // The configuration file section name.
Ki_HotkeyInfo** m_HK_InfoList; // List of Ki_HotkeyInfo pointers EDA_HOTKEY** m_HK_InfoList; // List of EDA_HOTKEY pointers
const wchar_t* m_Comment; // comment: will be printed in the config file const wchar_t* m_Comment; // Will be printed in the config file only.
// Info usage only
}; };
/* Identifiers (tags) in key code configuration file (or section names) /* Identifiers (tags) in key code configuration file (or section names)
* .m_SectionTag member of a Ki_HotkeyInfoSectionDescriptor * .m_SectionTag member of a EDA_HOTKEY_CONFIG
*/ */
extern wxString g_CommonSectionTag; extern wxString g_CommonSectionTag;
extern wxString g_SchematicSectionTag; extern wxString g_SchematicSectionTag;
...@@ -77,11 +80,11 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool * aIsFound = NULL ) ...@@ -77,11 +80,11 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool * aIsFound = NULL )
/** /**
* Function ReturnKeyNameFromCommandId * Function ReturnKeyNameFromCommandId
* return the key name from the Command id value ( m_Idcommand member value) * return the key name from the Command id value ( m_Idcommand member value)
* @param aList = pointer to a Ki_HotkeyInfo list of commands * @param aList = pointer to a EDA_HOTKEY list of commands
* @param aCommandId = Command Id value * @param aCommandId = Command Id value
* @return the key name in a wxString * @return the key name in a wxString
*/ */
wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** aList, int aCommandId ); wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId );
/** /**
* Function ReturnKeyCodeFromKeyName * Function ReturnKeyCodeFromKeyName
...@@ -98,7 +101,7 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname ); ...@@ -98,7 +101,7 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname );
* Hot keys can perform actions using the current mouse cursor position * Hot keys can perform actions using the current mouse cursor position
* Accelerators performs the same action as the associated menu * Accelerators performs the same action as the associated menu
* A comment is used in tool tips for some tools (zoom ..) * A comment is used in tool tips for some tools (zoom ..)
* to show the hot key that perfoms this action * to show the hot key that performs this action
*/ */
enum HOTKEY_ACTION_TYPE enum HOTKEY_ACTION_TYPE
{ {
...@@ -111,48 +114,44 @@ enum HOTKEY_ACTION_TYPE ...@@ -111,48 +114,44 @@ enum HOTKEY_ACTION_TYPE
* Function AddHotkeyName * Function AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value) * Add the key name from the Command id value ( m_Idcommand member value)
* @param aText = a wxString. returns aText + key name * @param aText = a wxString. returns aText + key name
* @param aList = pointer to a Ki_HotkeyInfo list of commands * @param aList = pointer to a EDA_HOTKEY list of commands
* @param aCommandId = Command Id value * @param aCommandId = Command Id value
* @param aIsShortCut = true to add &lttab&gt&ltkeyname&gt (active shortcuts in menus) * @param aShortCutType The #HOTKEY_ACTION_TYPE of the shortcut.
* = false to add &ltspaces&gt&lt(keyname)&gt
* @return a wxString (aTest + key name) if key found or aText without modification * @return a wxString (aTest + key name) if key found or aText without modification
*/ */
wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList, wxString AddHotkeyName( const wxString& aText, EDA_HOTKEY** aList, int aCommandId,
int aCommandId, HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY);
HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY);
/** /**
* Function AddHotkeyName * Function AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value) * Add the key name from the Command id value ( m_Idcommand member value)
* @param aText = a wxString. returns aText + key name * @param aText = a wxString. returns aText + key name
* @param aDescrList = pointer to a Ki_HotkeyInfoSectionDescriptor DescrList of commands * @param aDescrList = pointer to a EDA_HOTKEY_CONFIG DescrList of commands
* @param aCommandId = Command Id value * @param aCommandId = Command Id value
* @param aIsShortCut = true to add &lttab&gt&ltkeyname&gt (active shortcuts in menus) * @param aShortCutType The #HOTKEY_ACTION_TYPE of the shortcut.
* = false to add &ltspaces&gt&lt(keyname)&gt
* @return a wxString (aTest + key name) if key found or aText without modification * @return a wxString (aTest + key name) if key found or aText without modification
*/ */
wxString AddHotkeyName( const wxString& aText, wxString AddHotkeyName( const wxString& aText,
struct Ki_HotkeyInfoSectionDescriptor* aDescrList, struct EDA_HOTKEY_CONFIG* aDescrList,
int aCommandId, int aCommandId,
HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY ); HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY );
/** /**
* Function DisplayHotkeyList * Function DisplayHotkeyList
* Displays the current hotkey list * Displays the current hotkey list
* @param aFrame = current active frame * @param aFrame = current active frame
* @param aList = pointer to a Ki_HotkeyInfoSectionDescriptor list (Null terminated) * @param aList = pointer to a EDA_HOTKEY_CONFIG list (Null terminated)
*/ */
void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aList );
struct Ki_HotkeyInfoSectionDescriptor* aList );
/** /**
* Function GetDescriptorFromHotkey * Function GetDescriptorFromHotkey
* Return a Ki_HotkeyInfo * pointer fron a key code for OnHotKey() function * Return a EDA_HOTKEY * pointer from a key code for OnHotKey() function
* @param aKey = key code (ascii value, or wxWidgets value for function keys * @param aKey = key code (ascii value, or wxWidgets value for function keys
* @param aList = pointer to a Ki_HotkeyInfo list of commands * @param aList = pointer to a EDA_HOTKEY list of commands
* @return the corresponding Ki_HotkeyInfo pointer from the Ki_HotkeyInfo List * @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
*/ */
Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList ); EDA_HOTKEY* GetDescriptorFromHotkey( int aKey, EDA_HOTKEY** aList );
/** /**
* Function ReadHotkeyConfig * Function ReadHotkeyConfig
...@@ -161,11 +160,9 @@ Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList ); ...@@ -161,11 +160,9 @@ Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList );
* @param Appname = the value of the app's m_FrameName * @param Appname = the value of the app's m_FrameName
* @param aDescList = the hotkey data * @param aDescList = the hotkey data
*/ */
void ReadHotkeyConfig( const wxString& Appname, void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescList );
struct Ki_HotkeyInfoSectionDescriptor* aDescList );
void ParseHotkeyConfig( const wxString& data, void ParseHotkeyConfig( const wxString& data, struct EDA_HOTKEY_CONFIG* aDescList );
struct Ki_HotkeyInfoSectionDescriptor* aDescList );
// common hotkeys event id // common hotkeys event id
......
...@@ -44,8 +44,7 @@ public: ...@@ -44,8 +44,7 @@ public:
int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch) int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch)
int m_DisplayModText; // How to display module texts (line/ filled / sketch) int m_DisplayModText; // How to display module texts (line/ filled / sketch)
bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, bool m_DisplayPcbTrackFill; // FALSE : tracks are show in sketch mode, TRUE = filled.
* TRUE = filled */
EDA_UNITS_T m_UserGridUnit; EDA_UNITS_T m_UserGridUnit;
wxRealPoint m_UserGridSize; wxRealPoint m_UserGridSize;
...@@ -160,21 +159,11 @@ public: ...@@ -160,21 +159,11 @@ public:
/** /**
* Function CursorGoto * Function CursorGoto
* positions the cursor at a given coordinate and reframes the drawing if * positions the cursor at a given coordinate and reframes the drawing if the
*the
* requested point is out of view. * requested point is out of view.
* @param aPos The point to go to. * @param aPos The point to go to.
*/ */
void CursorGoto( const wxPoint& aPos ); void CursorGoto( const wxPoint& aPos );
void place_marqueur( wxDC* DC,
const wxPoint& pos,
char* pt_bitmap,
int DrawMode,
int color,
int type );
MODULE* Copie_Module( MODULE* module );
/** /**
* Function Save_Module_In_Library * Function Save_Module_In_Library
...@@ -211,7 +200,7 @@ public: ...@@ -211,7 +200,7 @@ public:
* do not forget to call this basic OnModify function to update info * do not forget to call this basic OnModify function to update info
* in derived OnModify functions * in derived OnModify functions
*/ */
virtual void OnModify( ); virtual void OnModify();
// Modules (footprints) // Modules (footprints)
/** /**
...@@ -424,20 +413,33 @@ public: ...@@ -424,20 +413,33 @@ public:
* Return true if OK, false if the file is not created (or has a problem) * Return true if OK, false if the file is not created (or has a problem)
*/ */
bool Genere_GERBER( const wxString& FullFileName, /**
int Layer, * Function ExportToGerberFile
bool PlotOriginIsAuxAxis, * create one output files one per board layer in the RS274X format.
GRTraceMode trace_mode ); * <p>
bool Genere_HPGL( const wxString& FullFileName, * The units are in inches and in the format 3.4 with the leading zeros omitted.
int Layer, * Coordinates are absolute value. The 3.4 format is used because the native PCBNew
GRTraceMode trace_mode ); * units are 1/10000 inch.
bool Genere_PS( const wxString& FullFileName, * </p>
int Layer, */
bool useA4, bool ExportToGerberFile( const wxString& aFullFileName,
GRTraceMode trace_mode ); int aLayer,
bool Genere_DXF( const wxString& FullFileName, bool aPlotOriginIsAuxAxis,
int Layer, GRTraceMode aTraceMode );
GRTraceMode trace_mode );
bool ExportToHpglFile( const wxString& aFullFileName,
int aLayer,
GRTraceMode aTraceMode );
bool ExportToPostScriptFile( const wxString& aFullFileName,
int aLayer,
bool aUseA4,
GRTraceMode aTraceMode );
bool ExportToDxfFile( const wxString& aFullFileName,
int aLayer,
GRTraceMode aTraceMode );
void Plot_Layer( PLOTTER* plotter, void Plot_Layer( PLOTTER* plotter,
int Layer, int Layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
......
...@@ -173,16 +173,21 @@ public: ...@@ -173,16 +173,21 @@ public:
void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent );
/** /**
* Function RecordMacros * Function RecordMacros.
* record sequence hotkeys and cursor position to macros. * records sequence of hotkeys and cursor positions to a macro.
* @param aDC = current device context
* @param aNumber The current number macros.
*/ */
void RecordMacros(wxDC* aDC, int aNumber); void RecordMacros( wxDC* aDC, int aNumber );
/** /**
* Function CallMacros * Function CallMacros
* play hotkeys and cursor position from recorded macros. * play hotkeys and cursor position from a recorded macro.
* @param aDC = current device context
* @param aPosition The current cursor position in logical (drawing) units.
* @param aNumber The current number macros.
*/ */
void CallMacros(wxDC* aDC, const wxPoint& aPosition, int aNumber); void CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber );
void SaveMacros(); void SaveMacros();
......
...@@ -43,7 +43,6 @@ class BASE_SCREEN; ...@@ -43,7 +43,6 @@ class BASE_SCREEN;
class EDA_TOOLBAR; class EDA_TOOLBAR;
class PARAM_CFG_BASE; class PARAM_CFG_BASE;
class Ki_PageDescr; class Ki_PageDescr;
class Ki_HotkeyInfo;
class PLOTTER; class PLOTTER;
enum id_librarytype { enum id_librarytype {
...@@ -139,7 +138,7 @@ public: ...@@ -139,7 +138,7 @@ public:
* Read configuration data and fill the current hotkey list with hotkeys * Read configuration data and fill the current hotkey list with hotkeys
* @param aDescList = current hotkey list descr. to initialize. * @param aDescList = current hotkey list descr. to initialize.
*/ */
int ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); int ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList );
/** /**
* Function WriteHotkeyConfig * Function WriteHotkeyConfig
...@@ -152,8 +151,7 @@ public: ...@@ -152,8 +151,7 @@ public:
* the output format is: shortcut "key" "function" * the output format is: shortcut "key" "function"
* lines starting with # are comments * lines starting with # are comments
*/ */
int WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList, int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL);
wxString* aFullFileName = NULL);
/** /**
* Function ReadHotkeyConfigFile * Function ReadHotkeyConfigFile
...@@ -162,22 +160,21 @@ public: ...@@ -162,22 +160,21 @@ public:
* @param aFilename = file name to read. * @param aFilename = file name to read.
* @param aDescList = current hotkey list descr. to initialize. * @param aDescList = current hotkey list descr. to initialize.
*/ */
int ReadHotkeyConfigFile( const wxString& aFilename, int ReadHotkeyConfigFile( const wxString& aFilename, struct EDA_HOTKEY_CONFIG* aDescList );
struct Ki_HotkeyInfoSectionDescriptor* aDescList );
/** /**
* Function ImportHotkeyConfigFromFile * Function ImportHotkeyConfigFromFile
* Prompt the user for an old hotkey file to read, and read it. * Prompt the user for an old hotkey file to read, and read it.
* @param aDescList = current hotkey list descr. to initialize. * @param aDescList = current hotkey list descr. to initialize.
*/ */
void ImportHotkeyConfigFromFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); void ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDescList );
/** /**
* Function ExportHotkeyConfigToFile * Function ExportHotkeyConfigToFile
* Prompt the user for an old hotkey file to read, and read it. * Prompt the user for an old hotkey file to read, and read it.
* @param aDescList = current hotkey list descr. to initialize. * @param aDescList = current hotkey list descr. to initialize.
*/ */
void ExportHotkeyConfigToFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); void ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescList );
/** /**
* Function SetLanguage * Function SetLanguage
...@@ -284,7 +281,7 @@ public: ...@@ -284,7 +281,7 @@ public:
wxPoint m_Auxiliary_Axis_Position; // position of the auxiliary axis wxPoint m_Auxiliary_Axis_Position; // position of the auxiliary axis
protected: protected:
Ki_HotkeyInfoSectionDescriptor * m_HotkeysZoomAndGridList; EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
int m_LastGridSizeId; int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color int m_GridColor; // Grid color
......
This diff is collapsed.
...@@ -79,24 +79,26 @@ enum hotkey_id_commnand { ...@@ -79,24 +79,26 @@ enum hotkey_id_commnand {
HK_CALL_MACROS_9 HK_CALL_MACROS_9
}; };
// Full list of hotkey descriptors for borad editor and footprint editor // Full list of hotkey descriptors for board editor and footprint editor
extern struct Ki_HotkeyInfoSectionDescriptor g_Pcbnew_Editor_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG g_Pcbnew_Editor_Hokeys_Descr[];
// List of hotkey descriptors for the board editor only // List of hotkey descriptors for the board editor only
extern struct Ki_HotkeyInfoSectionDescriptor g_Board_Editor_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG g_Board_Editor_Hokeys_Descr[];
// List of hotkey descriptors for the footprint editor only // List of hotkey descriptors for the footprint editor only
extern struct Ki_HotkeyInfoSectionDescriptor g_Module_Editor_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[];
// List of common hotkey descriptors // List of common hotkey descriptors
// used in hotkeys_board_editor.cpp and hotkeys_module_editor.cpp // used in hotkeys_board_editor.cpp and hotkeys_module_editor.cpp
extern Ki_HotkeyInfo* common_Hotkey_List[]; extern EDA_HOTKEY* common_Hotkey_List[];
// List of hotkey descriptors for pcbnew // List of hotkey descriptors for pcbnew
// used in hotkeys_board_editor.cpp // used in hotkeys_board_editor.cpp
extern Ki_HotkeyInfo* board_edit_Hotkey_List[]; extern EDA_HOTKEY* board_edit_Hotkey_List[];
// List of hotkey descriptors for the module editor // List of hotkey descriptors for the module editor
// used in hotkeys_module_editor.cpp // used in hotkeys_module_editor.cpp
extern Ki_HotkeyInfo* module_edit_Hotkey_List[]; extern EDA_HOTKEY* module_edit_Hotkey_List[];
#endif /* _PCBNEW_HOTKEYS_H_ */ #endif /* _PCBNEW_HOTKEYS_H_ */
...@@ -22,52 +22,39 @@ ...@@ -22,52 +22,39 @@
*/ */
/**
* Function RecordMacros.
* Record sequence hotkeys and cursor position to macros.
* @param aDC = current device context
* @param aNumber The current number macros.
*/
void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber) void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber)
{ {
assert(aNumber >= 0); assert( aNumber >= 0 );
assert(aNumber < 10); assert( aNumber < 10 );
wxString msg, tmp; wxString msg, tmp;
if( m_RecordingMacros < 0 ) if( m_RecordingMacros < 0 )
{ {
m_RecordingMacros = aNumber; m_RecordingMacros = aNumber;
m_Macros[aNumber].m_StartPosition = GetScreen()->GetCrossHairPosition(false); m_Macros[aNumber].m_StartPosition = GetScreen()->GetCrossHairPosition( false );
m_Macros[aNumber].m_Record.clear(); m_Macros[aNumber].m_Record.clear();
msg.Printf( wxT("%s %d"), _( "Recording macros" ), aNumber); msg.Printf( wxT( "%s %d" ), _( "Recording macros" ), aNumber );
SetStatusText(msg); SetStatusText( msg );
} }
else else
{ {
m_RecordingMacros = -1; m_RecordingMacros = -1;
msg.Printf( wxT("%s %d %s"), _( "Macros" ), aNumber, _( "recorded" )); msg.Printf( wxT( "%s %d %s" ), _( "Macros" ), aNumber, _( "recorded" ) );
SetStatusText(msg); SetStatusText( msg );
} }
} }
/** void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber )
* Function CallMacros
* play hotkeys and cursor position from recorded macros.
* @param aDC = current device context
* @param aPosition The current cursor position in logical (drawing) units.
* @param aNumber The current number macros.
*/
void PCB_EDIT_FRAME::CallMacros(wxDC* aDC, const wxPoint& aPosition, int aNumber)
{ {
PCB_SCREEN* screen = GetScreen(); PCB_SCREEN* screen = GetScreen();
wxPoint tPosition; wxPoint tPosition;
wxString msg; wxString msg;
msg.Printf( wxT("%s %d"), _( "Call macros"), aNumber); msg.Printf( wxT( "%s %d" ), _( "Call macros" ), aNumber );
SetStatusText( msg ); SetStatusText( msg );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
...@@ -97,15 +84,6 @@ void PCB_EDIT_FRAME::CallMacros(wxDC* aDC, const wxPoint& aPosition, int aNumber ...@@ -97,15 +84,6 @@ void PCB_EDIT_FRAME::CallMacros(wxDC* aDC, const wxPoint& aPosition, int aNumber
} }
/**
* Function OnHotKey.
* ** Commands are case insensitive **
* Some commands are relatives to the item under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aPosition The current cursor position in logical (drawing) units.
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
*/
void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
EDA_ITEM* aItem ) EDA_ITEM* aItem )
{ {
...@@ -124,7 +102,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -124,7 +102,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') ) if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') )
aHotkeyCode += 'A' - 'a'; aHotkeyCode += 'A' - 'a';
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, common_Hotkey_List ); EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, common_Hotkey_List );
if( HK_Descr == NULL ) if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, board_edit_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, board_edit_Hotkey_List );
...@@ -646,18 +624,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -646,18 +624,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
} }
/**
* Function OnHotkeyDeleteItem
* Delete the item found under the mouse cursor
* Depending on the current active tool::
* Tool track
* if a track is in progress: Delete the last segment
* else delete the entire track
* Tool module (footprint):
* Delete the module.
* @param aDC = current device context
* @return true if an item was deleted
*/
bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC ) bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
...@@ -823,14 +789,7 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand ) ...@@ -823,14 +789,7 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
return false; return false;
} }
/**
* Function OnHotkeyMoveItem
* Move or drag the item (footprint, track, text .. ) found under the mouse cursor
* An item can be moved (or dragged) only if there is no item currently edited
* Only a footprint, a pad or a track can be dragged
* @param aIdCommand = the hotkey command id
* @return true if an item was moved
*/
bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand ) bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
......
/*****************************/ /**
/* hotkeys_module_editor.cpp */ * @file hotkeys_module_editor.cpp
/*****************************/ */
#include "fctsys.h" #include "fctsys.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -36,7 +36,7 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos ...@@ -36,7 +36,7 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
if( (aHotKey >= 'a') && (aHotKey <= 'z') ) if( (aHotKey >= 'a') && (aHotKey <= 'z') )
aHotKey += 'A' - 'a'; aHotKey += 'A' - 'a';
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List ); EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
if( HK_Descr == NULL ) if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( aHotKey, module_edit_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( aHotKey, module_edit_Hotkey_List );
......
...@@ -205,38 +205,6 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -205,38 +205,6 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
} }
/**
* Function Copie_Module
* Copy an existing footprint. The new footprint is added in module list
* @param module = footprint to copy
* @return a pointer on the new footprint (the copy of the existing footprint)
*/
MODULE* PCB_BASE_FRAME::Copie_Module( MODULE* module )
{
MODULE* newmodule;
if( module == NULL )
return NULL;
OnModify();
/* Duplicate module */
GetBoard()->m_Status_Pcb = 0;
newmodule = new MODULE( GetBoard() );
newmodule->Copy( module );
GetBoard()->Add( newmodule, ADD_APPEND );
newmodule->m_Flags = IS_NEW;
GetBoard()->m_NetInfo->BuildListOfNets();
newmodule->DisplayInfo( this );
GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
return newmodule;
}
/* Redraw the footprint when moving the mouse. /* Redraw the footprint when moving the mouse.
*/ */
void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
......
/** /**
* @file pcbnew.cpp * @file pcbnew.cpp
* @file PCBNEW: main program. * @brief PCBNEW: main program.
*/ */
#include "fctsys.h" #include "fctsys.h"
......
...@@ -49,6 +49,7 @@ static bool setDouble( double* aDouble, double aValue, double aMin, double aMax ...@@ -49,6 +49,7 @@ static bool setDouble( double* aDouble, double aValue, double aMin, double aMax
return true; return true;
} }
/*******************************/ /*******************************/
/* Dialog box for plot control */ /* Dialog box for plot control */
/*******************************/ /*******************************/
...@@ -63,8 +64,10 @@ private: ...@@ -63,8 +64,10 @@ private:
double m_YScaleAdjust; double m_YScaleAdjust;
static wxPoint prevPosition; // Dialog position & size static wxPoint prevPosition; // Dialog position & size
static wxSize prevSize; static wxSize prevSize;
public: public:
DIALOG_PLOT( PCB_EDIT_FRAME* parent ); DIALOG_PLOT( PCB_EDIT_FRAME* parent );
private: private:
void Init_Dialog(); void Init_Dialog();
void Plot( wxCommandEvent& event ); void Plot( wxCommandEvent& event );
...@@ -77,6 +80,7 @@ private: ...@@ -77,6 +80,7 @@ private:
void CreateDrillFile( wxCommandEvent& event ); void CreateDrillFile( wxCommandEvent& event );
}; };
wxPoint DIALOG_PLOT::prevPosition( -1, -1 ); wxPoint DIALOG_PLOT::prevPosition( -1, -1 );
wxSize DIALOG_PLOT::prevSize; wxSize DIALOG_PLOT::prevSize;
...@@ -95,8 +99,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* parent ) : ...@@ -95,8 +99,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* parent ) :
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
if( prevPosition.x != -1 ) if( prevPosition.x != -1 )
SetSize( prevPosition.x, prevPosition.y, SetSize( prevPosition.x, prevPosition.y, prevSize.x, prevSize.y );
prevSize.x, prevSize.y );
else else
Center(); Center();
} }
...@@ -153,6 +156,7 @@ void DIALOG_PLOT::Init_Dialog() ...@@ -153,6 +156,7 @@ void DIALOG_PLOT::Init_Dialog()
// (Front or Top to Back or Bottom) // (Front or Top to Back or Bottom)
DECLARE_LAYERS_ORDER_LIST( layersOrder ); DECLARE_LAYERS_ORDER_LIST( layersOrder );
int layerIndex, checkIndex, layer; int layerIndex, checkIndex, layer;
for( layerIndex = 0; layerIndex < NB_LAYERS; layerIndex++ ) for( layerIndex = 0; layerIndex < NB_LAYERS; layerIndex++ )
{ {
layer = layersOrder[layerIndex]; layer = layersOrder[layerIndex];
...@@ -265,6 +269,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) ...@@ -265,6 +269,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
// to preselect it when opening the dialog. // to preselect it when opening the dialog.
wxFileName fn( m_outputDirectoryName->GetValue() ); wxFileName fn( m_outputDirectoryName->GetValue() );
wxString path; wxString path;
if( fn.IsRelative() ) if( fn.IsRelative() )
path = wxGetCwd() + fn.GetPathSeparator() + m_outputDirectoryName->GetValue(); path = wxGetCwd() + fn.GetPathSeparator() + m_outputDirectoryName->GetValue();
else else
...@@ -495,6 +500,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -495,6 +500,7 @@ void DIALOG_PLOT::applyPlotSettings()
msg.Printf( wxT( "X scale constrained!\n" ) ); msg.Printf( wxT( "X scale constrained!\n" ) );
m_messagesBox->AppendText( msg ); m_messagesBox->AppendText( msg );
} }
m_Config->Write( CONFIG_XFINESCALE_ADJ, m_XScaleAdjust ); m_Config->Write( CONFIG_XFINESCALE_ADJ, m_XScaleAdjust );
// Y scale // Y scale
...@@ -508,6 +514,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -508,6 +514,7 @@ void DIALOG_PLOT::applyPlotSettings()
msg.Printf( wxT( "Y scale constrained!\n" ) ); msg.Printf( wxT( "Y scale constrained!\n" ) );
m_messagesBox->AppendText( msg ); m_messagesBox->AppendText( msg );
} }
m_Config->Write( CONFIG_YFINESCALE_ADJ, m_YScaleAdjust ); m_Config->Write( CONFIG_YFINESCALE_ADJ, m_YScaleAdjust );
tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() ); tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
...@@ -516,13 +523,14 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -516,13 +523,14 @@ void DIALOG_PLOT::applyPlotSettings()
long selectedLayers = 0; long selectedLayers = 0;
unsigned int i; unsigned int i;
for( i = 0; i < layerList.size(); i++ ) for( i = 0; i < layerList.size(); i++ )
{ {
if( m_layerCheckListBox->IsChecked( i ) ) if( m_layerCheckListBox->IsChecked( i ) )
selectedLayers |= (1 << layerList[i]); selectedLayers |= (1 << layerList[i]);
} }
tempOptions.SetLayerSelection( selectedLayers );
tempOptions.SetLayerSelection( selectedLayers );
tempOptions.m_PlotPSNegative = m_plotPSNegativeOpt->GetValue(); tempOptions.m_PlotPSNegative = m_plotPSNegativeOpt->GetValue();
tempOptions.SetPsA4Output( m_forcePSA4OutputOpt->GetValue() ); tempOptions.SetPsA4Output( m_forcePSA4OutputOpt->GetValue() );
...@@ -581,6 +589,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -581,6 +589,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
g_PcbPlotOptions.m_AutoScale = false; g_PcbPlotOptions.m_AutoScale = false;
g_PcbPlotOptions.m_PlotScale = 1; g_PcbPlotOptions.m_PlotScale = 1;
switch( g_PcbPlotOptions.GetScaleSelection() ) switch( g_PcbPlotOptions.GetScaleSelection() )
{ {
default: default:
...@@ -610,6 +619,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -610,6 +619,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
*/ */
if( m_fineAdjustXscaleOpt->IsEnabled() && m_XScaleAdjust != 0.0 ) if( m_fineAdjustXscaleOpt->IsEnabled() && m_XScaleAdjust != 0.0 )
g_PcbPlotOptions.m_FineScaleAdjustX = m_XScaleAdjust; g_PcbPlotOptions.m_FineScaleAdjustX = m_XScaleAdjust;
if( m_fineAdjustYscaleOpt->IsEnabled() && m_YScaleAdjust != 0.0 ) if( m_fineAdjustYscaleOpt->IsEnabled() && m_YScaleAdjust != 0.0 )
g_PcbPlotOptions.m_FineScaleAdjustY = m_YScaleAdjust; g_PcbPlotOptions.m_FineScaleAdjustY = m_YScaleAdjust;
...@@ -637,15 +647,18 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -637,15 +647,18 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
// Test for a reasonable scale value // Test for a reasonable scale value
if( g_PcbPlotOptions.m_PlotScale < MIN_SCALE ) if( g_PcbPlotOptions.m_PlotScale < MIN_SCALE )
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "Warning: Scale option set to a very small value" ) ); _( "Warning: Scale option set to a very small value" ) );
if( g_PcbPlotOptions.m_PlotScale > MAX_SCALE ) if( g_PcbPlotOptions.m_PlotScale > MAX_SCALE )
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "Warning: Scale option set to a very large value" ) ); _( "Warning: Scale option set to a very large value" ) );
long layerMask = 1; long layerMask = 1;
for( layer = 0; layer < NB_LAYERS; layer++, layerMask <<= 1 ) for( layer = 0; layer < NB_LAYERS; layer++, layerMask <<= 1 )
{ {
bool success = false; bool success = false;
if( g_PcbPlotOptions.GetLayerSelection() & layerMask ) if( g_PcbPlotOptions.GetLayerSelection() & layerMask )
{ {
fn = m_Parent->GetScreen()->GetFileName(); fn = m_Parent->GetScreen()->GetFileName();
...@@ -742,42 +755,43 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -742,42 +755,43 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
switch( g_PcbPlotOptions.GetPlotFormat() ) switch( g_PcbPlotOptions.GetPlotFormat() )
{ {
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
success = m_Parent->Genere_PS( fn.GetFullPath(), layer, success = m_Parent->ExportToPostScriptFile( fn.GetFullPath(), layer,
g_PcbPlotOptions.GetPsA4Output(), g_PcbPlotOptions.GetPsA4Output(),
g_PcbPlotOptions.m_PlotMode ); g_PcbPlotOptions.m_PlotMode );
break; break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
success = m_Parent->Genere_GERBER( fn.GetFullPath(), layer, success = m_Parent->ExportToGerberFile( fn.GetFullPath(), layer,
g_PcbPlotOptions.GetUseAuxOrigin(), g_PcbPlotOptions.GetUseAuxOrigin(),
g_PcbPlotOptions.m_PlotMode ); g_PcbPlotOptions.m_PlotMode );
break; break;
case PLOT_FORMAT_HPGL: case PLOT_FORMAT_HPGL:
success = m_Parent->Genere_HPGL( fn.GetFullPath(), layer, success = m_Parent->ExportToHpglFile( fn.GetFullPath(), layer,
g_PcbPlotOptions.m_PlotMode ); g_PcbPlotOptions.m_PlotMode );
break; break;
case PLOT_FORMAT_DXF: case PLOT_FORMAT_DXF:
success = m_Parent->Genere_DXF( fn.GetFullPath(), layer, success = m_Parent->ExportToDxfFile( fn.GetFullPath(), layer,
g_PcbPlotOptions.m_PlotMode ); g_PcbPlotOptions.m_PlotMode );
break; break;
} }
// Print diags in messages box: // Print diags in messages box:
wxString msg; wxString msg;
if( success ) if( success )
msg.Printf( _( "Plot file <%s> created" ), GetChars( fn.GetFullPath() ) ); msg.Printf( _( "Plot file <%s> created" ), GetChars( fn.GetFullPath() ) );
else else
msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) ); msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) );
msg << wxT( "\n" ); msg << wxT( "\n" );
m_messagesBox->AppendText( msg ); m_messagesBox->AppendText( msg );
} }
} }
// If no layer selected, we have nothing plotted. // If no layer selected, we have nothing plotted.
// Prompt user if it happens // Prompt user if it happens because he could think there is a bug in pcbnew.
// because he could think there is a bug in pcbnew:
if( !g_PcbPlotOptions.GetLayerSelection() ) if( !g_PcbPlotOptions.GetLayerSelection() )
DisplayError( this, _( "No layer selected" ) ); DisplayError( this, _( "No layer selected" ) );
} }
......
...@@ -15,11 +15,13 @@ ...@@ -15,11 +15,13 @@
#include "pcbplot.h" #include "pcbplot.h"
bool PCB_BASE_FRAME::Genere_DXF( const wxString& FullFileName, int Layer, GRTraceMode trace_mode ) bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
GRTraceMode aTraceMode )
{ {
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc; Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
return false; return false;
...@@ -31,13 +33,13 @@ bool PCB_BASE_FRAME::Genere_DXF( const wxString& FullFileName, int Layer, GRTrac ...@@ -31,13 +33,13 @@ bool PCB_BASE_FRAME::Genere_DXF( const wxString& FullFileName, int Layer, GRTrac
plotter->set_paper_size( currentsheet ); plotter->set_paper_size( currentsheet );
plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 ); plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 );
plotter->set_creator( wxT( "PCBNEW-DXF" ) ); plotter->set_creator( wxT( "PCBNEW-DXF" ) );
plotter->set_filename( FullFileName ); plotter->set_filename( aFullFileName );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
if( g_PcbPlotOptions.m_PlotFrameRef ) if( g_PcbPlotOptions.m_PlotFrameRef )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, Layer, trace_mode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default(); SetLocaleTo_Default();
......
...@@ -23,16 +23,10 @@ ...@@ -23,16 +23,10 @@
#include "protos.h" #include "protos.h"
/* Creates the output files, one per board layer: bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLayer,
* filenames are like xxxc.PHO and use the RS274X format bool aPlotOriginIsAuxAxis, GRTraceMode aTraceMode )
* Units = inches
* format 3.4, Leading zero omitted, Abs format
* format 3.4 uses the native pcbnew units (1/10000 inch).
*/
bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer,
bool PlotOriginIsAuxAxis, GRTraceMode trace_mode )
{ {
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
...@@ -44,7 +38,7 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, ...@@ -44,7 +38,7 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer,
/* Calculate scaling from pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */ /* Calculate scaling from pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */
double scale = g_PcbPlotOptions.m_PlotScale; double scale = g_PcbPlotOptions.m_PlotScale;
if( PlotOriginIsAuxAxis ) if( aPlotOriginIsAuxAxis )
{ {
offset = m_Auxiliary_Axis_Position; offset = m_Auxiliary_Axis_Position;
} }
...@@ -60,20 +54,20 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, ...@@ -60,20 +54,20 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer,
plotter->set_viewport( offset, scale, 0 ); plotter->set_viewport( offset, scale, 0 );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-RS274X" ) ); plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
plotter->set_filename( FullFileName ); plotter->set_filename( aFullFileName );
if( plotter->start_plot( output_file ) ) if( plotter->start_plot( output_file ) )
{ {
// Skip NPTH pads on copper layers // Skip NPTH pads on copper layers
// ( only if hole size == pad size ): // ( only if hole size == pad size ):
if( (Layer >= LAYER_N_BACK) && (Layer <= LAYER_N_FRONT) ) if( (aLayer >= LAYER_N_BACK) && (aLayer <= LAYER_N_FRONT) )
g_PcbPlotOptions.m_SkipNPTH_Pads = true; g_PcbPlotOptions.m_SkipNPTH_Pads = true;
// Sheet refs on gerber CAN be useful... and they're always 1:1 // Sheet refs on gerber CAN be useful... and they're always 1:1
if( g_PcbPlotOptions.m_PlotFrameRef ) if( g_PcbPlotOptions.m_PlotFrameRef )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, Layer, trace_mode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
g_PcbPlotOptions.m_SkipNPTH_Pads = false; g_PcbPlotOptions.m_SkipNPTH_Pads = false;
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
#include "pcbplot.h" #include "pcbplot.h"
bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTraceMode trace_mode ) bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer,
GRTraceMode aTraceMode )
{ {
wxSize SheetSize; wxSize SheetSize;
wxSize BoardSize; wxSize BoardSize;
...@@ -27,7 +28,7 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra ...@@ -27,7 +28,7 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra
double scale; double scale;
wxPoint offset; wxPoint offset;
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
...@@ -40,8 +41,7 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra ...@@ -40,8 +41,7 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra
int pen_diam = wxRound( (g_PcbPlotOptions.m_HPGLPenDiam * U_PCB) / int pen_diam = wxRound( (g_PcbPlotOptions.m_HPGLPenDiam * U_PCB) /
g_PcbPlotOptions.m_PlotScale ); g_PcbPlotOptions.m_PlotScale );
// compute pen_overlay (from g_m_HPGLPenOvr in mils) // compute pen_overlay (from g_m_HPGLPenOvr in mils) with plot scale
// with plot scale
if( g_PcbPlotOptions.m_HPGLPenOvr < 0 ) if( g_PcbPlotOptions.m_HPGLPenOvr < 0 )
g_PcbPlotOptions.m_HPGLPenOvr = 0; g_PcbPlotOptions.m_HPGLPenOvr = 0;
...@@ -100,19 +100,18 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra ...@@ -100,19 +100,18 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror ); plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-HPGL" ) ); plotter->set_creator( wxT( "PCBNEW-HPGL" ) );
plotter->set_filename( FullFileName ); plotter->set_filename( aFullFileName );
plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed ); plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed );
plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum ); plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum );
plotter->set_pen_overlap( pen_overlay ); plotter->set_pen_overlap( pen_overlay );
plotter->set_pen_diameter( pen_diam ); plotter->set_pen_diameter( pen_diam );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with /* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
* paperscale!=1, anyway */
if( g_PcbPlotOptions.m_PlotFrameRef && !Center ) if( g_PcbPlotOptions.m_PlotFrameRef && !Center )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, Layer, trace_mode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default(); SetLocaleTo_Default();
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
/* Generate a PostScript file (*. ps) of the circuit layer. /* Generate a PostScript file (*. ps) of the circuit layer.
* If layer < 0: all layers are plotted. * If layer < 0: all layers are plotted.
*/ */
bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int aLayer,
bool useA4, GRTraceMode trace_mode ) bool aUseA4, GRTraceMode aTraceMode )
{ {
wxSize SheetSize; wxSize SheetSize;
wxSize PaperSize; wxSize PaperSize;
...@@ -34,7 +34,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -34,7 +34,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
Ki_PageDescr* SheetPS; Ki_PageDescr* SheetPS;
wxPoint offset; wxPoint offset;
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
...@@ -54,7 +54,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -54,7 +54,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
SheetSize.x = currentsheet->m_Size.x * U_PCB; SheetSize.x = currentsheet->m_Size.x * U_PCB;
SheetSize.y = currentsheet->m_Size.y * U_PCB; SheetSize.y = currentsheet->m_Size.y * U_PCB;
if( useA4 ) if( aUseA4 )
{ {
SheetPS = &g_Sheet_A4; SheetPS = &g_Sheet_A4;
PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB; PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB;
...@@ -82,7 +82,9 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -82,7 +82,9 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
scale = MIN( Xscale, Yscale ); scale = MIN( Xscale, Yscale );
} }
else else
{
scale = g_PcbPlotOptions.m_PlotScale * paperscale; scale = g_PcbPlotOptions.m_PlotScale * paperscale;
}
if( Center ) if( Center )
{ {
...@@ -102,11 +104,10 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -102,11 +104,10 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror ); plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-PS" ) ); plotter->set_creator( wxT( "PCBNEW-PS" ) );
plotter->set_filename( FullFileName ); plotter->set_filename( aFullFileName );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with /* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
* paperscale!=1, anyway */
if( g_PcbPlotOptions.m_PlotFrameRef && !Center ) if( g_PcbPlotOptions.m_PlotFrameRef && !Center )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
...@@ -126,7 +127,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -126,7 +127,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
plotter->set_color( BLACK ); plotter->set_color( BLACK );
} }
Plot_Layer( plotter, Layer, trace_mode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default(); SetLocaleTo_Default();
......
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