Commit b5781155 authored by CHARRAS's avatar CHARRAS
Browse files

create commandframe.cpp in kicad and some other minor changes

parent 9fe9fc7c
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with 
Please add newer entries at the top, list the date and your name with 
email address.
email address.


2007-Oct-31 UPDATE  Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+kicad:
	rename mdiframe.cpp to mainframe.cpp
	create commandframe.cpp to handle the command frame (which have the 4 "fast launch" buttons)



2007-Oct-31 UPDATE   Dick Hollenbeck <dickelbeck@yahoo.com>
2007-Oct-31 UPDATE   Dick Hollenbeck <dickelbeck@yahoo.com>
================================================================================
================================================================================
+1 −0
Original line number Original line Diff line number Diff line
@@ -89,6 +89,7 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT


/** Send a remote command to eeschema via a socket,
/** Send a remote command to eeschema via a socket,
 * @param objectToSync = item to be located on board (footprint, pad or text)
 * @param objectToSync = item to be located on board (footprint, pad or text)
 * @param LibItem = component in lib if objectToSync is a sub item of a component
 * Commands are
 * Commands are
 * $PART: reference   put cursor on footprint anchor
 * $PART: reference   put cursor on footprint anchor
 * $PIN: number $PART: reference put cursor on the footprint pad
 * $PIN: number $PART: reference put cursor on the footprint pad
+2 −1
Original line number Original line Diff line number Diff line
@@ -67,7 +67,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
/**
/**
 * Function FindComponentAndItem
 * Function FindComponentAndItem
 * finds a Component in the schematic, and an item in this component.
 * finds a Component in the schematic, and an item in this component.
 * @param pattern The text to search for, either in value, reference or elsewhere.
 * @param component_reference The component reference to find.
 * @param text_to_find The text to search for, either in value, reference or elsewhere.
 * @param Find_in_hierarchy:  false => Search is made in current sheet
 * @param Find_in_hierarchy:  false => Search is made in current sheet
 *                     true => the whole hierarchy
 *                     true => the whole hierarchy
 * @param SearchType:  0 => find component
 * @param SearchType:  0 => find component
+140 −119
Original line number Original line Diff line number Diff line
@@ -9,13 +9,14 @@
#if defined (DEBUG)
#if defined (DEBUG)
#include <iostream>         // needed for Show()
#include <iostream>         // needed for Show()
extern std::ostream& operator   <<( std::ostream& out, const wxSize& size );
extern std::ostream& operator   <<( std::ostream& out, const wxSize& size );

extern std::ostream& operator   <<( std::ostream& out, const wxPoint& pt );
extern std::ostream& operator   <<( std::ostream& out, const wxPoint& pt );

#endif
#endif




/* Id for class identification, at run time */
/* Id for class identification, at run time */
enum KICAD_T {
enum KICAD_T {
    
    NOT_USED = -1,          // the 3d code uses this value
    NOT_USED = -1,          // the 3d code uses this value


