Move hypertext linking to user-page-numbers.

Also moves most navigation code to SCH_NAVIGATION_TOOL.
Also changes page number href to anchor syntax ('#foo').
Also adds hypertext processing to SCH_TEXTBOXes.
Also adds combobox with schematic pages to text properties dialog.
This commit is contained in:
Jeff Young 2022-08-27 19:14:57 +01:00
parent 516c4cb2d3
commit 122a6d7f46
40 changed files with 505 additions and 556 deletions

View File

@ -983,33 +983,19 @@ bool EDA_TEXT::ValidateHyperlink( const wxString& aURL )
{
wxURL url;
return aURL.IsEmpty() || url.SetURL( aURL ) == wxURL_NOERR || IsGotoPageHyperlink( aURL );
return aURL.IsEmpty() || url.SetURL( aURL ) == wxURL_NOERR || IsGotoPageHref( aURL );
}
bool EDA_TEXT::IsGotoPageHyperlink( const wxString& aURL, int* aDestination )
bool EDA_TEXT::IsGotoPageHref( const wxString& aHref, wxString* aDestination )
{
wxString dest;
if( !aURL.StartsWith( "goto:", &dest ) )
return false;
long num;
bool retval = dest.ToLong( &num );
if( !retval || num < 0 )
return false;
if( aDestination )
*aDestination = static_cast<int>( num );
return true;
return aHref.StartsWith( wxT( "#" ), aDestination );
}
wxString EDA_TEXT::GotoPageHyperlinkString( const int& aDestination )
wxString EDA_TEXT::GotoPageHref( const wxString& aDestination )
{
return wxString::Format( "goto:%d", aDestination );
return wxT( "#" ) + aDestination;
}

View File

