Pl_Editor: fix minor issues in multi-lines texts
Others: fix very minor issues.
This commit is contained in:
parent
87eb527d67
commit
d04ab1fe75
|
@ -462,6 +462,43 @@ void WORKSHEET_DATAITEM_TEXT::IncrementLabel( int aIncr )
|
|||
m_FullText << (wxChar) ( aIncr + lbchar );
|
||||
}
|
||||
|
||||
// Replace the '\''n' sequence by EOL
|
||||
// and the sequence '\''\' by only one '\' in m_FullText
|
||||
// if m_FullTextis a multiline text (i;e.contains '\n') return true
|
||||
bool WORKSHEET_DATAITEM_TEXT::ReplaceAntiSlashSequence()
|
||||
{
|
||||
bool multiline = false;
|
||||
|
||||
for( unsigned ii = 0; ii < m_FullText.Len(); ii++ )
|
||||
{
|
||||
if( m_FullText[ii] == '\n' )
|
||||
multiline = true;
|
||||
|
||||
else if( m_FullText[ii] == '\\' )
|
||||
{
|
||||
if( ++ii >= m_FullText.Len() )
|
||||
break;
|
||||
|
||||
if( m_FullText[ii] == '\\' )
|
||||
{
|
||||
// a double \\ sequence is replaced by a single \ char
|
||||
m_FullText.Remove(ii, 1);
|
||||
ii--;
|
||||
}
|
||||
else if( m_FullText[ii] == 'n' )
|
||||
{
|
||||
// Replace the "\n" sequence by a EOL char
|
||||
multiline = true;
|
||||
m_FullText[ii] = '\n';
|
||||
m_FullText.Remove(ii-1, 1);
|
||||
ii--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return multiline;
|
||||
}
|
||||
|
||||
void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize()
|
||||
{
|
||||
m_ConstrainedTextSize = m_TextSize;
|
||||
|
@ -501,3 +538,4 @@ void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize()
|
|||
m_ConstrainedTextSize.y *= m_BoundingBoxSize.y / size.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,8 +152,7 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
|
|||
else
|
||||
{
|
||||
wsText->m_FullText = BuildFullText( wsText->m_TextBase );
|
||||
if( wsText->m_FullText.Replace( wxT("\\n" ), wxT("\n") ) > 0 )
|
||||
multilines = true;
|
||||
multilines = wsText->ReplaceAntiSlashSequence();
|
||||
}
|
||||
|
||||
if( wsText->m_FullText.IsEmpty() )
|
||||
|
|
|
@ -136,8 +136,8 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
|||
msg << aTextbase[ii];
|
||||
continue;
|
||||
}
|
||||
ii++;
|
||||
if( ii >= aTextbase.Len() )
|
||||
|
||||
if( ++ii >= aTextbase.Len() )
|
||||
break;
|
||||
|
||||
wxChar format = aTextbase[ii];
|
||||
|
|
|
@ -420,6 +420,14 @@ public:
|
|||
*/
|
||||
void SetConstrainedTextSize();
|
||||
|
||||
|
||||
/** Replace the '\''n' sequence by EOL
|
||||
* and the sequence '\''\' by only one '\'
|
||||
* inside m_FullText
|
||||
* @return true if the EOL symbol is found or is inserted (multiline text)
|
||||
*/
|
||||
bool ReplaceAntiSlashSequence();
|
||||
|
||||
/**
|
||||
* @return true is a bold font should be selected
|
||||
*/
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
}
|
||||
catch( IO_ERROR ioe )
|
||||
{
|
||||
wxMessageBox( ioe.errorText, _("Write Page Layout Error" ) );
|
||||
wxMessageBox( ioe.errorText, _("Error writing page layout descr file" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
}
|
||||
catch( IO_ERROR ioe )
|
||||
{
|
||||
wxMessageBox( ioe.errorText, _("Write Page Layout Error" ) );
|
||||
wxMessageBox( ioe.errorText, _("Error writing page layout descr file" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -194,9 +194,10 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
|
|||
m_SizerTextIncrementLabel->Show( true );
|
||||
|
||||
WORKSHEET_DATAITEM_TEXT* item = (WORKSHEET_DATAITEM_TEXT*) aItem;
|
||||
wxString text = item->m_TextBase;
|
||||
text.Replace(wxT("\\n"), wxT("\n") );
|
||||
m_textCtrlText->SetValue( text );
|
||||
item->m_FullText = item->m_TextBase;
|
||||
// Replace our '\' 'n' sequence by the EOL char
|
||||
item->ReplaceAntiSlashSequence();;
|
||||
m_textCtrlText->SetValue( item->m_FullText );
|
||||
|
||||
msg.Printf( wxT("%d"), item->m_IncrementLabel );
|
||||
m_textCtrlTextIncrement->SetValue( msg );
|
||||
|
@ -285,7 +286,12 @@ void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
|
|||
|
||||
WORKSHEET_DATAITEM* item = m_parent->GetSelectedItem();
|
||||
if( item )
|
||||
{
|
||||
CopyPrmsFromPanelToItem( item );
|
||||
// Be sure what is displayed is waht is set for item
|
||||
// (mainly, texts can be modified if they contain "\n")
|
||||
CopyPrmsFromItemToPanel( item );
|
||||
}
|
||||
|
||||
CopyPrmsFromPanelToGeneral();
|
||||
|
||||
|
@ -392,7 +398,6 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WORKSHEET_DATAITEM* aItem )
|
|||
WORKSHEET_DATAITEM_TEXT* item = (WORKSHEET_DATAITEM_TEXT*) aItem;
|
||||
|
||||
item->m_TextBase = m_textCtrlText->GetValue();
|
||||
item->m_TextBase.Replace( wxT("\n"), wxT("\\n") );
|
||||
|
||||
msg = m_textCtrlTextIncrement->GetValue();
|
||||
msg.ToLong( &itmp );
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#include <transline.h>
|
||||
#include <units.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
#ifndef INFINITY
|
||||
#define INFINITY std::numeric_limits<double>::infinity()
|
||||
|
@ -37,13 +35,6 @@ using namespace std;
|
|||
#define M_PI_2 (M_PI/2)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_CMATH_ISINF
|
||||
inline bool isinf(double x)
|
||||
{
|
||||
return x == INFINITY; // return true if x is infinity
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Functions to Read/Write parameters in pcb_calculator main frame:
|
||||
// They are wrapper to actual functions, so all transline functions do not
|
||||
|
@ -148,7 +139,7 @@ void TRANSLINE::ellipke( double arg, double& k, double& e )
|
|||
k = INFINITY; // infinite
|
||||
e = 0;
|
||||
}
|
||||
else if( isinf( arg ) && arg < 0 )
|
||||
else if( std::isinf( arg ) && arg < 0 )
|
||||
{
|
||||
k = 0;
|
||||
e = INFINITY; // infinite
|
||||
|
|
|
@ -58,15 +58,6 @@ inline double atanh( double x )
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926535897932384626433832795029 /* pi */
|
||||
#endif
|
||||
|
||||
#ifndef M_E
|
||||
#define M_E 2.7182818284590452353602874713526625 /* e */
|
||||
#endif
|
||||
|
||||
#define MU0 12.566370614e-7 // magnetic constant
|
||||
#define C0 299792458.0 // speed of light in vacuum
|
||||
#define ZF0 376.73031346958504364963 // wave resistance in vacuum
|
||||
|
|
|
@ -22,20 +22,17 @@ DIALOG_PADS_MASK_CLEARANCE_BASE::DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* pare
|
|||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bMainUpperSizer;
|
||||
bMainUpperSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxStaticBoxSizer* sbMiddleRightSizer;
|
||||
sbMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions:") ), wxVERTICAL );
|
||||
bMainUpperSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("Note: For clearance values:\n- a positive value means a mask bigger than a pad\n- a negative value means a mask smaller than a pad\n"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextInfo->Wrap( -1 );
|
||||
sbMiddleRightSizer->Add( m_staticTextInfo, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 );
|
||||
bMainUpperSizer->Add( m_staticTextInfo, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
sbMiddleRightSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
bMainUpperSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxFlexGridSizer* fgGridSolderMaskSizer;
|
||||
fgGridSolderMaskSizer = new wxFlexGridSizer( 4, 3, 0, 0 );
|
||||
fgGridSolderMaskSizer = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgGridSolderMaskSizer->AddGrowableCol( 1 );
|
||||
fgGridSolderMaskSizer->SetFlexibleDirection( wxBOTH );
|
||||
fgGridSolderMaskSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
@ -106,17 +103,14 @@ DIALOG_PADS_MASK_CLEARANCE_BASE::DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* pare
|
|||
fgGridSolderMaskSizer->Add( m_SolderPasteRatioMarginUnits, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbMiddleRightSizer->Add( fgGridSolderMaskSizer, 1, wxEXPAND, 5 );
|
||||
bMainUpperSizer->Add( fgGridSolderMaskSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainUpperSizer->Add( sbMiddleRightSizer, 1, wxEXPAND, 5 );
|
||||
m_staticline11 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bMainUpperSizer->Add( m_staticline11, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bMainUpperSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
m_staticline11 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bMainSizer->Add( m_staticline11, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_sdbButtonsSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbButtonsSizerOK = new wxButton( this, wxID_OK );
|
||||
m_sdbButtonsSizer->AddButton( m_sdbButtonsSizerOK );
|
||||
|
@ -124,7 +118,7 @@ DIALOG_PADS_MASK_CLEARANCE_BASE::DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* pare
|
|||
m_sdbButtonsSizer->AddButton( m_sdbButtonsSizerCancel );
|
||||
m_sdbButtonsSizer->Realize();
|
||||
|
||||
bMainSizer->Add( m_sdbButtonsSizer, 0, wxBOTTOM|wxALIGN_RIGHT, 5 );
|
||||
bMainSizer->Add( m_sdbButtonsSizer, 0, wxALIGN_RIGHT|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,7 +23,6 @@ class DIALOG_SHIM;
|
|||
#include <wx/statline.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
|
@ -72,7 +71,7 @@ class DIALOG_PADS_MASK_CLEARANCE_BASE : public DIALOG_SHIM
|
|||
|
||||
public:
|
||||
|
||||
DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pads Mask Clearance"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 361,292 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pads Mask Clearance"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 361,304 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_PADS_MASK_CLEARANCE_BASE();
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue