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
|
||||
|
|
|
@ -6,20 +6,21 @@
|
|||
#define BASE_STRUCT_H
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
#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 );
|
||||
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
|
||||
|
||||
NOT_USED = -1, // the 3d code uses this value
|
||||
|
||||
EOT = 0, // search types array terminator (End Of Types)
|
||||
|
||||
|
||||
TYPE_NOT_INIT = 0,
|
||||
TYPEPCB,
|
||||
|
||||
|
@ -80,7 +81,7 @@ enum KICAD_T {
|
|||
enum SEARCH_RESULT {
|
||||
SEARCH_QUIT,
|
||||
SEARCH_CONTINUE
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class EDA_BaseStruct;
|
||||
|
@ -89,7 +90,7 @@ class BOARD;
|
|||
|
||||
/**
|
||||
* Class INSPECTOR
|
||||
* is an abstract class that is used to inspect and possibly collect the
|
||||
* is an abstract class that is used to inspect and possibly collect the
|
||||
* (search) results of Iterating over a list or tree of KICAD_T objects.
|
||||
* Extend from this class and implement the Inspect function and provide for
|
||||
* a way for the extension to collect the results of the search/scan data and
|
||||
|
@ -97,16 +98,15 @@ class BOARD;
|
|||
*/
|
||||
class INSPECTOR
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~INSPECTOR()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function Inspect
|
||||
* is the examining function within the INSPECTOR which is passed to the
|
||||
* is the examining function within the INSPECTOR which is passed to the
|
||||
* Iterate function. It is used primarily for searching, but not limited to
|
||||
* that. It can also collect or modify the scanned objects.
|
||||
*
|
||||
|
@ -115,9 +115,9 @@ public:
|
|||
* if the BOARD_ITEM under test meets its match criteria.
|
||||
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
|
||||
* else SCAN_CONTINUE;
|
||||
*/
|
||||
SEARCH_RESULT virtual Inspect( EDA_BaseStruct* testItem,
|
||||
const void* testData ) = 0;
|
||||
*/
|
||||
SEARCH_RESULT virtual Inspect( EDA_BaseStruct * testItem,
|
||||
const void* testData ) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -125,15 +125,20 @@ 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.
|
||||
*/
|
||||
KICAD_T m_StructType;
|
||||
|
||||
KICAD_T m_StructType;
|
||||
|
||||
public:
|
||||
EDA_BaseStruct* Pnext; /* Linked list: Link (next struct) */
|
||||
EDA_BaseStruct* Pback; /* Linked list: Link (previous struct) */
|
||||
|
@ -142,33 +147,33 @@ public:
|
|||
EDA_BaseStruct* m_Image; /* Link to an image copy for undelete or abort command */
|
||||
|
||||
int m_Flags; // flags for editing and other misc. uses
|
||||
#define IS_CHANGED (1<<0)
|
||||
#define IS_LINKED (1<<1)
|
||||
#define IN_EDIT (1<<2)
|
||||
#define IS_MOVED (1<<3)
|
||||
#define IS_NEW (1<<4)
|
||||
#define IS_RESIZED (1<<5)
|
||||
#define IS_DRAGGED (1<<6)
|
||||
#define IS_DELETED (1<<7)
|
||||
#define IS_WIRE_IMAGE (1<<8)
|
||||
#define STARTPOINT (1<<9)
|
||||
#define ENDPOINT (1<<10)
|
||||
#define SELECTED (1<<11)
|
||||
#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 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 IS_CHANGED (1 << 0)
|
||||
#define IS_LINKED (1 << 1)
|
||||
#define IN_EDIT (1 << 2)
|
||||
#define IS_MOVED (1 << 3)
|
||||
#define IS_NEW (1 << 4)
|
||||
#define IS_RESIZED (1 << 5)
|
||||
#define IS_DRAGGED (1 << 6)
|
||||
#define IS_DELETED (1 << 7)
|
||||
#define IS_WIRE_IMAGE (1 << 8)
|
||||
#define STARTPOINT (1 << 9)
|
||||
#define ENDPOINT (1 << 10)
|
||||
#define SELECTED (1 << 11)
|
||||
#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 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
|
||||
|
||||
|
||||
unsigned long m_TimeStamp; // Time stamp used for logical links
|
||||
int m_Selected; /* Used by block commands, and selective editing */
|
||||
unsigned long m_TimeStamp; // Time stamp used for logical links
|
||||
int m_Selected; /* Used by block commands, and selective editing */
|
||||
|
||||
private:
|
||||
int m_Status;
|
||||
int m_Status;
|
||||
|
||||
private:
|
||||
void InitVars();
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -182,29 +187,31 @@ public:
|
|||
* a constructor sets it, so there is no public "setter" method.
|
||||
* @return KICAD_T - the type of object.
|
||||
*/
|
||||
KICAD_T Type() const { return m_StructType; }
|
||||
KICAD_T Type() const { return m_StructType; }
|
||||
|
||||
|
||||
EDA_BaseStruct* Next() const { return (EDA_BaseStruct*) Pnext; }
|
||||
EDA_BaseStruct* Back() const { return (EDA_BaseStruct*) Pback; }
|
||||
EDA_BaseStruct* GetParent() const { return (EDA_BaseStruct*) m_Parent; }
|
||||
|
||||
|
||||
|
||||
EDA_BaseStruct* Next() const { return (EDA_BaseStruct*) Pnext; }
|
||||
EDA_BaseStruct* Back() const { return (EDA_BaseStruct*) Pback; }
|
||||
EDA_BaseStruct* GetParent() const { return (EDA_BaseStruct*) m_Parent; }
|
||||
|
||||
|
||||
/* Gestion de l'etat (status) de la structure (active, deleted..) */
|
||||
|
||||
|
||||
int GetState( int type ) const
|
||||
{
|
||||
return m_Status & type;
|
||||
}
|
||||
|
||||
|
||||
void SetState( int type, int state )
|
||||
{
|
||||
if( state )
|
||||
m_Status |= type; // state = ON or OFF
|
||||
m_Status |= type; // state = ON or OFF
|
||||
else
|
||||
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 );
|
||||
|
||||
|
@ -224,19 +232,19 @@ public:
|
|||
int draw_mode,
|
||||
int Color = -1 );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function Display_Infos
|
||||
* has knowledge about the frame and how and where to put status information
|
||||
* about this object into the frame's message panel.
|
||||
* @param frame A WinEDA_DrawFrame in which to print status information.
|
||||
*/
|
||||
*/
|
||||
virtual void Display_Infos( WinEDA_DrawFrame* frame )
|
||||
{
|
||||
// derived classes may implement this
|
||||
// derived classes may implement this
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function HitTest
|
||||
* tests if the given wxPoint is within the bounds of this object.
|
||||
|
@ -251,25 +259,27 @@ public:
|
|||
|
||||
/**
|
||||
* Function IterateForward
|
||||
* walks through the object tree calling the inspector() on each object
|
||||
* walks through the object tree calling the inspector() on each object
|
||||
* type requested in scanTypes.
|
||||
*
|
||||
* @param listStart The first in a list of EDA_BaseStructs to iterate over.
|
||||
* @param inspector Is an INSPECTOR to call on each object that is one of
|
||||
* @param listStart The first in a list of EDA_BaseStructs to iterate over.
|
||||
* @param inspector Is an INSPECTOR to call on each object that is one of
|
||||
* the requested scanTypes.
|
||||
* @param testData Is an aid to testFunc, and should be sufficient to
|
||||
* @param testData Is an aid to testFunc, and should be sufficient to
|
||||
* allow it to fully determine if an item meets the match criteria, but it
|
||||
* may also be used to collect output.
|
||||
* @param scanTypes A KICAD_T array that is EOT
|
||||
* @param scanTypes A KICAD_T array that is EOT
|
||||
* terminated, and provides both the order and interest level of of
|
||||
* the types of objects to be iterated over.
|
||||
* @return SEARCH_RESULT - SEARCH_QUIT if the called INSPECTOR returned
|
||||
* @return SEARCH_RESULT - SEARCH_QUIT if the called INSPECTOR returned
|
||||
* SEARCH_QUIT, else SCAN_CONTINUE;
|
||||
*/
|
||||
static SEARCH_RESULT IterateForward( EDA_BaseStruct* listStart,
|
||||
INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] );
|
||||
static SEARCH_RESULT IterateForward( EDA_BaseStruct* listStart,
|
||||
INSPECTOR* inspector,
|
||||
const void* testData,
|
||||
const KICAD_T scanTypes[] );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function Visit
|
||||
* may be re-implemented for each derived class in order to handle
|
||||
|
@ -278,15 +288,15 @@ public:
|
|||
* to do so on lists of such data.
|
||||
* @param inspector An INSPECTOR instance to use in the inspection.
|
||||
* @param testData Arbitrary data used by the inspector.
|
||||
* @param scanTypes Which KICAD_T types are of interest and the order
|
||||
* @param scanTypes Which KICAD_T types are of interest and the order
|
||||
* is significant too, terminated by EOT.
|
||||
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
|
||||
* else SCAN_CONTINUE, and determined by the inspector.
|
||||
*/
|
||||
virtual SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
|
||||
const KICAD_T scanTypes[] );
|
||||
virtual SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
|
||||
const KICAD_T scanTypes[] );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function GetClass
|
||||
* returns the class name.
|
||||
|
@ -294,41 +304,40 @@ public:
|
|||
*/
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT("EDA_BaseStruct");
|
||||
return wxT( "EDA_BaseStruct" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function DeleteStructList
|
||||
* deletes each item in a linked list of EDA_BaseStructs, starting with
|
||||
* deletes each item in a linked list of EDA_BaseStructs, starting with
|
||||
* "this" object.
|
||||
*/
|
||||
void DeleteStructList();
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
#if defined (DEBUG)
|
||||
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* of nesting of this object within the overall tree.
|
||||
* @param os The ostream& to output to.
|
||||
*/
|
||||
virtual void Show( int nestLevel, std::ostream& os );
|
||||
virtual void Show( int nestLevel, std::ostream& os );
|
||||
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Function NestedSpace
|
||||
* outputs nested space for pretty indenting.
|
||||
* @param nestLevel The nest count
|
||||
* @param os The ostream&, where to output
|
||||
* @return std::ostream& - for continuation.
|
||||
**/
|
||||
static std::ostream& NestedSpace( int nestLevel, std::ostream& os );
|
||||
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 );
|
||||
|
@ -392,54 +409,60 @@ public:
|
|||
* @return bool - true if a hit, else false
|
||||
*/
|
||||
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();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class BOARD_ITEM
|
||||
* is a base class for any item which can be embedded within the BOARD
|
||||
* container class, and therefore instances of derived classes should only be
|
||||
* found in PCBNEW or other programs that use class BOARD and its contents.
|
||||
* container class, and therefore instances of derived classes should only be
|
||||
* found in PCBNEW or other programs that use class BOARD and its contents.
|
||||
* The corresponding class in EESCHEMA seems to be DrawPartStruct.
|
||||
*/
|
||||
class BOARD_ITEM : public EDA_BaseStruct
|
||||
{
|
||||
protected:
|
||||
int m_Layer;
|
||||
int m_Layer;
|
||||
|
||||
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; }
|
||||
|
||||
|
||||
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; }
|
||||
|
||||
/**
|
||||
* Function GetLayer
|
||||
* returns the layer this item is on.
|
||||
*/
|
||||
int GetLayer() const { return m_Layer; }
|
||||
|
||||
int GetLayer() const { return m_Layer; }
|
||||
|
||||
/**
|
||||
* Function SetLayer
|
||||
* sets the layer this item is on.
|
||||
* @param aLayer The layer number.
|
||||
*/
|
||||
void SetLayer( int aLayer ) { m_Layer = aLayer; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function IsOnLayer
|
||||
|
@ -454,7 +477,7 @@ public:
|
|||
return m_Layer == aLayer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function IsLocked
|
||||
* @return bool - true if the object is locked, else false
|
||||
|
@ -480,9 +503,9 @@ public:
|
|||
{
|
||||
UnLink();
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function MenuText
|
||||
* returns the text to use in any menu type UI control which must uniquely
|
||||
|
@ -491,27 +514,25 @@ public:
|
|||
* @return wxString
|
||||
* @todo: maybe: make this virtual and split into each derived class
|
||||
*/
|
||||
wxString MenuText( const BOARD* aBoard ) const;
|
||||
wxString MenuText( const BOARD* aBoard ) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function MenuIcon
|
||||
* @return const char** - The XPM to use in any UI control which can help
|
||||
* identify this item.
|
||||
* @todo: make this virtual and split into each derived class
|
||||
*/
|
||||
const char** MenuIcon() const;
|
||||
const char** MenuIcon() const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
virtual bool Save( FILE* aFile ) const = 0;
|
||||
|
||||
|
||||
*/
|
||||
virtual bool Save( FILE* aFile ) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -555,14 +576,14 @@ public:
|
|||
|
||||
public:
|
||||
EDA_Rect() { };
|
||||
|
||||
|
||||
wxPoint Centre()
|
||||
{
|
||||
return wxPoint( m_Pos.x + (m_Size.x >> 1), m_Pos.y + (m_Size.y >> 1) );
|
||||
}
|
||||
|
||||
|
||||
void Normalize(); // Ensure the height and width are >= 0
|
||||
void Normalize(); // Ensure the height and width are >= 0
|
||||
bool Inside( const wxPoint& point ); // Return TRUE if point is in Rect
|
||||
|
||||
bool Inside( int x, int y ) { return Inside( wxPoint( x, y ) ); }
|
||||
|
|
|
@ -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:
|
||||
|
|
129
kicad/kicad.h
129
kicad/kicad.h
|
@ -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,9 +40,9 @@ 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;
|
||||
int m_CommandWin_Height;
|
||||
|
||||
|
@ -50,8 +52,8 @@ private:
|
|||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
WinEDA_MainFrame( WinEDA_App * eda_app, wxWindow * parent, const wxString &title,
|
||||
const wxPoint &pos, const wxSize &size );
|
||||
WinEDA_MainFrame( WinEDA_App* eda_app, wxWindow* parent, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size );
|
||||
|
||||
~WinEDA_MainFrame();
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -83,18 +84,16 @@ public:
|
|||
|
||||
boost::python::object GetPrjName() const;
|
||||
|
||||
WinEDA_MainFrame( const WinEDA_MainFrame & ) {}
|
||||
|
||||
WinEDA_MainFrame() {}
|
||||
|
||||
WinEDA_MainFrame( const WinEDA_MainFrame& ) { }
|
||||
|
||||
WinEDA_MainFrame() { }
|
||||
|
||||
boost::python::object ToWx();
|
||||
void AddFastLaunchPy( boost::python::object& button );
|
||||
WinEDA_PrjFrame* GetTree() const;
|
||||
|
||||
#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;
|
||||
bool m_IsRootFile; // True if m_Filename is a root schematic (same name as project)
|
||||
wxString m_FileName; // Filename for a file, or directory name
|
||||
|
||||
private:
|
||||
wxTreeCtrl* m_Parent;
|
||||
|
@ -132,29 +167,35 @@ private:
|
|||
public:
|
||||
|
||||
TreePrjItemData( TreeFileType type, const wxString& data, wxTreeCtrl* parent );
|
||||
TreePrjItemData() : m_Parent( NULL ) {}
|
||||
|
||||
TreePrjItemData( const TreePrjItemData &src ) :
|
||||
m_Type( src.m_Type ),
|
||||
m_FileName( src.m_FileName ),
|
||||
m_Parent( src.m_Parent )
|
||||
TreePrjItemData() : m_Parent( NULL ) { }
|
||||
|
||||
TreePrjItemData( const TreePrjItemData& src ) :
|
||||
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 );
|
||||
|
@ -167,7 +208,8 @@ public:
|
|||
{
|
||||
return &m_fileMenu;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SetState( int state );
|
||||
|
||||
#ifdef KICAD_PYTHON
|
||||
|
@ -183,14 +225,16 @@ public:
|
|||
#endif
|
||||
};
|
||||
|
||||
/* Fenetre d'affichage des fichiers du projet */
|
||||
/** class WinEDA_PrjFrame
|
||||
* Window to display the tree files
|
||||
*/
|
||||
class WinEDA_PrjFrame : public wxSashLayoutWindow
|
||||
{
|
||||
private:
|
||||
|
||||
std::vector<wxMenu*> m_ContextMenus;
|
||||
std::vector<wxString> m_Filters;
|
||||
|
||||
|
||||
wxMenu* m_PopupMenu;
|
||||
wxCursor m_DragCursor;
|
||||
wxCursor m_Default;
|
||||
|
@ -210,8 +254,8 @@ public:
|
|||
public:
|
||||
static wxString GetFileExt( TreeFileType type );
|
||||
|
||||
WinEDA_PrjFrame( WinEDA_MainFrame * parent,
|
||||
const wxPoint &pos, const wxSize &size );
|
||||
WinEDA_PrjFrame( WinEDA_MainFrame* parent,
|
||||
const wxPoint& pos, const wxSize& size );
|
||||
~WinEDA_PrjFrame() { }
|
||||
void OnSelect( wxTreeEvent& Event );
|
||||
void OnRenameAsk( wxTreeEvent& Event );
|
||||
|
@ -243,16 +287,21 @@ 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 );
|
||||
boost::python::object GetMenuPy( TreeFileType );
|
||||
|
||||
boost::python::object GetFtExPy( TreeFileType ) const;
|
||||
boost::python::object GetFtExPy( TreeFileType ) const;
|
||||
|
||||
void RemoveFilterPy( const boost::python::str& filter );
|
||||
void AddFilter( const boost::python::str& filter );
|
||||
|
@ -261,8 +310,8 @@ public:
|
|||
TreePrjItemData* GetItemData( const boost::python::object& item );
|
||||
void AddFilePy( const boost::python::str& name, boost::python::object& root );
|
||||
void NewFilePy( const boost::python::str& name,
|
||||
TreeFileType type,
|
||||
boost::python::object& root );
|
||||
TreeFileType type,
|
||||
boost::python::object& root );
|
||||
|
||||
TreePrjItemData* FindItemData( const boost::python::str& name );
|
||||
|
||||
|
@ -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,7 +342,9 @@ public:
|
|||
{
|
||||
return m_Parent;
|
||||
}
|
||||
WinEDA_TreePrj( WinEDA_PrjFrame * parent );
|
||||
|
||||
|
||||
WinEDA_TreePrj( WinEDA_PrjFrame* parent );
|
||||
~WinEDA_TreePrj();
|
||||
private:
|
||||
/* overlayed sort function */
|
||||
|
@ -303,10 +356,10 @@ eda_global wxString g_SchematicRootFileName;
|
|||
eda_global wxString g_BoardFileName;
|
||||
|
||||
#ifdef MAIN
|
||||
wxString g_SchExtBuffer( wxT( ".sch" ) );
|
||||
wxString g_BoardExtBuffer( wxT( ".brd" ) );
|
||||
wxString g_NetlistExtBuffer( wxT( ".net" ) );
|
||||
wxString g_GerberExtBuffer( wxT( ".pho" ) );
|
||||
wxString g_SchExtBuffer( wxT( ".sch" ) );
|
||||
wxString g_BoardExtBuffer( wxT( ".brd" ) );
|
||||
wxString g_NetlistExtBuffer( wxT( ".net" ) );
|
||||
wxString g_GerberExtBuffer( wxT( ".pho" ) );
|
||||
|
||||
#else
|
||||
eda_global wxString g_SchExtBuffer;
|
||||
|
|
|
@ -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