43#include <wx/filedlg.h>
47#define DEFAULT_DPI 300
85 outputDPI = std::max( 1, outputDPI );
151 wxDefaultSize, wxDEFAULT_FRAME_STYLE, wxT(
"bitmap2cmp" ),
unityScale ),
159 wxIconBundle icon_bundle;
162 icon_bundle.AddIcon( icon );
164 icon_bundle.AddIcon( icon );
166 icon_bundle.AddIcon( icon );
168 icon_bundle.AddIcon( icon );
170 icon_bundle.AddIcon( icon );
172 SetIcons( icon_bundle );
174 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
175 SetSizer( mainSizer );
178 mainSizer->Add(
m_panel, 1, wxEXPAND, 5 );
180 m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
197 GetSizer()->SetSizeHints(
this );
231 return m_panel->GetCurrentPage();
259 wxCHECK( base_frame, );
263 wxMenuBar* oldMenuBar = base_frame->GetMenuBar();
277 if( !openRecentMenu )
282 fileHistory.UseMenu( openRecentMenu );
287 openRecentMenu->
SetTitle(
_(
"Open Recent" ) );
290 wxMenuItem* item = fileMenu->
Add( openRecentMenu->
Clone() );
297 fileMenu->AppendSeparator();
298 fileMenu->
AddQuit(
_(
"Image Converter" ) );
306 prefsMenu->AppendSeparator();
312 menuBar->Append( fileMenu,
_(
"&File" ) );
313 menuBar->Append( prefsMenu,
_(
"&Preferences" ) );
314 base_frame->AddStandardHelpMenu( menuBar );
316 base_frame->SetMenuBar( menuBar );
332 wxSizer* mainSizer =
m_panel->GetContainingSizer();
337 mainSizer->Add(
m_panel, 1, wxEXPAND, 5 );
344 m_panel->SetOutputSize( imageSizeX, imageSizeY );
358 title = filename.GetFullName() + wxT(
" \u2014 " );
361 title +=
_(
"Image Converter" );
396 wxString
path = fn.GetPath();
398 if(
path.IsEmpty() || !wxDirExists(
path ) )
401 wxFileDialog fileDlg(
this,
_(
"Choose Image" ),
path, wxEmptyString,
402 _(
"Image Files" ) + wxS(
" " )+ wxImage::GetImageExtWildcard(),
403 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
405 if( fileDlg.ShowModal() != wxID_OK )
408 wxString fullFilename = fileDlg.GetPath();
415 SetStatusText( fullFilename );
425 if(
m_panel->OpenProjectFiles( aFileSet, aCtl ) )
438 wxString
path = fn.GetPath();
440 if(
path.IsEmpty() || !wxDirExists(
path) )
443 wxFileDialog fileDlg(
this,
_(
"Create Drawing Sheet File" ),
path, wxEmptyString,
446 if( fileDlg.ShowModal() != wxID_OK )
449 fn = fileDlg.GetPath();
457 wxMessageBox( wxString::Format(
_(
"File '%s' could not be created." ),
m_outFileName ) );
463 fputs( buffer.c_str(), outfile );
471 wxString
path = fn.GetPath();
473 if(
path.IsEmpty() || !wxDirExists(
path ) )
476 wxFileDialog fileDlg(
this,
_(
"Create PostScript File" ),
path, wxEmptyString,
479 if( fileDlg.ShowModal() != wxID_OK )
482 fn = fileDlg.GetPath();
483 fn.SetExt( wxT(
"ps" ) );
490 wxMessageBox( wxString::Format(
_(
"File '%s' could not be created." ),
m_outFileName ) );
496 fputs( buffer.c_str(), outfile );
504 wxString
path = fn.GetPath();
506 if(
path.IsEmpty() || !wxDirExists(
path ) )
509 wxFileDialog fileDlg(
this,
_(
"Create Symbol Library" ),
path, wxEmptyString,
511 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
513 if( fileDlg.ShowModal() != wxID_OK )
523 wxMessageBox( wxString::Format(
_(
"File '%s' could not be created." ),
m_outFileName ) );
529 fputs( buffer.c_str(), outfile );
537 wxString
path = fn.GetPath();
539 if(
path.IsEmpty() || !wxDirExists(
path ) )
542 wxFileDialog fileDlg(
this,
_(
"Create Footprint Library" ),
path, wxEmptyString,
544 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
546 if( fileDlg.ShowModal() != wxID_OK )
556 wxMessageBox( wxString::Format(
_(
"File '%s' could not be created." ),
m_outFileName ) );
562 fputs( buffer.c_str(), outfile );
constexpr EDA_IU_SCALE unityScale
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
@ icon_bitmap2component_32
@ icon_bitmap2component_16
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION openPreferences
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Handle actions for the various symbol editor and viewers.
void ExportPcbnewFormat()
Generate a footprint in S expr format.
void ExportDrawingSheetFormat()
Generate a file suitable to be copied into a drawing sheet (.kicad_wks) file.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void ExportEeschemaFormat()
Generate a schematic library which contains one component: the logo.
wxStatusBar * m_statusBar
void OnExit(wxCommandEvent &aEvent)
Event handler for the wxID_EXIT and wxID_CLOSE events.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void OnFileHistory(wxCommandEvent &event)
BITMAP2CMP_FRAME(KIWAY *aKiway, wxWindow *aParent)
void doReCreateMenuBar() override
wxWindow * GetToolCanvas() const override
Canvas access.
void ExportPostScriptFormat()
Generate a postscript file.
BITMAP2CMP_PANEL * m_panel
bool OpenProjectFiles(const std::vector< wxString > &aFilenames, int aCtl=0) override
Open a project or set of files given by aFileList.
void OnClearFileHistory(wxCommandEvent &event)
void ShowChangedLanguage() override
Handle actions that are shared between different applications.
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
EDA_BASE_FRAME(wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, KIWAY *aKiway, const EDA_IU_SCALE &aIuScale)
void AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Create a menu list for language choice, and add it as submenu to MasterMenu.
void UpdateFileHistory(const wxString &FullFileName, FILE_HISTORY *aFileHistory=nullptr)
Update the list of recently opened files.
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
FILE_HISTORY & GetFileHistory()
Get the frame's main file history.
virtual void ClearFileHistory()
Remove all files from the file history.
wxString GetFileFromHistory(int cmdId, const wxString &type, FILE_HISTORY *aFileHistory=nullptr)
Fetch the file name from the file history list.
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
virtual void RegisterUIUpdateHandler(int aID, const ACTION_CONDITIONS &aConditions) override
Register a UI update handler for the control with ID aID.
void ReCreateMenuBar()
Recreate the menu bar.
This class implements a file history object to store a list of files, that can then be added to a men...
static SELECTION_CONDITION FileHistoryNotEmpty(const FILE_HISTORY &aHistory)
Create a SELECTION_CONDITION that can be used to enable a menu item when the file history has items i...
void UpdateClearText(wxMenu *aMenu, wxString aClearText)
Update the text displayed on the menu item that clears the entire menu.
void AddFilesToMenu() override
Add the files to all registered menus.
void SetUnit(EDA_UNITS aUnit)
int GetOriginalSizePixels()
void SetOutputSizeFromInitialImageSize()
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, const EDA_IU_SCALE &aIuScale)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
EVT_MENU_RANGE(ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILEMAX, GERBVIEW_FRAME::OnDrlFileHistory) EVT_MENU_RANGE(ID_GERBVIEW_ZIP_FILE1
static const std::string KiCadSymbolLibFileExtension
static const std::string DrawingSheetFileExtension
static const std::string KiCadFootprintFileExtension
static wxString KiCadSymbolLibFileWildcard()
static wxString KiCadFootprintLibFileWildcard()
static wxString PSFileWildcard()
static wxString DrawingSheetFileWildcard()
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
ACTION_CONDITIONS & Enable(const SELECTION_CONDITION &aCondition)
Definition of file extensions used in Kicad.