mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Add initial dialog for pcb render job
This commit is contained in:
parent
e384628478
commit
d8779a6c98
@ -19,10 +19,63 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <jobs/job_registry.h>
|
||||
#include <jobs/job_pcb_render.h>
|
||||
#include <i18n_utility.h>
|
||||
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_PCB_RENDER::FORMAT,
|
||||
{
|
||||
{ JOB_PCB_RENDER::FORMAT::JPEG, "jpeg" },
|
||||
{ JOB_PCB_RENDER::FORMAT::PNG, "png" }
|
||||
} )
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_PCB_RENDER::QUALITY,
|
||||
{
|
||||
{ JOB_PCB_RENDER::QUALITY::BASIC, "basic" },
|
||||
{ JOB_PCB_RENDER::QUALITY::HIGH, "high" },
|
||||
{ JOB_PCB_RENDER::QUALITY::USER, "user" }
|
||||
} )
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_PCB_RENDER::SIDE,
|
||||
{
|
||||
{ JOB_PCB_RENDER::SIDE::BACK, "back" },
|
||||
{ JOB_PCB_RENDER::SIDE::BOTTOM, "bottom" },
|
||||
{ JOB_PCB_RENDER::SIDE::FRONT, "front" },
|
||||
{ JOB_PCB_RENDER::SIDE::LEFT, "left" },
|
||||
{ JOB_PCB_RENDER::SIDE::RIGHT, "right" },
|
||||
{ JOB_PCB_RENDER::SIDE::TOP, "top" }
|
||||
} )
|
||||
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_PCB_RENDER::BG_STYLE,
|
||||
{
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_DEFAULT, "default" },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_OPAQUE, "opaque" },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_TRANSPARENT, "transparent" }
|
||||
} )
|
||||
|
||||
JOB_PCB_RENDER::JOB_PCB_RENDER() :
|
||||
JOB( "render", false ), m_filename()
|
||||
{
|
||||
}
|
||||
m_params.emplace_back( new JOB_PARAM<FORMAT>( "format", &m_format, m_format ) );
|
||||
m_params.emplace_back( new JOB_PARAM<QUALITY>( "quality", &m_quality, m_quality ) );
|
||||
m_params.emplace_back( new JOB_PARAM<BG_STYLE>( "bg_style", &m_bgStyle, m_bgStyle ) );
|
||||
m_params.emplace_back( new JOB_PARAM<SIDE>( "side", &m_side, m_side ) );
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM<double>( "zoom", &m_zoom, m_zoom ) );
|
||||
m_params.emplace_back( new JOB_PARAM<bool>( "perspective", &m_perspective, m_perspective ) );
|
||||
m_params.emplace_back( new JOB_PARAM<bool>( "floor", &m_floor, m_floor ) );
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM<int>( "width", &m_width, m_width ) );
|
||||
m_params.emplace_back( new JOB_PARAM<int>( "height", &m_height, m_height ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
wxString JOB_PCB_RENDER::GetDescription()
|
||||
{
|
||||
return _( "Render PCB" );
|
||||
}
|
||||
|
||||
|
||||
REGISTER_JOB( pcb_render, _HKI( "PCB: Render" ), KIWAY::FACE_PCB, JOB_PCB_RENDER );
|
||||
|
@ -32,9 +32,9 @@ class KICOMMON_API JOB_PCB_RENDER : public JOB
|
||||
{
|
||||
public:
|
||||
JOB_PCB_RENDER();
|
||||
wxString GetDescription() override;
|
||||
|
||||
wxString m_filename;
|
||||
wxString m_outputFile;
|
||||
|
||||
enum class FORMAT
|
||||
{
|
||||
@ -51,9 +51,9 @@ public:
|
||||
|
||||
enum class BG_STYLE
|
||||
{
|
||||
DEFAULT,
|
||||
TRANSPARENT,
|
||||
OPAQUE
|
||||
BG_DEFAULT,
|
||||
BG_TRANSPARENT,
|
||||
BG_OPAQUE
|
||||
};
|
||||
|
||||
enum class SIDE
|
||||
@ -68,7 +68,7 @@ public:
|
||||
|
||||
FORMAT m_format = FORMAT::PNG;
|
||||
QUALITY m_quality = QUALITY::BASIC;
|
||||
BG_STYLE m_bgStyle = BG_STYLE::DEFAULT;
|
||||
BG_STYLE m_bgStyle = BG_STYLE::BG_DEFAULT;
|
||||
int m_width = 0;
|
||||
int m_height = 0;
|
||||
std::string m_colorPreset;
|
||||
|
@ -243,7 +243,7 @@ int CLI::PCB_RENDER_COMMAND::doPerform( KIWAY& aKiway )
|
||||
{
|
||||
std::unique_ptr<JOB_PCB_RENDER> renderJob( new JOB_PCB_RENDER() );
|
||||
|
||||
renderJob->m_outputFile = m_argOutput;
|
||||
renderJob->SetOutputPath( m_argOutput );
|
||||
renderJob->m_filename = m_argInput;
|
||||
renderJob->SetVarOverrides( m_argDefineVars );
|
||||
|
||||
|
@ -134,6 +134,8 @@ set( PCBNEW_DIALOGS
|
||||
dialogs/dialog_position_relative.cpp
|
||||
dialogs/dialog_position_relative_base.cpp
|
||||
dialogs/dialog_print_pcbnew.cpp
|
||||
dialogs/dialog_render_job_base.cpp
|
||||
dialogs/dialog_render_job.cpp
|
||||
dialogs/dialog_set_offset_base.cpp
|
||||
dialogs/dialog_set_offset.cpp
|
||||
dialogs/dialog_swap_layers.cpp
|
||||
|
190
pcbnew/dialogs/dialog_render_job.cpp
Normal file
190
pcbnew/dialogs/dialog_render_job.cpp
Normal file
@ -0,0 +1,190 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 Mark Roszko <mark.roszko@gmail.com>
|
||||
* Copyright (C) 2024 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <dialogs/dialog_render_job.h>
|
||||
#include <jobs/job_pcb_render.h>
|
||||
#include <i18n_utility.h>
|
||||
|
||||
static std::map<JOB_PCB_RENDER::FORMAT, wxString> outputFormatMap = {
|
||||
{ JOB_PCB_RENDER::FORMAT::JPEG, _HKI( "JPEG" ) },
|
||||
{ JOB_PCB_RENDER::FORMAT::PNG, _HKI( "PNG" ) }
|
||||
};
|
||||
|
||||
static std::map<JOB_PCB_RENDER::BG_STYLE, wxString> bgStyleMap = {
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_DEFAULT, _HKI( "Default" ) },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_OPAQUE, _HKI( "Opaque" ) },
|
||||
{ JOB_PCB_RENDER::BG_STYLE::BG_TRANSPARENT, _HKI( "Transparent" ) }
|
||||
};
|
||||
|
||||
static std::map<JOB_PCB_RENDER::QUALITY, wxString> qualityMap = {
|
||||
{ JOB_PCB_RENDER::QUALITY::BASIC, _HKI( "Basic" ) },
|
||||
{ JOB_PCB_RENDER::QUALITY::HIGH, _HKI( "High" ) },
|
||||
{ JOB_PCB_RENDER::QUALITY::USER, _HKI( "User" ) }
|
||||
};
|
||||
|
||||
static std::map<JOB_PCB_RENDER::SIDE, wxString> sideMap = {
|
||||
{ JOB_PCB_RENDER::SIDE::BACK, _HKI( "Back" ) },
|
||||
{ JOB_PCB_RENDER::SIDE::BOTTOM, _HKI( "Bottom" ) },
|
||||
{ JOB_PCB_RENDER::SIDE::FRONT, _HKI( "Front" ) },
|
||||
{ JOB_PCB_RENDER::SIDE::LEFT, _HKI( "Left" ) },
|
||||
{ JOB_PCB_RENDER::SIDE::RIGHT, _HKI( "Right" ) },
|
||||
{ JOB_PCB_RENDER::SIDE::TOP, _HKI( "Top" ) }
|
||||
};
|
||||
|
||||
DIALOG_RENDER_JOB::DIALOG_RENDER_JOB( wxWindow* aParent, JOB_PCB_RENDER* aJob ) :
|
||||
DIALOG_RENDER_JOB_BASE( aParent ), m_job( aJob )
|
||||
{
|
||||
for( const auto& [k, name] : outputFormatMap )
|
||||
{
|
||||
m_choiceFormat->Append( wxGetTranslation( name ) );
|
||||
}
|
||||
|
||||
for( const auto& [k, name] : bgStyleMap )
|
||||
{
|
||||
m_choiceBgStyle->Append( wxGetTranslation( name ) );
|
||||
}
|
||||
|
||||
for( const auto& [k, name] : qualityMap )
|
||||
{
|
||||
m_choiceQuality->Append( wxGetTranslation( name ) );
|
||||
}
|
||||
|
||||
for( const auto& [k, name] : sideMap )
|
||||
{
|
||||
m_choiceSide->Append( wxGetTranslation( name ) );
|
||||
}
|
||||
|
||||
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
|
||||
{ wxID_CANCEL, _( "Close" ) } } );
|
||||
}
|
||||
|
||||
|
||||
JOB_PCB_RENDER::FORMAT DIALOG_RENDER_JOB::getSelectedFormat()
|
||||
{
|
||||
int selIndx = m_choiceFormat->GetSelection();
|
||||
auto it = outputFormatMap.begin();
|
||||
std::advance( it, selIndx );
|
||||
return it->first;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_RENDER_JOB::setSelectedFormat( JOB_PCB_RENDER::FORMAT aFormat )
|
||||
{
|
||||
auto it = outputFormatMap.find( aFormat );
|
||||
if( it != outputFormatMap.end() )
|
||||
{
|
||||
int idx = std::distance( outputFormatMap.begin(), it );
|
||||
m_choiceFormat->SetSelection( idx );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JOB_PCB_RENDER::SIDE DIALOG_RENDER_JOB::getSelectedSide()
|
||||
{
|
||||
int selIndx = m_choiceSide->GetSelection();
|
||||
auto it = sideMap.begin();
|
||||
std::advance( it, selIndx );
|
||||
return it->first;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_RENDER_JOB::setSelectedSide( JOB_PCB_RENDER::SIDE aSide )
|
||||
{
|
||||
auto it = sideMap.find( aSide );
|
||||
if( it != sideMap.end() )
|
||||
{
|
||||
int idx = std::distance( sideMap.begin(), it );
|
||||
m_choiceSide->SetSelection( idx );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JOB_PCB_RENDER::QUALITY DIALOG_RENDER_JOB::getSelectedQuality()
|
||||
{
|
||||
int selIndx = m_choiceQuality->GetSelection();
|
||||
auto it = qualityMap.begin();
|
||||
std::advance( it, selIndx );
|
||||
return it->first;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_RENDER_JOB::setSelectedQuality( JOB_PCB_RENDER::QUALITY aQuality )
|
||||
{
|
||||
auto it = qualityMap.find( aQuality );
|
||||
if( it != qualityMap.end() )
|
||||
{
|
||||
int idx = std::distance( qualityMap.begin(), it );
|
||||
m_choiceQuality->SetSelection( idx );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JOB_PCB_RENDER::BG_STYLE DIALOG_RENDER_JOB::getSelectedBgStyle()
|
||||
{
|
||||
int selIndx = m_choiceBgStyle->GetSelection();
|
||||
auto it = bgStyleMap.begin();
|
||||
std::advance( it, selIndx );
|
||||
return it->first;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_RENDER_JOB::setSelectedBgStyle( JOB_PCB_RENDER::BG_STYLE aBgStyle )
|
||||
{
|
||||
auto it = bgStyleMap.find( aBgStyle );
|
||||
if( it != bgStyleMap.end() )
|
||||
{
|
||||
int idx = std::distance( bgStyleMap.begin(), it );
|
||||
m_choiceBgStyle->SetSelection( idx );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_RENDER_JOB::TransferDataFromWindow()
|
||||
{
|
||||
m_job->SetOutputPath( m_textCtrlOutputFile->GetValue() );
|
||||
|
||||
m_job->m_format = getSelectedFormat();
|
||||
m_job->m_quality = getSelectedQuality();
|
||||
m_job->m_bgStyle = getSelectedBgStyle();
|
||||
m_job->m_side = getSelectedSide();
|
||||
m_job->m_zoom = m_spinCtrlZoom->GetValue();
|
||||
m_job->m_floor = m_cbFloor->GetValue();
|
||||
|
||||
m_radioProjection->GetSelection() == 0 ? m_job->m_perspective = true
|
||||
: m_job->m_perspective = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_RENDER_JOB::TransferDataToWindow()
|
||||
{
|
||||
m_textCtrlOutputFile->SetValue( m_job->GetOutputPath() );
|
||||
|
||||
setSelectedFormat( m_job->m_format );
|
||||
setSelectedBgStyle( m_job->m_bgStyle );
|
||||
setSelectedQuality( m_job->m_quality );
|
||||
setSelectedSide( m_job->m_side );
|
||||
m_spinCtrlZoom->SetValue( m_job->m_zoom );
|
||||
m_radioProjection->SetSelection( m_job->m_perspective ? 0 : 1 );
|
||||
m_cbFloor->SetValue( m_job->m_floor );
|
||||
|
||||
return true;
|
||||
}
|
48
pcbnew/dialogs/dialog_render_job.h
Normal file
48
pcbnew/dialogs/dialog_render_job.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2024 Mark Roszko <mark.roszko@gmail.com>
|
||||
* Copyright (C) 2024 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <dialog_render_job_base.h>
|
||||
#include <jobs/job_pcb_render.h>
|
||||
|
||||
class DIALOG_RENDER_JOB : public DIALOG_RENDER_JOB_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_RENDER_JOB( wxWindow* aParent, JOB_PCB_RENDER* aJob );
|
||||
|
||||
bool TransferDataFromWindow() override;
|
||||
bool TransferDataToWindow() override;
|
||||
|
||||
JOB_PCB_RENDER::FORMAT getSelectedFormat();
|
||||
void setSelectedFormat( JOB_PCB_RENDER::FORMAT aFormat );
|
||||
|
||||
JOB_PCB_RENDER::SIDE getSelectedSide();
|
||||
void setSelectedSide( JOB_PCB_RENDER::SIDE aSide );
|
||||
|
||||
JOB_PCB_RENDER::QUALITY getSelectedQuality();
|
||||
void setSelectedQuality( JOB_PCB_RENDER::QUALITY aSide );
|
||||
|
||||
JOB_PCB_RENDER::BG_STYLE getSelectedBgStyle();
|
||||
void setSelectedBgStyle( JOB_PCB_RENDER::BG_STYLE aBgStyle );
|
||||
|
||||
protected:
|
||||
JOB_PCB_RENDER* m_job;
|
||||
};
|
137
pcbnew/dialogs/dialog_render_job_base.cpp
Normal file
137
pcbnew/dialogs/dialog_render_job_base.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_render_job_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_RENDER_JOB_BASE::DIALOG_RENDER_JOB_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Options"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText9->Wrap( -1 );
|
||||
m_staticText9->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
||||
|
||||
bSizerMain->Add( m_staticText9, 0, wxALL, 5 );
|
||||
|
||||
m_panel9 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxFlexGridSizer* fgSizer1;
|
||||
fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_textOutputPath = new wxStaticText( m_panel9, wxID_ANY, _("Output File"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textOutputPath->Wrap( -1 );
|
||||
fgSizer1->Add( m_textOutputPath, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_textCtrlOutputFile = new wxTextCtrl( m_panel9, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textCtrlOutputFile->SetMinSize( wxSize( 350,-1 ) );
|
||||
|
||||
fgSizer1->Add( m_textCtrlOutputFile, 0, wxALL, 5 );
|
||||
|
||||
m_staticText18 = new wxStaticText( m_panel9, wxID_ANY, _("Format"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText18->Wrap( -1 );
|
||||
fgSizer1->Add( m_staticText18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxArrayString m_choiceFormatChoices;
|
||||
m_choiceFormat = new wxChoice( m_panel9, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceFormatChoices, 0 );
|
||||
m_choiceFormat->SetSelection( 0 );
|
||||
fgSizer1->Add( m_choiceFormat, 0, wxALL, 5 );
|
||||
|
||||
m_staticText181 = new wxStaticText( m_panel9, wxID_ANY, _("Quality"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText181->Wrap( -1 );
|
||||
fgSizer1->Add( m_staticText181, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxArrayString m_choiceQualityChoices;
|
||||
m_choiceQuality = new wxChoice( m_panel9, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceQualityChoices, 0 );
|
||||
m_choiceQuality->SetSelection( 0 );
|
||||
fgSizer1->Add( m_choiceQuality, 0, wxALL, 5 );
|
||||
|
||||
m_staticText1811 = new wxStaticText( m_panel9, wxID_ANY, _("Background Style"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1811->Wrap( -1 );
|
||||
fgSizer1->Add( m_staticText1811, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxArrayString m_choiceBgStyleChoices;
|
||||
m_choiceBgStyle = new wxChoice( m_panel9, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceBgStyleChoices, 0 );
|
||||
m_choiceBgStyle->SetSelection( 0 );
|
||||
fgSizer1->Add( m_choiceBgStyle, 0, wxALL, 5 );
|
||||
|
||||
m_staticText18111 = new wxStaticText( m_panel9, wxID_ANY, _("Side"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText18111->Wrap( -1 );
|
||||
fgSizer1->Add( m_staticText18111, 0, wxALL, 5 );
|
||||
|
||||
wxArrayString m_choiceSideChoices;
|
||||
m_choiceSide = new wxChoice( m_panel9, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceSideChoices, 0 );
|
||||
m_choiceSide->SetSelection( 0 );
|
||||
fgSizer1->Add( m_choiceSide, 0, wxALL, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_cbFloor = new wxCheckBox( m_panel9, wxID_ANY, _("Show floor"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_cbFloor, 1, wxALL, 5 );
|
||||
|
||||
m_staticText11 = new wxStaticText( m_panel9, wxID_ANY, _("Perspective"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText11->Wrap( -1 );
|
||||
fgSizer1->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxString m_radioProjectionChoices[] = { _("Perspective"), _("Orthogonal") };
|
||||
int m_radioProjectionNChoices = sizeof( m_radioProjectionChoices ) / sizeof( wxString );
|
||||
m_radioProjection = new wxRadioBox( m_panel9, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_radioProjectionNChoices, m_radioProjectionChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_radioProjection->SetSelection( 1 );
|
||||
fgSizer1->Add( m_radioProjection, 0, wxALL, 5 );
|
||||
|
||||
m_staticText15 = new wxStaticText( m_panel9, wxID_ANY, _("Zoom"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText15->Wrap( -1 );
|
||||
fgSizer1->Add( m_staticText15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_spinCtrlZoom = new wxSpinCtrlDouble( m_panel9, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 1, 0.1 );
|
||||
m_spinCtrlZoom->SetDigits( 2 );
|
||||
fgSizer1->Add( m_spinCtrlZoom, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_panel9->SetSizer( fgSizer1 );
|
||||
m_panel9->Layout();
|
||||
fgSizer1->Fit( m_panel9 );
|
||||
bSizerMain->Add( m_panel9, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_sdbSizer1 = new wxStdDialogButtonSizer();
|
||||
m_sdbSizer1OK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer1->AddButton( m_sdbSizer1OK );
|
||||
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
|
||||
m_sdbSizer1->Realize();
|
||||
|
||||
bSizerMain->Add( m_sdbSizer1, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_choiceFormat->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_RENDER_JOB_BASE::OnFormatChoice ), NULL, this );
|
||||
m_choiceQuality->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_RENDER_JOB_BASE::OnFormatChoice ), NULL, this );
|
||||
m_choiceBgStyle->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_RENDER_JOB_BASE::OnFormatChoice ), NULL, this );
|
||||
m_choiceSide->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_RENDER_JOB_BASE::OnFormatChoice ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_RENDER_JOB_BASE::~DIALOG_RENDER_JOB_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_choiceFormat->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_RENDER_JOB_BASE::OnFormatChoice ), NULL, this );
|
||||
m_choiceQuality->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_RENDER_JOB_BASE::OnFormatChoice ), NULL, this );
|
||||
m_choiceBgStyle->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_RENDER_JOB_BASE::OnFormatChoice ), NULL, this );
|
||||
m_choiceSide->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_RENDER_JOB_BASE::OnFormatChoice ), NULL, this );
|
||||
|
||||
}
|
1191
pcbnew/dialogs/dialog_render_job_base.fbp
Normal file
1191
pcbnew/dialogs/dialog_render_job_base.fbp
Normal file
File diff suppressed because it is too large
Load Diff
72
pcbnew/dialogs/dialog_render_job_base.h
Normal file
72
pcbnew/dialogs/dialog_render_job_base.h
Normal file
@ -0,0 +1,72 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// 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 "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_RENDER_JOB_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_RENDER_JOB_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticText9;
|
||||
wxPanel* m_panel9;
|
||||
wxStaticText* m_textOutputPath;
|
||||
wxTextCtrl* m_textCtrlOutputFile;
|
||||
wxStaticText* m_staticText18;
|
||||
wxChoice* m_choiceFormat;
|
||||
wxStaticText* m_staticText181;
|
||||
wxChoice* m_choiceQuality;
|
||||
wxStaticText* m_staticText1811;
|
||||
wxChoice* m_choiceBgStyle;
|
||||
wxStaticText* m_staticText18111;
|
||||
wxChoice* m_choiceSide;
|
||||
wxCheckBox* m_cbFloor;
|
||||
wxStaticText* m_staticText11;
|
||||
wxRadioBox* m_radioProjection;
|
||||
wxStaticText* m_staticText15;
|
||||
wxSpinCtrlDouble* m_spinCtrlZoom;
|
||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||
wxButton* m_sdbSizer1OK;
|
||||
wxButton* m_sdbSizer1Cancel;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnFormatChoice( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_RENDER_JOB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
||||
|
||||
~DIALOG_RENDER_JOB_BASE();
|
||||
|
||||
};
|
||||
|
@ -86,6 +86,7 @@
|
||||
#include <dialogs/dialog_export_step.h>
|
||||
#include <dialogs/dialog_plot.h>
|
||||
#include <dialogs/dialog_drc_job_config.h>
|
||||
#include <dialogs/dialog_render_job.h>
|
||||
|
||||
#include "pcbnew_scripting_helpers.h"
|
||||
#include <locale_io.h>
|
||||
@ -118,7 +119,10 @@ PCBNEW_JOBS_HANDLER::PCBNEW_JOBS_HANDLER( KIWAY* aKiway ) :
|
||||
std::bind( &PCBNEW_JOBS_HANDLER::JobExportRender, this, std::placeholders::_1 ),
|
||||
[]( JOB* job, wxWindow* aParent ) -> bool
|
||||
{
|
||||
return false;
|
||||
DIALOG_RENDER_JOB dlg( aParent, dynamic_cast<JOB_PCB_RENDER*>( job ) );
|
||||
dlg.ShowModal();
|
||||
|
||||
return dlg.GetReturnCode() == wxID_OK;
|
||||
} );
|
||||
Register( "svg", std::bind( &PCBNEW_JOBS_HANDLER::JobExportSvg, this, std::placeholders::_1 ),
|
||||
[aKiway]( JOB* job, wxWindow* aParent ) -> bool
|
||||
@ -505,8 +509,8 @@ int PCBNEW_JOBS_HANDLER::JobExportRender( JOB* aJob )
|
||||
cfg->m_CurrentPreset = aRenderJob->m_colorPreset;
|
||||
boardAdapter.m_Cfg = cfg;
|
||||
|
||||
if( aRenderJob->m_bgStyle == JOB_PCB_RENDER::BG_STYLE::TRANSPARENT
|
||||
|| ( aRenderJob->m_bgStyle == JOB_PCB_RENDER::BG_STYLE::DEFAULT
|
||||
if( aRenderJob->m_bgStyle == JOB_PCB_RENDER::BG_STYLE::BG_TRANSPARENT
|
||||
|| ( aRenderJob->m_bgStyle == JOB_PCB_RENDER::BG_STYLE::BG_DEFAULT
|
||||
&& aRenderJob->m_format == JOB_PCB_RENDER::FORMAT::PNG ) )
|
||||
{
|
||||
boardAdapter.m_ColorOverrides[LAYER_3D_BACKGROUND_TOP] = COLOR4D( 1.0, 1.0, 1.0, 0.0 );
|
||||
@ -601,7 +605,7 @@ int PCBNEW_JOBS_HANDLER::JobExportRender( JOB* aJob )
|
||||
image = image.Mirror( false );
|
||||
|
||||
image.SetOption( wxIMAGE_OPTION_QUALITY, 90 );
|
||||
image.SaveFile( aRenderJob->m_outputFile,
|
||||
image.SaveFile( aRenderJob->GetFullOutputPath(),
|
||||
aRenderJob->m_format == JOB_PCB_RENDER::FORMAT::PNG ? wxBITMAP_TYPE_PNG
|
||||
: wxBITMAP_TYPE_JPEG );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user