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
f4af52f9
Commit
f4af52f9
authored
Dec 29, 2012
by
Antia Puentes
Committed by
jean-pierre charras
Dec 29, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eeschema: Allow to edit an schematic item while dragging
parent
40f4304b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
127 additions
and
38 deletions
+127
-38
dialog_edit_component_in_schematic.cpp
eeschema/dialogs/dialog_edit_component_in_schematic.cpp
+9
-0
onrightclick.cpp
eeschema/onrightclick.cpp
+77
-15
sch_screen.cpp
eeschema/sch_screen.cpp
+16
-1
schedit.cpp
eeschema/schedit.cpp
+25
-22
No files found.
eeschema/dialogs/dialog_edit_component_in_schematic.cpp
View file @
f4af52f9
...
@@ -539,6 +539,15 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
...
@@ -539,6 +539,15 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
copyOptionsToPanel
();
copyOptionsToPanel
();
// disable some options inside the edit dialog
// which can cause problems while dragging
if
(
m_Cmp
->
IsDragging
()
)
{
orientationRadioBox
->
Disable
();
mirrorRadioBox
->
Disable
();
chipnameTextCtrl
->
Disable
();
}
// put focus on the list ctrl
// put focus on the list ctrl
fieldListCtrl
->
SetFocus
();
fieldListCtrl
->
SetFocus
();
...
...
eeschema/onrightclick.cpp
View file @
f4af52f9
...
@@ -59,6 +59,7 @@ static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text );
...
@@ -59,6 +59,7 @@ static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text );
static
void
AddMenusForLabel
(
wxMenu
*
PopMenu
,
SCH_LABEL
*
Label
);
static
void
AddMenusForLabel
(
wxMenu
*
PopMenu
,
SCH_LABEL
*
Label
);
static
void
AddMenusForGLabel
(
wxMenu
*
PopMenu
,
SCH_GLOBALLABEL
*
GLabel
);
static
void
AddMenusForGLabel
(
wxMenu
*
PopMenu
,
SCH_GLOBALLABEL
*
GLabel
);
static
void
AddMenusForHLabel
(
wxMenu
*
PopMenu
,
SCH_HIERLABEL
*
GLabel
);
static
void
AddMenusForHLabel
(
wxMenu
*
PopMenu
,
SCH_HIERLABEL
*
GLabel
);
static
void
AddMenusForEditComponent
(
wxMenu
*
PopMenu
,
SCH_COMPONENT
*
Component
);
static
void
AddMenusForComponent
(
wxMenu
*
PopMenu
,
SCH_COMPONENT
*
Component
);
static
void
AddMenusForComponent
(
wxMenu
*
PopMenu
,
SCH_COMPONENT
*
Component
);
static
void
AddMenusForComponentField
(
wxMenu
*
PopMenu
,
SCH_FIELD
*
Field
);
static
void
AddMenusForComponentField
(
wxMenu
*
PopMenu
,
SCH_FIELD
*
Field
);
static
void
AddMenusForMarkers
(
wxMenu
*
aPopMenu
,
SCH_MARKER
*
aMarker
,
SCH_EDIT_FRAME
*
aFrame
);
static
void
AddMenusForMarkers
(
wxMenu
*
aPopMenu
,
SCH_MARKER
*
aMarker
,
SCH_EDIT_FRAME
*
aFrame
);
...
@@ -75,6 +76,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
...
@@ -75,6 +76,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{
{
SCH_ITEM
*
item
=
GetScreen
()
->
GetCurItem
();
SCH_ITEM
*
item
=
GetScreen
()
->
GetCurItem
();
bool
BlockActive
=
GetScreen
()
->
IsBlockActive
();
bool
BlockActive
=
GetScreen
()
->
IsBlockActive
();
wxString
msg
;
// Do not start a block command on context menu.
// Do not start a block command on context menu.
m_canvas
->
SetCanStartBlock
(
-
1
);
m_canvas
->
SetCanStartBlock
(
-
1
);
...
@@ -83,6 +85,48 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
...
@@ -83,6 +85,48 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{
{
AddMenusForBlock
(
PopMenu
,
this
);
AddMenusForBlock
(
PopMenu
,
this
);
PopMenu
->
AppendSeparator
();
PopMenu
->
AppendSeparator
();
// If we have a block containing only one main element
// we append its edition submenu
if
(
item
!=
NULL
)
{
switch
(
item
->
Type
()
)
{
case
SCH_COMPONENT_T
:
AddMenusForEditComponent
(
PopMenu
,
(
SCH_COMPONENT
*
)
item
);
PopMenu
->
AppendSeparator
();
break
;
case
SCH_TEXT_T
:
msg
=
AddHotkeyName
(
_
(
"Edit Text"
),
s_Schematic_Hokeys_Descr
,
HK_EDIT
);
AddMenuItem
(
PopMenu
,
ID_SCH_EDIT_ITEM
,
msg
,
KiBitmap
(
edit_text_xpm
)
);
PopMenu
->
AppendSeparator
();
break
;
case
SCH_LABEL_T
:
msg
=
AddHotkeyName
(
_
(
"Edit Label"
),
s_Schematic_Hokeys_Descr
,
HK_EDIT
);
AddMenuItem
(
PopMenu
,
ID_SCH_EDIT_ITEM
,
msg
,
KiBitmap
(
edit_text_xpm
)
);
PopMenu
->
AppendSeparator
();
break
;
case
SCH_GLOBAL_LABEL_T
:
msg
=
AddHotkeyName
(
_
(
"Edit Global Label"
),
s_Schematic_Hokeys_Descr
,
HK_EDIT
);
AddMenuItem
(
PopMenu
,
ID_SCH_EDIT_ITEM
,
msg
,
KiBitmap
(
edit_text_xpm
)
);
PopMenu
->
AppendSeparator
();
break
;
case
SCH_HIERARCHICAL_LABEL_T
:
msg
=
AddHotkeyName
(
_
(
"Edit Hierarchical Label"
),
s_Schematic_Hokeys_Descr
,
HK_EDIT
);
AddMenuItem
(
PopMenu
,
ID_SCH_EDIT_ITEM
,
msg
,
KiBitmap
(
edit_text_xpm
)
);
PopMenu
->
AppendSeparator
();
break
;
default
:
break
;
}
}
return
true
;
return
true
;
}
}
...
@@ -295,13 +339,9 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
...
@@ -295,13 +339,9 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
wxString
msg
;
wxString
msg
;
LIB_ALIAS
*
libEntry
;
LIB_ALIAS
*
libEntry
;
LIB_COMPONENT
*
libComponent
=
NULL
;
libEntry
=
CMP_LIBRARY
::
FindLibraryEntry
(
Component
->
GetLibName
()
);
libEntry
=
CMP_LIBRARY
::
FindLibraryEntry
(
Component
->
GetLibName
()
);
if
(
libEntry
)
libComponent
=
libEntry
->
GetComponent
();
if
(
!
Component
->
GetFlags
()
)
if
(
!
Component
->
GetFlags
()
)
{
{
msg
=
_
(
"Move Component"
);
msg
=
_
(
"Move Component"
);
...
@@ -327,6 +367,39 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
...
@@ -327,6 +367,39 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
AddMenuItem
(
PopMenu
,
orientmenu
,
ID_POPUP_SCH_GENERIC_ORIENT_CMP
,
AddMenuItem
(
PopMenu
,
orientmenu
,
ID_POPUP_SCH_GENERIC_ORIENT_CMP
,
_
(
"Orient Component"
),
KiBitmap
(
orient_xpm
)
);
_
(
"Orient Component"
),
KiBitmap
(
orient_xpm
)
);
AddMenusForEditComponent
(
PopMenu
,
Component
);
if
(
!
Component
->
GetFlags
()
)
{
msg
=
AddHotkeyName
(
_
(
"Copy Component"
),
s_Schematic_Hokeys_Descr
,
HK_COPY_COMPONENT_OR_LABEL
);
AddMenuItem
(
PopMenu
,
ID_POPUP_SCH_COPY_ITEM
,
msg
,
KiBitmap
(
copy_button_xpm
)
);
msg
=
AddHotkeyName
(
_
(
"Delete Component"
),
s_Schematic_Hokeys_Descr
,
HK_DELETE
);
AddMenuItem
(
PopMenu
,
ID_POPUP_SCH_DELETE_CMP
,
msg
,
KiBitmap
(
delete_xpm
)
);
}
if
(
libEntry
&&
!
libEntry
->
GetDocFileName
().
IsEmpty
()
)
AddMenuItem
(
PopMenu
,
ID_POPUP_SCH_DISPLAYDOC_CMP
,
_
(
"Doc"
),
KiBitmap
(
datasheet_xpm
)
);
}
void
AddMenusForEditComponent
(
wxMenu
*
PopMenu
,
SCH_COMPONENT
*
Component
)
{
if
(
Component
->
Type
()
!=
SCH_COMPONENT_T
)
{
wxASSERT
(
0
);
return
;
}
wxString
msg
;
LIB_ALIAS
*
libEntry
;
LIB_COMPONENT
*
libComponent
=
NULL
;
libEntry
=
CMP_LIBRARY
::
FindLibraryEntry
(
Component
->
GetLibName
()
);
if
(
libEntry
)
libComponent
=
libEntry
->
GetComponent
();
wxMenu
*
editmenu
=
new
wxMenu
;
wxMenu
*
editmenu
=
new
wxMenu
;
msg
=
AddHotkeyName
(
_
(
"Edit"
),
s_Schematic_Hokeys_Descr
,
HK_EDIT
);
msg
=
AddHotkeyName
(
_
(
"Edit"
),
s_Schematic_Hokeys_Descr
,
HK_EDIT
);
AddMenuItem
(
editmenu
,
ID_SCH_EDIT_ITEM
,
msg
,
KiBitmap
(
edit_component_xpm
)
);
AddMenuItem
(
editmenu
,
ID_SCH_EDIT_ITEM
,
msg
,
KiBitmap
(
edit_component_xpm
)
);
...
@@ -384,17 +457,6 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
...
@@ -384,17 +457,6 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
AddMenuItem
(
PopMenu
,
editmenu
,
ID_SCH_EDIT_ITEM
,
AddMenuItem
(
PopMenu
,
editmenu
,
ID_SCH_EDIT_ITEM
,
_
(
"Edit Component"
),
KiBitmap
(
edit_component_xpm
)
);
_
(
"Edit Component"
),
KiBitmap
(
edit_component_xpm
)
);
if
(
!
Component
->
GetFlags
()
)
{
msg
=
AddHotkeyName
(
_
(
"Copy Component"
),
s_Schematic_Hokeys_Descr
,
HK_COPY_COMPONENT_OR_LABEL
);
AddMenuItem
(
PopMenu
,
ID_POPUP_SCH_COPY_ITEM
,
msg
,
KiBitmap
(
copy_button_xpm
)
);
msg
=
AddHotkeyName
(
_
(
"Delete Component"
),
s_Schematic_Hokeys_Descr
,
HK_DELETE
);
AddMenuItem
(
PopMenu
,
ID_POPUP_SCH_DELETE_CMP
,
msg
,
KiBitmap
(
delete_xpm
)
);
}
if
(
libEntry
&&
!
libEntry
->
GetDocFileName
().
IsEmpty
()
)
AddMenuItem
(
PopMenu
,
ID_POPUP_SCH_DISPLAYDOC_CMP
,
_
(
"Doc"
),
KiBitmap
(
datasheet_xpm
)
);
}
}
...
...
eeschema/sch_screen.cpp
View file @
f4af52f9
...
@@ -774,6 +774,7 @@ void SCH_SCREEN::SelectBlockItems()
...
@@ -774,6 +774,7 @@ void SCH_SCREEN::SelectBlockItems()
for
(
;
ii
<
last_select_id
;
ii
++
)
for
(
;
ii
<
last_select_id
;
ii
++
)
{
{
item
=
(
SCH_ITEM
*
)
pickedlist
->
GetPickedItem
(
ii
);
item
=
(
SCH_ITEM
*
)
pickedlist
->
GetPickedItem
(
ii
);
item
->
SetFlags
(
IS_DRAGGED
);
if
(
item
->
Type
()
==
SCH_LINE_T
)
if
(
item
->
Type
()
==
SCH_LINE_T
)
{
{
...
@@ -858,6 +859,8 @@ int SCH_SCREEN::UpdatePickList()
...
@@ -858,6 +859,8 @@ int SCH_SCREEN::UpdatePickList()
{
{
ITEM_PICKER
picker
;
ITEM_PICKER
picker
;
EDA_RECT
area
;
EDA_RECT
area
;
unsigned
count
;
area
.
SetOrigin
(
m_BlockLocate
.
GetOrigin
()
);
area
.
SetOrigin
(
m_BlockLocate
.
GetOrigin
()
);
area
.
SetSize
(
m_BlockLocate
.
GetSize
()
);
area
.
SetSize
(
m_BlockLocate
.
GetSize
()
);
area
.
Normalize
();
area
.
Normalize
();
...
@@ -872,7 +875,19 @@ int SCH_SCREEN::UpdatePickList()
...
@@ -872,7 +875,19 @@ int SCH_SCREEN::UpdatePickList()
}
}
}
}
return
m_BlockLocate
.
GetCount
();
// if the block is composed of one item,
// select it as the current item
count
=
m_BlockLocate
.
GetCount
();
if
(
count
==
1
)
{
SetCurItem
(
(
SCH_ITEM
*
)
m_BlockLocate
.
GetItem
(
0
)
);
}
else
{
SetCurItem
(
NULL
);
}
return
count
;
}
}
...
...
eeschema/schedit.cpp
View file @
f4af52f9
...
@@ -384,6 +384,12 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
...
@@ -384,6 +384,12 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
SCH_SCREEN
*
screen
=
GetScreen
();
SCH_SCREEN
*
screen
=
GetScreen
();
SCH_ITEM
*
item
=
screen
->
GetCurItem
();
SCH_ITEM
*
item
=
screen
->
GetCurItem
();
if
(
screen
->
m_BlockLocate
.
GetState
()
!=
STATE_NO_BLOCK
)
{
// trying to move an item when there is a block at the same time is not acceptable
return
;
}
if
(
item
==
NULL
)
if
(
item
==
NULL
)
{
{
// If we didn't get here by a hot key, then something has gone wrong.
// If we didn't get here by a hot key, then something has gone wrong.
...
@@ -725,15 +731,15 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
...
@@ -725,15 +731,15 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
INSTALL_UNBUFFERED_DC
(
dc
,
m_canvas
);
INSTALL_UNBUFFERED_DC
(
dc
,
m_canvas
);
if
(
item
==
NULL
)
// Allows block rotate operation on hot key.
if
(
screen
->
m_BlockLocate
.
GetState
()
!=
STATE_NO_BLOCK
)
{
{
// Allows block rotate operation on hot key.
HandleBlockEndByPopUp
(
BLOCK_ROTATE
,
&
dc
);
if
(
screen
->
m_BlockLocate
.
GetState
()
!=
STATE_NO_BLOCK
)
return
;
{
}
HandleBlockEndByPopUp
(
BLOCK_ROTATE
,
&
dc
);
return
;
}
if
(
item
==
NULL
)
{
// If we didn't get here by a hot key, then something has gone wrong.
// If we didn't get here by a hot key, then something has gone wrong.
if
(
aEvent
.
GetInt
()
==
0
)
if
(
aEvent
.
GetInt
()
==
0
)
return
;
return
;
...
@@ -965,9 +971,6 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
...
@@ -965,9 +971,6 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
wxFAIL_MSG
(
wxString
::
Format
(
wxT
(
"Cannot drag schematic item type %s."
),
wxFAIL_MSG
(
wxString
::
Format
(
wxT
(
"Cannot drag schematic item type %s."
),
GetChars
(
item
->
GetClass
()
)
)
);
GetChars
(
item
->
GetClass
()
)
)
);
}
}
// Since the drag is actually a block command, clear the current item.
screen
->
SetCurItem
(
NULL
);
}
}
...
@@ -978,21 +981,21 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
...
@@ -978,21 +981,21 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
INSTALL_UNBUFFERED_DC
(
dc
,
m_canvas
);
INSTALL_UNBUFFERED_DC
(
dc
,
m_canvas
);
if
(
item
==
NULL
)
// Allows block rotate operation on hot key.
if
(
screen
->
m_BlockLocate
.
GetState
()
!=
STATE_NO_BLOCK
)
{
{
// Allows block rotate operation on hot key.
if
(
aEvent
.
GetId
()
==
ID_SCH_MIRROR_X
)
if
(
screen
->
m_BlockLocate
.
GetState
()
!=
STATE_NO_BLOCK
)
HandleBlockEndByPopUp
(
BLOCK_MIRROR_X
,
&
dc
);
{
else
if
(
aEvent
.
GetId
()
==
ID_SCH_MIRROR_Y
)
if
(
aEvent
.
GetId
()
==
ID_SCH_MIRROR_X
)
HandleBlockEndByPopUp
(
BLOCK_MIRROR_Y
,
&
dc
);
HandleBlockEndByPopUp
(
BLOCK_MIRROR_X
,
&
dc
);
else
else
if
(
aEvent
.
GetId
()
==
ID_SCH_MIRROR_Y
)
wxFAIL_MSG
(
wxT
(
"Unknown block oriention command ID."
)
);
HandleBlockEndByPopUp
(
BLOCK_MIRROR_Y
,
&
dc
);
else
wxFAIL_MSG
(
wxT
(
"Unknown block oriention command ID."
)
);
return
;
return
;
}
}
if
(
item
==
NULL
)
{
// If we didn't get here by a hot key, then something has gone wrong.
// If we didn't get here by a hot key, then something has gone wrong.
if
(
aEvent
.
GetInt
()
==
0
)
if
(
aEvent
.
GetInt
()
==
0
)
return
;
return
;
...
...
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