MeshLib
 
Loading...
Searching...
No Matches
MRViewerSettingsPlugin.h
Go to the documentation of this file.
1#pragma once
2
7#include "MRMesh/MRVector4.h"
8#include "MRCommonPlugins/exports.h"
9
10namespace MR
11{
12
13class MRVIEWER_CLASS ViewerSettingsPlugin : public StatePlugin
14{
15public:
16
17 enum class TabType
18 {
19 Quick,
20 Application,
21 Control,
23 MeasurementUnits,
24 Features,
25 Count
26 };
27
29
30 virtual const std::string& uiName() const override;
31
32 virtual void drawDialog( float menuScaling, ImGuiContext* ctx ) override;
33
34 virtual bool blocking() const override { return false; }
35
36 // call this function if you save/delete color theme, or change current theme outside of this plugin
37 MRVIEWER_API void updateThemes();
38
39 // basic class of external settings
41 {
42 public:
43 virtual ~ExternalSettings() {}
44 // returns the name of the setting, which is a unique value
45 virtual const std::string& getName() const = 0;
46 // the function of drawing the configuration UI
47 virtual void draw( float menuScaling ) = 0;
48 // restore the settings to their default values
49 virtual void reset() {}
50 // if not overriden this setting will be drawn in tools block
51 virtual const char* separatorName() const { return "Tools"; }
52 };
53
55 MRVIEWER_API void addComboSettings( const TabType tab, std::shared_ptr<ExternalSettings> settings );
56
58 MRVIEWER_API void delComboSettings( const TabType tab, const ExternalSettings * settings );
59
60private:
61 virtual bool onEnable_() override;
62 virtual bool onDisable_() override;
63
64 void drawTab_( float menuWidth, float menuScaling );
65
66 void drawQuickTab_( float menuWidth, float menuScaling );
67 void drawApplicationTab_( float menuWidth, float menuScaling );
68 void drawControlTab_( float menuWidth, float menuScaling );
69 void drawViewportTab_( float menuWidth, float menuScaling );
70 void drawMeasurementUnitsTab_( float menuScaling );
71 void drawFeaturesTab_( float menuScaling );
72
73 void drawThemeSelector_( float menuScaling );
74 void drawResetDialog_( bool activated, float menuScaling );
75 void drawShadingModeCombo_( bool inGroup, float menuScaling, float toolWidth );
76 void drawProjectionModeSelector_( float menuScaling, float toolWidth );
77 void drawUpDirectionSelector_();
78 void drawBackgroundButton_( bool allViewports );
79 void drawRenderOptions_( float menuScaling );
80 void drawShadowsOptions_( float menuWidth, float menuScaling );
81 void drawMouseSceneControlsSettings_( float menuWidth, float menuScaling );
82 void drawSpaceMouseSettings_( float menuWidth, float menuScaling );
83 void drawTouchpadSettings_( float menuScaling );
84
85 void drawGlobalSettings_( float buttonWidth, float menuScaling );
86 void drawCustomSettings_( const std::string& separatorName, bool needSeparator, float menuScaling );
87 void drawSeparator_( const std::string& separatorName, float menuScaling );
88
89
90 void updateDialog_();
91 void resetSettings_();
92
93 int curSamples_{ 0 };
94 int storedSamples_{ 0 };
95 int maxSamples_{ 0 };
96 bool needReset_{ false };
97 bool gpuOverridesMSAA_{ false };
98
99 Vector4f backgroundColor_;
100
101 int selectedUserPreset_{ 0 };
102 std::vector<std::string> userThemesPresets_;
103
104 std::unique_ptr<ShadowsGL> shadowGl_;
105
106 SpaceMouseParameters spaceMouseParams_;
107#if defined(_WIN32) || defined(__APPLE__)
108 bool activeMouseScrollZoom_{ false };
109#endif
110
111 TouchpadParameters touchpadParameters_;
112
113 TabType activeTab_ = TabType::Quick;
114
115 std::array<std::vector<std::shared_ptr<ExternalSettings>>, size_t(TabType::Count)> comboSettings_;
116};
117
118}
Definition MRViewerFwd.h:59
Definition MRViewerSettingsPlugin.h:41
virtual const std::string & getName() const =0
virtual void reset()
Definition MRViewerSettingsPlugin.h:49
virtual void draw(float menuScaling)=0
virtual ~ExternalSettings()
Definition MRViewerSettingsPlugin.h:43
virtual const char * separatorName() const
Definition MRViewerSettingsPlugin.h:51
Definition MRViewerSettingsPlugin.h:14
MRVIEWER_API void delComboSettings(const TabType tab, const ExternalSettings *settings)
delete external settings with UI combo box
virtual void drawDialog(float menuScaling, ImGuiContext *ctx) override
virtual bool blocking() const override
Definition MRViewerSettingsPlugin.h:34
MRVIEWER_API void addComboSettings(const TabType tab, std::shared_ptr< ExternalSettings > settings)
add external settings with UI combo box
MRVIEWER_API void updateThemes()
virtual const std::string & uiName() const override
TabType
Definition MRViewerSettingsPlugin.h:18
Definition MRViewport.h:49
Definition MRCameraOrientationPlugin.h:7