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{
16
17
18class MRVIEWER_CLASS ViewerSettingsPlugin : public StatePlugin
19{
20public:
21
22 enum class TabType
23 {
24 Quick,
25 Application,
26 Control,
28 MeasurementUnits,
29 Features,
30 Count
31 };
32
34
35 virtual void drawDialog( ImGuiContext* ctx ) override;
36
37 virtual bool blocking() const override { return false; }
38
40 MRVIEWER_API void updateThemes();
41
44 {
45 public:
46 virtual ~ExternalSettings() {}
48 virtual const std::string& getName() const = 0;
50 virtual void draw() = 0;
52 virtual void reset() {}
54 virtual const char* separatorName() const { return "Tools"; }
55 };
56
58 MRVIEWER_API void addComboSettings( const TabType tab, std::shared_ptr<ExternalSettings> settings );
59
61 MRVIEWER_API void delComboSettings( const TabType tab, const ExternalSettings * settings );
62
65 MRVIEWER_API static ViewerSettingsPlugin* instance();
66
68 MRVIEWER_API void setActiveTab( TabType tab );
69private:
70 virtual bool onEnable_() override;
71 virtual bool onDisable_() override;
72
73 void drawTab_( float menuWidth );
74
75 void drawQuickTab_( float menuWidth );
76 void drawApplicationTab_( float menuWidth );
77 void drawControlTab_( float menuWidth );
78 void drawViewportTab_( float menuWidth );
79 void drawMeasurementUnitsTab_();
80 void drawFeaturesTab_();
81
82 void drawThemeSelector_();
83 void drawResetDialog_( bool activated );
84 void drawShadingModeCombo_( bool inGroup, float toolWidth );
85 void drawProjectionModeSelector_( float toolWidth );
86 void drawUpDirectionSelector_();
87 void drawBackgroundButton_( bool allViewports );
88 void drawRenderOptions_();
89 void drawShadowsOptions_( float menuWidth );
90 void drawMouseSceneControlsSettings_( float menuWidth );
91 void drawSpaceMouseSettings_( float menuWidth );
92 void drawTouchpadSettings_();
93
94 void drawMruInnerFormats_( float menuWidth );
95
96 void drawGlobalSettings_( float buttonWidth );
97 void drawCustomSettings_( const std::string& separatorName, bool needSeparator );
98 void drawSeparator_( const std::string& separatorName );
99
100
101 void updateDialog_();
102 void resetSettings_();
103
104 int storedSamples_{ 0 };
105 int maxSamples_{ 0 };
106 bool gpuOverridesMSAA_{ false };
107 float tempUserScaling_{ 1.0f };
108
109 Vector4f backgroundColor_;
110
111 int selectedUserPreset_{ 0 };
112 std::vector<std::string> userThemesPresets_;
113
114 std::unique_ptr<ShadowsGL> shadowGl_;
115
116 SpaceMouse::Parameters spaceMouseParams_;
117#if defined(_WIN32) || defined(__APPLE__)
118 bool activeMouseScrollZoom_{ false };
119#endif
120
121 TouchpadParameters touchpadParameters_;
122
123 TabType activeTab_ = TabType::Quick;
124 TabType orderedTab_ = TabType::Count;
125
126 std::array<std::vector<std::shared_ptr<ExternalSettings>>, size_t(TabType::Count)> comboSettings_;
127
128 MruFormatParameters mruFormatParameters_;
129};
130
131}
basic class of external settings
Definition MRViewerSettingsPlugin.h:44
Definition MRViewerSettingsPlugin.h:19
Definition MRViewport.h:49
virtual void drawDialog(ImGuiContext *ctx) override
MRVIEWER_API void delComboSettings(const TabType tab, const ExternalSettings *settings)
delete external settings with UI combo box
virtual const std::string & getName() const =0
returns the name of the setting, which is a unique value
virtual void reset()
restore the settings to their default values
Definition MRViewerSettingsPlugin.h:52
MRVIEWER_API void setActiveTab(TabType tab)
changes active tab
virtual ~ExternalSettings()
Definition MRViewerSettingsPlugin.h:46
virtual void draw()=0
the function of drawing the configuration UI
virtual bool blocking() const override
Definition MRViewerSettingsPlugin.h:37
MRVIEWER_API void addComboSettings(const TabType tab, std::shared_ptr< ExternalSettings > settings)
add external settings with UI combo box
MRVIEWER_API void updateThemes()
call this function if you save/delete color theme, or change current theme outside of this plugin
virtual const char * separatorName() const
if not overriden this setting will be drawn in tools block
Definition MRViewerSettingsPlugin.h:54
static MRVIEWER_API ViewerSettingsPlugin * instance()
TabType
Definition MRViewerSettingsPlugin.h:23
only for bindings generation
Definition MRCameraOrientationPlugin.h:8