diff --git a/common/displlst.cpp b/common/displlst.cpp index 0bdc6a107d..1353e963c5 100644 --- a/common/displlst.cpp +++ b/common/displlst.cpp @@ -8,6 +8,7 @@ #include "common.h" #include "macros.h" #include "kicad_string.h" +#include "dialog_helpers.h" enum listbox { diff --git a/common/drawframe.cpp b/common/drawframe.cpp index c0121c0742..5eed65db97 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -18,6 +18,7 @@ #include "wxstruct.h" #include "confirm.h" #include "kicad_device_context.h" +#include "dialog_helpers.h" #include diff --git a/common/wxwineda.cpp b/common/wxwineda.cpp index 26d8414f37..3a43e6349e 100644 --- a/common/wxwineda.cpp +++ b/common/wxwineda.cpp @@ -2,14 +2,10 @@ /* wxwineda.cpp */ /****************/ -#ifdef __GNUG__ -#pragma implementation -#endif - #include "fctsys.h" #include "common.h" #include "wxstruct.h" - +#include "dialog_helpers.h" /* * Text entry dialog to enter one or more lines of text. @@ -390,61 +386,3 @@ void WinEDA_ValueCtrl::Enable( bool enbl ) m_ValueCtrl->Enable( enbl ); m_Text->Enable( enbl ); } - - -/**********************************************************************/ -/* Class to display and edit a double precision floating point value. */ -/**********************************************************************/ -WinEDA_DFloatValueCtrl::WinEDA_DFloatValueCtrl( wxWindow* parent, - const wxString& title, - double value, - wxBoxSizer* BoxSizer ) -{ - wxString buffer; - wxString label = title; - - m_Value = value; - - m_Text = new wxStaticText( parent, -1, label ); - - BoxSizer->Add( m_Text, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); - - buffer.Printf( wxT( "%f" ), m_Value ); - m_ValueCtrl = new wxTextCtrl( parent, -1, buffer ); - - BoxSizer->Add( m_ValueCtrl, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); -} - - -WinEDA_DFloatValueCtrl::~WinEDA_DFloatValueCtrl() -{ - delete m_ValueCtrl; - delete m_Text; -} - - -double WinEDA_DFloatValueCtrl::GetValue() -{ - double coord = 0; - - m_ValueCtrl->GetValue().ToDouble( &coord ); - return coord; -} - - -void WinEDA_DFloatValueCtrl::SetValue( double new_value ) -{ - wxString buffer; - - m_Value = new_value; - - buffer.Printf( wxT( "%f" ), m_Value ); - m_ValueCtrl->SetValue( buffer ); -} - - -void WinEDA_DFloatValueCtrl::Enable( bool enbl ) -{ - m_ValueCtrl->Enable( enbl ); - m_Text->Enable( enbl ); -} diff --git a/eeschema/database.cpp b/eeschema/database.cpp index db6b8b75ea..b86a8b4936 100644 --- a/eeschema/database.cpp +++ b/eeschema/database.cpp @@ -14,6 +14,7 @@ #include "general.h" #include "protos.h" #include "class_library.h" +#include "dialog_helpers.h" #include @@ -64,13 +65,18 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, wxString& Buf return wxEmptyString; } - wxSingleChoiceDialog dlg( frame, wxEmptyString, _( "Select Component" ), - nameList ); + // Show candidate list: + wxString cmpname; + WinEDAListBox dlg( frame, _( "Select Component" ), + NULL, cmpname, DisplayCmpDoc ); - if( dlg.ShowModal() == wxID_CANCEL || dlg.GetStringSelection().IsEmpty() ) + dlg.InsertItems(nameList); + int selection = dlg.ShowModal(); + if( selection < 0 ) return wxEmptyString; - return dlg.GetStringSelection(); + cmpname = nameList[selection]; + return cmpname; } diff --git a/eeschema/dialog_edit_component_in_schematic.cpp b/eeschema/dialog_edit_component_in_schematic.cpp index 8a93ebecda..591f21a3b4 100644 --- a/eeschema/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialog_edit_component_in_schematic.cpp @@ -15,6 +15,7 @@ #include "protos.h" #include "class_library.h" #include "sch_component.h" +#include "dialog_helpers.h" #include "dialog_edit_component_in_schematic.h" @@ -685,9 +686,9 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() else field.m_Bold = false; - field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue(), + field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT ); - field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(), + field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT ); return true; diff --git a/eeschema/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialog_edit_libentry_fields_in_lib.cpp index 9e373a9e94..b40cdf90fa 100644 --- a/eeschema/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialog_edit_libentry_fields_in_lib.cpp @@ -17,6 +17,7 @@ #include "class_library.h" #include "sch_field.h" #include "template_fieldnames.h" +#include "dialog_helpers.h" #include "dialog_edit_libentry_fields_in_lib_base.h" diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index e88df59e79..8a7a8c1efe 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -28,6 +28,7 @@ #include "dialogs/dialog_lib_edit_text.h" #include "dialogs/dialog_SVG_print.h" +#include "dialog_helpers.h" #include diff --git a/eeschema/netlist_control.cpp b/eeschema/netlist_control.cpp index 0f8e78a45f..92d401f6ad 100644 --- a/eeschema/netlist_control.cpp +++ b/eeschema/netlist_control.cpp @@ -23,8 +23,9 @@ #include "general.h" #include "netlist.h" #include "protos.h" -#include "netlist_control.h" #include "sch_sheet.h" +#include "dialog_helpers.h" +#include "netlist_control.h" //Imported function: diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 1249b40724..507530fdc0 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -22,6 +22,7 @@ #include "wxEeschemaStruct.h" #include "class_sch_screen.h" +#include "dialog_helpers.h" #include "netlist_control.h" #include "libeditframe.h" #include "viewlib_frame.h" diff --git a/eeschema/selpart.cpp b/eeschema/selpart.cpp index 0dcf13158f..4c9d365edb 100644 --- a/eeschema/selpart.cpp +++ b/eeschema/selpart.cpp @@ -11,6 +11,7 @@ #include "general.h" #include "protos.h" #include "class_library.h" +#include "dialog_helpers.h" CMP_LIBRARY* SelectLibraryFromList( WinEDA_DrawFrame* frame ) diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index e5561357b2..ccbc9bfe47 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -14,6 +14,7 @@ #include "general.h" #include "protos.h" #include "sch_sheet.h" +#include "dialog_helpers.h" static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ); diff --git a/eeschema/tool_lib.cpp b/eeschema/tool_lib.cpp index 7e04a6cbc4..f105ab61b0 100644 --- a/eeschema/tool_lib.cpp +++ b/eeschema/tool_lib.cpp @@ -11,6 +11,7 @@ #include "general.h" #include "protos.h" #include "libeditframe.h" +#include "dialog_helpers.h" #include "help_common_strings.h" diff --git a/eeschema/tool_viewlib.cpp b/eeschema/tool_viewlib.cpp index d745ff10db..d9b7fb9328 100644 --- a/eeschema/tool_viewlib.cpp +++ b/eeschema/tool_viewlib.cpp @@ -14,6 +14,7 @@ #include "hotkeys.h" #include "class_library.h" #include "viewlib_frame.h" +#include "dialog_helpers.h" void WinEDA_ViewlibFrame::ReCreateHToolbar() diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index f1fd8f0d51..572b0c40e8 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -16,6 +16,7 @@ #include "viewlib_frame.h" #include "class_library.h" #include "hotkeys.h" +#include "dialog_helpers.h" /** diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp index dfd7817f82..5fbd07a566 100644 --- a/eeschema/viewlibs.cpp +++ b/eeschema/viewlibs.cpp @@ -17,6 +17,7 @@ #include "viewlib_frame.h" #include "eeschema_id.h" #include "class_library.h" +#include "dialog_helpers.h" #define NEXT_PART 1 diff --git a/gerbview/dialogs/dialog_gerber_config.cpp b/gerbview/dialogs/dialog_gerber_config.cpp index 962e869de9..46df0ee61b 100644 --- a/gerbview/dialogs/dialog_gerber_config.cpp +++ b/gerbview/dialogs/dialog_gerber_config.cpp @@ -11,6 +11,7 @@ #include "appl_wxstruct.h" #include "common.h" #include "gerbview.h" +#include "dialog_helpers.h" enum diff --git a/gerbview/edit.cpp b/gerbview/edit.cpp index 8d083de535..86ec9b9088 100644 --- a/gerbview/edit.cpp +++ b/gerbview/edit.cpp @@ -14,6 +14,7 @@ #include "kicad_device_context.h" #include "gerbview_id.h" #include "class_GERBER.h" +#include "dialog_helpers.h" /* Process the command triggered by the left button of the mouse when a tool diff --git a/gerbview/gerberframe.cpp b/gerbview/gerberframe.cpp index de0cbabbad..3d2661eb18 100644 --- a/gerbview/gerberframe.cpp +++ b/gerbview/gerberframe.cpp @@ -19,6 +19,7 @@ #include "gerbview_id.h" #include "hotkeys.h" #include "class_GERBER.h" +#include "dialog_helpers.h" #include "build_version.h" diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp index 5e0c868fe7..6b34375e11 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/gerbview/toolbars_gerber.cpp @@ -14,6 +14,7 @@ #include "hotkeys.h" #include "class_GERBER.h" #include "class_layerchoicebox.h" +#include "dialog_helpers.h" void WinEDA_GerberFrame::ReCreateHToolbar( void ) { diff --git a/include/dialog_helpers.h b/include/dialog_helpers.h new file mode 100644 index 0000000000..590447c49e --- /dev/null +++ b/include/dialog_helpers.h @@ -0,0 +1,250 @@ +// file dialog_helpers.h + +#ifndef _DIALOG_HELPERS_H_ +#define _DIALOG_HELPERS_H_ + +/* some small helper classes used in dialogs + * Due to use of wxFormBuilder to create dialogs + * most of them should be removed + */ + +/************************************************/ +/* Class to enter a line, is some dialog frames */ +/************************************************/ +class WinEDA_EnterText +{ +public: + bool m_Modify; + +private: + wxString m_NewText; + wxTextCtrl* m_FrameText; + wxStaticText* m_Title; + +public: + WinEDA_EnterText( wxWindow* parent, const wxString& Title, + const wxString& TextToEdit, wxBoxSizer* BoxSizer, + const wxSize& Size, bool Multiline = false ); + + ~WinEDA_EnterText() + { + } + + + wxString GetValue(); + void GetValue( char* buffer, int lenmax ); + void SetValue( const wxString& new_text ); + void Enable( bool enbl ); + + void SetFocus() { m_FrameText->SetFocus(); } + void SetInsertionPoint( int n ) { m_FrameText->SetInsertionPoint( n ); } + void SetSelection( int n, int m ) + { + m_FrameText->SetSelection( n, m ); + } +}; + + +/************************************************************************/ +/* Class to edit/enter a graphic text and its dimension ( INCHES or MM )*/ +/************************************************************************/ +class WinEDA_GraphicTextCtrl +{ +public: + UserUnitType m_UserUnit; + int m_Internal_Unit; + + wxTextCtrl* m_FrameText; + wxTextCtrl* m_FrameSize; +private: + wxStaticText* m_Title; + +public: + WinEDA_GraphicTextCtrl( wxWindow* parent, const wxString& Title, + const wxString& TextToEdit, int textsize, + UserUnitType user_unit, wxBoxSizer* BoxSizer, int framelen = 200, + int internal_unit = EESCHEMA_INTERNAL_UNIT ); + + ~WinEDA_GraphicTextCtrl(); + + wxString GetText(); + int GetTextSize(); + void Enable( bool state ); + void SetTitle( const wxString& title ); + + void SetFocus() { m_FrameText->SetFocus(); } + void SetValue( const wxString& value ); + void SetValue( int value ); + + /** + * Function FormatSize + * formats a string containing the size in the desired units. + */ + static wxString FormatSize( int internalUnit, UserUnitType user_unit, int textSize ); + + static int ParseSize( const wxString& sizeText, int internalUnit, + UserUnitType user_unit ); +}; + + +/**************************************************************************/ +/* Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in */ +/* dialog boxes, */ +/**************************************************************************/ +class WinEDA_PositionCtrl +{ +public: + UserUnitType m_UserUnit; + int m_Internal_Unit; + wxPoint m_Pos_To_Edit; + + wxTextCtrl* m_FramePosX; + wxTextCtrl* m_FramePosY; +private: + wxStaticText* m_TextX, * m_TextY; + +public: + WinEDA_PositionCtrl( wxWindow* parent, const wxString& title, + const wxPoint& pos_to_edit, + UserUnitType user_unit, wxBoxSizer* BoxSizer, + int internal_unit = EESCHEMA_INTERNAL_UNIT ); + + ~WinEDA_PositionCtrl(); + + void Enable( bool x_win_on, bool y_win_on ); + void SetValue( int x_value, int y_value ); + wxPoint GetValue(); +}; + + +/************************************************************* + * Class to edit/enter a size (pair of values for X and Y size) + * ( INCHES or MM ) in dialog boxes + ***************************************************************/ +class WinEDA_SizeCtrl : public WinEDA_PositionCtrl +{ +public: + WinEDA_SizeCtrl( wxWindow* parent, const wxString& title, + const wxSize& size_to_edit, + UserUnitType user_unit, wxBoxSizer* BoxSizer, + int internal_unit = EESCHEMA_INTERNAL_UNIT ); + + ~WinEDA_SizeCtrl() { } + wxSize GetValue(); +}; + + +/****************************************************************/ +/* Class to edit/enter a value ( INCHES or MM ) in dialog boxes */ +/****************************************************************/ +class WinEDA_ValueCtrl +{ +public: + UserUnitType m_UserUnit; + int m_Value; + wxTextCtrl* m_ValueCtrl; +private: + int m_Internal_Unit; + wxStaticText* m_Text; + +public: + WinEDA_ValueCtrl( wxWindow* parent, const wxString& title, int value, + UserUnitType user_unit, wxBoxSizer* BoxSizer, + int internal_unit = EESCHEMA_INTERNAL_UNIT ); + + ~WinEDA_ValueCtrl(); + + int GetValue(); + void SetValue( int new_value ); + void Enable( bool enbl ); + + void SetToolTip( const wxString& text ) + { + m_ValueCtrl->SetToolTip( text ); + } +}; + + +/***********************/ +/* class WinEDAListBox */ +/***********************/ + +class WinEDAListBox : public wxDialog +{ +public: + WinEDA_DrawFrame* m_Parent; + wxListBox* m_List; + wxTextCtrl* m_WinMsg; + const wxChar** m_ItemList; + +private: + void (*m_MoveFct)( wxString& Text ); + +public: + WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title, + const wxChar** ItemList, + const wxString& RefText, + void(* movefct)(wxString& Text) = NULL, + const wxColour& colour = wxNullColour, + wxPoint dialog_position = wxDefaultPosition ); + ~WinEDAListBox(); + + void SortList(); + void Append( const wxString& item ); + void InsertItems( const wxArrayString& itemlist, int position = 0 ); + void MoveMouseToOrigin(); + wxString GetTextSelection(); + +private: + void OnClose( wxCloseEvent& event ); + void OnCancelClick( wxCommandEvent& event ); + void OnOkClick( wxCommandEvent& event ); + void ClickOnList( wxCommandEvent& event ); + void D_ClickOnList( wxCommandEvent& event ); + void OnKeyEvent( wxKeyEvent& event ); + + DECLARE_EVENT_TABLE() +}; + + +/*************************/ +/* class WinEDAChoiceBox */ +/*************************/ + +/* class to display a choice list. + * This is a wrapper to wxComboBox (or wxChoice) + * but because they have some problems, WinEDAChoiceBox uses workarounds: + * - in wxGTK 2.6.2 wxGetSelection() does not work properly, + * - and wxChoice crashes if compiled in non unicode mode and uses utf8 codes + */ + +#define EVT_KICAD_CHOICEBOX EVT_COMBOBOX +class WinEDAChoiceBox : public wxComboBox +{ +public: + WinEDAChoiceBox( wxWindow* parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL ) : + wxComboBox( parent, id, wxEmptyString, pos, size, + n, choices, wxCB_READONLY ) + { + } + + + WinEDAChoiceBox( wxWindow* parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices ) : + wxComboBox( parent, id, wxEmptyString, pos, size, + choices, wxCB_READONLY ) + { + } + + + int GetChoice() + { + return GetCurrentSelection(); + } +}; + +#endif diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index b389f508ea..96f39ae396 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -570,6 +570,8 @@ public: void OnConfigurePcbOptions( wxCommandEvent& aEvent ); void InstallDisplayOptionsDialog( wxCommandEvent& aEvent ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); + bool InstallDialogNonCopperZonesEditor( ZONE_CONTAINER* aZone ); + void InstallDialogLayerSetup(); void GenModulesPosition( wxCommandEvent& event ); void GenModuleReport( wxCommandEvent& event ); diff --git a/include/wxstruct.h b/include/wxstruct.h index 650f64a032..2c37ed0329 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -626,192 +626,6 @@ public: DECLARE_EVENT_TABLE() }; - -/************************************************/ -/* Class to enter a line, is some dialog frames */ -/************************************************/ -class WinEDA_EnterText -{ -public: - bool m_Modify; - -private: - wxString m_NewText; - wxTextCtrl* m_FrameText; - wxStaticText* m_Title; - -public: - WinEDA_EnterText( wxWindow* parent, const wxString& Title, - const wxString& TextToEdit, wxBoxSizer* BoxSizer, - const wxSize& Size, bool Multiline = false ); - - ~WinEDA_EnterText() - { - } - - - wxString GetValue(); - void GetValue( char* buffer, int lenmax ); - void SetValue( const wxString& new_text ); - void Enable( bool enbl ); - - void SetFocus() { m_FrameText->SetFocus(); } - void SetInsertionPoint( int n ) { m_FrameText->SetInsertionPoint( n ); } - void SetSelection( int n, int m ) - { - m_FrameText->SetSelection( n, m ); - } -}; - - -/************************************************************************/ -/* Class to edit/enter a graphic text and its dimension ( INCHES or MM )*/ -/************************************************************************/ -class WinEDA_GraphicTextCtrl -{ -public: - UserUnitType m_UserUnit; - int m_Internal_Unit; - - wxTextCtrl* m_FrameText; - wxTextCtrl* m_FrameSize; -private: - wxStaticText* m_Title; - -public: - WinEDA_GraphicTextCtrl( wxWindow* parent, const wxString& Title, - const wxString& TextToEdit, int textsize, - UserUnitType user_unit, wxBoxSizer* BoxSizer, int framelen = 200, - int internal_unit = EESCHEMA_INTERNAL_UNIT ); - - ~WinEDA_GraphicTextCtrl(); - - wxString GetText(); - int GetTextSize(); - void Enable( bool state ); - void SetTitle( const wxString& title ); - - void SetFocus() { m_FrameText->SetFocus(); } - void SetValue( const wxString& value ); - void SetValue( int value ); - - /** - * Function FormatSize - * formats a string containing the size in the desired units. - */ - static wxString FormatSize( int internalUnit, UserUnitType user_unit, int textSize ); - - static int ParseSize( const wxString& sizeText, int internalUnit, - UserUnitType user_unit ); -}; - - -/**************************************************************************/ -/* Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in */ -/* dialog boxes, */ -/**************************************************************************/ -class WinEDA_PositionCtrl -{ -public: - UserUnitType m_UserUnit; - int m_Internal_Unit; - wxPoint m_Pos_To_Edit; - - wxTextCtrl* m_FramePosX; - wxTextCtrl* m_FramePosY; -private: - wxStaticText* m_TextX, * m_TextY; - -public: - WinEDA_PositionCtrl( wxWindow* parent, const wxString& title, - const wxPoint& pos_to_edit, - UserUnitType user_unit, wxBoxSizer* BoxSizer, - int internal_unit = EESCHEMA_INTERNAL_UNIT ); - - ~WinEDA_PositionCtrl(); - - void Enable( bool x_win_on, bool y_win_on ); - void SetValue( int x_value, int y_value ); - wxPoint GetValue(); -}; - - -/************************************************************* - * Class to edit/enter a size (pair of values for X and Y size) - * ( INCHES or MM ) in dialog boxes - ***************************************************************/ -class WinEDA_SizeCtrl : public WinEDA_PositionCtrl -{ -public: - WinEDA_SizeCtrl( wxWindow* parent, const wxString& title, - const wxSize& size_to_edit, - UserUnitType user_unit, wxBoxSizer* BoxSizer, - int internal_unit = EESCHEMA_INTERNAL_UNIT ); - - ~WinEDA_SizeCtrl() { } - wxSize GetValue(); -}; - - -/****************************************************************/ -/* Class to edit/enter a value ( INCHES or MM ) in dialog boxes */ -/****************************************************************/ -class WinEDA_ValueCtrl -{ -public: - UserUnitType m_UserUnit; - int m_Value; - wxTextCtrl* m_ValueCtrl; -private: - int m_Internal_Unit; - wxStaticText* m_Text; - -public: - WinEDA_ValueCtrl( wxWindow* parent, const wxString& title, int value, - UserUnitType user_unit, wxBoxSizer* BoxSizer, - int internal_unit = EESCHEMA_INTERNAL_UNIT ); - - ~WinEDA_ValueCtrl(); - - int GetValue(); - void SetValue( int new_value ); - void Enable( bool enbl ); - - void SetToolTip( const wxString& text ) - { - m_ValueCtrl->SetToolTip( text ); - } -}; - - -/************************************************************************/ -/* Class to edit/enter a pair of float (double) values in dialog boxes */ -/************************************************************************/ -class WinEDA_DFloatValueCtrl -{ -public: - double m_Value; - wxTextCtrl* m_ValueCtrl; -private: - wxStaticText* m_Text; - -public: - WinEDA_DFloatValueCtrl( wxWindow* parent, const wxString& title, - double value, wxBoxSizer* BoxSizer ); - - ~WinEDA_DFloatValueCtrl(); - - double GetValue(); - void SetValue( double new_value ); - void Enable( bool enbl ); - - void SetToolTip( const wxString& text ) - { - m_ValueCtrl->SetToolTip( text ); - } -}; - - /*************************/ /* class WinEDA_Toolbar */ /*************************/ @@ -852,86 +666,4 @@ public: }; -/***********************/ -/* class WinEDAListBox */ -/***********************/ - -class WinEDAListBox : public wxDialog -{ -public: - WinEDA_DrawFrame* m_Parent; - wxListBox* m_List; - wxTextCtrl* m_WinMsg; - const wxChar** m_ItemList; - -private: - void (*m_MoveFct)( wxString& Text ); - -public: - WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title, - const wxChar** ItemList, - const wxString& RefText, - void(* movefct)(wxString& Text) = NULL, - const wxColour& colour = wxNullColour, - wxPoint dialog_position = wxDefaultPosition ); - ~WinEDAListBox(); - - void SortList(); - void Append( const wxString& item ); - void InsertItems( const wxArrayString& itemlist, int position = 0 ); - void MoveMouseToOrigin(); - wxString GetTextSelection(); - -private: - void OnClose( wxCloseEvent& event ); - void OnCancelClick( wxCommandEvent& event ); - void OnOkClick( wxCommandEvent& event ); - void ClickOnList( wxCommandEvent& event ); - void D_ClickOnList( wxCommandEvent& event ); - void OnKeyEvent( wxKeyEvent& event ); - - DECLARE_EVENT_TABLE() -}; - - -/*************************/ -/* class WinEDAChoiceBox */ -/*************************/ - -/* class to display a choice list. - * This is a wrapper to wxComboBox (or wxChoice) - * but because they have some problems, WinEDAChoiceBox uses workarounds: - * - in wxGTK 2.6.2 wxGetSelection() does not work properly, - * - and wxChoice crashes if compiled in non unicode mode and uses utf8 codes - */ - -#define EVT_KICAD_CHOICEBOX EVT_COMBOBOX -class WinEDAChoiceBox : public wxComboBox -{ -public: - WinEDAChoiceBox( wxWindow* parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL ) : - wxComboBox( parent, id, wxEmptyString, pos, size, - n, choices, wxCB_READONLY ) - { - } - - - WinEDAChoiceBox( wxWindow* parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - const wxArrayString& choices ) : - wxComboBox( parent, id, wxEmptyString, pos, size, - choices, wxCB_READONLY ) - { - } - - - int GetChoice() - { - return GetCurrentSelection(); - } -}; - #endif /* WXSTRUCT_H */ diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 8ea0fe05ba..143e354ac9 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -14,7 +14,6 @@ #include "pcbnew.h" #include "bitmaps.h" -#include "protos.h" #include "pcbnew_id.h" #include "class_board_design_settings.h" diff --git a/pcbnew/dialog_layers_setup.cpp b/pcbnew/dialog_layers_setup.cpp index accb25402c..fba1d3446e 100644 --- a/pcbnew/dialog_layers_setup.cpp +++ b/pcbnew/dialog_layers_setup.cpp @@ -698,10 +698,8 @@ bool DIALOG_LAYERS_SETUP::testLayerNames() } -void DisplayDialogLayerSetup( WinEDA_PcbFrame* parent ) +void WinEDA_PcbFrame::InstallDialogLayerSetup() { - DIALOG_LAYERS_SETUP frame( parent ); - - frame.ShowModal(); - frame.Destroy(); + DIALOG_LAYERS_SETUP dlg( this ); + dlg.ShowModal(); } diff --git a/pcbnew/dialog_pcb_text_properties.cpp b/pcbnew/dialog_pcb_text_properties.cpp index 12057b5e6a..92867efa19 100644 --- a/pcbnew/dialog_pcb_text_properties.cpp +++ b/pcbnew/dialog_pcb_text_properties.cpp @@ -10,6 +10,7 @@ #include "wxPcbStruct.h" #include "drawtxt.h" #include "confirm.h" +#include "dialog_helpers.h" enum id_TextPCB_properties { ID_TEXTPCB_SELECT_LAYER = 1900 diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index 3e8127c347..c5848abca6 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -10,6 +10,7 @@ #include "wxPcbStruct.h" #include "class_board_design_settings.h" #include "drawtxt.h" +#include "dialog_helpers.h" /* Loca functions */ static void Exit_EditDimension( WinEDA_DrawPanel* Panel, wxDC* DC ); diff --git a/pcbnew/event_handlers_tracks_vias_sizes.cpp b/pcbnew/event_handlers_tracks_vias_sizes.cpp index 9ce85703e4..d6e1fdfd36 100644 --- a/pcbnew/event_handlers_tracks_vias_sizes.cpp +++ b/pcbnew/event_handlers_tracks_vias_sizes.cpp @@ -15,6 +15,7 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "class_board_design_settings.h" +#include "dialog_helpers.h" /** * Function Tracks_and_Vias_Size_Event diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 38ab2bd15a..c538cc3838 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -12,7 +12,7 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "module_editor_frame.h" -#include "protos.h" +#include "dialog_helpers.h" /* * Module library header format: diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 31f92ac0cb..f9a392179c 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -16,7 +16,7 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "module_editor_frame.h" -#include "protos.h" +#include "dialog_helpers.h" class ModList { diff --git a/pcbnew/mirepcb.cpp b/pcbnew/mirepcb.cpp index e50668fdc2..23a3aa5733 100644 --- a/pcbnew/mirepcb.cpp +++ b/pcbnew/mirepcb.cpp @@ -9,6 +9,7 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "class_board_design_settings.h" +#include "dialog_helpers.h" #include "protos.h" diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 54a1bf8c52..417de46579 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -14,6 +14,7 @@ #include "protos.h" #include "pcbnew_id.h" #include "hotkeys.h" +#include "dialog_helpers.h" #include "3d_viewer.h" diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index aea0fa2229..e30803b88b 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -13,6 +13,7 @@ #include "wxPcbStruct.h" #include "class_board_design_settings.h" #include "protos.h" +#include "dialog_helpers.h" #define COEFF_COUNT 6 diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 926f379e03..724f5045ea 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -36,6 +36,7 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "richio.h" +#include "dialog_helpers.h" #include "dialog_netlist.h" diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index db6855dbeb..f835ea9f7b 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -50,6 +50,7 @@ #include "pcbnew_config.h" #include "module_editor_frame.h" #include "dialog_SVG_print.h" +#include "dialog_helpers.h" extern int g_DrawDefaultLineThickness; diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index d5f0ec73da..dd79c5b427 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -54,7 +54,7 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event ) break; case ID_PCB_LAYERS_SETUP: - DisplayDialogLayerSetup( this ); + InstallDialogLayerSetup(); break; case ID_CONFIG_REQ: diff --git a/pcbnew/protos.h b/pcbnew/protos.h index d22ccca9af..d60eaeb49e 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -22,10 +22,6 @@ class COMMAND; void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage ); -/* install function for DialogNonCopperZonesEditor dialog frame :*/ -bool InstallDialogNonCopperZonesEditor( WinEDA_PcbFrame* aParent, - ZONE_CONTAINER* aZone ); - /*******************/ /* PAD_CONNECT.CPP */ /*******************/ @@ -213,10 +209,6 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, bool erase ); -/* LOADCMP.C : */ -MODULE* Load_Module_From_Library( WinEDA_DrawFrame* frame, wxDC* DC ); - - /****************/ /* EDITRACK.C : */ /****************/ @@ -277,32 +269,11 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, void ListSetState( EDA_BaseStruct* Start, int Nbitem, int State, int onoff ); -/**************/ -/* CLEAN.CPP : */ -/**************/ - -/* Remove segments connected incorrectly. - */ -int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ); - - /************/ /* ZONES.CPP */ /************/ int Propagation( WinEDA_PcbFrame* frame ); -/****************/ -/* ATTRIBUT.CPP */ -/****************/ - -/* Compute the attributes that are 0 (masque_clr) and put a 1 - * (Masque_set), depending on the options attribute. - * - * These attributes are normally the member flags of the structure TRACK - * Pointers NULLs are accepted. - */ -void MasqueAttributs( int* masque_set, int* masque_clr ); - /***************/ /* DUPLTRAC.CPP */ @@ -347,26 +318,4 @@ void RemoteCommand( const char* cmdline ); bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track ); -/***************/ -/* AUTOROUT.CPP */ -/***************/ -void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC ); /* for Debugging */ - - -/**************/ -/* NETLIST.CPP */ -/**************/ - -/* List the names of the modules of PCB - * Returns a pointer to the module selected or NULL if no selection. - */ -MODULE* ListAndSelectModuleName( COMMAND* Cmd ); - - -/***************************/ -/* DIALOG_LAYERS_SETUP.CPP */ -/***************************/ - -void DisplayDialogLayerSetup( WinEDA_PcbFrame* parent ); - #endif /* #define PROTO_H */ diff --git a/pcbnew/tool_modedit.cpp b/pcbnew/tool_modedit.cpp index 8c7fbda220..c2987f5a1f 100644 --- a/pcbnew/tool_modedit.cpp +++ b/pcbnew/tool_modedit.cpp @@ -8,15 +8,13 @@ #include "pcbnew.h" #include "wxPcbStruct.h" #include "module_editor_frame.h" - -#include "protos.h" - +#include "dialog_helpers.h" #include "bitmaps.h" - #include "pcbnew_id.h" - #include "hotkeys.h" +//#include "protos.h" + #ifdef __UNIX__ #define LISTBOX_WIDTH 140 #else diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index f4d3e3a58b..423c0f89b6 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -10,9 +10,8 @@ #include "wxPcbStruct.h" #include "class_board_design_settings.h" #include "colors_selection.h" - +#include "dialog_helpers.h" #include "bitmaps.h" - #include "pcbnew_id.h" #ifdef __UNIX__ diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index e0cd18a502..72d06a1789 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -17,6 +17,7 @@ #include "drc_stuff.h" #include "3d_viewer.h" #include "class_board_design_settings.h" +#include "dialog_helpers.h" /* helper to convert an integer value to a string, using mils or mm * according to g_UserUnit value diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index ca9d998108..ad205bc842 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -526,7 +526,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) } else // Put a zone on a non copper layer (technical layer) { - diag = InstallDialogNonCopperZonesEditor( this, zone ); + diag = InstallDialogNonCopperZonesEditor( zone ); g_Zone_Default_Setting.m_NetcodeSelection = 0; // No net for non copper zones } DrawPanel->MouseToCursorSchema(); @@ -787,7 +787,7 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container frame->Destroy(); } else // edit a zone on a non copper layer (technical layer) - diag = InstallDialogNonCopperZonesEditor( this, zone_container ); + diag = InstallDialogNonCopperZonesEditor( zone_container ); DrawPanel->MouseToCursorSchema(); DrawPanel->m_IgnoreMouseEvents = FALSE; diff --git a/pcbnew/zones_non_copper_type_functions.cpp b/pcbnew/zones_non_copper_type_functions.cpp index 5333df18ab..5a9845a969 100644 --- a/pcbnew/zones_non_copper_type_functions.cpp +++ b/pcbnew/zones_non_copper_type_functions.cpp @@ -62,10 +62,9 @@ DialogNonCopperZonesEditor::~DialogNonCopperZonesEditor() } -/* install function for DialogNonCopperZonesEditor dialog frame :*/ -bool InstallDialogNonCopperZonesEditor( WinEDA_PcbFrame* aParent, ZONE_CONTAINER* aZone ) +bool WinEDA_PcbFrame::InstallDialogNonCopperZonesEditor( ZONE_CONTAINER* aZone ) { - DialogNonCopperZonesEditor frame( aParent, aZone, &g_Zone_Default_Setting ); + DialogNonCopperZonesEditor frame( this, aZone, &g_Zone_Default_Setting ); bool diag = frame.ShowModal(); return diag;