@ -170,7 +170,7 @@ void DXF_PLOTTER::SetViewport( const VECTOR2I& aOffset, double aIusPerDecimil,
}
bool DXF_PLOTTER::StartPlot()
bool DXF_PLOTTER::StartPlot( const wxString& aPageNumber )
{
wxASSERT( m_outputFile );

View File

@ -234,7 +234,7 @@ void GERBER_PLOTTER::formatNetAttribute( GBR_NETLIST_METADATA* aData )
}
bool GERBER_PLOTTER::StartPlot()
bool GERBER_PLOTTER::StartPlot( const wxString& aPageNumber )
{
m_hasApertureRoundRect = false; // true is at least one round rect aperture is in use
m_hasApertureRotOval = false; // true is at least one oval rotated aperture is in use

View File

@ -255,7 +255,7 @@ void HPGL_PLOTTER::SetTargetChordLength( double chord_len )
}
bool HPGL_PLOTTER::StartPlot()
bool HPGL_PLOTTER::StartPlot( const wxString& aPageNumber )
{
wxASSERT( m_outputFile );
fprintf( m_outputFile, "IN;VS%d;PU;PA;SP%d;\n", m_penSpeed, m_penNumber );

View File

@ -34,7 +34,7 @@
#include <wx/zstream.h>
#include <advanced_config.h>
#include <eda_text.h> // for IsGotoPageHyperlink
#include <eda_text.h> // for IsGotoPageHref
#include <ignore.h>
#include <macros.h>
#include <trigo.h>
@ -670,11 +670,13 @@ void PDF_PLOTTER::closePdfStream()
}
void PDF_PLOTTER::StartPage()
void PDF_PLOTTER::StartPage( const wxString& aPageNumber )
{
wxASSERT( m_outputFile );
wxASSERT( !m_workFile );
m_pageNumbers.push_back( aPageNumber );
// Compute the paper size in IUs
m_paperSize = m_pageInfo.GetSizeMils();
m_paperSize.x *= 10.0 / m_iuPerDeviceUnit;
@ -701,11 +703,9 @@ void PDF_PLOTTER::ClosePage()
// Close the page stream (and compress it)
closePdfStream();
/* Page size is in 1/72 of inch (default user space units)
Works like the bbox in postscript but there is no need for
swapping the sizes, since PDF doesn't require a portrait page.
We use the MediaBox but PDF has lots of other less used boxes
to use */
// Page size is in 1/72 of inch (default user space units). Works like the bbox in postscript
// but there is no need for swapping the sizes, since PDF doesn't require a portrait page.
// We use the MediaBox but PDF has lots of other less-used boxes that could be used.
const double PTsPERMIL = 0.072;
VECTOR2D psPaperSize = VECTOR2D( m_pageInfo.GetSizeMils() ) * PTsPERMIL;
@ -720,29 +720,8 @@ void PDF_PLOTTER::ClosePage()
// Handle annotations (at the moment only "link" type objects)
std::vector<int> hyperlinkHandles;
// Write out all hyperlinks for the page as annotation links
/*
for( const std::pair<BOX2I, wxString>& linkPair : m_urlHyperlinks )
{
const BOX2I& box = linkPair.first;
const wxString& url = linkPair.second;
VECTOR2D bottomLeft = iuToPdfUserSpace( box.GetPosition() );
VECTOR2D topRight = iuToPdfUserSpace( box.GetEnd() );
hyperlinkHandles.push_back( startPdfObject() );
fprintf( m_outputFile,
"<< /Type /Annot\n"
" /Subtype /Link\n"
" /Rect[%g %g %g %g] /Border[16 16 1]\n"
" /A << /Type /Action /S /URI /URI %s >>\n"
">>\n",
bottomLeft.x, bottomLeft.y, topRight.x, topRight.y,
encodeStringForPlotter( url ).c_str() );
closePdfObject();
}*/
// Allocate all hyperlink objects for the page and calculate their position in user space coordinates
// Allocate all hyperlink objects for the page and calculate their position in user space
// coordinates
for( const std::pair<BOX2I, wxString>& linkPair : m_hyperlinksInPage )
{
const BOX2I& box = linkPair.first;
@ -768,11 +747,16 @@ void PDF_PLOTTER::ClosePage()
hyperLinkArrayHandle = startPdfObject();
bool isFirst = true;
fprintf( m_outputFile, "[%d 0 R", hyperlinkHandles[0] );
fputs( "[", m_outputFile );
for( auto it = hyperlinkHandles.begin() + 1; it != hyperlinkHandles.end(); ++it )
for( int handle : hyperlinkHandles )
{
fprintf( m_outputFile, " %d 0 R", *it );
if( isFirst )
isFirst = false;
else
fprintf( m_outputFile, " " );
fprintf( m_outputFile, "%d 0 R", handle );
}
fputs( "]\n", m_outputFile );
@ -812,7 +796,7 @@ void PDF_PLOTTER::ClosePage()
}
bool PDF_PLOTTER::StartPlot()
bool PDF_PLOTTER::StartPlot( const wxString& aPageNumber )
{
wxASSERT( m_outputFile );
@ -837,7 +821,7 @@ bool PDF_PLOTTER::StartPlot()
/* Now, the PDF is read from the end, (more or less)... so we start
with the page stream for page 1. Other more important stuff is written
at the end */
StartPage();
StartPage( aPageNumber );
return true;
}
@ -873,7 +857,6 @@ bool PDF_PLOTTER::EndPlot()
"<< /BaseFont %s\n"
" /Type /Font\n"
" /Subtype /Type1\n"
/* Adobe is so Mac-based that the nearest thing to Latin1 is
the Windows ANSI encoding! */
" /Encoding /WinAnsiEncoding\n"
@ -895,9 +878,9 @@ bool PDF_PLOTTER::EndPlot()
fputs( ">>\n", m_outputFile );
closePdfObject();
for( const std::pair<int,std::pair<BOX2D, wxString>>& handlePair : m_hyperlinkHandles )
for( const std::pair<const int, std::pair<BOX2D, wxString>>& handlePair : m_hyperlinkHandles )
{
const int& linkhandle = handlePair.first;
const int& linkhandle = handlePair.first;
const std::pair<BOX2D, wxString>& linkpair = handlePair.second;
const BOX2D& box = linkpair.first;
const wxString& url = linkpair.second;
@ -907,22 +890,30 @@ bool PDF_PLOTTER::EndPlot()
fprintf( m_outputFile,
"<< /Type /Annot\n"
" /Subtype /Link\n"
" /Rect[%g %g %g %g] /Border[16 16 1]\n",
" /Rect [%g %g %g %g]\n"
" /Border [16 16 0]\n",
box.GetLeft(), box.GetBottom(), box.GetRight(), box.GetTop() );
int pageIdx = -1;
wxString pageNumber;
bool pageFound = false;
if( EDA_TEXT::IsGotoPageHyperlink( url, &pageIdx ) )
if( EDA_TEXT::IsGotoPageHref( url, &pageNumber ) )
{
if( pageIdx <= m_pageHandles.size() && pageIdx > 0 )
for( size_t ii = 0; ii < m_pageNumbers.size(); ++ii )
{
fprintf( m_outputFile,
" /Dest [%d 0 R] >>\n"
">>\n",
m_pageHandles[pageIdx - 1] );
//todo: do we want to support specifying zoom factor/ position? e.g. /FitR
if( m_pageNumbers[ii] == pageNumber )
{
fprintf( m_outputFile,
" /Dest [%d 0 R /FitB] >>\n"
">>\n",
m_pageHandles[ii] );
pageFound = true;
break;
}
}
else
if( !pageFound )
{
// destination page is not being plotted, assign the NOP action to the link
fprintf( m_outputFile,

View File

@ -762,7 +762,7 @@ void PS_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
}
bool PS_PLOTTER::StartPlot()
bool PS_PLOTTER::StartPlot( const wxString& aPageNumber )
{
wxASSERT( m_outputFile );
@ -893,12 +893,14 @@ bool PS_PLOTTER::StartPlot()
fputs( PSMacro[ii], m_outputFile );
}
// The following string has been specified here (rather than within
// PSMacro[]) to highlight that it has been provided to ensure that the
// contents of the postscript file comply with the details specified
// within the Document Structuring Convention.
fputs( "%%Page: 1 1\n"
"%%BeginPageSetup\n"
// The following strings are output here (rather than within PSMacro[])
// to highlight that it has been provided to ensure that the contents of
// the postscript file comply with the Document Structuring Convention.
std::string page_num = encodeStringForPlotter( aPageNumber );
fprintf( m_outputFile, "%%Page: %s 1\n", page_num.c_str() );
fputs( "%%BeginPageSetup\n"
"gsave\n"
"0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
"linemode1\n", m_outputFile );

View File

@ -711,7 +711,7 @@ void SVG_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
}
bool SVG_PLOTTER::StartPlot()
bool SVG_PLOTTER::StartPlot( const wxString& aPageNumber )
{
wxASSERT( m_outputFile );

View File

@ -38,7 +38,6 @@
*/
#include <trigo.h>
#include <eda_item.h>
#include <plotters/plotter.h>
#include <geometry/shape_line_chain.h>
#include <bezier_curves.h>

View File

@ -565,7 +565,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetDXF( const wxString& aFileName,
LOCALE_IO toggle;
plotter->StartPlot();
plotter->StartPlot( m_parent->GetCurrentSheet().GetPageNumber() );
if( aPlotFrameRef )
{
@ -756,7 +756,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl( const wxString& aFileName,
// Pen num and pen speed are not initialized here.
// Default HPGL driver values are used
plotter->SetPenDiameter( m_HPGLPenSize );
plotter->StartPlot();
plotter->StartPlot( m_parent->GetCurrentSheet().GetPageNumber() );
if( aPlotFrameRef )
{
@ -846,7 +846,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotDrawingSheet
// Open the plotter and do the first page
setupPlotPagePDF( plotter, screen );
plotter->StartPlot();
plotter->StartPlot( sheetList[i].GetPageNumber() );
}
catch( const IO_ERROR& e )
{
@ -865,7 +865,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotDrawingSheet
* reconfigure, and then start a new one */
plotter->ClosePage();
setupPlotPagePDF( plotter, screen );
plotter->StartPage();
plotter->StartPage( sheetList[i].GetPageNumber() );
}
plotOneSheetPDF( plotter, screen, aPlotDrawingSheet );
@ -1088,7 +1088,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
LOCALE_IO toggle; // Switch the locale to standard C
plotter->StartPlot();
plotter->StartPlot( m_parent->GetCurrentSheet().GetPageNumber() );
if( m_plotBackgroundColor->GetValue() && plotter->GetColorMode() )
{
@ -1221,7 +1221,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
LOCALE_IO toggle;
plotter->StartPlot();
plotter->StartPlot( m_parent->GetCurrentSheet().GetPageNumber() );
if( m_plotBackgroundColor->GetValue() && plotter->GetColorMode() )
{

View File

@ -126,6 +126,21 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITE
m_separator3->SetIsSeparator();
SCH_SHEET_LIST sheetList = m_frame->Schematic().GetSheets();
sheetList.SortByPageNumbers( false );
for( const SCH_SHEET_PATH& sheet : sheetList )
{
wxString sheetPageNum = sheet.GetPageNumber();
wxString sheetName = sheet.size() == 1 ? _( "<root sheet>" ) : sheet.Last()->GetName();
m_hyperlinkCtrl->Append( wxString::Format( _( "Page %s (%s)" ), sheetPageNum, sheetName ) );
m_pageNumbers.push_back( sheetPageNum );
}
m_hyperlinkCtrl->Append( wxT( "---------------------" ) );
m_hyperlinkCtrl->Append( wxT( "http(s)://..." ) );
SetupStandardButtons();
Layout();
@ -159,7 +174,6 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
SCHEMATIC& schematic = m_frame->Schematic();
m_hyperlinkCb->SetValue( m_currentText->HasHyperlink() );
m_hyperlinkDestinationLabel->Enable( m_currentText->HasHyperlink() );
m_hyperlinkCtrl->Enable( m_currentText->HasHyperlink() );
m_hyperlinkCtrl->SetValue( m_currentText->GetHyperlink() );
@ -241,7 +255,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
}
void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& event )
void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& aEvent )
{
bool border = m_borderCheckbox->GetValue();
@ -256,7 +270,7 @@ void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& event )
}
void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& event )
void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& aEvent )
{
bool fill = m_filledCtrl->GetValue();
@ -267,16 +281,16 @@ void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& event )
void DIALOG_TEXT_PROPERTIES::onHyperlinkChecked( wxCommandEvent& aEvent )
{
if( aEvent.IsChecked() )
if( aEvent.IsChecked() && !m_hyperlinkCtrl->IsEnabled() )
{
m_hyperlinkCtrl->Enable( true );
m_hyperlinkDestinationLabel->Enable( true );
m_hyperlinkCtrl->ChangeValue( m_lastLink );
m_hyperlinkCtrl->SetFocus();
}
else
else if( !aEvent.IsChecked() && m_hyperlinkCtrl->IsEnabled() )
{
m_hyperlinkCtrl->Enable( false );
m_hyperlinkDestinationLabel->Enable( false );
m_lastLink = m_hyperlinkCtrl->GetValue();
m_hyperlinkCtrl->SetValue( wxEmptyString );
}
@ -284,6 +298,42 @@ void DIALOG_TEXT_PROPERTIES::onHyperlinkChecked( wxCommandEvent& aEvent )
}
void DIALOG_TEXT_PROPERTIES::onHyperlinkDropdown( wxCommandEvent& aEvent )
{
m_lastLink = m_hyperlinkCtrl->GetValue();
}
void DIALOG_TEXT_PROPERTIES::onHyperlinkCombo( wxCommandEvent& aEvent )
{
size_t sel = aEvent.GetSelection();
if( sel < 0 )
{
// user clicked outside dropdown; leave current value
}
else if( sel == m_hyperlinkCtrl->GetCount() - 2 )
{
// separator (and wxWidgets already updated our value to it);
// replace value with that saved in the dropdown event
m_hyperlinkCtrl->ChangeValue( m_lastLink );
m_hyperlinkCtrl->SetSelection( 0, m_hyperlinkCtrl->GetValue().Length() );
}
else if( sel == m_hyperlinkCtrl->GetCount() - 1 )
{
static wxString helper = wxT( "https://" );
m_hyperlinkCtrl->ChangeValue( helper );
m_hyperlinkCtrl->SetInsertionPointEnd();
}
else
{
m_hyperlinkCtrl->ChangeValue( wxT( "#" ) + m_pageNumbers[ sel ] );
m_hyperlinkCtrl->SetSelection( 0, m_hyperlinkCtrl->GetValue().Length() );
}
}
void DIALOG_TEXT_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
{
wxStyledTextCtrl* te = m_textCtrl;
@ -406,7 +456,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
if( !m_currentText->ValidateHyperlink( m_hyperlinkCtrl->GetValue() ) )
{
DisplayError( this, _( "Invalid hyperlink destination. Please enter either a valid URL "
"(e.g. file:// or http(s)://) or \"goto:<page sequence>\" to create "
"(e.g. file:// or http(s)://) or \"#<page number>\" to create "
"a hyperlink to a page in this schematic." ) );
return false;
}

View File

@ -44,9 +44,11 @@ public:
private:
void onScintillaCharAdded( wxStyledTextEvent &aEvent );
void onSpinButton( wxCommandEvent &aEvent );
void onBorderChecked( wxCommandEvent& event ) override;
void onFillChecked( wxCommandEvent& event ) override;
void onBorderChecked( wxCommandEvent& aEvent ) override;
void onFillChecked( wxCommandEvent& aEvent ) override;
void onHyperlinkChecked( wxCommandEvent& aEvent ) override;
void onHyperlinkDropdown( wxCommandEvent& aEvent ) override;
void onHyperlinkCombo( wxCommandEvent& aEvent ) override;
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;
void onMultiLineTCLostFocus( wxFocusEvent& event ) override;
@ -60,8 +62,11 @@ private:
UNIT_BINDER m_textSize;
UNIT_BINDER m_borderWidth;
SCINTILLA_TRICKS* m_scintillaTricks;
std::vector<wxString> m_pageNumbers;
HTML_MESSAGE_BOX* m_helpWindow;
wxString m_lastLink;
};

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -81,41 +81,15 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
m_textEntrySizer->Add( bSizer41, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_RIGHT|wxLEFT, 80 );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxHORIZONTAL );
m_hyperlinkCb = new wxCheckBox( this, wxID_ANY, _("Hyperlink"), wxDefaultPosition, wxDefaultSize, 0 );
m_hyperlinkCb->SetToolTip( _("Make this text item a clickable hyperlink") );
bSizer11->Add( m_hyperlinkCb, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizer11->Add( 10, 0, 0, wxEXPAND, 5 );
m_hyperlinkDestinationLabel = new wxStaticText( this, wxID_ANY, _("Destination:"), wxDefaultPosition, wxDefaultSize, 0 );
m_hyperlinkDestinationLabel->Wrap( -1 );
m_hyperlinkDestinationLabel->Enable( false );
bSizer11->Add( m_hyperlinkDestinationLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_hyperlinkCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_hyperlinkCtrl->Enable( false );
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 );
m_textEntrySizer->Add( bSizer11, wxGBPosition( 2, 0 ), wxGBSpan( 1, 6 ), wxEXPAND, 5 );
m_fontLabel = new wxStaticText( this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
m_fontLabel->Wrap( -1 );
m_textEntrySizer->Add( m_fontLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
m_textEntrySizer->Add( m_fontLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
wxString m_fontCtrlChoices[] = { _("Default Font"), _("KiCad Font") };
int m_fontCtrlNChoices = sizeof( m_fontCtrlChoices ) / sizeof( wxString );
m_fontCtrl = new FONT_CHOICE( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fontCtrlNChoices, m_fontCtrlChoices, 0 );
m_fontCtrl->SetSelection( 0 );
m_textEntrySizer->Add( m_fontCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 5 );
m_textEntrySizer->Add( m_fontCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 5 );
wxBoxSizer* bSizeCtrlSizer;
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
@ -176,11 +150,11 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
bSizeCtrlSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 3, 3 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP, 5 );
m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 2, 3 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP, 5 );
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeLabel->Wrap( -1 );
m_textEntrySizer->Add( m_textSizeLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( m_textSizeLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer71;
bSizer71 = new wxBoxSizer( wxHORIZONTAL );
@ -213,14 +187,14 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
bSizer71->Add( m_panelBorderColor1, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer71, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_textEntrySizer->Add( bSizer71, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_borderCheckbox = new wxCheckBox( this, wxID_ANY, _("Border"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 6, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 2 );
m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 5, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 2 );
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
@ -253,19 +227,19 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer7, wxGBPosition( 7, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_textEntrySizer->Add( bSizer7, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderStyleLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_borderStyleCombo->SetMinSize( wxSize( 240,-1 ) );
m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 8, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 7, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_filledCtrl = new wxCheckBox( this, wxID_ANY, _("Background fill"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 6, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 80 );
m_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 5, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 80 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
@ -288,12 +262,21 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
bSizer8->Add( m_panelFillColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer8, wxGBPosition( 7, 4 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_textEntrySizer->Add( bSizer8, wxGBPosition( 6, 4 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_hyperlinkCb = new wxCheckBox( this, wxID_ANY, _("Link:"), wxDefaultPosition, wxDefaultSize, 0 );
m_hyperlinkCb->SetValue(true);
m_hyperlinkCb->SetToolTip( _("Make this text item a clickable hyperlink") );
m_textEntrySizer->Add( m_hyperlinkCb, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
m_hyperlinkCtrl = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_textEntrySizer->Add( m_hyperlinkCtrl, wxGBPosition( 9, 1 ), wxGBSpan( 1, 6 ), wxEXPAND|wxBOTTOM, 5 );
m_textEntrySizer->AddGrowableCol( 3 );
bMainSizer->Add( m_textEntrySizer, 1, wxEXPAND|wxALL, 10 );
bMainSizer->Add( m_textEntrySizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
@ -311,18 +294,21 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
bSizer4->Add( m_sdbSizer1, 1, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bSizer4, 0, wxEXPAND|wxALL, 5 );
bMainSizer->Add( bSizer4, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_textCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
m_syntaxHelp->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnFormattingHelp ), NULL, this );
m_hyperlinkCb->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onHyperlinkChecked ), NULL, this );
m_borderCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_filledCtrl->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onFillChecked ), NULL, this );
m_hyperlinkCb->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onHyperlinkChecked ), NULL, this );
m_hyperlinkCtrl->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onHyperlinkCombo ), NULL, this );
m_hyperlinkCtrl->Connect( wxEVT_COMBOBOX_DROPDOWN, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onHyperlinkDropdown ), NULL, this );
}
DIALOG_TEXT_PROPERTIES_BASE::~DIALOG_TEXT_PROPERTIES_BASE()
@ -330,8 +316,10 @@ DIALOG_TEXT_PROPERTIES_BASE::~DIALOG_TEXT_PROPERTIES_BASE()
// Disconnect Events
m_textCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
m_syntaxHelp->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnFormattingHelp ), NULL, this );
m_hyperlinkCb->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onHyperlinkChecked ), NULL, this );
m_borderCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_filledCtrl->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onFillChecked ), NULL, this );
m_hyperlinkCb->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onHyperlinkChecked ), NULL, this );
m_hyperlinkCtrl->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onHyperlinkCombo ), NULL, this );
m_hyperlinkCtrl->Disconnect( wxEVT_COMBOBOX_DROPDOWN, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onHyperlinkDropdown ), NULL, this );
}

