Launcher tweaks

This commit is contained in:
Jon Evans 2021-02-13 08:59:21 -05:00
parent c69cdaff7c
commit e06aa32780
11 changed files with 57 additions and 158 deletions

View File

@ -42,8 +42,10 @@ BITMAP_BUTTON::BITMAP_BUTTON( wxWindow* aParent, wxWindowID aId, const wxPoint&
Bind( wxEVT_PAINT, &BITMAP_BUTTON::OnPaint, this );
Bind( wxEVT_LEFT_UP, &BITMAP_BUTTON::OnLeftButtonUp, this );
Bind( wxEVT_LEFT_DOWN, &BITMAP_BUTTON::OnLeftButtonDown, this );
Bind( wxEVT_LEAVE_WINDOW, &BITMAP_BUTTON::OnMouseLeave, this );
Bind( wxEVT_ENTER_WINDOW, &BITMAP_BUTTON::OnMouseEnter, this );
Bind( wxEVT_LEAVE_WINDOW, &BITMAP_BUTTON::OnLeave, this );
Bind( wxEVT_ENTER_WINDOW, &BITMAP_BUTTON::OnEnter, this );
Bind( wxEVT_KILL_FOCUS, &BITMAP_BUTTON::OnLeave, this );
Bind( wxEVT_SET_FOCUS, &BITMAP_BUTTON::OnEnter, this );
}
@ -74,7 +76,7 @@ void BITMAP_BUTTON::SetDisabledBitmap( const wxBitmap& aBmp )
}
void BITMAP_BUTTON::OnMouseLeave( wxMouseEvent& aEvent )
void BITMAP_BUTTON::OnLeave( wxEvent& aEvent )
{
clearFlag( wxCONTROL_CURRENT );
Refresh();
@ -83,7 +85,7 @@ void BITMAP_BUTTON::OnMouseLeave( wxMouseEvent& aEvent )
}
void BITMAP_BUTTON::OnMouseEnter( wxMouseEvent& aEvent )
void BITMAP_BUTTON::OnEnter( wxEvent& aEvent )
{
setFlag( wxCONTROL_CURRENT );
Refresh();

View File

@ -80,8 +80,8 @@ public:
void Check( bool aCheck = true );
protected:
void OnMouseLeave( wxMouseEvent& aEvent );
void OnMouseEnter( wxMouseEvent& aEvent );
void OnLeave( wxEvent& aEvent );
void OnEnter( wxEvent& aEvent );
void OnLeftButtonUp( wxMouseEvent& aEvent );
void OnLeftButtonDown( wxMouseEvent& aEvent );
void OnPaint( wxPaintEvent& aEvent );

View File

@ -33,8 +33,6 @@ public:
void CreateLaunchers();
wxTextCtrl* GetMessagesBox() const { return m_messagesBox; }
private:
TOOL_MANAGER* m_toolManager;

View File

@ -11,6 +11,9 @@
PANEL_KICAD_LAUNCHER_BASE::PANEL_KICAD_LAUNCHER_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_mainSizer = new wxBoxSizer( wxVERTICAL );
m_toolsSizer = new wxGridBagSizer( 5, 20 );
@ -23,21 +26,13 @@ PANEL_KICAD_LAUNCHER_BASE::PANEL_KICAD_LAUNCHER_BASE( wxWindow* parent, wxWindow
m_mainSizer->Add( 0, 20, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerMessages;
sbSizerMessages = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages") ), wxVERTICAL );
m_messagesBox = new wxTextCtrl( sbSizerMessages->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_messagesBox->SetMinSize( wxSize( -1,60 ) );
sbSizerMessages->Add( m_messagesBox, 1, wxALL|wxEXPAND, 5 );
bSizer2->Add( m_mainSizer, 1, wxEXPAND|wxLEFT, 50 );
m_mainSizer->Add( sbSizerMessages, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
this->SetSizer( m_mainSizer );
this->SetSizer( bSizer2 );
this->Layout();
m_mainSizer->Fit( this );
bSizer2->Fit( this );
}
PANEL_KICAD_LAUNCHER_BASE::~PANEL_KICAD_LAUNCHER_BASE()

View File

@ -51,110 +51,43 @@
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_mainSizer</property>
<property name="name">bSizer2</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size"></property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">20</property>
<property name="minimum_size"></property>
<property name="name">m_toolsSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_NONE</property>
<property name="permission">protected</property>
<property name="vgap">5</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">20</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="border">50</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Messages</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">sbSizerMessages</property>
<property name="name">m_mainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,60</property>
<property name="moveable">1</property>
<property name="name">m_messagesBox</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="proportion">0</property>
<object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size"></property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">20</property>
<property name="minimum_size"></property>
<property name="name">m_toolsSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_NONE</property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_MULTILINE|wxTE_READONLY</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="vgap">5</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">20</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object>

View File

@ -12,14 +12,12 @@
#include <wx/intl.h>
#include <wx/gdicmn.h>
#include <wx/gbsizer.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/panel.h>
#include <wx/string.h>
///////////////////////////////////////////////////////////////////////////
@ -34,7 +32,6 @@ class PANEL_KICAD_LAUNCHER_BASE : public wxPanel
protected:
wxBoxSizer* m_mainSizer;
wxGridBagSizer* m_toolsSizer;
wxTextCtrl* m_messagesBox;
public:

View File

@ -85,7 +85,7 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event )
return;
}
WX_TEXT_CTRL_REPORTER reporter( m_launcher->GetMessagesBox() );
STATUSBAR_REPORTER reporter( GetStatusBar() );
PROJECT_ARCHIVER archiver;
@ -126,8 +126,7 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
if( !dir.IsOpened() ) // wxWidgets display a error message on issue.
return;
WX_TEXT_CTRL_REPORTER reporter( m_launcher->GetMessagesBox() );
STATUSBAR_REPORTER reporter( GetStatusBar() );
PROJECT_ARCHIVER archiver;
archiver.Archive( currdirname, zipFile.GetFullPath(), reporter, true, true );

View File

@ -55,8 +55,6 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( wxString aWindowTitle, wxString
wxString default_dir = GetMruPath();
int style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
ClearMsg();
wxFileDialog schdlg( this, aWindowTitle, default_dir, wxEmptyString, aFilesWildcard, style );
if( schdlg.ShowModal() == wxID_CANCEL )

View File

@ -106,10 +106,10 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
m_aboutTitle = "KiCad";
// Create the status line (bottom of the frame)
static const int dims[3] = { -1, -1, 100 };
static const int dims[1] = { -1 };
CreateStatusBar( 3 );
SetStatusWidths( 3, dims );
CreateStatusBar( 1 );
SetStatusWidths( 1, dims );
// Give an icon
wxIcon icon;
@ -152,7 +152,8 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
.MinSize( m_leftWinWidth, -1 ).BestSize( m_leftWinWidth, -1 ) );
m_auimgr.AddPane( m_launcher,
EDA_PANE().Canvas().PaneBorder( false ).Name( "Launcher" ).Center() );
EDA_PANE().Canvas().PaneBorder( false ).Name( "Launcher" ).Center()
.MinSize( m_launcher->GetBestSize() ) );
m_auimgr.Update();
@ -164,6 +165,9 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
// Do not let the messages window have initial focus
m_leftWin->SetFocus();
// Do not let our size hide the launcher
SetMinSize( GetBestSize() );
// Ensure the window is on top
Raise();
}
@ -311,12 +315,6 @@ wxString KICAD_MANAGER_FRAME::help_name()
}
void KICAD_MANAGER_FRAME::PrintMsg( const wxString& aText )
{
m_launcher->GetMessagesBox()->AppendText( aText );
}
void KICAD_MANAGER_FRAME::OnSize( wxSizeEvent& event )
{
if( m_auimgr.GetManagedWindow() )
@ -402,7 +400,7 @@ bool KICAD_MANAGER_FRAME::CloseProject( bool aSave )
mgr.UnloadProject( &Prj() );
}
ClearMsg();
SetStatusText( "" );
m_leftWin->EmptyTreePrj();
@ -619,12 +617,6 @@ void KICAD_MANAGER_FRAME::ProjectChanged()
}
void KICAD_MANAGER_FRAME::ClearMsg()
{
m_launcher->GetMessagesBox()->Clear();
}
void KICAD_MANAGER_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_BASE_FRAME::LoadSettings( aCfg );
@ -658,8 +650,7 @@ void KICAD_MANAGER_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
void KICAD_MANAGER_FRAME::PrintPrjInfo()
{
wxString msg = wxString::Format( _( "Project name:\n%s\n" ), GetProjectFileName() );
PrintMsg( msg );
SetStatusText( wxString::Format( _( "Project: %s" ), Prj().GetProjectFullName() ) );
}

View File

@ -95,23 +95,11 @@ public:
*/
void OnImportEagleFiles( wxCommandEvent& event );
/**
* Displays \a aText in the text panel.
*
* @param aText The text to display.
*/
void PrintMsg( const wxString& aText );
/**
* Prints the current working directory name and the project name on the text panel.
*/
void PrintPrjInfo();
/**
* Erase the text panel.
*/
void ClearMsg();
void RefreshProjectTree();
/**

View File

@ -232,8 +232,6 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
return -1;
}
m_frame->ClearMsg();
// Make sure we are not overwriting anything in the destination folder.
std::vector< wxFileName > destFiles;