mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Compare commits
5 Commits
2d7bf7340b
...
100a6db92e
Author | SHA1 | Date | |
---|---|---|---|
|
100a6db92e | ||
|
18b56539a6 | ||
|
9b006c4f3b | ||
|
8035a66152 | ||
|
d9e2bb00be |
@ -327,7 +327,9 @@ class INFOBAR_REPORTER : public REPORTER
|
||||
{
|
||||
public:
|
||||
INFOBAR_REPORTER( WX_INFOBAR* aInfoBar ) :
|
||||
REPORTER(), m_messageSet( false ), m_infoBar( aInfoBar ),
|
||||
REPORTER(),
|
||||
m_messageSet( false ),
|
||||
m_infoBar( aInfoBar ),
|
||||
m_severity( RPT_SEVERITY_UNDEFINED )
|
||||
{
|
||||
}
|
||||
|
@ -54,6 +54,56 @@ void TEMPLATE_SELECTION_PANEL::AddTemplateWidget( TEMPLATE_WIDGET* aTemplateWidg
|
||||
}
|
||||
|
||||
|
||||
// Sort the widgets alphabetically, leaving Default at the top
|
||||
void TEMPLATE_SELECTION_PANEL::SortAlphabetically()
|
||||
{
|
||||
std::vector<TEMPLATE_WIDGET*> sortedList;
|
||||
TEMPLATE_WIDGET* default_temp = nullptr;
|
||||
size_t count = m_SizerChoice->GetItemCount();
|
||||
|
||||
if( count <= 1 )
|
||||
return;
|
||||
|
||||
for( size_t idx = 0; idx < count; idx++ )
|
||||
{
|
||||
wxSizerItem* item = m_SizerChoice->GetItem( idx );
|
||||
if( item && item->IsWindow() )
|
||||
{
|
||||
TEMPLATE_WIDGET* temp = static_cast<TEMPLATE_WIDGET*>( item->GetWindow() );
|
||||
|
||||
const wxString title = *temp->GetTemplate()->GetTitle();
|
||||
|
||||
if( default_temp == nullptr && title.CmpNoCase( "default" ) == 0 )
|
||||
default_temp = temp;
|
||||
else
|
||||
sortedList.push_back( temp );
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(
|
||||
sortedList.begin(), sortedList.end(),
|
||||
[]( TEMPLATE_WIDGET* aWidgetA, TEMPLATE_WIDGET* aWidgetB ) -> bool
|
||||
{
|
||||
const wxString* a = aWidgetA->GetTemplate()->GetTitle();
|
||||
const wxString* b = aWidgetB->GetTemplate()->GetTitle();
|
||||
|
||||
return ( *a ).CmpNoCase( *b ) < 0;
|
||||
});
|
||||
|
||||
m_SizerChoice->Clear( false );
|
||||
|
||||
if( default_temp != nullptr )
|
||||
m_SizerChoice->Add( default_temp );
|
||||
|
||||
for (TEMPLATE_WIDGET* temp : sortedList)
|
||||
{
|
||||
m_SizerChoice->Add( temp );
|
||||
}
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
||||
TEMPLATE_WIDGET::TEMPLATE_WIDGET( wxWindow* aParent, DIALOG_TEMPLATE_SELECTOR* aDialog ) :
|
||||
TEMPLATE_WIDGET_BASE( aParent )
|
||||
{
|
||||
@ -337,6 +387,7 @@ void DIALOG_TEMPLATE_SELECTOR::buildPageContent( const wxString& aPath, int aPag
|
||||
}
|
||||
}
|
||||
|
||||
m_panels[aPage]->SortAlphabetically();
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,8 @@ public:
|
||||
|
||||
void AddTemplateWidget( TEMPLATE_WIDGET* aTemplateWidget );
|
||||
|
||||
void SortAlphabetically();
|
||||
|
||||
protected:
|
||||
wxNotebookPage* m_parent;
|
||||
wxString m_templatesPath; ///< the path to access to the folder
|
||||
|
@ -55,8 +55,8 @@
|
||||
|
||||
#define RESOLVE_PAGE( T, pageIndex ) static_cast<T*>( m_treebook->ResolvePage( pageIndex ) )
|
||||
|
||||
DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
|
||||
PAGED_DIALOG( aFrame, _( "Board Setup" ), false, false,
|
||||
DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame, wxWindow* aParent ) :
|
||||
PAGED_DIALOG( aParent ? aParent : aFrame, _( "Board Setup" ), false, false,
|
||||
_( "Import Settings from Another Board..." ), wxSize( 980, 600 ) ),
|
||||
m_frame( aFrame ),
|
||||
m_layers( nullptr ),
|
||||
|
@ -42,7 +42,7 @@ class PANEL_TEXT_VARIABLES;
|
||||
class DIALOG_BOARD_SETUP : public PAGED_DIALOG
|
||||
{
|
||||
public:
|
||||
DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame );
|
||||
DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame, wxWindow* aWindow = nullptr );
|
||||
~DIALOG_BOARD_SETUP();
|
||||
|
||||
protected:
|
||||
|
@ -303,7 +303,7 @@ void DIALOG_DRC::OnMenu( wxCommandEvent& event )
|
||||
|
||||
void DIALOG_DRC::OnErrorLinkClicked( wxHtmlLinkEvent& event )
|
||||
{
|
||||
m_frame->ShowBoardSetupDialog( _( "Custom Rules" ) );
|
||||
m_frame->ShowBoardSetupDialog( _( "Custom Rules" ), this );
|
||||
}
|
||||
|
||||
|
||||
@ -993,7 +993,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
||||
}
|
||||
|
||||
case ID_EDIT_SEVERITIES:
|
||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
|
||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ), this );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1035,7 +1035,7 @@ void DIALOG_DRC::OnIgnoredItemRClick( wxListEvent& event )
|
||||
|
||||
void DIALOG_DRC::OnEditViolationSeverities( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
|
||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ), this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -527,10 +527,9 @@ void DRC_ENGINE::loadRules( const wxFileName& aPath )
|
||||
void DRC_ENGINE::compileRules()
|
||||
{
|
||||
if( m_logReporter )
|
||||
{
|
||||
m_logReporter->Report( ( wxString::Format( wxT( "Compiling Rules (%d rules): " ),
|
||||
(int) m_rules.size() ) ) );
|
||||
}
|
||||
m_logReporter->Report( wxT( "Compiling Rules" ) );
|
||||
|
||||
REPORTER error_semaphore;
|
||||
|
||||
for( std::shared_ptr<DRC_RULE>& rule : m_rules )
|
||||
{
|
||||
@ -539,9 +538,12 @@ void DRC_ENGINE::compileRules()
|
||||
if( rule->m_Condition && !rule->m_Condition->GetExpression().IsEmpty() )
|
||||
{
|
||||
condition = rule->m_Condition;
|
||||
condition->Compile( nullptr );
|
||||
condition->Compile( &error_semaphore );
|
||||
}
|
||||
|
||||
if( error_semaphore.HasMessageOfSeverity( RPT_SEVERITY_ERROR ) )
|
||||
THROW_PARSE_ERROR( wxT( "Parse error" ), rule->m_Name, rule->m_Condition->GetExpression(), 0, 0 );
|
||||
|
||||
for( const DRC_CONSTRAINT& constraint : rule->m_Constraints )
|
||||
{
|
||||
if( !m_constraintMap.count( constraint.m_Type ) )
|
||||
@ -594,6 +596,8 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
|
||||
}
|
||||
catch( PARSE_ERROR& original_parse_error )
|
||||
{
|
||||
m_rules.clear();
|
||||
|
||||
try // try again with just our implicit rules
|
||||
{
|
||||
loadImplicitRules();
|
||||
|
@ -109,6 +109,7 @@
|
||||
#include <widgets/pcb_net_inspector_panel.h>
|
||||
#include <widgets/wx_aui_utils.h>
|
||||
#include <kiplatform/app.h>
|
||||
#include <kiplatform/ui.h>
|
||||
#include <core/profile.h>
|
||||
#include <math/box2_minmax.h>
|
||||
#include <view/wx_view_controls.h>
|
||||
@ -1466,7 +1467,7 @@ void PCB_EDIT_FRAME::ActivateGalCanvas()
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
|
||||
void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, wxWindow* aParent )
|
||||
{
|
||||
static std::mutex dialogMutex; // Local static mutex
|
||||
|
||||
@ -1486,7 +1487,7 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
|
||||
// Make sure everything's up-to-date
|
||||
GetBoard()->BuildListOfNets();
|
||||
|
||||
DIALOG_BOARD_SETUP dlg( this );
|
||||
DIALOG_BOARD_SETUP dlg( this, aParent );
|
||||
|
||||
if( !aInitialPage.IsEmpty() )
|
||||
dlg.SetInitialPage( aInitialPage, wxEmptyString );
|
||||
|
@ -301,7 +301,7 @@ public:
|
||||
///< @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||
void ActivateGalCanvas() override;
|
||||
|
||||
void ShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString );
|
||||
void ShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString, wxWindow* aParent = nullptr );
|
||||
|
||||
void PrepareLayerIndicator( bool aForceRebuild = false );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user