View File

@ -47,7 +47,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_TEXT_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">778,449</property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Text Properties</property>
@ -123,7 +123,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size">-1,-1</property>
@ -278,16 +278,16 @@
<property name="flag">wxEXPAND|wxALIGN_RIGHT|wxLEFT</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer41</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">6</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxHyperlinkCtrl" expanded="1">
<object class="wxHyperlinkCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -349,226 +349,12 @@
</object>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">6</property>
<property name="column">0</property>
<property name="flag">wxEXPAND</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer11</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" 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="checked">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="label">Hyperlink</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_hyperlinkCb</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></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"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Make this text item a clickable hyperlink</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="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onHyperlinkChecked</event>
</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">0</property>
<property name="permission">protected</property>
<property name="width">10</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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">0</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="label">Destination:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_hyperlinkDestinationLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></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"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">10</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">0</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">0</property>
<property name="min_size">-1,-1</property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_hyperlinkCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></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">-1,-1</property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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>
<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>
</object>
</object>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP</property>
<property name="row">3</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -632,7 +418,7 @@
<property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP</property>
<property name="row">3</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
@ -699,9 +485,9 @@
<property name="colspan">2</property>
<property name="column">3</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="row">3</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizeCtrlSizer</property>
<property name="orient">wxHORIZONTAL</property>
@ -1071,11 +857,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1290,11 +1076,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxBitmapButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1516,7 +1302,7 @@
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">4</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -1580,18 +1366,18 @@
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxEXPAND</property>
<property name="row">4</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer71</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1651,11 +1437,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1712,11 +1498,11 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">15</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1773,21 +1559,21 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">5</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxPanel" expanded="1">
<object class="wxPanel" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1838,16 +1624,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxBORDER_SIMPLE|wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer22</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="CustomControl" expanded="1">
<object class="CustomControl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -1915,7 +1701,7 @@
<property name="colspan">2</property>
<property name="column">0</property>
<property name="flag">wxBOTTOM</property>
<property name="row">6</property>
<property name="row">5</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -1983,7 +1769,7 @@
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">7</property>
<property name="row">6</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -2047,18 +1833,18 @@
<property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxEXPAND</property>
<property name="row">7</property>
<property name="row">6</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer7</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -2118,11 +1904,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -2179,11 +1965,11 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">15</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -2240,21 +2026,21 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">5</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxPanel" expanded="1">
<object class="wxPanel" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -2305,7 +2091,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxBORDER_SIMPLE|wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer2</property>
<property name="orient">wxVERTICAL</property>
@ -2382,7 +2168,7 @@
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="row">8</property>
<property name="row">7</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -2446,7 +2232,7 @@
<property name="colspan">2</property>
<property name="column">1</property>
<property name="flag">wxEXPAND</property>
<property name="row">8</property>
<property name="row">7</property>
<property name="rowspan">1</property>
<object class="wxBitmapComboBox" expanded="1">
<property name="BottomDockable">1</property>
@ -2514,7 +2300,7 @@
<property name="colspan">2</property>
<property name="column">4</property>
<property name="flag">wxRIGHT</property>
<property name="row">6</property>
<property name="row">5</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -2582,18 +2368,18 @@
<property name="colspan">2</property>
<property name="column">4</property>
<property name="flag">wxEXPAND</property>
<property name="row">7</property>
<property name="row">6</property>
<property name="rowspan">1</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer8</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -2650,11 +2436,11 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxPanel" expanded="1">
<object class="wxPanel" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -2705,16 +2491,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxBORDER_SIMPLE|wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer21</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="CustomControl" expanded="1">
<object class="CustomControl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -2777,6 +2563,144 @@
</object>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM</property>
<property name="row">9</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" 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="checked">1</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="label">Link:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_hyperlinkCb</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></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"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Make this text item a clickable hyperlink</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="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onHyperlinkChecked</event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">6</property>
<property name="column">1</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="row">9</property>
<property name="rowspan">1</property>
<object class="wxComboBox" 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="choices"></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="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_hyperlinkCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></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>
<event name="OnCombobox">onHyperlinkCombo</event>
<event name="OnComboboxDropdown">onHyperlinkDropdown</event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
@ -2839,7 +2763,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -26,16 +26,17 @@ class WX_INFOBAR;
#include <wx/stc/stc.h>
#include <wx/hyperlink.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/textctrl.h>
#include <wx/choice.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/textctrl.h>
#include <wx/panel.h>
#include <wx/checkbox.h>
#include <wx/bmpcbox.h>
#include <wx/combobox.h>
#include <wx/gbsizer.h>
#include <wx/statline.h>
#include <wx/dialog.h>
@ -55,9 +56,6 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_textLabel;
wxStyledTextCtrl* m_textCtrl;
wxHyperlinkCtrl* m_syntaxHelp;
wxCheckBox* m_hyperlinkCb;
wxStaticText* m_hyperlinkDestinationLabel;
wxTextCtrl* m_hyperlinkCtrl;
wxStaticText* m_fontLabel;
FONT_CHOICE* m_fontCtrl;
BITMAP_BUTTON* m_separator1;
@ -90,6 +88,8 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_fillColorLabel;
wxPanel* m_panelFillColor;
COLOR_SWATCH* m_fillColorSwatch;
wxCheckBox* m_hyperlinkCb;
wxComboBox* m_hyperlinkCtrl;
wxStaticLine* m_staticline;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
@ -98,14 +98,16 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
// Virtual event handlers, override them in your derived class
virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void OnFormattingHelp( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void onHyperlinkChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onFillChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onHyperlinkChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onHyperlinkCombo( wxCommandEvent& event ) { event.Skip(); }
virtual void onHyperlinkDropdown( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 778,449 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_TEXT_PROPERTIES_BASE();

View File

@ -736,7 +736,7 @@ void SCH_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
}
void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) const
void SCH_FIELD::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const
{
constexpr int START_ID = 1;

View File

@ -89,12 +89,12 @@ public:
return false;
}
virtual bool IsHypertext() const override
bool IsHypertext() const override
{
return m_id == 0 && m_parent && m_parent->Type() == SCH_GLOBAL_LABEL_T;
}
virtual void DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) const override;
void DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const override;
/**
* Return the field name (not translated)..

View File

@ -293,6 +293,9 @@ const wxString& SCH_ITEM::GetDefaultFont() const
bool SCH_ITEM::RenderAsBitmap( double aWorldScale ) const
{
if( IsHypertext() )
return false;
if( const EDA_TEXT* text = dynamic_cast<const EDA_TEXT*>( this ) )
return text->GetTextHeight() * aWorldScale < BITMAP_FONT_SIZE_THRESHOLD;

View File

@ -236,7 +236,7 @@ public:
*/
virtual bool IsHypertext() const { return false; }
virtual void DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) const { }
virtual void DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const { }
/**
* Return the layer this item is on.

View File

@ -1837,12 +1837,6 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
return;
}
if( aText->IsHypertext() && ( aText->GetFlags() & IS_ROLLOVER ) && !drawingShadows
&& !aText->IsMoving() )
{
color = m_schSettings.GetLayerColor( LAYER_HOVERED );
}
m_gal->SetStrokeColor( color );
m_gal->SetFillColor( color );
@ -1865,6 +1859,13 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
attrs.m_Angle = aText->GetDrawRotation();
attrs.m_StrokeWidth = getTextThickness( aText );
if( aText->IsHypertext() && aText->IsRollover() )
{
m_gal->SetStrokeColor( m_schSettings.GetLayerColor( LAYER_HOVERED ) );
m_gal->SetFillColor( m_schSettings.GetLayerColor( LAYER_HOVERED ) );
attrs.m_Underlined = true;
}
// Adjust text drawn in an outline font to more closely mimic the positioning of
// SCH_FIELD text.
if( aText->GetDrawFont()->IsOutline() )
@ -1889,7 +1890,8 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
{
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
cache = aText->GetRenderCache( shownText, text_offset );
if( !aText->IsHypertext() )
cache = aText->GetRenderCache( shownText, text_offset );
if( cache )
{
@ -1922,9 +1924,17 @@ void SCH_PAINTER::draw( const SCH_TEXTBOX* aTextBox, int aLayer )
attrs.m_Angle = aTextBox->GetDrawRotation();
attrs.m_StrokeWidth = getTextThickness( aTextBox );
if( aTextBox->IsHypertext() && aTextBox->IsRollover() )
{
m_gal->SetStrokeColor( m_schSettings.GetLayerColor( LAYER_HOVERED ) );
m_gal->SetFillColor( m_schSettings.GetLayerColor( LAYER_HOVERED ) );
attrs.m_Underlined = true;
}
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
cache = aTextBox->GetRenderCache( shownText );
if( !aTextBox->IsHypertext() )
cache = aTextBox->GetRenderCache( shownText );
if( cache )
{
@ -2167,12 +2177,6 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer )
if( drawingShadows && !eeconfig()->m_Selection.draw_selected_children )
return;
if( aField->IsHypertext() && ( aField->GetFlags() & IS_ROLLOVER ) > 0
&& !drawingShadows && !aField->IsMoving() )
{
color = m_schSettings.GetLayerColor( LAYER_HOVERED );
}
// Calculate the text orientation according to the parent orientation.
EDA_ANGLE orient = aField->GetTextAngle();
@ -2230,6 +2234,13 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer )
attributes.m_StrokeWidth = getTextThickness( aField );
attributes.m_Angle = orient;
if( aField->IsHypertext() && aField->IsRollover() )
{
m_gal->SetStrokeColor( m_schSettings.GetLayerColor( LAYER_HOVERED ) );
m_gal->SetFillColor( m_schSettings.GetLayerColor( LAYER_HOVERED ) );
attributes.m_Underlined = true;
}
if( nonCached( aField ) && aField->RenderAsBitmap( m_gal->GetWorldScale() ) )
{
bitmapText( shownText, textpos, attributes );
@ -2239,7 +2250,8 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer )
{
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
cache = aField->GetRenderCache( shownText, textpos, attributes );
if( !aField->IsHypertext() )
cache = aField->GetRenderCache( shownText, textpos, attributes );
if( cache )
{

View File

@ -908,45 +908,22 @@ void SCH_SHEET::renumberPins()
}
int SCH_SHEET::guessPageFromParentScreen() const
SCH_SHEET_PATH SCH_SHEET::getSheetPath() const
{
SCH_SCREEN* parentScreen = static_cast<SCH_SCREEN*>( m_parent );
int vPageNumParent = parentScreen->GetVirtualPageNumber();
size_t vPageNumParent = parentScreen->GetVirtualPageNumber();
SCH_SHEET_LIST sheets = parentScreen->Schematic()->GetSheets();
wxCHECK( sheets.size() >= vPageNumParent && vPageNumParent > 0, m_screen->GetVirtualPageNumber() );
// We can use the virtual page number as an index to find the instance
SCH_SHEET_PATH parentSheetPath = sheets.at( vPageNumParent - 1 );
size_t parentIdx = std::max<size_t>( 0, std::min( sheets.size(), vPageNumParent ) - 1 );
SCH_SHEET_PATH sheetPath = sheets.at( parentIdx );
// Make sure our asumption about the virtual page number being the index-1 is correct
wxCHECK( parentSheetPath.LastScreen()->GetFileName() == parentScreen->GetFileName(),
m_screen->GetVirtualPageNumber() );
wxASSERT( sheetPath.LastScreen()->GetFileName() == parentScreen->GetFileName() );
KIID_PATH parentSheetKIIDPath = parentSheetPath.PathWithoutRootUuid();
sheetPath.push_back( const_cast<SCH_SHEET*>( this ) );
for( const SCH_SHEET_INSTANCE& instance : m_instances )
{
KIID_PATH instancePath = instance.m_Path;
if( instancePath.MakeRelativeTo( parentSheetKIIDPath ) && instancePath.size() == 1 )
{
// find the virtual page number of this path
auto isThePath = [&]( const SCH_SHEET_PATH& aPath ) -> bool
{
return aPath.PathWithoutRootUuid() == instance.m_Path;
};
auto result = std::find_if( sheets.begin(), sheets.end(), isThePath );
wxCHECK( result != sheets.end(), m_screen->GetVirtualPageNumber() );
return result - sheets.begin() + 1;
}
}
wxFAIL_MSG( "Couldn't find a valid path?" );
return m_screen->GetVirtualPageNumber();
return sheetPath;
}
@ -1073,7 +1050,6 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter, bool aBackground ) const
if( aBackground && !aPlotter->GetColorMode() )
return;
VECTOR2I pos;
auto* settings = dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
bool override = settings ? settings->m_OverrideItemColors : false;
COLOR4D borderColor = GetBorderColor();
@ -1102,9 +1078,9 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter, bool aBackground ) const
if( !aBackground )
{
BOX2I rect( m_pos, m_size );
int virtualPage = guessPageFromParentScreen();
wxString hyperlinkDestination = EDA_TEXT::GotoPageHyperlinkString( virtualPage );
aPlotter->HyperlinkBox( rect, hyperlinkDestination );
wxString pageNum = GetPageNumber( getSheetPath() );
aPlotter->HyperlinkBox( rect, EDA_TEXT::GotoPageHref( pageNum ) );
}
// Plot sheet pins

View File

@ -451,12 +451,12 @@ protected:
void renumberPins();
/**
* Guess the virtual page number of this sheet based on the virtual page number currently set
* Guess the sheet path of this sheet based on the virtual page number currently set
* on the parent screen. (Useful helper function for plotting)
*
* @return the instance corresponding to this sheet
*/
int guessPageFromParentScreen() const;
SCH_SHEET_PATH getSheetPath() const;
private:
bool doIsConnected( const VECTOR2I& aPosition ) const override;

