![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2011 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtRangeRingsManager.h,v $ $Revision: 1.1 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00011 00013 00014 #pragma once 00015 00016 #include <vrvUtil/DtVirtualBaseClass.h> 00017 #include <vrvUtil/signalslib.h> 00018 00019 #include <vrfGuiCore/vrfGuiCore.h> 00020 #include <vrfGuiCore/DtRangeRingsSettingsRecord.h> 00021 #include <vrvCore/DtObserverSettingsManager.h> 00022 #include <vrvCore/DtSharedSettings.h> 00023 #include <vrvUtil/event_signal.h> 00024 #include <vrvUtil/DtUnicode.h> 00025 00026 #include <vrvCore/DtDe.h> 00027 00028 namespace makVrv 00029 { 00030 class DtRecordSettingsBackupInterface; 00031 class DtEventQueueInterface; 00032 class DtSharedSettingsManager; 00033 } 00034 00035 namespace makVrf 00036 { 00037 const makVrv::DtObserverSettingsManager::ObserverSetting DtVrfGuiRangeRingsShowType = makVrv::DtObserverSettingsManager::ObserverSetting(200); 00038 00041 class DT_DLL_VRFGUICORE DtSharedRangeRingsSettings : public makVrv::DtSharedSettings 00042 { 00043 public: 00044 00047 friend class makVrv::DtReadSettingsLock<DtSharedRangeRingsSettings>; 00048 friend class makVrv::DtWriteSettingsLock<DtSharedRangeRingsSettings>; 00049 friend class makVrv::DtSharedSettingsManager; 00050 00054 static std::string className(); 00055 00057 virtual ~DtSharedRangeRingsSettings(); 00058 00059 virtual void setFill2D(bool); 00060 virtual bool fill2D() const; 00061 00062 virtual void setShowRangeSphere(bool); 00063 virtual bool showRangeSphere() const; 00064 00065 virtual void setShowWeaponNameLabel( bool ); 00066 virtual bool showWeaponNameLabel() const; 00067 00068 virtual void setShowEntityNameLabel( bool ); 00069 virtual bool showEntityNameLabel() const; 00070 00071 virtual void setShowRangeValueLabel( bool ); 00072 virtual bool showRangeValueLabel() const; 00073 00074 virtual const DtRangeRingsSettingsRecord::ColorOptions& colorOptions() const; 00075 00076 virtual void setColorOptions(const DtRangeRingsSettingsRecord::ColorOptions&); 00077 virtual void getColor(int type, int force, float& r, float& g, float& b, float& a, makVrv::DtUnicode&) const; 00078 virtual void setColor(int type, int color, const makVrv::DtUnicode&); 00079 virtual void removeColorOption(int type); 00080 00081 virtual void getRecord(DtRangeRingsSettingsRecord& rec) const; 00082 virtual void setFromRecord(const DtRangeRingsSettingsRecord& rec); 00083 00084 protected: 00085 virtual void colorFromForce(int force, float& r, float& g, float& b); 00086 00087 protected: 00088 00090 DtSharedRangeRingsSettings(makVrv::DtSharedSettingsManager& manager); 00091 00092 protected: 00093 bool myFill2D; 00094 bool myShowRangeSphere; 00095 bool myShowWeaponNameLabel; 00096 bool myShowEntityNameLabel; 00097 bool myShowRangeValueLabel; 00098 00099 DtRangeRingsSettingsRecord::ColorOptions myColorOptions; 00100 }; 00101 00103 class DT_DLL_VRFGUICORE DtRangeRingsManager : public makVrv::DtVirtualBaseClass 00104 { 00105 public: 00106 DtRangeRingsManager(makVrv::DtDe&); 00107 virtual ~DtRangeRingsManager(); 00108 00110 static DtRangeRingsManager& instance(makVrv::DtDe& de); 00111 static void registerInstance(makVrv::DtDe&, DtRangeRingsManager*); 00112 00114 virtual void loadDefaults(bool fromFactory = false); 00115 00117 virtual void saveAsDefaults(); 00118 00119 const makVrv::DtRecordSettingsBackupInterface* settingsBackup() const 00120 { 00121 return mySettingsBackup; 00122 } 00123 00124 makVrv::DtRecordSettingsBackupInterface* settingsBackup() 00125 { 00126 return mySettingsBackup; 00127 } 00128 00130 void exportSettings(const std::string& fileName); 00131 00133 void importSettings(const std::string& fileName); 00134 00135 void setAutoSave(bool b); 00136 bool autoSave() const; 00137 00138 virtual void getRecord(DtRangeRingsSettingsRecord& rec) const; 00139 virtual void setFromRecord(const DtRangeRingsSettingsRecord& rec); 00140 00141 virtual void setFill2D(bool b); 00142 virtual bool fill2D() const; 00143 00144 virtual void setShowRangeSphere( bool onOff ); 00145 virtual bool showRangeSphere() const; 00146 00147 virtual void setShowWeaponNameLabel( bool ); 00148 virtual bool showWeaponNameLabel() const; 00149 00150 virtual void setShowEntityNameLabel( bool ); 00151 virtual bool showEntityNameLabel() const; 00152 00153 virtual void setShowRangeValueLabel( bool ); 00154 virtual bool showRangeValueLabel() const; 00155 00156 virtual const DtRangeRingsSettingsRecord::ColorOptions& colorOptions() const; 00157 virtual void setColorOptions(const DtRangeRingsSettingsRecord::ColorOptions&); 00158 virtual void getColor(int type, int force, float& r, float& g, float& b, float& a, makVrv::DtUnicode&) const; 00159 virtual void setColor(int type, int color, const makVrv::DtUnicode&); 00160 00161 virtual void removeColorOption(int type); 00162 00163 protected: 00164 virtual void completeSetup(); 00165 00166 protected: 00167 makVrv::DtDe& myDe; 00168 makVrv::DtRecordSettingsBackupInterface* mySettingsBackup; 00169 }; 00170 00173 class DT_DLL_VRFGUICORE DtSharedRangeRingsSettingsSignaler : public makVrv::DtVirtualBaseClass 00174 { 00175 public: 00176 00180 static DtSharedRangeRingsSettingsSignaler& instance(const makVrv::DtSharedSettingsManager&); 00181 00184 static DtSharedRangeRingsSettingsSignaler& instance(makVrv::DtEventQueueInterface&); 00185 00189 static DtSharedRangeRingsSettingsSignaler* findInstance( 00190 makVrv::DtEventQueueInterface*); 00191 00193 virtual ~DtSharedRangeRingsSettingsSignaler(); 00194 00196 makVrv::event_signal<void (bool)> signal_fill2DChanged; 00197 makVrv::event_signal<void (bool)> signal_rangeSphereToggled; 00198 makVrv::event_signal<void ()> signal_labelSettingsChanged; 00199 makVrv::event_signal<void ()> signal_colorsChanged; 00200 00202 00203 protected: 00204 DtSharedRangeRingsSettingsSignaler(makVrv::DtEventQueueInterface& eqi); 00205 00206 private: 00207 DtSharedRangeRingsSettingsSignaler(const DtSharedRangeRingsSettingsSignaler&); 00208 DtSharedRangeRingsSettingsSignaler& operator=(const DtSharedRangeRingsSettingsSignaler&); 00209 }; 00210 }