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
9d8c684a
Commit
9d8c684a
authored
Jul 17, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Plain Diff
Libedit and Modedit: fix minor, but annoying issues when editing items
parents
5742bfb8
aaabdeae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
25 deletions
+48
-25
dialog_lib_edit_draw_item.cpp
eeschema/dialogs/dialog_lib_edit_draw_item.cpp
+27
-0
libedit_onleftclick.cpp
eeschema/libedit_onleftclick.cpp
+4
-9
symbdraw.cpp
eeschema/symbdraw.cpp
+4
-4
modedit_onclick.cpp
pcbnew/modedit_onclick.cpp
+13
-12
No files found.
eeschema/dialogs/dialog_lib_edit_draw_item.cpp
View file @
9d8c684a
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2006-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dialog_lib_edit_draw_item.cpp
*/
#include <dialog_lib_edit_draw_item.h>
#include <dialog_lib_edit_draw_item.h>
...
...
eeschema/libedit_onleftclick.cpp
View file @
9d8c684a
...
@@ -29,13 +29,10 @@
...
@@ -29,13 +29,10 @@
*/
*/
#include <fctsys.h>
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <eeschema_id.h>
#include <eeschema_id.h>
#include <general.h>
#include <general.h>
#include <protos.h>
#include <libeditframe.h>
#include <libeditframe.h>
#include <class_libentry.h>
#include <class_libentry.h>
...
@@ -43,19 +40,17 @@
...
@@ -43,19 +40,17 @@
void
LIB_EDIT_FRAME
::
OnLeftClick
(
wxDC
*
DC
,
const
wxPoint
&
aPosition
)
void
LIB_EDIT_FRAME
::
OnLeftClick
(
wxDC
*
DC
,
const
wxPoint
&
aPosition
)
{
{
LIB_ITEM
*
item
=
m_drawItem
;
LIB_ITEM
*
item
=
m_drawItem
;
bool
no_item_edited
=
item
==
NULL
||
item
->
GetFlags
()
==
0
;
if
(
m_component
==
NULL
)
// No component loaded !
if
(
m_component
==
NULL
)
// No component loaded !
return
;
return
;
if
(
item
==
NULL
||
item
->
GetFlags
()
==
0
)
if
(
(
GetToolId
()
==
ID_NO_TOOL_SELECTED
)
&&
no_item_edited
)
{
{
item
=
LocateItemUsingCursor
(
aPosition
);
item
=
LocateItemUsingCursor
(
aPosition
);
if
(
item
)
if
(
item
)
{
item
->
DisplayInfo
(
this
);
item
->
DisplayInfo
(
this
);
}
else
else
{
{
DisplayCmpDoc
();
DisplayCmpDoc
();
...
@@ -84,7 +79,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
...
@@ -84,7 +79,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
break
;
break
;
case
ID_LIBEDIT_PIN_BUTT
:
case
ID_LIBEDIT_PIN_BUTT
:
if
(
m_drawItem
==
NULL
||
m_drawItem
->
GetFlags
()
==
0
)
if
(
no_item_edited
)
{
{
CreatePin
(
DC
);
CreatePin
(
DC
);
}
}
...
@@ -99,7 +94,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
...
@@ -99,7 +94,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
case
ID_LIBEDIT_BODY_CIRCLE_BUTT
:
case
ID_LIBEDIT_BODY_CIRCLE_BUTT
:
case
ID_LIBEDIT_BODY_RECT_BUTT
:
case
ID_LIBEDIT_BODY_RECT_BUTT
:
case
ID_LIBEDIT_BODY_TEXT_BUTT
:
case
ID_LIBEDIT_BODY_TEXT_BUTT
:
if
(
m_drawItem
==
NULL
||
m_drawItem
->
GetFlags
()
==
0
)
if
(
no_item_edited
)
{
{
m_drawItem
=
CreateGraphicItem
(
m_component
,
DC
);
m_drawItem
=
CreateGraphicItem
(
m_component
,
DC
);
}
}
...
...
eeschema/symbdraw.cpp
View file @
9d8c684a
...
@@ -68,19 +68,19 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem )
...
@@ -68,19 +68,19 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem )
dialog
.
SetWidthUnits
(
ReturnUnitSymbol
(
g_UserUnit
)
);
dialog
.
SetWidthUnits
(
ReturnUnitSymbol
(
g_UserUnit
)
);
wxString
val
=
ReturnStringFromValue
(
g_UserUnit
,
m_drawLineWidth
);
wxString
val
=
ReturnStringFromValue
(
g_UserUnit
,
DrawItem
->
GetWidth
()
);
dialog
.
SetWidth
(
val
);
dialog
.
SetWidth
(
val
);
dialog
.
SetApplyToAllUnits
(
!
m_drawSpecificUnit
);
dialog
.
SetApplyToAllUnits
(
DrawItem
->
GetUnit
()
==
0
);
dialog
.
EnableApplyToAllUnits
(
component
&&
component
->
GetPartCount
()
>
1
);
dialog
.
EnableApplyToAllUnits
(
component
&&
component
->
GetPartCount
()
>
1
);
dialog
.
SetApplyToAllConversions
(
!
m_drawSpecificConvert
);
dialog
.
SetApplyToAllConversions
(
DrawItem
->
GetConvert
()
==
0
);
dialog
.
EnableApplyToAllConversions
(
component
&&
component
->
HasConversion
()
);
dialog
.
EnableApplyToAllConversions
(
component
&&
component
->
HasConversion
()
);
// dialog.SetFillStyle( m_drawFillStyle ); // could better to show the current setting
dialog
.
SetFillStyle
(
DrawItem
->
GetFillMode
()
);
dialog
.
SetFillStyle
(
DrawItem
->
GetFillMode
()
);
dialog
.
EnableFillStyle
(
DrawItem
->
IsFillable
()
);
dialog
.
EnableFillStyle
(
DrawItem
->
IsFillable
()
);
if
(
dialog
.
ShowModal
()
==
wxID_CANCEL
)
if
(
dialog
.
ShowModal
()
==
wxID_CANCEL
)
return
;
return
;
// Init default values (used to create a new draw item)
val
=
dialog
.
GetWidth
();
val
=
dialog
.
GetWidth
();
m_drawLineWidth
=
ReturnValueFromString
(
g_UserUnit
,
val
);
m_drawLineWidth
=
ReturnValueFromString
(
g_UserUnit
,
val
);
m_drawSpecificConvert
=
!
dialog
.
GetApplyToAllConversions
();
m_drawSpecificConvert
=
!
dialog
.
GetApplyToAllConversions
();
...
...
pcbnew/modedit_onclick.cpp
View file @
9d8c684a
...
@@ -58,11 +58,8 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -58,11 +58,8 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
}
}
}
}
}
}
item
=
GetCurItem
();
if
(
!
item
||
(
item
->
GetFlags
()
==
0
)
)
else
{
{
if
(
!
wxGetKeyState
(
WXK_SHIFT
)
&&
!
wxGetKeyState
(
WXK_ALT
)
if
(
!
wxGetKeyState
(
WXK_SHIFT
)
&&
!
wxGetKeyState
(
WXK_ALT
)
&&
!
wxGetKeyState
(
WXK_CONTROL
)
)
&&
!
wxGetKeyState
(
WXK_CONTROL
)
)
...
@@ -70,6 +67,10 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -70,6 +67,10 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
SetCurItem
(
item
);
SetCurItem
(
item
);
}
}
}
item
=
GetCurItem
();
bool
no_item_edited
=
item
==
NULL
||
item
->
GetFlags
()
==
0
;
switch
(
GetToolId
()
)
switch
(
GetToolId
()
)
{
{
...
@@ -79,7 +80,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -79,7 +80,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case
ID_MODEDIT_CIRCLE_TOOL
:
case
ID_MODEDIT_CIRCLE_TOOL
:
case
ID_MODEDIT_ARC_TOOL
:
case
ID_MODEDIT_ARC_TOOL
:
case
ID_MODEDIT_LINE_TOOL
:
case
ID_MODEDIT_LINE_TOOL
:
if
(
!
item
||
item
->
GetFlags
()
==
0
)
if
(
no_item_edited
)
{
{
STROKE_T
shape
=
S_SEGMENT
;
STROKE_T
shape
=
S_SEGMENT
;
...
@@ -117,9 +118,9 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -117,9 +118,9 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break
;
break
;
case
ID_MODEDIT_DELETE_TOOL
:
case
ID_MODEDIT_DELETE_TOOL
:
if
(
item
==
NULL
||
// No item to delete
if
(
!
no_item_edited
)
// Item in edit, cannot delete it
(
item
->
GetFlags
()
!=
0
)
)
// Item in edit, cannot delete it
break
;
break
;
item
=
ModeditLocateAndDisplay
();
if
(
item
->
Type
()
!=
PCB_MODULE_T
)
// Cannot delete the module itself
if
(
item
->
Type
()
!=
PCB_MODULE_T
)
// Cannot delete the module itself
{
{
...
...
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