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