MeshLib C++ Docs
Loading...
Searching...
No Matches
MRViewerSettingsPlugin.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRViewerFwd.h"
8#include "MRMesh/MRVector4.h"
9#include "MRCommonPlugins/exports.h"
11
12namespace MR
13{
14
15class MRVIEWER_CLASS ViewerSettingsPlugin : public StatePlugin
16{
17public:
18
19 enum class TabType
20 {
21 Quick,
22 Application,
23 Control,
25 MeasurementUnits,
26 Features,
27 Count
28 };
29
31
32 virtual void drawDialog( 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() = 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
62 MRVIEWER_API static ViewerSettingsPlugin* instance();
63
65 MRVIEWER_API void setActiveTab( TabType tab );
66private:
67 virtual bool onEnable_() override;
68 virtual bool onDisable_() override;
69
70 void drawTab_( float menuWidth );
71
72 void drawQuickTab_( float menuWidth );
73 void drawApplicationTab_( float menuWidth );
74 void drawControlTab_( float menuWidth );
75 void drawViewportTab_( float menuWidth );
76 void drawMeasurementUnitsTab_();
77 void drawFeaturesTab_();
78
79 void drawThemeSelector_();
80 void drawResetDialog_( bool activated );
81 void drawShadingModeCombo_( bool inGroup, float toolWidth );
82 void drawProjectionModeSelector_( float toolWidth );
83 void drawUpDirectionSelector_();
84 void drawBackgroundButton_( bool allViewports );
85 void drawRenderOptions_();
86 void drawShadowsOptions_( float menuWidth );
87 void drawMouseSceneControlsSettings_( float menuWidth );
88 void drawSpaceMouseSettings_( float menuWidth );
89 void drawTouchpadSettings_();
90
91 void drawMruInnerFormats_( float menuWidth );
92
93 void drawGlobalSettings_( float buttonWidth );
94 void drawCustomSettings_( const std::string& separatorName, bool needSeparator );
95 void drawSeparator_( const std::string& separatorName );
96
97
98 void updateDialog_();
99 void resetSettings_();
100
101 int storedSamples_{ 0 };
102 int maxSamples_{ 0 };
103 bool gpuOverridesMSAA_{ false };
104 float tempUserScaling_{ 1.0f };
105
106 Vector4f backgroundColor_;
107
108 int selectedUserPreset_{ 0 };
109 std::vector<std::string> userThemesPresets_;
110
111 std::unique_ptr<ShadowsGL> shadowGl_;
112
113 SpaceMouseParameters spaceMouseParams_;
114#if defined(_WIN32) || defined(__APPLE__)
115 bool activeMouseScrollZoom_{ false };
116#endif
117
118 TouchpadParameters touchpadParameters_;
119
120 TabType activeTab_ = TabType::Quick;
121 TabType orderedTab_ = TabType::Count; // invalid
122
123 std::array<std::vector<std::shared_ptr<ExternalSettings>>, size_t(TabType::Count)> comboSettings_;
124
125 MruFormatParameters mruFormatParameters_;
126};
127
128}
Definition MRViewerFwd.h:75
Definition MRViewerSettingsPlugin.h:41
virtual const std::string & getName() const =0
virtual void reset()
Definition MRViewerSettingsPlugin.h:49
virtual ~ExternalSettings()
Definition MRViewerSettingsPlugin.h:43
virtual const char * separatorName() const
Definition MRViewerSettingsPlugin.h:51
Definition MRViewerSettingsPlugin.h:16
virtual void drawDialog(ImGuiContext *ctx) override
MRVIEWER_API void delComboSettings(const TabType tab, const ExternalSettings *settings)
delete external settings with UI combo box
MRVIEWER_API void setActiveTab(TabType tab)
changes active tab
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()
static MRVIEWER_API ViewerSettingsPlugin * instance()
TabType
Definition MRViewerSettingsPlugin.h:20
Definition MRViewport.h:46
Definition MRCameraOrientationPlugin.h:8