43#include <wx/filedlg.h>
48#define DEFAULT_DPI 300
86 outputDPI = std::max( 1, outputDPI );
152 wxDefaultSize, wxDEFAULT_FRAME_STYLE, wxT(
"bitmap2cmp" ),
unityScale ),
160 wxIconBundle icon_bundle;
163 icon_bundle.AddIcon( icon );
165 icon_bundle.AddIcon( icon );
167 icon_bundle.AddIcon( icon );
169 icon_bundle.AddIcon( icon );
171 icon_bundle.AddIcon( icon );
173 SetIcons( icon_bundle );
175 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
176 SetSizer( mainSizer );
179 mainSizer->Add(
m_panel, 1, wxEXPAND, 5 );
181 m_statusBar = this->CreateStatusBar( 1, wxSTB_SIZEGRIP, wxID_ANY );
198 GetSizer()->SetSizeHints(
this );
232 return m_panel->GetCurrentPage();
260 wxCHECK( base_frame, );
264 wxMenuBar* oldMenuBar = base_frame->GetMenuBar();
278 if( !openRecentMenu )
283 fileHistory.UseMenu( openRecentMenu );
288 openRecentMenu->
SetTitle(
_(
"Open Recent" ) );
291 wxMenuItem* item = fileMenu->
Add( openRecentMenu->
Clone() );
298 fileMenu->AppendSeparator();
299 fileMenu->
AddQuit(
_(
"Image Converter" ) );
307 prefsMenu->AppendSeparator();
313 menuBar->Append( fileMenu,
_(
"&File" ) );
314 menuBar->Append( prefsMenu,
_(
"&Preferences" ) );
315 base_frame->AddStandardHelpMenu( menuBar );
317 base_frame->SetMenuBar( menuBar );
333 wxSizer* mainSizer =
m_panel->GetContainingSizer();
338 mainSizer->Add(
m_panel, 1, wxEXPAND, 5 );
345 m_panel->SetOutputSize( imageSizeX, imageSizeY );
359 title = filename.GetFullName() + wxT(
" \u2014 " );
362 title +=
_(
"Image Converter" );
397 wxString
path = fn.GetPath();
399 if(
path.IsEmpty() || !wxDirExists(
path ) )
402 wxFileDialog fileDlg(
this,
_(
"Choose Image" ),
path, wxEmptyString,
407 if( fileDlg.ShowModal() != wxID_OK )
410 wxString fullFilename = fileDlg.GetPath();
417 SetStatusText( fullFilename );
427 if(
m_panel->OpenProjectFiles( aFileSet, aCtl ) )
440 wxString
path = fn.GetPath();
442 if(
path.IsEmpty() || !wxDirExists(
path) )
445 wxFileDialog fileDlg(
this,
_(
"Create Drawing Sheet File" ),
path, wxEmptyString,
450 if( fileDlg.ShowModal() != wxID_OK )
453 fn = fileDlg.GetPath();
461 wxMessageBox( wxString::Format(
_(
"File '%s' could not be created." ),
m_outFileName ) );
467 fputs( buffer.c_str(), outfile );
475 wxString
path = fn.GetPath();
477 if(
path.IsEmpty() || !wxDirExists(
path ) )
480 wxFileDialog fileDlg(
this,
_(
"Create PostScript File" ),
path, wxEmptyString,
485 if( fileDlg.ShowModal() != wxID_OK )
488 fn = fileDlg.GetPath();
489 fn.SetExt( wxT(
"ps" ) );
496 wxMessageBox( wxString::Format(
_(
"File '%s' could not be created." ),
m_outFileName ) );
502 fputs( buffer.c_str(), outfile );
510 wxString
path = fn.GetPath();
512 if(
path.IsEmpty() || !wxDirExists(
path ) )
515 wxFileDialog fileDlg(
this,
_(
"Create Symbol Library" ),
path, wxEmptyString,
517 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
521 if( fileDlg.ShowModal() != wxID_OK )
531 wxMessageBox( wxString::Format(
_(
"File '%s' could not be created." ),
m_outFileName ) );
537 fputs( buffer.c_str(), outfile );
545 wxString
path = fn.GetPath();
547 if(
path.IsEmpty() || !wxDirExists(
path ) )
550 wxFileDialog fileDlg(
this,
_(
"Create Footprint Library" ),
path, wxEmptyString,
552 wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
556 if( fileDlg.ShowModal() != wxID_OK )
566 wxMessageBox( wxString::Format(
_(
"File '%s' could not be created." ),
m_outFileName ) );
572 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 ImageFileWildcard()
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.