Commit 62a28440 authored by CHARRAS's avatar CHARRAS

wxstruct modified and wxPcbStuct.h added. some minor other changes

parent 0aaf01e9
/* XPM */
#ifndef XPMMAIN
extern const char *Add_Corner_xpm[];
#else
const char * Add_Corner_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 7 1",
" c None",
"X c #808080",
". c #008000",
"+ c #FFFF00",
"@ c #800000",
"o c #C0C0C0",
"O c #808000",
/* pixels */
" .XX ",
" .XX ",
" XooO ",
" ooX ",
"..X ooooX ..... ",
"X.XoooooX XXXXXX",
"XX ooo++O XXXXXX",
" X OOO@ X ",
" X X ",
" X.XX ",
" .XX ",
" .XX ",
" .XX ",
" .XX ",
" .XX ",
" XX "
};
#endif
/* XPM */
static const char * add_zone_xpm[] = {
"16 16 3 1",
" c None",
". c #007D00",
"+ c #007E00",
"................",
".... ........",
"... .......",
".. ++ .....",
". .... ...",
". +. ..... ..",
". +. ...... ..",
". .... .. .",
".. ++ .. ",
"... .. ... ",
".... .... ...",
"............ ..",
"............. .",
".............. .",
"............... ",
"............... "};
/* XPM */
#ifndef XPMMAIN
extern const char *add_zone_xpm[];
#else
const char * add_zone_xpm[] = {
"16 16 3 1",
" c None",
". c #007D00",
"+ c #007E00",
"................",
".... ........",
"... .......",
".. ++ .....",
". .... ...",
". +. ..... ..",
". +. ...... ..",
". .... .. .",
".. ++ .. ",
"... .. ... ",
".... .... ...",
"............ ..",
"............. .",
".............. .",
"............... ",
"............... "};
#endif
/* XPM */
#ifndef XPMMAIN
extern const char *add_zone_cutout[];
#else
const char * add_zone_cutout[] = {
"16 16 3 1",
" c None",
". c #007D00",
"+ c #900000",
" ..............",
".... ........",
"... ++++ .......",
".. + + .....",
". + + ...",
". + + ..",
". + + ..",
". + + .",
".. + + ..",
"... +++++++ ... ",
".... .... ",
"............ ",
"............. ",
".............. ",
" ............. ",
" ............ "};
#endif
......@@ -4,6 +4,13 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-jan-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+all
wxstruct modified and wxPcbStuct.h added:
classes relatives to pcbnew, cvpcb and gerbview are moved in wxPcbStuct.h
2007-Dec-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
......
......@@ -73,9 +73,9 @@ wxString title;
m_Parent = parent;
m_DoUpdate = TRUE;
Create(parent, id, caption, pos, size, style);
title = _("from ") + g_EDA_Appl->m_CurrentOptionFile;
SetTitle(title);
Create(parent, id, caption, pos, size, style);
}
/*!
......
......@@ -34,6 +34,9 @@
#include "../bitmaps/plot_PS.xpm"
#include "../bitmaps/plot_HPG.xpm"
#include "../bitmaps/Add_Zone.xpm"
#include "../bitmaps/Add_Zone_Cutout.xpm"
#include "../bitmaps/Add_Corner.xpm"
#include "../bitmaps/Add_Circle.xpm"
#include "../bitmaps/Add_Line.xpm"
#include "../bitmaps/Add_Arc.xpm"
......
......@@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE
(wxT("(2007-12-22)"))
(wxT("(2008-01-01)"))
#endif
;
......
......@@ -558,6 +558,9 @@ enum main_id {
ID_POPUP_PCB_FILL_ZONE,
ID_POPUP_PCB_DELETE_ZONE_CONTAINER,
ID_POPUP_PCB_PLACE_ZONE_CORNER,
ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE,
ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE,
ID_POPUP_ZONE_UNUSED1,
ID_POPUP_ZONE_UNUSED2,
ID_POPUP_ZONE_UNUSED3,
ID_POPUP_ZONE_UNUSED4,
......
......@@ -129,16 +129,16 @@ enum Track_Shapes {
S_POLYGON /* polygon shape */
};
/* Forward declaration */
class MODULE;
class EQUIPOT;
class MARKER;
class TRACK;
class D_PAD;
struct CHEVELU;
class Ki_PageDescr;
class DrawBlockStruct;
//class Ki_PageDescr;
//class DrawBlockStruct;
/* main window classes : */
#include "wxPcbStruct.h"
/* Class to handle a board */
#include "class_board.h"
......
/***********************************************************/
/* wxstruct.h: */
/* descriptions des principales classes derivees utilisees */
/***********************************************************/
#ifndef WXPCB_STRUCT_H
#define WXPCB_STRUCT_H
#include <vector>
#ifndef PCB_INTERNAL_UNIT
#define PCB_INTERNAL_UNIT 10000
#endif
// Option for dialog boxes
// #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;
#define WinEDA_MenuBar wxMenuBar
#define WinEDA_Menu wxMenu
#define WinEDA_MenuItem wxMenuItem
// Used but not defined here:
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 COTATION;
class EDGE_MODULE;
class WinEDA3D_DrawFrame;
class DRC;
class ZONE_CONTAINER;
/******************************************************************/
/* class WinEDA_BasePcbFrame: Basic class for pcbnew and gerbview */
/******************************************************************/
class WinEDA_BasePcbFrame : public WinEDA_DrawFrame
{
public:
BOARD* m_Pcb;
bool m_DisplayPadFill; // How show pads
bool m_DisplayPadNum; // show pads numbers
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 */
WinEDA3D_DrawFrame* m_Draw3DFrame;
protected:
GENERAL_COLLECTOR* m_Collector;
public:
WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_BasePcbFrame();
// General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void Process_Special_Functions( wxCommandEvent& event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void ReCreateHToolbar() = 0;
virtual void ReCreateVToolbar() = 0;
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;
virtual void ReCreateMenuBar();
PCB_SCREEN* GetScreen() { return (PCB_SCREEN*) m_CurrentScreen; }
int BestZoom();
void Show3D_Frame( wxCommandEvent& event );
virtual void GeneralControle( wxDC* DC, wxPoint Mouse );
// Undo and redo functions
public:
virtual void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int flag_type_command = 0 );
private:
virtual void GetComponentFromUndoList();
virtual void GetComponentFromRedoList();
public:
// Read/write fonctions:
EDA_BaseStruct* ReadDrawSegmentDescr( FILE* File, int* LineNum );
int ReadListeSegmentDescr( FILE* File,
TRACK* PtSegm, int StructType,
int* LineNum, int NumSegm );
int ReadSetup( FILE* File, int* LineNum );
int ReadGeneralDescrPcb( FILE* File, int* LineNum );
// 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.
*
* @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
* 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();
/**
* Function GetCollectorsGuide
* @return GENERAL_COLLECTORS_GUIDE - that considers the global configuration options.
*/
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
/**
* 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 );
// 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 );
MODULE* GetModuleByName();
// Modules (footprints)
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
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
MODULE* Get_Librairie_Module( wxWindow* winaff, const wxString& library,
const wxString& ModuleName, bool show_msg_err );
wxString Select_1_Module_From_List(
WinEDA_DrawFrame* active_window, const wxString& Library,
const wxString& Mask, const wxString& KeyWord );
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
// ratsnest functions
void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */
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 */
void build_liste_pads();
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 );
/**
* 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
*/
void DelLimitesZone( wxDC* DC, bool Redraw );
// layerhandling:
// (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 );
void SelectLayerPair();
virtual void SwitchLayer( wxDC* DC, int layer );
// divers
void AddHistory( int value, KICAD_T type ); // Add value in data list history
void InstallGridFrame( const wxPoint& pos );
DECLARE_EVENT_TABLE()
};
/*****************************************************/
/* class WinEDA_PcbFrame: public WinEDA_BasePcbFrame */
/*****************************************************/
class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
{
public:
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelTrackWidthBox;
WinEDAChoiceBox* m_SelViaSizeBox;
private:
bool m_SelTrackWidthBox_Changed;
bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu;
DRC* m_drc; ///< the DRC controller, see drc.cpp
// we'll use lower case function names for private member functions.
void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu );
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:
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_PcbFrame();
// 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 );
void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateAuxiliaryToolbar();
void ReCreateVToolbar();
void ReCreateAuxVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent );
void PrepareLayerIndicator();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
/**
* 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 );
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 );
void SetToolbars();
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 );
bool RecreateCmpFileFromBoard();
void ExportToGenCAD( wxCommandEvent& event );
/* Fonctions specifiques */
MODULE* ListAndSelectModuleName();
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
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
void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
// Footprint edition (see also WinEDA_BasePcbFrame)
void StartMove_Module( MODULE* module, wxDC* DC );
bool Delete_Module( MODULE* module, wxDC* DC );
// loading modules: see WinEDA_BasePcbFrame
// Board handling
void Erase_Zones( bool query );
void Erase_Segments_Pcb( bool is_edges, bool query );
void Erase_Pistes( wxDC* DC, int masque_type, bool query );
void Erase_Modules( bool query );
void Erase_Textes_Pcb( bool query );
void Erase_Marqueurs();
void UnDeleteItem( wxDC* DC );
void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via );
// Hightlight functions:
int Select_High_Light( wxDC* DC );
void Hight_Light( wxDC* DC );
void DrawHightLight( wxDC* DC, int NetCode );
// Track and via edition:
void DisplayTrackSettings();
/**
* 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 );
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 Supprime_Une_Piste( wxDC* DC, TRACK* pt_segm );
bool Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via );
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 );
int Add_45_degrees_Segment( wxDC* DC, TRACK* pt_segm );
bool Genere_Pad_Connexion( wxDC* DC, int layer );
// zone handling
/** Function Delete_Zone
* Remove the zone which include the segment aZone, or the zone which have the given time stamp.
* A zone is a group of segments which have the same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL
*/
void Delete_Zone( wxDC* DC, SEGZONE* Track, long aTimestamp = 0 );
EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone );
/**
* Function Begin_Zone
* initiates a zone edge creation process,
* or terminates the current zone edge and creates a new zone edge stub
*/
EDGE_ZONE* Begin_Zone( wxDC* DC );
/**
* Function End_Zone
* terminates the zone edge creation process
* @param DC = current Device Context
*/
void End_Zone( wxDC* DC );
/** Function Fill_Zone()
* Calculate the zone filling for the outline zone_container
* The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks.
* If exists the old filling is removed
* @param DC = current Device Context
* @param zone_container = zone to fill
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_Zone( wxDC* DC, ZONE_CONTAINER * zone_container, bool verbose = TRUE );
/** Function Fill_All_Zones()
* Fill all zones on the board
* The old fillings are removed
* @param frame = reference to the main frame
* @param DC = current Device Context
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_All_Zones( wxDC* DC, bool verbose = TRUE );
/**
* Function Edit_Zone_Params
* Edit params (layer, clearance, ...) for a zone outline
*/
void Edit_Zone_Params( wxDC* DC , ZONE_CONTAINER * zone_container );
/**
* Function Start_Move_Zone_Corner
* Prepares a move corner in a zone outline,
* called from a move corner command (IsNewCorner = false),
* or a create new cornet command (IsNewCorner = true )
*/
void Start_Move_Zone_Corner( wxDC* DC , ZONE_CONTAINER * zone_container, int corner_id, bool IsNewCorner );
/**
* Function End_Move_Zone_Corner
* Terminates a move corner in a zone outline
*/
void End_Move_Zone_Corner( wxDC* DC , ZONE_CONTAINER * zone_container );
// Target handling
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:
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:
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:
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 );
bool SetBoardBoundaryBoxFromEdgesOnly();
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 );
int GenPlaceBoard();
void DrawInfoPlace( wxDC* DC );
// Autorouting:
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 );
void Ratsnest_On_Off( wxDC* DC );
void Clean_Pcb( wxDC* DC );
BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems );
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.
*/
void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
/* Micro waves functions */
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()
};
/****************************************************/
/* class WinEDA_GerberFrame: public WinEDA_PcbFrame */
/****************************************************/
class WinEDA_GerberFrame : public WinEDA_BasePcbFrame
{
public:
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelLayerTool;
private:
wxMenu* m_FilesMenu;
public:
WinEDA_GerberFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_GerberFrame();
void Update_config();
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); // Retourne le meilleur zoom
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
EDA_BaseStruct* GerberGeneralLocateAndDisplay();
EDA_BaseStruct* Locate( int typeloc );
void SetToolbars();
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 */
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 );
void CopyDCodesSizeToItems();
void Liste_D_Codes( wxDC* DC );
/* Fonctions specifiques */
void Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer );
// Copper texts
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 );
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 */
/*********************************************************/
class WinEDA_ModuleEditFrame : public WinEDA_BasePcbFrame
{
public:
MODULE* CurrentModule;
wxString m_CurrentLib;
public:
WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_ModuleEditFrame();
void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateAuxiliaryToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars();
void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* handlers for block commands */
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:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
private:
void GetComponentFromUndoList();
void GetComponentFromRedoList();
public:
// Footprint edition
void Place_Ancre( MODULE* module, wxDC* DC );
void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC );
void Transform( MODULE* module, wxDC* DC, int transform );
// loading Footprint
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
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:
void Delete_Module_In_Library( const wxString& libname );
int Create_Librairie( const wxString& LibName );
void Select_Active_Library();
DECLARE_EVENT_TABLE()
};
#endif /* WXPCB_STRUCT_H */
......@@ -27,10 +27,6 @@
#define EESCHEMA_INTERNAL_UNIT 1000
#endif
#ifndef PCB_INTERNAL_UNIT
#define PCB_INTERNAL_UNIT 10000
#endif
// Option for dialog boxes
// #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
......@@ -82,28 +78,13 @@ 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;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
class DRC;
class ZONE_CONTAINER;
enum id_librarytype {
LIBRARY_TYPE_EESCHEMA,
......@@ -333,746 +314,6 @@ public:
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
/******************************************************************/
/* class WinEDA_BasePcbFrame: Basic class for pcbnew and gerbview */
/******************************************************************/
class WinEDA_BasePcbFrame : public WinEDA_DrawFrame
{
public:
BOARD* m_Pcb;
bool m_DisplayPadFill; // How show pads
bool m_DisplayPadNum; // show pads numbers
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 */
WinEDA3D_DrawFrame* m_Draw3DFrame;
protected:
GENERAL_COLLECTOR* m_Collector;
public:
WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_BasePcbFrame();
// General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void Process_Special_Functions( wxCommandEvent& event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void ReCreateHToolbar() = 0;
virtual void ReCreateVToolbar() = 0;
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;
virtual void ReCreateMenuBar();
PCB_SCREEN* GetScreen() { return (PCB_SCREEN*) m_CurrentScreen; }
int BestZoom();
void Show3D_Frame( wxCommandEvent& event );
virtual void GeneralControle( wxDC* DC, wxPoint Mouse );
// Undo and redo functions
public:
virtual void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int flag_type_command = 0 );
private:
virtual void GetComponentFromUndoList();
virtual void GetComponentFromRedoList();
public:
// Read/write fonctions:
EDA_BaseStruct* ReadDrawSegmentDescr( FILE* File, int* LineNum );
int ReadListeSegmentDescr( FILE* File,
TRACK* PtSegm, int StructType,
int* LineNum, int NumSegm );
int ReadSetup( FILE* File, int* LineNum );
int ReadGeneralDescrPcb( FILE* File, int* LineNum );
// 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.
*
* @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
* 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();
/**
* Function GetCollectorsGuide
* @return GENERAL_COLLECTORS_GUIDE - that considers the global configuration options.
*/
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
/**
* 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 );
// 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 );
MODULE* GetModuleByName();
// Modules (footprints)
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
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
MODULE* Get_Librairie_Module( wxWindow* winaff, const wxString& library,
const wxString& ModuleName, bool show_msg_err );
wxString Select_1_Module_From_List(
WinEDA_DrawFrame* active_window, const wxString& Library,
const wxString& Mask, const wxString& KeyWord );
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
// ratsnest functions
void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */
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 */
void build_liste_pads();
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 );
/**
* 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
*/
void DelLimitesZone( wxDC* DC, bool Redraw );
// layerhandling:
// (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 );
void SelectLayerPair();
virtual void SwitchLayer( wxDC* DC, int layer );
// divers
void AddHistory( int value, KICAD_T type ); // Add value in data list history
void InstallGridFrame( const wxPoint& pos );
DECLARE_EVENT_TABLE()
};
/*****************************************************/
/* class WinEDA_PcbFrame: public WinEDA_BasePcbFrame */
/*****************************************************/
class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
{
public:
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelTrackWidthBox;
WinEDAChoiceBox* m_SelViaSizeBox;
private:
bool m_SelTrackWidthBox_Changed;
bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu;
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:
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_PcbFrame();
// 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 );
void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateAuxiliaryToolbar();
void ReCreateVToolbar();
void ReCreateAuxVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent );
void PrepareLayerIndicator();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
/**
* 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 );
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 );
void SetToolbars();
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 );
bool RecreateCmpFileFromBoard();
void ExportToGenCAD( wxCommandEvent& event );
/* Fonctions specifiques */
MODULE* ListAndSelectModuleName();
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
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
void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
// Footprint edition (see also WinEDA_BasePcbFrame)
void StartMove_Module( MODULE* module, wxDC* DC );
bool Delete_Module( MODULE* module, wxDC* DC );
// loading modules: see WinEDA_BasePcbFrame
// Board handling
void Erase_Zones( bool query );
void Erase_Segments_Pcb( bool is_edges, bool query );
void Erase_Pistes( wxDC* DC, int masque_type, bool query );
void Erase_Modules( bool query );
void Erase_Textes_Pcb( bool query );
void Erase_Marqueurs();
void UnDeleteItem( wxDC* DC );
void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via );
// Hightlight functions:
int Select_High_Light( wxDC* DC );
void Hight_Light( wxDC* DC );
void DrawHightLight( wxDC* DC, int NetCode );
// Track and via edition:
void DisplayTrackSettings();
/**
* 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 );
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 Supprime_Une_Piste( wxDC* DC, TRACK* pt_segm );
bool Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via );
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 );
int Add_45_degrees_Segment( wxDC* DC, TRACK* pt_segm );
bool Genere_Pad_Connexion( wxDC* DC, int layer );
// zone handling
/** Function Delete_Zone
* Remove the zone which include the segment aZone, or the zone which have the given time stamp.
* A zone is a group of segments which have the same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL
*/
void Delete_Zone( wxDC* DC, SEGZONE* Track, long aTimestamp = 0 );
EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone );
/**
* Function Begin_Zone
* initiates a zone edge creation process,
* or terminates the current zone edge and creates a new zone edge stub
*/
EDGE_ZONE* Begin_Zone( wxDC* DC );
/**
* Function End_Zone
* terminates the zone edge creation process
* @param DC = current Device Context
*/
void End_Zone( wxDC* DC );
/** Function Fill_Zone()
* Calculate the zone filling for the outline zone_container
* The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks.
* If exists the old filling is removed
* @param DC = current Device Context
* @param zone_container = zone to fill
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_Zone( wxDC* DC, ZONE_CONTAINER * zone_container, bool verbose = TRUE );
/** Function Fill_All_Zones()
* Fill all zones on the board
* The old fillings are removed
* @param frame = reference to the main frame
* @param DC = current Device Context
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_All_Zones( wxDC* DC, bool verbose = TRUE );
/**
* Function Edit_Zone_Params
* Edit params (layer, clearance, ...) for a zone outline
*/
void Edit_Zone_Params( wxDC* DC , ZONE_CONTAINER * zone_container );
/**
* Function Start_Move_Zone_Corner
* Prepares a move corner in a zone outline,
* called from a move corner command (IsNewCorner = false),
* or a create new cornet command (IsNewCorner = true )
*/
void Start_Move_Zone_Corner( wxDC* DC , ZONE_CONTAINER * zone_container, int corner_id, bool IsNewCorner );
/**
* Function End_Move_Zone_Corner
* Terminates a move corner in a zone outline
*/
void End_Move_Zone_Corner( wxDC* DC , ZONE_CONTAINER * zone_container );
// Target handling
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:
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:
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:
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 );
bool SetBoardBoundaryBoxFromEdgesOnly();
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 );
int GenPlaceBoard();
void DrawInfoPlace( wxDC* DC );
// Autorouting:
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 );
void Ratsnest_On_Off( wxDC* DC );
void Clean_Pcb( wxDC* DC );
BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems );
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.
*/
void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
/* Micro waves functions */
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()
};
/****************************************************/
/* class WinEDA_GerberFrame: public WinEDA_PcbFrame */
/****************************************************/
class WinEDA_GerberFrame : public WinEDA_BasePcbFrame
{
public:
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelLayerTool;
private:
wxMenu* m_FilesMenu;
public:
WinEDA_GerberFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_GerberFrame();
void Update_config();
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); // Retourne le meilleur zoom
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
EDA_BaseStruct* GerberGeneralLocateAndDisplay();
EDA_BaseStruct* Locate( int typeloc );
void SetToolbars();
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 */
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 );
void CopyDCodesSizeToItems();
void Liste_D_Codes( wxDC* DC );
/* Fonctions specifiques */
void Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer );
// Copper texts
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 );
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 */
/*********************************************************/
class WinEDA_ModuleEditFrame : public WinEDA_BasePcbFrame
{
public:
MODULE* CurrentModule;
wxString m_CurrentLib;
public:
WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_ModuleEditFrame();
void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateAuxiliaryToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars();
void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* handlers for block commands */
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:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
private:
void GetComponentFromUndoList();
void GetComponentFromRedoList();
public:
// Footprint edition
void Place_Ancre( MODULE* module, wxDC* DC );
void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC );
void Transform( MODULE* module, wxDC* DC, int transform );
// loading Footprint
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
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:
void Delete_Module_In_Library( const wxString& libname );
int Create_Librairie( const wxString& LibName );
void Select_Active_Library();
DECLARE_EVENT_TABLE()
};
/*******************************/
/* class WinEDA_SchematicFrame */
......
......@@ -14,7 +14,6 @@
#include "bitmaps.h"
#include "add_cotation.xpm"
#include "Add_Mires.xpm"
#include "Add_Zone.xpm"
/********************************************************/
......
......@@ -449,6 +449,14 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
Edit_Zone_Params( &dc, (ZONE_CONTAINER*) GetCurItem() );
break;
case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE:
wxMessageBox(wxT("ToDo"));
break;
case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE:
wxMessageBox(wxT("ToDo"));
break;
case ID_POPUP_PCB_DELETE_ZONE_CONTAINER:
{
DrawPanel->MouseToCursorSchema();
......
......@@ -27,7 +27,6 @@
#include "Delete_Track.xpm"
#include "Move_Module.xpm"
//#include "Move_Track_Segment.xpm"
#include "Drag_Track_Segment.xpm"
#include "Drag_Segment_WithSlope.xpm"
#include "Drag_Module.xpm"
......@@ -127,7 +126,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
// If a command or a block is in progress:
// Put the Cancel command (if needed) and the End command
// Put the Cancel command (if needed) and the End command
if( BlockActive )
{
......@@ -162,39 +161,39 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
}
}
/* Select a proper item */
wxPoint cursorPos = GetScreen()->m_Curseur;
wxPoint selectPos = m_Collector->GetRefPos();
PutOnGrid( &selectPos );
PutOnGrid( &selectPos );
// printf( "cursor=(%d, %d) select=(%d,%d)\n", cursorPos.x, cursorPos.y, selectPos.x, selectPos.y );
/* We can reselect another item only if there are no item being edited
because ALL moving functions use GetCurItem(), therefore GetCurItem()
must return the same item during moving. We know an item is moving
if( item && (item->m_Flags != 0)) is true and after calling
PcbGeneralLocateAndDisplay(), GetCurItem() is any arbitrary BOARD_ITEM,
not the current item being edited. In such case we cannot call
PcbGeneralLocateAndDisplay().
*/
if( !item || (item->m_Flags == 0) )
{
// show "item selector" menu only if no item now or selected item was not
/* We can reselect another item only if there are no item being edited
* because ALL moving functions use GetCurItem(), therefore GetCurItem()
* must return the same item during moving. We know an item is moving
* if( item && (item->m_Flags != 0)) is true and after calling
* PcbGeneralLocateAndDisplay(), GetCurItem() is any arbitrary BOARD_ITEM,
* not the current item being edited. In such case we cannot call
* PcbGeneralLocateAndDisplay().
*/
if( !item || (item->m_Flags == 0) )
{
// show "item selector" menu only if no item now or selected item was not
// previously picked at this position
if( !item || cursorPos != selectPos )
{
DrawPanel->m_AbortRequest = false;
item = PcbGeneralLocateAndDisplay();
if( DrawPanel->m_AbortRequest )
{
DrawPanel->CursorOn( &dc );
return false;
}
}
}
if( !item || cursorPos != selectPos )
{
DrawPanel->m_AbortRequest = false;
item = PcbGeneralLocateAndDisplay();
if( DrawPanel->m_AbortRequest )
{
DrawPanel->CursorOn( &dc );
return false;
}
}
}
item = GetCurItem();
if( item )
......@@ -265,7 +264,12 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
aPopMenu->Append( ID_POPUP_PCB_DELETE_DRAWING, _( "Delete Drawing" ) );
break;
case TYPEEDGEZONE:
case TYPEZONE: // Item used to fill a zone
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE,
_( "Delete Zone" ), delete_xpm );
break;
case TYPEEDGEZONE: // Graphic Item used to create a new zone outline
if( flags & IS_NEW )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE,
......@@ -275,42 +279,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
_( "Delete edge zone" ), delete_xpm );
break;
case TYPEZONE_CONTAINER:
{
ZONE_CONTAINER * edge_zone = (ZONE_CONTAINER *) item;
if ( edge_zone->m_Flags )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_CORNER,
_( "Place Corner" ), apply_xpm );
}
else
{
edge_zone->m_CornerSelection = -1;
int index;
if ( (index = edge_zone->HitTestForCorner( GetScreen()->m_Curseur )) >= 0 )
{
edge_zone->m_CornerSelection = index;
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_ZONE_CORNER,
_( "Move Corner" ), move_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_CORNER,
_( "Delete Corner" ), delete_xpm );
}
else if ( (index = edge_zone->HitTestForEdge( GetScreen()->m_Curseur )) >= 0 )
{
edge_zone->m_CornerSelection = index;
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_ADD_ZONE_CORNER,
_( "Create Corner" ), move_xpm );
}
aPopMenu->AppendSeparator();
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ZONE,
_( "Fill zone" ), fill_zone_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_ZONE_PARAMS,
_( "Edit Zone Params" ), edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_CONTAINER,
_( "Delete Zone Outline" ), delete_xpm );
}
}
case TYPEZONE_CONTAINER: // Item used to handle a zone area (outlines, holes ...)
createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu );
break;
case TYPETEXTE:
......@@ -323,11 +293,6 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
createPopupMenuForTracks( (TRACK*) item, aPopMenu );
break;
case TYPEZONE:
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE,
_( "Delete Zone" ), delete_xpm );
break;
case TYPEMARKER:
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MARKER,
_( "Delete Marker" ), delete_xpm );
......@@ -390,12 +355,12 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
{
case ID_PCB_ZONES_BUTT:
{
if ( m_Pcb->m_ZoneDescriptorList.size() > 0 )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES,
_( "Fill or Refill All Zones" ), fill_zone_xpm );
if( m_Pcb->m_ZoneDescriptorList.size() > 0 )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES,
_( "Fill or Refill All Zones" ), fill_zone_xpm );
aPopMenu->AppendSeparator();
}
}
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER,
_( "Select Working Layer" ), Select_W_Layer_xpm );
......@@ -489,7 +454,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
}
DrawPanel->CursorOn( &dc );
return true;
return true;
}
......@@ -601,8 +566,9 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
ID_POPUP_PCB_EDIT_TRACK_MNU, _( "Change Width" ), width_track_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG,
Track->Type()==TYPEVIA ? _( "Edit Via" ) : _( "Edit Segment" ), width_segment_xpm );
Track->Type()==TYPEVIA ? _( "Edit Via" ) : _(
"Edit Segment" ), width_segment_xpm );
if( !flags )
{
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK,
......@@ -621,10 +587,10 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
track_mnu = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
ID_POPUP_PCB_DELETE_TRACK_MNU, _( "Delete" ), delete_xpm );
msg = AddHotkeyName( Track->Type()==TYPEVIA ? _("Delete Via") : _( "Delete Segment" ),
s_Board_Editor_Hokeys_Descr, HK_BACK_SPACE );
msg = AddHotkeyName( Track->Type()==TYPEVIA ? _( "Delete Via" ) : _( "Delete Segment" ),
s_Board_Editor_Hokeys_Descr, HK_BACK_SPACE );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_DELETE_TRACKSEG,
msg, Delete_Line_xpm );
if( !flags )
......@@ -659,6 +625,56 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
}
/********************************************************************************************/
void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu )
/********************************************************************************************/
/* Create the wxMenuitem list for zone outlines editing and zone filling
*/
{
if( edge_zone->m_Flags )
{
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_CORNER,
_( "Place Corner" ), apply_xpm );
}
else
{
edge_zone->m_CornerSelection = -1;
int index;
if( ( index = edge_zone->HitTestForCorner( GetScreen()->m_Curseur ) ) >= 0 )
{
edge_zone->m_CornerSelection = index;
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_ZONE_CORNER,
_( "Move Corner" ), move_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_CORNER,
_( "Delete Corner" ), delete_xpm );
}
else if( ( index = edge_zone->HitTestForEdge( GetScreen()->m_Curseur ) ) >= 0 )
{
edge_zone->m_CornerSelection = index;
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_ADD_ZONE_CORNER,
_( "Create Corner" ), Add_Corner_xpm );
}
aPopMenu->AppendSeparator();
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE,
_( "Add Similar Zone" ), fill_zone_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE,
_( "Add Cutout Zone" ), add_zone_cutout );
aPopMenu->AppendSeparator();
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ZONE,
_( "Fill Zone" ), fill_zone_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_ZONE_PARAMS,
_( "Edit Zone Params" ), edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_CONTAINER,
_( "Delete Zone Outline" ), delete_xpm );
}
}
/*********************************************************************************/
void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu )
/*********************************************************************************/
......@@ -744,9 +760,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m
}
/***************************************************************/
/************************************************************************/
void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
/***************************************************************/
/************************************************************************/
/* Create pop menu for pads */
{
wxMenu* sub_menu_Pad;
......
......@@ -36,7 +36,6 @@
#include "mw_Add_Gap.xpm"
#include "mw_toolbar.xpm"
#include "Add_Tracks.xpm"
#include "Add_Zone.xpm"
#include "Show_Zone.xpm"
#include "net_hightlight.xpm"
#include "PcbOffset.xpm"
......
......@@ -29,7 +29,7 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
* The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks.
* @param frame = reference to the main frame
* @param DC = current Device Context
* @param DC = current Device Context (can be NULL)
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
......@@ -40,12 +40,10 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
int save_isol = g_DesignSettings.m_TrackClearence;
wxPoint ZoneStartFill;
wxString msg;
PCB_SCREEN* Screen = frame->GetScreen();
BOARD* Pcb = frame->m_Pcb;
g_DesignSettings.m_TrackClearence = g_DesignSettings.m_ZoneClearence;
g_HightLigth_NetCode = m_NetCode;
// Screen->m_Active_Layer = m_Layer;
g_HightLigth_NetCode = m_NetCode;
s_TimeStamp = m_TimeStamp;
......@@ -234,7 +232,7 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
}
}
if( Zone_Debug )
if( Zone_Debug && DC )
DisplayBoard( frame->DrawPanel, DC );
/* Filling the cells of the matrix (this is the zone building)*/
......@@ -250,7 +248,7 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
if( m_PadOption == THERMAL_PAD )
PlaceCells( Pcb, g_HightLigth_NetCode, FORCE_PADS );
if( Zone_Debug )
if( Zone_Debug && DC )
DisplayBoard( frame->DrawPanel, DC );
/* Convert the matrix information (cells) to segments which are actually the zone */
......@@ -291,7 +289,7 @@ static void Genere_Segments_Zone( WinEDA_PcbFrame* frame, wxDC* DC, int net_code
* 1 - From left to right and create horizontal zone segments
* 2 - From top to bottom, and create vertical zone segments
* @param net_code = net_code common to all segment zone created
* @param DC = current device context
* @param DC = current device context ( can be NULL )
* @param frame = current WinEDA_PcbFrame
* global: parameter TimeStamp: time stamp common to all segment zone created
*/
......@@ -341,7 +339,8 @@ static void Genere_Segments_Zone( WinEDA_PcbFrame* frame, wxDC* DC, int net_code
pt_track->m_TimeStamp = s_TimeStamp;
pt_track->Insert( frame->m_Pcb, NULL );
pt_track->Draw( frame->DrawPanel, DC, GR_OR );
if ( DC )
pt_track->Draw( frame->DrawPanel, DC, GR_OR );
nbsegm++;
}
}
......@@ -385,7 +384,8 @@ static void Genere_Segments_Zone( WinEDA_PcbFrame* frame, wxDC* DC, int net_code
pt_track->m_TimeStamp = s_TimeStamp;
pt_track->Insert( frame->m_Pcb, NULL );
pt_track->Draw( frame->DrawPanel, DC, GR_OR );
if( DC )
pt_track->Draw( frame->DrawPanel, DC, GR_OR );
nbsegm++;
}
}
......@@ -654,7 +654,8 @@ bool WinEDA_PcbFrame::Genere_Pad_Connexion( wxDC* DC, int layer )
}
pt_track->Insert( m_Pcb, NULL );
pt_track->Draw( DrawPanel, DC, GR_OR );
if( DC )
pt_track->Draw( DrawPanel, DC, GR_OR );
}
}
......
......@@ -77,7 +77,7 @@ void WinEDA_PcbFrame::Delete_Zone( wxDC* DC, SEGZONE* aZone, long aTimestamp )
*/
{
int nb_segm = 0;
bool modify = FALSE;
bool modify = false;
unsigned long TimeStamp;
if( aZone == NULL )
......@@ -113,7 +113,7 @@ void WinEDA_PcbFrame::Delete_Zone( wxDC* DC, SEGZONE* aZone, long aTimestamp )
EDGE_ZONE* WinEDA_PcbFrame::Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone )
/*****************************************************************************/
/* Used only while creating a new zonz outline
/* Used only while creating a new zone outline
* Remove and delete the current outline segment in progress
*/
{
......@@ -441,7 +441,7 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC )
if( net )
polygon->m_Netname = net->m_Netname;
edge = m_Pcb->m_CurrentLimitZone;
polygon->Start( GetScreen()->m_Active_Layer, 0, NULL,
polygon->Start( GetScreen()->m_Active_Layer, 0, 0,
edge->m_Start.x, edge->m_Start.y,
s_Zone_Hatching );
edge = edge->Next();
......@@ -585,13 +585,13 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v
/* Show the Net */
s_NetcodeSelection = zone_container->GetNet();
if( (g_HightLigth_NetCode > 0) && (g_HightLigth_NetCode != s_NetcodeSelection) )
if( (g_HightLigth_NetCode > 0) && (g_HightLigth_NetCode != s_NetcodeSelection) && DC )
{
Hight_Light( DC ); // Remove old hightlight selection
Hight_Light( DC ); // Remove old hightlight selection
}
g_HightLigth_NetCode = s_NetcodeSelection;
if( !g_HightLigt_Status )
if( !g_HightLigt_Status && DC)
Hight_Light( DC );
if( g_HightLigth_NetCode > 0 )
......@@ -613,7 +613,7 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v
msg = _( "No Net" );
Affiche_1_Parametre( this, 22, _( "NetName" ), msg, RED );
wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor)
zone_container->m_PadOption = s_Zone_Pad_Options;
zone_container->m_ZoneClearance = g_DesignSettings.m_ZoneClearence;
zone_container->m_GridFillValue = g_GridRoutingSize;
......@@ -641,13 +641,22 @@ int WinEDA_PcbFrame::Fill_All_Zones( wxDC* DC, bool verbose )
ZONE_CONTAINER* zone_container;
int error_level = 0;
// Remove all zones :
if ( m_Pcb->m_Zone )
{
m_Pcb->m_Zone->DeleteStructList();
m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0;
}
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ )
{
zone_container = m_Pcb->m_ZoneDescriptorList[ii];
error_level = Fill_Zone( DC, zone_container, verbose );
error_level = Fill_Zone( NULL, zone_container, verbose );
if( error_level && ! verbose )
break;
}
DrawPanel->Refresh(true);
return error_level;
}
......@@ -38,6 +38,7 @@ CPolyLine::CPolyLine()
m_dlist = NULL;
m_HatchStyle = 0;
m_sel_box = 0;
utility = 0;
m_gpc_poly = new gpc_polygon;
m_gpc_poly->num_contours = 0;
m_php_poly = new polygon;
......
......@@ -158,14 +158,15 @@ private:
int m_layer; // layer to draw on
int m_Width; // line width
int m_sel_box; // corner selection box width/2
public:
int utility;
protected:
std::vector <CPolyPt> corner; // array of points for corners
std::vector <int> side_style; // array of styles for sides
private:
std::vector <dl_element*> dl_side; // graphic elements
std::vector <dl_element*> dl_side_sel;
std::vector <dl_element*> dl_corner_sel;
public:
protected:
int m_HatchStyle; // hatch style, see enum above
std::vector <CSegment> m_HatchLines; // hatch lines
private:
......
......@@ -16,23 +16,23 @@ extern wxString g_Main_Title;
// Local
#ifdef GERBVIEW
static wxString MsgInfos(wxT("** GERBVIEW (jul 2001 .. 2007) **"));
static wxString MsgInfos(wxT("** GERBVIEW (jul 2001 .. 2008) **"));
#else
#ifdef PCBNEW
static wxString MsgInfos(wxT("** PCBNEW (sept 1992 .. 2007) **"));
static wxString MsgInfos(wxT("** PCBNEW (sept 1992 .. 2008) **"));
#endif
#endif
#ifdef CVPCB
static wxString MsgInfos(wxT("** CVPCB (sept 1992 .. 2007) **"));
static wxString MsgInfos(wxT("** CVPCB (sept 1992 .. 2008) **"));
#endif
#ifdef KICAD
static wxString MsgInfos(wxT("** KICAD (jul 2000 .. 2007) **"));
static wxString MsgInfos(wxT("** KICAD (jul 2000 .. 2008) **"));
#endif
#ifdef EESCHEMA
static wxString MsgInfos(wxT("** EESCHEMA (sept 1994 .. 2007) **"));
static wxString MsgInfos(wxT("** EESCHEMA (sept 1994 .. 2008) **"));
#endif
// Routines Locales
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment