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
c3d76bf3
Commit
c3d76bf3
authored
Aug 29, 2010
by
Marco Mattila
Committed by
Dick Hollenbeck
Aug 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
https://lists.launchpad.net/kicad-developers/msg05225.html
parent
9c575a7f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
248 additions
and
13 deletions
+248
-13
hotkeys.cpp
pcbnew/hotkeys.cpp
+207
-1
modedit_onclick.cpp
pcbnew/modedit_onclick.cpp
+37
-12
module_editor_frame.h
pcbnew/module_editor_frame.h
+4
-0
No files found.
pcbnew/hotkeys.cpp
View file @
c3d76bf3
...
@@ -171,7 +171,11 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] =
...
@@ -171,7 +171,11 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] =
};
};
// List of hotkey descriptors for the module editor
// List of hotkey descriptors for the module editor
Ki_HotkeyInfo
*
s_module_edit_Hotkey_List
[]
=
{
NULL
};
Ki_HotkeyInfo
*
s_module_edit_Hotkey_List
[]
=
{
&
HkMoveItem
,
&
HkRotateItem
,
&
HkEditBoardItem
,
&
HkDelete
,
NULL
};
// 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_Pcbnew_Editor_Hokeys_Descr
[]
=
struct
Ki_HotkeyInfoSectionDescriptor
s_Pcbnew_Editor_Hokeys_Descr
[]
=
...
@@ -635,9 +639,211 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey,
...
@@ -635,9 +639,211 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey,
cmd
.
SetId
(
ID_ZOOM_PAGE
);
cmd
.
SetId
(
ID_ZOOM_PAGE
);
GetEventHandler
()
->
ProcessEvent
(
cmd
);
GetEventHandler
()
->
ProcessEvent
(
cmd
);
break
;
break
;
case
HK_EDIT_ITEM
:
OnHotkeyEditItem
(
HK_EDIT_ITEM
);
break
;
case
HK_DELETE
:
OnHotkeyDeleteItem
(
HK_DELETE
);
break
;
case
HK_MOVE_ITEM
:
OnHotkeyMoveItem
(
HK_MOVE_ITEM
);
break
;
case
HK_ROTATE_ITEM
:
OnHotkeyRotateItem
(
HK_ROTATE_ITEM
);
break
;
}
}
bool
WinEDA_ModuleEditFrame
::
OnHotkeyEditItem
(
int
aIdCommand
)
{
BOARD_ITEM
*
item
=
GetCurItem
();
bool
itemCurrentlyEdited
=
item
&&
item
->
m_Flags
;
if
(
itemCurrentlyEdited
)
return
false
;
item
=
ModeditLocateAndDisplay
();
if
(
item
==
NULL
)
return
false
;
SetCurItem
(
item
);
int
evt_type
=
0
;
//Used to post a wxCommandEvent on demand
switch
(
item
->
Type
()
)
{
case
TYPE_MODULE
:
if
(
aIdCommand
==
HK_EDIT_ITEM
)
evt_type
=
ID_POPUP_PCB_EDIT_MODULE
;
break
;
case
TYPE_PAD
:
if
(
aIdCommand
==
HK_EDIT_ITEM
)
evt_type
=
ID_POPUP_PCB_EDIT_PAD
;
break
;
case
TYPE_TEXTE_MODULE
:
if
(
aIdCommand
==
HK_EDIT_ITEM
)
evt_type
=
ID_POPUP_PCB_EDIT_TEXTMODULE
;
break
;
default
:
break
;
}
if
(
evt_type
!=
0
)
{
wxCommandEvent
evt
(
wxEVT_COMMAND_MENU_SELECTED
);
evt
.
SetEventObject
(
this
);
evt
.
SetId
(
evt_type
);
wxPostEvent
(
this
,
evt
);
return
true
;
}
}
return
false
;
}
}
bool
WinEDA_ModuleEditFrame
::
OnHotkeyDeleteItem
(
int
aIdCommand
)
{
BOARD_ITEM
*
item
=
GetCurItem
();
bool
itemCurrentlyEdited
=
item
&&
item
->
m_Flags
;
if
(
itemCurrentlyEdited
)
return
false
;
item
=
ModeditLocateAndDisplay
();
if
(
item
==
NULL
)
return
false
;
SetCurItem
(
item
);
int
evt_type
=
0
;
//Used to post a wxCommandEvent on demand
switch
(
item
->
Type
()
)
{
case
TYPE_PAD
:
if
(
aIdCommand
==
HK_DELETE
)
evt_type
=
ID_POPUP_PCB_DELETE_PAD
;
break
;
case
TYPE_TEXTE_MODULE
:
if
(
aIdCommand
==
HK_DELETE
)
evt_type
=
ID_POPUP_PCB_DELETE_TEXTMODULE
;
break
;
case
TYPE_EDGE_MODULE
:
if
(
aIdCommand
==
HK_DELETE
)
evt_type
=
ID_POPUP_PCB_DELETE_EDGE
;
break
;
default
:
break
;
}
if
(
evt_type
!=
0
)
{
wxCommandEvent
evt
(
wxEVT_COMMAND_MENU_SELECTED
);
evt
.
SetEventObject
(
this
);
evt
.
SetId
(
evt_type
);
wxPostEvent
(
this
,
evt
);
return
true
;
}
return
false
;
}
bool
WinEDA_ModuleEditFrame
::
OnHotkeyMoveItem
(
int
aIdCommand
)
{
BOARD_ITEM
*
item
=
GetCurItem
();
bool
itemCurrentlyEdited
=
item
&&
item
->
m_Flags
;
if
(
itemCurrentlyEdited
)
return
false
;
item
=
ModeditLocateAndDisplay
();
if
(
item
==
NULL
)
return
false
;
SetCurItem
(
item
);
int
evt_type
=
0
;
//Used to post a wxCommandEvent on demand
switch
(
item
->
Type
()
)
{
case
TYPE_PAD
:
if
(
aIdCommand
==
HK_MOVE_ITEM
)
evt_type
=
ID_POPUP_PCB_MOVE_PAD_REQUEST
;
break
;
case
TYPE_TEXTE_MODULE
:
if
(
aIdCommand
==
HK_MOVE_ITEM
)
evt_type
=
ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST
;
break
;
case
TYPE_EDGE_MODULE
:
if
(
aIdCommand
==
HK_MOVE_ITEM
)
evt_type
=
ID_POPUP_PCB_MOVE_EDGE
;
break
;
default
:
break
;
}
if
(
evt_type
!=
0
)
{
wxCommandEvent
evt
(
wxEVT_COMMAND_MENU_SELECTED
);
evt
.
SetEventObject
(
this
);
evt
.
SetId
(
evt_type
);
wxPostEvent
(
this
,
evt
);
return
true
;
}
return
false
;
}
bool
WinEDA_ModuleEditFrame
::
OnHotkeyRotateItem
(
int
aIdCommand
)
{
BOARD_ITEM
*
item
=
GetCurItem
();
bool
itemCurrentlyEdited
=
item
&&
item
->
m_Flags
;
int
evt_type
=
0
;
// Used to post a wxCommandEvent on demand
if
(
!
itemCurrentlyEdited
)
item
=
ModeditLocateAndDisplay
();
if
(
item
==
NULL
)
return
false
;
SetCurItem
(
item
);
switch
(
item
->
Type
()
)
{
case
TYPE_TEXTE_MODULE
:
if
(
aIdCommand
==
HK_ROTATE_ITEM
)
// Rotation
evt_type
=
ID_POPUP_PCB_ROTATE_TEXTMODULE
;
break
;
default
:
break
;
}
if
(
evt_type
!=
0
)
{
wxCommandEvent
evt
(
wxEVT_COMMAND_MENU_SELECTED
);
evt
.
SetEventObject
(
this
);
evt
.
SetId
(
evt_type
);
wxPostEvent
(
this
,
evt
);
return
true
;
}
return
false
;
}
/** Function OnHotkeyDeleteItem
/** Function OnHotkeyDeleteItem
* Delete the item found under the mouse cursor
* Delete the item found under the mouse cursor
...
...
pcbnew/modedit_onclick.cpp
View file @
c3d76bf3
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "protos.h"
#include "protos.h"
#include "pcbnew_id.h"
#include "pcbnew_id.h"
#include "hotkeys.h"
/* Handle the left click in footprint editor
/* Handle the left click in footprint editor
*/
*/
...
@@ -264,8 +265,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -264,8 +265,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
_
(
"Rotate"
),
rotate_module_pos_xpm
);
_
(
"Rotate"
),
rotate_module_pos_xpm
);
ADD_MENUITEM
(
transform_choice
,
ID_MODEDIT_MODULE_MIRROR
,
ADD_MENUITEM
(
transform_choice
,
ID_MODEDIT_MODULE_MIRROR
,
_
(
"Mirror"
),
mirror_H_xpm
);
_
(
"Mirror"
),
mirror_H_xpm
);
msg
=
AddHotkeyName
(
_
(
"Edit Module"
),
s_Module_Editor_Hokeys_Descr
,
HK_EDIT_ITEM
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EDIT_MODULE
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EDIT_MODULE
,
_
(
"Edit Module"
)
,
edit_module_xpm
);
msg
,
edit_module_xpm
);
ADD_MENUITEM_WITH_SUBMENU
(
PopMenu
,
transform_choice
,
ADD_MENUITEM_WITH_SUBMENU
(
PopMenu
,
transform_choice
,
ID_MODEDIT_TRANSFORM_MODULE
,
ID_MODEDIT_TRANSFORM_MODULE
,
_
(
"Transform Module"
),
edit_xpm
);
_
(
"Transform Module"
),
edit_xpm
);
...
@@ -275,17 +278,23 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -275,17 +278,23 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
case
TYPE_PAD
:
case
TYPE_PAD
:
if
(
!
flags
)
if
(
!
flags
)
{
{
msg
=
AddHotkeyName
(
_
(
"Move Pad"
),
s_Module_Editor_Hokeys_Descr
,
HK_MOVE_ITEM
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_MOVE_PAD_REQUEST
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_MOVE_PAD_REQUEST
,
_
(
"Move Pad"
)
,
move_pad_xpm
);
msg
,
move_pad_xpm
);
}
}
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EDIT_PAD
,
_
(
"Edit Pad"
),
msg
=
AddHotkeyName
(
_
(
"Edit Pad"
),
s_Module_Editor_Hokeys_Descr
,
options_pad_xpm
);
HK_EDIT_ITEM
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EDIT_PAD
,
msg
,
options_pad_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_IMPORT_PAD_SETTINGS
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_IMPORT_PAD_SETTINGS
,
_
(
"New Pad Settings"
),
options_new_pad_xpm
);
_
(
"New Pad Settings"
),
options_new_pad_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EXPORT_PAD_SETTINGS
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EXPORT_PAD_SETTINGS
,
_
(
"Export Pad Settings"
),
export_options_pad_xpm
);
_
(
"Export Pad Settings"
),
export_options_pad_xpm
);
msg
=
AddHotkeyName
(
_
(
"Delete Pad"
),
s_Module_Editor_Hokeys_Descr
,
HK_DELETE
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_DELETE_PAD
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_DELETE_PAD
,
_
(
"delete Pad"
)
,
delete_pad_xpm
);
msg
,
delete_pad_xpm
);
if
(
!
flags
)
if
(
!
flags
)
{
{
PopMenu
->
AppendSeparator
();
PopMenu
->
AppendSeparator
();
...
@@ -297,18 +306,28 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -297,18 +306,28 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
case
TYPE_TEXTE_MODULE
:
case
TYPE_TEXTE_MODULE
:
if
(
!
flags
)
if
(
!
flags
)
{
{
msg
=
AddHotkeyName
(
_
(
"Move Text Mod."
),
s_Module_Editor_Hokeys_Descr
,
HK_MOVE_ITEM
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST
,
_
(
"Move Text Mod."
)
,
move_field_xpm
);
msg
,
move_field_xpm
);
}
}
msg
=
AddHotkeyName
(
_
(
"Rotate Text Mod."
),
s_Module_Editor_Hokeys_Descr
,
HK_ROTATE_ITEM
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_ROTATE_TEXTMODULE
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_ROTATE_TEXTMODULE
,
_
(
"Rotate Text Mod."
)
,
rotate_field_xpm
);
msg
,
rotate_field_xpm
);
if
(
!
flags
)
if
(
!
flags
)
{
{
msg
=
AddHotkeyName
(
_
(
"Edit Text Mod."
),
s_Module_Editor_Hokeys_Descr
,
HK_EDIT_ITEM
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EDIT_TEXTMODULE
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EDIT_TEXTMODULE
,
_
(
"Edit Text Mod."
)
,
edit_text_xpm
);
msg
,
edit_text_xpm
);
if
(
(
(
TEXTE_MODULE
*
)
DrawStruct
)
->
m_Type
==
TEXT_is_DIVERS
)
if
(
(
(
TEXTE_MODULE
*
)
DrawStruct
)
->
m_Type
==
TEXT_is_DIVERS
)
{
msg
=
AddHotkeyName
(
_
(
"Delete Text Mod."
),
s_Module_Editor_Hokeys_Descr
,
HK_DELETE
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_DELETE_TEXTMODULE
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_DELETE_TEXTMODULE
,
_
(
"Delete Text Mod."
),
delete_text_xpm
);
msg
,
delete_text_xpm
);
}
}
}
break
;
break
;
...
@@ -318,8 +337,12 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -318,8 +337,12 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_STOP_CURRENT_DRAWING
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_STOP_CURRENT_DRAWING
,
_
(
"End edge"
),
apply_xpm
);
_
(
"End edge"
),
apply_xpm
);
if
(
!
flags
)
if
(
!
flags
)
{
msg
=
AddHotkeyName
(
_
(
"Move edge"
),
s_Module_Editor_Hokeys_Descr
,
HK_MOVE_ITEM
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_MOVE_EDGE
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_MOVE_EDGE
,
_
(
"Move edge"
),
move_line_xpm
);
msg
,
move_line_xpm
);
}
if
(
(
flags
&
(
IS_NEW
|
IS_MOVED
)
)
==
IS_MOVED
)
if
(
(
flags
&
(
IS_NEW
|
IS_MOVED
)
)
==
IS_MOVED
)
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_PLACE_EDGE
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_PLACE_EDGE
,
_
(
"Place edge"
),
apply_xpm
);
_
(
"Place edge"
),
apply_xpm
);
...
@@ -335,8 +358,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -335,8 +358,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
_
(
"Edit Layer (Current)"
),
select_layer_pair_xpm
);
_
(
"Edit Layer (Current)"
),
select_layer_pair_xpm
);
ADD_MENUITEM
(
edit_mnu
,
ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE
,
ADD_MENUITEM
(
edit_mnu
,
ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE
,
_
(
"Edit Layer (All)"
),
select_layer_pair_xpm
);
_
(
"Edit Layer (All)"
),
select_layer_pair_xpm
);
msg
=
AddHotkeyName
(
_
(
"Delete edge"
),
s_Module_Editor_Hokeys_Descr
,
HK_DELETE
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_DELETE_EDGE
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_DELETE_EDGE
,
_
(
"Delete edge"
)
,
delete_xpm
);
msg
,
delete_xpm
);
append_set_width
=
TRUE
;
append_set_width
=
TRUE
;
}
}
break
;
break
;
...
@@ -375,7 +400,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -375,7 +400,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
||
(
m_ID_current_state
==
ID_PCB_ARC_BUTT
)
)
)
)
||
(
m_ID_current_state
==
ID_PCB_ARC_BUTT
)
)
)
)
{
{
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_ENTER_EDGE_WIDTH
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_ENTER_EDGE_WIDTH
,
_
(
"Set Width"
),
width_segment_xpm
);
_
(
"Set Width"
),
width_segment_xpm
);
PopMenu
->
AppendSeparator
();
PopMenu
->
AppendSeparator
();
}
}
...
...
pcbnew/module_editor_frame.h
View file @
c3d76bf3
...
@@ -41,6 +41,10 @@ public:
...
@@ -41,6 +41,10 @@ public:
void
ToolOnRightClick
(
wxCommandEvent
&
event
);
void
ToolOnRightClick
(
wxCommandEvent
&
event
);
void
OnSelectOptionToolbar
(
wxCommandEvent
&
event
);
void
OnSelectOptionToolbar
(
wxCommandEvent
&
event
);
void
OnHotKey
(
wxDC
*
DC
,
int
hotkey
,
EDA_BaseStruct
*
DrawStruct
);
void
OnHotKey
(
wxDC
*
DC
,
int
hotkey
,
EDA_BaseStruct
*
DrawStruct
);
bool
OnHotkeyEditItem
(
int
aIdCommand
);
bool
OnHotkeyDeleteItem
(
int
aIdCommand
);
bool
OnHotkeyMoveItem
(
int
aIdCommand
);
bool
OnHotkeyRotateItem
(
int
aIdCommand
);
void
Show3D_Frame
(
wxCommandEvent
&
event
);
void
Show3D_Frame
(
wxCommandEvent
&
event
);
void
GeneralControle
(
wxDC
*
DC
,
wxPoint
Mouse
);
void
GeneralControle
(
wxDC
*
DC
,
wxPoint
Mouse
);
...
...
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