2009-11-23 20:18:47 +00:00
|
|
|
/****************/
|
|
|
|
/* wxstruct.h */
|
|
|
|
/****************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifndef WXSTRUCT_H
|
|
|
|
#define WXSTRUCT_H
|
|
|
|
|
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include <wx/socket.h>
|
|
|
|
#include "wx/log.h"
|
|
|
|
#include "wx/config.h"
|
|
|
|
#include <wx/wxhtml.h>
|
|
|
|
#include <wx/laywin.h>
|
2009-11-02 22:24:55 +00:00
|
|
|
#include <wx/aui/aui.h>
|
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
#include "colors.h"
|
2007-10-10 18:01:14 +00:00
|
|
|
|
2009-02-02 12:12:18 +00:00
|
|
|
//C++ guarantees that operator delete checks its argument for null-ness
|
2008-02-12 21:12:46 +00:00
|
|
|
#ifndef SAFE_DELETE
|
2009-04-07 11:53:58 +00:00
|
|
|
#define SAFE_DELETE( p ) delete (p); (p) = NULL;
|
2008-02-12 21:12:46 +00:00
|
|
|
#endif
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
#define INTERNAL_UNIT_TYPE 0 // Internal unit = inch
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifndef EESCHEMA_INTERNAL_UNIT
|
2009-04-07 11:53:58 +00:00
|
|
|
#define EESCHEMA_INTERNAL_UNIT 1000
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
// Option for dialog boxes
|
2009-01-29 14:26:20 +00:00
|
|
|
#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | \
|
2009-04-07 11:53:58 +00:00
|
|
|
MAYBE_RESIZE_BORDER
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-01-29 14:26:20 +00:00
|
|
|
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
class EDA_BaseStruct;
|
|
|
|
class EDA_Rect;
|
2007-06-05 12:10:51 +00:00
|
|
|
class WinEDA_DrawPanel;
|
|
|
|
class WinEDA_MsgPanel;
|
|
|
|
class BASE_SCREEN;
|
|
|
|
class WinEDA_Toolbar;
|
|
|
|
class WinEDAChoiceBox;
|
|
|
|
class PARAM_CFG_BASE;
|
|
|
|
class Ki_PageDescr;
|
2007-08-21 19:37:31 +00:00
|
|
|
class Ki_HotkeyInfo;
|
2009-08-29 10:20:48 +00:00
|
|
|
class PLOTTER;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
enum id_librarytype {
|
|
|
|
LIBRARY_TYPE_EESCHEMA,
|
|
|
|
LIBRARY_TYPE_PCBNEW,
|
2009-08-27 11:41:56 +00:00
|
|
|
LIBRARY_TYPE_DOC,
|
|
|
|
LIBRARY_TYPE_SYMBOL
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum id_drawframe {
|
2007-08-04 04:42:49 +00:00
|
|
|
NOT_INIT_FRAME = 0,
|
|
|
|
SCHEMATIC_FRAME,
|
|
|
|
LIBEDITOR_FRAME,
|
|
|
|
VIEWER_FRAME,
|
|
|
|
PCB_FRAME,
|
|
|
|
MODULE_EDITOR_FRAME,
|
|
|
|
CVPCB_FRAME,
|
|
|
|
CVPCB_DISPLAY_FRAME,
|
|
|
|
GERBER_FRAME,
|
|
|
|
TEXT_EDITOR_FRAME,
|
|
|
|
DISPLAY3D_FRAME,
|
|
|
|
KICAD_MAIN_FRAME
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum id_toolbar {
|
2007-10-16 19:05:33 +00:00
|
|
|
TOOLBAR_MAIN = 1, // Main horizontal Toolbar
|
2009-05-01 18:06:03 +00:00
|
|
|
TOOLBAR_TOOL, // Right vertical Toolbar (list of tools)
|
2007-10-16 19:05:33 +00:00
|
|
|
TOOLBAR_OPTION, // Left vertical Toolbar (option toolbar
|
2009-04-07 11:53:58 +00:00
|
|
|
TOOLBAR_AUX // Secondary horizontal Toolbar
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
/***********************************************/
|
|
|
|
/* Classes for basic main frames used in kicad */
|
|
|
|
/***********************************************/
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/******************************************************************/
|
|
|
|
/* Basic frame for kicad, eeschema, pcbnew and gerbview. */
|
|
|
|
/* not directly used: the real frames are derived from this class */
|
|
|
|
/******************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
class WinEDA_BasicFrame : public wxFrame
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
int m_Ident; // Id Type (pcb, schematic, library..)
|
|
|
|
wxPoint m_FramePos;
|
|
|
|
wxSize m_FrameSize;
|
|
|
|
int m_MsgFrameHeight;
|
|
|
|
|
|
|
|
WinEDA_Toolbar* m_HToolBar; // Standard horizontal Toolbar
|
|
|
|
bool m_FrameIsActive;
|
2009-05-01 18:06:03 +00:00
|
|
|
wxString m_FrameName; // name used for writing and reading setup
|
2007-08-04 04:42:49 +00:00
|
|
|
// It is "SchematicFrame", "PcbFrame" ....
|
2008-01-28 05:49:15 +00:00
|
|
|
wxString m_AboutTitle; // Name of program displayed in About.
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-02 22:24:55 +00:00
|
|
|
wxAuiManager m_auimgr;
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDA_BasicFrame( wxWindow* father, int idtype,
|
2007-08-04 04:42:49 +00:00
|
|
|
const wxString& title,
|
2007-10-27 12:24:09 +00:00
|
|
|
const wxPoint& pos, const wxSize& size,
|
2009-04-07 11:53:58 +00:00
|
|
|
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef KICAD_PYTHON
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_BasicFrame( const WinEDA_BasicFrame& ) { } // Should throw!!
|
|
|
|
WinEDA_BasicFrame() { } // Should throw!!
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
2007-09-01 12:00:30 +00:00
|
|
|
~WinEDA_BasicFrame();
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
void GetKicadHelp( wxCommandEvent& event );
|
|
|
|
void GetKicadAbout( wxCommandEvent& event );
|
|
|
|
void PrintMsg( const wxString& text );
|
|
|
|
|
|
|
|
virtual void LoadSettings();
|
|
|
|
virtual void SaveSettings();
|
|
|
|
|
|
|
|
int WriteHotkeyConfigFile( const wxString& Filename,
|
|
|
|
struct Ki_HotkeyInfoSectionDescriptor* DescList,
|
|
|
|
bool verbose );
|
|
|
|
int ReadHotkeyConfigFile( const wxString& Filename,
|
|
|
|
struct Ki_HotkeyInfoSectionDescriptor* DescList,
|
|
|
|
bool verbose );
|
|
|
|
void SetLanguage( wxCommandEvent& event );
|
|
|
|
|
|
|
|
wxString GetFileFromHistory( int cmdId, const wxString& type );
|
|
|
|
void SetLastProject( const wxString& FullFileName );
|
|
|
|
void DisplayActivity( int PerCent, const wxString& Text );
|
|
|
|
virtual void ReCreateMenuBar();
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/*******************************************************/
|
|
|
|
/* Basic draw frame for eeschema, pcbnew and gerbview. */
|
|
|
|
/*******************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
class WinEDA_DrawFrame : public WinEDA_BasicFrame
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-10-16 19:05:33 +00:00
|
|
|
WinEDA_DrawPanel* DrawPanel; // Draw area
|
2009-11-23 20:18:47 +00:00
|
|
|
WinEDA_MsgPanel* MsgPanel; // Panel used to display some
|
|
|
|
// info (bottom of the screen)
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_Toolbar* m_VToolBar; // Vertical (right side) Toolbar
|
2009-11-23 20:18:47 +00:00
|
|
|
WinEDA_Toolbar* m_AuxVToolBar; // Auxiliary Vertical (right side)
|
|
|
|
// Toolbar
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_Toolbar* m_OptionsToolBar; // Options Toolbar (left side)
|
2009-11-23 20:18:47 +00:00
|
|
|
WinEDA_Toolbar* m_AuxiliaryToolBar; // Auxiliay Toolbar used in pcbnew
|
|
|
|
|
|
|
|
WinEDAChoiceBox* m_SelGridBox; // Choice box to choose the grid
|
|
|
|
// size
|
|
|
|
WinEDAChoiceBox* m_SelZoomBox; // Choice box to choose the zoom
|
|
|
|
// value
|
|
|
|
|
|
|
|
int m_CursorShape; // shape for cursor (0 = default
|
|
|
|
// cursor)
|
|
|
|
int m_ID_current_state; // Id of active button on the
|
|
|
|
// vertical toolbar
|
|
|
|
int m_ID_last_state; // Id of previous active button
|
|
|
|
// on the vertical toolbar
|
|
|
|
int m_HTOOL_current_state; // Id of active button on
|
|
|
|
// horizontal toolbar
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
int m_InternalUnits; // Internal units count in 1 inch
|
2009-11-23 20:18:47 +00:00
|
|
|
// = 1000 for eeschema, = 10000
|
|
|
|
// for PCBnew and Gerbview
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
int m_UnitType; // Internal Unit type (0 = inch)
|
|
|
|
bool m_Draw_Axis; // TRUE to show X and Y axis
|
|
|
|
bool m_Draw_Sheet_Ref; // TRUE to show frame references
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
bool m_Print_Sheet_Ref; // TRUE to print frame references
|
2009-11-23 20:18:47 +00:00
|
|
|
bool m_Draw_Auxiliary_Axis; /* TRUE to show auxiliary axis.
|
|
|
|
* Used in pcbnew: the auxiliary
|
|
|
|
* axis is the origin of
|
|
|
|
* coordinates for drill, gerber
|
|
|
|
* and component position files
|
2009-04-07 11:53:58 +00:00
|
|
|
*/
|
|
|
|
wxPoint m_Auxiliary_Axis_Position; /* position of the auxiliary axis */
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
protected:
|
|
|
|
int m_LastGridSizeId;
|
2010-02-01 21:23:27 +00:00
|
|
|
bool m_DrawGrid; // hide/Show grid
|
|
|
|
int m_GridColor; // Grid color
|
2009-10-14 19:43:31 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
private:
|
2009-04-07 11:53:58 +00:00
|
|
|
BASE_SCREEN* m_CurrentScreen; ///< current used SCREEN
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
protected:
|
2009-11-23 20:18:47 +00:00
|
|
|
void SetBaseScreen( BASE_SCREEN* aScreen )
|
|
|
|
{
|
|
|
|
m_CurrentScreen = aScreen;
|
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDA_DrawFrame( wxWindow* father, int idtype,
|
2007-08-04 04:42:49 +00:00
|
|
|
const wxString& title,
|
2007-10-27 12:24:09 +00:00
|
|
|
const wxPoint& pos, const wxSize& size,
|
2008-03-20 01:50:21 +00:00
|
|
|
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
~WinEDA_DrawFrame();
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual wxString GetScreenDesc();
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
/**
|
|
|
|
* Function GetBaseScreen
|
2009-05-01 18:06:03 +00:00
|
|
|
* is virtual and returns a pointer to a BASE_SCREEN or one of its
|
|
|
|
* derivatives. It may be overloaded by derived classes.
|
2008-04-17 16:25:29 +00:00
|
|
|
*/
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual BASE_SCREEN* GetBaseScreen() const { return m_CurrentScreen; }
|
|
|
|
|
|
|
|
void OnMenuOpen( wxMenuEvent& event );
|
|
|
|
void OnMouseEvent( wxMouseEvent& event );
|
2009-05-01 18:06:03 +00:00
|
|
|
virtual void OnHotKey( wxDC* DC, int hotkey,
|
|
|
|
EDA_BaseStruct* DrawStruct );
|
2009-04-07 11:53:58 +00:00
|
|
|
|
|
|
|
void Affiche_Message( const wxString& message );
|
|
|
|
void EraseMsgBox();
|
|
|
|
void Process_PageSettings( wxCommandEvent& event );
|
|
|
|
virtual void SetToolbars();
|
|
|
|
void SetLanguage( wxCommandEvent& event );
|
|
|
|
virtual void ReCreateHToolbar() = 0;
|
|
|
|
virtual void ReCreateVToolbar() = 0;
|
|
|
|
virtual void ReCreateMenuBar();
|
|
|
|
virtual void ReCreateAuxiliaryToolbar();
|
|
|
|
virtual void SetToolID( int id, int new_cursor_id,
|
|
|
|
const wxString& title );
|
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
/* Thes 4 functions provide a basic way to sho/hide grid
|
|
|
|
* and /get/set grid color.
|
|
|
|
* thes parameters are saved in kicad config for each main frame
|
|
|
|
*/
|
|
|
|
/** Function IsGridVisible() , virtual
|
|
|
|
* @return true if the grid must be shown
|
|
|
|
*/
|
|
|
|
virtual bool IsGridVisible()
|
|
|
|
{
|
|
|
|
return m_DrawGrid;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Function SetGridVisibility() , virtual
|
|
|
|
* It may be overloaded by derived classes
|
|
|
|
* @param aVisible = true if the grid must be shown
|
|
|
|
*/
|
|
|
|
virtual void SetGridVisibility(bool aVisible)
|
|
|
|
{
|
|
|
|
m_DrawGrid = aVisible;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Function GetGridColor() , virtual
|
|
|
|
* @return the color of the grid
|
|
|
|
*/
|
|
|
|
virtual int GetGridColor()
|
|
|
|
{
|
|
|
|
return m_GridColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Function SetGridColor() , virtual
|
|
|
|
* @param aColor = the new color of the grid
|
|
|
|
*/
|
|
|
|
virtual void SetGridColor(int aColor)
|
|
|
|
{
|
|
|
|
m_GridColor = aColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
/**
|
|
|
|
* Command event handler for selecting grid sizes.
|
|
|
|
*
|
|
|
|
* All commands that set the grid size should eventually end up here.
|
|
|
|
* This is where the application setting is saved. If you override
|
|
|
|
* this method, make sure you call down to the base class.
|
|
|
|
*
|
|
|
|
* @param event - Command event passed by selecting grid size from the
|
|
|
|
* grid size combobox on the toolbar.
|
|
|
|
*/
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual void OnSelectGrid( wxCommandEvent& event );
|
|
|
|
virtual void OnSelectZoom( wxCommandEvent& event );
|
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
virtual void GeneralControle( wxDC* DC, wxPoint Mouse ) { /* dummy */ }
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual void OnSize( wxSizeEvent& event );
|
|
|
|
void OnEraseBackground( wxEraseEvent& SizeEvent );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
void SetToolbarBgColor( int color_num );
|
|
|
|
virtual void OnZoom( wxCommandEvent& event );
|
|
|
|
void OnGrid( int grid_type );
|
|
|
|
void Recadre_Trace( bool ToMouse );
|
2009-11-23 20:18:47 +00:00
|
|
|
void PutOnGrid( wxPoint* coord ); /* set the coordinate to
|
|
|
|
* the nearest grid
|
|
|
|
* coordinate */
|
2009-04-07 11:53:58 +00:00
|
|
|
void Zoom_Automatique( bool move_mouse_cursor );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/* Set the zoom level to show the area Rect */
|
2009-04-07 11:53:58 +00:00
|
|
|
void Window_Zoom( EDA_Rect& Rect );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/* Return the zoom level which displays the full page on screen */
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual int BestZoom() = 0;
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-10-26 06:08:19 +00:00
|
|
|
/* Return the current zoom level */
|
2009-04-07 11:53:58 +00:00
|
|
|
int GetZoom( void );
|
2007-10-26 06:08:19 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
void SVG_Print( wxCommandEvent& event );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width );
|
2009-08-29 10:20:48 +00:00
|
|
|
void PlotWorkSheet( PLOTTER *plotter, BASE_SCREEN* screen );
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2008-07-31 15:30:57 +00:00
|
|
|
/** Function GetXYSheetReferences
|
|
|
|
* Return the X,Y sheet references where the point position is located
|
|
|
|
* @param aScreen = screen to use
|
|
|
|
* @param aPosition = position to identify by YX ref
|
2009-11-23 20:18:47 +00:00
|
|
|
* @return a wxString containing the message locator like A3 or B6
|
|
|
|
* (or ?? if out of page limits)
|
2008-07-31 15:30:57 +00:00
|
|
|
*/
|
2009-11-23 20:18:47 +00:00
|
|
|
wxString GetXYSheetReferences( BASE_SCREEN* aScreen,
|
|
|
|
const wxPoint& aPosition );
|
2009-04-07 11:53:58 +00:00
|
|
|
|
|
|
|
void DisplayToolMsg( const wxString& msg );
|
|
|
|
void Process_Zoom( wxCommandEvent& event );
|
|
|
|
void Process_Grid( wxCommandEvent& event );
|
|
|
|
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
|
2009-05-21 17:42:42 +00:00
|
|
|
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
2009-11-23 20:18:47 +00:00
|
|
|
virtual bool OnRightClick( const wxPoint& MousePos,
|
|
|
|
wxMenu* PopMenu ) = 0;
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual void ToolOnRightClick( wxCommandEvent& event );
|
|
|
|
void AdjustScrollBars();
|
2009-04-09 17:34:51 +00:00
|
|
|
|
2009-12-22 20:08:56 +00:00
|
|
|
/** OnActivate event function (virtual)
|
|
|
|
* called when activating the frame.
|
|
|
|
* in derived classes with a virtual OnActivate function,
|
|
|
|
* do not forget to call the WinEDA_DrawFrame::OnActivate( event ) basic function
|
|
|
|
*/
|
|
|
|
virtual void OnActivate( wxActivateEvent& event );
|
2009-04-09 17:34:51 +00:00
|
|
|
/**
|
|
|
|
* Function UpdateStatusBar
|
|
|
|
* updates the status bar information.
|
|
|
|
*
|
|
|
|
* The base method updates the absolute and relative coordinates and the
|
|
|
|
* zoom information. If you override this virtual method, make sure to call
|
|
|
|
* this subclassed method. The status bar can draw itself. This is not
|
|
|
|
* a drawing function per se, but rather updates lines of text held by
|
|
|
|
* the components within the status bar which is owned by the wxFrame.
|
|
|
|
* <p>
|
2009-11-23 20:18:47 +00:00
|
|
|
* On a MAC, be careful about calling this function when there is an
|
|
|
|
* existing wxDC in existence on a sibling window.
|
2009-04-09 17:34:51 +00:00
|
|
|
*/
|
|
|
|
virtual void UpdateStatusBar();
|
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
void DisplayUnitsMsg();
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/* Handlers for block commands */
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual int ReturnBlockCommand( int key );
|
|
|
|
virtual void InitBlockPasteInfos();
|
2009-11-23 20:18:47 +00:00
|
|
|
virtual bool HandleBlockBegin( wxDC* DC, int cmd_type,
|
|
|
|
const wxPoint& startpos );
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual void HandleBlockPlace( wxDC* DC );
|
|
|
|
virtual int HandleBlockEnd( wxDC* DC );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
void CopyToClipboard( wxCommandEvent& event );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
|
|
|
/* interprocess communication */
|
2009-04-07 11:53:58 +00:00
|
|
|
void OnSockRequest( wxSocketEvent& evt );
|
|
|
|
void OnSockRequestServer( wxSocketEvent& evt );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
virtual void LoadSettings();
|
|
|
|
virtual void SaveSettings();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
/**
|
|
|
|
* Append a message to the message panel.
|
|
|
|
*
|
|
|
|
* This helper method checks to make sure the message panel exists in
|
|
|
|
* the frame and appends a message to it using the message panel
|
|
|
|
* AppendMessage() method.
|
|
|
|
*
|
|
|
|
* @param textUpper - The message upper text.
|
|
|
|
* @param textLower - The message lower text.
|
|
|
|
* @param color - A color ID from the Kicad color list (see colors.h).
|
|
|
|
* @param pad - Number of spaces to pad between messages (default = 4).
|
|
|
|
*/
|
|
|
|
void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
|
|
|
|
int color, int pad = 6 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear all messages from the message panel.
|
|
|
|
*/
|
|
|
|
void ClearMsgPanel( void );
|
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
DECLARE_EVENT_TABLE();
|
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-10-27 12:24:09 +00:00
|
|
|
/*********************************************************
|
2009-04-07 11:53:58 +00:00
|
|
|
* class WinEDA_MsgPanel : this is a panel to display various infos
|
|
|
|
* and messages on items in eeschema an pcbnew
|
2007-10-27 12:24:09 +00:00
|
|
|
*********************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-10 18:01:14 +00:00
|
|
|
/**
|
|
|
|
* Struct MsgItem
|
2007-10-11 00:11:59 +00:00
|
|
|
* is used privately by WinEDA_MsgPanel as the item type of its vector.
|
2007-10-10 18:01:14 +00:00
|
|
|
* These items are the pairs of text strings shown in the MsgPanel.
|
|
|
|
*/
|
|
|
|
struct MsgItem
|
|
|
|
{
|
2009-04-07 11:53:58 +00:00
|
|
|
int m_X;
|
|
|
|
int m_UpperY;
|
|
|
|
int m_LowerY;
|
|
|
|
wxString m_UpperText;
|
|
|
|
wxString m_LowerText;
|
|
|
|
int m_Color;
|
2007-10-10 18:01:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function operator=
|
|
|
|
* overload the assignment operator so that the wxStrings get copied
|
|
|
|
* properly when copying a MsgItem.
|
|
|
|
* No, actually I'm not sure this needed, C++ compiler may auto-generate it.
|
|
|
|
*/
|
|
|
|
MsgItem& operator=( const MsgItem& rv )
|
|
|
|
{
|
2009-04-07 11:53:58 +00:00
|
|
|
m_X = rv.m_X;
|
2007-10-10 18:01:14 +00:00
|
|
|
m_UpperY = rv.m_UpperY;
|
|
|
|
m_LowerY = rv.m_LowerY;
|
|
|
|
m_UpperText = rv.m_UpperText; // overloaded operator=()
|
|
|
|
m_LowerText = rv.m_LowerText; // overloaded operator=()
|
|
|
|
m_Color = rv.m_Color;
|
2009-04-07 11:53:58 +00:00
|
|
|
|
|
|
|
return * this;
|
2007-10-10 18:01:14 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
class WinEDA_MsgPanel : public wxPanel
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-10 18:01:14 +00:00
|
|
|
protected:
|
2009-08-07 04:44:42 +00:00
|
|
|
std::vector<MsgItem> m_Items;
|
|
|
|
int m_last_x; ///< the last used x coordinate
|
|
|
|
wxSize m_fontSize;
|
2008-03-31 13:46:00 +00:00
|
|
|
|
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
void showItem( wxDC& dc, const MsgItem& aItem );
|
2007-10-10 18:01:14 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
void erase( wxDC* DC );
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-08-07 04:44:42 +00:00
|
|
|
/**
|
|
|
|
* Function getFontSize
|
|
|
|
* computes the height and width of a 'W' in the system font.
|
|
|
|
*/
|
|
|
|
static wxSize computeFontSize();
|
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
/**
|
|
|
|
* Calculate the width and height of a text string using the system UI font.
|
|
|
|
*/
|
|
|
|
wxSize computeTextSize( const wxString& text );
|
2009-08-07 04:44:42 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_DrawFrame* m_Parent;
|
2009-11-23 20:18:47 +00:00
|
|
|
int m_BgColor;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2009-11-23 20:18:47 +00:00
|
|
|
WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos,
|
|
|
|
const wxSize& size );
|
2007-09-01 12:00:30 +00:00
|
|
|
~WinEDA_MsgPanel();
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-08-07 04:44:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetRequiredHeight
|
|
|
|
* returns the required height (in pixels) of a WinEDA_MsgPanel. This takes
|
|
|
|
* into consideration the system gui font, wxSYS_DEFAULT_GUI_FONT.
|
|
|
|
*/
|
|
|
|
static int GetRequiredHeight();
|
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
void OnPaint( wxPaintEvent& event );
|
|
|
|
void EraseMsgBox();
|
|
|
|
void Affiche_1_Parametre( int pos_X, const wxString& texte_H,
|
|
|
|
const wxString& texte_L, int color );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
/**
|
|
|
|
* Append a message to the message panel.
|
|
|
|
*
|
|
|
|
* This method automatically adjusts for the width of the text string.
|
|
|
|
* Making consectutive calls to AppendMessage will append each message
|
|
|
|
* to the right of the last message. This message is not compatible
|
|
|
|
* with Affiche_1_Parametre.
|
|
|
|
*
|
|
|
|
* @param textUpper - The message upper text.
|
|
|
|
* @param textLower - The message lower text.
|
|
|
|
* @param color - A color ID from the Kicad color list (see colors.h).
|
|
|
|
* @param pad - Number of spaces to pad between messages (default = 4).
|
|
|
|
*/
|
|
|
|
void AppendMessage( const wxString& textUpper, const wxString& textLower,
|
2009-10-14 19:43:31 +00:00
|
|
|
int color, int pad = 6 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-10-27 12:24:09 +00:00
|
|
|
/************************************************/
|
|
|
|
/* Class to enter a line, is some dialog frames */
|
|
|
|
/************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
class WinEDA_EnterText
|
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
bool m_Modify;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
private:
|
2007-08-04 04:42:49 +00:00
|
|
|
wxString m_NewText;
|
|
|
|
wxTextCtrl* m_FrameText;
|
|
|
|
wxStaticText* m_Title;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_EnterText( wxWindow* parent, const wxString& Title,
|
|
|
|
const wxString& TextToEdit, wxBoxSizer* BoxSizer,
|
2009-04-28 19:34:42 +00:00
|
|
|
const wxSize& Size, bool Multiline = false );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
~WinEDA_EnterText()
|
2007-08-04 04:42:49 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
wxString GetValue();
|
|
|
|
void GetValue( char* buffer, int lenmax );
|
|
|
|
void SetValue( const wxString& new_text );
|
|
|
|
void Enable( bool enbl );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
void SetFocus() { m_FrameText->SetFocus(); }
|
2007-08-04 04:42:49 +00:00
|
|
|
void SetInsertionPoint( int n ) { m_FrameText->SetInsertionPoint( n ); }
|
|
|
|
void SetSelection( int n, int m )
|
|
|
|
{
|
|
|
|
m_FrameText->SetSelection( n, m );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2007-10-27 12:24:09 +00:00
|
|
|
/************************************************************************/
|
|
|
|
/* Class to edit/enter a graphic text and its dimension ( INCHES or MM )*/
|
|
|
|
/************************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
class WinEDA_GraphicTextCtrl
|
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
int m_Units, m_Internal_Unit;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
wxTextCtrl* m_FrameText;
|
|
|
|
wxTextCtrl* m_FrameSize;
|
2007-06-05 12:10:51 +00:00
|
|
|
private:
|
2007-08-04 04:42:49 +00:00
|
|
|
wxStaticText* m_Title;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_GraphicTextCtrl( wxWindow* parent, const wxString& Title,
|
|
|
|
const wxString& TextToEdit, int textsize,
|
|
|
|
int units, wxBoxSizer* BoxSizer, int framelen = 200,
|
|
|
|
int internal_unit = EESCHEMA_INTERNAL_UNIT );
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
~WinEDA_GraphicTextCtrl();
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
wxString GetText();
|
|
|
|
int GetTextSize();
|
|
|
|
void Enable( bool state );
|
|
|
|
void SetTitle( const wxString& title );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
void SetFocus() { m_FrameText->SetFocus(); }
|
2009-04-07 11:53:58 +00:00
|
|
|
void SetValue( const wxString& value );
|
|
|
|
void SetValue( int value );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function FormatSize
|
|
|
|
* formats a string containing the size in the desired units.
|
|
|
|
*/
|
|
|
|
static wxString FormatSize( int internalUnit, int units, int textSize );
|
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
static int ParseSize( const wxString& sizeText, int internalUnit,
|
|
|
|
int units );
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
/**************************************************************************/
|
|
|
|
/* Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in */
|
|
|
|
/* dialog boxes, */
|
|
|
|
/**************************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
class WinEDA_PositionCtrl
|
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
int m_Units, m_Internal_Unit;
|
|
|
|
wxPoint m_Pos_To_Edit;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
wxTextCtrl* m_FramePosX;
|
|
|
|
wxTextCtrl* m_FramePosY;
|
2007-06-05 12:10:51 +00:00
|
|
|
private:
|
2007-08-04 04:42:49 +00:00
|
|
|
wxStaticText* m_TextX, * m_TextY;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_PositionCtrl( wxWindow* parent, const wxString& title,
|
|
|
|
const wxPoint& pos_to_edit,
|
|
|
|
int units, wxBoxSizer* BoxSizer,
|
|
|
|
int internal_unit = EESCHEMA_INTERNAL_UNIT );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
~WinEDA_PositionCtrl();
|
2007-08-04 04:42:49 +00:00
|
|
|
|
|
|
|
void Enable( bool x_win_on, bool y_win_on );
|
|
|
|
void SetValue( int x_value, int y_value );
|
2007-09-01 12:00:30 +00:00
|
|
|
wxPoint GetValue();
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2007-10-27 12:24:09 +00:00
|
|
|
/*************************************************************
|
2009-04-07 11:53:58 +00:00
|
|
|
* Class to edit/enter a size (pair of values for X and Y size)
|
|
|
|
* ( INCHES or MM ) in dialog boxes
|
|
|
|
***************************************************************/
|
2007-08-04 04:42:49 +00:00
|
|
|
class WinEDA_SizeCtrl : public WinEDA_PositionCtrl
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_SizeCtrl( wxWindow* parent, const wxString& title,
|
|
|
|
const wxSize& size_to_edit,
|
|
|
|
int units, wxBoxSizer* BoxSizer,
|
|
|
|
int internal_unit = EESCHEMA_INTERNAL_UNIT );
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
~WinEDA_SizeCtrl() { }
|
|
|
|
wxSize GetValue();
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-10-27 12:24:09 +00:00
|
|
|
/****************************************************************/
|
|
|
|
/* Class to edit/enter a value ( INCHES or MM ) in dialog boxes */
|
|
|
|
/****************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
class WinEDA_ValueCtrl
|
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
int m_Units;
|
|
|
|
int m_Value;
|
|
|
|
wxTextCtrl* m_ValueCtrl;
|
2007-06-05 12:10:51 +00:00
|
|
|
private:
|
2007-08-04 04:42:49 +00:00
|
|
|
int m_Internal_Unit;
|
|
|
|
wxStaticText* m_Text;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_ValueCtrl( wxWindow* parent, const wxString& title, int value,
|
|
|
|
int units, wxBoxSizer* BoxSizer,
|
|
|
|
int internal_unit = EESCHEMA_INTERNAL_UNIT );
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
~WinEDA_ValueCtrl();
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
int GetValue();
|
|
|
|
void SetValue( int new_value );
|
|
|
|
void Enable( bool enbl );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
|
|
|
void SetToolTip( const wxString& text )
|
|
|
|
{
|
|
|
|
m_ValueCtrl->SetToolTip( text );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
|
2007-10-27 12:24:09 +00:00
|
|
|
/************************************************************************/
|
|
|
|
/* Class to edit/enter a pair of float (double) values in dialog boxes */
|
|
|
|
/************************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
class WinEDA_DFloatValueCtrl
|
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
double m_Value;
|
|
|
|
wxTextCtrl* m_ValueCtrl;
|
2007-06-05 12:10:51 +00:00
|
|
|
private:
|
2007-08-04 04:42:49 +00:00
|
|
|
wxStaticText* m_Text;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_DFloatValueCtrl( wxWindow* parent, const wxString& title,
|
|
|
|
double value, wxBoxSizer* BoxSizer );
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
~WinEDA_DFloatValueCtrl();
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
double GetValue();
|
|
|
|
void SetValue( double new_value );
|
|
|
|
void Enable( bool enbl );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
|
|
|
void SetToolTip( const wxString& text )
|
|
|
|
{
|
|
|
|
m_ValueCtrl->SetToolTip( text );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
/*************************/
|
|
|
|
/* class WinEDA_Toolbar */
|
|
|
|
/*************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-02 22:24:55 +00:00
|
|
|
class WinEDA_Toolbar : public wxAuiToolBar
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
wxWindow* m_Parent;
|
|
|
|
id_toolbar m_Ident;
|
2010-01-14 20:20:59 +00:00
|
|
|
bool m_Horizontal; // some auxilary TB are horizontal, others vertical
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_Toolbar( id_toolbar type, wxWindow* parent,
|
|
|
|
wxWindowID id, bool horizontal );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2009-11-05 08:52:41 +00:00
|
|
|
bool GetToolState( int toolId ) { return GetToolToggled(toolId); };
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2009-11-23 20:18:47 +00:00
|
|
|
void AddRadioTool( int toolid,
|
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bitmap,
|
|
|
|
const wxBitmap& bmpDisabled = wxNullBitmap,
|
|
|
|
const wxString& shortHelp = wxEmptyString,
|
|
|
|
const wxString& longHelp = wxEmptyString,
|
|
|
|
wxObject* data = NULL )
|
2009-11-05 08:52:41 +00:00
|
|
|
{
|
2009-11-23 20:18:47 +00:00
|
|
|
AddTool( toolid, label, bitmap, bmpDisabled, wxITEM_CHECK,
|
|
|
|
shortHelp, longHelp, data );
|
2009-11-02 22:24:55 +00:00
|
|
|
};
|
|
|
|
|
2009-11-05 08:52:41 +00:00
|
|
|
void SetToolNormalBitmap( int id, const wxBitmap& bitmap ) {};
|
|
|
|
void SetRows( int nRows ) {};
|
2010-02-01 21:23:27 +00:00
|
|
|
|
2010-01-14 20:20:59 +00:00
|
|
|
/** Function GetDimension
|
|
|
|
* @return the dimension of this toolbar (Height if horizontal, Width if vertical.
|
|
|
|
*/
|
|
|
|
int GetDimension( );
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
/***********************/
|
|
|
|
/* class WinEDAListBox */
|
|
|
|
/***********************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
class WinEDAListBox : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDA_DrawFrame* m_Parent;
|
|
|
|
wxListBox* m_List;
|
|
|
|
wxTextCtrl* m_WinMsg;
|
|
|
|
const wxChar** m_ItemList;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
private:
|
2009-04-07 11:53:58 +00:00
|
|
|
void (*m_MoveFct)( wxString& Text );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
|
|
|
|
const wxChar** ItemList,
|
|
|
|
const wxString& RefText,
|
2007-10-01 15:37:42 +00:00
|
|
|
void(* movefct)(wxString& Text) = NULL,
|
2007-08-04 04:42:49 +00:00
|
|
|
const wxColour& colour = wxNullColour,
|
|
|
|
wxPoint dialog_position = wxDefaultPosition );
|
2007-09-01 12:00:30 +00:00
|
|
|
~WinEDAListBox();
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2009-04-07 11:53:58 +00:00
|
|
|
void SortList();
|
|
|
|
void Append( const wxString& item );
|
|
|
|
void InsertItems( const wxArrayString& itemlist, int position = 0 );
|
|
|
|
void MoveMouseToOrigin();
|
|
|
|
wxString GetTextSelection();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
private:
|
2009-04-07 11:53:58 +00:00
|
|
|
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 );
|
2007-08-04 04:42:49 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*************************/
|
|
|
|
/* class WinEDAChoiceBox */
|
|
|
|
/*************************/
|
2007-08-04 04:42:49 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* class to display a choice list.
|
2007-08-04 04:42:49 +00:00
|
|
|
* 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
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#define EVT_KICAD_CHOICEBOX EVT_COMBOBOX
|
|
|
|
class WinEDAChoiceBox : public wxComboBox
|
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
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 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
int GetChoice()
|
2007-08-04 04:42:49 +00:00
|
|
|
{
|
|
|
|
return GetCurrentSelection();
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* WXSTRUCT_H */
|