MeshLib C++ Docs
Loading...
Searching...
No Matches
MRViewerSettingsPlugin.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRCommonPlugins/exports.h"
9#include "MRMesh/MRVector4.h"
11
12namespace MR
13{
16
17
18class MRCOMMONPLUGINS_CLASS ViewerSettingsPlugin : public StatePlugin
19{
20public:
21
35
37
38 virtual void drawDialog( ImGuiContext* ctx ) override;
39
40 virtual bool blocking() const override { return false; }
41
43 MRCOMMONPLUGINS_API void updateThemes();
44
47 {
48 public:
49 virtual ~ExternalSettings() {}
51 virtual const std::string& getName() const = 0;
53 virtual void draw() = 0;
55 virtual void reset() {}
57 virtual const char* separatorName() const { return "Tools"; }
58 };
59
61 MRCOMMONPLUGINS_API void addComboSettings( const TabType tab, std::shared_ptr<ExternalSettings> settings );
62
64 MRCOMMONPLUGINS_API void delComboSettings( const TabType tab, const ExternalSettings * settings );
65
68 MRCOMMONPLUGINS_API static ViewerSettingsPlugin* instance();
69
71 MRCOMMONPLUGINS_API void setActiveTab( TabType tab );
72private:
73 virtual bool onEnable_() override;
74 virtual bool onDisable_() override;
75
76 void drawTab_( float menuWidth );
77
78 void drawQuickTab_( float menuWidth );
79 void drawApplicationTab_( float menuWidth );
80 void drawControlTab_( float menuWidth );
81 void drawViewportTab_( float menuWidth );
82 void drawMeasurementUnitsTab_();
83 void drawFeaturesTab_();
84 void drawMcpTab_();
85
86 void drawLanguageSelector_();
87 void drawThemeSelector_();
88 void drawResetDialog_( bool activated );
89 void drawShadingModeCombo_( bool inGroup, float toolWidth );
90 void drawProjectionModeSelector_( float toolWidth );
91 void drawUpDirectionSelector_();
92 void drawBackgroundButton_( bool allViewports );
93 void drawRenderOptions_();
94 void drawShadowsOptions_( float menuWidth );
95 void drawMouseSceneControlsSettings_( float menuWidth );
96 void drawSpaceMouseSettings_( float menuWidth );
97 void drawTouchpadSettings_();
98 void drawMcpSettings_();
99
100 void drawMruInnerFormats_( float menuWidth );
101
102 void drawGlobalSettings_( float buttonWidth );
103 void drawCustomSettings_( const std::string& separatorName, bool needSeparator );
104 void drawSeparator_( const std::string& separatorName );
105
106
107 void updateDialog_();
108 void resetSettings_();
109
110 int storedSamples_{ 0 };
111 int maxSamples_{ 0 };
112 bool gpuOverridesMSAA_{ false };
113 float tempUserScaling_{ 1.0f };
114
115 Vector4f backgroundColor_;
116
117 int selectedLanguage_{ -1 };
118
119 int selectedUserPreset_{ 0 };
120 std::vector<std::string> userThemesPresets_;
121
122 std::unique_ptr<ShadowsGL> shadowGl_;
123
124 SpaceMouse::Parameters spaceMouseParams_;
125
126 TouchpadParameters touchpadParameters_;
127
128 TabType activeTab_ = TabType::Quick;
129 TabType orderedTab_ = TabType::Count;
130
131 std::array<std::vector<std::shared_ptr<ExternalSettings>>, size_t(TabType::Count)> comboSettings_;
132
133 MruFormatParameters mruFormatParameters_;
134};
135
136}
basic class of external settings
Definition MRViewerSettingsPlugin.h:47
virtual void drawDialog(ImGuiContext *ctx) override
virtual const std::string & getName() const =0
returns the name of the setting, which is a unique value
MRCOMMONPLUGINS_API void updateThemes()
call this function if you save/delete color theme, or change current theme outside of this plugin
MRCOMMONPLUGINS_API void delComboSettings(const TabType tab, const ExternalSettings *settings)
delete external settings with UI combo box
virtual void reset()
restore the settings to their default values
Definition MRViewerSettingsPlugin.h:55
MRCOMMONPLUGINS_API void addComboSettings(const TabType tab, std::shared_ptr< ExternalSettings > settings)
add external settings with UI combo box
MRCOMMONPLUGINS_API void setActiveTab(TabType tab)
changes active tab
StateListenerPlugin<> StatePlugin
Definition MRViewerFwd.h:75
virtual ~ExternalSettings()
Definition MRViewerSettingsPlugin.h:49
virtual void draw()=0
the function of drawing the configuration UI
virtual bool blocking() const override
true if this item is blocking (only one blocking item can be active at once)
Definition MRViewerSettingsPlugin.h:40
static MRCOMMONPLUGINS_API ViewerSettingsPlugin * instance()
virtual const char * separatorName() const
if not overriden this setting will be drawn in tools block
Definition MRViewerSettingsPlugin.h:57
TabType
Definition MRViewerSettingsPlugin.h:23
@ Mcp
Definition MRViewerSettingsPlugin.h:29
@ Quick
Definition MRViewerSettingsPlugin.h:24
@ MeasurementUnits
Definition MRViewerSettingsPlugin.h:28
@ Viewport
Definition MRViewerSettingsPlugin.h:27
@ Features
Definition MRViewerSettingsPlugin.h:30
@ Control
Definition MRViewerSettingsPlugin.h:26
@ Application
Definition MRViewerSettingsPlugin.h:25
@ Count
When adding/reordering/renaming constants here, don't forget to add the name in MRViewerSettingsPlugi...
Definition MRViewerSettingsPlugin.h:33
only for bindings generation
Definition MRCameraOrientationPlugin.h:8