kicad/include/wxstruct.h

1773 lines
70 KiB
C
Raw Normal View History

2007-08-04 04:42:49 +00:00
/***********************************************************/
/* wxstruct.h: */
/* descriptions des principales classes derivees utilisees */
/***********************************************************/
#ifndef WXSTRUCT_H
#define WXSTRUCT_H
#ifndef eda_global
#define eda_global extern
#endif
#include <wx/socket.h>
#include "wx/log.h"
#include "wx/config.h"
#include <wx/wxhtml.h>
#include <wx/laywin.h>
#include <wx/snglinst.h>
2007-10-10 18:01:14 +00:00
#include <vector>
2007-08-04 04:42:49 +00:00
#define INTERNAL_UNIT_TYPE 0 // Internal unit = inch
#ifndef EESCHEMA_INTERNAL_UNIT
2007-08-04 04:42:49 +00:00
#define EESCHEMA_INTERNAL_UNIT 1000
#endif
#ifndef PCB_INTERNAL_UNIT
2007-08-04 04:42:49 +00:00
#define PCB_INTERNAL_UNIT 10000
#endif
// Option for dialog boxes
2007-10-07 03:08:24 +00:00
// #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP
#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS
#define EDA_DRAW_PANEL wxScrolledWindow
class wxMyDialogModalData;
/* Forward declarations of classes. */
class WinEDA_DrawPanel;
class WinEDA_DrawFrame;
#include "base_struct.h"
class WinEDA_App;
class WinEDA_MsgPanel;
class COMMAND;
class WinEDA_MainFrame;
class BASE_SCREEN;
class SCH_SCREEN;
class PCB_SCREEN;
class WinEDA_SchematicFrame; // Schematic main frame
class WinEDA_LibeditFrame; // Component creation and edition main frame
class WinEDA_ViewlibFrame; // Component viewer main frame
class WinEDA_GerberFrame; // GERBER viewer main frame
class WinEDA_Toolbar;
class WinEDA_CvpcbFrame;
class WinEDA_PcbFrame;
class WinEDA_ModuleEditFrame;
class WinEDAChoiceBox;
2007-08-04 04:42:49 +00:00
#define WinEDA_MenuBar wxMenuBar
#define WinEDA_Menu wxMenu
#define WinEDA_MenuItem wxMenuItem
// Used but not defined here:
class LibraryStruct;
class EDA_LibComponentStruct;
class LibEDA_BaseStruct;
class EDA_BaseStruct;
class DrawBusEntryStruct;
class DrawGlobalLabelStruct;
class DrawTextStruct;
class EDA_DrawLineStruct;
class DrawSheetStruct;
class DrawSheetLabelStruct;
class EDA_SchComponentStruct;
class LibDrawField;
class PartTextStruct;
class LibDrawPin;
class DrawJunctionStruct;
class BOARD;
class TEXTE_PCB;
class MODULE;
class TRACK;
class SEGZONE;
class SEGVIA;
class EDGE_ZONE;
class D_PAD;
class TEXTE_MODULE;
class MIREPCB;
class DRAWSEGMENT;
class COTATION;
class EDGE_MODULE;
class WinEDA3D_DrawFrame;
class PARAM_CFG_BASE;
class Ki_PageDescr;
class Ki_HotkeyInfo;
2007-08-30 22:20:52 +00:00
class GENERAL_COLLECTOR;
2007-09-05 04:48:47 +00:00
class GENERAL_COLLECTORS_GUIDE;
2007-12-01 03:42:52 +00:00
class DRC;
2007-08-04 04:42:49 +00:00
enum id_librarytype {
LIBRARY_TYPE_EESCHEMA,
LIBRARY_TYPE_PCBNEW,
LIBRARY_TYPE_DOC
};
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
};
enum id_toolbar {
TOOLBAR_MAIN = 1, // Main horizontal Toolbar
TOOLBAR_TOOL, // Rigth vertical Toolbar (list of tools)
TOOLBAR_OPTION, // Left vertical Toolbar (option toolbar
TOOLBAR_AUX // Secondary horizontal Toolbar
};
2007-08-04 04:42:49 +00:00
/**********************/
/* Classes pour WXWIN */
/**********************/
#define MSG_PANEL_DEFAULT_HEIGHT ( 28 ) // height of the infos display window
2007-08-04 04:42:49 +00:00
/**********************************************/
/* Class representing the entire Application */
/**********************************************/
#include "appl_wxstruct.h"
/******************************************************************/
/* Basic frame for kicad, eeschema, pcbnew and gerbview. */
/* not directly used: the real frames are derived from this class */
/******************************************************************/
2007-08-04 04:42:49 +00:00
class WinEDA_BasicFrame : public wxFrame
{
public:
2007-08-04 04:42:49 +00:00
int m_Ident; // Id Type (pcb, schematic, library..)
WinEDA_App* m_Parent;
wxPoint m_FramePos;
wxSize m_FrameSize;
int m_MsgFrameHeight;
WinEDA_MenuBar* m_MenuBar; // menu du haut d'ecran
WinEDA_Toolbar* m_HToolBar; // Standard horizontal Toolbar
bool m_FrameIsActive;
wxString m_FrameName; // name used for writting and reading setup
// It is "SchematicFrame", "PcbFrame" ....
public:
2007-08-04 04:42:49 +00:00
// Constructor and destructor
WinEDA_BasicFrame( wxWindow* father, int idtype, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE);
#ifdef KICAD_PYTHON
2007-08-04 04:42:49 +00:00
WinEDA_BasicFrame( const WinEDA_BasicFrame& ) { } // Should throw!!
WinEDA_BasicFrame() { } // Should throw!!
#endif
2007-09-01 12:00:30 +00:00
~WinEDA_BasicFrame();
2007-08-04 04:42:49 +00:00
void GetKicadHelp( wxCommandEvent& event );
void GetKicadAbout( wxCommandEvent& event );
void PrintMsg( const wxString& text );
2007-09-01 12:00:30 +00:00
void GetSettings();
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 );
2007-08-04 04:42:49 +00:00
void ProcessFontPreferences( int id );
wxString GetLastProject( int rang );
void SetLastProject( const wxString& FullFileName );
void DisplayActivity( int PerCent, const wxString& Text );
2007-09-01 12:00:30 +00:00
virtual void ReCreateMenuBar();
};
/*******************************************************/
/* Basic draw frame for eeschema, pcbnew and gerbview. */
/*******************************************************/
2007-08-04 04:42:49 +00:00
class WinEDA_DrawFrame : public WinEDA_BasicFrame
{
public:
WinEDA_DrawPanel* DrawPanel; // Draw area
2007-08-04 04:42:49 +00:00
WinEDA_MsgPanel* MsgPanel; // Zone d'affichage de caracteristiques
WinEDA_Toolbar* m_VToolBar; // Vertical (right side) Toolbar
WinEDA_Toolbar* m_AuxVToolBar; // Auxiliary Vertical (right side) Toolbar
WinEDA_Toolbar* m_OptionsToolBar; // Options Toolbar (left side)
WinEDA_Toolbar* m_AuxiliaryToolBar; // Toolbar auxiliaire (utilis<69> dans pcbnew)
WinEDAChoiceBox* m_SelGridBox; // Dialog box to choose the grid size
WinEDAChoiceBox* m_SelZoomBox; // Dialog box to choose the Zoom value
int m_ZoomMaxValue; // Max zoom value: Draw min scale is 1/m_ZoomMaxValue
BASE_SCREEN* m_CurrentScreen; // current used SCREEN
2007-08-04 04:42:49 +00:00
int m_CurrentCursorShape; // shape for cursor (0 = default cursor)
int m_ID_current_state; // Id of 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
int m_InternalUnits; // nombre d'unites internes pour 1 pouce
// = 1000 pour schema, = 10000 pour PCB
2007-08-04 04:42:49 +00:00
int m_UnitType; // Internal Unit type (0 = inch)
bool m_Draw_Axis; // TRUE pour avoir les axes dessines
bool m_Draw_Grid; // TRUE pour avoir la grille dessinee
bool m_Draw_Sheet_Ref; // TRUE pour avoir le cartouche dessin<69>
bool m_Print_Sheet_Ref; // TRUE pour avoir le cartouche imprim<69>
bool m_Draw_Auxiliary_Axis; // TRUE pour avoir les axes auxiliaires dessines
wxPoint m_Auxiliary_Axis_Position; /* origine de l'axe auxiliaire (app:
* dans la generation les fichiers de positionnement
* des composants) */
public:
2007-08-04 04:42:49 +00:00
// Constructor and destructor
WinEDA_DrawFrame( wxWindow* father, int idtype, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
2007-08-04 04:42:49 +00:00
2007-09-01 12:00:30 +00:00
~WinEDA_DrawFrame();
BASE_SCREEN* GetScreen() { return m_CurrentScreen; }
2007-08-04 04:42:49 +00:00
void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event );
virtual void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
void AddFontSelectionMenu( wxMenu* main_menu );
void ProcessFontPreferences( wxCommandEvent& event );
2007-08-04 04:42:49 +00:00
void Affiche_Message( const wxString& message );
2007-09-01 12:00:30 +00:00
void EraseMsgBox();
2007-08-04 04:42:49 +00:00
void Process_PageSettings( wxCommandEvent& event );
void SetDrawBgColor( int color_num );
2007-09-01 12:00:30 +00:00
virtual void SetToolbars();
2007-08-04 04:42:49 +00:00
void SetLanguage( wxCommandEvent& event );
2007-09-01 12:00:30 +00:00
virtual void ReCreateHToolbar() = 0;
virtual void ReCreateVToolbar() = 0;
virtual void ReCreateMenuBar();
virtual void ReCreateAuxiliaryToolbar();
2007-08-04 04:42:49 +00:00
void SetToolID( int id, int new_cursor_id, const wxString& title );
virtual void OnSelectGrid( wxCommandEvent& event );
virtual void OnSelectZoom( wxCommandEvent& event );
virtual void GeneralControle( wxDC* DC, wxPoint Mouse );
virtual void OnSize( wxSizeEvent& event );
void OnEraseBackground( wxEraseEvent& SizeEvent );
// void OnChar(wxKeyEvent& event);
void SetToolbarBgColor( int color_num );
void OnZoom( int zoom_type );
void OnPanning( int direction );
void OnGrid( int grid_type );
void Recadre_Trace( bool ToMouse );
void PutOnGrid( wxPoint* coord ); /* set the coordiante "coord" to the nearest grid coordinate */
2007-08-04 04:42:49 +00:00
void Zoom_Automatique( bool move_mouse_cursor );
/* Set the zoom level to show the area Rect */
2007-08-04 04:42:49 +00:00
void Window_Zoom( EDA_Rect& Rect );
/* Return the zoom level which displays the full page on screen */
virtual int BestZoom() = 0;
2007-08-04 04:42:49 +00:00
/* Return the current zoom level */
int GetZoom(void);
2007-08-04 04:42:49 +00:00
void ToPrinter( wxCommandEvent& event );
void SVG_Print( wxCommandEvent& event );
void OnActivate( wxActivateEvent& event );
2007-09-01 12:00:30 +00:00
void ReDrawPanel();
2007-08-04 04:42:49 +00:00
void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width );
void DisplayToolMsg( const wxString msg );
void Process_Zoom( wxCommandEvent& event );
void Process_Grid( wxCommandEvent& event );
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void Process_Special_Functions( wxCommandEvent& event ) = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
2007-08-04 04:42:49 +00:00
virtual void ToolOnRightClick( wxCommandEvent& event );
2007-09-01 12:00:30 +00:00
void AdjustScrollBars();
2007-10-07 03:08:24 +00:00
void Affiche_Status_Box(); /* Affichage des coord curseur, zoom .. */
2007-09-01 12:00:30 +00:00
void DisplayUnitsMsg();
2007-08-04 04:42:49 +00:00
/* Handlers for block commands */
2007-08-04 04:42:49 +00:00
virtual int ReturnBlockCommand( int key );
virtual void InitBlockPasteInfos();
virtual bool HandleBlockBegin( wxDC* DC, int cmd_type, const wxPoint& startpos );
virtual void HandleBlockPlace( wxDC* DC );
virtual int HandleBlockEnd( wxDC* DC );
void CopyToClipboard( wxCommandEvent& event );
/* interprocess communication */
void OnSockRequest( wxSocketEvent& evt );
void OnSockRequestServer( wxSocketEvent& evt );
};
#define COMMON_EVENTS_DRAWFRAME \
2007-08-04 04:42:49 +00:00
EVT_MOUSEWHEEL( WinEDA_DrawFrame::OnMouseEvent ) \
EVT_MENU_OPEN( WinEDA_DrawFrame::OnMenuOpen ) \
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
/******************************************************************/
/* class WinEDA_BasePcbFrame: Basic class for pcbnew and gerbview */
/******************************************************************/
2007-08-04 04:42:49 +00:00
class WinEDA_BasePcbFrame : public WinEDA_DrawFrame
{
public:
2007-08-04 04:42:49 +00:00
BOARD* m_Pcb;
2007-08-04 04:42:49 +00:00
bool m_DisplayPadFill; // How show pads
bool m_DisplayPadNum; // show pads numbers
2007-08-04 04:42:49 +00:00
int m_DisplayModEdge; // How show module drawings
int m_DisplayModText; // How show module texts
bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, TRUE = filled */
2007-08-04 04:42:49 +00:00
WinEDA3D_DrawFrame* m_Draw3DFrame;
protected:
2007-09-05 04:48:47 +00:00
GENERAL_COLLECTOR* m_Collector;
public:
2007-08-04 04:42:49 +00:00
WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
2007-09-01 12:00:30 +00:00
~WinEDA_BasePcbFrame();
2007-08-04 04:42:49 +00:00
// General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void Process_Special_Functions( wxCommandEvent& event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
2007-09-01 12:00:30 +00:00
virtual void ReCreateHToolbar() = 0;
virtual void ReCreateVToolbar() = 0;
2007-08-04 04:42:49 +00:00
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
2007-09-01 12:00:30 +00:00
virtual void ReCreateMenuBar();
PCB_SCREEN* GetScreen() { return (PCB_SCREEN*) m_CurrentScreen; }
int BestZoom();
2007-08-04 04:42:49 +00:00
void Show3D_Frame( wxCommandEvent& event );
2007-08-04 04:42:49 +00:00
virtual void GeneralControle( wxDC* DC, wxPoint Mouse );
2007-08-04 04:42:49 +00:00
// Undo and redo functions
public:
2007-08-04 04:42:49 +00:00
virtual void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int flag_type_command = 0 );
private:
2007-09-01 12:00:30 +00:00
virtual void GetComponentFromUndoList();
virtual void GetComponentFromRedoList();
public:
2007-08-04 04:42:49 +00:00
// Read/write fonctions:
EDA_BaseStruct* ReadDrawSegmentDescr( FILE* File, int* LineNum );
int ReadListeSegmentDescr( FILE* File,
TRACK* PtSegm, int StructType,
int* LineNum, int NumSegm );
2007-08-04 04:42:49 +00:00
int ReadSetup( FILE* File, int* LineNum );
int ReadGeneralDescrPcb( FILE* File, int* LineNum );
2007-08-04 04:42:49 +00:00
// PCB handling
bool Clear_Pcb( bool query );
/**
* Function PcbGeneralLocateAndDisplay
* searches for an item under the mouse cursor.
* Items are searched first on the current working layer.
* If nothing found, an item will be searched without layer restriction. If
* more than one item is found meeting the current working layer criterion, then
* a popup menu is shown which allows the user to pick which item he/she is
* interested in. Once an item is chosen, then it is make the "current item"
* and the status window is updated to reflect this.
2007-09-25 15:10:01 +00:00
*
* @param aHotKeyCode The hotkey which relates to the caller and determines the
* type of search to be performed. If zero, then the mouse tools will be
2007-09-25 15:10:01 +00:00
* tested instead.
*/
BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 );
BOARD_ITEM* Locate( int typeloc, int LayerSearch );
void ProcessItemSelection( wxCommandEvent& event );
/**
* Function SetCurItem
* sets the currently selected item and displays it in the MsgPanel.
* If the given item is NULL then the MsgPanel is erased and there is no
* currently selected item. This function is intended to make the process
* of "selecting" an item more formal, and to indivisibly tie the operation
* of selecting an item to displaying it using BOARD_ITEM::Display_Infos().
* @param aItem The BOARD_ITEM to make the selected item or NULL if none.
*/
void SetCurItem( BOARD_ITEM* aItem );
BOARD_ITEM* GetCurItem();
2007-09-05 04:48:47 +00:00
/**
* Function GetCollectorsGuide
* @return GENERAL_COLLECTORS_GUIDE - that considers the global configuration options.
*/
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
2007-12-04 07:04:53 +00:00
/**
* Function CursorGoto
* positions the cursor at a given coordinate and reframes the drawing if the
* requested point is out of view.
* @param aPos The point to go to.
*/
void CursorGoto( const wxPoint& aPos );
/* Place un repere sur l'ecran au point de coordonnees PCB pos */
void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap,
int DrawMode, int color, int type );
2007-08-04 04:42:49 +00:00
// Gestion des modules
void InstallModuleOptionsFrame( MODULE* Module,
wxDC* DC, const wxPoint& pos );
MODULE* Copie_Module( MODULE* module );
MODULE* Exchange_Module( wxWindow* winaff, MODULE* old_module, MODULE* new_module );
int Save_1_Module( const wxString& LibName, MODULE* Module,
bool Overwrite, bool DisplayDialog );
void Archive_Modules( const wxString& LibName, bool NewModulesOnly );
MODULE* Select_1_Module_From_BOARD( BOARD* Pcb );
2007-09-01 12:00:30 +00:00
MODULE* GetModuleByName();
2007-08-04 04:42:49 +00:00
// Modules (footprints)
2007-08-04 04:42:49 +00:00
MODULE* Create_1_Module( wxDC* DC, const wxString& module_name );
void Edit_Module( MODULE* module, wxDC* DC );
void Rotate_Module( wxDC* DC, MODULE* module, int angle, bool incremental );
void Change_Side_Module( MODULE* Module, wxDC* DC );
void Place_Module( MODULE* module, wxDC* DC );
void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule,
wxDC* DC, const wxPoint& pos );
// module texts
2007-08-04 04:42:49 +00:00
void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC );
void DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC );
void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC );
void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC );
TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC );
void InstallPadOptionsFrame( D_PAD* pad, wxDC* DC, const wxPoint& pos );
void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod,
wxDC* DC, const wxPoint& pos );
// Pads sur modules
void AddPad( MODULE* Module, wxDC* DC );
void DeletePad( D_PAD* Pad, wxDC* DC );
void StartMovePad( D_PAD* Pad, wxDC* DC );
void RotatePad( D_PAD* Pad, wxDC* DC );
void PlacePad( D_PAD* Pad, wxDC* DC );
void Export_Pad_Settings( D_PAD* pt_pad );
void Import_Pad_Settings( D_PAD* pt_pad, wxDC* DC );
void Global_Import_Pad_Settings( D_PAD* Pad, wxDC* DC );
// loading footprints
2007-08-04 04:42:49 +00:00
MODULE* Get_Librairie_Module( wxWindow* winaff, const wxString& library,
const wxString& ModuleName, bool show_msg_err );
2007-08-04 04:42:49 +00:00
wxString Select_1_Module_From_List(
WinEDA_DrawFrame* active_window, const wxString& Library,
const wxString& Mask, const wxString& KeyWord );
2007-08-04 04:42:49 +00:00
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
// ratsnest functions
2007-10-07 03:08:24 +00:00
void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */
2007-08-04 04:42:49 +00:00
void ReCompile_Ratsnest_After_Changes( wxDC* DC );
int Test_1_Net_Ratsnest( wxDC* DC, int net_code );
char* build_ratsnest_module( wxDC* DC, MODULE* Module );
void trace_ratsnest_module( wxDC* DC );
void Build_Board_Ratsnest( wxDC* DC );
void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 );
void trace_ratsnest_pad( wxDC* DC );
void recalcule_pad_net_code(); /* compute and update the PAD net codes */
2007-09-01 12:00:30 +00:00
void build_liste_pads();
2007-08-04 04:42:49 +00:00
int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init );
void Tst_Ratsnest( wxDC* DC, int ref_netcode );
void test_connexions( wxDC* DC );
void test_1_net_connexion( wxDC* DC, int net_code );
void reattribution_reference_piste( int affiche );
// Plotting
void ToPlotter( wxCommandEvent& event );
void Plot_Serigraphie( int format_plot, FILE* File, int masque_layer );
void Genere_GERBER( const wxString& FullFileName, int Layer,
bool PlotOriginIsAuxAxis );
void Genere_HPGL( const wxString& FullFileName, int Layer );
void Genere_PS( const wxString& FullFileName, int Layer );
void Plot_Layer_HPGL( FILE* File, int masque_layer,
int garde, int tracevia, int modetrace );
void Plot_Layer_GERBER( FILE* File, int masque_layer,
int garde, int tracevia );
int Gen_D_CODE_File( FILE* file );
void Plot_Layer_PS( FILE* File, int masque_layer,
int garde, int tracevia, int modetrace );
/* Block operations: */
void Block_Delete( wxDC* DC );
void Block_Rotate( wxDC* DC );
void Block_Invert( wxDC* DC );
void Block_Move( wxDC* DC );
void Block_Duplicate( wxDC* DC );
2007-10-31 06:40:15 +00:00
/**
* Function DelLimitesZone
* deletes the limits of a zone.
* @param DC A wxDC to draw onto.
* @param Redraw If true, means redraw the pcb without the zone limits
*/
2007-08-04 04:42:49 +00:00
void DelLimitesZone( wxDC* DC, bool Redraw );
// layerhandling:
2007-10-07 03:08:24 +00:00
// (See pcbnew/sel_layer.cpp for description of why null_layer parameter is provided)
int SelectLayer( int default_layer, int min_layer, int max_layer,
bool null_layer = false );
2007-09-01 12:00:30 +00:00
void SelectLayerPair();
2007-08-04 04:42:49 +00:00
virtual void SwitchLayer( wxDC* DC, int layer );
// divers
void AddHistory( int value, KICAD_T type ); // Add value in data list history
2007-08-04 04:42:49 +00:00
void InstallGridFrame( const wxPoint& pos );
DECLARE_EVENT_TABLE()
};
2007-08-04 04:42:49 +00:00
/*****************************************************/
/* class WinEDA_PcbFrame: public WinEDA_BasePcbFrame */
/*****************************************************/
class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
{
public:
2007-08-04 04:42:49 +00:00
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelTrackWidthBox;
WinEDAChoiceBox* m_SelViaSizeBox;
private:
2007-08-04 04:42:49 +00:00
bool m_SelTrackWidthBox_Changed;
bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu;
2007-12-01 03:42:52 +00:00
DRC* m_drc; ///< the DRC controller, see drc.cpp
// we'll use lower case function names for private member functions.
void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu );
void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
void createPopUpBlockMenu( wxMenu* menu );
public:
2007-08-04 04:42:49 +00:00
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
2007-08-04 04:42:49 +00:00
2007-09-01 12:00:30 +00:00
~WinEDA_PcbFrame();
2007-08-04 04:42:49 +00:00
// Configurations:
void InstallConfigFrame( const wxPoint& pos );
void Process_Config( wxCommandEvent& event );
void Update_config( wxWindow* displayframe );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
bool OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct );
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
2007-08-04 04:42:49 +00:00
void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
2007-09-01 12:00:30 +00:00
void ReCreateHToolbar();
void ReCreateAuxiliaryToolbar();
void ReCreateVToolbar();
void ReCreateAuxVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
2007-08-04 04:42:49 +00:00
WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent );
2007-09-01 12:00:30 +00:00
void PrepareLayerIndicator();
2007-08-04 04:42:49 +00:00
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
2007-09-06 04:34:03 +00:00
/**
* Function OnRightClick
* populates a popup menu with the choices appropriate for the current context.
* The caller will add the ZOOM menu choices afterwards.
* @param aMousePos The current mouse position
* @param aPopMenu The menu to add to.
*/
bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu );
2007-08-04 04:42:49 +00:00
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
/* Gestion generale des operations sur block */
int ReturnBlockCommand( int key );
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
2007-09-01 12:00:30 +00:00
void SetToolbars();
2007-08-04 04:42:49 +00:00
void Process_Settings( wxCommandEvent& event );
void InstallPcbOptionsFrame( const wxPoint& pos, wxDC* DC, int id );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
void GenModulesPosition( wxCommandEvent& event );
void GenModuleReport( wxCommandEvent& event );
void InstallDrillFrame( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void Files_io( wxCommandEvent& event );
int LoadOnePcbFile( const wxString& FileName, wxDC* DC, bool Append );
int ReadPcbFile( wxDC* DC, FILE* File, bool Append );
bool SavePcbFile( const wxString& FileName );
int SavePcbFormatAscii( FILE* File );
bool WriteGeneralDescrPcb( FILE* File );
2007-09-01 12:00:30 +00:00
bool RecreateCmpFileFromBoard();
2007-08-04 04:42:49 +00:00
void ExportToGenCAD( wxCommandEvent& event );
/* Fonctions specifiques */
2007-09-01 12:00:30 +00:00
MODULE* ListAndSelectModuleName();
2007-08-04 04:42:49 +00:00
void Liste_Equipot( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event );
void Install_Test_DRC_Frame( wxDC* DC );
void Trace_Pcb( wxDC* DC, int mode );
// Handling texts on the board
2007-08-04 04:42:49 +00:00
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
TEXTE_PCB* Create_Texte_Pcb( wxDC* DC );
void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC );
void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB,
wxDC* DC, const wxPoint& pos );
// Graphic Segments type DRAWSEGMENT
2007-08-04 04:42:49 +00:00
void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
// Footprint edition (see also WinEDA_BasePcbFrame)
2007-08-04 04:42:49 +00:00
void StartMove_Module( MODULE* module, wxDC* DC );
bool Delete_Module( MODULE* module, wxDC* DC );
// loading modules: see WinEDA_BasePcbFrame
2007-08-04 04:42:49 +00:00
// Board handling
void Erase_Zones( bool query );
void Erase_Segments_Pcb( bool is_edges, bool query );
2007-08-04 04:42:49 +00:00
void Erase_Pistes( wxDC* DC, int masque_type, bool query );
void Erase_Modules( bool query );
void Erase_Textes_Pcb( bool query );
2007-09-01 12:00:30 +00:00
void Erase_Marqueurs();
2007-08-04 04:42:49 +00:00
void UnDeleteItem( wxDC* DC );
2007-10-29 15:51:48 +00:00
void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
2007-08-04 04:42:49 +00:00
void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via );
// Hightlight functions:
2007-08-04 04:42:49 +00:00
int Select_High_Light( wxDC* DC );
void Hight_Light( wxDC* DC );
void DrawHightLight( wxDC* DC, int NetCode );
// Track and via edition:
2007-09-01 12:00:30 +00:00
void DisplayTrackSettings();
2007-12-14 22:31:45 +00:00
/**
* Function Other_Layer_Route
* operates in one of two ways. If argument track is NULL, then swap the active
* layer between m_Route_Layer_TOP and m_Route_Layer_BOTTOM. If a track is
* in progress (track is not NULL), and if DRC allows it, place a via on the end
* of the current track, and then swap the current active layer and start a new
* segment on the new layer.
* @param track A TRACK* to append the via to or NULL.
* @param DC A device context to draw on.
* @return bool - true if the operation was successful, else false such as
* the case where DRC would not allow a via.
*/
bool Other_Layer_Route( TRACK* track, wxDC* DC );
2007-08-04 04:42:49 +00:00
void Affiche_PadsNoConnect( wxDC* DC );
void Affiche_Status_Net( wxDC* DC );
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
void Delete_Track( wxDC* DC, TRACK* Track );
void Delete_net( wxDC* DC, TRACK* Track );
void Delete_Zone( wxDC* DC, SEGZONE* Track );
void Supprime_Une_Piste( wxDC* DC, TRACK* pt_segm );
bool Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via );
void Edit_Zone_Width( wxDC* DC, SEGZONE* pt_ref );
void Edit_Net_Width( wxDC* DC, int Netcode );
void Edit_Track_Width( wxDC* DC, TRACK* Track );
int Edit_TrackSegm_Width( wxDC* DC, TRACK* segm );
TRACK* Begin_Route( TRACK* track, wxDC* DC );
void End_Route( TRACK* track, wxDC* DC );
void ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC );
void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On );
void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On );
void Attribut_net( wxDC* DC, int net_code, bool Flag_On );
void Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int command );
bool PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, int layer );
2007-12-01 03:42:52 +00:00
int Add_45_degrees_Segment( wxDC* DC, TRACK* pt_segm );
bool Genere_Pad_Connexion( wxDC* DC, int layer );
2007-08-04 04:42:49 +00:00
// zone handling
2007-08-04 04:42:49 +00:00
EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone );
void CaptureNetName( wxDC* DC );
2007-12-20 22:27:32 +00:00
EDGE_ZONE* Begin_Zone( wxDC* DC );
2007-10-31 14:14:21 +00:00
/**
* Function End_Zone
* terminates the zone edge creation process
*/
2007-08-04 04:42:49 +00:00
void End_Zone( wxDC* DC );
2007-11-01 04:48:42 +00:00
/**
* Function Fill_Zone
* creates a number zone segments by using a flood fill algorithm. The
* "high-lighted" net is used to determine the netcode of all the zone
* segments and what can be connected to and what must be avoided on the
* current layer as the flooding occurs.
*/
2007-08-04 04:42:49 +00:00
void Fill_Zone( wxDC* DC );
// Target handling
2007-08-04 04:42:49 +00:00
MIREPCB* Create_Mire( wxDC* DC );
void Delete_Mire( MIREPCB* MirePcb, wxDC* DC );
void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC );
void Place_Mire( MIREPCB* MirePcb, wxDC* DC );
void InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC, const wxPoint& pos );
// Graphic segments type DRAWSEGMENT handling:
2007-08-04 04:42:49 +00:00
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
// Dimension handling:
2007-08-04 04:42:49 +00:00
void Install_Edit_Cotation( COTATION* Cotation, wxDC* DC, const wxPoint& pos );
COTATION* Begin_Cotation( COTATION* Cotation, wxDC* DC );
void Delete_Cotation( COTATION* Cotation, wxDC* DC );
// netlist handling:
2007-08-04 04:42:49 +00:00
void InstallNetlistFrame( wxDC* DC, const wxPoint& pos );
// Autoplacement:
void AutoPlace( wxCommandEvent& event );
void ReOrientModules( const wxString& ModuleMask, int Orient,
bool include_fixe, wxDC* DC );
void FixeModule( MODULE* Module, bool Fixe );
void AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb );
2007-09-01 12:00:30 +00:00
bool SetBoardBoundaryBoxFromEdgesOnly();
2007-08-04 04:42:49 +00:00
void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC );
int RecherchePlacementModule( MODULE* Module, wxDC* DC );
void GenModuleOnBoard( MODULE* Module );
float Compute_Ratsnest_PlaceModule( wxDC* DC );
2007-09-01 12:00:30 +00:00
int GenPlaceBoard();
2007-08-04 04:42:49 +00:00
void DrawInfoPlace( wxDC* DC );
// Autorouting:
2007-08-04 04:42:49 +00:00
int Solve( wxDC* DC, int two_sides );
void Reset_Noroutable( wxDC* DC );
void Autoroute( wxDC* DC, int mode );
void ReadAutoroutedTracks( wxDC* DC );
void GlobalRoute( wxDC* DC );
// divers
void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC );
2007-08-04 04:42:49 +00:00
void Ratsnest_On_Off( wxDC* DC );
void Clean_Pcb( wxDC* DC );
2007-09-01 12:00:30 +00:00
BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems );
2007-08-04 04:42:49 +00:00
void InstallFindFrame( const wxPoint& pos, wxDC* DC );
/**
* Function SendMessageToEESCHEMA
* sends a message to the schematic editor so that it may move its cursor
* to a part with the same reference as the objectToSync
* @param objectToSync The object whose reference is used to syncronize eeschema.
*/
2007-09-30 02:37:06 +00:00
void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
/* Micro waves functions */
2007-08-04 04:42:49 +00:00
void Edit_Gap( wxDC* DC, MODULE* Module );
MODULE* Create_MuWaveBasicShape( wxDC* DC, const wxString& name, int pad_count );
MODULE* Create_MuWaveComponent( wxDC* DC, int shape_type );
MODULE* Create_MuWavePolygonShape( wxDC* DC );
void Begin_Self( wxDC* DC );
MODULE* Genere_Self( wxDC* DC );
DECLARE_EVENT_TABLE()
};
2007-08-04 04:42:49 +00:00
/****************************************************/
/* class WinEDA_GerberFrame: public WinEDA_PcbFrame */
/****************************************************/
class WinEDA_GerberFrame : public WinEDA_BasePcbFrame
{
public:
2007-08-04 04:42:49 +00:00
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelLayerTool;
private:
2007-08-04 04:42:49 +00:00
wxMenu* m_FilesMenu;
public:
2007-08-04 04:42:49 +00:00
WinEDA_GerberFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
2007-08-04 04:42:49 +00:00
2007-09-01 12:00:30 +00:00
~WinEDA_GerberFrame();
2007-08-04 04:42:49 +00:00
2007-09-01 12:00:30 +00:00
void Update_config();
2007-08-04 04:42:49 +00:00
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
2007-09-01 12:00:30 +00:00
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
2007-08-04 04:42:49 +00:00
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
2007-09-01 12:00:30 +00:00
int BestZoom(); // Retourne le meilleur zoom
2007-08-04 04:42:49 +00:00
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
2007-08-04 04:42:49 +00:00
2007-09-01 12:00:30 +00:00
EDA_BaseStruct* GerberGeneralLocateAndDisplay();
2007-08-04 04:42:49 +00:00
EDA_BaseStruct* Locate( int typeloc );
2007-08-04 04:42:49 +00:00
2007-09-01 12:00:30 +00:00
void SetToolbars();
2007-08-04 04:42:49 +00:00
void Process_Settings( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void InstallConfigFrame( const wxPoint& pos );
void InstallPcbOptionsFrame( const wxPoint& pos, int id );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
/* handlers for block commands */
2007-08-04 04:42:49 +00:00
int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC );
virtual int HandleBlockEnd( wxDC* DC );
void InstallDrillFrame( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void Genere_HPGL( const wxString& FullFileName, int Layers );
void Genere_GERBER( const wxString& FullFileName, int Layers );
void Genere_PS( const wxString& FullFileName, int Layers );
void Plot_Layer_HPGL( FILE* File, int masque_layer,
int garde, int tracevia, int modetrace );
void Plot_Layer_GERBER( FILE* File, int masque_layer,
int garde, int tracevia );
int Gen_D_CODE_File( const wxString& Name_File );
void Plot_Layer_PS( FILE* File, int masque_layer,
int garde, int tracevia, int modetrace );
void Files_io( wxCommandEvent& event );
int LoadOneGerberFile( const wxString& FileName, wxDC* DC, int mode );
int ReadGerberFile( wxDC* DC, FILE* File, bool Append );
bool Read_GERBER_File( wxDC* DC,
const wxString& GERBER_FullFileName,
const wxString& D_Code_FullFileName );
bool SaveGerberFile( const wxString& FileName, wxDC* DC );
int Read_D_Code_File( const wxString& D_Code_FullFileName );
2007-09-01 12:00:30 +00:00
void CopyDCodesSizeToItems();
2007-08-04 04:42:49 +00:00
void Liste_D_Codes( wxDC* DC );
/* Fonctions specifiques */
void Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer );
2007-08-04 04:42:49 +00:00
// Copper texts
2007-08-04 04:42:49 +00:00
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
TEXTE_PCB* Create_Texte_Pcb( wxDC* DC );
void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC );
void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
// PCB handling
bool Clear_Pcb( bool query );
void Erase_Current_Layer( bool query );
void Erase_Zones( bool query );
void Erase_Segments_Pcb( bool is_edges, bool query );
void Erase_Pistes( int masque_type, bool query );
void Erase_Textes_Pcb( bool query );
2007-08-04 04:42:49 +00:00
void UnDeleteItem( wxDC* DC );
void Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number );
TRACK* Begin_Route( TRACK* track, wxDC* DC );
void End_Route( TRACK* track, wxDC* DC );
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
int Edit_TrackSegm_Width( wxDC* DC, TRACK* segm );
// Conversion function
void ExportDataInPcbnewFormat( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
/*********************************************************/
/* class WinEDA_ModuleEditFrame: public WinEDA_DrawFrame */
/* Class for the footprint editor */
/*********************************************************/
2007-08-04 04:42:49 +00:00
class WinEDA_ModuleEditFrame : public WinEDA_BasePcbFrame
{
public:
2007-08-04 04:42:49 +00:00
MODULE* CurrentModule;
wxString m_CurrentLib;
public:
2007-08-04 04:42:49 +00:00
WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
2007-08-04 04:42:49 +00:00
2007-09-01 12:00:30 +00:00
~WinEDA_ModuleEditFrame();
2007-08-04 04:42:49 +00:00
void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
2007-09-01 12:00:30 +00:00
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateAuxiliaryToolbar();
2007-08-04 04:42:49 +00:00
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
2007-09-01 12:00:30 +00:00
void SetToolbars();
void ReCreateMenuBar();
2007-08-04 04:42:49 +00:00
void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* handlers for block commands */
2007-08-04 04:42:49 +00:00
int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC );
virtual int HandleBlockEnd( wxDC* DC );
BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
/* Undo and redo functions */
public:
2007-08-04 04:42:49 +00:00
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
private:
2007-09-01 12:00:30 +00:00
void GetComponentFromUndoList();
void GetComponentFromRedoList();
public:
2007-08-04 04:42:49 +00:00
// Footprint edition
2007-08-04 04:42:49 +00:00
void Place_Ancre( MODULE* module, wxDC* DC );
void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC );
void Transform( MODULE* module, wxDC* DC, int transform );
// loading Footprint
2007-08-04 04:42:49 +00:00
MODULE* Import_Module( wxDC* DC );
void Export_Module( MODULE* ptmod, bool createlib );
void Load_Module_Module_From_BOARD( MODULE* Module );
// functions to edit footprint edges
2007-08-04 04:42:49 +00:00
void Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC );
void Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC );
void Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC );
EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge );
void End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC );
void Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC );
void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
void Place_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
// handlers for libraries:
2007-08-04 04:42:49 +00:00
void Delete_Module_In_Library( const wxString& libname );
int Create_Librairie( const wxString& LibName );
2007-09-01 12:00:30 +00:00
void Select_Active_Library();
2007-08-04 04:42:49 +00:00
DECLARE_EVENT_TABLE()
};
2007-08-04 04:42:49 +00:00
/*******************************/
/* class WinEDA_SchematicFrame */
/*******************************/
/* enum used in RotationMiroir() */
2007-08-04 04:42:49 +00:00
enum fl_rot_cmp {
CMP_NORMAL, // orientation normale (O, pas de miroir)
CMP_ROTATE_CLOCKWISE, // nouvelle rotation de -90
CMP_ROTATE_COUNTERCLOCKWISE, // nouvelle rotation de +90
CMP_ORIENT_0, // orientation 0, pas de miroir, id CMP_NORMAL
CMP_ORIENT_90, // orientation 90, pas de miroir
CMP_ORIENT_180, // orientation 180, pas de miroir
CMP_ORIENT_270, // orientation -90, pas de miroir
CMP_MIROIR_X = 0x100, // miroir selon axe X
CMP_MIROIR_Y = 0x200 // miroir selon axe Y
};
2007-08-04 04:42:49 +00:00
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
{
public:
2007-08-04 04:42:49 +00:00
WinEDAChoiceBox* m_SelPartBox;
private:
2007-08-04 04:42:49 +00:00
wxMenu* m_FilesMenu;
public:
2007-08-04 04:42:49 +00:00
WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
2007-08-04 04:42:49 +00:00
2007-09-01 12:00:30 +00:00
~WinEDA_SchematicFrame();
2007-08-04 04:42:49 +00:00
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void Save_Config( wxWindow* displayframe );
2007-08-04 04:42:49 +00:00
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
2007-08-04 04:42:49 +00:00
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void SetToolbars();
void OnHotKey( wxDC* DC,
int hotkey,
EDA_BaseStruct* DrawStruct );
2007-08-04 04:42:49 +00:00
2007-09-01 12:00:30 +00:00
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; }
2007-08-04 04:42:49 +00:00
void InstallConfigFrame( const wxPoint& pos );
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
int BestZoom(); // Retourne le meilleur zoom
EDA_BaseStruct* SchematicGeneralLocateAndDisplay(
bool IncludePin = TRUE );
EDA_BaseStruct* SchematicGeneralLocateAndDisplay(
const wxPoint& refpoint,
bool IncludePin );
EDA_BaseStruct* FindComponentAndItem(
const wxString& component_reference, bool Find_in_hierarchy,
int SearchType,
const wxString& text_to_find,
bool mouseWarp );
2007-08-04 04:42:49 +00:00
/* Cross probing with pcbnew */
void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
EDA_SchComponentStruct* LibItem );
2007-08-04 04:42:49 +00:00
/* netlist generation */
2007-09-01 12:00:30 +00:00
void* BuildNetListBase();
2007-08-04 04:42:49 +00:00
// FUnctions used for hierarchy handling
2007-09-01 12:00:30 +00:00
void InstallPreviousScreen();
2007-08-04 04:42:49 +00:00
void InstallNextScreen( DrawSheetStruct* Sheet );
void ToPlot_PS( wxCommandEvent& event );
void ToPlot_HPGL( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void Save_File( wxCommandEvent& event );
int LoadOneEEProject( const wxString& FileName, bool IsNew );
bool LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName );
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
bool LoadOneSheet( SCH_SCREEN* screen, const wxString& FullFileName );
// General search:
/**
* Function FindSchematicItem
* finds a string in the schematic.
* @param pattern The text to search for, either in value, reference or elsewhere.
* @param SearchType: 0 => Search is made in current sheet
* 1 => the whole hierarchy
* 2 => or for the next item
* @param mouseWarp If true, then move the mouse cursor to the item.
*/
EDA_BaseStruct* FindSchematicItem( const wxString& pattern,
int SearchType,
bool mouseWarp = true );
2007-08-04 04:42:49 +00:00
EDA_BaseStruct* FindMarker( int SearchType );
private:
2007-08-04 04:42:49 +00:00
void Process_Move_Item( EDA_BaseStruct* DrawStruct, wxDC* DC );
// Bus Entry
DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type );
void SetBusEntryShape( wxDC* DC,
DrawBusEntryStruct* BusEntry,
int entry_type );
int GetBusEntryShape( DrawBusEntryStruct* BusEntry );
void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem, wxDC* DC );
// NoConnect
EDA_BaseStruct* CreateNewNoConnectStruct( wxDC* DC );
// Junction
DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC,
const wxPoint& pos,
bool PutInUndoList = FALSE );
// Text ,label, glabel
EDA_BaseStruct* CreateNewText( wxDC* DC, int type );
void EditSchematicText( DrawTextStruct* TextStruct, wxDC* DC );
void ChangeTextOrient( DrawTextStruct* TextStruct, wxDC* DC );
void StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC );
void ConvertTextType( DrawTextStruct* Text, wxDC* DC, int newtype );
// Wire, Bus
void BeginSegment( wxDC* DC, int type );
void EndSegment( wxDC* DC );
void DeleteCurrentSegment( wxDC* DC );
void DeleteConnection( wxDC* DC, bool DeleteFullConnection );
// graphic lines
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC );
// Hierarchical Sheet & PinSheet
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
DrawSheetStruct* CreateSheet( wxDC* DC );
void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
public:
2007-08-04 04:42:49 +00:00
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
private:
2007-08-04 04:42:49 +00:00
void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC );
DrawSheetLabelStruct* Create_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
void Edit_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
void StartMove_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
void Place_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
DrawSheetLabelStruct* Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
public:
2007-08-04 04:42:49 +00:00
void DeleteSheetLabel( wxDC* DC, DrawSheetLabelStruct* SheetLabelToDel );
private:
2007-08-04 04:42:49 +00:00
// Component
EDA_SchComponentStruct* Load_Component( wxDC* DC,
const wxString& libname,
wxArrayString& List,
bool UseLibBrowser );
void StartMovePart( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
public:
2007-08-04 04:42:49 +00:00
void CmpRotationMiroir(
EDA_SchComponentStruct* DrawComponent, wxDC* DC, int type_rotate );
private:
2007-08-04 04:42:49 +00:00
void SelPartUnit( EDA_SchComponentStruct* DrawComponent, int unit, wxDC* DC );
void ConvertPart( EDA_SchComponentStruct* DrawComponent, wxDC* DC );
void SetInitCmp( EDA_SchComponentStruct* DrawComponent, wxDC* DC );
void EditComponentReference( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
void EditComponentValue( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
void EditComponentFootprint( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
2007-08-04 04:42:49 +00:00
void StartMoveCmpField( PartTextStruct* Field, wxDC* DC );
void EditCmpFieldText( PartTextStruct* Field, wxDC* DC );
void RotateCmpField( PartTextStruct* Field, wxDC* DC );
/* Operations sur bloc */
void PasteStruct( wxDC* DC );
/* Undo - redo */
public:
2007-08-04 04:42:49 +00:00
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int flag_type_command = 0 );
private:
2007-08-04 04:42:49 +00:00
void PutDataInPreviousState( DrawPickedStruct* List );
2007-09-19 15:29:50 +00:00
bool GetSchematicFromRedoList();
bool GetSchematicFromUndoList();
public:
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
2007-08-04 04:42:49 +00:00
/* Gestion generale des operations sur block */
int ReturnBlockCommand( int key );
void InitBlockPasteInfos();
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
void HandleBlockEndByPopUp( int Command, wxDC* DC );
2007-08-04 04:42:49 +00:00
// Repetition automatique de placements
void RepeatDrawItem( wxDC* DC );
2007-08-04 04:42:49 +00:00
// Test des points de connexion en l'air (dangling ends)
void TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC );
LibDrawPin* LocatePinEnd( EDA_BaseStruct* DrawList, const wxPoint& pos );
2007-08-04 04:42:49 +00:00
DECLARE_EVENT_TABLE()
};
2007-08-04 04:42:49 +00:00
/*****************************/
/* class WinEDA_LibeditFrame */
/*****************************/
2007-08-04 04:42:49 +00:00
class WinEDA_LibeditFrame : public WinEDA_DrawFrame
{
public:
2007-08-04 04:42:49 +00:00
WinEDAChoiceBox* m_SelpartBox;
WinEDAChoiceBox* m_SelAliasBox;
public:
2007-08-04 04:42:49 +00:00
WinEDA_LibeditFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
2007-08-04 04:42:49 +00:00
2007-09-01 12:00:30 +00:00
~WinEDA_LibeditFrame();
2007-08-04 04:42:49 +00:00
void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar();
void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); // Retourne le meilleur zoom
void SetToolbars();
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
2007-09-01 12:00:30 +00:00
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; }
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
private:
2007-08-04 04:42:49 +00:00
// General:
2007-09-01 12:00:30 +00:00
void CreateNewLibraryPart();
void DeleteOnePart();
void SaveOnePartInMemory();
void SelectActiveLibrary();
bool LoadOneLibraryPart();
void SaveActiveLibrary();
void ImportOnePart();
2007-08-04 04:42:49 +00:00
void ExportOnePart( bool create_lib );
int LoadOneLibraryPartAux( EDA_LibComponentStruct* LibEntry,
LibraryStruct* Library, int noMsg = 0 );
void DisplayCmpDoc( const wxString& Name );
void InstallLibeditFrame( const wxPoint& pos );
// General editing
public:
2007-08-04 04:42:49 +00:00
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
private:
2007-09-19 15:29:50 +00:00
bool GetComponentFromUndoList();
bool GetComponentFromRedoList();
2007-08-04 04:42:49 +00:00
// Edition des Pins:
void CreatePin( wxDC* DC );
void DeletePin( wxDC* DC,
EDA_LibComponentStruct* LibEntry,
LibDrawPin* Pin );
void StartMovePin( wxDC* DC );
// Test des pins ( duplicates...)
bool TestPins( EDA_LibComponentStruct* LibEntry );
// Edition de l'ancre
2007-09-01 12:00:30 +00:00
void PlaceAncre();
2007-08-04 04:42:49 +00:00
// Edition des graphismes:
LibEDA_BaseStruct* CreateGraphicItem( wxDC* DC );
void GraphicItemBeginDraw( wxDC* DC );
void StartMoveDrawSymbol( wxDC* DC );
void EndDrawGraphicItem( wxDC* DC );
void LoadOneSymbol( wxDC* DC );
2007-09-01 12:00:30 +00:00
void SaveOneSymbol();
2007-08-04 04:42:49 +00:00
void EditGraphicSymbol( wxDC* DC, LibEDA_BaseStruct* DrawItem );
void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem );
void RotateSymbolText( wxDC* DC );
void DeleteDrawPoly( wxDC* DC );
LibDrawField* LocateField( EDA_LibComponentStruct* LibEntry );
LibEDA_BaseStruct* LocateItemUsingCursor();
2007-08-04 04:42:49 +00:00
void RotateField( wxDC* DC, LibDrawField* Field );
void PlaceField( wxDC* DC, LibDrawField* Field );
void EditField( wxDC* DC, LibDrawField* Field );
void StartMoveField( wxDC* DC, LibDrawField* field );
public:
2007-08-04 04:42:49 +00:00
/* Block commands: */
int ReturnBlockCommand( int key );
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
void DeletePartInLib( LibraryStruct* Library, EDA_LibComponentStruct* Entry );
void PlacePin( wxDC* DC );
2007-09-01 12:00:30 +00:00
void InitEditOnePin();
2007-08-04 04:42:49 +00:00
void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id );
2007-08-04 04:42:49 +00:00
// Repetition automatique de placement de pins
void RepeatPinItem( wxDC* DC, LibDrawPin* Pin );
DECLARE_EVENT_TABLE()
};
class LibraryStruct;
2007-08-04 04:42:49 +00:00
class WinEDA_ViewlibFrame : public WinEDA_DrawFrame
{
public:
2007-08-04 04:42:49 +00:00
WinEDAChoiceBox* SelpartBox;
2007-08-04 04:42:49 +00:00
wxListBox* m_LibList;
wxSize m_LibListSize;
wxListBox* m_CmpList;
wxSize m_CmpListSize;
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
public:
2007-08-04 04:42:49 +00:00
WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
LibraryStruct* Library = NULL,
wxSemaphore* semaphore = NULL );
2007-09-01 12:00:30 +00:00
~WinEDA_ViewlibFrame();
2007-08-04 04:42:49 +00:00
void OnSize( wxSizeEvent& event );
2007-09-01 12:00:30 +00:00
void ReCreateListLib();
void ReCreateListCmp();
2007-08-04 04:42:49 +00:00
void Process_Special_Functions( wxCommandEvent& event );
2007-09-01 12:00:30 +00:00
void DisplayLibInfos();
2007-08-04 04:42:49 +00:00
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event );
2007-09-01 12:00:30 +00:00
void ReCreateHToolbar();
void ReCreateVToolbar();
2007-08-04 04:42:49 +00:00
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
2007-09-01 12:00:30 +00:00
int BestZoom(); // Retourne le meilleur zoom
2007-08-04 04:42:49 +00:00
void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event );
2007-09-01 12:00:30 +00:00
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; }
private:
2007-09-01 12:00:30 +00:00
void SelectCurrentLibrary();
2007-08-04 04:42:49 +00:00
void SelectAndViewLibraryPart( int option );
void ExportToSchematicLibraryPart( wxCommandEvent& event );
void ViewOneLibraryContent( LibraryStruct* Lib, int Flag );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
2007-08-04 04:42:49 +00:00
DECLARE_EVENT_TABLE()
};
2007-08-04 04:42:49 +00:00
/****************************************************/
/* classe representant un ecran graphique de dessin */
/****************************************************/
#include "drawpanel_wxstruct.h"
/*********************************************************
class WinEDA_MsgPanel : this is a panel to display various infos
and messages on items in eeschema an pcbnew
*********************************************************/
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
{
int m_X;
int m_UpperY;
int m_LowerY;
wxString m_UpperText;
wxString m_LowerText;
int m_Color;
/**
* 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 )
{
m_X = rv.m_X;
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;
return *this;
}
};
2007-08-04 04:42:49 +00:00
class WinEDA_MsgPanel : public wxPanel
{
2007-10-10 18:01:14 +00:00
protected:
std::vector<MsgItem> m_Items;
void showItem( wxDC& dc, const MsgItem& aItem );
2007-10-10 18:01:14 +00:00
public:
2007-08-04 04:42:49 +00:00
WinEDA_DrawFrame* m_Parent;
int m_BgColor; // couleur de fond
public:
2007-08-04 04:42:49 +00:00
// Constructor and destructor
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
void OnPaint( wxPaintEvent& event );
2007-09-01 12:00:30 +00:00
void EraseMsgBox();
2007-08-04 04:42:49 +00:00
void EraseMsgBox( wxDC* DC );
void Affiche_1_Parametre( int pos_X, const wxString& texte_H,
const wxString& texte_L, int color );
2007-08-04 04:42:49 +00:00
DECLARE_EVENT_TABLE()
};
/************************************************/
/* Class to enter a line, is some dialog frames */
/************************************************/
class WinEDA_EnterText
{
public:
2007-08-04 04:42:49 +00:00
bool m_Modify;
private:
2007-08-04 04:42:49 +00:00
wxString m_NewText;
wxTextCtrl* m_FrameText;
wxStaticText* m_Title;
public:
2007-08-04 04:42:49 +00:00
// Constructor and destructor
WinEDA_EnterText( wxWindow* parent, const wxString& Title,
const wxString& TextToEdit, wxBoxSizer* BoxSizer,
const wxSize& Size );
2007-09-01 12:00:30 +00:00
~WinEDA_EnterText()
2007-08-04 04:42:49 +00:00
{
}
2007-09-01 12:00:30 +00:00
wxString GetValue();
2007-08-04 04:42:49 +00:00
void GetValue( char* buffer, int lenmax );
void SetValue( const wxString& new_text );
void Enable( bool enbl );
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 );
}
};
/************************************************************************/
/* Class to edit/enter a graphic text and its dimension ( INCHES or MM )*/
/************************************************************************/
class WinEDA_GraphicTextCtrl
{
public:
2007-08-04 04:42:49 +00:00
int m_Units, m_Internal_Unit;
2007-08-04 04:42:49 +00:00
wxTextCtrl* m_FrameText;
wxTextCtrl* m_FrameSize;
private:
2007-08-04 04:42:49 +00:00
wxStaticText* m_Title;
public:
2007-08-04 04:42:49 +00:00
// Constructor and destructor
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
2007-09-01 12:00:30 +00:00
wxString GetText();
int GetTextSize();
2007-08-04 04:42:49 +00:00
void Enable( bool state );
void SetTitle( const wxString& title );
2007-09-01 12:00:30 +00:00
void SetFocus() { m_FrameText->SetFocus(); }
2007-08-04 04:42:49 +00:00
void SetValue( const wxString& value );
void SetValue( int value );
};
/*************************************************************************************/
/*Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in dialog boxes */
/*************************************************************************************/
class WinEDA_PositionCtrl
{
public:
2007-08-04 04:42:49 +00:00
int m_Units, m_Internal_Unit;
wxPoint m_Pos_To_Edit;
2007-08-04 04:42:49 +00:00
wxTextCtrl* m_FramePosX;
wxTextCtrl* m_FramePosY;
private:
2007-08-04 04:42:49 +00:00
wxStaticText* m_TextX, * m_TextY;
public:
2007-08-04 04:42:49 +00:00
// Constructor and destructor
WinEDA_PositionCtrl( wxWindow* parent, const wxString& title,
const wxPoint& pos_to_edit,
int units, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
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();
};
/*************************************************************
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
{
public:
2007-08-04 04:42:49 +00:00
// Constructor and destructor
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();
};
/****************************************************************/
/* Class to edit/enter a value ( INCHES or MM ) in dialog boxes */
/****************************************************************/
2007-08-04 04:42:49 +00:00
/* internal_unit est le nombre d'unites internes par inch
2007-08-04 04:42:49 +00:00
* - 1000 sur EESchema
* - 10000 sur PcbNew
*/
class WinEDA_ValueCtrl
{
public:
2007-08-04 04:42:49 +00:00
int m_Units;
int m_Value;
wxTextCtrl* m_ValueCtrl;
private:
2007-08-04 04:42:49 +00:00
int m_Internal_Unit;
wxStaticText* m_Text;
public:
2007-08-04 04:42:49 +00:00
// Constructor and destructor
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
2007-09-01 12:00:30 +00:00
int GetValue();
2007-08-04 04:42:49 +00:00
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:
2007-08-04 04:42:49 +00:00
double m_Value;
wxTextCtrl* m_ValueCtrl;
private:
2007-08-04 04:42:49 +00:00
wxStaticText* m_Text;
public:
2007-08-04 04:42:49 +00:00
// Constructor and destructor
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
2007-09-01 12:00:30 +00:00
double GetValue();
2007-08-04 04:42:49 +00:00
void SetValue( double new_value );
void Enable( bool enbl );
void SetToolTip( const wxString& text )
{
m_ValueCtrl->SetToolTip( text );
}
};
2007-08-04 04:42:49 +00:00
/*************************/
/* class WinEDA_Toolbar */
/*************************/
2007-08-04 04:42:49 +00:00
class WinEDA_Toolbar : public wxToolBar
{
public:
2007-08-04 04:42:49 +00:00
wxWindow* m_Parent;
id_toolbar m_Ident;
WinEDA_Toolbar* Pnext;
bool m_Horizontal;
int m_Size;
public:
2007-08-04 04:42:49 +00:00
WinEDA_Toolbar( id_toolbar type, wxWindow* parent,
wxWindowID id, bool horizontal );
2007-09-01 12:00:30 +00:00
WinEDA_Toolbar* Next() { return Pnext; }
};
2007-08-04 04:42:49 +00:00
/***********************/
/* class WinEDAListBox */
/***********************/
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;
private:
void (*m_MoveFct)( wxString & Text );
public:
2007-08-04 04:42:49 +00:00
WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
const wxChar** ItemList,
const wxString& RefText,
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
2007-09-01 12:00:30 +00:00
void SortList();
2007-08-04 04:42:49 +00:00
void Append( const wxString& item );
void InsertItems( const wxArrayString& itemlist, int position = 0 );
2007-09-01 12:00:30 +00:00
void MoveMouseToOrigin();
wxString GetTextSelection();
private:
2007-08-04 04:42:49 +00:00
void OnClose( wxCloseEvent& event );
2007-10-07 03:08:24 +00:00
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
2007-08-04 04:42:49 +00:00
void ClickOnList( wxCommandEvent& event );
void D_ClickOnList( wxCommandEvent& event );
void OnKeyEvent( wxKeyEvent& event );
DECLARE_EVENT_TABLE()
};
/*************************/
/* class WinEDAChoiceBox */
/*************************/
2007-08-04 04:42:49 +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
*/
#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();
}
};
#endif /* WXSTRUCT_H */