1 /*
2     delaboratory - color correction utility
3     Copyright (C) 2011 Jacek Poplawski
4 
5     This program is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef _DE_PROJECT_H
20 #define _DE_PROJECT_H
21 
22 #include "sampler_manager.h"
23 #include "view_manager.h"
24 #include "logger.h"
25 #include "image.h"
26 #include "size.h"
27 #include "gui.h"
28 
29 class deImagePanel;
30 class deHistogramPanel;
31 class deMainWindow;
32 class deLayerProcessor;
33 class deLayerStack;
34 class deLayerFrameManager;
35 class deLayer;
36 class deStaticImage;
37 class deRawModule;
38 class deZoomManager;
39 class deBaseLayer;
40 class deProgressDialog;
41 
42 class deProject
43 {
44     private:
45         deProject(const deProject& project);
46         deProject& operator =(const deProject& project);
47 
48         deLayerProcessor& layerProcessor;
49         std::string imageFileName;
50         std::string sourceImageFileName;
51         deChannelManager& channelManager;
52         deViewManager viewManager;
53         deStaticImage& sourceImage;
54         deLayerStack& layerStack;
55         deLayerFrameManager& layerFrameManager;
56         deRawModule& rawModule;
57         deZoomManager& zoomManager;
58         deMainWindow& mainWindow;
59         deGUI& gui;
60 
61         void onImageNameUpdate();
62 
63         bool processFullSizeImage(const std::string& fileName, const std::string& type, bool saveAll, deProgressDialog& progressDialog);
64 
65         void freeImage();
66 
67         void onScaleSet();
68 
69         void updateLayerGrid();
70 
71         bool openImageRAW(const std::string& fileName, bool srgb, bool brighten);
72 
73     public:
74         deProject(deLayerProcessor& _processor, deChannelManager& _channelManager, deLayerStack& _layerStack, deLayerFrameManager& _layerFrameManager, deStaticImage& _sourceImage, deRawModule& _rawModule, deZoomManager& _zoomManager, deMainWindow& _mainWindow, deGUI& _gui);
75 
76         virtual ~deProject();
77         void onKey(int key);
78         void init(const std::string& fileName);
79         void resetLayerStack(deColorSpace colorSpace);
80 
81         deChannelManager& getPreviewChannelManager();
82         deSize getSourceImageSize();
83         deLayerStack& getLayerStack();
84         deLayerProcessor& getLayerProcessor();
85 
86         bool isSourceValid() const;
87 
88         const deViewManager& getViewManager() const;
89         deViewManager& getViewManager();
90 
91         void onChangeView(int a);
92 
93         bool exportFinalImage(const std::string& app, const std::string& type, const std::string& name, deProgressDialog& progressDialog, bool saveAll, const std::string& dir);
94 
95         void onChangeViewMode();
96 
97         bool openImage(const std::string& fileName, bool raw, bool srgb, bool brighten);
98         void newProject();
99         void setTestImage(int s);
100 
101 
102         void setHistogramChannel(int channel);
103 
104         void onTimerUpdate();
105 
106         deBaseLayer* createNewLayer(const std::string& type);
107 
108         void onAddNewLayer();
109         void onRemoveTopLayer();
110 
getLayerFrameManager()111         deLayerFrameManager& getLayerFrameManager() {return layerFrameManager;};
112         deValue getSourceAspect() const;
113 
114         deSize onImageAreaChangeSize(const deSize& ps, bool canSkip);
115 
116         void openLayerFrame(int index);
117 
118 };
119 
120 #endif
121