2018-04-20 11:27:25 +00:00
|
|
|
#include "ButtonsDescription.hpp"
|
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/statbmp.h>
|
2018-04-30 12:20:33 +00:00
|
|
|
#include <wx/clrpicker.h>
|
2018-04-20 11:27:25 +00:00
|
|
|
|
|
|
|
#include "GUI.hpp"
|
2018-10-01 13:09:31 +00:00
|
|
|
#include "GUI_App.hpp"
|
2018-11-26 13:41:58 +00:00
|
|
|
#include "I18N.hpp"
|
2019-04-13 21:46:52 +00:00
|
|
|
#include "wxExtensions.hpp"
|
2018-04-20 11:27:25 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
namespace GUI {
|
|
|
|
|
2019-05-09 17:24:21 +00:00
|
|
|
ButtonsDescription::ButtonsDescription(wxWindow* parent, const std::vector<Entry> &entries) :
|
2018-05-02 11:20:36 +00:00
|
|
|
wxDialog(parent, wxID_ANY, _(L("Buttons And Text Colors Description")), wxDefaultPosition, wxDefaultSize),
|
2019-05-09 17:24:21 +00:00
|
|
|
m_entries(entries)
|
2018-04-20 11:27:25 +00:00
|
|
|
{
|
|
|
|
auto grid_sizer = new wxFlexGridSizer(3, 20, 20);
|
|
|
|
|
|
|
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
main_sizer->Add(grid_sizer, 0, wxEXPAND | wxALL, 20);
|
|
|
|
|
2018-04-30 12:20:33 +00:00
|
|
|
// Icon description
|
2019-05-09 17:24:21 +00:00
|
|
|
for (const Entry &entry : m_entries)
|
2018-04-20 11:27:25 +00:00
|
|
|
{
|
2019-05-09 17:24:21 +00:00
|
|
|
auto icon = new wxStaticBitmap(this, wxID_ANY, entry.bitmap->bmp());
|
2018-04-20 11:27:25 +00:00
|
|
|
grid_sizer->Add(icon, -1, wxALIGN_CENTRE_VERTICAL);
|
2019-05-09 17:24:21 +00:00
|
|
|
auto description = new wxStaticText(this, wxID_ANY, _utf8(entry.symbol));
|
2018-04-24 06:49:37 +00:00
|
|
|
grid_sizer->Add(description, -1, wxALIGN_CENTRE_VERTICAL);
|
2019-05-09 17:24:21 +00:00
|
|
|
description = new wxStaticText(this, wxID_ANY, _utf8(entry.explanation));
|
2018-04-24 06:49:37 +00:00
|
|
|
grid_sizer->Add(description, -1, wxALIGN_CENTRE_VERTICAL | wxEXPAND);
|
2018-04-20 11:27:25 +00:00
|
|
|
}
|
|
|
|
|
2018-04-30 12:20:33 +00:00
|
|
|
// Text color description
|
|
|
|
auto sys_label = new wxStaticText(this, wxID_ANY, _(L("Value is the same as the system value")));
|
2018-10-01 13:09:31 +00:00
|
|
|
sys_label->SetForegroundColour(wxGetApp().get_label_clr_sys());
|
|
|
|
auto sys_colour = new wxColourPickerCtrl(this, wxID_ANY, wxGetApp().get_label_clr_sys());
|
2018-04-30 12:20:33 +00:00
|
|
|
sys_colour->Bind(wxEVT_COLOURPICKER_CHANGED, ([sys_colour, sys_label](wxCommandEvent e)
|
|
|
|
{
|
|
|
|
sys_label->SetForegroundColour(sys_colour->GetColour());
|
|
|
|
sys_label->Refresh();
|
|
|
|
}));
|
|
|
|
size_t t= 0;
|
2018-10-31 11:56:08 +00:00
|
|
|
while (t < 3) {
|
2018-04-30 12:20:33 +00:00
|
|
|
grid_sizer->Add(new wxStaticText(this, wxID_ANY, ""), -1, wxALIGN_CENTRE_VERTICAL | wxEXPAND);
|
|
|
|
++t;
|
|
|
|
}
|
|
|
|
grid_sizer->Add(0, -1, wxALIGN_CENTRE_VERTICAL);
|
|
|
|
grid_sizer->Add(sys_colour, -1, wxALIGN_CENTRE_VERTICAL);
|
|
|
|
grid_sizer->Add(sys_label, -1, wxALIGN_CENTRE_VERTICAL | wxEXPAND);
|
|
|
|
|
|
|
|
auto mod_label = new wxStaticText(this, wxID_ANY, _(L("Value was changed and is not equal to the system value or the last saved preset")));
|
2018-10-01 13:09:31 +00:00
|
|
|
mod_label->SetForegroundColour(wxGetApp().get_label_clr_modified());
|
|
|
|
auto mod_colour = new wxColourPickerCtrl(this, wxID_ANY, wxGetApp().get_label_clr_modified());
|
2018-04-30 12:20:33 +00:00
|
|
|
mod_colour->Bind(wxEVT_COLOURPICKER_CHANGED, ([mod_colour, mod_label](wxCommandEvent e)
|
|
|
|
{
|
|
|
|
mod_label->SetForegroundColour(mod_colour->GetColour());
|
|
|
|
mod_label->Refresh();
|
|
|
|
}));
|
|
|
|
grid_sizer->Add(0, -1, wxALIGN_CENTRE_VERTICAL);
|
|
|
|
grid_sizer->Add(mod_colour, -1, wxALIGN_CENTRE_VERTICAL);
|
|
|
|
grid_sizer->Add(mod_label, -1, wxALIGN_CENTRE_VERTICAL | wxEXPAND);
|
|
|
|
|
|
|
|
|
|
|
|
auto buttons = CreateStdDialogButtonSizer(wxOK|wxCANCEL);
|
|
|
|
main_sizer->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10);
|
|
|
|
|
|
|
|
wxButton* btn = static_cast<wxButton*>(FindWindowById(wxID_OK, this));
|
|
|
|
btn->Bind(wxEVT_BUTTON, [sys_colour, mod_colour, this](wxCommandEvent&) {
|
2018-10-01 13:09:31 +00:00
|
|
|
wxGetApp().set_label_clr_sys(sys_colour->GetColour());
|
|
|
|
wxGetApp().set_label_clr_modified(mod_colour->GetColour());
|
2018-04-30 12:20:33 +00:00
|
|
|
EndModal(wxID_OK);
|
|
|
|
});
|
2018-04-20 11:27:25 +00:00
|
|
|
|
|
|
|
SetSizer(main_sizer);
|
|
|
|
main_sizer->SetSizeHints(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // GUI
|
|
|
|
} // Slic3r
|
|
|
|
|