VPTissue Reference Manual
BitmapGraphicsPreferences.h
Go to the documentation of this file.
1 #ifndef EXPORTERS_BITMAP_GRAPHICS_PREFERENCES_H_
2 #define EXPORTERS_BITMAP_GRAPHICS_PREFERENCES_H_
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
23 #include "util/misc/Exception.h"
24 
25 #include <boost/property_tree/ptree_fwd.hpp>
26 
27 namespace SimPT_Shell
28 {
29 
34 {
35  enum Format {
36  Png, Bmp, Jpeg
37  };
38 
39  Format m_format;
40  bool m_size_preset;
41  int m_size_x;
42  int m_size_y;
43 
45  {
46  m_format = Png; // This 'preference' is not read from preferences ptree. Can only be modified in code.
47  m_size_preset = false;
48  m_size_x = 0;
49  m_size_y = 0;
50  }
51 
52  virtual void Update(const SimShell::Ws::Event::MergedPreferencesChanged& e)
53  {
54  GraphicsPreferences::Update(e);
55 
56  m_size_preset = false;
57  try {
58  auto size_prefs = e.source->GetChild("size");
59  m_size_x = size_prefs->Get<double>("x");
60  m_size_y = size_prefs->Get<double>("y");
61  m_size_preset = true;
62  } catch (boost::property_tree::ptree_error& e) {}
63  }
64 };
65 
66 } // namespace
67 
68 #endif
Namespace for SimPT shell package.
Definition: Client.cpp:50
Interface/Implementation for GraphicsPreferences.
Preferences for graphics viewer.
Preferences for a graphic viewer.
Header file for Exception class.