IccMAX 2.1.27
Color Profile Tools
Loading...
Searching...
No Matches
MyFrame Class Reference

#include <wxProfileDump.h>

+ Inheritance diagram for MyFrame:
+ Collaboration diagram for MyFrame:

Public Member Functions

 MyFrame (wxWindow *parent, const wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, const long style)
 
void InitToolBar (wxToolBar *toolBar)
 
void OnAbout (wxCommandEvent &event)
 
void OnClose (wxCloseEvent &event)
 
void OnOpenProfile (wxCommandEvent &event)
 
void OnQuit (wxCommandEvent &event)
 
void OpenFile (wxString path)
 

Detailed Description

Constructor & Destructor Documentation

◆ MyFrame()

MyFrame::MyFrame ( wxWindow *  parent,
const wxWindowID  id,
const wxString &  title,
const wxPoint &  pos,
const wxSize &  size,
const long  style 
)
257 : wxMDIParentFrame(parent, id, title, pos, size,
258 style | wxNO_FULL_REPAINT_ON_RESIZE)
259{
260#if wxUSE_TOOLBAR
261 CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
262 InitToolBar(GetToolBar());
263#endif // wxUSE_TOOLBAR
264
265 // Accelerators
266 wxAcceleratorEntry entries[3];
267 entries[0].Set(wxACCEL_CTRL, (int) 'O', MDI_OPEN_PROFILE);
268 entries[1].Set(wxACCEL_CTRL, (int) 'X', MDI_QUIT);
269 entries[2].Set(wxACCEL_CTRL, (int) 'A', MDI_ABOUT);
270 wxAcceleratorTable accel(3, entries);
271 SetAcceleratorTable(accel);
272}
@ MDI_ABOUT
Definition wxProfileDump.h:222
@ MDI_QUIT
Definition wxProfileDump.h:219
@ MDI_OPEN_PROFILE
Definition wxProfileDump.h:220
void InitToolBar(wxToolBar *toolBar)

Member Function Documentation

◆ InitToolBar()

void MyFrame::InitToolBar ( wxToolBar *  toolBar)

◆ OnAbout()

void MyFrame::OnAbout ( wxCommandEvent &  event)
298{
299 (void)wxMessageBox(_T("wxProfileDump\n")
300 _T("Copyright (C) 2005-2023\n\n")
301 _T("Using ICCProflib version ") ICCPROFLIBVER _T("\n"),
302 _T("About wxProfileDump"));
303}
#define ICCPROFLIBVER
Definition IccProfLibVer.h:2

◆ OnClose()

void MyFrame::OnClose ( wxCloseEvent &  event)
275{
276 if ( event.CanVeto() && (gs_nFrames > 0) )
277 {
278 wxString msg;
279 msg.Printf(_T("%d windows still open, close anyhow?"), gs_nFrames);
280 if ( wxMessageBox(msg, _T("Please confirm"),
281 wxICON_QUESTION | wxYES_NO) != wxYES )
282 {
283 event.Veto();
284
285 return;
286 }
287 }
288
289 event.Skip();
290}
static int gs_nFrames
Definition wxProfileDump.cpp:131

◆ OnOpenProfile()

void MyFrame::OnOpenProfile ( wxCommandEvent &  event)
358{
359 wxString profilePath;
360
361 if (event.GetId()==MDI_OPEN_PROFILE) {
362 wxFileDialog dialog(this, _T("Open Profile"), wxEmptyString, wxEmptyString, _T("ICC files (*.icc)|*.icc|ICM files (*.icm)|*.icm|All files|*.*"), wxOPEN |wxFILE_MUST_EXIST);
363
364 if (dialog.ShowModal()!=wxID_OK)
365 return;
366
367 profilePath = dialog.GetPath();
368 }
369 else {
370 profilePath = wxGetApp().m_history.GetHistoryFile(event.GetId() - wxID_FILE1);
371 }
372
373 OpenFile(profilePath);
374}
void OpenFile(wxString path)
Definition wxProfileDump.cpp:305

◆ OnQuit()

void MyFrame::OnQuit ( wxCommandEvent &  event)
293{
294 Close();
295}

◆ OpenFile()

void MyFrame::OpenFile ( wxString  path)
306{
307 wxFileName filepath(profilePath);
308 wxString profileTitle = filepath.GetName();
309
310 std::string path = profilePath.ToStdString(wxConvUTF8);
311 CIccProfile *pIcc = OpenIccProfile(path.c_str());
312
313 if (!pIcc) {
314 (void)wxMessageBox(wxString(_T("Unable to open profile '")) + profilePath + _T("'"),
315 _T("Open Error!"));
316 return;
317 }
318
319 wxGetApp().m_history.AddFileToHistory(profilePath);
320
321 // Make another frame, containing a canvas
322 MyChild *subframe = new MyChild(my_frame, profileTitle, pIcc, profilePath);
323
324 subframe->SetTitle(profileTitle);
325
326 // Give it an icon
327#ifdef __WXMSW__
328 subframe->SetIcon(wxIcon(_T("ProfileDumpDoc_icn")));
329#else
330// subframe->SetIcon(wxIcon( mondrian_xpm ));
331#endif
332
333 // Make a menubar
334 wxMenu *file_menu = new wxMenu;
335 subframe->SetFileMenu(file_menu);
336
337 file_menu->Append(MDI_OPEN_PROFILE, _T("&Open Profile"));
338 file_menu->Append(MDI_CHILD_QUIT, _T("&Close"), _T("Close this window"));
339 file_menu->Append(MDI_QUIT, _T("&Exit"));
340
341 wxGetApp().m_history.UseMenu(file_menu);
342 wxGetApp().m_history.AddFilesToMenu(file_menu);
343
344 wxMenu *help_menu = new wxMenu;
345 help_menu->Append(MDI_ABOUT, _T("&About"));
346
347 wxMenuBar *menu_bar = new wxMenuBar;
348
349 menu_bar->Append(file_menu, _T("&File"));
350 menu_bar->Append(help_menu, _T("&Help"));
351
352 // Associate the menu bar with the frame
353 subframe->SetMenuBar(menu_bar);
354 subframe->Show(true);
355}
class ICCPROFLIB_API CIccProfile
Definition IccPcc.h:80
CIccProfile * OpenIccProfile(const icChar *szFilename, bool bUseSubProfile)
Definition IccProfile.cpp:3387
@ MDI_CHILD_QUIT
Definition wxProfileDump.h:221
MyFrame * my_frame
Definition wxProfileDump.cpp:124
Definition wxProfileDump.h:135
void SetFileMenu(wxMenu *menu)
Definition wxProfileDump.cpp:668

The documentation for this class was generated from the following files: