Commit 803ebdf3 authored by stambaughw's avatar stambaughw

Fix escape key handling in annotate dialog and some eeschema code refactoring.

parent 1dbf5e21
......@@ -40,14 +40,17 @@ OPTION(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON)
# Comment this out if you don't want to build with Python support.
# OPTION(KICAD_PYTHON "enable/disable building with Python support (default OFF)")
# Set default flags for Release build.
SET(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
# Set debugging flags for GCC only.
IF( CMAKE_COMPILER_IS_GCC )
# Set default flags for Release build.
SET(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
# Set default flags for Debug build.
SET(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
# Set default flags for Debug build.
SET(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
ENDIF( CMAKE_COMPILER_IS_GCC )
# Locations for install targets.
IF(UNIX)
......
......@@ -5,6 +5,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Feb-27 UPDATE Wayne Stambaugh <stambaughw{at}verizon{dot}net>
================================================================================
+ eeschema
* fixed escape key handling and add accelerate keys in annotate dialog.
* factored out eeschema frame class to prevent rebuild of entire project
when making changes to eeschema frames.
* refactor main eeschema event loop by factoring out most of the non-drawing
events.
+ cmake
* small fix to root CMakeList file to prevent GCC flags being used with
other compilers.
2008-Feb-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema
......
......@@ -13,6 +13,8 @@
#include "protos.h"
#include "schframe.h"
/***********************************************************/
void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame )
......
......@@ -9,8 +9,11 @@
#include "netlist.h"
#include "protos.h"
#include "schframe.h"
/* Local Functions*/
static int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet );
static int ListeComposants( CmpListStruct* BaseListeCmp,
DrawSheetList* sheet );
static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp );
static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp );
static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp );
......
......@@ -28,6 +28,8 @@
#include "wx/wx.h"
#endif
#include "../include/wxstruct.h"
#include "schframe.h"
#include "annotate_dialog.h"
extern void DeleteAnnotation( WinEDA_SchematicFrame* parent,
......@@ -51,6 +53,7 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_AnnotateFrame, wxDialog )
BEGIN_EVENT_TABLE( WinEDA_AnnotateFrame, wxDialog )
EVT_BUTTON( wxID_CLEAR, WinEDA_AnnotateFrame::OnClear )
EVT_BUTTON( wxID_APPLY, WinEDA_AnnotateFrame::OnApply )
EVT_BUTTON( wxID_CANCEL, WinEDA_AnnotateFrame::OnCancel )
END_EVENT_TABLE()
/*!
......@@ -156,20 +159,27 @@ void WinEDA_AnnotateFrame::CreateControls()
wxBoxSizer* sizerAnnotateItems = new wxBoxSizer( wxVERTICAL );
m_rbEntireSchematic =
new wxRadioButton( this, ID_ENTIRE_SCHEMATIC,
_( "Annotate the entire schematic" ),
_( "Annotate the &entire schematic" ),
wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
wxRadioButton* rbCurrentPage =
new wxRadioButton( this, ID_CURRENT_PAGE,
_( "Annotate the current page only" ) );
_( "Annotate the current &page only" ) );
m_rbEntireSchematic->SetValue( true );
m_cbResetAnnotation = new wxCheckBox( this, ID_RESET_ANNOTATION,
_( "Reset existing annotation" ) );
_( "&Reset existing annotation" ) );
sizerAnnotateItems->Add( m_rbEntireSchematic, flagsRadioButtonSpacing );
sizerAnnotateItems->Add( rbCurrentPage, flagsRadioButtonSpacing );
sizerAnnotateItems->Add( m_cbResetAnnotation, flagsRadioButtonSpacing );
sizerAnnotate->Add( sizerAnnotateItems, flagsRadioButtonSizerSpacing );
sizerTop->Add( sizerAnnotate, flagsGroupSizerSpacing );
/* This is an ugly hack to make sure the focus is set correctly so the
* escape key closes the dialog without requiring one of the controls
* to be activated by the user first. This problem only occurs on the
* GTK version of wxWidgets */
#ifdef __WXGTK__
m_rbEntireSchematic->SetFocus( );
#endif
/* Annotation sort order sizers, label, and radio buttons. */
wxBoxSizer* sizerSort = new wxBoxSizer( wxVERTICAL );
......@@ -180,13 +190,13 @@ void WinEDA_AnnotateFrame::CreateControls()
wxBoxSizer* sizerSortItems = new wxBoxSizer( wxVERTICAL );
m_rbSortByPosition = new wxRadioButton( this,
ID_SORT_BY_POSITION,
_( "Sort components by position" ),
_( "Sort components by p&osition" ),
wxDefaultPosition,
wxDefaultSize,
wxRB_GROUP );
wxRadioButton* rbSortByValue =
new wxRadioButton( this, ID_SORT_BY_VALUE,
_( "Sort components by value" ) );
_( "Sort components by &value" ) );
sizerSortItems->Add( m_rbSortByPosition, flagsRadioButtonSpacing );
sizerSortItems->Add( rbSortByValue, flagsRadioButtonSpacing );
sizerSort->Add( sizerSortItems, flagsRadioButtonSizerSpacing );
......@@ -194,7 +204,7 @@ void WinEDA_AnnotateFrame::CreateControls()
/* Standard dialog buttons and sizer. */
wxBoxSizer* sizerDialogButtons = new wxBoxSizer( wxHORIZONTAL );
wxButton* btnClose = new wxButton( this, wxID_CANCEL, _( "Close" ) );
wxButton* btnClose = new wxButton( this, wxID_CANCEL );
/* TODO: Check if there is any existing annotation and enable/disable
* the clear button accordingly. Probably should also enable/
* disable new components radio button if all of the components
......@@ -269,7 +279,6 @@ void WinEDA_AnnotateFrame::OnClear( wxCommandEvent& event )
void WinEDA_AnnotateFrame::OnApply( wxCommandEvent& event )
{
int response;
wxButton* btn;
wxString message;
if( GetResetItems() )
......@@ -292,6 +301,17 @@ void WinEDA_AnnotateFrame::OnApply( wxCommandEvent& event )
m_btnClear->Enable();
}
void WinEDA_AnnotateFrame::OnCancel( wxCommandEvent& event )
{
if( IsModal() )
EndModal( wxID_CANCEL );
else
{
SetReturnCode( wxID_CANCEL );
this->Show( false );
}
}
bool WinEDA_AnnotateFrame::GetLevel( void )
{
wxASSERT_MSG( ((m_rbEntireSchematic != NULL) &&
......
......@@ -99,8 +99,11 @@ public:
WinEDA_SchematicFrame* m_Parent;
private:
void CloseDialog( void );
void OnClear( wxCommandEvent& event );
void OnApply( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event );
wxRadioButton* m_rbEntireSchematic;
wxRadioButton* m_rbSortByPosition;
......
......@@ -13,6 +13,8 @@
#include "protos.h"
#include "schframe.h"
/* Variables Locales */
/* Fonctions exportees */
......
......@@ -12,6 +12,8 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
......
......@@ -13,6 +13,7 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
......
......@@ -31,6 +31,7 @@
#include "general.h"
#include "protos.h"
#include "schframe.h"
/***********************************************************/
......
......@@ -8,6 +8,8 @@
#include "general.h"
#include "protos.h"
#include "schframe.h"
/******************************************************************/
void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
......
......@@ -14,6 +14,7 @@
#include "id.h"
#include "protos.h"
#include "schframe.h"
/************************/
......
......@@ -12,6 +12,7 @@
#include "netlist.h"
#include "macros.h"
#include "protos.h"
#include "schframe.h"
/* Routines locales */
......
......@@ -15,9 +15,12 @@
#include "protos.h"
#include "macros.h"
#include "schframe.h"
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY( ArrayOfSheetLists );
/***************************/
/* class DrawPartStruct */
/* class EDA_SchComponentStruct */
......
......@@ -17,6 +17,8 @@
#include "protos.h"
#include "schframe.h"
/**************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::
SchematicGeneralLocateAndDisplay( bool IncludePin )
......
......@@ -15,6 +15,8 @@
#include "protos.h"
#include "schframe.h"
/***************************************************************/
void RemoteCommand( const char* cmdline )
......
......@@ -12,6 +12,9 @@
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "protos.h"
#include "schframe.h"
enum End_Type {
UNKNOWN = 0,
WIRE_START_END,
......
......@@ -13,6 +13,8 @@
#include "protos.h"
#include "schframe.h"
/********************************************************************************/
static int CountConnectedItems(WinEDA_SchematicFrame * frame,
......
......@@ -11,6 +11,7 @@
#include "general.h"
#include "protos.h"
#include "schframe.h"
/**************************************************************************/
......
......@@ -127,14 +127,6 @@ BEGIN_EVENT_TABLE( WinEDA_Build_BOM_Frame, wxDialog )
END_EVENT_TABLE()
/***************************************************************/
void InstallToolsFrame(WinEDA_DrawFrame *parent, wxPoint & pos)
/***************************************************************/
{
WinEDA_Build_BOM_Frame * frame = new WinEDA_Build_BOM_Frame(parent);
frame->ShowModal();
frame->Destroy();
}
/*!
* WinEDA_Build_BOM_Frame constructors
......
......@@ -40,6 +40,8 @@
#include "id.h"
#include "schframe.h"
#include "dialog_eeschema_config.h"
////@begin XPM images
......
......@@ -37,6 +37,7 @@
#include "netlist.h"
#include "protos.h"
#include "schframe.h"
#include "dialog_erc.h"
......
......@@ -14,6 +14,8 @@
#include "protos.h"
#include "schframe.h"
/* Fonctions exportees */
......
......@@ -13,6 +13,8 @@
#include "protos.h"
#include "schframe.h"
/* Fonctions locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC );
......
......@@ -15,6 +15,8 @@
#include "id.h"
#include "schframe.h"
/* Variables locales */
......
......@@ -12,6 +12,10 @@
#include "protos.h"
#include "schframe.h"
#include "schframe.h"
/* Routines Locales */
static void Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
......
......@@ -13,6 +13,8 @@
#include "protos.h"
#include "schframe.h"
char marq_bitmap[]=
{
......
......@@ -23,6 +23,8 @@
#include "protos.h"
#include "bitmaps.h"
#include "eda_dde.h"
#include "schframe.h"
// Global variables
wxString g_Main_Title( wxT( "EESchema" ) );
......
......@@ -12,6 +12,7 @@
#include "protos.h"
#include "schframe.h"
#include "../bitmaps/ercgreen.xpm"
#include "../bitmaps/ercwarn.xpm"
......@@ -145,18 +146,6 @@ static int MinimalReq[PIN_NMAX][PIN_NMAX] =
};
/*************************************************************/
void InstallErcFrame( WinEDA_SchematicFrame* parent, wxPoint& pos )
/*************************************************************/
/* Install function for the ERC dialog frame
*/
{
WinEDA_ErcFrame* frame = new WinEDA_ErcFrame( parent );
frame->ShowModal(); frame->Destroy();
}
/*********************************************/
void WinEDA_ErcFrame::ReBuildMatrixPanel()
......
......@@ -13,6 +13,8 @@
#include "protos.h"
#include "id.h"
#include "schframe.h"
/* Fonctions locales */
......
......@@ -15,6 +15,8 @@
#include "libcmp.h"
#include "general.h"
#include "schframe.h"
/* Variables Locales */
static int s_ItemsCount, s_MarkerCount;
static wxString s_OldStringFound;
......@@ -25,17 +27,6 @@ static wxString s_OldStringFound;
#include "protos.h"
/**************************************************************/
void InstallFindFrame( WinEDA_SchematicFrame* parent, wxPoint& pos )
/**************************************************************/
{
parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_FindFrame* frame = new WinEDA_FindFrame( parent );
frame->ShowModal(); frame->Destroy();
parent->DrawPanel->m_IgnoreMouseEvents = FALSE;
}
/**************************************************************/
void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
/**************************************************************/
......
......@@ -13,6 +13,8 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
......
......@@ -12,6 +12,8 @@
#include "protos.h"
#include "schframe.h"
#include "wx/image.h"
#include "wx/imaglist.h"
#include "wx/treectrl.h"
......
......@@ -17,6 +17,8 @@
#include "protos.h"
#include "schframe.h"
/* How to add a new hotkey:
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION (see hotkeys.h).
* add a new Ki_HotkeyInfo entry like:
......
......@@ -14,6 +14,8 @@
#include "id.h"
#include "schframe.h"
/* Format des fichiers:
* - entete:
* EESchema Schematic File Version n
......
......@@ -18,6 +18,8 @@
#include "id.h"
#include "hotkeys.h"
#include "schframe.h"
/************************************************/
void WinEDA_SchematicFrame::ReCreateMenuBar()
......
......@@ -13,6 +13,7 @@
#include "protos.h"
#include "schframe.h"
/* Routines locales */
static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame, const wxString& FullFileName );
......
......@@ -12,6 +12,8 @@
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "protos.h"
#include "schframe.h"
//#define NETLIST_DEBUG
/* Routines locales */
......
......@@ -22,41 +22,15 @@
#include "netlist.h"
#include "protos.h"
#include "schframe.h"
#include "netlist_control.h"
// ID for configuration:
#define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" )
#define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" )
/* Loacl variable */
/* Event id for notebook page buttons: */
enum id_netlist {
ID_CREATE_NETLIST = 1550,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_RUN_SIMULATOR,
ID_SETUP_PLUGIN,
ID_VALIDATE_PLUGIN,
ID_DELETE_PLUGIN,
ID_NETLIST_NOTEBOOK
};
/* panel (notebook page) identifiers */
enum panel_netlist_index {
PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */
PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */
PANELCADSTAR, /* Handle Netlist format CadStar */
PANELSPICE, /* Handle Netlist format Pspice */
PANELCUSTOMBASE /* First auxiliary panel (custom netlists).
* others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
};
/* Values returned when the netlist dialog is demiss */
enum gen_netlist_diag {
NET_OK,
NET_ABORT,
NET_PLUGIN_CHANGE
};
/****************************************************/
wxString ReturnUserNetlistTypeName( bool first_item )
/****************************************************/
......@@ -87,63 +61,6 @@ wxString ReturnUserNetlistTypeName( bool first_item )
}
/************************/
/* Class declarations : */
/************************/
/* wxPanels for creating the NoteBook pages for each netlist format:
*/
class EDA_NoteBookPage : public wxPanel
{
public:
int m_IdNetType;
wxCheckBox* m_IsCurrentFormat;
WinEDA_EnterText* m_CommandStringCtrl;
WinEDA_EnterText* m_TitleStringCtrl;
wxButton* m_ButtonCancel;
wxBoxSizer* m_LeftBoxSizer;
wxBoxSizer* m_RightBoxSizer;
wxBoxSizer* m_RightOptionsBoxSizer;
wxBoxSizer* m_LowBoxSizer;
EDA_NoteBookPage( wxNotebook* parent, const wxString& title,
int id_NetType, int idCheckBox, int idCreateFile );
~EDA_NoteBookPage() { };
};
/* Dialog frame for creating netlists */
class WinEDA_NetlistFrame : public wxDialog
{
public:
WinEDA_SchematicFrame* m_Parent;
wxNotebook* m_NoteBook;
EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
wxRadioBox* m_UseNetNamesInNetlist;
public:
// Constructor and destructor
WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent, wxPoint& pos );
~WinEDA_NetlistFrame() { };
private:
void InstallCustomPages();
void InstallPageSpice();
void GenNetlist( wxCommandEvent& event );
void RunSimulator( wxCommandEvent& event );
void NetlistUpdateOpt();
void OnCancelClick( wxCommandEvent& event );
void SelectNetlistType( wxCommandEvent& event );
void SetupPluginData( wxCommandEvent& event );
void DeletePluginPanel( wxCommandEvent& event );
void ValidatePluginPanel( wxCommandEvent& event );
void WriteCurrentNetlistSetup( void );
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE( WinEDA_NetlistFrame, wxDialog )
EVT_BUTTON( wxID_CANCEL, WinEDA_NetlistFrame::OnCancelClick )
......@@ -156,29 +73,6 @@ EVT_BUTTON( ID_RUN_SIMULATOR, WinEDA_NetlistFrame::RunSimulator )
END_EVENT_TABLE()
/*********************************************************************/
void InstallNetlistFrame( WinEDA_SchematicFrame* parent, wxPoint& pos )
/*********************************************************************/
/* Installator for the netlist generation dialog box
*/
{
int ii;
if ( g_NetFormat < NET_TYPE_PCBNEW )
g_NetFormat = NET_TYPE_PCBNEW;
do
{
WinEDA_NetlistFrame* frame = new WinEDA_NetlistFrame( parent, pos );
ii = frame->ShowModal();
frame->Destroy();
} while( ii == NET_PLUGIN_CHANGE );
// If a plugin is removed or added, rebuild and reopen the new dialog
}
/*******************************/
/* Functions for these classes */
......@@ -271,8 +165,8 @@ EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent, const wxString& title,
/*************************************************************************************/
WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent, wxPoint& framepos ) :
wxDialog( parent, -1, _( "Netlist" ), framepos,
WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ) :
wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition,
wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER )
/*************************************************************************************/
......@@ -289,7 +183,6 @@ WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent, wxPoint
m_PanelNetType[ii] = NULL;
}
if( framepos == wxDefaultPosition )
Centre();
wxBoxSizer* GeneralBoxSizer = new wxBoxSizer( wxVERTICAL );
......
/*****************************************************************************
*
* netlist_control.h
*
*****************************************************************************/
#ifndef _NETLIST_CONTROL_H_
#define _NETLIST_CONTROL_H_
/* Event id for notebook page buttons: */
enum id_netlist {
ID_CREATE_NETLIST = 1550,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_RUN_SIMULATOR,
ID_SETUP_PLUGIN,
ID_VALIDATE_PLUGIN,
ID_DELETE_PLUGIN,
ID_NETLIST_NOTEBOOK
};
/* panel (notebook page) identifiers */
enum panel_netlist_index {
PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */
PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */
PANELCADSTAR, /* Handle Netlist format CadStar */
PANELSPICE, /* Handle Netlist format Pspice */
PANELCUSTOMBASE /* First auxiliary panel (custom netlists).
* others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
};
/* Values returned when the netlist dialog is demiss */
enum gen_netlist_diag {
NET_OK,
NET_ABORT,
NET_PLUGIN_CHANGE
};
/* wxPanels for creating the NoteBook pages for each netlist format: */
class EDA_NoteBookPage : public wxPanel
{
public:
int m_IdNetType;
wxCheckBox* m_IsCurrentFormat;
WinEDA_EnterText* m_CommandStringCtrl;
WinEDA_EnterText* m_TitleStringCtrl;
wxButton* m_ButtonCancel;
wxBoxSizer* m_LeftBoxSizer;
wxBoxSizer* m_RightBoxSizer;
wxBoxSizer* m_RightOptionsBoxSizer;
wxBoxSizer* m_LowBoxSizer;
EDA_NoteBookPage( wxNotebook* parent, const wxString& title,
int id_NetType, int idCheckBox, int idCreateFile );
~EDA_NoteBookPage() { };
};
/* Dialog frame for creating netlists */
class WinEDA_NetlistFrame : public wxDialog
{
public:
WinEDA_SchematicFrame* m_Parent;
wxNotebook* m_NoteBook;
EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
wxRadioBox* m_UseNetNamesInNetlist;
public:
// Constructor and destructor
WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent );
~WinEDA_NetlistFrame() { };
private:
void InstallCustomPages();
void InstallPageSpice();
void GenNetlist( wxCommandEvent& event );
void RunSimulator( wxCommandEvent& event );
void NetlistUpdateOpt();
void OnCancelClick( wxCommandEvent& event );
void SelectNetlistType( wxCommandEvent& event );
void SetupPluginData( wxCommandEvent& event );
void DeletePluginPanel( wxCommandEvent& event );
void ValidatePluginPanel( wxCommandEvent& event );
void WriteCurrentNetlistSetup( void );
DECLARE_EVENT_TABLE()
};
#endif /* _NETLIST_CONTROL_H_ */
......@@ -15,6 +15,8 @@
#include "protos.h"
#include "schframe.h"
static wxArrayString s_CmpNameList;
static wxArrayString s_PowerNameList;
......
......@@ -20,6 +20,8 @@
#include "bitmaps.h"
#include "schframe.h"
#include "Enter_Sheet.xpm"
#include "Leave_Sheet.xpm"
#include "Delete_Sheet.xpm"
......
......@@ -41,6 +41,8 @@
#include "protos.h"
#include "schframe.h"
/* coeff de conversion dim en 1 mil -> dim en unite HPGL: */
#define SCALE_HPGL 1.02041
......
......@@ -36,6 +36,8 @@
#include "plot_common.h"
#include "protos.h"
#include "schframe.h"
#include "wx/defs.h"
// coeff de conversion dim en 1 mil -> dim en unite PS:
......
......@@ -293,14 +293,12 @@ void SuppressDuplicateDrawItem(EDA_LibComponentStruct * LibEntry);
/* NETLIST.CPP */
/**************/
int IsBusLabel(const wxString & LabelDrawList);
void InstallNetlistFrame(WinEDA_SchematicFrame *parent, wxPoint &pos);
/***************/
/* ANNOTATE.CPP */
/***************/
void ReAnnotatePowerSymbolsOnly();
void InstallAnnotateFrame(WinEDA_SchematicFrame * parent);
int CheckAnnotate(WinEDA_SchematicFrame * frame, bool OneSheetOnly);
/* Retourne le nombre de composants non annotes ou erron�s
Si OneSheetOnly : recherche sur le schema courant
......@@ -354,12 +352,6 @@ void DeleteOneLibraryDrawStruct(WinEDA_DrawPanel * panel,
Affiche (si != 0 Efface le graphique correspondant de l'ecran) */
/**********/
/* ERC.CPP */
/**********/
void InstallErcFrame(WinEDA_SchematicFrame *parent, wxPoint & pos);
/**************/
/* GETPART.CPP */
/**************/
......@@ -408,7 +400,6 @@ bool LibArchive(wxWindow * frame, const wxString & ArchFullFileName);
/***************/
/* GENLISTE.CPP */
/***************/
void InstallToolsFrame(WinEDA_DrawFrame *parent, wxPoint &pos);
struct ListComponent;
int GenListeCmp( ListComponent * List );
......@@ -447,12 +438,6 @@ int LocateAlias( const wxArrayString & AliasData, const wxString & Name);
/* Return an index in alias data list ( -1 if not found ) */
/************/
/* FIND.CPP */
/************/
void InstallFindFrame(WinEDA_SchematicFrame *parent, wxPoint &pos);
/***************/
/* OPTIONS.CPP */
/***************/
......
......@@ -13,6 +13,8 @@
#include "protos.h"
#include "schframe.h"
/* Format des fichiers: Voir EELOAD.CC */
/* Fonctions externes */
......
......@@ -15,17 +15,19 @@
#include "protos.h"
/*****************************************************************************/
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
/*****************************************************************************/
#include "schframe.h"
/* Traite les selections d'outils et les commandes appelees du menu POPUP
*/
/*****************************************************************************
*
* Traite les selections d'outils et les commandes appelees du menu POPUP
*
*****************************************************************************/
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
{
int id = event.GetId();
wxPoint pos;
wxClientDC dc( DrawPanel );
wxPoint defaultpos( -1, -1 );
DrawPanel->PrepareGraphicContext( &dc );
......@@ -36,84 +38,6 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// If needed, stop the current command and deselect current tool
switch( id )
{
case ID_POPUP_SCH_ENTRY_SELECT_SLASH: // Do nothing:
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
case ID_POPUP_END_LINE:
case ID_POPUP_SCH_EDIT_TEXT:
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
case ID_POPUP_SCH_SET_SHAPE_TEXT:
case ID_POPUP_SCH_ROTATE_TEXT:
case ID_POPUP_SCH_EDIT_SHEET:
case ID_POPUP_SCH_CLEANUP_SHEET:
case ID_POPUP_SCH_END_SHEET:
case ID_POPUP_SCH_RESIZE_SHEET:
case ID_POPUP_SCH_EDIT_PINSHEET:
case ID_POPUP_SCH_MOVE_PINSHEET:
case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
case ID_POPUP_SCH_MOVE_CMP_REQUEST:
case ID_POPUP_SCH_DRAG_CMP_REQUEST:
case ID_POPUP_SCH_EDIT_CMP:
case ID_POPUP_SCH_MIROR_X_CMP:
case ID_POPUP_SCH_MIROR_Y_CMP:
case ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE:
case ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE:
case ID_POPUP_SCH_ORIENT_NORMAL_CMP:
case ID_POPUP_SCH_INIT_CMP:
case ID_POPUP_SCH_DISPLAYDOC_CMP:
case ID_POPUP_SCH_EDIT_VALUE_CMP:
case ID_POPUP_SCH_EDIT_REF_CMP:
case ID_POPUP_SCH_EDIT_FOOTPRINT_CMP:
case ID_POPUP_SCH_EDIT_CONVERT_CMP:
case ID_POPUP_SCH_SELECT_UNIT_CMP:
case ID_POPUP_SCH_SELECT_UNIT1:
case ID_POPUP_SCH_SELECT_UNIT2:
case ID_POPUP_SCH_SELECT_UNIT3:
case ID_POPUP_SCH_SELECT_UNIT4:
case ID_POPUP_SCH_SELECT_UNIT5:
case ID_POPUP_SCH_SELECT_UNIT6:
case ID_POPUP_SCH_SELECT_UNIT7:
case ID_POPUP_SCH_SELECT_UNIT8:
case ID_POPUP_SCH_SELECT_UNIT9:
case ID_POPUP_SCH_SELECT_UNIT10:
case ID_POPUP_SCH_SELECT_UNIT11:
case ID_POPUP_SCH_SELECT_UNIT12:
case ID_POPUP_SCH_SELECT_UNIT13:
case ID_POPUP_SCH_SELECT_UNIT14:
case ID_POPUP_SCH_SELECT_UNIT15:
case ID_POPUP_SCH_SELECT_UNIT16:
case ID_POPUP_SCH_SELECT_UNIT17:
case ID_POPUP_SCH_SELECT_UNIT18:
case ID_POPUP_SCH_SELECT_UNIT19:
case ID_POPUP_SCH_SELECT_UNIT20:
case ID_POPUP_SCH_SELECT_UNIT21:
case ID_POPUP_SCH_SELECT_UNIT22:
case ID_POPUP_SCH_SELECT_UNIT23:
case ID_POPUP_SCH_SELECT_UNIT24:
case ID_POPUP_SCH_SELECT_UNIT25:
case ID_POPUP_SCH_SELECT_UNIT26:
case ID_POPUP_SCH_ROTATE_FIELD:
case ID_POPUP_SCH_EDIT_FIELD:
case ID_POPUP_DELETE_BLOCK:
case ID_POPUP_PLACE_BLOCK:
case ID_POPUP_ZOOM_BLOCK:
case ID_POPUP_DRAG_BLOCK:
case ID_POPUP_COPY_BLOCK:
case ID_POPUP_ROTATE_BLOCK:
case ID_POPUP_MIRROR_X_BLOCK:
case ID_POPUP_MIRROR_Y_BLOCK:
case ID_POPUP_SCH_DELETE_NODE:
case ID_POPUP_SCH_DELETE_CONNECTION:
case wxID_CUT:
case wxID_COPY:
case ID_POPUP_SCH_ENTER_SHEET:
case ID_POPUP_SCH_LEAVE_SHEET:
case ID_POPUP_SCH_ADD_JUNCTION:
case ID_POPUP_SCH_ADD_LABEL:
break; // Do nothing:
case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( GetScreen()->BlockLocate.m_Command != BLOCK_IDLE )
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
......@@ -156,100 +80,6 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
switch( id ) // Command execution:
{
case ID_EXIT:
Close( TRUE );
break;
case ID_NEW_PROJECT: /* New EED Project */
LoadOneEEProject( wxEmptyString, TRUE );
break;
case ID_LOAD_PROJECT:
LoadOneEEProject( wxEmptyString, FALSE );
break;
case ID_LOAD_ONE_SHEET:
//how is this different from above?
//LoadOneSheet( GetSheet(), wxEmptyString );
break;
case ID_LOAD_FILE_1:
case ID_LOAD_FILE_2:
case ID_LOAD_FILE_3:
case ID_LOAD_FILE_4:
case ID_LOAD_FILE_5:
case ID_LOAD_FILE_6:
case ID_LOAD_FILE_7:
case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10:
LoadOneEEProject( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(
), FALSE );
break;
case ID_TO_LIBRARY:
if( m_Parent->m_LibeditFrame )
{
m_Parent->m_LibeditFrame->Show( TRUE );
}
else
{
m_Parent->m_LibeditFrame =
new WinEDA_LibeditFrame( m_Parent->m_SchematicFrame,
m_Parent,
wxT( "Library Editor" ),
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
ActiveScreen = ScreenLib;
m_Parent->m_LibeditFrame->AdjustScrollBars();
}
break;
case ID_TO_PCB:
{
wxString Line;
if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString )
{
Line = GetScreen()->m_FileName;
AddDelimiterString( Line );
ChangeFileNameExt( Line, wxEmptyString );
ExecuteFile( this, PCBNEW_EXE, Line );
}
else
ExecuteFile( this, PCBNEW_EXE );
break;
}
case ID_TO_CVPCB:
{
wxString Line;
if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString )
{
Line = g_RootSheet->m_AssociatedScreen->m_FileName;
AddDelimiterString( Line );
ChangeFileNameExt( Line, wxEmptyString );
ExecuteFile( this, CVPCB_EXE, Line );
}
else
ExecuteFile( this, CVPCB_EXE );
break;
}
case ID_TO_LIBVIEW:
if( m_Parent->m_ViewlibFrame )
{
m_Parent->m_ViewlibFrame->Show( TRUE );
}
else
{
m_Parent->m_ViewlibFrame =
new WinEDA_ViewlibFrame( m_Parent->m_SchematicFrame,
m_Parent );
m_Parent->m_ViewlibFrame->AdjustScrollBars();
}
break;
case ID_HIERARCHY:
InstallHierarchyFrame( &dc, pos );
g_ItemToRepeat = NULL;
......@@ -262,27 +92,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
g_ItemToRepeat = NULL;
break;
case wxID_PASTE:
HandleBlockBegin( &dc, BLOCK_PASTE, GetScreen()->m_Curseur );
break;
case ID_GET_ERC:
InstallErcFrame( this, defaultpos );
break;
case ID_GET_NETLIST:
InstallNetlistFrame( this, defaultpos );
break;
case ID_GET_TOOLS:
InstallToolsFrame( this, defaultpos );
break;
case ID_FIND_ITEMS:
InstallFindFrame( this, pos );
break;
case ID_HIERARCHY_PUSH_POP_BUTT:
SetToolID( id, wxCURSOR_HAND, _( "Push/Pop Hierarchy" ) );
break;
......@@ -815,8 +628,6 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->Refresh( TRUE );
break;
default: // Log error:
DisplayError( this,
wxT( "WinEDA_SchematicFrame::Process_Special_Functions error" ) );
......
......@@ -13,6 +13,8 @@
#include "protos.h"
#include "schframe.h"
/* Functions to undo and redo edit commands.
* commmands to undo are in CurrentScreen->m_UndoList
* commmands to redo are in CurrentScreen->m_RedoList
......
......@@ -16,8 +16,14 @@
#include "bitmaps.h"
#include "protos.h"
#include "id.h"
#include "netlist.h"
#include "schframe.h"
#include "annotate_dialog.h"
#include "dialog_build_BOM.h"
#include "dialog_erc.h"
#include "dialog_find.h"
#include "netlist_control.h"
/*******************************/
......@@ -32,11 +38,15 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame )
EVT_CLOSE( WinEDA_SchematicFrame::OnCloseWindow )
EVT_SIZE( WinEDA_SchematicFrame::OnSize )
EVT_MENU_RANGE( ID_LOAD_PROJECT, ID_LOAD_FILE_10,
WinEDA_SchematicFrame::Process_Special_Functions )
EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
WinEDA_SchematicFrame::OnLoadFile )
EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_SCHEMATIC_MAIN_TOOLBAR_START,
ID_SCHEMATIC_MAIN_TOOLBAR_END,
WinEDA_SchematicFrame::Process_Special_Functions )
......@@ -54,7 +64,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame )
EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
EVT_MENU( ID_GEN_COPY_BLOCK_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
EVT_MENU( ID_EXIT, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_MENU( ID_EXIT, WinEDA_SchematicFrame::OnExit )
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
ID_CONFIG_AND_PREFERENCES_END,
......@@ -68,14 +78,11 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_SchematicFrame::Process_Zoom )
EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_TO_LIBRARY, WinEDA_SchematicFrame::OnOpenLibraryEditor )
EVT_TOOL( ID_TO_LIBVIEW, WinEDA_SchematicFrame::OnOpenLibraryViewer )
EVT_TOOL( ID_TO_LIBRARY, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_TO_LIBVIEW, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_TO_PCB, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_TO_CVPCB, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_TO_PCB, WinEDA_SchematicFrame::OnOpenPcbnew )
EVT_TOOL( ID_TO_CVPCB, WinEDA_SchematicFrame::OnOpenCvpcb )
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
EVT_TOOL( ID_HIERARCHY, WinEDA_SchematicFrame::Process_Special_Functions )
......@@ -85,8 +92,10 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, wxFrame )
EVT_TOOL( ID_UNDO_BUTT, WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate )
EVT_TOOL( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter )
EVT_TOOL_RANGE( ID_GET_ERC, ID_FIND_ITEMS,
WinEDA_SchematicFrame::Process_Special_Functions )
EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc )
EVT_TOOL( ID_GET_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist )
EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_SchematicFrame::OnFindItems )
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
......@@ -145,17 +154,16 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
g_ItemToRepeat = NULL;
/* Get config */
GetSettings();
g_DrawMinimunLineWidth = m_Parent->m_EDA_Config->Read(
MINI_DRAW_LINE_WIDTH_KEY,
(long) 0 );
g_PlotPSMinimunLineWidth = m_Parent->m_EDA_Config->Read(
MINI_PLOTPS_LINE_WIDTH_KEY,
(long) 4 );
/****/
g_DrawMinimunLineWidth =
m_Parent->m_EDA_Config->Read( MINI_DRAW_LINE_WIDTH_KEY, (long) 0 );
g_PlotPSMinimunLineWidth =
m_Parent->m_EDA_Config->Read( MINI_PLOTPS_LINE_WIDTH_KEY, (long) 4 );
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
if( DrawPanel )
DrawPanel->m_Block_Enable = TRUE;
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateVToolbar();
......@@ -215,9 +223,7 @@ wxString WinEDA_SchematicFrame::GetScreenDesc()
}
/*******************************************/
void WinEDA_SchematicFrame::CreateScreens()
/*******************************************/
{
/* creation des ecrans Sch , Lib */
if( g_RootSheet == NULL )
......@@ -243,7 +249,6 @@ void WinEDA_SchematicFrame::CreateScreens()
/**************************************************************/
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
/**************************************************************/
{
DrawSheetList* sheet;
......@@ -314,12 +319,12 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
}
/********************************************/
/*****************************************************************************
*
* Enable or disable some tools according to current conditions
*
*****************************************************************************/
void WinEDA_SchematicFrame::SetToolbars()
/********************************************/
/* Enable or disable some tools according to current conditions
*/
{
if( m_HToolBar )
{
......@@ -389,9 +394,7 @@ void WinEDA_SchematicFrame::SetToolbars()
}
/******************************************/
int WinEDA_SchematicFrame::BestZoom()
/******************************************/
{
int dx, dy, ii, jj;
int bestzoom;
......@@ -418,3 +421,129 @@ void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
dlg->ShowModal();
dlg->Destroy();
}
void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
{
WinEDA_ErcFrame* dlg = new WinEDA_ErcFrame( this );
dlg->ShowModal();
dlg->Destroy();
}
void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
{
int i;
if ( g_NetFormat < NET_TYPE_PCBNEW )
g_NetFormat = NET_TYPE_PCBNEW;
do
{
WinEDA_NetlistFrame* dlg = new WinEDA_NetlistFrame( this );
i = dlg->ShowModal();
dlg->Destroy();
} while( i == NET_PLUGIN_CHANGE );
// If a plugin is removed or added, rebuild and reopen the new dialog
}
void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent & )
{
WinEDA_Build_BOM_Frame* dlg = new WinEDA_Build_BOM_Frame( this );
dlg->ShowModal();
dlg->Destroy();
}
void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
{
this->DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this );
dlg->ShowModal();
dlg->Destroy();
this->DrawPanel->m_IgnoreMouseEvents = FALSE;
}
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
{
int i = event.GetId() - ID_LOAD_FILE_1;
LoadOneEEProject( GetLastProject( i ).GetData( ), false );
SetToolbars();
}
void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event )
{
LoadOneEEProject( wxEmptyString, true );
}
void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event )
{
LoadOneEEProject( wxEmptyString, false );
}
void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
{
wxString Line;
if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString )
{
Line = GetScreen()->m_FileName;
AddDelimiterString( Line );
ChangeFileNameExt( Line, wxEmptyString );
ExecuteFile( this, PCBNEW_EXE, Line );
}
else
ExecuteFile( this, PCBNEW_EXE );
}
void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
{
wxString Line;
if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString )
{
Line = g_RootSheet->m_AssociatedScreen->m_FileName;
AddDelimiterString( Line );
ChangeFileNameExt( Line, wxEmptyString );
ExecuteFile( this, CVPCB_EXE, Line );
}
else
ExecuteFile( this, CVPCB_EXE );
}
void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
{
if( m_Parent->m_ViewlibFrame )
{
m_Parent->m_ViewlibFrame->Show( TRUE );
}
else
{
m_Parent->m_ViewlibFrame =
new WinEDA_ViewlibFrame( m_Parent->m_SchematicFrame,
m_Parent );
m_Parent->m_ViewlibFrame->AdjustScrollBars();
}
}
void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
{
if( m_Parent->m_LibeditFrame )
{
m_Parent->m_LibeditFrame->Show( TRUE );
}
else
{
m_Parent->m_LibeditFrame =
new WinEDA_LibeditFrame( m_Parent->m_SchematicFrame,
m_Parent,
wxT( "Library Editor" ),
wxPoint( -1, -1 ),
wxSize( 600, 400 ) );
ActiveScreen = ScreenLib;
m_Parent->m_LibeditFrame->AdjustScrollBars();
}
}
void WinEDA_SchematicFrame::OnExit( wxCommandEvent& event )
{
Close( true );
}
/*****************************************************************************
*
* schframe.h
*
* Header for class definition of WinEDA_SchematicFrame. This is the main
* window for EESchema.
*
*****************************************************************************/
#ifndef _SCHFRAME_H_
#define _SCHFRAME_H_
class WinEDA_DrawFrame;
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
{
public:
WinEDAChoiceBox* m_SelPartBox;
DrawSheetList* m_CurrentSheet; //which sheet we are presently working on.
private:
wxMenu* m_FilesMenu;
public:
WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_SchematicFrame();
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void Save_Config( wxWindow* displayframe );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void CreateScreens();
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void SetToolbars();
void OnHotKey( wxDC* DC,
int hotkey,
EDA_BaseStruct* DrawStruct );
DrawSheetList* GetSheet();
virtual BASE_SCREEN* GetScreen();
virtual void SetScreen(SCH_SCREEN* screen);
virtual wxString GetScreenDesc();
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 );
/* Cross probing with pcbnew */
void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
EDA_SchComponentStruct* LibItem );
/* netlist generation */
void* BuildNetListBase();
// FUnctions used for hierarchy handling
void InstallPreviousSheet();
void InstallNextScreen( DrawSheetStruct* Sheet );
void ToPlot_PS( wxCommandEvent& event );
void ToPlot_HPGL( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void Save_File( wxCommandEvent& event );
void SaveProject();
int LoadOneEEProject( const wxString& FileName, bool IsNew );
bool LoadOneEEFile(SCH_SCREEN* screen, const wxString& FullFileName );
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
SCH_SCREEN * CreateNewScreen(SCH_SCREEN * OldScreen, int TimeStamp);
// 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 );
EDA_BaseStruct* FindMarker( int SearchType );
private:
void Process_Move_Item( EDA_BaseStruct* DrawStruct, wxDC* DC );
void OnExit( wxCommandEvent& event );
void OnAnnotate ( wxCommandEvent& event );
void OnErc( wxCommandEvent& event );
void OnCreateNetlist( wxCommandEvent& event );
void OnCreateBillOfMaterials( wxCommandEvent& event );
void OnFindItems( wxCommandEvent& event );
void OnLoadFile( wxCommandEvent& event );
void OnNewProject( wxCommandEvent& event );
void OnLoadProject( wxCommandEvent& event );
void OnOpenPcbnew( wxCommandEvent& event );
void OnOpenCvpcb( wxCommandEvent& event );
void OnOpenLibraryViewer( wxCommandEvent& event );
void OnOpenLibraryEditor( wxCommandEvent& event );
// 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:
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
private:
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:
void DeleteSheetLabel( wxDC* DC, DrawSheetLabelStruct* SheetLabelToDel );
private:
// Component
EDA_SchComponentStruct* Load_Component( wxDC* DC,
const wxString& libname,
wxArrayString& List,
bool UseLibBrowser );
void StartMovePart( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
public:
void CmpRotationMiroir( EDA_SchComponentStruct* DrawComponent,
wxDC* DC, int type_rotate );
private:
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 );
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:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int flag_type_command = 0 );
private:
void PutDataInPreviousState( DrawPickedStruct* List );
bool GetSchematicFromRedoList();
bool GetSchematicFromUndoList();
public:
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* 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 );
// Repetition automatique de placements
void RepeatDrawItem( wxDC* DC );
// 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 );
DECLARE_EVENT_TABLE()
};
#endif /* _SCHFRAME_H_ */
......@@ -39,6 +39,8 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
......
......@@ -12,6 +12,9 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
......
......@@ -13,6 +13,8 @@
#include "protos.h"
#include "hotkeys.h"
#include "schframe.h"
#define BITMAP wxBitmap
#include "bitmaps.h" /* general bitmaps */
......
......@@ -338,220 +338,6 @@ enum fl_rot_cmp {
CMP_MIROIR_Y = 0x200 // miroir selon axe Y
};
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
{
public:
WinEDAChoiceBox* m_SelPartBox;
DrawSheetList* m_CurrentSheet; //which sheet we are presently working on.
private:
wxMenu* m_FilesMenu;
public:
WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_SchematicFrame();
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void Save_Config( wxWindow* displayframe );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void CreateScreens();
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void SetToolbars();
void OnHotKey( wxDC* DC,
int hotkey,
EDA_BaseStruct* DrawStruct );
DrawSheetList* GetSheet();
virtual BASE_SCREEN* GetScreen();
virtual void SetScreen(SCH_SCREEN* screen);
virtual wxString GetScreenDesc();
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 );
/* Cross probing with pcbnew */
void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
EDA_SchComponentStruct* LibItem );
/* netlist generation */
void* BuildNetListBase();
// FUnctions used for hierarchy handling
void InstallPreviousSheet();
void InstallNextScreen( DrawSheetStruct* Sheet );
void ToPlot_PS( wxCommandEvent& event );
void ToPlot_HPGL( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void Save_File( wxCommandEvent& event );
void SaveProject();
int LoadOneEEProject( const wxString& FileName, bool IsNew );
bool LoadOneEEFile(SCH_SCREEN* screen, const wxString& FullFileName );
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
SCH_SCREEN * CreateNewScreen(SCH_SCREEN * OldScreen, int TimeStamp);
// 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 );
EDA_BaseStruct* FindMarker( int SearchType );
private:
void Process_Move_Item( EDA_BaseStruct* DrawStruct, wxDC* DC );
void OnAnnotate ( wxCommandEvent& event );
// 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:
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
private:
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:
void DeleteSheetLabel( wxDC* DC, DrawSheetLabelStruct* SheetLabelToDel );
private:
// Component
EDA_SchComponentStruct* Load_Component( wxDC* DC,
const wxString& libname,
wxArrayString& List,
bool UseLibBrowser );
void StartMovePart( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
public:
void CmpRotationMiroir(
EDA_SchComponentStruct* DrawComponent, wxDC* DC, int type_rotate );
private:
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 );
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:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int flag_type_command = 0 );
private:
void PutDataInPreviousState( DrawPickedStruct* List );
bool GetSchematicFromRedoList();
bool GetSchematicFromUndoList();
public:
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* 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 );
// Repetition automatique de placements
void RepeatDrawItem( wxDC* DC );
// 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 );
DECLARE_EVENT_TABLE()
};
/*****************************/
/* class WinEDA_LibeditFrame */
......
......@@ -43,6 +43,7 @@
#ifdef EESCHEMA
#include "program.h"
#include "../eeschema/schframe.h"
#endif
////@begin XPM images
......
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