create commandframe.cpp in kicad and some other minor changes
This commit is contained in:
parent
9fe9fc7c00
commit
b578115533
|
@ -4,6 +4,12 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
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>
|
||||
================================================================================
|
||||
|
|
|
@ -89,6 +89,7 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
|
|||
|
||||
/** Send a remote command to eeschema via a socket,
|
||||
* @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
|
||||
* $PART: reference put cursor on footprint anchor
|
||||
* $PIN: number $PART: reference put cursor on the footprint pad
|
||||
|
|
|
@ -67,7 +67,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
|
|||
/**
|
||||
* Function FindComponentAndItem
|
||||
* 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
|
||||
* true => the whole hierarchy
|
||||
* @param SearchType: 0 => find component
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
#if defined (DEBUG)
|
||||
#include <iostream> // needed for Show()
|
||||
extern std::ostream& operator <<( std::ostream& out, const wxSize& size );
|
||||
|
||||
extern std::ostream& operator <<( std::ostream& out, const wxPoint& pt );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Id for class identification, at run time */
|
||||
enum KICAD_T {
|
||||
|
||||
NOT_USED = -1, // the 3d code uses this value
|
||||
|
||||
EOT = 0, // search types array terminator (End Of Types)
|
||||
|
@ -97,7 +98,6 @@ class BOARD;
|
|||
*/
|
||||
class INSPECTOR
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~INSPECTOR()
|
||||
{
|
||||
|
@ -125,9 +125,14 @@ public:
|
|||
/* 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:
|
||||
|
||||
/**
|
||||
* Run time identification, _keep private_ so it can never be changed after
|
||||
* a constructor sets it. See comment near SetType() regarding virtual functions.
|
||||
|
@ -197,6 +202,7 @@ public:
|
|||
return m_Status & type;
|
||||
}
|
||||
|
||||
|
||||
void SetState( int type, int state )
|
||||
{
|
||||
if( state )
|
||||
|
@ -205,6 +211,7 @@ public:
|
|||
m_Status &= ~type;
|
||||
}
|
||||
|
||||
|
||||
int ReturnStatus() const { return m_Status; }
|
||||
|
||||
void SetStatus( int new_status )
|
||||
|
@ -212,6 +219,7 @@ public:
|
|||
m_Status = new_status;
|
||||
}
|
||||
|
||||
|
||||
/* addition d'une nouvelle struct a la liste chain<69> */
|
||||
void AddToChain( EDA_BaseStruct* laststruct );
|
||||
|
||||
|
@ -267,7 +275,9 @@ public:
|
|||
* SEARCH_QUIT, else SCAN_CONTINUE;
|
||||
*/
|
||||
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[] );
|
||||
|
||||
|
||||
/**
|
||||
|
@ -328,7 +338,6 @@ public:
|
|||
static std::ostream& NestedSpace( int nestLevel, std::ostream& os );
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -356,23 +365,27 @@ typedef enum {
|
|||
|
||||
#define DEFAULT_SIZE_TEXT 60 /* default text height (in mils or 1/1000") */
|
||||
|
||||
/* classe de gestion des textes (labels, textes composants ..)
|
||||
* (Non utilisee seule) */
|
||||
/** class EDA_TextStruct
|
||||
* 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
|
||||
{
|
||||
public:
|
||||
wxString m_Text; /* text! */
|
||||
wxPoint m_Pos; /* XY position of anchor 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_Miroir; // Display Normal / mirror
|
||||
int m_Attributs; /* controle visibilite */
|
||||
int m_Attributs; /* flags (visible...) */
|
||||
int m_CharType; /* normal, bold, italic ... */
|
||||
int m_HJustify, m_VJustify; /* Justifications Horiz et Vert du texte */
|
||||
int m_ZoomLevelDrawable; /* Niveau de zoom acceptable pour affichage normal */
|
||||
int* m_TextDrawings; /* pointeur sur la liste des segments de dessin */
|
||||
int m_TextDrawingsSize; /* nombre de segments a dessiner */
|
||||
int m_HJustify, m_VJustify; /* Horiz and Vert Justifications */
|
||||
int m_ZoomLevelDrawable; /* zoom level to draw text.
|
||||
* if zoom < m_ZoomLevelDrawable: the text is drawn as a single line */
|
||||
int* m_TextDrawings; /* list of segments to draw, for the Draw function */
|
||||
int m_TextDrawingsSize; /* segment count */
|
||||
|
||||
public:
|
||||
EDA_TextStruct( const wxString& text = wxEmptyString );
|
||||
|
@ -380,7 +393,11 @@ public:
|
|||
void CreateDrawData();
|
||||
|
||||
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,
|
||||
const wxPoint& offset, int color,
|
||||
int draw_mode, int display_mode = FILAIRE, int anchor_color = -1 );
|
||||
|
@ -393,7 +410,11 @@ public:
|
|||
*/
|
||||
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:
|
|||
public:
|
||||
|
||||
BOARD_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) :
|
||||
EDA_BaseStruct( StructFather, idtype ),
|
||||
m_Layer(0)
|
||||
EDA_BaseStruct( StructFather, idtype )
|
||||
, m_Layer( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BOARD_ITEM( const BOARD_ITEM& src ) :
|
||||
EDA_BaseStruct( src.m_Parent, src.Type() ),
|
||||
m_Layer( src.m_Layer )
|
||||
EDA_BaseStruct( src.m_Parent, src.Type() )
|
||||
, m_Layer( src.m_Layer )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
|
||||
BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
|
||||
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
|
||||
|
@ -510,8 +533,6 @@ public:
|
|||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
virtual bool Save( FILE* aFile ) const = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -278,45 +278,3 @@ void WinEDA_MainFrame::RecreateBaseHToolbar()
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
/*****************************************************/
|
||||
/* 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 )
|
|||
if ( !success ) return;
|
||||
|
||||
Py_INCREF( button.ptr() );
|
||||
AddFastLaunch( btn );
|
||||
btn->Reparent( m_CommandWin );
|
||||
m_CommandWin->AddFastLaunch( btn );
|
||||
}
|
||||
|
||||
// WinEDA_PrjFrame Special binding functions:
|
||||
|
|
|
@ -20,8 +20,7 @@ eda_global wxString g_Main_Title
|
|||
#endif
|
||||
;
|
||||
|
||||
#define WinEDA_CommandFrame wxSashLayoutWindow
|
||||
|
||||
class WinEDA_CommandFrame;
|
||||
class WinEDA_TreePrj;
|
||||
class WinEDA_PrjFrame;
|
||||
|
||||
|
@ -29,6 +28,9 @@ class WinEDA_PrjFrame;
|
|||
/* classe pour la Fenetre generale de kicad*/
|
||||
/*******************************************/
|
||||
|
||||
/* class WinEDA_MainFrame
|
||||
* This is the main kicad frame
|
||||
*/
|
||||
class WinEDA_MainFrame : public WinEDA_BasicFrame
|
||||
{
|
||||
/* This class is the main entry point of the py API */
|
||||
|
@ -38,7 +40,7 @@ public:
|
|||
WinEDA_PrjFrame* m_LeftWin;
|
||||
wxSashLayoutWindow* m_BottomWin;
|
||||
wxTextCtrl* m_DialogWin;
|
||||
WinEDA_Toolbar* m_VToolBar; // Toolbar Vertical bord d'ecran
|
||||
WinEDA_Toolbar* m_VToolBar; // Verticam Toolbar (not used)
|
||||
wxString m_PrjFileName;
|
||||
|
||||
int m_LeftWin_Width;
|
||||
|
@ -69,7 +71,6 @@ public:
|
|||
void Process_Preferences( wxCommandEvent& event );
|
||||
void ReCreateMenuBar();
|
||||
void RecreateBaseHToolbar();
|
||||
void CreateCommandToolbar();
|
||||
void PrintMsg( const wxString& text );
|
||||
void ClearMsg();
|
||||
void SetLanguage( wxCommandEvent& event );
|
||||
|
@ -93,8 +94,6 @@ public:
|
|||
|
||||
#endif
|
||||
|
||||
void AddFastLaunch( wxButton* button, int sep = 20 );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@ -114,15 +113,51 @@ enum TreeFileType {
|
|||
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 */
|
||||
/***********************************************************/
|
||||
|
||||
/** class TreePrjItemData
|
||||
* Handle one item (a file or a directory name) for the tree file
|
||||
*/
|
||||
class TreePrjItemData : public wxTreeItemData
|
||||
{
|
||||
public:
|
||||
TreeFileType m_Type;
|
||||
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:
|
||||
wxTreeCtrl* m_Parent;
|
||||
|
@ -135,26 +170,32 @@ public:
|
|||
TreePrjItemData() : m_Parent( NULL ) { }
|
||||
|
||||
TreePrjItemData( const TreePrjItemData& src ) :
|
||||
m_Type( src.m_Type ),
|
||||
m_FileName( src.m_FileName ),
|
||||
m_Parent( src.m_Parent )
|
||||
m_Type( src.m_Type )
|
||||
, m_FileName( src.m_FileName )
|
||||
, m_Parent( src.m_Parent )
|
||||
{
|
||||
SetState( src.m_State );
|
||||
}
|
||||
|
||||
|
||||
TreeFileType GetType() const
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
|
||||
|
||||
wxString GetFileName() const
|
||||
{
|
||||
return m_FileName;
|
||||
}
|
||||
|
||||
|
||||
void SetFileName( const wxString& name )
|
||||
{
|
||||
m_FileName = name;
|
||||
}
|
||||
|
||||
|
||||
wxString GetDir() const;
|
||||
|
||||
void OnRename( wxTreeEvent& event, bool check = true );
|
||||
|
@ -168,6 +209,7 @@ public:
|
|||
return &m_fileMenu;
|
||||
}
|
||||
|
||||
|
||||
void SetState( int state );
|
||||
|
||||
#ifdef KICAD_PYTHON
|
||||
|
@ -183,7 +225,9 @@ public:
|
|||
#endif
|
||||
};
|
||||
|
||||
/* Fenetre d'affichage des fichiers du projet */
|
||||
/** class WinEDA_PrjFrame
|
||||
* Window to display the tree files
|
||||
*/
|
||||
class WinEDA_PrjFrame : public wxSashLayoutWindow
|
||||
{
|
||||
private:
|
||||
|
@ -243,11 +287,16 @@ public:
|
|||
#ifdef KICAD_PYTHON
|
||||
boost::python::object ToWx();
|
||||
|
||||
WinEDA_PrjFrame() {
|
||||
WinEDA_PrjFrame()
|
||||
{
|
||||
}
|
||||
WinEDA_PrjFrame( const WinEDA_PrjFrame & ) {
|
||||
|
||||
|
||||
WinEDA_PrjFrame( const WinEDA_PrjFrame& )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void OnRunPy( wxCommandEvent& event );
|
||||
|
||||
boost::python::object GetMenuPy( TreeFileType );
|
||||
|
@ -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
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( WinEDA_TreePrj )
|
||||
|
@ -291,6 +342,8 @@ public:
|
|||
{
|
||||
return m_Parent;
|
||||
}
|
||||
|
||||
|
||||
WinEDA_TreePrj( WinEDA_PrjFrame* parent );
|
||||
~WinEDA_TreePrj();
|
||||
private:
|
||||
|
|
|
@ -0,0 +1,404 @@
|
|||
/***********************************************************/
|
||||
/* 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\
|
|||
treeprj_datas.o\
|
||||
buildmnu.o\
|
||||
infospgm.o\
|
||||
mdiframe.o\
|
||||
mainframe.o\
|
||||
prjconfig.o\
|
||||
preferences.o\
|
||||
commandframe.o\
|
||||
files-io.o
|
||||
|
||||
|
||||
|
@ -24,7 +25,7 @@ prjconfig.o: prjconfig.cpp $(DEPEND) prjconfig.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
|
||||
|
||||
|
|
|
@ -1,395 +0,0 @@
|
|||
/******************************************************************/
|
||||
/* 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,
|
|||
SetSize( 0, 0, minsize.x, minsize.y );
|
||||
|
||||
// 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 );
|
||||
SetStatusWidths( 6, dims );
|
||||
|
|
Loading…
Reference in New Issue