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
a1659e41
Commit
a1659e41
authored
Nov 24, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
further dialog development
parent
c4215848
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
594 additions
and
278 deletions
+594
-278
change_log.txt
change_log.txt
+10
-2
dialog_edit_component_in_schematic.cpp
eeschema/dialog_edit_component_in_schematic.cpp
+119
-71
dialog_edit_component_in_schematic.fbp
eeschema/dialog_edit_component_in_schematic.fbp
+363
-125
dialog_edit_component_in_schematic.h
eeschema/dialog_edit_component_in_schematic.h
+20
-7
dialog_edit_component_in_schematic_fbp.cpp
eeschema/dialog_edit_component_in_schematic_fbp.cpp
+65
-69
dialog_edit_component_in_schematic_fbp.h
eeschema/dialog_edit_component_in_schematic_fbp.h
+17
-4
No files found.
change_log.txt
View file @
a1659e41
...
...
@@ -5,6 +5,15 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Nov-24 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+eeschema
edit component in schematic editor. It is not complete but further.
Keep your old eeschema binary, this one does not fully work yet, another day or so.
Switched away from wxGrid to wxListCtrl, and that class is poorly documented
so much time pioneering how to use it. Should go faster now.
2008-Nov-23 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+all
...
...
@@ -25,8 +34,7 @@ email address.
+eeschema
Started on the edit component in schematic editor. It is not complete and
breaks the usefulness of the editor at this moment. Do not build this version
if you want to fully use eeschema. I will get something working in another day,
even if it is the old editor.
if you want to fully use eeschema.
2008-Nov-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
...
...
eeschema/dialog_edit_component_in_schematic.cpp
View file @
a1659e41
...
...
@@ -15,10 +15,6 @@
#include "dialog_edit_component_in_schematic.h"
#define ID_ON_SELECT_FIELD 3000
/**********************************************************************/
void
InstallCmpeditFrame
(
WinEDA_SchematicFrame
*
parent
,
wxPoint
&
pos
,
SCH_COMPONENT
*
aComponent
)
...
...
@@ -38,6 +34,9 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
new
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
(
parent
);
frame
->
InitBuffers
(
aComponent
);
// frame->Layout();
frame
->
ShowModal
();
frame
->
Destroy
();
}
...
...
@@ -93,46 +92,55 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
{
m_Parent
=
(
WinEDA_SchematicFrame
*
)
parent
;
// fieldGrid->SetDefaultColSize( 160, true );
// fieldGrid->SetColLabelValue( 0, _("Field Text") );
m_SelectedRow
=
0
;
wxListItem
columnLabel
;
// set grid as read only.
fieldGrid
->
EnableEditing
(
false
);
columnLabel
.
SetImage
(
-
1
);
// @todo make this conditional on 2.8.8 wxWidgets
field
Grid
->
SetRowLabelSize
(
wxGRID_AUTOSIZE
);
columnLabel
.
SetText
(
_
(
"Name"
)
);
field
ListCtrl
->
InsertColumn
(
0
,
columnLabel
);
// else fieldGrid->SetRowLabelSize( 140 ) or so
columnLabel
.
SetText
(
_
(
"Value"
)
);
fieldListCtrl
->
InsertColumn
(
1
,
columnLabel
);
// select only a single row, and since table is only a single column wide
// this means only one cell.
fieldGrid
->
SetSelectionMode
(
wxGrid
::
wxGridSelectRows
);
// these must go here late in the game.
fieldListCtrl
->
SetColumnWidth
(
0
,
wxLIST_AUTOSIZE
);
fieldListCtrl
->
SetColumnWidth
(
1
,
wxLIST_AUTOSIZE
);
copySelectedFieldToPanel
();
wxToolTip
::
Enable
(
true
);
}
/*
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnGridCellLeftClick( wxGridEvent& event )
void
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
OnListItemDeselected
(
wxListEvent
&
event
)
{
// TODO: Implement OnGridCellLeftClick
D
(
printf
(
"OnListItemDeselected()
\n
"
);)
copyPanelToSelectedField
();
}
*/
void
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
OnListItemSelected
(
wxListEvent
&
event
)
{
D
(
printf
(
"OnListItemSelected()
\n
"
);)
m_SelectedRow
=
event
.
GetIndex
();
copySelectedFieldToPanel
();
}
void
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
setSelectedFieldNdx
(
int
aFieldNdx
)
{
field
Grid
->
SelectCol
(
0
);
field
Grid
->
SelectRow
(
aFieldNdx
);
field
ListCtrl
->
SetItemState
(
aFieldNdx
,
wxLIST_STATE_SELECTED
,
wxLIST_STATE_SELECTED
);
field
ListCtrl
->
EnsureVisible
(
aFieldNdx
);
}
int
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
getSelectedFieldNdx
()
{
wxArrayInt
array
=
fieldGrid
->
GetSelectedRows
();
if
(
!
array
.
IsEmpty
()
)
return
array
.
Item
(
0
);
else
return
-
1
;
return
m_SelectedRow
;
}
...
...
@@ -193,99 +201,139 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
#endif
/*******************************************************************************
*
/
/*******************************************************************************/
void
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
InitBuffers
(
SCH_COMPONENT
*
aComponent
)
/*******************************************************************************
*
/
/*******************************************************************************/
{
m_Cmp
=
aComponent
;
setSelectedFieldNdx
(
REFERENCE
);
m_FieldBuf
=
aComponent
->
m_Fields
;
// copy all the fields to a work area
m_FieldsBuf
=
aComponent
->
m_Fields
;
m_FieldBuf
[
REFERENCE
].
m_Text
=
m_Cmp
->
GetRef
(
m_Parent
->
GetSheet
()
);
m_Field
s
Buf
[
REFERENCE
].
m_Text
=
m_Cmp
->
GetRef
(
m_Parent
->
GetSheet
()
);
for
(
int
ii
=
0
;
ii
<
aComponent
->
GetFieldCount
();
++
ii
)
{
// make the editable field position relative to the component
m_FieldBuf
[
ii
].
m_Pos
-=
m_Cmp
->
m_Pos
;
m_FieldsBuf
[
ii
].
m_Pos
-=
m_Cmp
->
m_Pos
;
setRowItem
(
ii
,
m_FieldsBuf
[
ii
]
);
}
setSelectedFieldNdx
(
REFERENCE
);
}
void
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
setRowItem
(
int
aFieldNdx
,
const
SCH_CMP_FIELD
&
aField
)
{
wxASSERT
(
aFieldNdx
>=
0
);
// insert blanks if aFieldNdx is referencing a yet to be defined row
while
(
aFieldNdx
>=
fieldListCtrl
->
GetItemCount
()
)
{
long
ndx
=
fieldListCtrl
->
InsertItem
(
fieldListCtrl
->
GetItemCount
(),
wxEmptyString
);
wxASSERT
(
ndx
>=
0
);
fieldListCtrl
->
SetItem
(
ndx
,
1
,
wxEmptyString
);
}
fieldListCtrl
->
SetItem
(
aFieldNdx
,
0
,
aField
.
m_Name
);
fieldListCtrl
->
SetItem
(
aFieldNdx
,
1
,
aField
.
m_Text
);
// recompute the column widths here, after setting texts
fieldListCtrl
->
SetColumnWidth
(
0
,
wxLIST_AUTOSIZE
);
fieldListCtrl
->
SetColumnWidth
(
1
,
wxLIST_AUTOSIZE
);
}
#if 0
/****************************************************************/
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copy
Data
ToPanel()
void
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
copy
SelectedField
ToPanel
()
/****************************************************************/
{
int fieldNdx = G
etSelectedFieldNdx();
unsigned
fieldNdx
=
g
etSelectedFieldNdx
();
if( fieldNdx
== -1 )
if
(
fieldNdx
>=
m_FieldsBuf
.
size
()
)
// traps the -1 case too
return
;
for( int ii = FIELD1; ii < NUMBER_OF_FIELDS; ii++ )
{
m_FieldSelection->SetString( ii, m_FieldName[ii] );
}
SCH_CMP_FIELD
&
field
=
m_FieldsBuf
[
fieldNdx
];
fieldNameTextCtrl
->
SetValue
(
field
.
m_Name
);
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable editing
fieldNameTextCtrl
->
Enable
(
fieldNdx
>=
FIELD1
);
fieldValueTextCtrl
->
SetValue
(
field
.
m_Text
);
/*
if( fieldNdx == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER )
m_FieldTextCtrl->Enable( FALSE );
*/
if( m_FieldFlags[fieldNdx] )
m_ShowFieldTextCtrl->SetValue( TRUE );
else
m_ShowFieldTextCtrl->SetValue( FALSE );
showCheckBox
->
SetValue
(
!
(
field
.
m_Attributs
&
TEXT_NO_VISIBLE
)
);
// If the field value is empty and the position is zero, we set the
// initial position as a small offset from the ref field, and orient
// it the same as the ref field. That is likely to put it at least
// close to the desired position.
if( m_FieldBuf[fieldNdx].m_Pos == wxPoint( 0, 0 )
&& m_FieldBuf[fieldNdx].m_Text.IsEmpty() )
if
(
field
.
m_Pos
==
wxPoint
(
0
,
0
)
&&
field
.
m_Text
.
IsEmpty
()
)
{
m_VorientFieldText->SetValue( m_FieldOrient[REFERENCE] != 0 );
m_FieldPositionCtrl->SetValue( m_FieldPosition[REFERENCE].x + 100,
m_FieldPosition[REFERENCE].y + 100 );
wxString
dim
;
// @todo look at the dedicated position control for this.
dim
.
Printf
(
wxT
(
"%d"
),
m_FieldsBuf
[
REFERENCE
].
m_Pos
.
x
+
(
fieldNdx
-
FIELD1
+
1
)
*
100
);
posXTextCtrl
->
SetValue
(
dim
);
dim
.
Printf
(
wxT
(
"%d"
),
m_FieldsBuf
[
REFERENCE
].
m_Pos
.
y
+
(
fieldNdx
-
FIELD1
+
1
)
*
100
);
posYTextCtrl
->
SetValue
(
dim
);
}
else
{
m_FieldPositionCtrl->SetValue( m_FieldPosition[fieldNdx].x, m_FieldPosition[fieldNdx].y );
m_VorientFieldText->SetValue( m_FieldOrient[fieldNdx] != 0 );
wxString
dim
;
dim
.
Printf
(
wxT
(
"%d"
),
field
.
m_Pos
.
x
);
posXTextCtrl
->
SetValue
(
dim
);
dim
.
Printf
(
wxT
(
"%d"
),
field
.
m_Pos
.
y
);
posYTextCtrl
->
SetValue
(
dim
);
}
m_FieldNameCtrl->SetValue( m_FieldName[fieldNdx]
);
rotateCheckBox
->
SetValue
(
field
.
m_Orient
==
TEXT_ORIENT_VERT
);
if( fieldNdx < FIELD1 )
m_FieldNameCtrl->Enable( FALSE );
else
m_FieldNameCtrl->Enable( TRUE );
#if 0
m_FieldNameCtrl->SetValue( m_FieldName[fieldNdx] );
m_FieldTextCtrl->SetValue( m_FieldText[fieldNdx] );
m_FieldTextCtrl->SetValue( m_FieldSize[fieldNdx] );
#endif
}
/*****************************************************************/
void
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
copyPanelToSelectedField
()
/*****************************************************************/
{
unsigned
fieldNdx
=
getSelectedFieldNdx
();
/****************************************************************/
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelFieldToData()
/****************************************************************/
if
(
fieldNdx
>=
m_FieldsBuf
.
size
()
)
return
;
/* Copy the values displayed on the panel field to the buffers according to
* the current field number
*/
{
int id = m_CurrentFieldId;
m_FieldFlags[id] = m_ShowFieldTextCtrl->GetValue();
m_FieldOrient[id] = m_VorientFieldText->GetValue();
m_FieldText[id] = m_FieldTextCtrl->GetText();
m_FieldName[id] = m_FieldNameCtrl->GetValue();
m_FieldPosition[id] = m_FieldPositionCtrl->GetValue();
m_FieldSize[id] = m_FieldTextCtrl->GetTextSize();
SCH_CMP_FIELD
&
field
=
m_FieldsBuf
[
fieldNdx
];
field
.
m_Name
=
fieldNameTextCtrl
->
GetValue
();
field
.
m_Text
=
fieldValueTextCtrl
->
GetValue
();
// field.m_Size =
// m_FieldPosition[id] = m_FieldPositionCtrl->GetValue();
// m_FieldSize[id] = m_FieldTextCtrl->GetTextSize();
}
#if 0
/*************************************************************/
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::fillTableModel()
/*************************************************************/
...
...
eeschema/dialog_edit_component_in_schematic.fbp
View file @
a1659e41
This diff is collapsed.
Click to expand it.
eeschema/dialog_edit_component_in_schematic.h
View file @
a1659e41
...
...
@@ -16,28 +16,41 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEM
SCH_COMPONENT
*
m_Cmp
;
EDA_LibComponentStruct
*
m_LibEntry
;
int
m_SelectedRow
;
/// a copy of the edited component's SCH_CMP_FIELDs
SCH_CMP_FIELDS
m_FieldBuf
;
SCH_CMP_FIELDS
m_Field
s
Buf
;
void
setSelectedFieldNdx
(
int
aFieldNdx
);
int
getSelectedFieldNdx
();
/**
* Function
CopyData
ToPanel
* Function
copySelectedField
ToPanel
* sets the values displayed on the panel according to
* the current
field number
* the current
ly selected field row
*/
void
copyDataToPanel
();
void
copySelectedFieldToPanel
();
/**
* Function copyPanelToSelectedField
* copies the values displayed on the panel fields to the currently selected field
*/
void
copyPanelToSelectedField
();
void
fillTableModel
();
void
setRowItem
(
int
aFieldNdx
,
const
SCH_CMP_FIELD
&
aField
);
// event handlers
void
OnListItemDeselected
(
wxListEvent
&
event
);
void
OnListItemSelected
(
wxListEvent
&
event
);
protected
:
// Handlers for DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP events.
// void OnGridCellLeftClick( wxGridEvent& event );
public
:
/** Constructor */
...
...
eeschema/dialog_edit_component_in_schematic_fbp.cpp
View file @
a1659e41
This diff is collapsed.
Click to expand it.
eeschema/dialog_edit_component_in_schematic_fbp.h
View file @
a1659e41
...
...
@@ -21,8 +21,9 @@
#include <wx/radiobox.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/
grid
.h>
#include <wx/
listctrl
.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
...
...
@@ -41,25 +42,37 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
wxRadioBox
*
mirrorRadioBox
;
wxTextCtrl
*
chipnameTxtControl
;
wxCheckBox
*
convertCheckBox
;
wx
Grid
*
fieldGrid
;
wx
ListCtrl
*
fieldListCtrl
;
wxButton
*
addFieldButton
;
wxButton
*
deleteFieldButton
;
wxButton
*
moveUpButton
;
wxCheckBox
*
showCheckBox
;
wxCheckBox
*
rotateCheckBox
;
wxStaticText
*
fieldNameLabel
;
wxTextCtrl
*
fieldNameTextCtrl
;
wxTextCtrl
*
m_textCtrl3
;
wxStaticText
*
fieldValueLabel
;
wxTextCtrl
*
fieldValueTextCtrl
;
wxStaticText
*
textSizeLabel
;
wxTextCtrl
*
textSizeTextCtrl
;
wxStaticText
*
posXLabel
;
wxTextCtrl
*
posXTextCtrl
;
wxStaticText
*
posYLabel
;
wxTextCtrl
*
posYTextCtrl
;
wxButton
*
defaultsButton
;
wxStdDialogButtonSizer
*
stdDialogButtonSizer
;
wxButton
*
stdDialogButtonSizerOK
;
wxButton
*
stdDialogButtonSizerCancel
;
// Virtual event handlers, overide them in your derived class
virtual
void
OnListItemDeselected
(
wxListEvent
&
event
){
event
.
Skip
();
}
virtual
void
OnListItemSelected
(
wxListEvent
&
event
){
event
.
Skip
();
}
public
:
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"Component Properties"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
864
,
5
40
),
long
style
=
wxCAPTION
|
wxCLOSE_BOX
|
wxDEFAULT_DIALOG_STYLE
|
wxMAXIMIZE_BOX
|
wxRESIZE_BORDER
);
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"Component Properties"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
864
,
5
50
),
long
style
=
wxCAPTION
|
wxCLOSE_BOX
|
wxDEFAULT_DIALOG_STYLE
|
wxMAXIMIZE_BOX
|
wxMINIMIZE_BOX
|
wxRESIZE_BORDER
|
wxSYSTEM_MENU
);
~
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
();
};
...
...
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