View File

@ -29,7 +29,6 @@
#include <plotters/plotter.h>
#include <widgets/msgpanel.h>
#include <bitmaps.h>
#include <eda_doc.h>
#include <string_utils.h>
#include <sch_text.h>
#include <schematic.h>
@ -43,7 +42,6 @@
#include <project/net_settings.h>
#include <core/mirror.h>
#include <core/kicad_algo.h>
#include <tools/ee_actions.h>
#include <tools/sch_navigate_tool.h>
#include <trigo.h>
@ -385,55 +383,13 @@ wxString SCH_TEXT::GetShownText( int aDepth ) const
}
void SCH_TEXT::DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) const
void SCH_TEXT::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const
{
wxCHECK_MSG( IsHypertext(), /* void */,
"Calling a hypertext menu on a SCH_TEXT with no hyperlink?" );
int destPage = -1;
wxMenu menu;
if( IsGotoPageHyperlink( m_hyperlink, &destPage ) && destPage > 0 )
{
std::map<int, wxString> sheetNames;
std::map<int, wxString> sheetPages;
for( const SCH_SHEET_PATH& sheet : Schematic()->GetSheets() )
{
sheetPages[sheet.GetVirtualPageNumber()] = sheet.GetPageNumber();
if( sheet.size() == 1 )
sheetNames[sheet.GetVirtualPageNumber()] = _( "<root sheet>" );
else
sheetNames[sheet.GetVirtualPageNumber()] = sheet.Last()->GetName();
}
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 = &destPage;
if( param )
aFrame->GetToolManager()->RunAction( EE_ACTIONS::hypertextCommand, true, param );
}
else
{
aFrame->ShowInfoBarError( wxString::Format( _( "Page sequence '%d' does not exist." ),
destPage ) );
}
}
else
{
menu.Append( 1, wxString::Format( _( "Open %s" ), m_hyperlink ) );
int sel = aFrame->GetPopupMenuSelectionFromUser( menu );
if( sel == 1 )
GetAssociatedDocument( aFrame, m_hyperlink, &aFrame->Prj() );
}
SCH_NAVIGATE_TOOL* navTool = aFrame->GetToolManager()->GetTool<SCH_NAVIGATE_TOOL>();
navTool->HypertextCommand( m_hyperlink );
}

View File

@ -133,9 +133,12 @@ public:
wxString GetShownText( int aDepth = 0 ) const override;
virtual bool IsHypertext() const override { return HasHyperlink(); }
bool IsHypertext() const override
{
return HasHyperlink();
}
virtual void DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) const override;
void DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const override;
/**
* Set a spin or rotation angle, along with specific horizontal and vertical justification

View File

@ -38,6 +38,7 @@
#include <core/kicad_algo.h>
#include <trigo.h>
#include <sch_textbox.h>
#include <tools/sch_navigate_tool.h>
using KIGFX::SCH_RENDER_SETTINGS;
@ -319,6 +320,16 @@ bool SCH_TEXTBOX::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
}
void SCH_TEXTBOX::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const
{
wxCHECK_MSG( IsHypertext(), /* void */,
"Calling a hypertext menu on a SCH_TEXTBOX with no hyperlink?" );
SCH_NAVIGATE_TOOL* navTool = aFrame->GetToolManager()->GetTool<SCH_NAVIGATE_TOOL>();
navTool->HypertextCommand( m_hyperlink );
}
wxString SCH_TEXTBOX::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "Graphic Text Box" ) );

View File

@ -57,6 +57,13 @@ public:
wxString GetShownText( int aDepth = 0 ) const override;
bool IsHypertext() const override
{
return HasHyperlink();
}
void DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const override;
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override;
void SwapData( SCH_ITEM* aItem ) override;

