Commit 930a777e authored by charras's avatar charras

Change dialog to edit fields in libedit (see CHANGELOG.txt)

parent cbb5159a
......@@ -5,6 +5,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Dec-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++Eeschema:
Note: this is a work in progress!
Change dialog to edit fields in libedit.
Most of code created by Dick to edit fields in shematic is reused (this was the goal).
Component dialog properties -in libedit) is not modified, and fields can be also edited with it.
New dialog box is similar to the component dialog box used in schematic.
But all features do not work (work in progress!)
TODO (by me):
use vector to handle fields in libraries, like schematic.
Finish work, and test it.
2008-Dec-29 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++all
......
......@@ -4,7 +4,6 @@
#include "wx/generic/aboutdlgg.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
extern wxString g_Main_Title; // Import program title
......
......@@ -580,11 +580,21 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC )
}
//#define USE_GCDC_IN_KICAD
#ifdef USE_GCDC_IN_KICAD
#include <wx/dcgraph.h>
#endif
/***************************************************/
void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
/***************************************************/
{
#ifdef USE_GCDC_IN_KICAD
wxPaintDC pDC( this );
wxGCDC paintDC(pDC); // Following line should be disabled on MSW and OS X
paintDC.GetGraphicsContext()->Translate(0.5, 0.5); // Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187
#else
wxPaintDC paintDC( this );
#endif
EDA_Rect tmp;
wxRect PaintClipBox;
wxPoint org;
......
......@@ -41,6 +41,8 @@ set(EESCHEMA_SRCS
dialog_edit_component_in_schematic.cpp
dialog_edit_label.cpp
dialog_edit_label_base.cpp
dialog_edit_libentry_fields_in_lib.cpp
dialog_edit_libentry_fields_in_lib_base.cpp
dialog_eeschema_config.cpp
dialog_erc.cpp
# dialog_find.cpp
......
......@@ -410,8 +410,11 @@ LibDrawField* LibDrawField::GenCopy()
}
// copie du field dans le field Target
void LibDrawField::Copy( LibDrawField* Target )
/** Function Copy
* copy parameters of this to Target. Pointers are not copied
* @param Target = the LibDrawField to set with "this" values
*/
void LibDrawField::Copy( LibDrawField* Target ) const
{
Target->m_Pos = m_Pos;
Target->m_Size = m_Size;
......
......@@ -137,6 +137,12 @@ public:
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile );
/** Function SetFields
* initialize fields from a vector of fields
* @param aFields a std::vector <LibDrawField> to import.
*/
void SetFields( const std::vector <LibDrawField> aFields );
};
......
......@@ -497,7 +497,14 @@ public:
LibDrawField* GenCopy();
void Copy( LibDrawField* Target );
/** Function Copy
* copy parameters of this to Target. Pointers are not copied
* @param Target = the LibDrawField to set with "this" values
*/
void Copy( LibDrawField* Target ) const;
void SetFields( const std::vector <LibDrawField> aFields );
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
int aDrawMode, void* aData, int aTransformMatrix[2][2] );
......
......@@ -445,7 +445,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
fieldNameTextCtrl->SetValue( field.m_Name );
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable editing
// fieldNameTextCtrl->Enable( fieldNdx >= FIELD1 );
fieldNameTextCtrl->Enable( fieldNdx >= FIELD1 );
fieldNameTextCtrl->SetEditable( fieldNdx >= FIELD1 );
fieldValueTextCtrl->SetValue( field.m_Text );
......
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_edit_libentry_fields_in_lib_base__
#define __dialog_edit_libentry_fields_in_lib_base__
#include <wx/intl.h>
#include <wx/listctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog
{
private:
protected:
wxListCtrl* fieldListCtrl;
wxButton* addFieldButton;
wxButton* deleteFieldButton;
wxButton* moveUpButton;
wxRadioBox* m_FieldPositionCtrl;
wxRadioBox* m_FieldVJustifyCtrl;
wxCheckBox* showCheckBox;
wxCheckBox* rotateCheckBox;
wxRadioBox* m_StyleRadioBox;
wxStaticText* fieldNameLabel;
wxTextCtrl* fieldNameTextCtrl;
wxStaticText* fieldValueLabel;
wxTextCtrl* fieldValueTextCtrl;
wxStaticText* textSizeLabel;
wxTextCtrl* textSizeTextCtrl;
wxStaticText* posXLabel;
wxTextCtrl* posXTextCtrl;
wxStaticText* posYLabel;
wxTextCtrl* posYTextCtrl;
wxStdDialogButtonSizer* stdDialogButtonSizer;
wxButton* stdDialogButtonSizerOK;
wxButton* stdDialogButtonSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); }
virtual void addFieldButtonHandler( wxCommandEvent& event ){ event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ){ event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 773,550 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE();
};
#endif //__dialog_edit_libentry_fields_in_lib_base__
This diff is collapsed.
......@@ -29,6 +29,8 @@ OBJECTS = eeschema.o\
component_class.o\
class_library.o\
dialog_options.o\
dialog_edit_libentry_fields_in_lib.o\
dialog_edit_libentry_fields_in_lib_base.o\
tool_lib.o\
tool_sch.o\
tool_viewlib.o\
......
......@@ -156,6 +156,12 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
-1, -1, (wxObject*) NULL,
_( "Edit component properties" ) );
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, BITMAP( add_text_xpm ),
wxNullBitmap,
FALSE,
-1, -1, (wxObject*) NULL,
_( "Add, remove, edit fields properties" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, BITMAP( erc_xpm ),
wxNullBitmap,
......
......@@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion
# include "config.h"
(wxT(KICAD_SVN_VERSION))
# else
(wxT("(20081221-unstable)")) /* main program version */
(wxT("(20081229-unstable)")) /* main program version */
# endif
#endif
;
......@@ -20,7 +20,7 @@ COMMON_GLOBL wxString g_BuildAboutVersion
# include "config.h"
(wxT(KICAD_ABOUT_VERSION))
# else
(wxT("(20081221-unstable)")) /* svn date & rev (normally overridden) */
(wxT("(20081229-unstable)")) /* svn date & rev (normally overridden) */
# endif
#endif
;
......
......@@ -429,6 +429,7 @@ enum main_id {
ID_LIBEDIT_SAVE_CURRENT_PART,
ID_LIBEDIT_NEW_PART,
ID_LIBEDIT_GET_FRAME_EDIT_PART,
ID_LIBEDIT_GET_FRAME_EDIT_FIELDS,
ID_LIBEDIT_DELETE_PART,
ID_LIBEDIT_IMPORT_PART,
ID_LIBEDIT_EXPORT_PART,
......@@ -439,14 +440,14 @@ enum main_id {
ID_DE_MORGAN_CONVERT_BUTT,
ID_LIBEDIT_EDIT_PIN_BY_PIN,
ID_LIBEDIT_VIEW_DOC,
ID_LIBEDIT_CHECK_PART,
ID_LIBEDIT_CHECK_PART,
ID_LIBEDIT_END_H_TOOL, // End Id for HToolBar (Libedit)
ID_LIBEDIT_SELECT_PART_NUMBER, // Id selection unit of part (HToolBar, combo box)
ID_LIBEDIT_SELECT_ALIAS, // Id selection alias of part (HToolBar, combo box)
ID_LIBEDIT_HTOOL_UNUSED1,
ID_LIBEDIT_HTOOL_UNUSED2,
ID_LIBEDIT_HTOOL_UNUSED3,
ID_LIBEDIT_HTOOL_UNUSED4,
ID_LIBEDIT_HTOOL_UNUSED3,
ID_LIBEDIT_HTOOL_UNUSED4,
/* Id pour VToolBar de Libedit */
ID_LIBEDIT_START_V_TOOL,
......
......@@ -25,6 +25,7 @@
#define ABS( y ) ( (y) >= 0 ? (y) : ( -(y) ) )
#endif
#define NEGATE(x) (x = -x)
/// # of elements in an arrray
#define DIM(x) (sizeof(x)/sizeof((x)[0]))
......
......@@ -408,6 +408,7 @@ private:
// General editing
public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
void InstallFieldsEditorDialog( void );
private:
bool GetComponentFromUndoList();
......
No preview for this file type
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment