Commit 9aa4fb69 authored by jean-pierre charras's avatar jean-pierre charras

Cvpcb: force project name in stand alone mode, to allow access to project fp...

Cvpcb: force project name in stand alone mode, to allow access to project fp lib table. In project mode: disable the read netlist option (the netlist is read when Cvpcb is started by eeschema)
Dialog fp lib table editor: now shows the table full filenames, to help users.
parent 6ba5e406
...@@ -438,25 +438,39 @@ void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event ) ...@@ -438,25 +438,39 @@ void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
{ {
if( aFileSet.size() == 1 ) if( aFileSet.size() != 1 ) // Unexpected comand
{ return false;
m_NetlistFileName = aFileSet[0];
ReadNetListAndLinkFiles();
UpdateTitle(); m_NetlistFileName = aFileSet[0];
ReadNetListAndLinkFiles();
// Resize the components list box. This is needed in case the UpdateTitle();
// contents have shrunk compared to the previous netlist.
m_compListBox->UpdateWidth();
// OSX need it since some objects are "rebuild" just make aware AUI // Resize the components list box. This is needed in case the
// Fixes #1258081 // contents have shrunk compared to the previous netlist.
m_auimgr.Update(); m_compListBox->UpdateWidth();
// OSX need it since some objects are "rebuild" just make aware AUI
// Fixes #1258081
m_auimgr.Update();
return true; if( Kiface().IsSingle() )
{
// PROJECT::SetProjectFullName() is an impactful function. It should only be
// called under carefully considered circumstances.
// The calling code should know not to ask me here to change projects unless
// it knows what consequences that will have on other KIFACEs running and using
// this same PROJECT. It can be very harmful if that calling code is stupid.
//
// In Cvpcb, we call SetProjectFullName only in Single mode, i.e. it is not
// called from a project
wxFileName pro = m_NetlistFileName;
pro.SetExt( ProjectFileExtension );
Prj().SetProjectFullName( pro.GetFullPath() );
} }
return false; return true;
} }
......
...@@ -64,50 +64,49 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() ...@@ -64,50 +64,49 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Menu File: // Menu File:
wxMenu* filesMenu = new wxMenu; wxMenu* filesMenu = new wxMenu;
// Open // Open files can be used only outside a project, because opening a netlist
AddMenuItem( filesMenu, // which is not the project netlist is a non sense.
ID_LOAD_PROJECT, if( Kiface().IsSingle() )
_( "&Open Netlist" ), LOAD_FILE_HELP, KiBitmap( open_document_xpm ) ); {
AddMenuItem( filesMenu, ID_LOAD_PROJECT,
_( "&Open Netlist" ), LOAD_FILE_HELP, KiBitmap( open_document_xpm ) );
// Open Recent submenu // Open Recent submenu
static wxMenu* openRecentMenu; static wxMenu* openRecentMenu;
// Add this menu to list menu managed by m_fileHistory // Add this menu to list menu managed by m_fileHistory
// (the file history will be updated when adding/removing files in history // (the file history will be updated when adding/removing files in history
if( openRecentMenu ) if( openRecentMenu )
Kiface().GetFileHistory().RemoveMenu( openRecentMenu ); Kiface().GetFileHistory().RemoveMenu( openRecentMenu );
openRecentMenu = new wxMenu(); openRecentMenu = new wxMenu();
Kiface().GetFileHistory().UseMenu( openRecentMenu ); Kiface().GetFileHistory().UseMenu( openRecentMenu );
Kiface().GetFileHistory().AddFilesToMenu(); Kiface().GetFileHistory().AddFilesToMenu();
AddMenuItem( filesMenu, openRecentMenu, -1, AddMenuItem( filesMenu, openRecentMenu, -1,
_( "Open &Recent" ), _( "Open &Recent" ),
_( "Open recent netlist" ), _( "Open recent netlist" ),
KiBitmap( open_project_xpm ) ); KiBitmap( open_project_xpm ) );
// Separator // Separator
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
}
// Save the .cmp file // Save the .cmp file
AddMenuItem( filesMenu, AddMenuItem( filesMenu, wxID_SAVE,
wxID_SAVE,
_( "&Save\tCtrl+S" ), SAVE_HLP_MSG, KiBitmap( save_xpm ) ); _( "&Save\tCtrl+S" ), SAVE_HLP_MSG, KiBitmap( save_xpm ) );
// Save as the .cmp file // Save as the .cmp file
AddMenuItem( filesMenu, AddMenuItem( filesMenu, wxID_SAVEAS,
wxID_SAVEAS,
_( "Save &As...\tCtrl+Shift+S" ), SAVE_AS_HLP_MSG, KiBitmap( save_xpm ) ); _( "Save &As...\tCtrl+Shift+S" ), SAVE_AS_HLP_MSG, KiBitmap( save_xpm ) );
// Separator // Separator
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
// Quit // Quit
AddMenuItem( filesMenu, AddMenuItem( filesMenu, wxID_EXIT,
wxID_EXIT, _( "&Quit" ), _( "Quit CvPcb" ),
_( "&Quit" ),
_( "Quit CvPcb" ),
KiBitmap( exit_xpm ) ); KiBitmap( exit_xpm ) );
// Menu Preferences: // Menu Preferences:
......
...@@ -49,8 +49,13 @@ void CVPCB_MAINFRAME::ReCreateHToolbar() ...@@ -49,8 +49,13 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxEmptyString, // Open files can be used only outside a project, because opening a netlist
KiBitmap( open_document_xpm ), LOAD_FILE_HELP ); // which is not the project netlist is a non sense.
if( Kiface().IsSingle() )
{
m_mainToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxEmptyString,
KiBitmap( open_document_xpm ), LOAD_FILE_HELP );
}
m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ), SAVE_HLP_MSG ); m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ), SAVE_HLP_MSG );
......
...@@ -295,6 +295,10 @@ public: ...@@ -295,6 +295,10 @@ public:
m_global( aGlobal ), m_global( aGlobal ),
m_project( aProject ) m_project( aProject )
{ {
// For user info, shows the table filenames:
m_PrjTableFilename->SetLabel( Prj().FootprintLibTblName() );
m_GblTableFilename->SetLabel( FP_LIB_TABLE::GetGlobalTableFileName() );
// wxGrid only supports user owned tables if they exist past end of ~wxGrid(), // wxGrid only supports user owned tables if they exist past end of ~wxGrid(),
// so make it a grid owned table. // so make it a grid owned table.
m_global_grid->SetTable( new FP_TBL_MODEL( *aGlobal ), true ); m_global_grid->SetTable( new FP_TBL_MODEL( *aGlobal ), true );
......
...@@ -24,6 +24,22 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID ...@@ -24,6 +24,22 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* m_global_sizer; wxBoxSizer* m_global_sizer;
m_global_sizer = new wxBoxSizer( wxVERTICAL ); m_global_sizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 1, 2, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText3 = new wxStaticText( m_global_panel, wxID_ANY, _("Table:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer1->Add( m_staticText3, 0, wxRIGHT|wxLEFT, 5 );
m_GblTableFilename = new wxStaticText( m_global_panel, wxID_ANY, _("Table Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_GblTableFilename->Wrap( -1 );
fgSizer1->Add( m_GblTableFilename, 0, wxRIGHT|wxLEFT, 5 );
m_global_sizer->Add( fgSizer1, 0, wxEXPAND, 5 );
m_global_grid = new wxGrid( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_global_grid = new wxGrid( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid // Grid
...@@ -60,6 +76,22 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID ...@@ -60,6 +76,22 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* m_project_sizer; wxBoxSizer* m_project_sizer;
m_project_sizer = new wxBoxSizer( wxVERTICAL ); m_project_sizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 1, 2, 0, 0 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText4 = new wxStaticText( m_project_panel, wxID_ANY, _("Table:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
fgSizer2->Add( m_staticText4, 0, wxRIGHT|wxLEFT, 5 );
m_PrjTableFilename = new wxStaticText( m_project_panel, wxID_ANY, _("Table Name"), wxDefaultPosition, wxDefaultSize, 0 );
m_PrjTableFilename->Wrap( -1 );
fgSizer2->Add( m_PrjTableFilename, 0, wxRIGHT|wxLEFT, 5 );
m_project_sizer->Add( fgSizer2, 0, wxEXPAND, 5 );
m_project_grid = new wxGrid( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_project_grid = new wxGrid( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid // Grid
......
This diff is collapsed.
...@@ -14,13 +14,14 @@ ...@@ -14,13 +14,14 @@
class DIALOG_SHIM; class DIALOG_SHIM;
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/font.h> #include <wx/stattext.h>
#include <wx/grid.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/grid.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/image.h> #include <wx/image.h>
...@@ -43,8 +44,12 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM ...@@ -43,8 +44,12 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
protected: protected:
wxAuiNotebook* m_auinotebook; wxAuiNotebook* m_auinotebook;
wxPanel* m_global_panel; wxPanel* m_global_panel;
wxStaticText* m_staticText3;
wxStaticText* m_GblTableFilename;
wxGrid* m_global_grid; wxGrid* m_global_grid;
wxPanel* m_project_panel; wxPanel* m_project_panel;
wxStaticText* m_staticText4;
wxStaticText* m_PrjTableFilename;
wxGrid* m_project_grid; wxGrid* m_project_grid;
wxButton* m_append_button; wxButton* m_append_button;
wxButton* m_buttonWizard; wxButton* m_buttonWizard;
......
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