Separate BITMAP2CMP_PANEL from BITMAP2CMP_FRAME.
This is primarily to allow wxFormBuilder to create the panel without the dangerous hack of passing a wxWindow ID into KIWAY_PLAYER's ctor.
This commit is contained in:
parent
abc0c19d64
commit
150e2b8a19
|
@ -14,15 +14,17 @@ set( BITMAP2COMPONENT_SRCS
|
|||
bitmap2cmp_main.cpp
|
||||
bitmap2cmp_settings.cpp
|
||||
bitmap2component.cpp
|
||||
bitmap2cmp_gui_base.cpp
|
||||
bitmap2cmp_gui.cpp
|
||||
bitmap2cmp_panel_base.cpp
|
||||
bitmap2cmp_frame.cpp
|
||||
bitmap2cmp_panel.cpp
|
||||
bitmap2cmp_panel_base.cpp
|
||||
../common/env_vars.cpp # needed on MSW to avoid a link issue (a symbol not found)
|
||||
)
|
||||
|
||||
set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_BM2CMP"
|
||||
)
|
||||
set_source_files_properties( bitmap2cmp_gui.cpp PROPERTIES
|
||||
set_source_files_properties(bitmap2cmp_frame.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "COMPILING_DLL"
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,444 @@
|
|||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2010 jean-pierre.charras
|
||||
* Copyright (C) 1992-2023 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 <bitmap2component.h>
|
||||
#include <bitmap2cmp_frame.h>
|
||||
#include <bitmap2cmp_panel.h>
|
||||
#include <bitmap2cmp_settings.h>
|
||||
#include <bitmap_io.h>
|
||||
#include <bitmaps.h>
|
||||
#include <common.h>
|
||||
#include <kiface_base.h>
|
||||
#include <pgm_base.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
|
||||
#define DEFAULT_DPI 300 // the image DPI used in formats that do not define a DPI
|
||||
|
||||
IMAGE_SIZE::IMAGE_SIZE()
|
||||
{
|
||||
m_outputSize = 0.0;
|
||||
m_originalDPI = DEFAULT_DPI;
|
||||
m_originalSizePixels = 0;
|
||||
m_unit = EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
|
||||
|
||||
void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
|
||||
{
|
||||
// Safety-check to guarantee no divide-by-zero
|
||||
m_originalDPI = std::max( 1, m_originalDPI );
|
||||
|
||||
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
|
||||
else
|
||||
m_outputSize = m_originalDPI;
|
||||
}
|
||||
|
||||
|
||||
int IMAGE_SIZE::GetOutputDPI()
|
||||
{
|
||||
int outputDPI;
|
||||
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
outputDPI = GetOriginalSizePixels() / m_outputSize;
|
||||
else
|
||||
outputDPI = KiROUND( m_outputSize );
|
||||
|
||||
// Zero is not a DPI, and may cause divide-by-zero errors...
|
||||
outputDPI = std::max( 1, outputDPI );
|
||||
|
||||
return outputDPI;
|
||||
}
|
||||
|
||||
|
||||
void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
|
||||
{
|
||||
// Set the unit used for m_outputSize, and convert the old m_outputSize value
|
||||
// to the value in new unit
|
||||
if( aUnit == m_unit )
|
||||
return;
|
||||
|
||||
// Convert m_outputSize to mm:
|
||||
double size_mm;
|
||||
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
size_mm = m_outputSize;
|
||||
}
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
{
|
||||
size_mm = m_outputSize * 25.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_outputSize is the DPI, not an image size
|
||||
// the image size is m_originalSizePixels / m_outputSize (in inches)
|
||||
if( m_outputSize )
|
||||
size_mm = m_originalSizePixels / m_outputSize * 25.4;
|
||||
else
|
||||
size_mm = 0;
|
||||
}
|
||||
|
||||
// Convert m_outputSize to new value:
|
||||
if( aUnit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
m_outputSize = size_mm;
|
||||
}
|
||||
else if( aUnit == EDA_UNITS::INCHES )
|
||||
{
|
||||
m_outputSize = size_mm / 25.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( size_mm )
|
||||
m_outputSize = m_originalSizePixels / size_mm * 25.4;
|
||||
else
|
||||
m_outputSize = 0;
|
||||
}
|
||||
|
||||
m_unit = aUnit;
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( BITMAP2CMP_FRAME, KIWAY_PLAYER )
|
||||
EVT_MENU( wxID_EXIT, BITMAP2CMP_FRAME::OnExit )
|
||||
EVT_MENU( wxID_OPEN, BITMAP2CMP_FRAME::OnLoadFile )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
BITMAP2CMP_FRAME::BITMAP2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_BM2CMP, _( "Image Converter" ), wxDefaultPosition,
|
||||
wxDefaultSize, wxDEFAULT_FRAME_STYLE, wxT( "bitmap2cmp" ), unityScale ),
|
||||
m_panel( nullptr ),
|
||||
m_statusBar( nullptr )
|
||||
{
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
wxIconBundle icon_bundle;
|
||||
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_32 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_16 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
|
||||
SetIcons( icon_bundle );
|
||||
|
||||
wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
SetSizer( mainSizer );
|
||||
|
||||
m_panel = new BITMAP2CMP_PANEL( this );
|
||||
mainSizer->Add( m_panel, 1, wxEXPAND, 5 );
|
||||
|
||||
m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
|
||||
|
||||
ReCreateMenuBar();
|
||||
|
||||
LoadSettings( config() );
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
|
||||
|
||||
if ( m_framePos == wxDefaultPosition )
|
||||
Centre();
|
||||
}
|
||||
|
||||
|
||||
BITMAP2CMP_FRAME::~BITMAP2CMP_FRAME()
|
||||
{
|
||||
SaveSettings( config() );
|
||||
/*
|
||||
* This needed for OSX: avoids further OnDraw processing after this
|
||||
* destructor and before the native window is destroyed
|
||||
*/
|
||||
Freeze();
|
||||
}
|
||||
|
||||
|
||||
wxWindow* BITMAP2CMP_FRAME::GetToolCanvas() const
|
||||
{
|
||||
return m_panel->GetCurrentPage();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::doReCreateMenuBar()
|
||||
{
|
||||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
|
||||
wxMenu* fileMenu = new wxMenu;
|
||||
|
||||
wxMenuItem* item = new wxMenuItem( fileMenu, wxID_OPEN, _( "Open..." ) + wxT( "\tCtrl+O" ),
|
||||
_( "Load source image" ) );
|
||||
|
||||
fileMenu->Append( item );
|
||||
|
||||
#ifndef __WXMAC__
|
||||
// Mac moves Quit to the App menu so we don't need a separator on Mac
|
||||
fileMenu->AppendSeparator();
|
||||
#endif
|
||||
|
||||
item = new wxMenuItem( fileMenu, wxID_EXIT, _( "Quit" ) + wxT( "\tCtrl+Q" ),
|
||||
_( "Quit Image Converter" ) );
|
||||
|
||||
if( Pgm().GetCommonSettings()->m_Appearance.use_icons_in_menus )
|
||||
item->SetBitmap( KiBitmap( BITMAPS::exit ) );
|
||||
|
||||
fileMenu->Append( item );
|
||||
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
delete oldMenuBar;
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::OnExit( wxCommandEvent& event )
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
BITMAP2CMP_SETTINGS* cfg = dynamic_cast<BITMAP2CMP_SETTINGS*>( aCfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
m_bitmapFileName = cfg->m_BitmapFileName;
|
||||
m_convertedFileName = cfg->m_ConvertedFileName;
|
||||
m_panel->LoadSettings( cfg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||
|
||||
BITMAP2CMP_SETTINGS* cfg = dynamic_cast<BITMAP2CMP_SETTINGS*>( aCfg );
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_BitmapFileName = m_bitmapFileName;
|
||||
cfg->m_ConvertedFileName = m_convertedFileName;
|
||||
m_panel->SaveSettings( cfg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn( m_bitmapFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = m_mruPath;
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
||||
_( "Image Files" ) + wxS( " " )+ wxImage::GetImageExtWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
wxString fullFilename = fileDlg.GetPath();
|
||||
|
||||
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
|
||||
return;
|
||||
|
||||
fn = fullFilename;
|
||||
m_mruPath = fn.GetPath();
|
||||
SetStatusText( fullFilename );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
bool BITMAP2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
{
|
||||
m_bitmapFileName = aFileSet[0];
|
||||
|
||||
return m_panel->OpenProjectFiles( aFileSet, aCtl );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::ExportLogo()
|
||||
{
|
||||
wxFileName fn( m_convertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Logo File" ), path, wxEmptyString,
|
||||
DrawingSheetFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( DrawingSheetFileExtension );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
m_panel->ExportToBuffer( buffer, KICAD_WKS_LOGO );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::ExportPostScriptFormat()
|
||||
{
|
||||
wxFileName fn( m_convertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create PostScript File" ), path, wxEmptyString,
|
||||
PSFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( wxT( "ps" ) );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
m_panel->ExportToBuffer( buffer, POSTSCRIPT_FMT );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::ExportEeschemaFormat()
|
||||
{
|
||||
wxFileName fn( m_convertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Symbol Library" ), path, wxEmptyString,
|
||||
KiCadSymbolLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = EnsureFileExtension( fileDlg.GetPath(), KiCadSymbolLibFileExtension );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
m_panel->ExportToBuffer( buffer, EESCHEMA_FMT );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BITMAP2CMP_FRAME::ExportPcbnewFormat()
|
||||
{
|
||||
wxFileName fn( m_convertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = m_mruPath;
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Footprint Library" ), path, wxEmptyString,
|
||||
KiCadFootprintLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = EnsureFileExtension( fileDlg.GetPath(), KiCadFootprintFileExtension );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_convertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
m_panel->ExportToBuffer( buffer, PCBNEW_KICAD_MOD );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
m_mruPath = fn.GetPath();
|
||||
}
|
||||
|
||||
|
|
@ -23,12 +23,13 @@
|
|||
#ifndef BITMOP2CMP_GUI_H_
|
||||
#define BITMOP2CMP_GUI_H_
|
||||
|
||||
#include "bitmap2component.h"
|
||||
#include <kiway_player.h>
|
||||
#include <bitmap2cmp_frame.h>
|
||||
|
||||
#include "bitmap2cmp_gui_base.h"
|
||||
#include <eda_units.h>
|
||||
#include <potracelib.h>
|
||||
|
||||
class BITMAP2CMP_PANEL;
|
||||
|
||||
class IMAGE_SIZE
|
||||
{
|
||||
|
@ -82,97 +83,55 @@ private:
|
|||
int m_originalSizePixels; // The original image size read from file, in pixels
|
||||
};
|
||||
|
||||
class BM2CMP_FRAME : public BM2CMP_FRAME_BASE
|
||||
|
||||
class BITMAP2CMP_FRAME : public KIWAY_PLAYER
|
||||
{
|
||||
public:
|
||||
BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
~BM2CMP_FRAME();
|
||||
BITMAP2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
~BITMAP2CMP_FRAME();
|
||||
|
||||
// overload KIWAY_PLAYER virtual
|
||||
bool OpenProjectFiles( const std::vector<wxString>& aFilenames, int aCtl = 0 ) override;
|
||||
|
||||
void OnExit( wxCommandEvent& event );
|
||||
void OnLoadFile( wxCommandEvent& event ) override;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
// Event handlers
|
||||
void OnPaintInit( wxPaintEvent& event ) override;
|
||||
void OnPaintGreyscale( wxPaintEvent& event ) override;
|
||||
void OnPaintBW( wxPaintEvent& event ) override;
|
||||
void OnExportToFile( wxCommandEvent& event ) override;
|
||||
void OnExportToClipboard( wxCommandEvent& event ) override;
|
||||
|
||||
///< @return the EDA_UNITS from the m_PixelUnit choice
|
||||
EDA_UNITS getUnitFromSelection();
|
||||
|
||||
// return a string giving the output size, according to the selected unit
|
||||
wxString FormatOutputSize( double aSize );
|
||||
void OnLoadFile( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Generate a schematic library which contains one component:
|
||||
* the logo
|
||||
*/
|
||||
void exportEeschemaFormat();
|
||||
void ExportEeschemaFormat();
|
||||
|
||||
/**
|
||||
* Generate a footprint in S expr format
|
||||
*/
|
||||
void exportPcbnewFormat();
|
||||
void ExportPcbnewFormat();
|
||||
|
||||
/**
|
||||
* Generate a postscript file
|
||||
*/
|
||||
void exportPostScriptFormat();
|
||||
void ExportPostScriptFormat();
|
||||
|
||||
/**
|
||||
* Generate a file suitable to be copied into a drawing sheet (.kicad_wks) file
|
||||
*/
|
||||
void exportLogo();
|
||||
|
||||
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
|
||||
void OnNegativeClicked( wxCommandEvent& event ) override;
|
||||
void OnThresholdChange( wxScrollEvent& event ) override;
|
||||
|
||||
void OnSizeChangeX( wxCommandEvent& event ) override;
|
||||
void OnSizeChangeY( wxCommandEvent& event ) override;
|
||||
void OnSizeUnitChange( wxCommandEvent& event ) override;
|
||||
|
||||
void ToggleAspectRatioLock( wxCommandEvent& event ) override;
|
||||
|
||||
void NegateGreyscaleImage();
|
||||
/**
|
||||
* generate a export data of the current bitmap.
|
||||
* @param aOutput is a string buffer to fill with data
|
||||
* @param aFormat is the format to generate
|
||||
*/
|
||||
void ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat );
|
||||
|
||||
void updateImageInfo();
|
||||
void OnFormatChange( wxCommandEvent& event ) override;
|
||||
void exportBitmap( OUTPUT_FMT_ID aFormat );
|
||||
void ExportLogo();
|
||||
|
||||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
wxWindow* GetToolCanvas() const override;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
protected:
|
||||
void doReCreateMenuBar() override;
|
||||
|
||||
private:
|
||||
wxImage m_Pict_Image;
|
||||
wxBitmap m_Pict_Bitmap;
|
||||
wxImage m_Greyscale_Image;
|
||||
wxBitmap m_Greyscale_Bitmap;
|
||||
wxImage m_NB_Image;
|
||||
wxBitmap m_BN_Bitmap;
|
||||
IMAGE_SIZE m_outputSizeX;
|
||||
IMAGE_SIZE m_outputSizeY;
|
||||
bool m_Negative;
|
||||
wxString m_BitmapFileName;
|
||||
wxString m_ConvertedFileName;
|
||||
double m_AspectRatio;
|
||||
BITMAP2CMP_PANEL* m_panel;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
wxString m_bitmapFileName;
|
||||
wxString m_convertedFileName;
|
||||
};
|
||||
#endif// BITMOP2CMP_GUI_H_
|
|
@ -22,7 +22,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <bitmap2cmp_gui.h>
|
||||
#include <bitmap2cmp_frame.h>
|
||||
#include <bitmap2cmp_settings.h>
|
||||
#include <kiface_base.h>
|
||||
#include <kiway.h>
|
||||
|
@ -41,7 +41,7 @@ static struct IFACE : public KIFACE_BASE
|
|||
{
|
||||
InitSettings( new BITMAP2CMP_SETTINGS );
|
||||
Pgm().GetSettingsManager().RegisterSettings( KifaceSettings() );
|
||||
return new BM2CMP_FRAME( aKiway, aParent );
|
||||
return new BITMAP2CMP_FRAME( aKiway, aParent );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,140 +22,33 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "bitmap2cmp_gui.h"
|
||||
#include "bitmap2component.h"
|
||||
#include <bitmap2cmp_frame.h>
|
||||
#include <bitmap2component.h>
|
||||
#include <bitmap2cmp_panel.h>
|
||||
#include <bitmap2cmp_settings.h>
|
||||
#include <bitmap_io.h>
|
||||
#include <bitmaps.h>
|
||||
#include <common.h>
|
||||
#include <kiface_base.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <kiway.h>
|
||||
#include <pgm_base.h>
|
||||
#include <potracelib.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/common_control.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/rawbmp.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
|
||||
#include "bitmap2cmp_gui_base.h"
|
||||
#include "pgm_base.h"
|
||||
|
||||
#define DEFAULT_DPI 300 // the image DPI used in formats that do not define a DPI
|
||||
|
||||
IMAGE_SIZE::IMAGE_SIZE()
|
||||
|
||||
BITMAP2CMP_PANEL::BITMAP2CMP_PANEL( BITMAP2CMP_FRAME* aParent ) :
|
||||
BITMAP2CMP_PANEL_BASE( aParent ),
|
||||
m_parentFrame( aParent )
|
||||
{
|
||||
m_outputSize = 0.0;
|
||||
m_originalDPI = DEFAULT_DPI;
|
||||
m_originalSizePixels = 0;
|
||||
m_unit = EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
|
||||
|
||||
void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
|
||||
{
|
||||
// Safety-check to guarantee no divide-by-zero
|
||||
m_originalDPI = std::max( 1, m_originalDPI );
|
||||
|
||||
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
|
||||
else
|
||||
m_outputSize = m_originalDPI;
|
||||
}
|
||||
|
||||
|
||||
int IMAGE_SIZE::GetOutputDPI()
|
||||
{
|
||||
int outputDPI;
|
||||
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
outputDPI = GetOriginalSizePixels() / m_outputSize;
|
||||
else
|
||||
outputDPI = KiROUND( m_outputSize );
|
||||
|
||||
// Zero is not a DPI, and may cause divide-by-zero errors...
|
||||
outputDPI = std::max( 1, outputDPI );
|
||||
|
||||
return outputDPI;
|
||||
}
|
||||
|
||||
|
||||
void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
|
||||
{
|
||||
// Set the unit used for m_outputSize, and convert the old m_outputSize value
|
||||
// to the value in new unit
|
||||
if( aUnit == m_unit )
|
||||
return;
|
||||
|
||||
// Convert m_outputSize to mm:
|
||||
double size_mm;
|
||||
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
size_mm = m_outputSize;
|
||||
}
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
{
|
||||
size_mm = m_outputSize * 25.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_outputSize is the DPI, not an image size
|
||||
// the image size is m_originalSizePixels / m_outputSize (in inches)
|
||||
if( m_outputSize )
|
||||
size_mm = m_originalSizePixels / m_outputSize * 25.4;
|
||||
else
|
||||
size_mm = 0;
|
||||
}
|
||||
|
||||
// Convert m_outputSize to new value:
|
||||
if( aUnit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
m_outputSize = size_mm;
|
||||
}
|
||||
else if( aUnit == EDA_UNITS::INCHES )
|
||||
{
|
||||
m_outputSize = size_mm / 25.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( size_mm )
|
||||
m_outputSize = m_originalSizePixels / size_mm * 25.4;
|
||||
else
|
||||
m_outputSize = 0;
|
||||
}
|
||||
|
||||
m_unit = aUnit;
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( BM2CMP_FRAME, BM2CMP_FRAME_BASE )
|
||||
EVT_MENU( wxID_EXIT, BM2CMP_FRAME::OnExit )
|
||||
EVT_MENU( wxID_OPEN, BM2CMP_FRAME::OnLoadFile )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
BM2CMP_FRAME_BASE( aParent )
|
||||
{
|
||||
m_ident = FRAME_BM2CMP; // Initialized to wxID_ANY by wxFormBuilder
|
||||
SetKiway( this, aKiway );
|
||||
|
||||
for( wxString unit : { _( "mm" ), _( "Inch" ), _( "DPI" ) } )
|
||||
m_PixelUnit->Append( unit );
|
||||
|
||||
LoadSettings( config() );
|
||||
|
||||
m_outputSizeX.SetUnit( getUnitFromSelection() );
|
||||
m_outputSizeY.SetUnit( getUnitFromSelection() );
|
||||
m_outputSizeX.SetOutputSize( 0, getUnitFromSelection() );
|
||||
|
@ -164,99 +57,24 @@ BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_UnitSizeX->ChangeValue( FormatOutputSize( m_outputSizeX.GetOutputSize() ) );
|
||||
m_UnitSizeY->ChangeValue( FormatOutputSize( m_outputSizeY.GetOutputSize() ) );
|
||||
|
||||
// Give an icon
|
||||
wxIcon icon;
|
||||
wxIconBundle icon_bundle;
|
||||
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_32 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_bitmap2component_16 ) );
|
||||
icon_bundle.AddIcon( icon );
|
||||
|
||||
SetIcons( icon_bundle );
|
||||
|
||||
ReCreateMenuBar();
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
m_buttonExportFile->Enable( false );
|
||||
m_buttonExportClipboard->Enable( false );
|
||||
|
||||
SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
|
||||
|
||||
if ( m_framePos == wxDefaultPosition )
|
||||
Centre();
|
||||
}
|
||||
|
||||
|
||||
BM2CMP_FRAME::~BM2CMP_FRAME()
|
||||
BITMAP2CMP_PANEL::~BITMAP2CMP_PANEL()
|
||||
{
|
||||
SaveSettings( config() );
|
||||
/*
|
||||
* This needed for OSX: avoids further OnDraw processing after this
|
||||
* destructor and before the native window is destroyed
|
||||
*/
|
||||
Freeze();
|
||||
}
|
||||
|
||||
|
||||
wxWindow* BM2CMP_FRAME::GetToolCanvas() const
|
||||
wxWindow* BITMAP2CMP_PANEL::GetCurrentPage()
|
||||
{
|
||||
return m_Notebook->GetCurrentPage();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::doReCreateMenuBar()
|
||||
void BITMAP2CMP_PANEL::LoadSettings( BITMAP2CMP_SETTINGS* cfg )
|
||||
{
|
||||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
|
||||
wxMenu* fileMenu = new wxMenu;
|
||||
|
||||
wxMenuItem* item = new wxMenuItem( fileMenu, wxID_OPEN, _( "Open..." ) + wxT( "\tCtrl+O" ),
|
||||
_( "Load source image" ) );
|
||||
|
||||
fileMenu->Append( item );
|
||||
|
||||
#ifndef __WXMAC__
|
||||
// Mac moves Quit to the App menu so we don't need a separator on Mac
|
||||
fileMenu->AppendSeparator();
|
||||
#endif
|
||||
|
||||
item = new wxMenuItem( fileMenu, wxID_EXIT, _( "Quit" ) + wxT( "\tCtrl+Q" ),
|
||||
_( "Quit Image Converter" ) );
|
||||
|
||||
if( Pgm().GetCommonSettings()->m_Appearance.use_icons_in_menus )
|
||||
item->SetBitmap( KiBitmap( BITMAPS::exit ) );
|
||||
|
||||
fileMenu->Append( item );
|
||||
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
delete oldMenuBar;
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExit( wxCommandEvent& event )
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
BITMAP2CMP_SETTINGS* cfg = static_cast<BITMAP2CMP_SETTINGS*>( aCfg );
|
||||
|
||||
m_BitmapFileName = cfg->m_BitmapFileName;
|
||||
m_ConvertedFileName = cfg->m_ConvertedFileName;
|
||||
|
||||
int u_select = cfg->m_Units;
|
||||
|
||||
if( u_select < 0 || u_select > 2 ) // Validity control
|
||||
|
@ -291,14 +109,8 @@ void BM2CMP_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||
void BITMAP2CMP_PANEL::SaveSettings( BITMAP2CMP_SETTINGS* cfg )
|
||||
{
|
||||
EDA_BASE_FRAME::SaveSettings( aCfg );
|
||||
|
||||
BITMAP2CMP_SETTINGS* cfg = static_cast<BITMAP2CMP_SETTINGS*>( aCfg );
|
||||
|
||||
cfg->m_BitmapFileName = m_BitmapFileName;
|
||||
cfg->m_ConvertedFileName = m_ConvertedFileName;
|
||||
cfg->m_Threshold = m_sliderThreshold->GetValue();
|
||||
cfg->m_Negative = m_checkNegative->IsChecked();
|
||||
cfg->m_LastFormat = m_rbOutputFormat->GetSelection();
|
||||
|
@ -307,7 +119,7 @@ void BM2CMP_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnPaintInit( wxPaintEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnPaintInit( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
|
@ -326,7 +138,7 @@ void BM2CMP_FRAME::OnPaintInit( wxPaintEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnPaintGreyscale( wxPaintEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnPaintGreyscale( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
|
@ -345,7 +157,7 @@ void BM2CMP_FRAME::OnPaintGreyscale( wxPaintEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnPaintBW( wxPaintEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnPaintBW( wxPaintEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Otherwise fails due: using wxPaintDC without being in a native paint event
|
||||
|
@ -363,41 +175,17 @@ void BM2CMP_FRAME::OnPaintBW( wxPaintEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnLoadFile( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn( m_BitmapFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = m_mruPath;
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
||||
_( "Image Files" ) + wxS( " " )+ wxImage::GetImageExtWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
wxString fullFilename = fileDlg.GetPath();
|
||||
|
||||
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
|
||||
return;
|
||||
|
||||
fn = fullFilename;
|
||||
m_mruPath = fn.GetPath();
|
||||
SetStatusText( fullFilename );
|
||||
Refresh();
|
||||
m_parentFrame->OnLoadFile( event );
|
||||
}
|
||||
|
||||
|
||||
bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
bool BITMAP2CMP_PANEL::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
{
|
||||
m_Pict_Image.Destroy();
|
||||
m_BitmapFileName = aFileSet[0];
|
||||
|
||||
if( !m_Pict_Image.LoadFile( m_BitmapFileName ) )
|
||||
if( !m_Pict_Image.LoadFile( aFileSet[0] ) )
|
||||
{
|
||||
// LoadFile has its own UI, no need for further failure notification here
|
||||
return false;
|
||||
|
@ -485,7 +273,7 @@ bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int
|
|||
|
||||
|
||||
// return a string giving the output size, according to the selected unit
|
||||
wxString BM2CMP_FRAME::FormatOutputSize( double aSize )
|
||||
wxString BITMAP2CMP_PANEL::FormatOutputSize( double aSize )
|
||||
{
|
||||
wxString text;
|
||||
|
||||
|
@ -499,7 +287,7 @@ wxString BM2CMP_FRAME::FormatOutputSize( double aSize )
|
|||
return text;
|
||||
}
|
||||
|
||||
void BM2CMP_FRAME::updateImageInfo()
|
||||
void BITMAP2CMP_PANEL::updateImageInfo()
|
||||
{
|
||||
// Note: the image resolution text controls are not modified here, to avoid a race between
|
||||
// text change when entered by user and a text change if it is modified here.
|
||||
|
@ -517,7 +305,7 @@ void BM2CMP_FRAME::updateImageInfo()
|
|||
}
|
||||
|
||||
|
||||
EDA_UNITS BM2CMP_FRAME::getUnitFromSelection()
|
||||
EDA_UNITS BITMAP2CMP_PANEL::getUnitFromSelection()
|
||||
{
|
||||
// return the EDA_UNITS from the m_PixelUnit choice
|
||||
switch( m_PixelUnit->GetSelection() )
|
||||
|
@ -530,7 +318,7 @@ EDA_UNITS BM2CMP_FRAME::getUnitFromSelection()
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnSizeChangeX( wxCommandEvent& event )
|
||||
{
|
||||
double new_size;
|
||||
|
||||
|
@ -559,7 +347,7 @@ void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnSizeChangeY( wxCommandEvent& event )
|
||||
{
|
||||
double new_size;
|
||||
|
||||
|
@ -588,7 +376,7 @@ void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnSizeUnitChange( wxCommandEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnSizeUnitChange( wxCommandEvent& event )
|
||||
{
|
||||
m_outputSizeX.SetUnit( getUnitFromSelection() );
|
||||
m_outputSizeY.SetUnit( getUnitFromSelection() );
|
||||
|
@ -599,7 +387,7 @@ void BM2CMP_FRAME::OnSizeUnitChange( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::ToggleAspectRatioLock( wxCommandEvent& event )
|
||||
void BITMAP2CMP_PANEL::ToggleAspectRatioLock( wxCommandEvent& event )
|
||||
{
|
||||
if( m_aspectRatioCheckbox->GetValue() )
|
||||
{
|
||||
|
@ -610,7 +398,7 @@ void BM2CMP_FRAME::ToggleAspectRatioLock( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::Binarize( double aThreshold )
|
||||
void BITMAP2CMP_PANEL::Binarize( double aThreshold )
|
||||
{
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
int w = m_Greyscale_Image.GetWidth();
|
||||
|
@ -639,7 +427,7 @@ void BM2CMP_FRAME::Binarize( double aThreshold )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::NegateGreyscaleImage( )
|
||||
void BITMAP2CMP_PANEL::NegateGreyscaleImage( )
|
||||
{
|
||||
unsigned char pix;
|
||||
int h = m_Greyscale_Image.GetHeight();
|
||||
|
@ -657,7 +445,7 @@ void BM2CMP_FRAME::NegateGreyscaleImage( )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnNegativeClicked( wxCommandEvent& )
|
||||
void BITMAP2CMP_PANEL::OnNegativeClicked( wxCommandEvent& )
|
||||
{
|
||||
if( m_checkNegative->GetValue() != m_Negative )
|
||||
{
|
||||
|
@ -672,14 +460,14 @@ void BM2CMP_FRAME::OnNegativeClicked( wxCommandEvent& )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnThresholdChange( wxScrollEvent& event )
|
||||
{
|
||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnExportToFile( wxCommandEvent& event )
|
||||
{
|
||||
// choices of m_rbOutputFormat are expected to be in same order as
|
||||
// OUTPUT_FMT_ID. See bitmap2component.h
|
||||
|
@ -688,7 +476,7 @@ void BM2CMP_FRAME::OnExportToFile( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnExportToClipboard( wxCommandEvent& event )
|
||||
{
|
||||
// choices of m_rbOutputFormat are expected to be in same order as
|
||||
// OUTPUT_FMT_ID. See bitmap2component.h
|
||||
|
@ -715,161 +503,19 @@ void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::exportBitmap( OUTPUT_FMT_ID aFormat )
|
||||
void BITMAP2CMP_PANEL::exportBitmap( OUTPUT_FMT_ID aFormat )
|
||||
{
|
||||
switch( aFormat )
|
||||
{
|
||||
case EESCHEMA_FMT: exportEeschemaFormat(); break;
|
||||
case PCBNEW_KICAD_MOD: exportPcbnewFormat(); break;
|
||||
case POSTSCRIPT_FMT: exportPostScriptFormat(); break;
|
||||
case KICAD_WKS_LOGO: exportLogo(); break;
|
||||
case EESCHEMA_FMT: m_parentFrame->ExportEeschemaFormat(); break;
|
||||
case PCBNEW_KICAD_MOD: m_parentFrame->ExportPcbnewFormat(); break;
|
||||
case POSTSCRIPT_FMT: m_parentFrame->ExportPostScriptFormat(); break;
|
||||
case KICAD_WKS_LOGO: m_parentFrame->ExportLogo(); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::exportLogo()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Logo File" ), path, wxEmptyString,
|
||||
DrawingSheetFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( DrawingSheetFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, KICAD_WKS_LOGO );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::exportPostScriptFormat()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create PostScript File" ), path, wxEmptyString,
|
||||
PSFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( wxT( "ps" ) );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, POSTSCRIPT_FMT );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::exportEeschemaFormat()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists(path) )
|
||||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Symbol Library" ), path, wxEmptyString,
|
||||
KiCadSymbolLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = EnsureFileExtension( fileDlg.GetPath(), KiCadSymbolLibFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, EESCHEMA_FMT );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::exportPcbnewFormat()
|
||||
{
|
||||
wxFileName fn( m_ConvertedFileName );
|
||||
wxString path = fn.GetPath();
|
||||
|
||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||
path = m_mruPath;
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Footprint Library" ), path, wxEmptyString,
|
||||
KiCadFootprintLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = EnsureFileExtension( fileDlg.GetPath(), KiCadFootprintFileExtension );
|
||||
m_ConvertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
|
||||
|
||||
if( outfile == nullptr )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File '%s' could not be created." ), m_ConvertedFileName );
|
||||
wxMessageBox( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
std::string buffer;
|
||||
ExportToBuffer( buffer, PCBNEW_KICAD_MOD );
|
||||
fputs( buffer.c_str(), outfile );
|
||||
fclose( outfile );
|
||||
m_mruPath = fn.GetPath();
|
||||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat )
|
||||
void BITMAP2CMP_PANEL::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat )
|
||||
{
|
||||
// Create a potrace bitmap
|
||||
int h = m_NB_Image.GetHeight();
|
||||
|
@ -910,7 +556,7 @@ void BM2CMP_FRAME::ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat )
|
|||
}
|
||||
|
||||
|
||||
void BM2CMP_FRAME::OnFormatChange( wxCommandEvent& event )
|
||||
void BITMAP2CMP_PANEL::OnFormatChange( wxCommandEvent& event )
|
||||
{
|
||||
bool enable = m_rbOutputFormat->GetSelection() == PCBNEW_KICAD_MOD;
|
||||
m_chPCBLayer->Enable( enable );
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2022 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
|
||||
*/
|
||||
#ifndef BITMAP2CMP_PANEL_H
|
||||
#define BITMAP2CMP_PANEL_H
|
||||
|
||||
#include <bitmap2cmp_panel_base.h>
|
||||
#include <eda_units.h>
|
||||
|
||||
|
||||
class BITMAP2CMP_FRAME;
|
||||
class BITMAP2CMP_SETTINGS;
|
||||
|
||||
|
||||
class BITMAP2CMP_PANEL : public BITMAP2CMP_PANEL_BASE
|
||||
{
|
||||
public:
|
||||
BITMAP2CMP_PANEL( BITMAP2CMP_FRAME* aParent );
|
||||
~BITMAP2CMP_PANEL();
|
||||
|
||||
bool OpenProjectFiles( const std::vector<wxString>& aFilenames, int aCtl = 0 );
|
||||
|
||||
void OnLoadFile( wxCommandEvent& event ) override;
|
||||
|
||||
void LoadSettings( BITMAP2CMP_SETTINGS* aCfg );
|
||||
void SaveSettings( BITMAP2CMP_SETTINGS* aCfg );
|
||||
|
||||
wxWindow* GetCurrentPage();
|
||||
|
||||
/**
|
||||
* generate a export data of the current bitmap.
|
||||
* @param aOutput is a string buffer to fill with data
|
||||
* @param aFormat is the format to generate
|
||||
*/
|
||||
void ExportToBuffer( std::string& aOutput, OUTPUT_FMT_ID aFormat );
|
||||
|
||||
private:
|
||||
// Event handlers
|
||||
void OnPaintInit( wxPaintEvent& event ) override;
|
||||
void OnPaintGreyscale( wxPaintEvent& event ) override;
|
||||
void OnPaintBW( wxPaintEvent& event ) override;
|
||||
void OnExportToFile( wxCommandEvent& event ) override;
|
||||
void OnExportToClipboard( wxCommandEvent& event ) override;
|
||||
|
||||
///< @return the EDA_UNITS from the m_PixelUnit choice
|
||||
EDA_UNITS getUnitFromSelection();
|
||||
|
||||
// return a string giving the output size, according to the selected unit
|
||||
wxString FormatOutputSize( double aSize );
|
||||
|
||||
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
|
||||
void OnNegativeClicked( wxCommandEvent& event ) override;
|
||||
void OnThresholdChange( wxScrollEvent& event ) override;
|
||||
|
||||
void OnSizeChangeX( wxCommandEvent& event ) override;
|
||||
void OnSizeChangeY( wxCommandEvent& event ) override;
|
||||
void OnSizeUnitChange( wxCommandEvent& event ) override;
|
||||
|
||||
void ToggleAspectRatioLock( wxCommandEvent& event ) override;
|
||||
|
||||
void NegateGreyscaleImage();
|
||||
|
||||
void updateImageInfo();
|
||||
void OnFormatChange( wxCommandEvent& event ) override;
|
||||
void exportBitmap( OUTPUT_FMT_ID aFormat );
|
||||
|
||||
private:
|
||||
BITMAP2CMP_FRAME* m_parentFrame;
|
||||
|
||||
wxImage m_Pict_Image;
|
||||
wxBitmap m_Pict_Bitmap;
|
||||
wxImage m_Greyscale_Image;
|
||||
wxBitmap m_Greyscale_Bitmap;
|
||||
wxImage m_NB_Image;
|
||||
wxBitmap m_BN_Bitmap;
|
||||
IMAGE_SIZE m_outputSizeX;
|
||||
IMAGE_SIZE m_outputSizeY;
|
||||
bool m_Negative;
|
||||
double m_AspectRatio;
|
||||
};
|
||||
#endif// BITMAP2CMP_PANEL
|
|
@ -1,24 +1,16 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "bitmap2cmp_gui_base.h"
|
||||
#include "bitmap2cmp_panel_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 )
|
||||
BITMAP2CMP_PANEL_BASE::BITMAP2CMP_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
m_menubar = new wxMenuBar( 0 );
|
||||
m_menu1 = new wxMenu();
|
||||
m_menubar->Append( m_menu1, _("dummy") );
|
||||
|
||||
this->SetMenuBar( m_menubar );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
@ -106,6 +98,9 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
|
|||
m_buttonLoad = new wxButton( this, wxID_ANY, _("Load Source Image"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
brightSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerImgPrms;
|
||||
sbSizerImgPrms = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Output Size") ), wxVERTICAL );
|
||||
|
||||
|
@ -184,47 +179,46 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
|
|||
brightSizer->Add( m_buttonExportClipboard, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( brightSizer, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
bMainSizer->Add( brightSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
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_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
||||
m_aspectRatioCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_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_sliderThreshold->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), 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 );
|
||||
m_rbOutputFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), 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_InitialPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BITMAP2CMP_PANEL_BASE::OnPaintInit ), NULL, this );
|
||||
m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BITMAP2CMP_PANEL_BASE::OnPaintGreyscale ), NULL, this );
|
||||
m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BITMAP2CMP_PANEL_BASE::OnPaintBW ), NULL, this );
|
||||
m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnLoadFile ), NULL, this );
|
||||
m_aspectRatioCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::ToggleAspectRatioLock ), NULL, this );
|
||||
m_UnitSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnSizeChangeX ), NULL, this );
|
||||
m_UnitSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnSizeChangeY ), NULL, this );
|
||||
m_PixelUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnSizeUnitChange ), NULL, this );
|
||||
m_sliderThreshold->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( BITMAP2CMP_PANEL_BASE::OnThresholdChange ), NULL, this );
|
||||
m_sliderThreshold->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BITMAP2CMP_PANEL_BASE::OnThresholdChange ), NULL, this );
|
||||
m_checkNegative->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnNegativeClicked ), NULL, this );
|
||||
m_rbOutputFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnFormatChange ), NULL, this );
|
||||
m_buttonExportFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnExportToFile ), NULL, this );
|
||||
m_buttonExportClipboard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnExportToClipboard ), NULL, this );
|
||||
}
|
||||
|
||||
BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
|
||||
BITMAP2CMP_PANEL_BASE::~BITMAP2CMP_PANEL_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_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
|
||||
m_aspectRatioCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_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_sliderThreshold->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), 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 );
|
||||
m_rbOutputFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnFormatChange ), 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_InitialPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BITMAP2CMP_PANEL_BASE::OnPaintInit ), NULL, this );
|
||||
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BITMAP2CMP_PANEL_BASE::OnPaintGreyscale ), NULL, this );
|
||||
m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BITMAP2CMP_PANEL_BASE::OnPaintBW ), NULL, this );
|
||||
m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnLoadFile ), NULL, this );
|
||||
m_aspectRatioCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::ToggleAspectRatioLock ), NULL, this );
|
||||
m_UnitSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnSizeChangeX ), NULL, this );
|
||||
m_UnitSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnSizeChangeY ), NULL, this );
|
||||
m_PixelUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnSizeUnitChange ), NULL, this );
|
||||
m_sliderThreshold->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( BITMAP2CMP_PANEL_BASE::OnThresholdChange ), NULL, this );
|
||||
m_sliderThreshold->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BITMAP2CMP_PANEL_BASE::OnThresholdChange ), NULL, this );
|
||||
m_checkNegative->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnNegativeClicked ), NULL, this );
|
||||
m_rbOutputFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnFormatChange ), NULL, this );
|
||||
m_buttonExportFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnExportToFile ), NULL, this );
|
||||
m_buttonExportClipboard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BITMAP2CMP_PANEL_BASE::OnExportToClipboard ), NULL, this );
|
||||
|
||||
}
|
|
@ -11,13 +11,13 @@
|
|||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">bitmap2cmp_gui_base</property>
|
||||
<property name="file">bitmap2cmp_panel_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">bitmap2cmp_gui</property>
|
||||
<property name="name">bitmap2cmp_panel</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
|
@ -29,63 +29,29 @@
|
|||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Frame" expanded="1">
|
||||
<object class="Panel" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">BM2CMP_FRAME_BASE</property>
|
||||
<property name="name">BITMAP2CMP_PANEL_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style">wxCLOSE_BOX|wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">KIWAY_PLAYER; kiway_player.h</property>
|
||||
<property name="title">Image Converter</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="two_step_creation">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<property name="xrc_skip_sizer">1</property>
|
||||
<object class="wxMenuBar" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_menubar</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<object class="wxMenu" expanded="1">
|
||||
<property name="label">dummy</property>
|
||||
<property name="name">m_menu1</property>
|
||||
<property name="permission">protected</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bMainSizer</property>
|
||||
|
@ -117,7 +83,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -174,7 +139,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -235,7 +199,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -296,7 +259,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -336,7 +298,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -347,7 +309,7 @@
|
|||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Image Information</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -355,11 +317,11 @@
|
|||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</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="wxFlexGridSizer" expanded="1">
|
||||
<object class="wxFlexGridSizer" expanded="0">
|
||||
<property name="cols">4</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">1,2</property>
|
||||
|
@ -396,7 +358,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -458,7 +419,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -520,7 +480,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -582,7 +541,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -619,11 +577,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">wxBOTTOM|wxRIGHT|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>
|
||||
|
@ -644,7 +602,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -681,11 +638,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|wxBOTTOM|wxRIGHT|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>
|
||||
|
@ -706,7 +663,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -743,11 +699,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|wxBOTTOM|wxRIGHT</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>
|
||||
|
@ -768,7 +724,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -805,11 +760,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|wxBOTTOM|wxRIGHT</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>
|
||||
|
@ -830,7 +785,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -892,7 +846,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -954,7 +907,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1016,7 +968,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1053,11 +1004,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"></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">0</property>
|
||||
|
@ -1097,7 +1048,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1142,11 +1092,21 @@
|
|||
<event name="OnButtonClick">OnLoadFile</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Output Size</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -1154,11 +1114,11 @@
|
|||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1180,7 +1140,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1220,11 +1179,11 @@
|
|||
<event name="OnCheckBox">ToggleAspectRatioLock</event>
|
||||
</object>
|
||||
</object>
|
||||
<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="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerRes</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
|
@ -1254,7 +1213,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1316,7 +1274,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1382,7 +1339,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1449,7 +1405,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1497,7 +1452,7 @@
|
|||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Options</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -1505,11 +1460,11 @@
|
|||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">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>
|
||||
|
@ -1530,7 +1485,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1567,11 +1521,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">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxSlider" expanded="1">
|
||||
<object class="wxSlider" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1592,7 +1546,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1635,11 +1588,11 @@
|
|||
<event name="OnCommandScrollThumbTrack">OnThresholdChange</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1661,7 +1614,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1707,7 +1659,7 @@
|
|||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Pcb Layer for Graphics</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -1715,11 +1667,11 @@
|
|||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">protected</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="1">
|
||||
<object class="wxChoice" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1741,7 +1693,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1808,7 +1759,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1880,7 +1830,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -1955,7 +1904,6 @@
|
|||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
|
@ -2003,30 +1951,6 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="wxStatusBar" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="fields">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_statusBar</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxSTB_SIZEGRIP</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -10,14 +10,12 @@
|
|||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "kiway_player.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
|
@ -32,22 +30,19 @@
|
|||
#include <wx/choice.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/statusbr.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class BM2CMP_FRAME_BASE
|
||||
/// Class BITMAP2CMP_PANEL_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class BM2CMP_FRAME_BASE : public KIWAY_PLAYER
|
||||
class BITMAP2CMP_PANEL_BASE : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxMenuBar* m_menubar;
|
||||
wxMenu* m_menu1;
|
||||
wxNotebook* m_Notebook;
|
||||
wxScrolledWindow* m_InitialPicturePanel;
|
||||
wxScrolledWindow* m_GreyscalePicturePanel;
|
||||
|
@ -77,7 +72,6 @@ class BM2CMP_FRAME_BASE : public KIWAY_PLAYER
|
|||
wxRadioBox* m_rbOutputFormat;
|
||||
wxButton* m_buttonExportFile;
|
||||
wxButton* m_buttonExportClipboard;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnPaintInit( wxPaintEvent& event ) { event.Skip(); }
|
||||
|
@ -97,9 +91,9 @@ class BM2CMP_FRAME_BASE : public KIWAY_PLAYER
|
|||
|
||||
public:
|
||||
|
||||
BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Image Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCLOSE_BOX|wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
|
||||
BITMAP2CMP_PANEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
|
||||
~BM2CMP_FRAME_BASE();
|
||||
~BITMAP2CMP_PANEL_BASE();
|
||||
|
||||
};
|
||||
|
|
@ -55,27 +55,8 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
|
|||
}
|
||||
|
||||
|
||||
// Don't use this one; it's only for wxFormBuilder, and it must be augmented with code to
|
||||
// correct the m_ident and set the m_kiway early in derived constructor.
|
||||
//
|
||||
// Because of its inherent danger, it's also declared private and requires friend-class
|
||||
// declarations for each usage.
|
||||
//
|
||||
KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName ) :
|
||||
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName, nullptr,
|
||||
unityScale ),
|
||||
m_modal( false ),
|
||||
m_modal_loop( nullptr ),
|
||||
m_modal_resultant_parent( nullptr ),
|
||||
m_modal_ret_val( false ),
|
||||
m_socketServer( nullptr )
|
||||
KIWAY_PLAYER::~KIWAY_PLAYER() throw()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
KIWAY_PLAYER::~KIWAY_PLAYER() throw() {
|
||||
|
||||
// socket server must be destructed before we complete
|
||||
// destructing the frame or else we could crash
|
||||
|
|
|
@ -110,6 +110,9 @@ END_EVENT_TABLE()
|
|||
SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_SIMULATOR, _( "Simulator" ), wxDefaultPosition,
|
||||
wxDefaultSize, wxDEFAULT_FRAME_STYLE, wxT( "simulator" ), unityScale ),
|
||||
m_schematicFrame( nullptr ),
|
||||
m_toolBar( nullptr ),
|
||||
m_panel( nullptr ),
|
||||
m_lastSimPlot( nullptr ),
|
||||
m_simFinished( false ),
|
||||
m_workbookModified( false )
|
||||
|
|
|
@ -175,16 +175,6 @@ public:
|
|||
*/
|
||||
virtual void ExecuteRemoteCommand( const char* cmdline ){}
|
||||
|
||||
|
||||
private:
|
||||
friend class BM2CMP_FRAME_BASE;
|
||||
|
||||
/// Don't use this one, only wxformbuilder uses it, and it must be augmented with correcting
|
||||
/// m_ident and calling a SetKiway() early in derived constructor.
|
||||
KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName = wxFrameNameStr );
|
||||
|
||||
protected:
|
||||
|
||||
/// event handler, routes to derivative specific virtual KiwayMailIn()
|
||||
|
|
Loading…
Reference in New Issue