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
b0f3e79e
Commit
b0f3e79e
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created a common interface for edit frames.
parent
eee2779f
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
149 additions
and
72 deletions
+149
-72
wxPcbStruct.h
include/wxPcbStruct.h
+6
-6
board_undo_redo.cpp
pcbnew/board_undo_redo.cpp
+2
-2
modedit_onclick.cpp
pcbnew/modedit_onclick.cpp
+39
-35
modedit_undo_redo.cpp
pcbnew/modedit_undo_redo.cpp
+2
-2
module_editor_frame.h
pcbnew/module_editor_frame.h
+21
-17
moduleframe.cpp
pcbnew/moduleframe.cpp
+5
-5
pcb_base_edit_frame.h
pcbnew/pcb_base_edit_frame.h
+69
-0
pcbframe.cpp
pcbnew/pcbframe.cpp
+3
-3
edit_tool.cpp
pcbnew/tools/edit_tool.cpp
+1
-1
point_editor.cpp
pcbnew/tools/point_editor.cpp
+1
-1
No files found.
include/wxPcbStruct.h
View file @
b0f3e79e
...
...
@@ -30,7 +30,7 @@
#define WXPCB_STRUCT_H_
#include <
wxBasePcbF
rame.h>
#include <
pcb_base_edit_f
rame.h>
#include <config_params.h>
#include <class_macros_record.h>
#include <class_undoredo_container.h>
...
...
@@ -73,7 +73,7 @@ namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
*
* See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.
*/
class
PCB_EDIT_FRAME
:
public
PCB_BASE_FRAME
class
PCB_EDIT_FRAME
:
public
PCB_BASE_
EDIT_
FRAME
{
friend
class
PCB
::
IFACE
;
friend
class
PCB_LAYER_WIDGET
;
...
...
@@ -659,22 +659,22 @@ public:
bool
aRebuildRatsnet
=
true
);
/**
* Function
GetBoard
FromRedoList
* Function
RestoreCopy
FromRedoList
* Redo the last edition:
* - Save the current board in Undo list
* - Get an old version of the board from Redo list
* @return none
*/
void
GetBoard
FromRedoList
(
wxCommandEvent
&
aEvent
);
void
RestoreCopy
FromRedoList
(
wxCommandEvent
&
aEvent
);
/**
* Function
GetBoard
FromUndoList
* Function
RestoreCopy
FromUndoList
* Undo the last edition:
* - Save the current board in Redo list
* - Get an old version of the board from Undo list
* @return none
*/
void
GetBoard
FromUndoList
(
wxCommandEvent
&
aEvent
);
void
RestoreCopy
FromUndoList
(
wxCommandEvent
&
aEvent
);
/* Block operations: */
...
...
pcbnew/board_undo_redo.cpp
View file @
b0f3e79e
...
...
@@ -630,7 +630,7 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
}
void
PCB_EDIT_FRAME
::
GetBoard
FromUndoList
(
wxCommandEvent
&
aEvent
)
void
PCB_EDIT_FRAME
::
RestoreCopy
FromUndoList
(
wxCommandEvent
&
aEvent
)
{
if
(
GetScreen
()
->
GetUndoCommandCount
()
<=
0
)
return
;
...
...
@@ -653,7 +653,7 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& aEvent )
}
void
PCB_EDIT_FRAME
::
GetBoard
FromRedoList
(
wxCommandEvent
&
aEvent
)
void
PCB_EDIT_FRAME
::
RestoreCopy
FromRedoList
(
wxCommandEvent
&
aEvent
)
{
if
(
GetScreen
()
->
GetRedoCommandCount
()
==
0
)
return
;
...
...
pcbnew/modedit_onclick.cpp
View file @
b0f3e79e
...
...
@@ -418,17 +418,39 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
// Item found
SetCurItem
(
item
);
OnEditItemRequest
(
DC
,
item
);
break
;
// end case 0
switch
(
item
->
Type
()
)
case
ID_PCB_ADD_LINE_BUTT
:
{
if
(
item
&&
item
->
IsNew
()
)
{
End_Edge_Module
(
(
EDGE_MODULE
*
)
item
);
SetCurItem
(
NULL
);
m_canvas
->
Refresh
();
}
break
;
}
default
:
break
;
}
}
void
FOOTPRINT_EDIT_FRAME
::
OnEditItemRequest
(
wxDC
*
aDC
,
BOARD_ITEM
*
aItem
)
{
switch
(
aItem
->
Type
()
)
{
case
PCB_PAD_T
:
InstallPadOptionsFrame
(
(
D_PAD
*
)
i
tem
);
InstallPadOptionsFrame
(
(
D_PAD
*
)
aI
tem
);
m_canvas
->
MoveCursorToCrossHair
();
break
;
case
PCB_MODULE_T
:
{
DIALOG_MODULE_MODULE_EDITOR
dialog
(
this
,
(
MODULE
*
)
i
tem
);
DIALOG_MODULE_MODULE_EDITOR
dialog
(
this
,
(
MODULE
*
)
aI
tem
);
int
ret
=
dialog
.
ShowModal
();
GetScreen
()
->
GetCurItem
()
->
ClearFlags
();
m_canvas
->
MoveCursorToCrossHair
();
...
...
@@ -439,35 +461,17 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break
;
case
PCB_MODULE_TEXT_T
:
InstallTextModOptionsFrame
(
(
TEXTE_MODULE
*
)
item
,
DC
);
InstallTextModOptionsFrame
(
(
TEXTE_MODULE
*
)
aItem
,
a
DC
);
m_canvas
->
MoveCursorToCrossHair
();
break
;
case
PCB_MODULE_EDGE_T
:
m_canvas
->
MoveCursorToCrossHair
();
InstallFootprintBodyItemPropertiesDlg
(
(
EDGE_MODULE
*
)
i
tem
);
InstallFootprintBodyItemPropertiesDlg
(
(
EDGE_MODULE
*
)
aI
tem
);
m_canvas
->
Refresh
();
break
;
default
:
break
;
}
break
;
// end case 0
case
ID_PCB_ADD_LINE_BUTT
:
{
if
(
item
&&
item
->
IsNew
()
)
{
End_Edge_Module
(
(
EDGE_MODULE
*
)
item
);
SetCurItem
(
NULL
);
m_canvas
->
Refresh
();
}
break
;
}
default
:
break
;
}
}
pcbnew/modedit_undo_redo.cpp
View file @
b0f3e79e
...
...
@@ -66,7 +66,7 @@ void FOOTPRINT_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLi
}
void
FOOTPRINT_EDIT_FRAME
::
GetComponent
FromRedoList
(
wxCommandEvent
&
aEvent
)
void
FOOTPRINT_EDIT_FRAME
::
RestoreCopy
FromRedoList
(
wxCommandEvent
&
aEvent
)
{
if
(
GetScreen
()
->
GetRedoCommandCount
()
<=
0
)
return
;
...
...
@@ -107,7 +107,7 @@ void FOOTPRINT_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& aEvent )
}
void
FOOTPRINT_EDIT_FRAME
::
GetComponent
FromUndoList
(
wxCommandEvent
&
aEvent
)
void
FOOTPRINT_EDIT_FRAME
::
RestoreCopy
FromUndoList
(
wxCommandEvent
&
aEvent
)
{
if
(
GetScreen
()
->
GetUndoCommandCount
()
<=
0
)
return
;
...
...
pcbnew/module_editor_frame.h
View file @
b0f3e79e
...
...
@@ -30,6 +30,7 @@
#define MODULE_EDITOR_FRAME_H_
#include <wxBasePcbFrame.h>
#include <pcb_base_edit_frame.h>
#include <io_mgr.h>
...
...
@@ -38,7 +39,7 @@ class FP_LIB_TABLE;
namespace
PCB
{
struct
IFACE
;
}
// A KIFACE_I coded in pcbnew.c
class
FOOTPRINT_EDIT_FRAME
:
public
PCB_BASE_FRAME
class
FOOTPRINT_EDIT_FRAME
:
public
PCB_BASE_
EDIT_
FRAME
{
friend
struct
PCB
::
IFACE
;
...
...
@@ -148,6 +149,9 @@ public:
void
OnUpdateReplaceModuleInBoard
(
wxUpdateUIEvent
&
aEvent
);
void
OnUpdateSelectCurrentLib
(
wxUpdateUIEvent
&
aEvent
);
///> @copydoc PCB_BASE_EDIT_FRAME::OnEditItemRequest()
void
OnEditItemRequest
(
wxDC
*
aDC
,
BOARD_ITEM
*
aItem
);
/**
* Function LoadModuleFromBoard
* called from the main toolbar to load a footprint from board mainly to edit it.
...
...
@@ -244,6 +248,22 @@ public:
UNDO_REDO_T
aTypeCommand
,
const
wxPoint
&
aTransformPoint
=
wxPoint
(
0
,
0
)
);
/**
* Function RestoreCopyFromUndoList
* performs an undo operation on the last edition:
* - Place the current edited library component in Redo list
* - Get old version of the current edited library component
*/
void
RestoreCopyFromUndoList
(
wxCommandEvent
&
aEvent
);
/**
* Function RestoreCopyFromRedoList
* performs a redo operation on the the last edition:
* - Place the current edited library component in undo list
* - Get old version of the current edited library component
*/
void
RestoreCopyFromRedoList
(
wxCommandEvent
&
aEvent
);
/// Return the current library nickname.
const
wxString
GetCurrentLib
()
const
;
...
...
@@ -413,22 +433,6 @@ protected:
PCB_LAYER_WIDGET
*
m_Layers
;
/**
* Function GetComponentFromUndoList
* performs an undo operation on the last edition:
* - Place the current edited library component in Redo list
* - Get old version of the current edited library component
*/
void
GetComponentFromUndoList
(
wxCommandEvent
&
aEvent
);
/**
* Function GetComponentFromRedoList
* performs a redo operation on the the last edition:
* - Place the current edited library component in undo list
* - Get old version of the current edited library component
*/
void
GetComponentFromRedoList
(
wxCommandEvent
&
aEvent
);
/**
* Function UpdateTitle
* updates window title according to getLibNickName().
...
...
pcbnew/moduleframe.cpp
View file @
b0f3e79e
...
...
@@ -99,8 +99,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL
(
ID_MODEDIT_INSERT_MODULE_IN_BOARD
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_UPDATE_MODULE_IN_BOARD
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_EDIT_MODULE_PROPERTIES
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_UNDO
,
FOOTPRINT_EDIT_FRAME
::
GetComponent
FromUndoList
)
EVT_TOOL
(
wxID_REDO
,
FOOTPRINT_EDIT_FRAME
::
GetComponent
FromRedoList
)
EVT_TOOL
(
wxID_UNDO
,
FOOTPRINT_EDIT_FRAME
::
RestoreCopy
FromUndoList
)
EVT_TOOL
(
wxID_REDO
,
FOOTPRINT_EDIT_FRAME
::
RestoreCopy
FromRedoList
)
// Vertical tool bar button click event handler.
EVT_TOOL
(
ID_NO_TOOL_SELECTED
,
FOOTPRINT_EDIT_FRAME
::
OnVerticalToolbar
)
...
...
@@ -160,7 +160,7 @@ END_EVENT_TABLE()
#define FOOTPRINT_EDIT_FRAME_NAME wxT( "ModEditFrame" )
FOOTPRINT_EDIT_FRAME
::
FOOTPRINT_EDIT_FRAME
(
KIWAY
*
aKiway
,
wxWindow
*
aParent
)
:
PCB_BASE_FRAME
(
aKiway
,
aParent
,
FRAME_PCB_MODULE_EDITOR
,
wxEmptyString
,
PCB_BASE_
EDIT_
FRAME
(
aKiway
,
aParent
,
FRAME_PCB_MODULE_EDITOR
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
KICAD_DEFAULT_DRAWFRAME_STYLE
,
GetFootprintEditorFrameName
()
)
{
...
...
pcbnew/pcb_base_edit_frame.h
0 → 100644
View file @
b0f3e79e
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* 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
*/
#ifndef BASE_EDIT_FRAME_H
#define BASE_EDIT_FRAME_H
#include <wxBasePcbFrame.h>
/**
* Common, abstract interface for edit frames.
*/
class
PCB_BASE_EDIT_FRAME
:
public
PCB_BASE_FRAME
{
public
:
PCB_BASE_EDIT_FRAME
(
KIWAY
*
aKiway
,
wxWindow
*
aParent
,
FRAME_T
aFrameType
,
const
wxString
&
aTitle
,
const
wxPoint
&
aPos
,
const
wxSize
&
aSize
,
long
aStyle
,
const
wxString
&
aFrameName
)
:
PCB_BASE_FRAME
(
aKiway
,
aParent
,
aFrameType
,
aTitle
,
aPos
,
aSize
,
aStyle
,
aFrameName
)
{}
virtual
~
PCB_BASE_EDIT_FRAME
()
{};
/**
* Function OnEditItemRequest
* Install the corresponding dialog editor for the given item
* @param aDC = the current device context
* @param aItem = a pointer to the BOARD_ITEM to edit
*/
virtual
void
OnEditItemRequest
(
wxDC
*
aDC
,
BOARD_ITEM
*
aItem
)
=
0
;
/**
* Function RestoreCopyFromRedoList
* Redo the last edition:
* - Save the current data in Undo list
* - Get an old version of the data from Redo list
*/
virtual
void
RestoreCopyFromRedoList
(
wxCommandEvent
&
aEvent
)
=
0
;
/**
* Function RestoreCopyFromUndoList
* Undo the last edition:
* - Save the current board in Redo list
* - Get an old version of the data from Undo list
*/
virtual
void
RestoreCopyFromUndoList
(
wxCommandEvent
&
aEvent
)
=
0
;
};
#endif
pcbnew/pcbframe.cpp
View file @
b0f3e79e
...
...
@@ -187,8 +187,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL
(
wxID_CUT
,
PCB_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_COPY
,
PCB_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_PASTE
,
PCB_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_UNDO
,
PCB_EDIT_FRAME
::
GetBoard
FromUndoList
)
EVT_TOOL
(
wxID_REDO
,
PCB_EDIT_FRAME
::
GetBoard
FromRedoList
)
EVT_TOOL
(
wxID_UNDO
,
PCB_EDIT_FRAME
::
RestoreCopy
FromUndoList
)
EVT_TOOL
(
wxID_REDO
,
PCB_EDIT_FRAME
::
RestoreCopy
FromRedoList
)
EVT_TOOL
(
wxID_PRINT
,
PCB_EDIT_FRAME
::
ToPrinter
)
EVT_TOOL
(
ID_GEN_PLOT_SVG
,
PCB_EDIT_FRAME
::
SVG_Print
)
EVT_TOOL
(
ID_GEN_PLOT
,
PCB_EDIT_FRAME
::
Process_Special_Functions
)
...
...
@@ -304,7 +304,7 @@ END_EVENT_TABLE()
#define PCB_EDIT_FRAME_NAME wxT( "PcbFrame" )
PCB_EDIT_FRAME
::
PCB_EDIT_FRAME
(
KIWAY
*
aKiway
,
wxWindow
*
aParent
)
:
PCB_BASE_FRAME
(
aKiway
,
aParent
,
FRAME_PCB
,
wxT
(
"Pcbnew"
),
wxDefaultPosition
,
PCB_BASE_
EDIT_
FRAME
(
aKiway
,
aParent
,
FRAME_PCB
,
wxT
(
"Pcbnew"
),
wxDefaultPosition
,
wxDefaultSize
,
KICAD_DEFAULT_DRAWFRAME_STYLE
,
PCB_EDIT_FRAME_NAME
)
{
m_FrameName
=
PCB_EDIT_FRAME_NAME
;
...
...
pcbnew/tools/edit_tool.cpp
View file @
b0f3e79e
...
...
@@ -189,7 +189,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
{
// Modifications have to be rollbacked, so restore the previous state of items
wxCommandEvent
dummy
;
editFrame
->
GetBoard
FromUndoList
(
dummy
);
editFrame
->
RestoreCopy
FromUndoList
(
dummy
);
}
else
{
...
...
pcbnew/tools/point_editor.cpp
View file @
b0f3e79e
...
...
@@ -309,7 +309,7 @@ int POINT_EDITOR::OnSelectionChange( TOOL_EVENT& aEvent )
if
(
modified
)
// Restore the last change
{
wxCommandEvent
dummy
;
editFrame
->
GetBoard
FromUndoList
(
dummy
);
editFrame
->
RestoreCopy
FromUndoList
(
dummy
);
updatePoints
();
modified
=
false
;
...
...
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