2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2014 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2014-07-29 17:14:25 +00:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
#include <memory>
|
2014-07-29 17:14:25 +00:00
|
|
|
#include <string>
|
2016-08-02 06:22:58 +00:00
|
|
|
#include <unordered_map>
|
|
|
|
#include <utility>
|
2014-07-29 17:14:25 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <wx/dialog.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
#include "DolphinWX/DolphinSlider.h"
|
2014-07-29 17:14:25 +00:00
|
|
|
#include "VideoCommon/PostProcessing.h"
|
|
|
|
|
2015-05-08 14:04:40 +00:00
|
|
|
class wxButton;
|
|
|
|
class wxCheckBox;
|
|
|
|
class wxFlexGridSizer;
|
|
|
|
|
2014-07-29 17:14:25 +00:00
|
|
|
class PostProcessingConfigDiag : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
2016-06-24 08:43:46 +00:00
|
|
|
PostProcessingConfigDiag(wxWindow* parent, const std::string& shader);
|
|
|
|
~PostProcessingConfigDiag();
|
2014-07-29 17:14:25 +00:00
|
|
|
|
|
|
|
private:
|
2016-06-24 08:43:46 +00:00
|
|
|
// This is literally the stupidest thing ever
|
|
|
|
// wxWidgets takes ownership of any pointer given to a event handler
|
|
|
|
// Instead of passing them a pointer to a std::string, we wrap around it here.
|
|
|
|
class UserEventData : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UserEventData(const std::string& data) : m_data(data) {}
|
|
|
|
const std::string& GetData() { return m_data; }
|
2018-04-12 12:18:04 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
private:
|
|
|
|
const std::string m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ConfigGrouping
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum WidgetType
|
|
|
|
{
|
|
|
|
TYPE_TOGGLE,
|
|
|
|
TYPE_SLIDER,
|
|
|
|
};
|
|
|
|
|
|
|
|
ConfigGrouping(WidgetType type, const std::string& gui_name, const std::string& option_name,
|
|
|
|
const std::string& parent,
|
|
|
|
const PostProcessingShaderConfiguration::ConfigurationOption* config_option)
|
|
|
|
: m_type(type), m_gui_name(gui_name), m_option(option_name), m_parent(parent),
|
|
|
|
m_config_option(config_option)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
void AddChild(std::unique_ptr<ConfigGrouping>&& child)
|
|
|
|
{
|
|
|
|
m_children.emplace_back(std::move(child));
|
|
|
|
}
|
2016-06-24 08:43:46 +00:00
|
|
|
bool HasChildren() { return m_children.size() != 0; }
|
2016-08-02 06:22:58 +00:00
|
|
|
const std::vector<std::unique_ptr<ConfigGrouping>>& GetChildren() { return m_children; }
|
2016-06-24 08:43:46 +00:00
|
|
|
// Gets the string that is shown in the UI for the option
|
|
|
|
const std::string& GetGUIName() { return m_gui_name; }
|
|
|
|
// Gets the option name for use in the shader
|
|
|
|
// Also is a unique identifier for the option's configuration
|
|
|
|
const std::string& GetOption() { return m_option; }
|
|
|
|
// Gets the option name of the parent of this option
|
|
|
|
const std::string& GetParent() { return m_parent; }
|
|
|
|
void GenerateUI(PostProcessingConfigDiag* dialog, wxWindow* parent, wxFlexGridSizer* sizer);
|
|
|
|
|
|
|
|
void EnableDependentChildren(bool enable);
|
|
|
|
|
|
|
|
int GetSliderValue(const int index) { return m_option_sliders[index]->GetValue(); }
|
|
|
|
void SetSliderText(const int index, const std::string& text)
|
|
|
|
{
|
|
|
|
m_option_text_ctrls[index]->SetValue(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const WidgetType m_type;
|
|
|
|
const std::string m_gui_name;
|
|
|
|
const std::string m_option;
|
|
|
|
const std::string m_parent;
|
|
|
|
const PostProcessingShaderConfiguration::ConfigurationOption* m_config_option;
|
|
|
|
|
|
|
|
// For TYPE_TOGGLE
|
|
|
|
wxCheckBox* m_option_checkbox;
|
|
|
|
|
|
|
|
// For TYPE_SLIDER
|
|
|
|
// Can have up to 4
|
2016-08-02 06:22:58 +00:00
|
|
|
std::vector<DolphinSlider*> m_option_sliders;
|
2016-06-24 08:43:46 +00:00
|
|
|
std::vector<wxTextCtrl*> m_option_text_ctrls;
|
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
std::vector<std::unique_ptr<ConfigGrouping>> m_children;
|
2016-06-24 08:43:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// WX UI things
|
|
|
|
void Event_Slider(wxCommandEvent& ev);
|
|
|
|
void Event_CheckBox(wxCommandEvent& ev);
|
|
|
|
|
|
|
|
const std::string& m_shader;
|
|
|
|
PostProcessingShaderConfiguration* m_post_processor;
|
|
|
|
|
2016-08-02 06:22:58 +00:00
|
|
|
std::unordered_map<std::string, ConfigGrouping*> m_config_map;
|
|
|
|
std::vector<std::unique_ptr<ConfigGrouping>> m_config_groups;
|
2014-07-29 17:14:25 +00:00
|
|
|
};
|