19#ifndef CELLVALUESHADER_HPP 
   20#define CELLVALUESHADER_HPP 
   23#include <wx/notebook.h> 
   24#include <wx/clrpicker.h> 
   25#include <wx/statline.h> 
   27#include "../../kernel/core/ui/language.hpp" 
   28#include "../../kernel/core/utils/stringtools.hpp" 
   96            double part = val - index;
 
  102            else if (index < excl)
 
  217            auto removeQuotes = [](
const wxString& strVal) {
return strVal[0] == 
'"' && strVal[strVal.length()-1] == 
'"' 
  218                                                            ? strVal.substr(1, strVal.length()-2) : strVal;};
 
  235                    if (strVal.find(sStr) != std::string::npos)
 
  243                    if (strVal.find(sStr) != std::string::npos)
 
  318            wxBoxSizer* condSizer = _panel->
createGroup(wxHORIZONTAL, hsizer, 0);
 
  329            lt_gt.Add(
_guilang.
get(
"GUI_DLG_CVS_LT_GT_EQ_CONTAINS"));
 
  330            lt_gt.Add(
_guilang.
get(
"GUI_DLG_CVS_LT_GT_EQ_NOT_CONTAINS"));
 
  342            m_lt_gt_colour = 
new wxColourPickerCtrl(hsizer->GetStaticBox(), wxID_ANY);
 
  344            hsizer->Add(
m_lt_gt_colour, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
 
  369            wxBoxSizer* colorsizer = _panel->
createGroup(wxHORIZONTAL, hsizer, 0);
 
  372            for (
size_t i = 0; i < 3; i++)
 
  373                m_interval_col[i] = 
new wxColourPickerCtrl(hsizer->GetStaticBox(), wxID_ANY);
 
  383            for (
size_t i = 0; i < 3; i++)
 
  386            wxCheckBox* check = _panel->
CreateCheckBox(hsizer->GetStaticBox(), hsizer, 
_guilang.
get(
"GUI_DLG_CVS_COLOR_COUNT", 
"3"));
 
  412            wxBoxSizer* colorsizer = _panel->
createGroup(wxHORIZONTAL, hsizer, 0);
 
  415            for (
size_t i = 0; i < 5; i++)
 
  429            wxStaticLine* line = 
new wxStaticLine(hsizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVERTICAL);
 
  430            colorsizer->Add(line, 0, wxEXPAND | wxALL, 5);
 
  433            for (
size_t i = 1; i < 4; i++)
 
  437            line = 
new wxStaticLine(hsizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVERTICAL);
 
  438            colorsizer->Add(line, 0, wxEXPAND | wxALL, 5);
 
  441            wxCheckBox* check = _panel->
CreateCheckBox(hsizer->GetStaticBox(), hsizer, 
_guilang.
get(
"GUI_DLG_CVS_COLOR_COUNT", 
"5"));
 
  476            wxBoxSizer* vsizer = 
new wxBoxSizer(wxVERTICAL);
 
  485            vsizer->Add(
m_book, 0, wxALL, 5);
 
  491            wxBoxSizer* buttonSizer = 
new wxBoxSizer(wxHORIZONTAL);
 
  492            vsizer->Add(buttonSizer, 0, wxALIGN_RIGHT | wxALL, 0);
 
  493            wxButton* okButton = 
new wxButton(
this, wxID_OK, 
_guilang.
get(
"GUI_OPTIONS_OK"), wxDefaultPosition, wxDefaultSize, 0);
 
  494            wxButton* cancelButton = 
new wxButton(
this, wxID_CANCEL, 
_guilang.
get(
"GUI_OPTIONS_CANCEL"), wxDefaultPosition, wxDefaultSize, 0);
 
  495            buttonSizer->Add(okButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
 
  496            buttonSizer->Add(cancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
 
  497            vsizer->SetSizeHints(
this);
 
  511            if (event.GetId() == wxID_OK)
 
  516                std::vector<wxColour> colors;
 
  518                int sel = 
m_book->GetSelection();
 
  531                        std::vector<std::string> vecVal;
 
  533                        if (val.front() == 
'{' && val.back() == 
'}')
 
  536                            vecVal.push_back(val);
 
  552                        else if (condType == 
">")
 
  554                        else if (condType == 
"<=")
 
  556                        else if (condType == 
">=")
 
  561                        else if (condType == 
"==")
 
  566                        else if (condType == 
"!=")
 
  568                        else if (condType == 
_guilang.
get(
"GUI_DLG_CVS_LT_GT_EQ_CONTAINS"))
 
  570                        else if (condType == 
_guilang.
get(
"GUI_DLG_CVS_LT_GT_EQ_NOT_CONTAINS"))
 
  574                        for (
const auto& s : vecVal)
 
  589                        for (
size_t i = 0; i < 3; i++)
 
  617                            cond.
m_vals.push_back(NAN);
 
  624                            cond.
m_vals.push_back(NAN);
 
  631                        for (
size_t i = 0; i < 5; i++)
 
  661                            cond.
m_vals.push_back(NAN);
 
  668                            cond.
m_vals.push_back(NAN);
 
  678            EndModal(event.GetId());
 
This class implements the dialog for choosing the shader properties of the selected cells.
 
static wxColour LOWERCOLOUR
 
TextField * m_interval_end
 
const CellValueShader & getShader() const
Get a reference to the internally available shader instance.
 
void createIntervalPage(double minVal, double maxVal)
This private member function creates the interval page.
 
void createIntervalExclPage(double minVal, double maxVal)
This private member function creates the excluded interval page.
 
static wxColour HIGHERCOLOUR
 
static wxColour MAXCOLOUR
 
wxColourPickerCtrl * m_lt_gt_colour
 
wxColourPickerCtrl * m_interval_col[3]
 
CellValueShaderDialog(wxWindow *parent, double minVal, double maxVal, wxWindowID id=wxID_ANY)
Create the dialog.
 
TextField * m_lt_gt_value
 
static bool USEALLCOLOURS
 
void OnCheckBox(wxCommandEvent &event)
Event handler for the colour count checkboxes.
 
void createLtGtPage()
This private member function creates the single value comparison page.
 
void OnButtonClick(wxCommandEvent &event)
Event handler for the apply and cancel buttons. Will create a valid shader if the user clicked on app...
 
static wxColour LEVELCOLOUR
 
wxColourPickerCtrl * m_interval_col_excl[5]
 
TextField * m_interval_end_excl
 
wxChoice * m_lt_gt_choice
 
TextField * m_interval_start_excl
 
static wxColour MEDCOLOUR
 
static wxColour MINCOLOUR
 
TextField * m_interval_start
 
A class to handle value-based cell shading using a custom colorscheme and custom conditions.
 
wxColour getColour(const wxString &strVal) const
Calulate the colour for a string value.
 
std::vector< wxColour > m_colorArray
 
CellValueShader(const CellValueShader &shader)
 
wxColour getColour(const mu::value_type &val) const
Calculate the colour for a numerical value.
 
bool isActive() const
Detect, whether this shader is actually active or an empty shader.
 
wxColour interpolateColor(double val, bool excl) const
Calculate the cell background colour depending on their value and using linear interpolation.
 
CellValueShader(const std::vector< wxColour > &colors, const CellValueShaderCondition &cond)
 
CellValueShaderCondition m_condition
 
This class simplifies the creation of simple windows and creates a common layout among all windows.
 
wxStaticText * AddStaticText(wxWindow *parent, wxSizer *sizer, const wxString &text, int id=wxID_STATIC, int alignment=wxALIGN_CENTER_VERTICAL)
Add some static test to the current sizer and window.
 
wxChoice * CreateChoices(wxWindow *parent, wxSizer *sizer, const wxArrayString &choices, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a dropdown list.
 
wxCheckBox * CreateCheckBox(wxWindow *parent, wxSizer *sizer, const wxString &description, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a usual checkbox.
 
wxBoxSizer * getMainSizer()
Return the pointer to the current main layout sizer.
 
wxStaticBoxSizer * createGroup(const wxString &sGroupName, int orient=wxVERTICAL, wxWindow *parent=nullptr, wxSizer *sizer=nullptr, int expand=0)
Member function to create a group (a static box with a label) in the panel.
 
TextField * CreateTextInput(wxWindow *parent, wxSizer *sizer, const wxString &description, const wxString &sDefault=wxEmptyString, int nStyle=0, int id=wxID_ANY, const wxSize &size=wxSize(310,-1), int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a text input.
 
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
 
This class is a extension to the standard wxTextCtrl to combine it with a read- and changeable label.
 
CONSTCD14 std::enable_if< detail::no_overflow< Period, typenameTo::period >::value, To >::type floor(const std::chrono::duration< Rep, Period > &d)
 
MUP_BASETYPE value_type
The numeric datatype used by the parser.
 
bool isnan(const value_type &v)
 
bool isinf(const value_type &v)
 
std::string get(const std::string &sUrl, const std::string &sUserName, const std::string &sPassWord)
Get the contents of a URL.
 
Represents the basic settings needed by the CellValueShader class to actually calculate the cell shad...
 
std::vector< mu::value_type > m_vals
 
std::vector< wxString > m_strs
 
std::string toString(int)
Converts an integer to a string without the Settings bloat.