View File

@ -57,7 +57,7 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
LOCALE_IO toggle;
plotter->StartPlot();
plotter->StartPlot( wxT( "1" ) );
if( m_symbol )
{

View File

@ -382,7 +382,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
}
else if( collector[0]->IsHypertext() )
{
collector[0]->DoHypertextMenu( m_frame );
collector[ 0 ]->DoHypertextAction( m_frame );
selCancelled = true;
}
}
@ -620,9 +620,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( rolloverItem != lastRolloverItem )
{
EDA_ITEM* item = m_frame->GetItem( lastRolloverItem );
if( item )
if( EDA_ITEM* item = m_frame->GetItem( lastRolloverItem ) )
{
item->ClearFlags( IS_ROLLOVER );
lastRolloverItem = niluuid;
@ -632,10 +630,11 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
else
m_frame->GetCanvas()->GetView()->Update( item );
}
}
item = m_frame->GetItem( rolloverItem );
if( item )
if( EDA_ITEM* item = m_frame->GetItem( rolloverItem ) )
{
if( !( item->GetFlags() & IS_ROLLOVER ) )
{
item->SetFlags( IS_ROLLOVER );
lastRolloverItem = rolloverItem;

View File

@ -26,7 +26,7 @@
#include <eeschema_id.h>
#include <tools/ee_actions.h>
#include <tools/sch_navigate_tool.h>
#include "eda_doc.h"
void SCH_NAVIGATE_TOOL::ResetHistory()
{
@ -81,6 +81,30 @@ int SCH_NAVIGATE_TOOL::HypertextCommand( const TOOL_EVENT& aEvent )
}
void SCH_NAVIGATE_TOOL::HypertextCommand( const wxString& href )
{
wxString destPage;
if( EDA_TEXT::IsGotoPageHref( href, &destPage ) && !destPage.IsEmpty() )
{
for( const SCH_SHEET_PATH& sheet : m_frame->Schematic().GetSheets() )
{
if( sheet.GetPageNumber() == destPage )
{
changeSheet( sheet );
return;
}
}
m_frame->ShowInfoBarError( wxString::Format( _( "Page '%d' not found." ), destPage ) );
}
else
{
GetAssociatedDocument( m_frame, href, &m_frame->Prj() );
}
}
int SCH_NAVIGATE_TOOL::Up( const TOOL_EVENT& aEvent )
{
// Checks for CanGoUp()

View File

@ -66,6 +66,8 @@ public:
int Next( const TOOL_EVENT& aEvent );
int HypertextCommand( const TOOL_EVENT& aEvent );
void HypertextCommand( const wxString& href );
bool CanGoBack();
bool CanGoForward();
bool CanGoUp();

View File

@ -124,6 +124,11 @@ public:
inline bool IsResized() const { return m_flags & IS_RESIZING; }
inline bool IsBrightened() const { return m_flags & BRIGHTENED; }
inline bool IsRollover() const
{
return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
}
inline void SetWireImage() { SetFlags( IS_WIRE_IMAGE ); }
inline void SetSelected() { SetFlags( SELECTED ); }
inline void SetBrightened() { SetFlags( BRIGHTENED ); }

View File

@ -336,24 +336,26 @@ public:
static bool ValidateHyperlink( const wxString& aURL );
/**
* Check if aURL is a valid "goto" hyperlink.
* Check if aHref is a valid internal hyperlink.
*
* @param aURL String to validate
* @param aDestinationIdx optional. pointer to populate with the page index destination
* @return true if aURL is a valid hyperlink
* @param aHref String to validate
* @param aDestination [optional] pointer to populate with the destination page
* @return true if aHref is a valid internal hyperlink. Does *not* check if the destination
* page actually exists.
*/
static bool IsGotoPageHyperlink( const wxString& aURL, int* aDestination = nullptr );
static bool IsGotoPageHref( const wxString& aHref, wxString* aDestination = nullptr );
/**
* Generate a hyperlink string that goes to the page number specified
* @param aDestination Virtual page number to go to. Note that the root sheet is 1.
* @return A hyperlink String that goes to the page number specified
* Generate a href to a page in the current schematic.
*
* @param aDestination Destination sheet's page number.
* @return A hyperlink href string that goes to the specified page.
*/
static wxString GotoPageHyperlinkString( const int& aDestination );
static wxString GotoPageHref( const wxString& aDestination );
protected:
/**
* A hyperlink to a URL or file in the system. If empty, this text object is not a hyperlink
* A hyperlink URL. If empty, this text object is not a hyperlink.
*/
wxString m_hyperlink;

View File

@ -123,7 +123,7 @@ public:
*/
virtual PLOT_FORMAT GetPlotterType() const = 0;
virtual bool StartPlot() = 0;
virtual bool StartPlot( const wxString& aPageNumber ) = 0;
virtual bool EndPlot() = 0;
virtual void SetNegative( bool aNegative ) { m_negativeMode = aNegative; }

View File

@ -61,7 +61,7 @@ public:
/**
* Open the DXF plot with a skeleton header.
*/
virtual bool StartPlot() override;
virtual bool StartPlot( const wxString& aPageNumber ) override;
virtual bool EndPlot() override;
// For now we don't use 'thick' primitives, so no line width

View File

@ -49,7 +49,7 @@ public:
/**
* Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.
*/
virtual bool StartPlot() override;
virtual bool StartPlot( const wxString& pageNumber ) override;
virtual bool EndPlot() override;
virtual void SetCurrentLineWidth( int aLineWidth, void* aData = nullptr ) override;

View File

@ -61,7 +61,7 @@ public:
/**
* At the start of the HPGL plot pen speed and number are requested.
*/
virtual bool StartPlot() override;
virtual bool StartPlot( const wxString& aPageNumber ) override;
/**
* HPGL end of plot: sort and emit graphics, pen return and release.

View File

@ -185,7 +185,7 @@ public:
* BBox is the boundary box (position and size of the "client rectangle"
* for drawings (page - margins) in mils (0.001 inch)
*/
virtual bool StartPlot() override;
virtual bool StartPlot( const wxString& aPageNumber ) override;
virtual bool EndPlot() override;
/**
@ -273,13 +273,13 @@ public:
* The PDF engine supports multiple pages; the first one is opened 'for free' the following
* are to be closed and reopened. Between each page parameters can be set.
*/
virtual bool StartPlot() override;
virtual bool StartPlot( const wxString& aPageNumber ) override;
virtual bool EndPlot() override;
/**
* Start a new page in the PDF document.
*/
virtual void StartPage();
virtual void StartPage( const wxString& aPageNumber );
/**
* Close the current page in the PDF document (and emit its compressed stream).
@ -417,8 +417,11 @@ protected:
FILE* m_workFile; ///< Temporary file to construct the stream before zipping
std::vector<long> m_xrefTable; ///< The PDF xref offset table
///< List of user-space page numbers for resolving internal hyperlinks
std::vector<wxString> m_pageNumbers;
///< List of loaded hyperlinks in current page
std::vector<std::pair<BOX2I, wxString>> m_hyperlinksInPage;
std::vector<std::pair<BOX2I, wxString>> m_hyperlinksInPage;
///< Handles for all the hyperlink objects that will be deferred
std::map<int, std::pair<BOX2D, wxString>> m_hyperlinkHandles;
@ -445,7 +448,7 @@ public:
/**
* Create SVG file header.
*/
virtual bool StartPlot() override;
virtual bool StartPlot( const wxString& aPageNumber ) override;
virtual bool EndPlot() override;
/**

View File

@ -207,7 +207,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
gbrplotter->AddLineToHeader( text );
}
plotter->StartPlot();
plotter->StartPlot( wxT( "1" ) );
// Draw items on edge layer.
// Not all, only items useful for drill map, i.e. board outlines.

View File

@ -156,9 +156,8 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
// Add the standard X2 FileFunction for drill files
// %TF.FileFunction,Plated[NonPlated],layer1num,layer2num,PTH[NPTH][Blind][Buried],Drill[Route][Mixed]*%
wxString text = BuildFileFunctionAttributeString( aLayerPair,
aIsNpth
? TYPE_FILE::NPTH_FILE
: TYPE_FILE::PTH_FILE );
aIsNpth ? TYPE_FILE::NPTH_FILE
: TYPE_FILE::PTH_FILE );
plotter.AddLineToHeader( text );
// Add file polarity (positive)
@ -168,7 +167,7 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
if( !plotter.OpenFile( aFullFilename ) )
return -1;
plotter.StartPlot();
plotter.StartPlot( wxT( "1" ) );
holes_count = 0;

View File

@ -109,7 +109,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
// We need a BRDITEMS_PLOTTER to plot pads
BRDITEMS_PLOTTER brd_plotter( &plotter, m_pcb, plotOpts );
plotter.StartPlot();
plotter.StartPlot( wxT( "1" ) );
// Some tools in P&P files have the type and size defined.
// they are position flash (round), pad1 flash (diamond), other pads flash (round)

View File

@ -1174,7 +1174,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
AddGerberX2Attribute( plotter, aBoard, aLayer, not useX2mode );
}
plotter->StartPlot();
plotter->StartPlot( wxT( "1" ) );
// Plot the frame reference if requested
if( aPlotOpts->GetPlotFrameRef() )