Commit e095b07c authored by jean-pierre charras's avatar jean-pierre charras

code cleaning

parent 2cdce05d
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "common.h" #include "common.h"
#include "macros.h" #include "macros.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "dialog_helpers.h"
enum listbox { enum listbox {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "wxstruct.h" #include "wxstruct.h"
#include "confirm.h" #include "confirm.h"
#include "kicad_device_context.h" #include "kicad_device_context.h"
#include "dialog_helpers.h"
#include <wx/fontdlg.h> #include <wx/fontdlg.h>
......
...@@ -2,14 +2,10 @@ ...@@ -2,14 +2,10 @@
/* wxwineda.cpp */ /* wxwineda.cpp */
/****************/ /****************/
#ifdef __GNUG__
#pragma implementation
#endif
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "dialog_helpers.h"
/* /*
* Text entry dialog to enter one or more lines of text. * Text entry dialog to enter one or more lines of text.
...@@ -390,61 +386,3 @@ void WinEDA_ValueCtrl::Enable( bool enbl ) ...@@ -390,61 +386,3 @@ void WinEDA_ValueCtrl::Enable( bool enbl )
m_ValueCtrl->Enable( enbl ); m_ValueCtrl->Enable( enbl );
m_Text->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 );
}
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "dialog_helpers.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
...@@ -64,13 +65,18 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, wxString& Buf ...@@ -64,13 +65,18 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, wxString& Buf
return wxEmptyString; return wxEmptyString;
} }
wxSingleChoiceDialog dlg( frame, wxEmptyString, _( "Select Component" ), // Show candidate list:
nameList ); 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 wxEmptyString;
return dlg.GetStringSelection(); cmpname = nameList[selection];
return cmpname;
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "sch_component.h" #include "sch_component.h"
#include "dialog_helpers.h"
#include "dialog_edit_component_in_schematic.h" #include "dialog_edit_component_in_schematic.h"
...@@ -685,9 +686,9 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -685,9 +686,9 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
else else
field.m_Bold = false; 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 ); EESCHEMA_INTERNAL_UNIT );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(), field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
return true; return true;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "class_library.h" #include "class_library.h"
#include "sch_field.h" #include "sch_field.h"
#include "template_fieldnames.h" #include "template_fieldnames.h"
#include "dialog_helpers.h"
#include "dialog_edit_libentry_fields_in_lib_base.h" #include "dialog_edit_libentry_fields_in_lib_base.h"
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "dialogs/dialog_lib_edit_text.h" #include "dialogs/dialog_lib_edit_text.h"
#include "dialogs/dialog_SVG_print.h" #include "dialogs/dialog_SVG_print.h"
#include "dialog_helpers.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
......
...@@ -23,8 +23,9 @@ ...@@ -23,8 +23,9 @@
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "protos.h" #include "protos.h"
#include "netlist_control.h"
#include "sch_sheet.h" #include "sch_sheet.h"
#include "dialog_helpers.h"
#include "netlist_control.h"
//Imported function: //Imported function:
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "wxEeschemaStruct.h" #include "wxEeschemaStruct.h"
#include "class_sch_screen.h" #include "class_sch_screen.h"
#include "dialog_helpers.h"
#include "netlist_control.h" #include "netlist_control.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "viewlib_frame.h" #include "viewlib_frame.h"
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "dialog_helpers.h"
CMP_LIBRARY* SelectLibraryFromList( WinEDA_DrawFrame* frame ) CMP_LIBRARY* SelectLibraryFromList( WinEDA_DrawFrame* frame )
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "sch_sheet.h" #include "sch_sheet.h"
#include "dialog_helpers.h"
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ); static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "dialog_helpers.h"
#include "help_common_strings.h" #include "help_common_strings.h"
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "hotkeys.h" #include "hotkeys.h"
#include "class_library.h" #include "class_library.h"
#include "viewlib_frame.h" #include "viewlib_frame.h"
#include "dialog_helpers.h"
void WinEDA_ViewlibFrame::ReCreateHToolbar() void WinEDA_ViewlibFrame::ReCreateHToolbar()
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "viewlib_frame.h" #include "viewlib_frame.h"
#include "class_library.h" #include "class_library.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "dialog_helpers.h"
/** /**
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "viewlib_frame.h" #include "viewlib_frame.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "class_library.h" #include "class_library.h"
#include "dialog_helpers.h"
#define NEXT_PART 1 #define NEXT_PART 1
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "gerbview.h" #include "gerbview.h"
#include "dialog_helpers.h"
enum enum
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "kicad_device_context.h" #include "kicad_device_context.h"
#include "gerbview_id.h" #include "gerbview_id.h"
#include "class_GERBER.h" #include "class_GERBER.h"
#include "dialog_helpers.h"
/* Process the command triggered by the left button of the mouse when a tool /* Process the command triggered by the left button of the mouse when a tool
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "gerbview_id.h" #include "gerbview_id.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "class_GERBER.h" #include "class_GERBER.h"
#include "dialog_helpers.h"
#include "build_version.h" #include "build_version.h"
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "hotkeys.h" #include "hotkeys.h"
#include "class_GERBER.h" #include "class_GERBER.h"
#include "class_layerchoicebox.h" #include "class_layerchoicebox.h"
#include "dialog_helpers.h"
void WinEDA_GerberFrame::ReCreateHToolbar( void ) void WinEDA_GerberFrame::ReCreateHToolbar( void )
{ {
......
// 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
...@@ -570,6 +570,8 @@ public: ...@@ -570,6 +570,8 @@ public:
void OnConfigurePcbOptions( wxCommandEvent& aEvent ); void OnConfigurePcbOptions( wxCommandEvent& aEvent );
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent ); void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
bool InstallDialogNonCopperZonesEditor( ZONE_CONTAINER* aZone );
void InstallDialogLayerSetup();
void GenModulesPosition( wxCommandEvent& event ); void GenModulesPosition( wxCommandEvent& event );
void GenModuleReport( wxCommandEvent& event ); void GenModuleReport( wxCommandEvent& event );
......
...@@ -626,192 +626,6 @@ public: ...@@ -626,192 +626,6 @@ public:
DECLARE_EVENT_TABLE() 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 */ /* class WinEDA_Toolbar */
/*************************/ /*************************/
...@@ -852,86 +666,4 @@ public: ...@@ -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 */ #endif /* WXSTRUCT_H */
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "protos.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
......
...@@ -698,10 +698,8 @@ bool DIALOG_LAYERS_SETUP::testLayerNames() ...@@ -698,10 +698,8 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
} }
void DisplayDialogLayerSetup( WinEDA_PcbFrame* parent ) void WinEDA_PcbFrame::InstallDialogLayerSetup()
{ {
DIALOG_LAYERS_SETUP frame( parent ); DIALOG_LAYERS_SETUP dlg( this );
dlg.ShowModal();
frame.ShowModal();
frame.Destroy();
} }
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "confirm.h" #include "confirm.h"
#include "dialog_helpers.h"
enum id_TextPCB_properties { enum id_TextPCB_properties {
ID_TEXTPCB_SELECT_LAYER = 1900 ID_TEXTPCB_SELECT_LAYER = 1900
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "dialog_helpers.h"
/* Loca functions */ /* Loca functions */
static void Exit_EditDimension( WinEDA_DrawPanel* Panel, wxDC* DC ); static void Exit_EditDimension( WinEDA_DrawPanel* Panel, wxDC* DC );
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "dialog_helpers.h"
/** /**
* Function Tracks_and_Vias_Size_Event * Function Tracks_and_Vias_Size_Event
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h" #include "module_editor_frame.h"
#include "protos.h" #include "dialog_helpers.h"
/* /*
* Module library header format: * Module library header format:
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h" #include "module_editor_frame.h"
#include "protos.h" #include "dialog_helpers.h"
class ModList class ModList
{ {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "dialog_helpers.h"
#include "protos.h" #include "protos.h"
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "protos.h" #include "protos.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "dialog_helpers.h"
#include "3d_viewer.h" #include "3d_viewer.h"
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "protos.h" #include "protos.h"
#include "dialog_helpers.h"
#define COEFF_COUNT 6 #define COEFF_COUNT 6
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "richio.h" #include "richio.h"
#include "dialog_helpers.h"
#include "dialog_netlist.h" #include "dialog_netlist.h"
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "pcbnew_config.h" #include "pcbnew_config.h"
#include "module_editor_frame.h" #include "module_editor_frame.h"
#include "dialog_SVG_print.h" #include "dialog_SVG_print.h"
#include "dialog_helpers.h"
extern int g_DrawDefaultLineThickness; extern int g_DrawDefaultLineThickness;
......
...@@ -54,7 +54,7 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event ) ...@@ -54,7 +54,7 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
break; break;
case ID_PCB_LAYERS_SETUP: case ID_PCB_LAYERS_SETUP:
DisplayDialogLayerSetup( this ); InstallDialogLayerSetup();
break; break;
case ID_CONFIG_REQ: case ID_CONFIG_REQ:
......
...@@ -22,10 +22,6 @@ class COMMAND; ...@@ -22,10 +22,6 @@ class COMMAND;
void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage ); 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 */ /* PAD_CONNECT.CPP */
/*******************/ /*******************/
...@@ -213,10 +209,6 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, ...@@ -213,10 +209,6 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel,
bool erase ); bool erase );
/* LOADCMP.C : */
MODULE* Load_Module_From_Library( WinEDA_DrawFrame* frame, wxDC* DC );
/****************/ /****************/
/* EDITRACK.C : */ /* EDITRACK.C : */
/****************/ /****************/
...@@ -277,32 +269,11 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, ...@@ -277,32 +269,11 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
void ListSetState( EDA_BaseStruct* Start, int Nbitem, int State, int onoff ); 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 */ /* ZONES.CPP */
/************/ /************/
int Propagation( WinEDA_PcbFrame* frame ); 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 */ /* DUPLTRAC.CPP */
...@@ -347,26 +318,4 @@ void RemoteCommand( const char* cmdline ); ...@@ -347,26 +318,4 @@ void RemoteCommand( const char* cmdline );
bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track ); 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 */ #endif /* #define PROTO_H */
...@@ -8,15 +8,13 @@ ...@@ -8,15 +8,13 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "module_editor_frame.h" #include "module_editor_frame.h"
#include "dialog_helpers.h"
#include "protos.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
#include "hotkeys.h" #include "hotkeys.h"
//#include "protos.h"
#ifdef __UNIX__ #ifdef __UNIX__
#define LISTBOX_WIDTH 140 #define LISTBOX_WIDTH 140
#else #else
......
...@@ -10,9 +10,8 @@ ...@@ -10,9 +10,8 @@
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "colors_selection.h" #include "colors_selection.h"
#include "dialog_helpers.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
#ifdef __UNIX__ #ifdef __UNIX__
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "drc_stuff.h" #include "drc_stuff.h"
#include "3d_viewer.h" #include "3d_viewer.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "dialog_helpers.h"
/* helper to convert an integer value to a string, using mils or mm /* helper to convert an integer value to a string, using mils or mm
* according to g_UserUnit value * according to g_UserUnit value
......
...@@ -526,7 +526,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) ...@@ -526,7 +526,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
} }
else // Put a zone on a non copper layer (technical layer) 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 g_Zone_Default_Setting.m_NetcodeSelection = 0; // No net for non copper zones
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
...@@ -787,7 +787,7 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container ...@@ -787,7 +787,7 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
frame->Destroy(); frame->Destroy();
} }
else // edit a zone on a non copper layer (technical layer) else // edit a zone on a non copper layer (technical layer)
diag = InstallDialogNonCopperZonesEditor( this, zone_container ); diag = InstallDialogNonCopperZonesEditor( zone_container );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
......
...@@ -62,10 +62,9 @@ DialogNonCopperZonesEditor::~DialogNonCopperZonesEditor() ...@@ -62,10 +62,9 @@ DialogNonCopperZonesEditor::~DialogNonCopperZonesEditor()
} }
/* install function for DialogNonCopperZonesEditor dialog frame :*/ bool WinEDA_PcbFrame::InstallDialogNonCopperZonesEditor( ZONE_CONTAINER* aZone )
bool InstallDialogNonCopperZonesEditor( WinEDA_PcbFrame* aParent, ZONE_CONTAINER* aZone )
{ {
DialogNonCopperZonesEditor frame( aParent, aZone, &g_Zone_Default_Setting ); DialogNonCopperZonesEditor frame( this, aZone, &g_Zone_Default_Setting );
bool diag = frame.ShowModal(); bool diag = frame.ShowModal();
return diag; return diag;
......
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