Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
a97f5c25
Commit
a97f5c25
authored
Mar 14, 2011
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gerbview: code cleanup and very minor fix.
parent
fe6890a9
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
432 additions
and
189 deletions
+432
-189
CMakeLists.txt
gerbview/CMakeLists.txt
+2
-1
dcode.cpp
gerbview/dcode.cpp
+1
-1
draw_gerber_screen.cpp
gerbview/draw_gerber_screen.cpp
+1
-1
events_called_functions.cpp
gerbview/events_called_functions.cpp
+294
-0
files.cpp
gerbview/files.cpp
+1
-0
gerbview.cpp
gerbview/gerbview.cpp
+2
-1
gerbview_config.cpp
gerbview/gerbview_config.cpp
+2
-2
gerbview_frame.cpp
gerbview/gerbview_frame.cpp
+3
-139
gerbview_frame.h
gerbview/gerbview_frame.h
+27
-30
gerbview_id.h
gerbview/gerbview_id.h
+10
-1
hotkeys.cpp
gerbview/hotkeys.cpp
+12
-5
locate.cpp
gerbview/locate.cpp
+1
-1
onleftclick.cpp
gerbview/onleftclick.cpp
+69
-0
readgerb.cpp
gerbview/readgerb.cpp
+1
-1
rs274d.cpp
gerbview/rs274d.cpp
+1
-1
toolbars_gerber.cpp
gerbview/toolbars_gerber.cpp
+5
-5
No files found.
gerbview/CMakeLists.txt
View file @
a97f5c25
...
@@ -33,7 +33,7 @@ set(GERBVIEW_SRCS
...
@@ -33,7 +33,7 @@ set(GERBVIEW_SRCS
dcode.cpp
dcode.cpp
dummy_functions.cpp
dummy_functions.cpp
draw_gerber_screen.cpp
draw_gerber_screen.cpp
e
dit
.cpp
e
vents_called_functions
.cpp
export_to_pcbnew.cpp
export_to_pcbnew.cpp
files.cpp
files.cpp
gerbview.cpp
gerbview.cpp
...
@@ -43,6 +43,7 @@ set(GERBVIEW_SRCS
...
@@ -43,6 +43,7 @@ set(GERBVIEW_SRCS
initpcb.cpp
initpcb.cpp
locate.cpp
locate.cpp
menubar.cpp
menubar.cpp
onleftclick.cpp
onrightclick.cpp
onrightclick.cpp
options.cpp
options.cpp
pcbplot.cpp
pcbplot.cpp
...
...
gerbview/dcode.cpp
View file @
a97f5c25
...
@@ -158,7 +158,7 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName
...
@@ -158,7 +158,7 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName
wxString
msg
;
wxString
msg
;
D_CODE
*
dcode
;
D_CODE
*
dcode
;
FILE
*
dest
;
FILE
*
dest
;
int
layer
=
GetScreen
()
->
m_Active_Layer
;
int
layer
=
getActiveLayer
()
;
int
type_outil
;
int
type_outil
;
if
(
g_GERBER_List
[
layer
]
==
NULL
)
if
(
g_GERBER_List
[
layer
]
==
NULL
)
...
...
gerbview/draw_gerber_screen.cpp
View file @
a97f5c25
...
@@ -222,7 +222,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
...
@@ -222,7 +222,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoin
int
dcode_highlight
=
0
;
int
dcode_highlight
=
0
;
if
(
layer
==
m_PcbFrame
->
GetScreen
()
->
m_Active_Layer
)
if
(
layer
==
((
GERBVIEW_FRAME
*
)
m_PcbFrame
)
->
getActiveLayer
()
)
dcode_highlight
=
gerber
->
m_Selected_Tool
;
dcode_highlight
=
gerber
->
m_Selected_Tool
;
int
layerdrawMode
=
GR_COPY
;
int
layerdrawMode
=
GR_COPY
;
...
...
gerbview/e
dit
.cpp
→
gerbview/e
vents_called_functions
.cpp
View file @
a97f5c25
This diff is collapsed.
Click to expand it.
gerbview/files.cpp
View file @
a97f5c25
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include "gestfich.h"
#include "gestfich.h"
#include "gerbview.h"
#include "gerbview.h"
#include "gerbview_id.h"
/* Load a Gerber file selected from history list on current layer
/* Load a Gerber file selected from history list on current layer
...
...
gerbview/gerbview.cpp
View file @
a97f5c25
...
@@ -119,13 +119,14 @@ bool WinEDA_App::OnInit()
...
@@ -119,13 +119,14 @@ bool WinEDA_App::OnInit()
wxSetWorkingDirectory
(
fn
.
GetPath
()
);
wxSetWorkingDirectory
(
fn
.
GetPath
()
);
// Load all files specified on the command line.
// Load all files specified on the command line.
int
jj
=
0
;
for
(
int
ii
=
1
;
ii
<
argc
&&
ii
<=
LAYER_COUNT
;
++
ii
)
for
(
int
ii
=
1
;
ii
<
argc
&&
ii
<=
LAYER_COUNT
;
++
ii
)
{
{
fn
=
wxFileName
(
argv
[
ii
]
);
fn
=
wxFileName
(
argv
[
ii
]
);
if
(
fn
.
FileExists
()
)
if
(
fn
.
FileExists
()
)
{
{
(
(
PCB_SCREEN
*
)
frame
->
GetScreen
()
)
->
m_Active_Layer
=
ii
-
1
;
frame
->
setActiveLayer
(
jj
++
)
;
frame
->
LoadGerberFiles
(
fn
.
GetFullPath
()
);
frame
->
LoadGerberFiles
(
fn
.
GetFullPath
()
);
}
}
}
}
...
...
gerbview/gerbview_config.cpp
View file @
a97f5c25
...
@@ -89,7 +89,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
...
@@ -89,7 +89,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
WHITE
)
);
WHITE
)
);
m_configSettings
.
push_back
(
new
PARAM_CFG_BOOL
(
true
,
m_configSettings
.
push_back
(
new
PARAM_CFG_BOOL
(
true
,
wxT
(
"DisplayPola
i
rCoordinates"
),
wxT
(
"DisplayPolarCoordinates"
),
&
DisplayOpt
.
DisplayPolarCood
,
&
DisplayOpt
.
DisplayPolarCood
,
false
)
);
false
)
);
...
@@ -108,7 +108,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
...
@@ -108,7 +108,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
// List of keywords used as identifiers in config
// List of keywords used as identifiers in config
// they *must* be static const and not temporary created,
// they *must* be static const and not temporary created,
// because the parameter list that use
d
these keywords does not store them,
// because the parameter list that use these keywords does not store them,
// just points on them
// just points on them
static
const
wxChar
*
keys
[
32
]
=
static
const
wxChar
*
keys
[
32
]
=
{
{
...
...
gerbview/gerbview_frame.cpp
View file @
a97f5c25
...
@@ -29,99 +29,6 @@ const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) );
...
@@ -29,99 +29,6 @@ const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) );
/* class GERBVIEW_FRAME for GerbView*/
/* class GERBVIEW_FRAME for GerbView*/
/****************************************/
/****************************************/
BEGIN_EVENT_TABLE
(
GERBVIEW_FRAME
,
PCB_BASE_FRAME
)
EVT_CLOSE
(
GERBVIEW_FRAME
::
OnCloseWindow
)
EVT_SIZE
(
GERBVIEW_FRAME
::
OnSize
)
EVT_TOOL
(
wxID_FILE
,
GERBVIEW_FRAME
::
Files_io
)
EVT_TOOL
(
ID_INC_LAYER_AND_APPEND_FILE
,
GERBVIEW_FRAME
::
Files_io
)
EVT_TOOL
(
ID_GERBVIEW_LOAD_DRILL_FILE
,
GERBVIEW_FRAME
::
Files_io
)
EVT_TOOL
(
ID_GERBVIEW_LOAD_DCODE_FILE
,
GERBVIEW_FRAME
::
Files_io
)
EVT_TOOL
(
ID_NEW_BOARD
,
GERBVIEW_FRAME
::
Files_io
)
// Menu Files:
EVT_MENU
(
wxID_FILE
,
GERBVIEW_FRAME
::
Files_io
)
EVT_MENU
(
ID_MENU_INC_LAYER_AND_APPEND_FILE
,
GERBVIEW_FRAME
::
Files_io
)
EVT_MENU
(
ID_NEW_BOARD
,
GERBVIEW_FRAME
::
Files_io
)
EVT_MENU
(
ID_GEN_PLOT
,
GERBVIEW_FRAME
::
ToPlotter
)
EVT_MENU
(
ID_GERBVIEW_EXPORT_TO_PCBNEW
,
GERBVIEW_FRAME
::
ExportDataInPcbnewFormat
)
EVT_MENU_RANGE
(
wxID_FILE1
,
wxID_FILE9
,
GERBVIEW_FRAME
::
OnFileHistory
)
EVT_MENU
(
ID_EXIT
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
// menu Preferences
EVT_MENU_RANGE
(
ID_PREFERENCES_HOTKEY_START
,
ID_PREFERENCES_HOTKEY_END
,
GERBVIEW_FRAME
::
Process_Config
)
EVT_MENU
(
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG
,
GERBVIEW_FRAME
::
OnSelectOptionToolbar
)
EVT_MENU
(
ID_GERBVIEW_OPTIONS_SETUP
,
GERBVIEW_FRAME
::
InstallGerberOptionsDialog
)
EVT_MENU_RANGE
(
ID_LANGUAGE_CHOICE
,
ID_LANGUAGE_CHOICE_END
,
EDA_DRAW_FRAME
::
SetLanguage
)
// menu Postprocess
EVT_MENU
(
ID_GERBVIEW_SHOW_LIST_DCODES
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
EVT_MENU
(
ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
EVT_MENU
(
ID_GERBVIEW_SHOW_SOURCE
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
EVT_MENU
(
ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR
,
EDA_BASE_FRAME
::
OnSelectPreferredEditor
)
// menu Miscellaneous
EVT_MENU
(
ID_GERBVIEW_GLOBAL_DELETE
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
// Menu Help
EVT_MENU
(
ID_GENERAL_HELP
,
EDA_DRAW_FRAME
::
GetKicadHelp
)
EVT_MENU
(
ID_KICAD_ABOUT
,
EDA_DRAW_FRAME
::
GetKicadAbout
)
EVT_TOOL
(
wxID_CUT
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_COPY
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_PASTE
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_UNDO
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_PRINT
,
GERBVIEW_FRAME
::
ToPrinter
)
EVT_TOOL
(
ID_FIND_ITEMS
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
EVT_KICAD_CHOICEBOX
(
ID_TOOLBARH_GERBVIEW_SELECT_LAYER
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
EVT_SELECT_DCODE
(
ID_TOOLBARH_GERBER_SELECT_TOOL
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
// Vertical toolbar:
EVT_TOOL
(
ID_NO_TOOL_SELECTED
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
EVT_MENU_RANGE
(
ID_POPUP_GENERAL_START_RANGE
,
ID_POPUP_GENERAL_END_RANGE
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
// Pop up menu
EVT_MENU
(
ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
// Option toolbar
EVT_TOOL
(
ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH
,
GERBVIEW_FRAME
::
OnSelectOptionToolbar
)
EVT_TOOL
(
ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH
,
GERBVIEW_FRAME
::
OnSelectOptionToolbar
)
EVT_TOOL
(
ID_TB_OPTIONS_SHOW_LINES_SKETCH
,
GERBVIEW_FRAME
::
OnSelectOptionToolbar
)
EVT_TOOL
(
ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR
,
GERBVIEW_FRAME
::
OnSelectOptionToolbar
)
EVT_TOOL
(
ID_TB_OPTIONS_SHOW_DCODES
,
GERBVIEW_FRAME
::
OnSelectOptionToolbar
)
EVT_TOOL_RANGE
(
ID_TB_OPTIONS_SHOW_GBR_MODE_0
,
ID_TB_OPTIONS_SHOW_GBR_MODE_2
,
GERBVIEW_FRAME
::
OnSelectDisplayMode
)
EVT_UPDATE_UI
(
ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH
,
GERBVIEW_FRAME
::
OnUpdateFlashedItemsDrawMode
)
EVT_UPDATE_UI
(
ID_TB_OPTIONS_SHOW_LINES_SKETCH
,
GERBVIEW_FRAME
::
OnUpdateLinesDrawMode
)
EVT_UPDATE_UI
(
ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH
,
GERBVIEW_FRAME
::
OnUpdatePolygonsDrawMode
)
EVT_UPDATE_UI
(
ID_TB_OPTIONS_SHOW_DCODES
,
GERBVIEW_FRAME
::
OnUpdateShowDCodes
)
EVT_UPDATE_UI
(
ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR
,
GERBVIEW_FRAME
::
OnUpdateShowLayerManager
)
EVT_UPDATE_UI
(
ID_TOOLBARH_GERBER_SELECT_TOOL
,
GERBVIEW_FRAME
::
OnUpdateSelectDCode
)
EVT_UPDATE_UI
(
ID_TOOLBARH_GERBVIEW_SELECT_LAYER
,
GERBVIEW_FRAME
::
OnUpdateLayerSelectBox
)
EVT_UPDATE_UI_RANGE
(
ID_TB_OPTIONS_SHOW_GBR_MODE_0
,
ID_TB_OPTIONS_SHOW_GBR_MODE_2
,
GERBVIEW_FRAME
::
OnUpdateDrawMode
)
END_EVENT_TABLE
()
GERBVIEW_FRAME
::
GERBVIEW_FRAME
(
wxWindow
*
father
,
GERBVIEW_FRAME
::
GERBVIEW_FRAME
(
wxWindow
*
father
,
const
wxString
&
title
,
const
wxString
&
title
,
...
@@ -463,23 +370,6 @@ void GERBVIEW_FRAME::syncLayerBox()
...
@@ -463,23 +370,6 @@ void GERBVIEW_FRAME::syncLayerBox()
}
}
/**
* Function SetLanguage
* called on a language menu selection
* Update Layer manager title and tabs texts
*/
void
GERBVIEW_FRAME
::
SetLanguage
(
wxCommandEvent
&
event
)
{
EDA_DRAW_FRAME
::
SetLanguage
(
event
);
m_LayersManager
->
SetLayersManagerTabsText
();
wxAuiPaneInfo
&
pane_info
=
m_auimgr
.
GetPane
(
m_LayersManager
);
pane_info
.
Caption
(
_
(
"Visibles"
)
);
m_auimgr
.
Update
();
ReFillLayerWidget
();
}
void
GERBVIEW_FRAME
::
Liste_D_Codes
()
void
GERBVIEW_FRAME
::
Liste_D_Codes
()
{
{
int
ii
,
jj
;
int
ii
,
jj
;
...
@@ -487,7 +377,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
...
@@ -487,7 +377,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
wxString
Line
;
wxString
Line
;
WinEDA_TextFrame
*
List
;
WinEDA_TextFrame
*
List
;
int
scale
=
10000
;
int
scale
=
10000
;
int
curr_layer
=
GetScreen
()
->
m_Active_Layer
;
int
curr_layer
=
getActiveLayer
()
;
List
=
new
WinEDA_TextFrame
(
this
,
_
(
"List D codes"
)
);
List
=
new
WinEDA_TextFrame
(
this
,
_
(
"List D codes"
)
);
...
@@ -556,7 +446,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
...
@@ -556,7 +446,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
*/
*/
void
GERBVIEW_FRAME
::
UpdateTitleAndInfo
()
void
GERBVIEW_FRAME
::
UpdateTitleAndInfo
()
{
{
GERBER_IMAGE
*
gerber
=
g_GERBER_List
[
GetScreen
()
->
m_Active_Layer
];
GERBER_IMAGE
*
gerber
=
g_GERBER_List
[
getActiveLayer
()
];
wxString
text
;
wxString
text
;
// Display the gerber filename
// Display the gerber filename
...
@@ -565,7 +455,7 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
...
@@ -565,7 +455,7 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
text
=
wxGetApp
().
GetAppName
()
+
wxT
(
" "
)
+
GetBuildVersion
();
text
=
wxGetApp
().
GetAppName
()
+
wxT
(
" "
)
+
GetBuildVersion
();
SetTitle
(
text
);
SetTitle
(
text
);
SetStatusText
(
wxEmptyString
,
0
);
SetStatusText
(
wxEmptyString
,
0
);
text
.
Printf
(
_
(
"Layer %d not in use"
),
GetScreen
()
->
m_Active_Layer
+
1
);
text
.
Printf
(
_
(
"Layer %d not in use"
),
getActiveLayer
()
+
1
);
m_TextInfo
->
SetValue
(
text
);
m_TextInfo
->
SetValue
(
text
);
ClearMsgPanel
();
ClearMsgPanel
();
return
;
return
;
...
@@ -593,29 +483,3 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
...
@@ -593,29 +483,3 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
m_TextInfo
->
SetValue
(
text
);
m_TextInfo
->
SetValue
(
text
);
}
}
/* Function OnSelectDisplayMode: called to select display mode
* (fast display, or exact mode with stacked images or with transparency
*/
void
GERBVIEW_FRAME
::
OnSelectDisplayMode
(
wxCommandEvent
&
event
)
{
int
oldMode
=
GetDisplayMode
();
switch
(
event
.
GetId
()
)
{
case
ID_TB_OPTIONS_SHOW_GBR_MODE_0
:
SetDisplayMode
(
0
);
break
;
case
ID_TB_OPTIONS_SHOW_GBR_MODE_1
:
SetDisplayMode
(
1
);
break
;
case
ID_TB_OPTIONS_SHOW_GBR_MODE_2
:
SetDisplayMode
(
2
);
break
;
}
if
(
GetDisplayMode
()
!=
oldMode
)
DrawPanel
->
Refresh
();
}
gerbview/gerbview_frame.h
View file @
a97f5c25
...
@@ -16,27 +16,6 @@
...
@@ -16,27 +16,6 @@
#define NO_AVAILABLE_LAYERS -1
#define NO_AVAILABLE_LAYERS -1
/**
* Command IDs for the gerber file viewer.
*
* Please add IDs that are unique to the gerber file viewer here and not in the
* global id.h file. This will prevent the entire project from being rebuilt
* when adding new command to the gerber file viewer.
*/
enum
id_gerbview_frm
{
// A MenuItem ID of Zero does not work under Mac,first id = 1
ID_GERBVIEW_SHOW_LIST_DCODES
=
1
,
ID_GERBVIEW_LOAD_DRILL_FILE
,
ID_GERBVIEW_LOAD_DCODE_FILE
,
ID_TOOLBARH_GERBER_SELECT_TOOL
,
ID_MENU_INC_LAYER_AND_APPEND_FILE
,
ID_INC_LAYER_AND_APPEND_FILE
,
ID_GERBVIEW_SHOW_SOURCE
,
ID_GERBVIEW_EXPORT_TO_PCBNEW
,
ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS
};
class
DCODE_SELECTION_BOX
;
class
DCODE_SELECTION_BOX
;
...
@@ -81,6 +60,17 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
...
@@ -81,6 +60,17 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
void
OnCloseWindow
(
wxCloseEvent
&
Event
);
void
OnCloseWindow
(
wxCloseEvent
&
Event
);
// Virtual basic functions:
void
RedrawActiveWindow
(
wxDC
*
DC
,
bool
EraseBg
);
void
ReCreateHToolbar
();
void
ReCreateVToolbar
();
void
ReCreateOptToolbar
();
void
ReCreateMenuBar
();
void
OnLeftClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
);
void
OnLeftDClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
);
bool
OnRightClick
(
const
wxPoint
&
MousePos
,
wxMenu
*
PopMenu
);
int
BestZoom
();
/**
/**
* Function ReportMessage
* Function ReportMessage
* Add a message (a string) in message list
* Add a message (a string) in message list
...
@@ -287,17 +277,23 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
...
@@ -287,17 +277,23 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
virtual
void
SetLanguage
(
wxCommandEvent
&
event
);
virtual
void
SetLanguage
(
wxCommandEvent
&
event
);
void
Process_Special_Functions
(
wxCommandEvent
&
event
);
void
Process_Special_Functions
(
wxCommandEvent
&
event
);
void
RedrawActiveWindow
(
wxDC
*
DC
,
bool
EraseBg
);
void
ReCreateHToolbar
();
void
ReCreateVToolbar
();
void
ReCreateOptToolbar
();
void
ReCreateMenuBar
();
void
OnLeftClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
);
void
OnLeftDClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
);
bool
OnRightClick
(
const
wxPoint
&
MousePos
,
wxMenu
*
PopMenu
);
int
BestZoom
();
void
OnSelectOptionToolbar
(
wxCommandEvent
&
event
);
void
OnSelectOptionToolbar
(
wxCommandEvent
&
event
);
/**
* Function OnSelectActiveLayer
* Selects the active layer:
* - if a file is loaded, it is loaded in this layer
* _ this layer is displayed on top of other layers
*/
void
OnSelectActiveLayer
(
wxCommandEvent
&
event
);
/**
* Function OnShowGerberSourceFile
* Call the preferred editor to show (and edit) the gerber source file
* loaded in the active layer
*/
void
OnShowGerberSourceFile
(
wxCommandEvent
&
event
);
/**
/**
* Function OnSelectDisplayMode
* Function OnSelectDisplayMode
* called on a display mode selection
* called on a display mode selection
...
@@ -305,6 +301,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
...
@@ -305,6 +301,7 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
* or exact mode with stacked images or with transparency
* or exact mode with stacked images or with transparency
*/
*/
void
OnSelectDisplayMode
(
wxCommandEvent
&
event
);
void
OnSelectDisplayMode
(
wxCommandEvent
&
event
);
void
OnHotKey
(
wxDC
*
DC
,
int
hotkey
,
EDA_ITEM
*
DrawStruct
);
void
OnHotKey
(
wxDC
*
DC
,
int
hotkey
,
EDA_ITEM
*
DrawStruct
);
GERBER_DRAW_ITEM
*
GerberGeneralLocateAndDisplay
();
GERBER_DRAW_ITEM
*
GerberGeneralLocateAndDisplay
();
...
...
gerbview/gerbview_id.h
View file @
a97f5c25
...
@@ -15,10 +15,19 @@ enum gerbview_ids
...
@@ -15,10 +15,19 @@ enum gerbview_ids
{
{
ID_MAIN_MENUBAR
=
ID_END_LIST
,
ID_MAIN_MENUBAR
=
ID_END_LIST
,
ID_GERBVIEW_SHOW_LIST_DCODES
=
1
,
ID_GERBVIEW_LOAD_DRILL_FILE
,
ID_GERBVIEW_LOAD_DCODE_FILE
,
ID_TOOLBARH_GERBER_SELECT_TOOL
,
ID_MENU_INC_LAYER_AND_APPEND_FILE
,
ID_INC_LAYER_AND_APPEND_FILE
,
ID_GERBVIEW_SHOW_SOURCE
,
ID_GERBVIEW_EXPORT_TO_PCBNEW
,
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG
,
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG
,
ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR
,
ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR
,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER
,
ID_TOOLBARH_GERBVIEW_SELECT_
ACTIVE_
LAYER
,
ID_GERBVIEW_GLOBAL_DELETE
,
ID_GERBVIEW_GLOBAL_DELETE
,
ID_GERBVIEW_OPTIONS_SETUP
,
ID_GERBVIEW_OPTIONS_SETUP
,
ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR
,
ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR
,
...
...
gerbview/hotkeys.cpp
View file @
a97f5c25
...
@@ -4,10 +4,11 @@
...
@@ -4,10 +4,11 @@
#include "fctsys.h"
#include "fctsys.h"
#include "common.h"
#include "common.h"
#include "
hotkeys
.h"
#include "
kicad_device_context
.h"
#include "gerbview.h"
#include "gerbview.h"
#include "class_drawpanel.h"
#include "class_drawpanel.h"
#include "hotkeys.h"
/* 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.
...
@@ -139,13 +140,19 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
...
@@ -139,13 +140,19 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
break
;
break
;
case
HK_SWITCH_LAYER_TO_PREVIOUS
:
case
HK_SWITCH_LAYER_TO_PREVIOUS
:
if
(
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
>
0
)
if
(
getActiveLayer
()
>
0
)
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
--
;
{
setActiveLayer
(
getActiveLayer
()
-
1
);
DrawPanel
->
Refresh
();
}
break
;
break
;
case
HK_SWITCH_LAYER_TO_NEXT
:
case
HK_SWITCH_LAYER_TO_NEXT
:
if
(
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
<
31
)
if
(
getActiveLayer
()
<
31
)
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
++
;
{
setActiveLayer
(
getActiveLayer
()
+
1
);
DrawPanel
->
Refresh
();
}
break
;
break
;
}
}
}
}
gerbview/locate.cpp
View file @
a97f5c25
...
@@ -19,7 +19,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
...
@@ -19,7 +19,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
if
(
aTypeloc
==
CURSEUR_ON_GRILLE
)
if
(
aTypeloc
==
CURSEUR_ON_GRILLE
)
ref
=
GetScreen
()
->
GetNearestGridPosition
(
ref
);
ref
=
GetScreen
()
->
GetNearestGridPosition
(
ref
);
int
layer
=
GetScreen
()
->
m_Active_Layer
;
int
layer
=
getActiveLayer
()
;
// Search first on active layer
// Search first on active layer
BOARD_ITEM
*
item
=
GetBoard
()
->
m_Drawings
;
BOARD_ITEM
*
item
=
GetBoard
()
->
m_Drawings
;
...
...
gerbview/onleftclick.cpp
0 → 100644
View file @
a97f5c25
/******************************************************************/
/* onleftclick.cpp: functions called on left or double left click */
/******************************************************************/
#include "fctsys.h"
#include "class_drawpanel.h"
#include "common.h"
//#include "gestfich.h"
//#include "appl_wxstruct.h"
#include "gerbview.h"
//#include "pcbplot.h"
//#include "kicad_device_context.h"
#include "gerbview_id.h"
#include "class_GERBER.h"
#include "dialog_helpers.h"
#include "class_DCodeSelectionbox.h"
/* Process the command triggered by the left button of the mouse when a tool
* is already selected.
*/
void
GERBVIEW_FRAME
::
OnLeftClick
(
wxDC
*
DC
,
const
wxPoint
&
aPosition
)
{
BOARD_ITEM
*
DrawStruct
=
GetScreen
()
->
GetCurItem
();
wxString
msg
;
if
(
GetToolId
()
==
ID_NO_TOOL_SELECTED
)
{
if
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
{
msg
.
Printf
(
wxT
(
"GERBVIEW_FRAME::OnLeftClick err: Struct %d, m_Flags = %X"
),
(
unsigned
)
DrawStruct
->
Type
(),
(
unsigned
)
DrawStruct
->
m_Flags
);
wxFAIL_MSG
(
msg
);
}
else
{
DrawStruct
=
Locate
(
aPosition
,
CURSEUR_OFF_GRILLE
);
GetScreen
()
->
SetCurItem
(
DrawStruct
);
if
(
DrawStruct
==
NULL
)
{
GERBER_IMAGE
*
gerber
=
g_GERBER_List
[
getActiveLayer
()
];
if
(
gerber
)
gerber
->
DisplayImageInfo
(
);
}
}
}
switch
(
GetToolId
()
)
{
case
ID_NO_TOOL_SELECTED
:
break
;
if
(
DrawStruct
==
NULL
)
break
;
default
:
wxFAIL_MSG
(
wxT
(
"GERBVIEW_FRAME::ProcessCommand error"
)
);
break
;
}
}
/* Called on a double click of left mouse button.
*/
void
GERBVIEW_FRAME
::
OnLeftDClick
(
wxDC
*
DC
,
const
wxPoint
&
aPosition
)
{
// Currently: no nothing
}
gerbview/readgerb.cpp
View file @
a97f5c25
...
@@ -26,7 +26,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
...
@@ -26,7 +26,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
char
*
text
;
char
*
text
;
int
layer
;
/* current layer used in gerbview */
int
layer
;
/* current layer used in gerbview */
layer
=
GetScreen
()
->
m_Active_Layer
;
layer
=
getActiveLayer
()
;
if
(
g_GERBER_List
[
layer
]
==
NULL
)
if
(
g_GERBER_List
[
layer
]
==
NULL
)
{
{
...
...
gerbview/rs274d.cpp
View file @
a97f5c25
...
@@ -570,7 +570,7 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
...
@@ -570,7 +570,7 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
GERBER_DRAW_ITEM
*
gbritem
;
GERBER_DRAW_ITEM
*
gbritem
;
BOARD
*
pcb
=
m_Parent
->
GetBoard
();
BOARD
*
pcb
=
m_Parent
->
GetBoard
();
int
activeLayer
=
m_Parent
->
GetScreen
()
->
m_Active_Layer
;
int
activeLayer
=
m_Parent
->
getActiveLayer
()
;
int
dcode
=
0
;
int
dcode
=
0
;
D_CODE
*
tool
=
NULL
;
D_CODE
*
tool
=
NULL
;
...
...
gerbview/toolbars_gerber.cpp
View file @
a97f5c25
...
@@ -28,7 +28,7 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
...
@@ -28,7 +28,7 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
if
(
GetScreen
()
)
if
(
GetScreen
()
)
{
{
layer
=
GetScreen
()
->
m_Active_Layer
;
layer
=
getActiveLayer
()
;
gerber
=
g_GERBER_List
[
layer
];
gerber
=
g_GERBER_List
[
layer
];
}
}
...
@@ -70,7 +70,7 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
...
@@ -70,7 +70,7 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
choices
.
Add
(
msg
);
choices
.
Add
(
msg
);
}
}
m_SelLayerBox
=
new
WinEDALayerChoiceBox
(
m_HToolBar
,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER
,
m_SelLayerBox
=
new
WinEDALayerChoiceBox
(
m_HToolBar
,
ID_TOOLBARH_GERBVIEW_SELECT_
ACTIVE_
LAYER
,
wxDefaultPosition
,
wxSize
(
150
,
-
1
),
choices
);
wxDefaultPosition
,
wxSize
(
150
,
-
1
),
choices
);
m_HToolBar
->
AddControl
(
m_SelLayerBox
);
m_HToolBar
->
AddControl
(
m_SelLayerBox
);
...
@@ -260,7 +260,7 @@ void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
...
@@ -260,7 +260,7 @@ void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
void
GERBVIEW_FRAME
::
OnUpdateSelectDCode
(
wxUpdateUIEvent
&
aEvent
)
void
GERBVIEW_FRAME
::
OnUpdateSelectDCode
(
wxUpdateUIEvent
&
aEvent
)
{
{
int
layer
=
GetScreen
()
->
m_Active_Layer
;
int
layer
=
getActiveLayer
()
;
GERBER_IMAGE
*
gerber
=
g_GERBER_List
[
layer
];
GERBER_IMAGE
*
gerber
=
g_GERBER_List
[
layer
];
int
selected
=
(
gerber
)
?
gerber
->
m_Selected_Tool
:
0
;
int
selected
=
(
gerber
)
?
gerber
->
m_Selected_Tool
:
0
;
...
@@ -273,8 +273,8 @@ void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
...
@@ -273,8 +273,8 @@ void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
void
GERBVIEW_FRAME
::
OnUpdateLayerSelectBox
(
wxUpdateUIEvent
&
aEvent
)
void
GERBVIEW_FRAME
::
OnUpdateLayerSelectBox
(
wxUpdateUIEvent
&
aEvent
)
{
{
if
(
m_SelLayerBox
&&
(
m_SelLayerBox
->
GetSelection
()
!=
GetScreen
()
->
m_Active_Layer
)
)
if
(
m_SelLayerBox
&&
(
m_SelLayerBox
->
GetSelection
()
!=
getActiveLayer
()
)
)
{
{
m_SelLayerBox
->
SetSelection
(
GetScreen
()
->
m_Active_Layer
);
m_SelLayerBox
->
SetSelection
(
getActiveLayer
()
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment