equal
deleted
inserted
replaced
1 #include <wx/wx.h> |
1 #include <wx/wx.h> |
2 #include <wx/log.h> |
2 #include <wx/log.h> |
3 #include <wx/image.h> |
3 #include <wx/image.h> |
4 #include <wx/string.h> |
4 #include <wx/string.h> |
5 #include <wx/init.h> |
5 #include <wx/init.h> |
|
6 |
|
7 #include <vector> |
6 |
8 |
7 #include "MainWindow.hpp" |
9 #include "MainWindow.hpp" |
8 |
10 |
9 class MyApp : public wxApp |
11 class MyApp : public wxApp |
10 { |
12 { |
19 if (argc < 2) |
21 if (argc < 2) |
20 return false; |
22 return false; |
21 |
23 |
22 ::wxInitAllImageHandlers(); |
24 ::wxInitAllImageHandlers(); |
23 |
25 |
24 wxString filename(argv[1]); |
26 std::vector<wxString> imgs; |
25 |
27 for(int i=1; i < argc; ++i) |
26 wxLogVerbose(_T("Opening file %s."), filename.c_str()); |
|
27 wxImage img(filename); |
|
28 if (!img.IsOk()) |
|
29 return false; |
|
30 |
|
31 CropArea area; |
|
32 if (argc < 6) |
|
33 { |
28 { |
34 area.x = 0; |
29 wxString filename(argv[i]); |
35 area.y = 0; |
30 imgs.push_back(filename); |
36 area.width = 0; |
|
37 area.height = 0; |
|
38 } |
|
39 else |
|
40 { |
|
41 wxString(argv[2]).ToLong(&area.x); |
|
42 wxString(argv[3]).ToLong(&area.y); |
|
43 wxString(argv[4]).ToLong(&area.width); |
|
44 wxString(argv[5]).ToLong(&area.height); |
|
45 } |
31 } |
46 |
32 |
47 img.Rescale(img.GetWidth()/3, img.GetHeight()/3); |
33 MainWindow *mw = new MainWindow(imgs, wxDefaultSize); |
48 |
|
49 wxSize size(img.GetWidth(), img.GetHeight()); |
|
50 MainWindow *mw = new MainWindow(img, area, size); |
|
51 mw->Show(); |
34 mw->Show(); |
52 |
35 |
53 return true; |
36 return true; |
54 } |
37 } |