First checkin. It works enough.
#include <wx/wx.h>
#include <wx/log.h>
#include <wx/image.h>
#include <wx/string.h>
#include <wx/init.h>
#include "MainWindow.hpp"
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
if (argc < 2)
return false;
::wxInitAllImageHandlers();
wxString filename(argv[1]);
wxLogVerbose(_T("Opening file %s."), filename.c_str());
wxImage img(filename);
if (!img.IsOk())
return false;
CropArea area;
if (argc < 6)
{
area.x = 0;
area.y = 0;
area.width = 0;
area.height = 0;
}
else
{
wxString(argv[2]).ToLong(&area.x);
wxString(argv[3]).ToLong(&area.y);
wxString(argv[4]).ToLong(&area.width);
wxString(argv[5]).ToLong(&area.height);
}
img.Rescale(img.GetWidth()/3, img.GetHeight()/3);
wxSize size(img.GetWidth(), img.GetHeight());
MainWindow *mw = new MainWindow(img, area, size);
mw->Show();
return true;
}