Get it working for SCH_TEXT with infobar error message

This commit is contained in:
Roberto Fernandez Bautista 2022-07-22 22:34:52 -04:00 committed by Jeff Young
parent 212864306c
commit 72e39fc865
4 changed files with 22 additions and 12 deletions

View File

@ -405,7 +405,9 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
if( !m_currentText->ValidateHyperlink( m_hyperlinkCtrl->GetValue() ) )
{
DisplayError( this, _( "Invalid hyperlink destination (URL)." ) );
DisplayError( this, _( "Invalid hyperlink destination. Please enter either a valid URL "
"(e.g. file:// or http(s)://) or \"goto:<page sequence>\" to create "
"a hyperlink to a page in this schematic." ) );
return false;
}
else

View File

@ -92,7 +92,7 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
bSizer11->Add( 10, 0, 0, wxEXPAND, 5 );
m_hyperlinkDestinationLabel = new wxStaticText( this, wxID_ANY, _("Destination (URL):"), wxDefaultPosition, wxDefaultSize, 0 );
m_hyperlinkDestinationLabel = new wxStaticText( this, wxID_ANY, _("Destination:"), wxDefaultPosition, wxDefaultSize, 0 );
m_hyperlinkDestinationLabel->Wrap( -1 );
m_hyperlinkDestinationLabel->Enable( false );
@ -100,7 +100,7 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
m_hyperlinkCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_hyperlinkCtrl->Enable( false );
m_hyperlinkCtrl->SetToolTip( _("Please enter a file:// or http(s):// URL") );
m_hyperlinkCtrl->SetToolTip( _("Please enter either a valid URL (e.g. file:// or http(s)://) or \"goto:<page sequence>\" to create a hyperlink to a page in this schematic.") );
bSizer11->Add( m_hyperlinkCtrl, 10, wxALL, 5 );

View File

@ -468,7 +468,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Destination (URL):</property>
<property name="label">Destination:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -550,7 +550,7 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Please enter a file:// or http(s):// URL</property>
<property name="tooltip">Please enter either a valid URL (e.g. file:// or http(s)://) or &quot;goto:&lt;page sequence&gt;&quot; to create a hyperlink to a page in this schematic.</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>

View File

@ -408,15 +408,23 @@ void SCH_TEXT::DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) const
sheetNames[sheet.GetVirtualPageNumber()] = sheet.Last()->GetName();
}
menu.Append( 0, wxString::Format( _( "Go to Page %s (%s)" ),
sheetPages[destPage],
sheetNames[destPage] ) );
if( sheetPages.count( destPage ) > 0 )
{
menu.Append( 0, wxString::Format( _( "Go to Page %s (%s)" ),
sheetPages[destPage],
sheetNames[destPage] ) );
int sel = aFrame->GetPopupMenuSelectionFromUser( menu );
void* param = &sheetPages[destPage];
int sel = aFrame->GetPopupMenuSelectionFromUser( menu );
void* param = &sheetPages[destPage];
if( param )
aFrame->GetToolManager()->RunAction( EE_ACTIONS::hypertextCommand, true, param );
if( param )
aFrame->GetToolManager()->RunAction( EE_ACTIONS::hypertextCommand, true, param );
}
else
{
aFrame->ShowInfoBarError( wxString::Format( _( "Page sequence '%d' does not exist." ),
destPage ) );
}
}
else
{