Fixes in bitmap2cmp: enhancements and fixes.
* Better messages, more easy to translate * Error messages are now displayed. * Move start code to bitmap2cmp_main.cpp.
This commit is contained in:
parent
0e4cd590cf
commit
6a9eb4576d
|
@ -13,9 +13,10 @@ include_directories(
|
|||
|
||||
set( BITMAP2COMPONENT_SRCS
|
||||
../common/single_top.cpp
|
||||
bitmap2cmp_main.cpp
|
||||
bitmap2component.cpp
|
||||
bitmap2cmp_gui_base
|
||||
bitmap2cmp_gui
|
||||
bitmap2cmp_gui_base.cpp
|
||||
bitmap2cmp_gui.cpp
|
||||
)
|
||||
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
|
|
|
@ -244,20 +244,20 @@ void BM2CMP_FRAME::LoadSettings()
|
|||
if( tmp < 0 || tmp > FINAL_FMT )
|
||||
tmp = PCBNEW_KICAD_MOD;
|
||||
|
||||
m_radioBoxFormat->SetSelection( tmp );
|
||||
m_rbOutputFormat->SetSelection( tmp );
|
||||
}
|
||||
|
||||
if( tmp == PCBNEW_KICAD_MOD )
|
||||
m_radio_PCBLayer->Enable( true );
|
||||
m_rbPCBLayer->Enable( true );
|
||||
else
|
||||
m_radio_PCBLayer->Enable( false );
|
||||
m_rbPCBLayer->Enable( false );
|
||||
|
||||
if( m_config->Read( KEYWORD_LAST_MODLAYER, &tmp ) )
|
||||
{
|
||||
if( (unsigned) tmp > MOD_LYR_FINAL ) // Out of range
|
||||
m_radio_PCBLayer->SetSelection( MOD_LYR_FSILKS );
|
||||
m_rbPCBLayer->SetSelection( MOD_LYR_FSILKS );
|
||||
else
|
||||
m_radio_PCBLayer->SetSelection( tmp );
|
||||
m_rbPCBLayer->SetSelection( tmp );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,8 +282,8 @@ void BM2CMP_FRAME::SaveSettings()
|
|||
m_config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );
|
||||
m_config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() );
|
||||
m_config->Write( KEYWORD_BW_NEGATIVE, m_checkNegative->IsChecked() ? 1 : 0 );
|
||||
m_config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() );
|
||||
m_config->Write( KEYWORD_LAST_MODLAYER, m_radio_PCBLayer->GetSelection() );
|
||||
m_config->Write( KEYWORD_LAST_FORMAT, m_rbOutputFormat->GetSelection() );
|
||||
m_config->Write( KEYWORD_LAST_MODLAYER, m_rbPCBLayer->GetSelection() );
|
||||
m_config->Write( KEYWORD_UNIT_SELECTION, m_PixelUnit->GetSelection() );
|
||||
}
|
||||
|
||||
|
@ -683,9 +683,9 @@ void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
|
|||
void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event )
|
||||
{
|
||||
m_exportToClipboard = false;
|
||||
// choices of m_radioBoxFormat are expected to be in same order as
|
||||
// choices of m_rbOutputFormat are expected to be in same order as
|
||||
// OUTPUT_FMT_ID. See bitmap2component.h
|
||||
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_radioBoxFormat->GetSelection();
|
||||
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
|
||||
exportBitmap( format );
|
||||
}
|
||||
|
||||
|
@ -693,9 +693,9 @@ void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event )
|
|||
void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
|
||||
{
|
||||
m_exportToClipboard = true;
|
||||
// choices of m_radioBoxFormat are expected to be in same order as
|
||||
// choices of m_rbOutputFormat are expected to be in same order as
|
||||
// OUTPUT_FMT_ID. See bitmap2component.h
|
||||
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_radioBoxFormat->GetSelection();
|
||||
OUTPUT_FMT_ID format = (OUTPUT_FMT_ID) m_rbOutputFormat->GetSelection();
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, format );
|
||||
|
@ -918,97 +918,26 @@ void BM2CMP_FRAME::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat )
|
|||
}
|
||||
}
|
||||
|
||||
// choices of m_radio_PCBLayer are expected to be in same order as
|
||||
// choices of m_rbPCBLayer are expected to be in same order as
|
||||
// BMP2CMP_MOD_LAYER. See bitmap2component.h
|
||||
BMP2CMP_MOD_LAYER modLayer = MOD_LYR_FSILKS;
|
||||
|
||||
if( aFormat == PCBNEW_KICAD_MOD )
|
||||
modLayer = (BMP2CMP_MOD_LAYER) m_radio_PCBLayer->GetSelection();
|
||||
modLayer = (BMP2CMP_MOD_LAYER) m_rbPCBLayer->GetSelection();
|
||||
|
||||
BITMAPCONV_INFO converter( aOutput );
|
||||
converter.ConvertBitmap( potrace_bitmap, aFormat, m_outputSizeX.GetOutputDPI(),
|
||||
m_outputSizeY.GetOutputDPI(), modLayer );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----<KIFACE>-----------------------------------------------------------------
|
||||
|
||||
namespace BMP2CMP {
|
||||
|
||||
static struct IFACE : public KIFACE_I
|
||||
{
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
|
||||
|
||||
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
|
||||
{
|
||||
return new BM2CMP_FRAME( aKiway, aParent );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IfaceOrAddress
|
||||
* return a pointer to the requested object. The safest way to use this
|
||||
* is to retrieve a pointer to a static instance of an interface, similar to
|
||||
* how the KIFACE interface is exported. But if you know what you are doing
|
||||
* use it to retrieve anything you want.
|
||||
*
|
||||
* @param aDataId identifies which object you want the address of.
|
||||
*
|
||||
* @return void* - and must be cast into the know type.
|
||||
*/
|
||||
void* IfaceOrAddress( int aDataId ) override
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IFACE( const char* aDSOname, KIWAY::FACE_T aType ) :
|
||||
KIFACE_I( aDSOname, aType )
|
||||
{}
|
||||
|
||||
} kiface( "BMP2CMP", KIWAY::FACE_BMP2CMP );
|
||||
|
||||
} // namespace BMP2CMP
|
||||
|
||||
using namespace BMP2CMP;
|
||||
|
||||
static PGM_BASE* process;
|
||||
|
||||
KIFACE_I& Kiface()
|
||||
{
|
||||
return kiface;
|
||||
}
|
||||
|
||||
|
||||
// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
|
||||
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
|
||||
KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
|
||||
{
|
||||
process = (PGM_BASE*) aProgram;
|
||||
return &kiface;
|
||||
}
|
||||
|
||||
|
||||
#if defined(BUILD_KIWAY_DLLS)
|
||||
PGM_BASE& Pgm()
|
||||
{
|
||||
wxASSERT( process ); // KIFACE_GETTER has already been called.
|
||||
return *process;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
{
|
||||
return start_common( aCtlBits );
|
||||
if( !converter.GetErrorMessages().empty() )
|
||||
wxMessageBox( converter.GetErrorMessages().c_str(), _( "Errors" ) );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnFormatChange( wxCommandEvent& event )
|
||||
{
|
||||
if( m_radioBoxFormat->GetSelection() == PCBNEW_KICAD_MOD )
|
||||
m_radio_PCBLayer->Enable( true );
|
||||
if( m_rbOutputFormat->GetSelection() == PCBNEW_KICAD_MOD )
|
||||
m_rbPCBLayer->Enable( true );
|
||||
else
|
||||
m_radio_PCBLayer->Enable( false );
|
||||
|
||||
event.Skip();
|
||||
m_rbPCBLayer->Enable( false );
|
||||
}
|
||||
|
|
|
@ -1,228 +1,234 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 1 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "bitmap2cmp_gui_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : KIWAY_PLAYER( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InitialPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_InitialPicturePanel->SetScrollRate( 5, 5 );
|
||||
m_InitialPicturePanel->SetMinSize( wxSize( 400,300 ) );
|
||||
|
||||
m_Notebook->AddPage( m_InitialPicturePanel, _("Original Picture"), true );
|
||||
m_GreyscalePicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_GreyscalePicturePanel->SetScrollRate( 5, 5 );
|
||||
m_GreyscalePicturePanel->SetMinSize( wxSize( 400,300 ) );
|
||||
|
||||
m_Notebook->AddPage( m_GreyscalePicturePanel, _("Greyscale Picture"), false );
|
||||
m_BNPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_BNPicturePanel->SetScrollRate( 5, 5 );
|
||||
m_Notebook->AddPage( m_BNPicturePanel, _("Black&&White Picture"), false );
|
||||
|
||||
bMainSizer->Add( m_Notebook, 1, wxEXPAND, 5 );
|
||||
|
||||
m_panelRight = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* brightSizer;
|
||||
brightSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbSizerInfo;
|
||||
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Bitmap Info:") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerInfo;
|
||||
fgSizerInfo = new wxFlexGridSizer( 0, 4, 0, 0 );
|
||||
fgSizerInfo->AddGrowableCol( 1 );
|
||||
fgSizerInfo->AddGrowableCol( 2 );
|
||||
fgSizerInfo->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticTextISize = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Input size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextISize->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextISize, 0, wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_SizeXValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeXValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeXValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_SizeYValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeYValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeYValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_SizePixUnits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizePixUnits->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizePixUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_staticTextDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Input DPI:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDPI->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextDPI, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_InputXValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InputXValueDPI->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_InputXValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_InputYValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InputYValueDPI->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_InputYValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_DPIUnit = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("DPI"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DPIUnit->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_DPIUnit, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_staticTextBPP = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextBPP->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextBPP, 0, wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_BPPValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_BPPValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_BPPValue, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_BPPunits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_BPPunits->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
fgSizerInfo->Add( 0, 0, 0, 0, 5 );
|
||||
|
||||
|
||||
sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* bSizerLock;
|
||||
bSizerLock = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_textLock = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Lock Aspect Ratio"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textLock->Wrap( -1 );
|
||||
bSizerLock->Add( m_textLock, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_AspectRatioLockButton = new wxBitmapButton( sbSizerInfo->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizerLock->Add( m_AspectRatioLockButton, 0, wxALL, 5 );
|
||||
|
||||
|
||||
sbSizerInfo->Add( bSizerLock, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRes;
|
||||
bSizerRes = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextOSize = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOSize->Wrap( -1 );
|
||||
bSizerRes->Add( m_staticTextOSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_UnitSizeX = new wxTextCtrl( sbSizerInfo->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_UnitSizeX->SetMinSize( wxSize( 60,-1 ) );
|
||||
|
||||
bSizerRes->Add( m_UnitSizeX, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_UnitSizeY = new wxTextCtrl( sbSizerInfo->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_UnitSizeY->SetMinSize( wxSize( 60,-1 ) );
|
||||
|
||||
bSizerRes->Add( m_UnitSizeY, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
wxArrayString m_PixelUnitChoices;
|
||||
m_PixelUnit = new wxChoice( sbSizerInfo->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_PixelUnitChoices, 0 );
|
||||
m_PixelUnit->SetSelection( 0 );
|
||||
m_PixelUnit->SetMinSize( wxSize( 80,-1 ) );
|
||||
|
||||
bSizerRes->Add( m_PixelUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbSizerInfo->Add( bSizerRes, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_buttonExportFile = new wxButton( m_panelRight, wxID_ANY, _("Export to File"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonExportFile, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_buttonExportClipboard = new wxButton( m_panelRight, wxID_ANY, _("Export to Clipboard"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonExportClipboard, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxString m_radioBoxFormatChoices[] = { _("Eeschema (.lib file)"), _("Pcbnew (.kicad_mod file)"), _("Postscript (.ps file)"), _("Logo for title block (.kicad_wks file)") };
|
||||
int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString );
|
||||
m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format:"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_radioBoxFormat->SetSelection( 1 );
|
||||
brightSizer->Add( m_radioBoxFormat, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizer2;
|
||||
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Image Options:") ), wxVERTICAL );
|
||||
|
||||
m_ThresholdText = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Black / White Threshold:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ThresholdText->Wrap( -1 );
|
||||
sbSizer2->Add( m_ThresholdText, 0, wxTOP|wxLEFT, 5 );
|
||||
|
||||
m_sliderThreshold = new wxSlider( sbSizer2->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
|
||||
m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
|
||||
|
||||
sbSizer2->Add( m_sliderThreshold, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkNegative = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Negative"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizer2->Add( m_checkNegative, 0, wxTOP|wxBOTTOM, 10 );
|
||||
|
||||
|
||||
brightSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxString m_radio_PCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") };
|
||||
int m_radio_PCBLayerNChoices = sizeof( m_radio_PCBLayerChoices ) / sizeof( wxString );
|
||||
m_radio_PCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline:"), wxDefaultPosition, wxDefaultSize, m_radio_PCBLayerNChoices, m_radio_PCBLayerChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_radio_PCBLayer->SetSelection( 3 );
|
||||
m_radio_PCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe 2 invisible fields reference and value are always placed on the silk screen layer.") );
|
||||
|
||||
brightSizer->Add( m_radio_PCBLayer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelRight->SetSizer( brightSizer );
|
||||
m_panelRight->Layout();
|
||||
brightSizer->Fit( m_panelRight );
|
||||
bMainSizer->Add( m_panelRight, 0, wxEXPAND, 0 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
|
||||
|
||||
// Connect Events
|
||||
m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
|
||||
m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
|
||||
m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
|
||||
m_AspectRatioLockButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this );
|
||||
m_UnitSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this );
|
||||
m_UnitSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this );
|
||||
m_PixelUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this );
|
||||
m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
||||
m_buttonExportFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this );
|
||||
m_buttonExportClipboard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this );
|
||||
m_radioBoxFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
|
||||
m_sliderThreshold->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
|
||||
m_checkNegative->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
|
||||
}
|
||||
|
||||
BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
|
||||
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
|
||||
m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
|
||||
m_AspectRatioLockButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this );
|
||||
m_UnitSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this );
|
||||
m_UnitSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this );
|
||||
m_PixelUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this );
|
||||
m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
||||
m_buttonExportFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this );
|
||||
m_buttonExportClipboard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this );
|
||||
m_radioBoxFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
|
||||
m_sliderThreshold->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
|
||||
m_checkNegative->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
|
||||
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 1 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "bitmap2cmp_gui_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : KIWAY_PLAYER( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InitialPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_InitialPicturePanel->SetScrollRate( 5, 5 );
|
||||
m_InitialPicturePanel->SetMinSize( wxSize( 400,300 ) );
|
||||
|
||||
m_Notebook->AddPage( m_InitialPicturePanel, _("Original Picture"), true );
|
||||
m_GreyscalePicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_GreyscalePicturePanel->SetScrollRate( 5, 5 );
|
||||
m_GreyscalePicturePanel->SetMinSize( wxSize( 400,300 ) );
|
||||
|
||||
m_Notebook->AddPage( m_GreyscalePicturePanel, _("Greyscale Picture"), false );
|
||||
m_BNPicturePanel = new wxScrolledWindow( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_BNPicturePanel->SetScrollRate( 5, 5 );
|
||||
m_Notebook->AddPage( m_BNPicturePanel, _("Black&&White Picture"), false );
|
||||
|
||||
bMainSizer->Add( m_Notebook, 1, wxEXPAND, 5 );
|
||||
|
||||
m_panelRight = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* brightSizer;
|
||||
brightSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbSizerInfo;
|
||||
sbSizerInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Bitmap Info:") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerInfo;
|
||||
fgSizerInfo = new wxFlexGridSizer( 0, 4, 0, 0 );
|
||||
fgSizerInfo->AddGrowableCol( 1 );
|
||||
fgSizerInfo->AddGrowableCol( 2 );
|
||||
fgSizerInfo->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticTextISize = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Bitmap size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextISize->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextISize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_SizeXValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeXValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeXValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_SizeYValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizeYValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizeYValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_SizePixUnits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SizePixUnits->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_SizePixUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_staticTextDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("Bitmap PPI:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDPI->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextDPI, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_InputXValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InputXValueDPI->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_InputXValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_InputYValueDPI = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InputYValueDPI->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_InputYValueDPI, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_DPIUnit = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("PPI"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DPIUnit->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_DPIUnit, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_staticTextBPP = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextBPP->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_staticTextBPP, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_BPPValue = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_BPPValue->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_BPPValue, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_BPPunits = new wxStaticText( sbSizerInfo->GetStaticBox(), wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_BPPunits->Wrap( -1 );
|
||||
fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
fgSizerInfo->Add( 0, 0, 0, 0, 5 );
|
||||
|
||||
|
||||
sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerImgPrms;
|
||||
sbSizerImgPrms = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Output Parameters:") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizerLock;
|
||||
bSizerLock = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_textLock = new wxStaticText( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("Lock height/width ratio"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textLock->Wrap( -1 );
|
||||
bSizerLock->Add( m_textLock, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_AspectRatioLockButton = new wxBitmapButton( sbSizerImgPrms->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizerLock->Add( m_AspectRatioLockButton, 0, wxALL, 5 );
|
||||
|
||||
|
||||
sbSizerImgPrms->Add( bSizerLock, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRes;
|
||||
bSizerRes = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextOSize = new wxStaticText( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOSize->Wrap( -1 );
|
||||
bSizerRes->Add( m_staticTextOSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_UnitSizeX = new wxTextCtrl( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_UnitSizeX->SetMinSize( wxSize( 60,-1 ) );
|
||||
|
||||
bSizerRes->Add( m_UnitSizeX, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_UnitSizeY = new wxTextCtrl( sbSizerImgPrms->GetStaticBox(), wxID_ANY, _("300"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_UnitSizeY->SetMinSize( wxSize( 60,-1 ) );
|
||||
|
||||
bSizerRes->Add( m_UnitSizeY, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
wxArrayString m_PixelUnitChoices;
|
||||
m_PixelUnit = new wxChoice( sbSizerImgPrms->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_PixelUnitChoices, 0 );
|
||||
m_PixelUnit->SetSelection( 0 );
|
||||
m_PixelUnit->SetMinSize( wxSize( 80,-1 ) );
|
||||
|
||||
bSizerRes->Add( m_PixelUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbSizerImgPrms->Add( bSizerRes, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
brightSizer->Add( sbSizerImgPrms, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_buttonExportFile = new wxButton( m_panelRight, wxID_ANY, _("Export to File"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonExportFile, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_buttonExportClipboard = new wxButton( m_panelRight, wxID_ANY, _("Export to Clipboard"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonExportClipboard, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxString m_rbOutputFormatChoices[] = { _("Eeschema (.lib file)"), _("Pcbnew (.kicad_mod file)"), _("Postscript (.ps file)"), _("Logo for title block (.kicad_wks file)") };
|
||||
int m_rbOutputFormatNChoices = sizeof( m_rbOutputFormatChoices ) / sizeof( wxString );
|
||||
m_rbOutputFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format:"), wxDefaultPosition, wxDefaultSize, m_rbOutputFormatNChoices, m_rbOutputFormatChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_rbOutputFormat->SetSelection( 1 );
|
||||
brightSizer->Add( m_rbOutputFormat, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizer2;
|
||||
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_panelRight, wxID_ANY, _("Image Options:") ), wxVERTICAL );
|
||||
|
||||
m_ThresholdText = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Black / White Threshold:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ThresholdText->Wrap( -1 );
|
||||
sbSizer2->Add( m_ThresholdText, 0, wxTOP|wxLEFT, 5 );
|
||||
|
||||
m_sliderThreshold = new wxSlider( sbSizer2->GetStaticBox(), wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
|
||||
m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
|
||||
|
||||
sbSizer2->Add( m_sliderThreshold, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_checkNegative = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Negative"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizer2->Add( m_checkNegative, 0, wxTOP|wxBOTTOM, 10 );
|
||||
|
||||
|
||||
brightSizer->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxString m_rbPCBLayerChoices[] = { _("Front silk screen"), _("Front solder mask"), _("User layer Eco1"), _("User layer Eco2") };
|
||||
int m_rbPCBLayerNChoices = sizeof( m_rbPCBLayerChoices ) / sizeof( wxString );
|
||||
m_rbPCBLayer = new wxRadioBox( m_panelRight, wxID_ANY, _("Board Layer for Outline:"), wxDefaultPosition, wxDefaultSize, m_rbPCBLayerNChoices, m_rbPCBLayerChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_rbPCBLayer->SetSelection( 0 );
|
||||
m_rbPCBLayer->SetToolTip( _("Choose the board layer to place the outline.\nThe 2 invisible fields reference and value are always placed on the silk screen layer.") );
|
||||
|
||||
brightSizer->Add( m_rbPCBLayer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_panelRight->SetSizer( brightSizer );
|
||||
m_panelRight->Layout();
|
||||
brightSizer->Fit( m_panelRight );
|
||||
bMainSizer->Add( m_panelRight, 0, wxEXPAND, 0 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
|
||||
|
||||
// Connect Events
|
||||
m_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
|
||||
m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
|
||||
m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
|
||||
m_AspectRatioLockButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this );
|
||||
m_UnitSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this );
|
||||
m_UnitSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this );
|
||||
m_PixelUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this );
|
||||
m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
||||
m_buttonExportFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this );
|
||||
m_buttonExportClipboard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this );
|
||||
m_rbOutputFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
|
||||
m_sliderThreshold->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
|
||||
m_checkNegative->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
|
||||
}
|
||||
|
||||
BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintInit ), NULL, this );
|
||||
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintGreyscale ), NULL, this );
|
||||
m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaintBW ), NULL, this );
|
||||
m_AspectRatioLockButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::ToggleAspectRatioLock ), NULL, this );
|
||||
m_UnitSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeX ), NULL, this );
|
||||
m_UnitSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeChangeY ), NULL, this );
|
||||
m_PixelUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnSizeUnitChange ), NULL, this );
|
||||
m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
||||
m_buttonExportFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToFile ), NULL, this );
|
||||
m_buttonExportClipboard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportToClipboard ), NULL, this );
|
||||
m_rbOutputFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), NULL, this );
|
||||
m_sliderThreshold->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
|
||||
m_checkNegative->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnNegativeClicked ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<property name="minimum_size"></property>
|
||||
<property name="name">BM2CMP_FRAME_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">746,616</property>
|
||||
<property name="size">746,684</property>
|
||||
<property name="style">wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">KIWAY_PLAYER; kiway_player.h</property>
|
||||
<property name="title">Bitmap to Component Converter</property>
|
||||
|
@ -372,7 +372,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<property name="cols">4</property>
|
||||
|
@ -388,7 +388,7 @@
|
|||
<property name="vgap">0</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -418,7 +418,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Input size:</property>
|
||||
<property name="label">Bitmap size:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -632,7 +632,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -662,7 +662,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Input DPI:</property>
|
||||
<property name="label">Bitmap PPI:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -845,7 +845,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">DPI</property>
|
||||
<property name="label">PPI</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -876,7 +876,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT</property>
|
||||
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -1069,6 +1069,20 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Output Parameters:</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sbSizerImgPrms</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
|
@ -1110,7 +1124,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Lock Aspect Ratio</property>
|
||||
<property name="label">Lock height/width ratio</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -1744,7 +1758,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_radioBoxFormat</property>
|
||||
<property name="name">m_rbOutputFormat</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -2017,7 +2031,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_radio_PCBLayer</property>
|
||||
<property name="name">m_rbPCBLayer</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -2025,7 +2039,7 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">3</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
|
|
|
@ -1,105 +1,105 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 1 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "kiway_player.h"
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/valtext.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/statusbr.h>
|
||||
#include <wx/frame.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class BM2CMP_FRAME_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class BM2CMP_FRAME_BASE : public KIWAY_PLAYER
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxNotebook* m_Notebook;
|
||||
wxScrolledWindow* m_InitialPicturePanel;
|
||||
wxScrolledWindow* m_GreyscalePicturePanel;
|
||||
wxScrolledWindow* m_BNPicturePanel;
|
||||
wxPanel* m_panelRight;
|
||||
wxStaticText* m_staticTextISize;
|
||||
wxStaticText* m_SizeXValue;
|
||||
wxStaticText* m_SizeYValue;
|
||||
wxStaticText* m_SizePixUnits;
|
||||
wxStaticText* m_staticTextDPI;
|
||||
wxStaticText* m_InputXValueDPI;
|
||||
wxStaticText* m_InputYValueDPI;
|
||||
wxStaticText* m_DPIUnit;
|
||||
wxStaticText* m_staticTextBPP;
|
||||
wxStaticText* m_BPPValue;
|
||||
wxStaticText* m_BPPunits;
|
||||
wxStaticText* m_textLock;
|
||||
wxBitmapButton* m_AspectRatioLockButton;
|
||||
wxStaticText* m_staticTextOSize;
|
||||
wxTextCtrl* m_UnitSizeX;
|
||||
wxTextCtrl* m_UnitSizeY;
|
||||
wxChoice* m_PixelUnit;
|
||||
wxButton* m_buttonLoad;
|
||||
wxButton* m_buttonExportFile;
|
||||
wxButton* m_buttonExportClipboard;
|
||||
wxRadioBox* m_radioBoxFormat;
|
||||
wxStaticText* m_ThresholdText;
|
||||
wxSlider* m_sliderThreshold;
|
||||
wxCheckBox* m_checkNegative;
|
||||
wxRadioBox* m_radio_PCBLayer;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnPaintInit( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintGreyscale( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintBW( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void ToggleAspectRatioLock( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeChangeX( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeChangeY( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeUnitChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnExportToFile( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnExportToClipboard( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnFormatChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnThresholdChange( wxScrollEvent& event ) { event.Skip(); }
|
||||
virtual void OnNegativeClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Bitmap to Component Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 746,616 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
|
||||
|
||||
~BM2CMP_FRAME_BASE();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 1 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "kiway_player.h"
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/valtext.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/statusbr.h>
|
||||
#include <wx/frame.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class BM2CMP_FRAME_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class BM2CMP_FRAME_BASE : public KIWAY_PLAYER
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxNotebook* m_Notebook;
|
||||
wxScrolledWindow* m_InitialPicturePanel;
|
||||
wxScrolledWindow* m_GreyscalePicturePanel;
|
||||
wxScrolledWindow* m_BNPicturePanel;
|
||||
wxPanel* m_panelRight;
|
||||
wxStaticText* m_staticTextISize;
|
||||
wxStaticText* m_SizeXValue;
|
||||
wxStaticText* m_SizeYValue;
|
||||
wxStaticText* m_SizePixUnits;
|
||||
wxStaticText* m_staticTextDPI;
|
||||
wxStaticText* m_InputXValueDPI;
|
||||
wxStaticText* m_InputYValueDPI;
|
||||
wxStaticText* m_DPIUnit;
|
||||
wxStaticText* m_staticTextBPP;
|
||||
wxStaticText* m_BPPValue;
|
||||
wxStaticText* m_BPPunits;
|
||||
wxStaticText* m_textLock;
|
||||
wxBitmapButton* m_AspectRatioLockButton;
|
||||
wxStaticText* m_staticTextOSize;
|
||||
wxTextCtrl* m_UnitSizeX;
|
||||
wxTextCtrl* m_UnitSizeY;
|
||||
wxChoice* m_PixelUnit;
|
||||
wxButton* m_buttonLoad;
|
||||
wxButton* m_buttonExportFile;
|
||||
wxButton* m_buttonExportClipboard;
|
||||
wxRadioBox* m_rbOutputFormat;
|
||||
wxStaticText* m_ThresholdText;
|
||||
wxSlider* m_sliderThreshold;
|
||||
wxCheckBox* m_checkNegative;
|
||||
wxRadioBox* m_rbPCBLayer;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnPaintInit( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintGreyscale( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintBW( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void ToggleAspectRatioLock( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeChangeX( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeChangeY( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeUnitChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnExportToFile( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnExportToClipboard( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnFormatChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnThresholdChange( wxScrollEvent& event ) { event.Skip(); }
|
||||
virtual void OnNegativeClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Bitmap to Component Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 746,684 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
|
||||
|
||||
~BM2CMP_FRAME_BASE();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2010 jean-pierre.charras
|
||||
* Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "bitmap2cmp_gui.h"
|
||||
#include <kiface_i.h>
|
||||
#include <kiway.h>
|
||||
#include <pgm_base.h>
|
||||
|
||||
|
||||
//-----<KIFACE>-----------------------------------------------------------------
|
||||
|
||||
namespace BMP2CMP {
|
||||
|
||||
static struct IFACE : public KIFACE_I
|
||||
{
|
||||
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
|
||||
|
||||
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
|
||||
{
|
||||
return new BM2CMP_FRAME( aKiway, aParent );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IfaceOrAddress
|
||||
* return a pointer to the requested object. The safest way to use this
|
||||
* is to retrieve a pointer to a static instance of an interface, similar to
|
||||
* how the KIFACE interface is exported. But if you know what you are doing
|
||||
* use it to retrieve anything you want.
|
||||
*
|
||||
* @param aDataId identifies which object you want the address of.
|
||||
*
|
||||
* @return void* - and must be cast into the know type.
|
||||
*/
|
||||
void* IfaceOrAddress( int aDataId ) override
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IFACE( const char* aDSOname, KIWAY::FACE_T aType ) :
|
||||
KIFACE_I( aDSOname, aType )
|
||||
{}
|
||||
|
||||
} kiface( "BMP2CMP", KIWAY::FACE_BMP2CMP );
|
||||
|
||||
} // namespace BMP2CMP
|
||||
|
||||
using namespace BMP2CMP;
|
||||
|
||||
static PGM_BASE* process;
|
||||
|
||||
KIFACE_I& Kiface()
|
||||
{
|
||||
return kiface;
|
||||
}
|
||||
|
||||
|
||||
// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
|
||||
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
|
||||
KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
|
||||
{
|
||||
process = (PGM_BASE*) aProgram;
|
||||
return &kiface;
|
||||
}
|
||||
|
||||
|
||||
#if defined(BUILD_KIWAY_DLLS)
|
||||
PGM_BASE& Pgm()
|
||||
{
|
||||
wxASSERT( process ); // KIFACE_GETTER has already been called.
|
||||
return *process;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
{
|
||||
return start_common( aCtlBits );
|
||||
}
|
|
@ -84,7 +84,9 @@ int BITMAPCONV_INFO::ConvertBitmap( potrace_bitmap_t* aPotrace_bitmap,
|
|||
param = potrace_param_default();
|
||||
if( !param )
|
||||
{
|
||||
fprintf( stderr, "Error allocating parameters: %s\n", strerror( errno ) );
|
||||
char msg[256];
|
||||
sprintf( msg, "Error allocating parameters: %s\n", strerror( errno ) );
|
||||
m_errors += msg;
|
||||
return 1;
|
||||
}
|
||||
param->turdsize = 0;
|
||||
|
@ -99,7 +101,9 @@ int BITMAPCONV_INFO::ConvertBitmap( potrace_bitmap_t* aPotrace_bitmap,
|
|||
}
|
||||
potrace_param_free( param );
|
||||
|
||||
fprintf( stderr, "Error tracing bitmap: %s\n", strerror( errno ) );
|
||||
char msg[256];
|
||||
sprintf( msg, "Error tracing bitmap: %s\n", strerror( errno ) );
|
||||
m_errors += msg;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -199,7 +203,7 @@ void BITMAPCONV_INFO::outputDataHeader( const char * aBrdLayerName )
|
|||
// fields text thickness = 1.5 / 5 = 0.3mm
|
||||
sprintf( strbuf, "(module %s (layer F.Cu)\n (at 0 0)\n", m_CmpName.c_str() );
|
||||
m_Data += strbuf;
|
||||
sprintf( strbuf, " (fp_text reference \"G***\" (at 0 0) (layer %s) hide\n"
|
||||
sprintf( strbuf, " (fp_text reference \"G***\" (at 0 0) (layer %s)\n"
|
||||
" (effects (font (thickness 0.3)))\n )\n", aBrdLayerName );
|
||||
m_Data += strbuf;
|
||||
sprintf( strbuf, " (fp_text value \"%s\" (at 0.75 0) (layer %s) hide\n"
|
||||
|
@ -399,7 +403,9 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
|
|||
potrace_path_t* paths = m_Paths; // the list of paths
|
||||
|
||||
if(!m_Paths)
|
||||
printf("NULL Paths!\n");
|
||||
{
|
||||
m_errors += "No path in black and white image: no outline created\n";
|
||||
}
|
||||
|
||||
while( paths != NULL )
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define BITMAP2COMPONENT_H
|
||||
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <potracelib.h>
|
||||
#include <potracelib.h>
|
||||
|
||||
// for consistency this enum should conform to the
|
||||
// indices in m_radioBoxFormat from bitmap2cmp_gui.cpp
|
||||
|
@ -62,6 +62,7 @@ private:
|
|||
potrace_path_t* m_Paths; // the list of paths, from potrace (list of lines and bezier curves)
|
||||
std::string m_CmpName; // The string used as cmp/footprint name
|
||||
std::string& m_Data; // the buffer containing the conversion
|
||||
std::string m_errors; // a buffer to return error messages
|
||||
|
||||
public:
|
||||
BITMAPCONV_INFO( std::string& aData );
|
||||
|
@ -73,6 +74,7 @@ public:
|
|||
OUTPUT_FMT_ID aFormat, int aDpi_X, int aDpi_Y,
|
||||
BMP2CMP_MOD_LAYER aModLayer );
|
||||
|
||||
std::string& GetErrorMessages() {return m_errors; }
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue