Commit b5781155 authored by CHARRAS's avatar CHARRAS

create commandframe.cpp in kicad and some other minor changes

parent 9fe9fc7c
......@@ -4,6 +4,12 @@ Started 2007-June-11
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
......
This diff is collapsed.
......@@ -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;
}
/*****************************************************/
/* 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,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;
......
This diff is collapsed.
......@@ -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
......
This diff is collapsed.
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment