mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-21 00:39:58 +00:00
Use settings values to declare enum settings
This commit is contained in:
parent
9cbe82ac7b
commit
72fa4924dc
@ -15,38 +15,10 @@
|
||||
#include "category.hpp"
|
||||
#include "state.hpp"
|
||||
|
||||
CSMPrefs::EnumValue::EnumValue(const std::string& value, const std::string& tooltip)
|
||||
: mValue(value)
|
||||
, mTooltip(tooltip)
|
||||
{
|
||||
}
|
||||
|
||||
CSMPrefs::EnumValue::EnumValue(const char* value)
|
||||
: mValue(value)
|
||||
{
|
||||
}
|
||||
|
||||
CSMPrefs::EnumValues& CSMPrefs::EnumValues::add(const EnumValues& values)
|
||||
{
|
||||
mValues.insert(mValues.end(), values.mValues.begin(), values.mValues.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSMPrefs::EnumValues& CSMPrefs::EnumValues::add(const EnumValue& value)
|
||||
{
|
||||
mValues.push_back(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSMPrefs::EnumValues& CSMPrefs::EnumValues::add(const std::string& value, const std::string& tooltip)
|
||||
{
|
||||
mValues.emplace_back(value, tooltip);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSMPrefs::EnumSetting::EnumSetting(
|
||||
Category* parent, QMutex* mutex, const std::string& key, const QString& label, Settings::Index& index)
|
||||
CSMPrefs::EnumSetting::EnumSetting(Category* parent, QMutex* mutex, std::string_view key, const QString& label,
|
||||
std::span<const EnumValueView> values, Settings::Index& index)
|
||||
: TypedSetting(parent, mutex, key, label, index)
|
||||
, mValues(values)
|
||||
, mWidget(nullptr)
|
||||
{
|
||||
}
|
||||
@ -57,45 +29,28 @@ CSMPrefs::EnumSetting& CSMPrefs::EnumSetting::setTooltip(const std::string& tool
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSMPrefs::EnumSetting& CSMPrefs::EnumSetting::addValues(const EnumValues& values)
|
||||
{
|
||||
mValues.add(values);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSMPrefs::EnumSetting& CSMPrefs::EnumSetting::addValue(const EnumValue& value)
|
||||
{
|
||||
mValues.add(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSMPrefs::EnumSetting& CSMPrefs::EnumSetting::addValue(const std::string& value, const std::string& tooltip)
|
||||
{
|
||||
mValues.add(value, tooltip);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CSMPrefs::SettingWidgets CSMPrefs::EnumSetting::makeWidgets(QWidget* parent)
|
||||
{
|
||||
QLabel* label = new QLabel(getLabel(), parent);
|
||||
|
||||
mWidget = new QComboBox(parent);
|
||||
|
||||
size_t index = 0;
|
||||
const std::string value = getValue();
|
||||
|
||||
for (size_t i = 0; i < mValues.mValues.size(); ++i)
|
||||
for (std::size_t i = 0; i < mValues.size(); ++i)
|
||||
{
|
||||
if (value == mValues.mValues[i].mValue)
|
||||
index = i;
|
||||
const EnumValueView& v = mValues[i];
|
||||
|
||||
mWidget->addItem(QString::fromUtf8(mValues.mValues[i].mValue.c_str()));
|
||||
mWidget->addItem(QString::fromUtf8(v.mValue.data(), static_cast<int>(v.mValue.size())));
|
||||
|
||||
if (!mValues.mValues[i].mTooltip.empty())
|
||||
mWidget->setItemData(
|
||||
static_cast<int>(i), QString::fromUtf8(mValues.mValues[i].mTooltip.c_str()), Qt::ToolTipRole);
|
||||
if (!v.mTooltip.empty())
|
||||
mWidget->setItemData(static_cast<int>(i),
|
||||
QString::fromUtf8(v.mTooltip.data(), static_cast<int>(v.mTooltip.size())), Qt::ToolTipRole);
|
||||
}
|
||||
|
||||
const std::string value = getValue();
|
||||
const std::size_t index = std::find_if(mValues.begin(), mValues.end(), [&](const EnumValueView& v) {
|
||||
return v.mValue == value;
|
||||
}) - mValues.begin();
|
||||
|
||||
mWidget->setCurrentIndex(static_cast<int>(index));
|
||||
|
||||
if (!mTooltip.empty())
|
||||
@ -117,6 +72,9 @@ void CSMPrefs::EnumSetting::updateWidget()
|
||||
|
||||
void CSMPrefs::EnumSetting::valueChanged(int value)
|
||||
{
|
||||
setValue(mValues.mValues.at(value).mValue);
|
||||
if (value < 0 || static_cast<std::size_t>(value) >= mValues.size())
|
||||
throw std::logic_error("Invalid enum setting \"" + getKey() + "\" value index: " + std::to_string(value));
|
||||
|
||||
setValue(std::string(mValues[value].mValue));
|
||||
getParent()->getState()->update(*this);
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
#ifndef CSM_PREFS_ENUMSETTING_H
|
||||
#define CSM_PREFS_ENUMSETTING_H
|
||||
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "enumvalueview.hpp"
|
||||
#include "setting.hpp"
|
||||
|
||||
class QComboBox;
|
||||
@ -13,47 +16,20 @@ namespace CSMPrefs
|
||||
{
|
||||
class Category;
|
||||
|
||||
struct EnumValue
|
||||
{
|
||||
std::string mValue;
|
||||
std::string mTooltip;
|
||||
|
||||
EnumValue(const std::string& value, const std::string& tooltip = "");
|
||||
|
||||
EnumValue(const char* value);
|
||||
};
|
||||
|
||||
struct EnumValues
|
||||
{
|
||||
std::vector<EnumValue> mValues;
|
||||
|
||||
EnumValues& add(const EnumValues& values);
|
||||
|
||||
EnumValues& add(const EnumValue& value);
|
||||
|
||||
EnumValues& add(const std::string& value, const std::string& tooltip);
|
||||
};
|
||||
|
||||
class EnumSetting final : public TypedSetting<std::string>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
std::string mTooltip;
|
||||
EnumValues mValues;
|
||||
std::span<const EnumValueView> mValues;
|
||||
QComboBox* mWidget;
|
||||
|
||||
public:
|
||||
explicit EnumSetting(
|
||||
Category* parent, QMutex* mutex, const std::string& key, const QString& label, Settings::Index& index);
|
||||
explicit EnumSetting(Category* parent, QMutex* mutex, std::string_view key, const QString& label,
|
||||
std::span<const EnumValueView> values, Settings::Index& index);
|
||||
|
||||
EnumSetting& setTooltip(const std::string& tooltip);
|
||||
|
||||
EnumSetting& addValues(const EnumValues& values);
|
||||
|
||||
EnumSetting& addValue(const EnumValue& value);
|
||||
|
||||
EnumSetting& addValue(const std::string& value, const std::string& tooltip);
|
||||
|
||||
/// Return label, input widget.
|
||||
SettingWidgets makeWidgets(QWidget* parent) override;
|
||||
|
||||
|
15
apps/opencs/model/prefs/enumvalueview.hpp
Normal file
15
apps/opencs/model/prefs/enumvalueview.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef OPENMW_APPS_OPENCS_MODEL_PREFS_ENUMVALUEVIEW_H
|
||||
#define OPENMW_APPS_OPENCS_MODEL_PREFS_ENUMVALUEVIEW_H
|
||||
|
||||
#include <string_view>
|
||||
|
||||
namespace CSMPrefs
|
||||
{
|
||||
struct EnumValueView
|
||||
{
|
||||
std::string_view mValue;
|
||||
std::string_view mTooltip;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -59,13 +59,7 @@ void CSMPrefs::State::declare()
|
||||
declareInt(mValues->mWindows.mMinimumWidth, "Minimum subview width")
|
||||
.setTooltip("Minimum width of subviews.")
|
||||
.setRange(50, 10000);
|
||||
EnumValue scrollbarOnly("Scrollbar Only",
|
||||
"Simple addition of scrollbars, the view window "
|
||||
"does not grow automatically.");
|
||||
declareEnum("mainwindow-scrollbar", "Horizontal scrollbar mode for main window.", scrollbarOnly)
|
||||
.addValue(scrollbarOnly)
|
||||
.addValue("Grow Only", "The view window grows as subviews are added. No scrollbars.")
|
||||
.addValue("Grow then Scroll", "The view window grows. The scrollbar appears once it cannot grow any further.");
|
||||
declareEnum(mValues->mWindows.mMainwindowScrollbar, "Horizontal scrollbar mode for main window.");
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
declareBool(mValues->mWindows.mGrowLimit, "Grow Limit Screen")
|
||||
.setTooltip(
|
||||
@ -75,34 +69,15 @@ void CSMPrefs::State::declare()
|
||||
#endif
|
||||
|
||||
declareCategory("Records");
|
||||
EnumValue iconAndText("Icon and Text");
|
||||
EnumValues recordValues;
|
||||
recordValues.add(iconAndText).add("Icon Only").add("Text Only");
|
||||
declareEnum("status-format", "Modification status display format", iconAndText).addValues(recordValues);
|
||||
declareEnum("type-format", "ID type display format", iconAndText).addValues(recordValues);
|
||||
declareEnum(mValues->mRecords.mStatusFormat, "Modification status display format");
|
||||
declareEnum(mValues->mRecords.mTypeFormat, "ID type display format");
|
||||
|
||||
declareCategory("ID Tables");
|
||||
EnumValue inPlaceEdit("Edit in Place", "Edit the clicked cell");
|
||||
EnumValue editRecord("Edit Record", "Open a dialogue subview for the clicked record");
|
||||
EnumValue view("View", "Open a scene subview for the clicked record (not available everywhere)");
|
||||
EnumValue editRecordAndClose("Edit Record and Close");
|
||||
EnumValues doubleClickValues;
|
||||
doubleClickValues.add(inPlaceEdit)
|
||||
.add(editRecord)
|
||||
.add(view)
|
||||
.add("Revert")
|
||||
.add("Delete")
|
||||
.add(editRecordAndClose)
|
||||
.add("View and Close", "Open a scene subview for the clicked record and close the table subview");
|
||||
declareEnum("double", "Double Click", inPlaceEdit).addValues(doubleClickValues);
|
||||
declareEnum("double-s", "Shift Double Click", editRecord).addValues(doubleClickValues);
|
||||
declareEnum("double-c", "Control Double Click", view).addValues(doubleClickValues);
|
||||
declareEnum("double-sc", "Shift Control Double Click", editRecordAndClose).addValues(doubleClickValues);
|
||||
EnumValue jumpAndSelect("Jump and Select", "Scroll new record into view and make it the selection");
|
||||
declareEnum("jump-to-added", "Action on adding or cloning a record", jumpAndSelect)
|
||||
.addValue(jumpAndSelect)
|
||||
.addValue("Jump Only", "Scroll new record into view")
|
||||
.addValue("No Jump", "No special action");
|
||||
declareEnum(mValues->mIdTables.mDouble, "Double Click");
|
||||
declareEnum(mValues->mIdTables.mDoubleS, "Shift Double Click");
|
||||
declareEnum(mValues->mIdTables.mDoubleC, "Control Double Click");
|
||||
declareEnum(mValues->mIdTables.mDoubleSc, "Shift Control Double Click");
|
||||
declareEnum(mValues->mIdTables.mJumpToAdded, "Action on adding or cloning a record");
|
||||
declareBool(
|
||||
mValues->mIdTables.mExtendedConfig, "Manually specify affected record types for an extended delete/revert")
|
||||
.setTooltip(
|
||||
@ -120,18 +95,10 @@ void CSMPrefs::State::declare()
|
||||
declareBool(mValues->mIdDialogues.mToolbar, "Show toolbar");
|
||||
|
||||
declareCategory("Reports");
|
||||
EnumValue actionNone("None");
|
||||
EnumValue actionEdit("Edit", "Open a table or dialogue suitable for addressing the listed report");
|
||||
EnumValue actionRemove("Remove", "Remove the report from the report table");
|
||||
EnumValue actionEditAndRemove("Edit And Remove",
|
||||
"Open a table or dialogue suitable for addressing the listed report, then remove the report from the report "
|
||||
"table");
|
||||
EnumValues reportValues;
|
||||
reportValues.add(actionNone).add(actionEdit).add(actionRemove).add(actionEditAndRemove);
|
||||
declareEnum("double", "Double Click", actionEdit).addValues(reportValues);
|
||||
declareEnum("double-s", "Shift Double Click", actionRemove).addValues(reportValues);
|
||||
declareEnum("double-c", "Control Double Click", actionEditAndRemove).addValues(reportValues);
|
||||
declareEnum("double-sc", "Shift Control Double Click", actionNone).addValues(reportValues);
|
||||
declareEnum(mValues->mReports.mDouble, "Double Click");
|
||||
declareEnum(mValues->mReports.mDoubleS, "Shift Double Click");
|
||||
declareEnum(mValues->mReports.mDoubleC, "Control Double Click");
|
||||
declareEnum(mValues->mReports.mDoubleSc, "Shift Control Double Click");
|
||||
declareBool(mValues->mReports.mIgnoreBaseRecords, "Ignore base records in verifier");
|
||||
|
||||
declareCategory("Search & Replace");
|
||||
@ -152,11 +119,7 @@ void CSMPrefs::State::declare()
|
||||
declareInt(mValues->mScripts.mTabWidth, "Tab Width")
|
||||
.setTooltip("Number of characters for tab width")
|
||||
.setRange(1, 10);
|
||||
EnumValue warningsNormal("Normal", "Report warnings as warning");
|
||||
declareEnum("warnings", "Warning Mode", warningsNormal)
|
||||
.addValue("Ignore", "Do not report warning")
|
||||
.addValue(warningsNormal)
|
||||
.addValue("Strict", "Promote warning to an error");
|
||||
declareEnum(mValues->mScripts.mWarnings, "Warning Mode");
|
||||
declareBool(mValues->mScripts.mToolbar, "Show toolbar");
|
||||
declareInt(mValues->mScripts.mCompileDelay, "Delay between updating of source errors")
|
||||
.setTooltip("Delay in milliseconds")
|
||||
@ -244,32 +207,6 @@ void CSMPrefs::State::declare()
|
||||
declareBool(mValues->mTooltips.mSceneHideBasic, "Hide basic 3D scenes tooltips");
|
||||
declareInt(mValues->mTooltips.mSceneDelay, "Tooltip delay in milliseconds").setMin(1);
|
||||
|
||||
EnumValue createAndInsert("Create cell and insert");
|
||||
EnumValue showAndInsert("Show cell and insert");
|
||||
EnumValue dontInsert("Discard");
|
||||
EnumValue insertAnyway("Insert anyway");
|
||||
EnumValues insertOutsideCell;
|
||||
insertOutsideCell.add(createAndInsert).add(dontInsert).add(insertAnyway);
|
||||
EnumValues insertOutsideVisibleCell;
|
||||
insertOutsideVisibleCell.add(showAndInsert).add(dontInsert).add(insertAnyway);
|
||||
|
||||
EnumValue createAndLandEdit("Create cell and land, then edit");
|
||||
EnumValue showAndLandEdit("Show cell and edit");
|
||||
EnumValue dontLandEdit("Discard");
|
||||
EnumValues landeditOutsideCell;
|
||||
landeditOutsideCell.add(createAndLandEdit).add(dontLandEdit);
|
||||
EnumValues landeditOutsideVisibleCell;
|
||||
landeditOutsideVisibleCell.add(showAndLandEdit).add(dontLandEdit);
|
||||
|
||||
EnumValue SelectOnly("Select only");
|
||||
EnumValue SelectAdd("Add to selection");
|
||||
EnumValue SelectRemove("Remove from selection");
|
||||
EnumValue selectInvert("Invert selection");
|
||||
EnumValues primarySelectAction;
|
||||
primarySelectAction.add(SelectOnly).add(SelectAdd).add(SelectRemove).add(selectInvert);
|
||||
EnumValues secondarySelectAction;
|
||||
secondarySelectAction.add(SelectOnly).add(SelectAdd).add(SelectRemove).add(selectInvert);
|
||||
|
||||
declareCategory("3D Scene Editing");
|
||||
declareDouble(mValues->mSceneEditing.mGridsnapMovement, "Grid snap size");
|
||||
declareDouble(mValues->mSceneEditing.mGridsnapRotation, "Angle snap size");
|
||||
@ -278,15 +215,13 @@ void CSMPrefs::State::declare()
|
||||
.setTooltip(
|
||||
"If an instance drop can not be placed against another object at the "
|
||||
"insert point, it will be placed by this distance from the insert point instead");
|
||||
declareEnum("outside-drop", "Handling drops outside of cells", createAndInsert).addValues(insertOutsideCell);
|
||||
declareEnum("outside-visible-drop", "Handling drops outside of visible cells", showAndInsert)
|
||||
.addValues(insertOutsideVisibleCell);
|
||||
declareEnum("outside-landedit", "Handling terrain edit outside of cells", createAndLandEdit)
|
||||
.setTooltip("Behavior of terrain editing, if land editing brush reaches an area without cell record.")
|
||||
.addValues(landeditOutsideCell);
|
||||
declareEnum("outside-visible-landedit", "Handling terrain edit outside of visible cells", showAndLandEdit)
|
||||
.setTooltip("Behavior of terrain editing, if land editing brush reaches an area that is not currently visible.")
|
||||
.addValues(landeditOutsideVisibleCell);
|
||||
declareEnum(mValues->mSceneEditing.mOutsideDrop, "Handling drops outside of cells");
|
||||
declareEnum(mValues->mSceneEditing.mOutsideVisibleDrop, "Handling drops outside of visible cells");
|
||||
declareEnum(mValues->mSceneEditing.mOutsideLandedit, "Handling terrain edit outside of cells")
|
||||
.setTooltip("Behavior of terrain editing, if land editing brush reaches an area without cell record.");
|
||||
declareEnum(mValues->mSceneEditing.mOutsideVisibleLandedit, "Handling terrain edit outside of visible cells")
|
||||
.setTooltip(
|
||||
"Behavior of terrain editing, if land editing brush reaches an area that is not currently visible.");
|
||||
declareInt(mValues->mSceneEditing.mTexturebrushMaximumsize, "Maximum texture brush size").setMin(1);
|
||||
declareInt(mValues->mSceneEditing.mShapebrushMaximumsize, "Maximum height edit brush size")
|
||||
.setTooltip("Setting for the slider range of brush size in terrain height editing.")
|
||||
@ -303,16 +238,14 @@ void CSMPrefs::State::declare()
|
||||
.setTooltip(
|
||||
"When opening a reference from the scene view, it will open the"
|
||||
" instance list view instead of the individual instance record view.");
|
||||
declareEnum("primary-select-action", "Action for primary select", SelectOnly)
|
||||
declareEnum(mValues->mSceneEditing.mPrimarySelectAction, "Action for primary select")
|
||||
.setTooltip(
|
||||
"Selection can be chosen between select only, add to selection, remove from selection and invert "
|
||||
"selection.")
|
||||
.addValues(primarySelectAction);
|
||||
declareEnum("secondary-select-action", "Action for secondary select", SelectAdd)
|
||||
"selection.");
|
||||
declareEnum(mValues->mSceneEditing.mSecondarySelectAction, "Action for secondary select")
|
||||
.setTooltip(
|
||||
"Selection can be chosen between select only, add to selection, remove from selection and invert "
|
||||
"selection.")
|
||||
.addValues(secondarySelectAction);
|
||||
"selection.");
|
||||
|
||||
declareCategory("Key Bindings");
|
||||
|
||||
@ -531,12 +464,13 @@ CSMPrefs::BoolSetting& CSMPrefs::State::declareBool(Settings::SettingValue<bool>
|
||||
return *setting;
|
||||
}
|
||||
|
||||
CSMPrefs::EnumSetting& CSMPrefs::State::declareEnum(const std::string& key, const QString& label, EnumValue default_)
|
||||
CSMPrefs::EnumSetting& CSMPrefs::State::declareEnum(EnumSettingValue& value, const QString& label)
|
||||
{
|
||||
if (mCurrentCategory == mCategories.end())
|
||||
throw std::logic_error("no category for setting");
|
||||
|
||||
CSMPrefs::EnumSetting* setting = new CSMPrefs::EnumSetting(&mCurrentCategory->second, &mMutex, key, label, *mIndex);
|
||||
CSMPrefs::EnumSetting* setting = new CSMPrefs::EnumSetting(
|
||||
&mCurrentCategory->second, &mMutex, value.getValue().mName, label, value.getEnumValues(), *mIndex);
|
||||
|
||||
mCurrentCategory->second.addSetting(setting);
|
||||
|
||||
|
@ -32,6 +32,7 @@ namespace CSMPrefs
|
||||
class ModifierSetting;
|
||||
class Setting;
|
||||
class StringSetting;
|
||||
class EnumSettingValue;
|
||||
struct Values;
|
||||
|
||||
/// \brief User settings state
|
||||
@ -69,7 +70,7 @@ namespace CSMPrefs
|
||||
|
||||
BoolSetting& declareBool(Settings::SettingValue<bool>& value, const QString& label);
|
||||
|
||||
EnumSetting& declareEnum(const std::string& key, const QString& label, EnumValue default_);
|
||||
EnumSetting& declareEnum(EnumSettingValue& value, const QString& label);
|
||||
|
||||
ColourSetting& declareColour(const std::string& key, const QString& label, QColor default_);
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef OPENMW_APPS_OPENCS_MODEL_PREFS_VALUES_H
|
||||
#define OPENMW_APPS_OPENCS_MODEL_PREFS_VALUES_H
|
||||
|
||||
#include "enumvalueview.hpp"
|
||||
|
||||
#include <components/settings/sanitizer.hpp>
|
||||
#include <components/settings/settingvalue.hpp>
|
||||
|
||||
@ -15,12 +17,6 @@
|
||||
|
||||
namespace CSMPrefs
|
||||
{
|
||||
struct EnumValueView
|
||||
{
|
||||
std::string_view mValue;
|
||||
std::string_view mTooltip;
|
||||
};
|
||||
|
||||
class EnumSanitizer final : public Settings::Sanitizer<std::string>
|
||||
{
|
||||
public:
|
||||
@ -51,6 +47,26 @@ namespace CSMPrefs
|
||||
return std::make_unique<EnumSanitizer>(values);
|
||||
}
|
||||
|
||||
class EnumSettingValue
|
||||
{
|
||||
public:
|
||||
explicit EnumSettingValue(Settings::Index& index, std::string_view category, std::string_view name,
|
||||
std::span<const EnumValueView> values, std::size_t defaultValueIndex)
|
||||
: mValue(
|
||||
index, category, name, std::string(values[defaultValueIndex].mValue), makeEnumSanitizerString(values))
|
||||
, mEnumValues(values)
|
||||
{
|
||||
}
|
||||
|
||||
Settings::SettingValue<std::string>& getValue() { return mValue; }
|
||||
|
||||
std::span<const EnumValueView> getEnumValues() const { return mEnumValues; }
|
||||
|
||||
private:
|
||||
Settings::SettingValue<std::string> mValue;
|
||||
std::span<const EnumValueView> mEnumValues;
|
||||
};
|
||||
|
||||
struct WindowsCategory : Settings::WithIndex
|
||||
{
|
||||
using Settings::WithIndex::WithIndex;
|
||||
@ -72,8 +88,7 @@ namespace CSMPrefs
|
||||
Settings::SettingValue<int> mMaxSubviews{ mIndex, sName, "max-subviews", 256 };
|
||||
Settings::SettingValue<bool> mHideSubview{ mIndex, sName, "hide-subview", false };
|
||||
Settings::SettingValue<int> mMinimumWidth{ mIndex, sName, "minimum-width", 325 };
|
||||
Settings::SettingValue<std::string> mMainwindowScrollbar{ mIndex, sName, "mainwindow-scrollbar",
|
||||
std::string(sMainwindowScrollbarValues[0].mValue), makeEnumSanitizerString(sMainwindowScrollbarValues) };
|
||||
EnumSettingValue mMainwindowScrollbar{ mIndex, sName, "mainwindow-scrollbar", sMainwindowScrollbarValues, 0 };
|
||||
Settings::SettingValue<bool> mGrowLimit{ mIndex, sName, "grow-limit", false };
|
||||
};
|
||||
|
||||
@ -89,10 +104,8 @@ namespace CSMPrefs
|
||||
EnumValueView{ "Text Only", "" },
|
||||
};
|
||||
|
||||
Settings::SettingValue<std::string> mStatusFormat{ mIndex, sName, "status-format",
|
||||
std::string(sRecordValues[0].mValue), makeEnumSanitizerString(sRecordValues) };
|
||||
Settings::SettingValue<std::string> mTypeFormat{ mIndex, sName, "type-format",
|
||||
std::string(sRecordValues[0].mValue), makeEnumSanitizerString(sRecordValues) };
|
||||
EnumSettingValue mStatusFormat{ mIndex, sName, "status-format", sRecordValues, 0 };
|
||||
EnumSettingValue mTypeFormat{ mIndex, sName, "type-format", sRecordValues, 0 };
|
||||
};
|
||||
|
||||
struct IdTablesCategory : Settings::WithIndex
|
||||
@ -118,16 +131,11 @@ namespace CSMPrefs
|
||||
EnumValueView{ "No Jump", "No special action" },
|
||||
};
|
||||
|
||||
Settings::SettingValue<std::string> mDouble{ mIndex, sName, "double", std::string(sDoubleClickValues[0].mValue),
|
||||
makeEnumSanitizerString(sDoubleClickValues) };
|
||||
Settings::SettingValue<std::string> mDoubleS{ mIndex, sName, "double-s",
|
||||
std::string(sDoubleClickValues[1].mValue), makeEnumSanitizerString(sDoubleClickValues) };
|
||||
Settings::SettingValue<std::string> mDoubleC{ mIndex, sName, "double-c",
|
||||
std::string(sDoubleClickValues[2].mValue), makeEnumSanitizerString(sDoubleClickValues) };
|
||||
Settings::SettingValue<std::string> mDoubleSc{ mIndex, sName, "double-sc",
|
||||
std::string(sDoubleClickValues[5].mValue), makeEnumSanitizerString(sDoubleClickValues) };
|
||||
Settings::SettingValue<std::string> mJumpToAdded{ mIndex, sName, "jump-to-added",
|
||||
std::string(sJumpAndSelectValues[0].mValue), makeEnumSanitizerString(sJumpAndSelectValues) };
|
||||
EnumSettingValue mDouble{ mIndex, sName, "double", sDoubleClickValues, 0 };
|
||||
EnumSettingValue mDoubleS{ mIndex, sName, "double-s", sDoubleClickValues, 1 };
|
||||
EnumSettingValue mDoubleC{ mIndex, sName, "double-c", sDoubleClickValues, 2 };
|
||||
EnumSettingValue mDoubleSc{ mIndex, sName, "double-sc", sDoubleClickValues, 5 };
|
||||
EnumSettingValue mJumpToAdded{ mIndex, sName, "jump-to-added", sJumpAndSelectValues, 0 };
|
||||
Settings::SettingValue<bool> mExtendedConfig{ mIndex, sName, "extended-config", false };
|
||||
Settings::SettingValue<bool> mSubviewNewWindow{ mIndex, sName, "subview-new-window", false };
|
||||
};
|
||||
@ -156,14 +164,10 @@ namespace CSMPrefs
|
||||
"report table" },
|
||||
};
|
||||
|
||||
Settings::SettingValue<std::string> mDouble{ mIndex, sName, "double", std::string(sReportValues[1].mValue),
|
||||
makeEnumSanitizerString(sReportValues) };
|
||||
Settings::SettingValue<std::string> mDoubleS{ mIndex, sName, "double-s", std::string(sReportValues[2].mValue),
|
||||
makeEnumSanitizerString(sReportValues) };
|
||||
Settings::SettingValue<std::string> mDoubleC{ mIndex, sName, "double-c", std::string(sReportValues[3].mValue),
|
||||
makeEnumSanitizerString(sReportValues) };
|
||||
Settings::SettingValue<std::string> mDoubleSc{ mIndex, sName, "double-sc", std::string(sReportValues[0].mValue),
|
||||
makeEnumSanitizerString(sReportValues) };
|
||||
EnumSettingValue mDouble{ mIndex, sName, "double", sReportValues, 1 };
|
||||
EnumSettingValue mDoubleS{ mIndex, sName, "double-s", sReportValues, 2 };
|
||||
EnumSettingValue mDoubleC{ mIndex, sName, "double-c", sReportValues, 3 };
|
||||
EnumSettingValue mDoubleSc{ mIndex, sName, "double-sc", sReportValues, 0 };
|
||||
Settings::SettingValue<bool> mIgnoreBaseRecords{ mIndex, sName, "ignore-base-records", false };
|
||||
};
|
||||
|
||||
@ -194,8 +198,7 @@ namespace CSMPrefs
|
||||
Settings::SettingValue<bool> mWrapLines{ mIndex, sName, "wrap-lines", false };
|
||||
Settings::SettingValue<bool> mMonoFont{ mIndex, sName, "mono-font", true };
|
||||
Settings::SettingValue<int> mTabWidth{ mIndex, sName, "tab-width", 4 };
|
||||
Settings::SettingValue<std::string> mWarnings{ mIndex, sName, "warnings", std::string(sWarningValues[1].mValue),
|
||||
makeEnumSanitizerString(sWarningValues) };
|
||||
EnumSettingValue mWarnings{ mIndex, sName, "warnings", sWarningValues, 1 };
|
||||
Settings::SettingValue<bool> mToolbar{ mIndex, sName, "toolbar", true };
|
||||
Settings::SettingValue<int> mCompileDelay{ mIndex, sName, "compile-delay", 100 };
|
||||
Settings::SettingValue<int> mErrorHeight{ mIndex, sName, "error-height", 100 };
|
||||
@ -310,14 +313,7 @@ namespace CSMPrefs
|
||||
EnumValueView{ "Discard", "" },
|
||||
};
|
||||
|
||||
static constexpr std::array<EnumValueView, 4> sPrimarySelectAction{
|
||||
EnumValueView{ "Select only", "" },
|
||||
EnumValueView{ "Add to selection", "" },
|
||||
EnumValueView{ "Remove from selection", "" },
|
||||
EnumValueView{ "Invert selection", "" },
|
||||
};
|
||||
|
||||
static constexpr std::array<EnumValueView, 4> sSecondarySelectAction{
|
||||
static constexpr std::array<EnumValueView, 4> sSelectAction{
|
||||
EnumValueView{ "Select only", "" },
|
||||
EnumValueView{ "Add to selection", "" },
|
||||
EnumValueView{ "Remove from selection", "" },
|
||||
@ -328,16 +324,12 @@ namespace CSMPrefs
|
||||
Settings::SettingValue<double> mGridsnapRotation{ mIndex, sName, "gridsnap-rotation", 15 };
|
||||
Settings::SettingValue<double> mGridsnapScale{ mIndex, sName, "gridsnap-scale", 0.25 };
|
||||
Settings::SettingValue<int> mDistance{ mIndex, sName, "distance", 50 };
|
||||
Settings::SettingValue<std::string> mOutsideDrop{ mIndex, sName, "outside-drop",
|
||||
std::string(sInsertOutsideCellValues[0].mValue), makeEnumSanitizerString(sInsertOutsideCellValues) };
|
||||
Settings::SettingValue<std::string> mOutsideVisibleDrop{ mIndex, sName, "outside-visible-drop",
|
||||
std::string(sInsertOutsideVisibleCellValues[0].mValue),
|
||||
makeEnumSanitizerString(sInsertOutsideVisibleCellValues) };
|
||||
Settings::SettingValue<std::string> mOutsideLandedit{ mIndex, sName, "outside-landedit",
|
||||
std::string(sLandEditOutsideCellValues[0].mValue), makeEnumSanitizerString(sLandEditOutsideCellValues) };
|
||||
Settings::SettingValue<std::string> mOutsideVisibleLandedit{ mIndex, sName, "outside-visible-landedit",
|
||||
std::string(sLandEditOutsideVisibleCellValues[0].mValue),
|
||||
makeEnumSanitizerString(sLandEditOutsideVisibleCellValues) };
|
||||
EnumSettingValue mOutsideDrop{ mIndex, sName, "outside-drop", sInsertOutsideCellValues, 0 };
|
||||
EnumSettingValue mOutsideVisibleDrop{ mIndex, sName, "outside-visible-drop", sInsertOutsideVisibleCellValues,
|
||||
0 };
|
||||
EnumSettingValue mOutsideLandedit{ mIndex, sName, "outside-landedit", sLandEditOutsideCellValues, 0 };
|
||||
EnumSettingValue mOutsideVisibleLandedit{ mIndex, sName, "outside-visible-landedit",
|
||||
sLandEditOutsideVisibleCellValues, 0 };
|
||||
Settings::SettingValue<int> mTexturebrushMaximumsize{ mIndex, sName, "texturebrush-maximumsize", 50 };
|
||||
Settings::SettingValue<int> mShapebrushMaximumsize{ mIndex, sName, "shapebrush-maximumsize", 100 };
|
||||
Settings::SettingValue<bool> mLandeditPostSmoothpainting{ mIndex, sName, "landedit-post-smoothpainting",
|
||||
@ -345,10 +337,8 @@ namespace CSMPrefs
|
||||
Settings::SettingValue<double> mLandeditPostSmoothstrength{ mIndex, sName, "landedit-post-smoothstrength",
|
||||
0.25 };
|
||||
Settings::SettingValue<bool> mOpenListView{ mIndex, sName, "open-list-view", false };
|
||||
Settings::SettingValue<std::string> mPrimarySelectAction{ mIndex, sName, "primary-select-action",
|
||||
std::string(sPrimarySelectAction[0].mValue), makeEnumSanitizerString(sPrimarySelectAction) };
|
||||
Settings::SettingValue<std::string> mSecondarySelectAction{ mIndex, sName, "secondary-select-action",
|
||||
std::string(sPrimarySelectAction[1].mValue), makeEnumSanitizerString(sPrimarySelectAction) };
|
||||
EnumSettingValue mPrimarySelectAction{ mIndex, sName, "primary-select-action", sSelectAction, 0 };
|
||||
EnumSettingValue mSecondarySelectAction{ mIndex, sName, "secondary-select-action", sSelectAction, 1 };
|
||||
};
|
||||
|
||||
struct KeyBindingsCategory : Settings::WithIndex
|
||||
|
Loading…
x
Reference in New Issue
Block a user