    EOT = 0,                // search types array terminator (End Of Types)
    EOT = 0,                // search types array terminator (End Of Types)
@@ -97,7 +98,6 @@ class BOARD;
 */
 */
class INSPECTOR
class INSPECTOR
{
{
    
public:
public:
    virtual ~INSPECTOR()
    virtual ~INSPECTOR()
    {
    {
@@ -125,9 +125,14 @@ public:
/* Classes de base: servent a deriver les classes reellement utiles */
/* Classes de base: servent a deriver les classes reellement utiles */
/********************************************************************/
/********************************************************************/


class EDA_BaseStruct        /* Basic class, not directly used */
/** class EDA_BaseStruct
 * Basic class, not directly used.
 * All the kicad classes used to describe a shematic or a board item are derived from.
 */
class EDA_BaseStruct
{
{
private:
private:

    /**
    /**
     * Run time identification, _keep private_ so it can never be changed after
     * Run time identification, _keep private_ so it can never be changed after
     * a constructor sets it.  See comment near SetType() regarding virtual functions.
     * a constructor sets it.  See comment near SetType() regarding virtual functions.
@@ -197,6 +202,7 @@ public:
        return m_Status & type;
        return m_Status & type;
    }
    }



    void SetState( int type, int state )
    void SetState( int type, int state )
    {
    {
        if( state )
        if( state )
@@ -205,6 +211,7 @@ public:
            m_Status &= ~type;
            m_Status &= ~type;
    }
    }



    int ReturnStatus() const {  return m_Status;  }
    int ReturnStatus() const {  return m_Status;  }


    void SetStatus( int new_status )
    void SetStatus( int new_status )
@@ -212,6 +219,7 @@ public:
        m_Status = new_status;
        m_Status = new_status;
    }
    }



    /* addition d'une nouvelle struct a la liste chain� */
    /* addition d'une nouvelle struct a la liste chain� */
    void            AddToChain( EDA_BaseStruct* laststruct );
    void            AddToChain( EDA_BaseStruct* laststruct );


@@ -267,7 +275,9 @@ public:
     *  SEARCH_QUIT, else SCAN_CONTINUE;
     *  SEARCH_QUIT, else SCAN_CONTINUE;
     */
     */
    static SEARCH_RESULT    IterateForward( EDA_BaseStruct* listStart,
    static SEARCH_RESULT    IterateForward( EDA_BaseStruct* listStart,
        INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] );
                                            INSPECTOR*      inspector,
                                            const void*     testData,
                                            const KICAD_T   scanTypes[] );




    /**
    /**
@@ -328,7 +338,6 @@ public:
    static std::ostream&    NestedSpace( int nestLevel, std::ostream& os );
    static std::ostream&    NestedSpace( int nestLevel, std::ostream& os );


#endif
#endif

};
};




@@ -356,23 +365,27 @@ typedef enum {


#define DEFAULT_SIZE_TEXT 60        /* default text height (in mils or  1/1000") */
#define DEFAULT_SIZE_TEXT 60        /* default text height (in mils or  1/1000") */


/* classe de gestion des textes (labels, textes composants ..)
/** class EDA_TextStruct
 *  (Non utilisee seule) */
 * basic class to handle texts (labels, texts on components or footprints ..)
 * not used directly.
 * the text classes are derived from EDA_BaseStruct and EDA_TextStruct
 */
class EDA_TextStruct
class EDA_TextStruct
{
{
public:
public:
    wxString m_Text;                    /* text! */
    wxString m_Text;                    /* text! */
    wxPoint  m_Pos;                     /* XY position of anchor text. */
    wxPoint  m_Pos;                     /* XY position of anchor text. */
    wxSize   m_Size;                    /* XY size of text */
    wxSize   m_Size;                    /* XY size of text */
    int      m_Width;                   /* epaisseur du trait */
    int      m_Width;                   /* text width */
    int      m_Orient;                  /* Orient in 0.1 degrees */
    int      m_Orient;                  /* Orient in 0.1 degrees */
    int      m_Miroir;                  // Display Normal / mirror
    int      m_Miroir;                  // Display Normal / mirror
    int      m_Attributs;               /* controle visibilite */
    int      m_Attributs;               /* flags (visible...) */
    int      m_CharType;                /* normal, bold, italic ... */
    int      m_CharType;                /* normal, bold, italic ... */
    int      m_HJustify, m_VJustify;    /* Justifications Horiz et Vert du texte */
    int      m_HJustify, m_VJustify;    /* Horiz and  Vert Justifications */
    int      m_ZoomLevelDrawable;       /* Niveau de zoom acceptable pour affichage normal */
    int      m_ZoomLevelDrawable;       /* zoom level to draw text.
    int*     m_TextDrawings;            /* pointeur sur la liste des segments de dessin */
                                          * if zoom < m_ZoomLevelDrawable: the text is drawn as a single line */
    int      m_TextDrawingsSize;        /* nombre de segments a dessiner */
    int*     m_TextDrawings;            /* list of segments to draw, for the Draw function */
    int      m_TextDrawingsSize;        /* segment count */


public:
public:
    EDA_TextStruct( const wxString& text = wxEmptyString );
    EDA_TextStruct( const wxString& text = wxEmptyString );
@@ -380,7 +393,11 @@ public:
    void    CreateDrawData();
    void    CreateDrawData();


    int     GetLength() { return m_Text.Length(); };
    int     GetLength() { return m_Text.Length(); };
    int     Pitch();/* retourne le pas entre 2 caracteres */

    /** Function Pitch()
     * @return distance between 2 caracteres
     */
    int     Pitch();
    void    Draw( WinEDA_DrawPanel* panel, wxDC* DC,
    void    Draw( WinEDA_DrawPanel* panel, wxDC* DC,
                  const wxPoint& offset, int color,
                  const wxPoint& offset, int color,
                  int draw_mode, int display_mode = FILAIRE, int anchor_color = -1 );
                  int draw_mode, int display_mode = FILAIRE, int anchor_color = -1 );
@@ -393,7 +410,11 @@ public:
     */
     */
    bool    HitTest( const wxPoint& ref_pos );
    bool    HitTest( const wxPoint& ref_pos );


    int     Len_Size(); // Return the text lenght in internal units
    /**
     * Function Len_Size
     * Return the text lenght in internal units
     */
    int     Len_Size();
};
};




@@ -412,17 +433,19 @@ protected:
public:
public:


    BOARD_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) :
    BOARD_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) :
        EDA_BaseStruct( StructFather, idtype ),
        EDA_BaseStruct( StructFather, idtype )
        m_Layer(0)
        , m_Layer( 0 )
    {
    {
    }
    }



    BOARD_ITEM( const BOARD_ITEM& src ) :
    BOARD_ITEM( const BOARD_ITEM& src ) :
        EDA_BaseStruct( src.m_Parent, src.Type() ),
        EDA_BaseStruct( src.m_Parent, src.Type() )
        m_Layer( src.m_Layer )
        , m_Layer( src.m_Layer )
    {
    {
    }
    }



    BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
    BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
    BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
    BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
    BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
    BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
@@ -510,8 +533,6 @@ public:
     * @return bool - true if success writing else false.
     * @return bool - true if success writing else false.
     */
     */
    virtual bool    Save( FILE* aFile ) const = 0;
    virtual bool    Save( FILE* aFile ) const = 0;
    
    
};
};




+0 −42
Original line number Original line Diff line number Diff line
@@ -278,45 +278,3 @@ void WinEDA_MainFrame::RecreateBaseHToolbar()
    m_HToolBar->Realize();
    m_HToolBar->Realize();
}
}
/*************************************************/
void WinEDA_MainFrame::CreateCommandToolbar()
/*************************************************/
{
    wxBitmapButton * btn;

    // delete and recreate the toolbar
    if( m_VToolBar ) return;
    btn = new wxBitmapButton( this, ID_TO_EESCHEMA, BITMAP(icon_eeschema_xpm) );
    btn->SetToolTip(_("eeschema (Schematic editor)"));
    AddFastLaunch( btn );

    btn = new wxBitmapButton( this,ID_TO_CVPCB, BITMAP(icon_cvpcb_xpm) );
    btn->SetToolTip(_("cvpcb (Components to modules)"));
    AddFastLaunch( btn );

    btn = new wxBitmapButton( this, ID_TO_PCB, BITMAP(a_icon_pcbnew_xpm) );
    btn->SetToolTip(_("pcbnew (PCB editor)"));
    AddFastLaunch( btn );

    btn = new wxBitmapButton( this, ID_TO_GERBVIEW, BITMAP(icon_gerbview_xpm) );
    btn->SetToolTip(_("gerbview (Gerber viewer)"));
    AddFastLaunch( btn );


    // Set up toolbar

    #ifdef KICAD_PYTHON
    btn = new wxBitmapButton( this, ID_RUN_PYTHON, BITMAP(icon_python_xpm) );
    btn->SetToolTip(_("Run Python Script"));
    AddFastLaunch( btn );
    #endif
}

void WinEDA_MainFrame::AddFastLaunch( wxButton * button, int sep )
{
    static wxPoint pos (20, 20);
    button->Reparent( m_CommandWin );
    button->Move( pos );
    pos.x += button->GetSize().GetWidth() + sep;
}
Loading