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