Commit b5781155 authored by CHARRAS's avatar CHARRAS

create commandframe.cpp in kicad and some other minor changes

parent 9fe9fc7c
...@@ -4,6 +4,12 @@ Started 2007-June-11 ...@@ -4,6 +4,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Oct-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+kicad:
rename mdiframe.cpp to mainframe.cpp
create commandframe.cpp to handle the command frame (which have the 4 "fast launch" buttons)
2007-Oct-31 UPDATE Dick Hollenbeck <dickelbeck@yahoo.com> 2007-Oct-31 UPDATE Dick Hollenbeck <dickelbeck@yahoo.com>
================================================================================ ================================================================================
......
...@@ -89,6 +89,7 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT ...@@ -89,6 +89,7 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
/** Send a remote command to eeschema via a socket, /** Send a remote command to eeschema via a socket,
* @param objectToSync = item to be located on board (footprint, pad or text) * @param objectToSync = item to be located on board (footprint, pad or text)
* @param LibItem = component in lib if objectToSync is a sub item of a component
* Commands are * Commands are
* $PART: reference put cursor on footprint anchor * $PART: reference put cursor on footprint anchor
* $PIN: number $PART: reference put cursor on the footprint pad * $PIN: number $PART: reference put cursor on the footprint pad
......
...@@ -67,7 +67,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -67,7 +67,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
/** /**
* Function FindComponentAndItem * Function FindComponentAndItem
* finds a Component in the schematic, and an item in this component. * finds a Component in the schematic, and an item in this component.
* @param pattern The text to search for, either in value, reference or elsewhere. * @param component_reference The component reference to find.
* @param text_to_find The text to search for, either in value, reference or elsewhere.
* @param Find_in_hierarchy: false => Search is made in current sheet * @param Find_in_hierarchy: false => Search is made in current sheet
* true => the whole hierarchy * true => the whole hierarchy
* @param SearchType: 0 => find component * @param SearchType: 0 => find component
......
...@@ -6,16 +6,17 @@ ...@@ -6,16 +6,17 @@
#define BASE_STRUCT_H #define BASE_STRUCT_H
#if defined(DEBUG) #if defined (DEBUG)
#include <iostream> // needed for Show() #include <iostream> // needed for Show()
extern std::ostream& operator<<( std::ostream& out, const wxSize& size ); extern std::ostream& operator <<( std::ostream& out, const wxSize& size );
extern std::ostream& operator<<( std::ostream& out, const wxPoint& pt );
extern std::ostream& operator <<( std::ostream& out, const wxPoint& pt );
#endif #endif
/* Id for class identification, at run time */ /* Id for class identification, at run time */
enum KICAD_T { enum KICAD_T {
NOT_USED = -1, // the 3d code uses this value NOT_USED = -1, // the 3d code uses this value
EOT = 0, // search types array terminator (End Of Types) EOT = 0, // search types array terminator (End Of Types)
...@@ -97,7 +98,6 @@ class BOARD; ...@@ -97,7 +98,6 @@ class BOARD;
*/ */
class INSPECTOR class INSPECTOR
{ {
public: public:
virtual ~INSPECTOR() virtual ~INSPECTOR()
{ {
...@@ -116,7 +116,7 @@ public: ...@@ -116,7 +116,7 @@ public:
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE; * else SCAN_CONTINUE;
*/ */
SEARCH_RESULT virtual Inspect( EDA_BaseStruct* testItem, SEARCH_RESULT virtual Inspect( EDA_BaseStruct * testItem,
const void* testData ) = 0; const void* testData ) = 0;
}; };
...@@ -125,9 +125,14 @@ public: ...@@ -125,9 +125,14 @@ public:
/* Classes de base: servent a deriver les classes reellement utiles */ /* Classes de base: servent a deriver les classes reellement utiles */
/********************************************************************/ /********************************************************************/
class EDA_BaseStruct /* Basic class, not directly used */ /** class EDA_BaseStruct
* Basic class, not directly used.
* All the kicad classes used to describe a shematic or a board item are derived from.
*/
class EDA_BaseStruct
{ {
private: private:
/** /**
* Run time identification, _keep private_ so it can never be changed after * Run time identification, _keep private_ so it can never be changed after
* a constructor sets it. See comment near SetType() regarding virtual functions. * a constructor sets it. See comment near SetType() regarding virtual functions.
...@@ -142,22 +147,22 @@ public: ...@@ -142,22 +147,22 @@ public:
EDA_BaseStruct* m_Image; /* Link to an image copy for undelete or abort command */ EDA_BaseStruct* m_Image; /* Link to an image copy for undelete or abort command */
int m_Flags; // flags for editing and other misc. uses int m_Flags; // flags for editing and other misc. uses
#define IS_CHANGED (1<<0) #define IS_CHANGED (1 << 0)
#define IS_LINKED (1<<1) #define IS_LINKED (1 << 1)
#define IN_EDIT (1<<2) #define IN_EDIT (1 << 2)
#define IS_MOVED (1<<3) #define IS_MOVED (1 << 3)
#define IS_NEW (1<<4) #define IS_NEW (1 << 4)
#define IS_RESIZED (1<<5) #define IS_RESIZED (1 << 5)
#define IS_DRAGGED (1<<6) #define IS_DRAGGED (1 << 6)
#define IS_DELETED (1<<7) #define IS_DELETED (1 << 7)
#define IS_WIRE_IMAGE (1<<8) #define IS_WIRE_IMAGE (1 << 8)
#define STARTPOINT (1<<9) #define STARTPOINT (1 << 9)
#define ENDPOINT (1<<10) #define ENDPOINT (1 << 10)
#define SELECTED (1<<11) #define SELECTED (1 << 11)
#define SELECTEDNODE (1<<12) ///< flag indiquant que la structure a deja selectionnee #define SELECTEDNODE (1 << 12) ///< flag indiquant que la structure a deja selectionnee
#define STRUCT_DELETED (1<<13) ///< Bit flag de Status pour structures effacee #define STRUCT_DELETED (1 << 13) ///< Bit flag de Status pour structures effacee
#define CANDIDATE (1<<14) ///< flag indiquant que la structure est connectee #define CANDIDATE (1 << 14) ///< flag indiquant que la structure est connectee
#define SKIP_STRUCT (1<<15) ///< flag indiquant que la structure ne doit pas etre traitee #define SKIP_STRUCT (1 << 15) ///< flag indiquant que la structure ne doit pas etre traitee
unsigned long m_TimeStamp; // Time stamp used for logical links unsigned long m_TimeStamp; // Time stamp used for logical links
...@@ -197,6 +202,7 @@ public: ...@@ -197,6 +202,7 @@ public:
return m_Status & type; return m_Status & type;
} }
void SetState( int type, int state ) void SetState( int type, int state )
{ {
if( state ) if( state )
...@@ -205,6 +211,7 @@ public: ...@@ -205,6 +211,7 @@ public:
m_Status &= ~type; m_Status &= ~type;
} }
int ReturnStatus() const { return m_Status; } int ReturnStatus() const { return m_Status; }
void SetStatus( int new_status ) void SetStatus( int new_status )
...@@ -212,6 +219,7 @@ public: ...@@ -212,6 +219,7 @@ public:
m_Status = new_status; m_Status = new_status;
} }
/* addition d'une nouvelle struct a la liste chain� */ /* addition d'une nouvelle struct a la liste chain� */
void AddToChain( EDA_BaseStruct* laststruct ); void AddToChain( EDA_BaseStruct* laststruct );
...@@ -267,7 +275,9 @@ public: ...@@ -267,7 +275,9 @@ public:
* SEARCH_QUIT, else SCAN_CONTINUE; * SEARCH_QUIT, else SCAN_CONTINUE;
*/ */
static SEARCH_RESULT IterateForward( EDA_BaseStruct* listStart, static SEARCH_RESULT IterateForward( EDA_BaseStruct* listStart,
INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] ); INSPECTOR* inspector,
const void* testData,
const KICAD_T scanTypes[] );
/** /**
...@@ -294,7 +304,7 @@ public: ...@@ -294,7 +304,7 @@ public:
*/ */
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT("EDA_BaseStruct"); return wxT( "EDA_BaseStruct" );
} }
...@@ -306,7 +316,7 @@ public: ...@@ -306,7 +316,7 @@ public:
void DeleteStructList(); void DeleteStructList();
#if defined(DEBUG) #if defined (DEBUG)
/** /**
* Function Show * Function Show
...@@ -328,7 +338,6 @@ public: ...@@ -328,7 +338,6 @@ public:
static std::ostream& NestedSpace( int nestLevel, std::ostream& os ); static std::ostream& NestedSpace( int nestLevel, std::ostream& os );
#endif #endif
}; };
...@@ -356,23 +365,27 @@ typedef enum { ...@@ -356,23 +365,27 @@ typedef enum {
#define DEFAULT_SIZE_TEXT 60 /* default text height (in mils or 1/1000") */ #define DEFAULT_SIZE_TEXT 60 /* default text height (in mils or 1/1000") */
/* classe de gestion des textes (labels, textes composants ..) /** class EDA_TextStruct
* (Non utilisee seule) */ * basic class to handle texts (labels, texts on components or footprints ..)
* not used directly.
* the text classes are derived from EDA_BaseStruct and EDA_TextStruct
*/
class EDA_TextStruct class EDA_TextStruct
{ {
public: public:
wxString m_Text; /* text! */ wxString m_Text; /* text! */
wxPoint m_Pos; /* XY position of anchor text. */ wxPoint m_Pos; /* XY position of anchor text. */
wxSize m_Size; /* XY size of text */ wxSize m_Size; /* XY size of text */
int m_Width; /* epaisseur du trait */ int m_Width; /* text width */
int m_Orient; /* Orient in 0.1 degrees */ int m_Orient; /* Orient in 0.1 degrees */
int m_Miroir; // Display Normal / mirror int m_Miroir; // Display Normal / mirror
int m_Attributs; /* controle visibilite */ int m_Attributs; /* flags (visible...) */
int m_CharType; /* normal, bold, italic ... */ int m_CharType; /* normal, bold, italic ... */
int m_HJustify, m_VJustify; /* Justifications Horiz et Vert du texte */ int m_HJustify, m_VJustify; /* Horiz and Vert Justifications */
int m_ZoomLevelDrawable; /* Niveau de zoom acceptable pour affichage normal */ int m_ZoomLevelDrawable; /* zoom level to draw text.
int* m_TextDrawings; /* pointeur sur la liste des segments de dessin */ * if zoom < m_ZoomLevelDrawable: the text is drawn as a single line */
int m_TextDrawingsSize; /* nombre de segments a dessiner */ int* m_TextDrawings; /* list of segments to draw, for the Draw function */
int m_TextDrawingsSize; /* segment count */
public: public:
EDA_TextStruct( const wxString& text = wxEmptyString ); EDA_TextStruct( const wxString& text = wxEmptyString );
...@@ -380,7 +393,11 @@ public: ...@@ -380,7 +393,11 @@ public:
void CreateDrawData(); void CreateDrawData();
int GetLength() { return m_Text.Length(); }; int GetLength() { return m_Text.Length(); };
int Pitch();/* retourne le pas entre 2 caracteres */
/** Function Pitch()
* @return distance between 2 caracteres
*/
int Pitch();
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int color, const wxPoint& offset, int color,
int draw_mode, int display_mode = FILAIRE, int anchor_color = -1 ); int draw_mode, int display_mode = FILAIRE, int anchor_color = -1 );
...@@ -393,7 +410,11 @@ public: ...@@ -393,7 +410,11 @@ public:
*/ */
bool HitTest( const wxPoint& ref_pos ); bool HitTest( const wxPoint& ref_pos );
int Len_Size(); // Return the text lenght in internal units /**
* Function Len_Size
* Return the text lenght in internal units
*/
int Len_Size();
}; };
...@@ -412,17 +433,19 @@ protected: ...@@ -412,17 +433,19 @@ protected:
public: public:
BOARD_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) : BOARD_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) :
EDA_BaseStruct( StructFather, idtype ), EDA_BaseStruct( StructFather, idtype )
m_Layer(0) , m_Layer( 0 )
{ {
} }
BOARD_ITEM( const BOARD_ITEM& src ) : BOARD_ITEM( const BOARD_ITEM& src ) :
EDA_BaseStruct( src.m_Parent, src.Type() ), EDA_BaseStruct( src.m_Parent, src.Type() )
m_Layer( src.m_Layer ) , m_Layer( src.m_Layer )
{ {
} }
BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; } BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; } BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; } BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
...@@ -510,8 +533,6 @@ public: ...@@ -510,8 +533,6 @@ public:
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
virtual bool Save( FILE* aFile ) const = 0; virtual bool Save( FILE* aFile ) const = 0;
}; };
......
...@@ -278,45 +278,3 @@ void WinEDA_MainFrame::RecreateBaseHToolbar() ...@@ -278,45 +278,3 @@ void WinEDA_MainFrame::RecreateBaseHToolbar()
m_HToolBar->Realize(); m_HToolBar->Realize();
} }
/*************************************************/
void WinEDA_MainFrame::CreateCommandToolbar()
/*************************************************/
{
wxBitmapButton * btn;
// delete and recreate the toolbar
if( m_VToolBar ) return;
btn = new wxBitmapButton( this, ID_TO_EESCHEMA, BITMAP(icon_eeschema_xpm) );
btn->SetToolTip(_("eeschema (Schematic editor)"));
AddFastLaunch( btn );
btn = new wxBitmapButton( this,ID_TO_CVPCB, BITMAP(icon_cvpcb_xpm) );
btn->SetToolTip(_("cvpcb (Components to modules)"));
AddFastLaunch( btn );
btn = new wxBitmapButton( this, ID_TO_PCB, BITMAP(a_icon_pcbnew_xpm) );
btn->SetToolTip(_("pcbnew (PCB editor)"));
AddFastLaunch( btn );
btn = new wxBitmapButton( this, ID_TO_GERBVIEW, BITMAP(icon_gerbview_xpm) );
btn->SetToolTip(_("gerbview (Gerber viewer)"));
AddFastLaunch( btn );
// Set up toolbar
#ifdef KICAD_PYTHON
btn = new wxBitmapButton( this, ID_RUN_PYTHON, BITMAP(icon_python_xpm) );
btn->SetToolTip(_("Run Python Script"));
AddFastLaunch( btn );
#endif
}
void WinEDA_MainFrame::AddFastLaunch( wxButton * button, int sep )
{
static wxPoint pos (20, 20);
button->Reparent( m_CommandWin );
button->Move( pos );
pos.x += button->GetSize().GetWidth() + sep;
}
/*****************************************************/
/* commandframe.cpp: window handling comman buttons */
/*****************************************************/
#include "fctsys.h"
#include "common.h"
#include "kicad.h"
#include "macros.h"
#define BITMAP wxBitmap
// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------
// USE_XPM_BITMAPS
#include "bitmaps.h"
#include "id.h"
/************************************************************************************/
WinEDA_CommandFrame::WinEDA_CommandFrame( wxWindow* parent, int id,
wxPoint pos, wxSize size, long style ) :
wxSashLayoutWindow( parent, id, pos, size, style )
/************************************************************************************/
/** WinEDA_CommandFrame constructor
* create the window which the buttons to call eeschema and others...
*/
{
SetDefaultSize( wxSize( size.x, 100 ) );
SetOrientation( wxLAYOUT_HORIZONTAL );
SetAlignment( wxLAYOUT_TOP );
SetSashVisible( wxSASH_BOTTOM, TRUE );
SetSashVisible( wxSASH_LEFT, TRUE );
SetExtraBorderSize( 2 );
SetFont( *g_StdFont );
CreateCommandToolbar();
}
/*************************************************/
void WinEDA_CommandFrame::CreateCommandToolbar( void )
/*************************************************/
/** Function CreateCommandToolbar
* create the buttons to call eescheman cvpcb, pcbnew and gerbview
*/
{
wxBitmapButton* btn;
m_ButtonSeparation = 10;
m_ButtonLastPosition.x = 20;
m_ButtonLastPosition.y = 20;
btn = new wxBitmapButton( this, ID_TO_EESCHEMA, BITMAP( icon_eeschema_xpm ) );
btn->SetToolTip( _( "eeschema (Schematic editor)" ) );
AddFastLaunch( btn );
btn = new wxBitmapButton( this, ID_TO_CVPCB, BITMAP( icon_cvpcb_xpm ) );
btn->SetToolTip( _( "cvpcb (Components to modules)" ) );
AddFastLaunch( btn );
btn = new wxBitmapButton( this, ID_TO_PCB, BITMAP( a_icon_pcbnew_xpm ) );
btn->SetToolTip( _( "pcbnew (PCB editor)" ) );
AddFastLaunch( btn );
btn = new wxBitmapButton( this, ID_TO_GERBVIEW, BITMAP( icon_gerbview_xpm ) );
btn->SetToolTip( _( "gerbview (Gerber viewer)" ) );
AddFastLaunch( btn );
// Set up toolbar
#ifdef KICAD_PYTHON
btn = new wxBitmapButton( this, ID_RUN_PYTHON, BITMAP( icon_python_xpm ) );
btn->SetToolTip( _( "Run Python Script" ) );
AddFastLaunch( btn );
#endif
}
/****************************************************************/
void WinEDA_CommandFrame::AddFastLaunch( wxBitmapButton * button )
/****************************************************************/
/** Function AddFastLaunch
* add a Bitmap Button (fast launch button) to the window
* @param button = wxBitmapButton to add to the window
*/
{
button->Move( m_ButtonLastPosition );
m_ButtonLastPosition.x += button->GetSize().GetWidth() + m_ButtonSeparation;
}
...@@ -68,7 +68,8 @@ void WinEDA_MainFrame::AddFastLaunchPy( object & button ) ...@@ -68,7 +68,8 @@ void WinEDA_MainFrame::AddFastLaunchPy( object & button )
if ( !success ) return; if ( !success ) return;
Py_INCREF( button.ptr() ); Py_INCREF( button.ptr() );
AddFastLaunch( btn ); btn->Reparent( m_CommandWin );
m_CommandWin->AddFastLaunch( btn );
} }
// WinEDA_PrjFrame Special binding functions: // WinEDA_PrjFrame Special binding functions:
......
...@@ -20,8 +20,7 @@ eda_global wxString g_Main_Title ...@@ -20,8 +20,7 @@ eda_global wxString g_Main_Title
#endif #endif
; ;
#define WinEDA_CommandFrame wxSashLayoutWindow class WinEDA_CommandFrame;
class WinEDA_TreePrj; class WinEDA_TreePrj;
class WinEDA_PrjFrame; class WinEDA_PrjFrame;
...@@ -29,6 +28,9 @@ class WinEDA_PrjFrame; ...@@ -29,6 +28,9 @@ class WinEDA_PrjFrame;
/* classe pour la Fenetre generale de kicad*/ /* classe pour la Fenetre generale de kicad*/
/*******************************************/ /*******************************************/
/* class WinEDA_MainFrame
* This is the main kicad frame
*/
class WinEDA_MainFrame : public WinEDA_BasicFrame class WinEDA_MainFrame : public WinEDA_BasicFrame
{ {
/* This class is the main entry point of the py API */ /* This class is the main entry point of the py API */
...@@ -38,7 +40,7 @@ public: ...@@ -38,7 +40,7 @@ public:
WinEDA_PrjFrame* m_LeftWin; WinEDA_PrjFrame* m_LeftWin;
wxSashLayoutWindow* m_BottomWin; wxSashLayoutWindow* m_BottomWin;
wxTextCtrl* m_DialogWin; wxTextCtrl* m_DialogWin;
WinEDA_Toolbar* m_VToolBar; // Toolbar Vertical bord d'ecran WinEDA_Toolbar* m_VToolBar; // Verticam Toolbar (not used)
wxString m_PrjFileName; wxString m_PrjFileName;
int m_LeftWin_Width; int m_LeftWin_Width;
...@@ -50,8 +52,8 @@ private: ...@@ -50,8 +52,8 @@ private:
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_MainFrame( WinEDA_App * eda_app, wxWindow * parent, const wxString &title, WinEDA_MainFrame( WinEDA_App* eda_app, wxWindow* parent, const wxString& title,
const wxPoint &pos, const wxSize &size ); const wxPoint& pos, const wxSize& size );
~WinEDA_MainFrame(); ~WinEDA_MainFrame();
...@@ -69,7 +71,6 @@ public: ...@@ -69,7 +71,6 @@ public:
void Process_Preferences( wxCommandEvent& event ); void Process_Preferences( wxCommandEvent& event );
void ReCreateMenuBar(); void ReCreateMenuBar();
void RecreateBaseHToolbar(); void RecreateBaseHToolbar();
void CreateCommandToolbar();
void PrintMsg( const wxString& text ); void PrintMsg( const wxString& text );
void ClearMsg(); void ClearMsg();
void SetLanguage( wxCommandEvent& event ); void SetLanguage( wxCommandEvent& event );
...@@ -83,9 +84,9 @@ public: ...@@ -83,9 +84,9 @@ public:
boost::python::object GetPrjName() const; boost::python::object GetPrjName() const;
WinEDA_MainFrame( const WinEDA_MainFrame & ) {} WinEDA_MainFrame( const WinEDA_MainFrame& ) { }
WinEDA_MainFrame() {} WinEDA_MainFrame() { }
boost::python::object ToWx(); boost::python::object ToWx();
void AddFastLaunchPy( boost::python::object& button ); void AddFastLaunchPy( boost::python::object& button );
...@@ -93,8 +94,6 @@ public: ...@@ -93,8 +94,6 @@ public:
#endif #endif
void AddFastLaunch( wxButton* button, int sep = 20 );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
...@@ -114,15 +113,51 @@ enum TreeFileType { ...@@ -114,15 +113,51 @@ enum TreeFileType {
TREE_MAX, TREE_MAX,
}; };
/**************************************************************/
/* class WinEDA_CommandFrame: window handling command buttons */
/**************************************************************/
/** class WinEDA_CommandFrame
* This is the window handling the main tools to launch eeschema, cvpcb, pcbnew and gerbview
*/
class WinEDA_CommandFrame : public wxSashLayoutWindow
{
public:
WinEDA_CommandFrame( wxWindow* parent, int id, wxPoint pos, wxSize size, long style );
~WinEDA_CommandFrame()
{ }
/** Function AddFastLaunch
* add a Bitmap Button (fast launch button) to the window
*/
public: void AddFastLaunch( wxBitmapButton * button );
private:
/** Function CreateCommandToolbar
* Create the main buttons (fast launch buttons)
*/
void CreateCommandToolbar( void );
private:
wxPoint m_ButtonLastPosition; /** position of the last button in the window */
int m_ButtonSeparation; /** button distance in pixels */
};
/***********************************************************/ /***********************************************************/
/* Classes pour l'arbre de hierarchie de gestion du projet */ /* Classes pour l'arbre de hierarchie de gestion du projet */
/***********************************************************/ /***********************************************************/
/** class TreePrjItemData
* Handle one item (a file or a directory name) for the tree file
*/
class TreePrjItemData : public wxTreeItemData class TreePrjItemData : public wxTreeItemData
{ {
public: public:
TreeFileType m_Type; TreeFileType m_Type;
bool m_IsRootFile; // True if m_Filename is a root schematic (same name as project) bool m_IsRootFile; // True if m_Filename is a root schematic (same name as project)
wxString m_FileName; wxString m_FileName; // Filename for a file, or directory name
private: private:
wxTreeCtrl* m_Parent; wxTreeCtrl* m_Parent;
...@@ -132,29 +167,35 @@ private: ...@@ -132,29 +167,35 @@ private:
public: public:
TreePrjItemData( TreeFileType type, const wxString& data, wxTreeCtrl* parent ); TreePrjItemData( TreeFileType type, const wxString& data, wxTreeCtrl* parent );
TreePrjItemData() : m_Parent( NULL ) {} TreePrjItemData() : m_Parent( NULL ) { }
TreePrjItemData( const TreePrjItemData &src ) : TreePrjItemData( const TreePrjItemData& src ) :
m_Type( src.m_Type ), m_Type( src.m_Type )
m_FileName( src.m_FileName ), , m_FileName( src.m_FileName )
m_Parent( src.m_Parent ) , m_Parent( src.m_Parent )
{ {
SetState( src.m_State ); SetState( src.m_State );
} }
TreeFileType GetType() const TreeFileType GetType() const
{ {
return m_Type; return m_Type;
} }
wxString GetFileName() const wxString GetFileName() const
{ {
return m_FileName; return m_FileName;
} }
void SetFileName( const wxString& name ) void SetFileName( const wxString& name )
{ {
m_FileName = name; m_FileName = name;
} }
wxString GetDir() const; wxString GetDir() const;
void OnRename( wxTreeEvent& event, bool check = true ); void OnRename( wxTreeEvent& event, bool check = true );
...@@ -168,6 +209,7 @@ public: ...@@ -168,6 +209,7 @@ public:
return &m_fileMenu; return &m_fileMenu;
} }
void SetState( int state ); void SetState( int state );
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
...@@ -183,7 +225,9 @@ public: ...@@ -183,7 +225,9 @@ public:
#endif #endif
}; };
/* Fenetre d'affichage des fichiers du projet */ /** class WinEDA_PrjFrame
* Window to display the tree files
*/
class WinEDA_PrjFrame : public wxSashLayoutWindow class WinEDA_PrjFrame : public wxSashLayoutWindow
{ {
private: private:
...@@ -210,8 +254,8 @@ public: ...@@ -210,8 +254,8 @@ public:
public: public:
static wxString GetFileExt( TreeFileType type ); static wxString GetFileExt( TreeFileType type );
WinEDA_PrjFrame( WinEDA_MainFrame * parent, WinEDA_PrjFrame( WinEDA_MainFrame* parent,
const wxPoint &pos, const wxSize &size ); const wxPoint& pos, const wxSize& size );
~WinEDA_PrjFrame() { } ~WinEDA_PrjFrame() { }
void OnSelect( wxTreeEvent& Event ); void OnSelect( wxTreeEvent& Event );
void OnRenameAsk( wxTreeEvent& Event ); void OnRenameAsk( wxTreeEvent& Event );
...@@ -243,11 +287,16 @@ public: ...@@ -243,11 +287,16 @@ public:
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
boost::python::object ToWx(); boost::python::object ToWx();
WinEDA_PrjFrame() { WinEDA_PrjFrame()
{
} }
WinEDA_PrjFrame( const WinEDA_PrjFrame & ) {
WinEDA_PrjFrame( const WinEDA_PrjFrame& )
{
} }
void OnRunPy( wxCommandEvent& event ); void OnRunPy( wxCommandEvent& event );
boost::python::object GetMenuPy( TreeFileType ); boost::python::object GetMenuPy( TreeFileType );
...@@ -277,7 +326,9 @@ public: ...@@ -277,7 +326,9 @@ public:
}; };
/** Classe TreeCtrl des fichiers projets **/ /** Class TreeCtrl
* This is the class to show (as a tree) the files in the project directory
*/
class WinEDA_TreePrj : public wxTreeCtrl class WinEDA_TreePrj : public wxTreeCtrl
{ {
DECLARE_DYNAMIC_CLASS( WinEDA_TreePrj ) DECLARE_DYNAMIC_CLASS( WinEDA_TreePrj )
...@@ -291,7 +342,9 @@ public: ...@@ -291,7 +342,9 @@ public:
{ {
return m_Parent; return m_Parent;
} }
WinEDA_TreePrj( WinEDA_PrjFrame * parent );
WinEDA_TreePrj( WinEDA_PrjFrame* parent );
~WinEDA_TreePrj(); ~WinEDA_TreePrj();
private: private:
/* overlayed sort function */ /* overlayed sort function */
......
/***********************************************************/
/* mdiframe.cpp - WinEDA_MainFrame is the kicad main frame */
/***********************************************************/
#ifdef __GNUG__
#pragma implementation
#endif
#ifdef KICAD_PYTHON
#include <pyhandler.h>
#endif
#include "fctsys.h"
#include "common.h"
#include "bitmaps.h"
#include "protos.h"
#include "id.h"
#include "kicad.h"
/****************/
/* Constructor */
/****************/
WinEDA_MainFrame::WinEDA_MainFrame( WinEDA_App* eda_app,
wxWindow* parent, const wxString& title,
const wxPoint& pos, const wxSize& size ) :
WinEDA_BasicFrame( parent, KICAD_MAIN_FRAME, eda_app, title, pos, size )
{
wxString msg;
wxSize clientsize;
m_FrameName = wxT( "KicadFrame" );
m_VToolBar = NULL;
m_LeftWin = NULL;
m_BottomWin = NULL;
m_CommandWin = NULL;
m_LeftWin_Width = 200;
m_CommandWin_Height = 82;
GetSettings();
if( m_Parent->m_EDA_Config )
{
m_Parent->m_EDA_Config->Read( wxT( "LeftWinWidth" ), &m_LeftWin_Width );
m_Parent->m_EDA_Config->Read( wxT( "CommandWinWidth" ), &m_CommandWin_Height );
}
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
// Create the status line (bottom of the frame
int dims[3] = { -1, -1, 100 };
CreateStatusBar( 3 );
SetStatusWidths( 3, dims );
// Give an icon
#ifdef __WINDOWS__
SetIcon( wxICON( a_kicad_icon ) );
#else
SetIcon( wxICON( kicad_icon ) );
#endif
clientsize = GetClientSize();
// Left window: is the box which display tree project
m_LeftWin = new WinEDA_PrjFrame( this, wxDefaultPosition, wxDefaultSize );
m_LeftWin->SetDefaultSize( wxSize( m_LeftWin_Width, clientsize.y ) );
m_LeftWin->SetOrientation( wxLAYOUT_VERTICAL );
m_LeftWin->SetAlignment( wxLAYOUT_LEFT );
m_LeftWin->SetSashVisible( wxSASH_RIGHT, TRUE );
m_LeftWin->SetExtraBorderSize( 2 );
// Bottom Window: box to display messages
m_BottomWin = new wxSashLayoutWindow( this, ID_BOTTOM_FRAME,
wxDefaultPosition, wxDefaultSize,
wxNO_BORDER | wxSW_3D );
m_BottomWin->SetDefaultSize( wxSize( clientsize.x, 150 ) );
m_BottomWin->SetOrientation( wxLAYOUT_HORIZONTAL );
m_BottomWin->SetAlignment( wxLAYOUT_BOTTOM );
m_BottomWin->SetSashVisible( wxSASH_TOP, TRUE );
m_BottomWin->SetSashVisible( wxSASH_LEFT, TRUE );
m_BottomWin->SetExtraBorderSize( 2 );
m_DialogWin = new wxTextCtrl( m_BottomWin, ID_MAIN_DIALOG, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE |
wxNO_BORDER |
wxTE_READONLY );
m_DialogWin->SetFont( *g_StdFont );
// m_CommandWin is the box with buttons which launch eechema, pcbnew ...
m_CommandWin = new WinEDA_CommandFrame( this, ID_MAIN_COMMAND,
wxPoint( m_LeftWin_Width,
0 ),
wxSize( clientsize.x, m_CommandWin_Height ),
wxNO_BORDER | wxSW_3D );
wxString line;
msg = wxGetCwd();
line.Printf( _( "Ready\nWorking dir: %s\n" ), msg.GetData() );
PrintMsg( line );
#ifdef KICAD_PYTHON
PyHandler::GetInstance()->DeclareEvent( wxT( "kicad::LoadProject" ) );
#endif
}
/***************/
/* Destructor */
/***************/
WinEDA_MainFrame::~WinEDA_MainFrame()
{
if( m_Parent->m_EDA_Config )
{
m_LeftWin_Width = m_LeftWin->GetSize().x;
m_CommandWin_Height = m_CommandWin->GetSize().y;
m_Parent->m_EDA_Config->Write( wxT( "LeftWinWidth" ), m_LeftWin_Width );
m_Parent->m_EDA_Config->Write( wxT( "CommandWinWidth" ), m_CommandWin_Height );
}
}
/*******************************************************/
void WinEDA_MainFrame::PrintMsg( const wxString& text )
/*******************************************************/
/*
* Put text in the dialog frame
*/
{
m_DialogWin->SetFont( *g_StdFont );
m_DialogWin->AppendText( text );
}
/****************************************************/
void WinEDA_MainFrame::OnSashDrag( wxSashEvent& event )
/****************************************************/
/* Resize windows when dragging window borders
*/
{
int w, h;
wxSize newsize;
if( event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE )
return;
GetClientSize( &w, &h );
switch( event.GetId() )
{
case ID_LEFT_FRAME:
{
m_LeftWin->SetDefaultSize( wxSize( event.GetDragRect().width, -1 ) );
break;
}
case ID_BOTTOM_FRAME:
{
newsize = event.GetDragRect().GetSize();
m_LeftWin->SetDefaultSize( wxSize( w - newsize.x, -1 ) );
m_BottomWin->SetDefaultSize( wxSize( -1, newsize.y ) );
m_CommandWin->SetDefaultSize( wxSize( -1, h - newsize.y ) );
break;
}
case ID_MAIN_COMMAND:
{
newsize = event.GetDragRect().GetSize();
m_LeftWin->SetDefaultSize( wxSize( w - newsize.x, -1 ) );
m_CommandWin->SetDefaultSize( wxSize( -1, newsize.y ) );
m_BottomWin->SetDefaultSize( wxSize( -1, h - newsize.y ) );
break;
}
}
wxLayoutAlgorithm layout;
layout.LayoutFrame( this );
}
/************************************************/
void WinEDA_MainFrame::OnSize( wxSizeEvent& event )
/************************************************/
{
if( m_CommandWin && m_BottomWin )
{
int w, h, dy;
wxSize bsize, hsize;
GetClientSize( &w, &h );
bsize = m_BottomWin->GetSize();
hsize = m_CommandWin->GetSize();
dy = h - hsize.y;
if( dy < 50 )
{
dy = 50;
hsize.y = h - dy;
}
m_CommandWin->SetDefaultSize( wxSize( -1, hsize.y ) );
m_BottomWin->SetDefaultSize( wxSize( -1, dy ) );
}
;
wxLayoutAlgorithm layout;
layout.LayoutFrame( this );
if( m_CommandWin )
m_CommandWin->Refresh( TRUE );
}
/**********************************************************/
void WinEDA_MainFrame::OnCloseWindow( wxCloseEvent& Event )
/**********************************************************/
{
int px, py;
SetLastProject( m_PrjFileName );
if( !IsIconized() ) // save main frame position and size
{
GetPosition( &px, &py );
m_FramePos.x = px;
m_FramePos.y = py;
GetSize( &px, &py );
m_FrameSize.x = px;
m_FrameSize.y = py;
}
Event.SetCanVeto( TRUE );
SaveSettings();
// Close the help frame
if( m_Parent->m_HtmlCtrl )
{
if( m_Parent->m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active
m_Parent->m_HtmlCtrl->GetFrame()->Close( TRUE );
m_Parent->m_HtmlCtrl = NULL;
}
Destroy();
}
/**********************************************************/
void WinEDA_MainFrame::OnPaint( wxPaintEvent& event )
/**********************************************************/
{
event.Skip();
}
/*******************************************/
void WinEDA_MainFrame::ReDraw( wxDC* DC )
/*******************************************/
{
}
/**********************************************************************/
void WinEDA_MainFrame::Process_Special_Functions( wxCommandEvent& event )
/**********************************************************************/
{
int id = event.GetId();
switch( id )
{
case ID_EXIT:
Close( TRUE );
break;
default:
DisplayError( this, wxT( "WinEDA_MainFrame::Process_Special_Functions error" ) );
break;
}
}
/********************************************************/
void WinEDA_MainFrame::Process_Fct( wxCommandEvent& event )
/*********************************************************/
{
int id = event.GetId();
wxString FullFileName = m_PrjFileName;
switch( id )
{
case ID_TO_PCB:
ChangeFileNameExt( FullFileName, g_BoardExtBuffer );
AddDelimiterString( FullFileName );
ExecuteFile( this, PCBNEW_EXE, FullFileName );
break;
case ID_TO_CVPCB:
ChangeFileNameExt( FullFileName, g_NetlistExtBuffer );
AddDelimiterString( FullFileName );
ExecuteFile( this, CVPCB_EXE, FullFileName );
break;
case ID_TO_EESCHEMA:
ChangeFileNameExt( FullFileName, g_SchExtBuffer );
AddDelimiterString( FullFileName );
ExecuteFile( this, EESCHEMA_EXE, FullFileName );
break;
case ID_TO_GERBVIEW:
FullFileName = wxGetCwd() + STRING_DIR_SEP;
AddDelimiterString( FullFileName );
ExecuteFile( this, GERBVIEW_EXE, FullFileName );
break;
case ID_TO_EDITOR:
{
wxString editorname = GetEditorName();
if( !editorname.IsEmpty() )
ExecuteFile( this, editorname, wxEmptyString );
}
break;
#ifdef KICAD_PYTHON
case ID_RUN_PYTHON:
{
wxString script = EDA_FileSelector( _( "Execute Python Script:" ),
wxEmptyString, /* Default path */
wxEmptyString, /* default filename */
wxT( ".py" ), /* default ext. */
wxT( "*.py" ), /* mask for filename filter */
this,
wxFD_OPEN,
FALSE
);
if( script.IsEmpty() )
break;
PyHandler::GetInstance()->RunScript( script );
}
break;
#endif
case ID_BROWSE_AN_SELECT_FILE:
{
wxString mask( wxT( "*" ) ), extension;
#ifdef __WINDOWS__
mask += wxT( ".*" );
extension = wxT( ".*" );
#endif
FullFileName = EDA_FileSelector( _( "Load file:" ),
wxGetCwd(), /* Default path */
wxEmptyString, /* default filename */
extension, /* default ext. */
mask, /* mask for filename filter */
this,
wxFD_OPEN,
TRUE
);
if( !FullFileName.IsEmpty() )
{
AddDelimiterString( FullFileName );
wxString editorname = GetEditorName();
if( !editorname.IsEmpty() )
ExecuteFile( this, editorname, FullFileName );
}
}
break;
break;
default:
DisplayError( this, wxT( "WinEDA_MainFrame::Process_Fct Internal Error" ) );
break;
}
}
/********************************************************/
void WinEDA_MainFrame::OnRefresh( wxCommandEvent& event )
/********************************************************/
{
m_LeftWin->ReCreateTreePrj();
}
/*********************************/
void WinEDA_MainFrame::ClearMsg()
/*********************************/
{
m_DialogWin->Clear();
}
#ifdef KICAD_PYTHON
void WinEDA_MainFrame::OnRefreshPy()
{
m_LeftWin->ReCreateTreePrj();
}
#endif
...@@ -8,9 +8,10 @@ OBJECTS = kicad.o\ ...@@ -8,9 +8,10 @@ OBJECTS = kicad.o\
treeprj_datas.o\ treeprj_datas.o\
buildmnu.o\ buildmnu.o\
infospgm.o\ infospgm.o\
mdiframe.o\ mainframe.o\
prjconfig.o\ prjconfig.o\
preferences.o\ preferences.o\
commandframe.o\
files-io.o files-io.o
...@@ -24,7 +25,7 @@ prjconfig.o: prjconfig.cpp $(DEPEND) prjconfig.h ...@@ -24,7 +25,7 @@ prjconfig.o: prjconfig.cpp $(DEPEND) prjconfig.h
files-io.o: files-io.cpp $(DEPEND) kicad.h files-io.o: files-io.cpp $(DEPEND) kicad.h
mdiframe.o: mdiframe.cpp $(DEPEND) kicad.h mainframe.o: mainframe.cpp $(DEPEND) kicad.h
buildmnu.o: buildmnu.cpp $(DEPEND) kicad.h buildmnu.o: buildmnu.cpp $(DEPEND) kicad.h
......
/******************************************************************/
/* mdiframe.cpp - fonctions de la classe du type WinEDA_MainFrame */
/******************************************************************/
#ifdef __GNUG__
#pragma implementation
#endif
#ifdef KICAD_PYTHON
#include <pyhandler.h>
#endif
#include "fctsys.h"
#include "common.h"
#include "bitmaps.h"
#include "protos.h"
#include "id.h"
#include "kicad.h"
/****************/
/* Constructeur */
/****************/
WinEDA_MainFrame::WinEDA_MainFrame(WinEDA_App * eda_app,
wxWindow *parent, const wxString & title,
const wxPoint& pos, const wxSize& size):
WinEDA_BasicFrame(parent, KICAD_MAIN_FRAME, eda_app, title, pos, size )
{
wxString msg;
wxSize clientsize;
m_FrameName = wxT("KicadFrame");
m_VToolBar = NULL;
m_LeftWin = NULL;
m_BottomWin = NULL;
m_CommandWin = NULL;
m_LeftWin_Width = 200;
m_CommandWin_Height = 82;
GetSettings();
if( m_Parent->m_EDA_Config )
{
m_Parent->m_EDA_Config->Read(wxT("LeftWinWidth"), &m_LeftWin_Width);
m_Parent->m_EDA_Config->Read(wxT("CommandWinWidth"), &m_CommandWin_Height);
}
SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y);
// ajuste la ligne de status
int dims[3] = { -1, -1, 100};
CreateStatusBar(3);
SetStatusWidths(3,dims);
// Give an icon
#ifdef __WINDOWS__
SetIcon(wxICON(a_kicad_icon));
#else
SetIcon(wxICON(kicad_icon));
#endif
clientsize = GetClientSize();
// Left window: is the box which display tree project
m_LeftWin = new WinEDA_PrjFrame(this, wxDefaultPosition, wxDefaultSize);
m_LeftWin->SetDefaultSize(wxSize(m_LeftWin_Width, clientsize.y));
m_LeftWin->SetOrientation(wxLAYOUT_VERTICAL);
m_LeftWin->SetAlignment(wxLAYOUT_LEFT);
m_LeftWin->SetSashVisible(wxSASH_RIGHT, TRUE);
m_LeftWin->SetExtraBorderSize(2);
// Bottom Window: box to display messages
m_BottomWin = new wxSashLayoutWindow(this, ID_BOTTOM_FRAME,
wxDefaultPosition, wxDefaultSize,
wxNO_BORDER|wxSW_3D);
m_BottomWin->SetDefaultSize(wxSize(clientsize.x, 150));
m_BottomWin->SetOrientation(wxLAYOUT_HORIZONTAL);
m_BottomWin->SetAlignment(wxLAYOUT_BOTTOM);
m_BottomWin->SetSashVisible(wxSASH_TOP, TRUE);
m_BottomWin->SetSashVisible(wxSASH_LEFT, TRUE);
m_BottomWin->SetExtraBorderSize(2);
m_DialogWin = new wxTextCtrl(m_BottomWin, ID_MAIN_DIALOG, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE|
wxNO_BORDER|
wxTE_READONLY);
m_DialogWin->SetFont(* g_StdFont);
// m_CommandWin is the box with buttons which launch eechema, pcbnew ...
m_CommandWin = new WinEDA_CommandFrame(this, ID_MAIN_COMMAND,
wxPoint(m_LeftWin_Width, 0), wxSize(clientsize.x, m_CommandWin_Height),
wxNO_BORDER|wxSW_3D);
m_CommandWin->SetDefaultSize(wxSize(clientsize.x, 100));
m_CommandWin->SetOrientation(wxLAYOUT_HORIZONTAL);
m_CommandWin->SetAlignment(wxLAYOUT_TOP);
m_CommandWin->SetSashVisible(wxSASH_BOTTOM, TRUE);
m_CommandWin->SetSashVisible(wxSASH_LEFT, TRUE);
m_CommandWin->SetExtraBorderSize(2);
m_CommandWin->SetFont(* g_StdFont);
CreateCommandToolbar();
wxString line;
msg = wxGetCwd();
line.Printf( _("Ready\nWorking dir: %s\n"), msg.GetData());
PrintMsg(line);
#ifdef KICAD_PYTHON
PyHandler::GetInstance()->DeclareEvent(wxT("kicad::LoadProject"));
#endif
}
/***************/
/* Destructeur */
/***************/
WinEDA_MainFrame::~WinEDA_MainFrame()
{
if( m_Parent->m_EDA_Config )
{
m_LeftWin_Width = m_LeftWin->GetSize().x;
m_CommandWin_Height = m_CommandWin->GetSize().y;
m_Parent->m_EDA_Config->Write(wxT("LeftWinWidth"), m_LeftWin_Width);
m_Parent->m_EDA_Config->Write(wxT("CommandWinWidth"), m_CommandWin_Height);
}
}
/*******************************************************/
void WinEDA_MainFrame::PrintMsg(const wxString & text)
/*******************************************************/
/*
imprime le message dans la fenetre des messages
*/
{
m_DialogWin->SetFont(* g_StdFont);
m_DialogWin->AppendText(text);
}
/****************************************************/
void WinEDA_MainFrame::OnSashDrag(wxSashEvent& event)
/****************************************************/
/* Resize windows when dragging window borders
*/
{
int w, h;
wxSize newsize;
if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE)
return;
GetClientSize(&w, &h);
switch (event.GetId())
{
case ID_LEFT_FRAME:
{
m_LeftWin->SetDefaultSize(wxSize(event.GetDragRect().width, -1));
break;
}
case ID_BOTTOM_FRAME:
{
newsize = event.GetDragRect().GetSize();
m_LeftWin->SetDefaultSize(wxSize(w-newsize.x, -1));
m_BottomWin->SetDefaultSize(wxSize(-1, newsize.y));
m_CommandWin->SetDefaultSize(wxSize(-1, h - newsize.y));
break;
}
case ID_MAIN_COMMAND:
{
newsize = event.GetDragRect().GetSize();
m_LeftWin->SetDefaultSize(wxSize(w-newsize.x, -1));
m_CommandWin->SetDefaultSize(wxSize(-1, newsize.y));
m_BottomWin->SetDefaultSize(wxSize(-1, h - newsize.y));
break;
}
}
wxLayoutAlgorithm layout;
layout.LayoutFrame(this);
}
/************************************************/
void WinEDA_MainFrame::OnSize(wxSizeEvent& event)
/************************************************/
{
if (m_CommandWin && m_BottomWin)
{
int w, h, dy;
wxSize bsize, hsize;
GetClientSize(&w, &h);
bsize = m_BottomWin->GetSize();
hsize = m_CommandWin->GetSize();
dy = h - hsize.y;
if ( dy < 50 )
{
dy = 50;
hsize.y = h - dy;
}
m_CommandWin->SetDefaultSize(wxSize(-1, hsize.y));
m_BottomWin->SetDefaultSize(wxSize(-1, dy));
};
wxLayoutAlgorithm layout;
layout.LayoutFrame(this);
if ( m_CommandWin ) m_CommandWin->Refresh(TRUE);
}
/**********************************************************/
void WinEDA_MainFrame::OnCloseWindow(wxCloseEvent & Event)
/**********************************************************/
{
int px, py;
SetLastProject(m_PrjFileName);
if ( ! IsIconized() )
{
/* Memorisation position sur l'ecran */
GetPosition(&px, &py);
m_FramePos.x = px;
m_FramePos.y = py;
/* Memorisation dimension de la fenetre */
GetSize(&px, &py);
m_FrameSize.x = px;
m_FrameSize.y = py;
}
Event.SetCanVeto(TRUE);
SaveSettings();
// Close the help frame
if ( m_Parent->m_HtmlCtrl )
{
if ( m_Parent->m_HtmlCtrl->GetFrame() ) // returns NULL if no help frame active
m_Parent->m_HtmlCtrl->GetFrame()->Close(TRUE);
m_Parent->m_HtmlCtrl = NULL;
}
Destroy();
}
/**********************************************************/
void WinEDA_MainFrame::OnPaint(wxPaintEvent & event)
/**********************************************************/
{
event.Skip();
}
/*******************************************/
void WinEDA_MainFrame::ReDraw(wxDC * DC)
/*******************************************/
{
}
/**********************************************************************/
void WinEDA_MainFrame::Process_Special_Functions(wxCommandEvent& event)
/**********************************************************************/
{
int id = event.GetId();
switch ( id )
{
case ID_EXIT :
Close(TRUE);
break;
default:
DisplayError(this, wxT("WinEDA_MainFrame::Process_Special_Functions error"));
break;
}
}
/********************************************************/
void WinEDA_MainFrame::Process_Fct(wxCommandEvent& event)
/*********************************************************/
{
int id = event.GetId();
wxString FullFileName = m_PrjFileName;
switch (id)
{
case ID_TO_PCB:
ChangeFileNameExt(FullFileName, g_BoardExtBuffer);
AddDelimiterString(FullFileName);
ExecuteFile(this, PCBNEW_EXE, FullFileName);
break;
case ID_TO_CVPCB:
ChangeFileNameExt(FullFileName, g_NetlistExtBuffer);
AddDelimiterString(FullFileName);
ExecuteFile(this, CVPCB_EXE, FullFileName);
break;
case ID_TO_EESCHEMA:
ChangeFileNameExt(FullFileName, g_SchExtBuffer);
AddDelimiterString(FullFileName);
ExecuteFile(this, EESCHEMA_EXE, FullFileName);
break;
case ID_TO_GERBVIEW:
FullFileName = wxGetCwd() + STRING_DIR_SEP;
AddDelimiterString(FullFileName);
ExecuteFile(this, GERBVIEW_EXE, FullFileName);
break;
case ID_TO_EDITOR:
{
wxString editorname = GetEditorName();
if ( !editorname.IsEmpty() )
ExecuteFile(this, editorname, wxEmptyString);
}
break;
#ifdef KICAD_PYTHON
case ID_RUN_PYTHON:
{
wxString script = EDA_FileSelector( _("Execute Python Script:"),
wxEmptyString, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */
wxT( ".py" ), /* extension par defaut */
wxT("*.py"), /* Masque d'affichage */
this,
wxFD_OPEN,
FALSE
);
if ( script.IsEmpty() ) break;
PyHandler::GetInstance()->RunScript( script );
}
break;
#endif
case ID_BROWSE_AN_SELECT_FILE:
{
wxString mask(wxT("*")), extension;
#ifdef __WINDOWS__
mask += wxT(".*");
extension = wxT(".*");
#endif
FullFileName = EDA_FileSelector( _("Load file:"),
wxGetCwd(), /* Default path */
wxEmptyString, /* default filename */
extension, /* default ext. */
mask, /* mask for filename filter */
this,
wxFD_OPEN,
TRUE
);
if ( ! FullFileName.IsEmpty() )
{
AddDelimiterString(FullFileName);
wxString editorname = GetEditorName();
if ( ! editorname.IsEmpty() )
ExecuteFile(this, editorname, FullFileName);
}
}
break;
break;
default: DisplayError(this, wxT("WinEDA_MainFrame::Process_Fct Internal Error"));
break;
}
}
/********************************************************/
void WinEDA_MainFrame::OnRefresh(wxCommandEvent & event )
/********************************************************/
{
m_LeftWin->ReCreateTreePrj();
}
/*********************************/
void WinEDA_MainFrame::ClearMsg()
/*********************************/
{
m_DialogWin->Clear();
}
#ifdef KICAD_PYTHON
void WinEDA_MainFrame::OnRefreshPy() { m_LeftWin->ReCreateTreePrj(); }
#endif
...@@ -84,7 +84,13 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -84,7 +84,13 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
SetSize( 0, 0, minsize.x, minsize.y ); SetSize( 0, 0, minsize.x, minsize.y );
// Creation de la ligne de status // Creation de la ligne de status
static const int dims[6] = { -1, 60, 130, 130, 40, 100 }; #define ZOOM_DISPLAY_SIZE 60
#define COORD_DISPLAY_SIZE 140
#define UNITS_DISPLAY_SIZE 50
#define FUNCTION_DISPLAY_SIZE 100
static const int dims[6] = { -1, ZOOM_DISPLAY_SIZE,
COORD_DISPLAY_SIZE, COORD_DISPLAY_SIZE,
UNITS_DISPLAY_SIZE, FUNCTION_DISPLAY_SIZE };
CreateStatusBar( 6 ); CreateStatusBar( 6 );
SetStatusWidths( 6, dims ); SetStatusWidths( 6, dims );
......
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