mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-03 20:13:59 -06:00
ENH:dark mode of imgui part
Change-Id: I42975f9004be1a348db83f1a5790490dbc444c9d
This commit is contained in:
parent
1400e9d63a
commit
df260dd724
81 changed files with 877 additions and 297 deletions
|
@ -22,6 +22,7 @@
|
|||
|
||||
static const float GROUND_Z = -0.04f;
|
||||
static const std::array<float, 4> DEFAULT_MODEL_COLOR = { 0.3255f, 0.337f, 0.337f, 1.0f };
|
||||
static const std::array<float, 4> DEFAULT_MODEL_COLOR_DARK = { 0.255f, 0.255f, 0.283f, 1.0f };
|
||||
static const std::array<float, 4> PICKING_MODEL_COLOR = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
|
||||
namespace Slic3r {
|
||||
|
@ -334,7 +335,7 @@ void Bed3D::render_internal(GLCanvas3D& canvas, bool bottom, float scale_factor,
|
|||
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
|
||||
m_model.set_color(-1, DEFAULT_MODEL_COLOR);
|
||||
m_model.set_color(-1, wxGetApp().app_config->get("dark_color_mode") == "1" ? DEFAULT_MODEL_COLOR_DARK : DEFAULT_MODEL_COLOR);
|
||||
|
||||
switch (m_type)
|
||||
{
|
||||
|
@ -651,7 +652,7 @@ void Bed3D::render_model() const
|
|||
GLModel* model = const_cast<GLModel*>(&m_model);
|
||||
|
||||
if (model->get_filename() != m_model_filename && model->init_from_file(m_model_filename)) {
|
||||
model->set_color(-1, DEFAULT_MODEL_COLOR);
|
||||
model->set_color(-1, wxGetApp().app_config->get("dark_color_mode") == "1" ? DEFAULT_MODEL_COLOR_DARK : DEFAULT_MODEL_COLOR);
|
||||
|
||||
update_model_offset();
|
||||
}
|
||||
|
|
|
@ -330,9 +330,8 @@ void GCodeViewer::SequentialView::Marker::render(int canvas_width, int canvas_he
|
|||
|
||||
static float last_window_width = 0.0f;
|
||||
static size_t last_text_length = 0;
|
||||
static const ImU32 text_name_clr = IM_COL32(38, 46, 48, 255);
|
||||
static const ImU32 text_value_clr = IM_COL32(144, 144, 144, 255);
|
||||
static const ImU32 window_bg_clr = IM_COL32(255, 255, 255, 255);
|
||||
const ImU32 text_name_clr = wxGetApp().app_config->get("dark_color_mode") == "1" ? IM_COL32(255, 255, 255, 0.88 * 255) : IM_COL32(38, 46, 48, 255);
|
||||
const ImU32 text_value_clr = wxGetApp().app_config->get("dark_color_mode") == "1" ? IM_COL32(255, 255, 255, 0.4 * 255) : IM_COL32(144, 144, 144, 255);
|
||||
|
||||
auto it = std::find_if(moves.begin(), moves.end(), [&curr_line_id](auto move) {
|
||||
return move.gcode_id == curr_line_id;
|
||||
|
@ -347,7 +346,6 @@ void GCodeViewer::SequentialView::Marker::render(int canvas_width, int canvas_he
|
|||
imgui.push_toolbar_style(m_scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0, 4.0 * m_scale));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0 * m_scale, 6.0 * m_scale));
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, window_bg_clr);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, text_name_clr);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, text_value_clr);
|
||||
imgui.begin(std::string("ExtruderPosition"), ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar);
|
||||
|
@ -465,9 +463,9 @@ void GCodeViewer::SequentialView::Marker::render(int canvas_width, int canvas_he
|
|||
}
|
||||
|
||||
imgui.end();
|
||||
imgui.pop_toolbar_style();
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopStyleColor(3);
|
||||
ImGui::PopStyleColor(2);
|
||||
imgui.pop_toolbar_style();
|
||||
}
|
||||
|
||||
void GCodeViewer::SequentialView::GCodeWindow::load_gcode(const std::string& filename, std::vector<size_t> &&lines_ends)
|
||||
|
|
|
@ -78,7 +78,9 @@ static const float SLIDER_RIGHT_MARGIN = 105.0f;
|
|||
static const float SLIDER_BOTTOM_MARGIN = 90.0f;
|
||||
|
||||
float GLCanvas3D::DEFAULT_BG_LIGHT_COLOR[3] = { 0.906f, 0.906f, 0.906f };
|
||||
float GLCanvas3D::DEFAULT_BG_LIGHT_COLOR_DARK[3] = { 0.329f, 0.329f, 0.353f };
|
||||
float GLCanvas3D::ERROR_BG_LIGHT_COLOR[3] = { 0.753f, 0.192f, 0.039f };
|
||||
float GLCanvas3D::ERROR_BG_LIGHT_COLOR_DARK[3] = { 0.753f, 0.192f, 0.039f };
|
||||
|
||||
void GLCanvas3D::update_render_colors()
|
||||
{
|
||||
|
@ -241,8 +243,10 @@ void GLCanvas3D::LayersEditing::render_variable_layer_height_dialog(const GLCanv
|
|||
if (imgui.button(_L("Adaptive")))
|
||||
wxPostEvent((wxEvtHandler*)canvas.get_wxglcanvas(), Event<float>(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, m_adaptive_quality));
|
||||
ImGui::SameLine();
|
||||
float text_align = ImGui::GetCursorPosX();
|
||||
static float text_align = ImGui::GetCursorPosX();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
text_align = std::max(text_align, ImGui::GetCursorPosX());
|
||||
ImGui::SetCursorPosX(text_align);
|
||||
imgui.text(_L("Quality / Speed"));
|
||||
if (ImGui::IsItemHovered()) {
|
||||
//ImGui::BeginTooltip();
|
||||
|
@ -250,22 +254,28 @@ void GLCanvas3D::LayersEditing::render_variable_layer_height_dialog(const GLCanv
|
|||
//ImGui::EndTooltip();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
float slider_align = ImGui::GetCursorPosX();
|
||||
static float slider_align = ImGui::GetCursorPosX();
|
||||
ImGui::PushItemWidth(sliders_width);
|
||||
m_adaptive_quality = std::clamp(m_adaptive_quality, 0.0f, 1.f);
|
||||
slider_align = std::max(slider_align, ImGui::GetCursorPosX());
|
||||
ImGui::SetCursorPosX(slider_align);
|
||||
imgui.bbl_slider_float_style("##adaptive_slider", &m_adaptive_quality, 0.0f, 1.f, "%.2f");
|
||||
ImGui::SameLine();
|
||||
float input_align = ImGui::GetCursorPosX();
|
||||
static float input_align = ImGui::GetCursorPosX();
|
||||
ImGui::PushItemWidth(input_box_width);
|
||||
input_align = std::max(input_align, ImGui::GetCursorPosX());
|
||||
ImGui::SetCursorPosX(input_align);
|
||||
ImGui::BBLDragFloat("##adaptive_input", &m_adaptive_quality, 0.05f, 0.0f, 0.0f, "%.2f");
|
||||
|
||||
if (imgui.button(_L("Smooth")))
|
||||
wxPostEvent((wxEvtHandler*)canvas.get_wxglcanvas(), HeightProfileSmoothEvent(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, m_smooth_params));
|
||||
ImGui::SameLine();
|
||||
text_align = std::max(text_align, ImGui::GetCursorPosX());
|
||||
ImGui::SetCursorPosX(text_align);
|
||||
ImGui::AlignTextToFramePadding();
|
||||
imgui.text(_L("Radius"));
|
||||
ImGui::SameLine();
|
||||
slider_align = std::max(slider_align, ImGui::GetCursorPosX());
|
||||
ImGui::SetCursorPosX(slider_align);
|
||||
ImGui::PushItemWidth(sliders_width);
|
||||
int radius = (int)m_smooth_params.radius;
|
||||
|
@ -282,6 +292,7 @@ void GLCanvas3D::LayersEditing::render_variable_layer_height_dialog(const GLCanv
|
|||
ImGui::PopStyleColor(4);
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::SameLine();
|
||||
input_align = std::max(input_align, ImGui::GetCursorPosX());
|
||||
ImGui::SetCursorPosX(input_align);
|
||||
ImGui::PushItemWidth(input_box_width);
|
||||
ImGui::PushStyleColor(ImGuiCol_BorderActive, ImVec4(0.00f, 0.68f, 0.26f, 1.00f));
|
||||
|
@ -5658,8 +5669,10 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||
if (!m_main_toolbar.is_enabled())
|
||||
return true;
|
||||
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
|
||||
BackgroundTexture::Metadata background_data;
|
||||
background_data.filename = "toolbar_background.png";
|
||||
background_data.filename = dark_mode ? "toolbar_background_dark.png" : "toolbar_background.png";
|
||||
background_data.left = 16;
|
||||
background_data.top = 16;
|
||||
background_data.right = 16;
|
||||
|
@ -5696,10 +5709,12 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||
m_main_toolbar.set_separator_size(5);
|
||||
m_main_toolbar.set_gap_size(4);
|
||||
|
||||
m_main_toolbar.del_all_item();
|
||||
|
||||
GLToolbarItem::Data item;
|
||||
|
||||
item.name = "add";
|
||||
item.icon_filename = "toolbar_open.svg";
|
||||
item.icon_filename = dark_mode ? "toolbar_open_dark.svg" : "toolbar_open.svg";
|
||||
item.tooltip = _utf8(L("Add")) + " [" + GUI::shortkey_ctrl_prefix() + "I]";
|
||||
item.sprite_id = 0;
|
||||
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_ADD)); };
|
||||
|
@ -5708,7 +5723,7 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||
return false;
|
||||
|
||||
item.name = "addplate";
|
||||
item.icon_filename = "toolbar_add_plate.svg";
|
||||
item.icon_filename = dark_mode ? "toolbar_add_plate_dark.svg" : "toolbar_add_plate.svg";
|
||||
item.tooltip = _utf8(L("Add plate"));
|
||||
item.sprite_id++;
|
||||
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_ADD_PLATE)); };
|
||||
|
@ -5717,7 +5732,7 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||
return false;
|
||||
|
||||
item.name = "orient";
|
||||
item.icon_filename = "toolbar_orient.svg";
|
||||
item.icon_filename = dark_mode ? "toolbar_orient_dark.svg" : "toolbar_orient.svg";
|
||||
item.tooltip = _utf8(L("Auto orient"));
|
||||
item.sprite_id++;
|
||||
item.left.render_callback = nullptr;
|
||||
|
@ -5737,7 +5752,7 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||
return false;
|
||||
|
||||
item.name = "arrange";
|
||||
item.icon_filename = "toolbar_arrange.svg";
|
||||
item.icon_filename = dark_mode ? "toolbar_arrange_dark.svg" : "toolbar_arrange.svg";
|
||||
item.tooltip = _utf8(L("Arrange all objects")) + " [A]\n" + _utf8(L("Arrange objects on selected plates")) + " [Shift+A]";
|
||||
item.sprite_id++;
|
||||
item.left.action_callback = []() {};
|
||||
|
@ -5761,7 +5776,7 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||
return false;
|
||||
|
||||
item.name = "splitobjects";
|
||||
item.icon_filename = "split_objects.svg";
|
||||
item.icon_filename = dark_mode ? "split_objects_dark.svg" : "split_objects.svg";
|
||||
item.tooltip = _utf8(L("Split to objects"));
|
||||
item.sprite_id++;
|
||||
item.left.render_callback = nullptr;
|
||||
|
@ -5772,7 +5787,7 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||
return false;
|
||||
|
||||
item.name = "splitvolumes";
|
||||
item.icon_filename = "split_parts.svg";
|
||||
item.icon_filename = dark_mode ? "split_parts_dark.svg" : "split_parts.svg";
|
||||
item.tooltip = _utf8(L("Split to parts"));
|
||||
item.sprite_id++;
|
||||
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_SPLIT_VOLUMES)); };
|
||||
|
@ -5782,7 +5797,7 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||
return false;
|
||||
|
||||
item.name = "layersediting";
|
||||
item.icon_filename = "toolbar_variable_layer_height.svg";
|
||||
item.icon_filename = dark_mode ? "toolbar_variable_layer_height_dark.svg" : "toolbar_variable_layer_height.svg";
|
||||
item.tooltip = _utf8(L("Variable layer height"));
|
||||
item.sprite_id++;
|
||||
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_LAYERSEDITING)); };
|
||||
|
@ -5839,8 +5854,10 @@ bool GLCanvas3D::_init_assemble_view_toolbar()
|
|||
if (!m_assemble_view_toolbar.is_enabled())
|
||||
return true;
|
||||
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
|
||||
BackgroundTexture::Metadata background_data;
|
||||
background_data.filename = "toolbar_background.png";
|
||||
background_data.filename = dark_mode ? "toolbar_background_dark.png" : "toolbar_background.png";
|
||||
background_data.left = 16;
|
||||
background_data.top = 16;
|
||||
background_data.right = 16;
|
||||
|
@ -5861,6 +5878,8 @@ bool GLCanvas3D::_init_assemble_view_toolbar()
|
|||
m_assemble_view_toolbar.set_separator_size(10);
|
||||
m_assemble_view_toolbar.set_gap_size(4);
|
||||
|
||||
m_assemble_view_toolbar.del_all_item();
|
||||
|
||||
GLToolbarItem::Data item;
|
||||
item.name = "assembly_view";
|
||||
item.icon_filename = "toolbar_assemble.svg";
|
||||
|
@ -5894,9 +5913,10 @@ bool GLCanvas3D::_init_separator_toolbar()
|
|||
if (!m_separator_toolbar.is_enabled())
|
||||
return true;
|
||||
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
|
||||
BackgroundTexture::Metadata background_data;
|
||||
background_data.filename = "toolbar_background.png";
|
||||
background_data.filename = dark_mode ? "toolbar_background_dark.png" : "toolbar_background.png";
|
||||
background_data.left = 0;
|
||||
background_data.top = 0;
|
||||
background_data.right = 0;
|
||||
|
@ -5915,6 +5935,8 @@ bool GLCanvas3D::_init_separator_toolbar()
|
|||
m_separator_toolbar.set_vertical_orientation(GLToolbar::Layout::VO_Top);
|
||||
m_separator_toolbar.set_border(5.0f);
|
||||
|
||||
m_separator_toolbar.del_all_item();
|
||||
|
||||
GLToolbarItem::Data sperate_item;
|
||||
sperate_item.name = "start_seperator";
|
||||
sperate_item.icon_filename = "seperator.svg";
|
||||
|
@ -6246,18 +6268,21 @@ void GLCanvas3D::_render_background() const
|
|||
|
||||
::glBegin(GL_QUADS);
|
||||
|
||||
float* background_color = wxGetApp().app_config->get("dark_color_mode") == "1" ? DEFAULT_BG_LIGHT_COLOR_DARK : DEFAULT_BG_LIGHT_COLOR;
|
||||
float* error_background_color = wxGetApp().app_config->get("dark_color_mode") == "1" ? ERROR_BG_LIGHT_COLOR_DARK : ERROR_BG_LIGHT_COLOR;
|
||||
|
||||
if (use_error_color)
|
||||
::glColor3fv(ERROR_BG_LIGHT_COLOR);
|
||||
::glColor3fv(error_background_color);
|
||||
else
|
||||
::glColor3fv(DEFAULT_BG_LIGHT_COLOR);
|
||||
::glColor3fv(background_color);
|
||||
|
||||
::glVertex2f(-1.0f, -1.0f);
|
||||
::glVertex2f(1.0f, -1.0f);
|
||||
|
||||
if (use_error_color)
|
||||
::glColor3fv(ERROR_BG_LIGHT_COLOR);
|
||||
::glColor3fv(error_background_color);
|
||||
else
|
||||
::glColor3fv(DEFAULT_BG_LIGHT_COLOR);
|
||||
::glColor3fv(background_color);
|
||||
|
||||
::glVertex2f(1.0f, 1.0f);
|
||||
::glVertex2f(-1.0f, 1.0f);
|
||||
|
@ -6668,13 +6693,35 @@ void GLCanvas3D::_render_overlays()
|
|||
m_gizmos.set_overlay_icon_size(gizmo_size);
|
||||
#endif // ENABLE_RETINA_GL
|
||||
|
||||
_render_separator_toolbar_right();
|
||||
_render_separator_toolbar_left();
|
||||
_render_main_toolbar();
|
||||
static bool last_dark_mode_tatus = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
bool dark_mode_status = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
if (dark_mode_status != last_dark_mode_tatus) {
|
||||
last_dark_mode_tatus = dark_mode_status;
|
||||
// reset svg
|
||||
_init_toolbars();
|
||||
m_gizmos.init();
|
||||
// re-generate icon texture
|
||||
m_separator_toolbar.set_icon_dirty();
|
||||
_render_separator_toolbar_right();
|
||||
m_separator_toolbar.set_icon_dirty();
|
||||
_render_separator_toolbar_left();
|
||||
m_main_toolbar.set_icon_dirty();
|
||||
_render_main_toolbar();
|
||||
wxGetApp().plater()->get_collapse_toolbar().set_icon_dirty();
|
||||
_render_collapse_toolbar();
|
||||
m_assemble_view_toolbar.set_icon_dirty();
|
||||
_render_assemble_view_toolbar();
|
||||
m_gizmos.set_icon_dirty();
|
||||
}
|
||||
else {
|
||||
_render_separator_toolbar_right();
|
||||
_render_separator_toolbar_left();
|
||||
_render_main_toolbar();
|
||||
_render_collapse_toolbar();
|
||||
_render_assemble_view_toolbar();
|
||||
}
|
||||
//BBS: GUI refactor: GLToolbar
|
||||
_render_imgui_select_plate_toolbar();
|
||||
_render_collapse_toolbar();
|
||||
_render_assemble_view_toolbar();
|
||||
_render_return_toolbar();
|
||||
// BBS
|
||||
//_render_view_toolbar();
|
||||
|
|
|
@ -200,7 +200,9 @@ class GLCanvas3D
|
|||
|
||||
|
||||
static float DEFAULT_BG_LIGHT_COLOR[3];
|
||||
static float DEFAULT_BG_LIGHT_COLOR_DARK[3];
|
||||
static float ERROR_BG_LIGHT_COLOR[3];
|
||||
static float ERROR_BG_LIGHT_COLOR_DARK[3];
|
||||
|
||||
static void update_render_colors();
|
||||
static void load_render_colors();
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "nanosvg/nanosvgrast.h"
|
||||
|
||||
#include "libslic3r/Utils.hpp"
|
||||
|
||||
#include "GUI_App.hpp"
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
|
@ -244,6 +244,8 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri
|
|||
if (filenames.empty() || states.empty() || sprite_size_px == 0)
|
||||
return false;
|
||||
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
|
||||
// every tile needs to have a 1px border around it to avoid artifacts when linear sampling on its edges
|
||||
unsigned int sprite_size_px_ex = sprite_size_px + 1;
|
||||
|
||||
|
@ -262,14 +264,23 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri
|
|||
|
||||
std::vector<unsigned char> data(n_pixels * 4, 0);
|
||||
std::vector<unsigned char> sprite_data(sprite_bytes, 0);
|
||||
std::vector<unsigned char> sprite_white_only_data(sprite_bytes, 0);
|
||||
std::vector<unsigned char> sprite_gray_only_data(sprite_bytes, 0);
|
||||
std::vector<unsigned char> sprite_white_only_data(sprite_bytes, 0); // normal
|
||||
std::vector<unsigned char> sprite_gray_only_data(sprite_bytes, 0); // disable
|
||||
std::vector<unsigned char> output_data(sprite_bytes, 0);
|
||||
|
||||
//BBS
|
||||
std::vector<unsigned char> pressed_data(sprite_bytes, 0);
|
||||
std::vector<unsigned char> pressed_data(sprite_bytes, 0); // (gizmo) pressed
|
||||
std::vector<unsigned char> disable_data(sprite_bytes, 0);
|
||||
std::vector<unsigned char> hover_data(sprite_bytes, 0);
|
||||
std::vector<unsigned char> hover_data(sprite_bytes, 0); // hover
|
||||
|
||||
const unsigned char pressed_color[3] = {255, 255, 255};
|
||||
const unsigned char hover_color[3] = {255, 255, 255};
|
||||
const unsigned char normal_color[3] = {43, 52, 54};
|
||||
const unsigned char disable_color[3] = {200, 200, 200};
|
||||
const unsigned char pressed_color_dark[3] = {60, 60, 65};
|
||||
const unsigned char hover_color_dark[3] = {60, 60, 65};
|
||||
const unsigned char normal_color_dark[3] = {182, 182, 182};
|
||||
const unsigned char disable_color_dark[3] = {76, 76, 85};
|
||||
|
||||
NSVGrasterizer* rast = nsvgCreateRasterizer();
|
||||
if (rast == nullptr) {
|
||||
|
@ -299,12 +310,13 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri
|
|||
::memcpy((void*)pressed_data.data(), (const void*)sprite_data.data(), sprite_bytes);
|
||||
for (int i = 0; i < sprite_n_pixels; ++i) {
|
||||
int offset = i * 4;
|
||||
if (pressed_data.data()[offset + 0] == 0 &&
|
||||
if (pressed_data.data()[offset + 0] == 0 &&
|
||||
pressed_data.data()[offset + 1] == 0 &&
|
||||
pressed_data.data()[offset + 2] == 0) {
|
||||
::memset((void*)&pressed_data.data()[offset], 238, 3);
|
||||
pressed_data.data()[offset + 3] = (unsigned char) 225;
|
||||
}
|
||||
hover_data.data()[offset + 0] = dark_mode ? pressed_color_dark[0] : pressed_color[0];
|
||||
hover_data.data()[offset + 0] = dark_mode ? pressed_color_dark[1] : pressed_color[1];
|
||||
hover_data.data()[offset + 0] = dark_mode ? pressed_color_dark[2] : pressed_color[2];
|
||||
}
|
||||
}
|
||||
|
||||
::memcpy((void*)disable_data.data(), (const void*)sprite_data.data(), sprite_bytes);
|
||||
|
@ -319,23 +331,23 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri
|
|||
int offset = i * 4;
|
||||
if (hover_data.data()[offset + 0] == 0 &&
|
||||
hover_data.data()[offset + 1] == 0 &&
|
||||
hover_data.data()[offset + 2] == 0)
|
||||
hover_data.data()[offset + 2] == 0)
|
||||
{
|
||||
::memset((void *) &hover_data.data()[offset], 238, 3);
|
||||
hover_data.data()[offset + 3] = (unsigned char) 75;
|
||||
hover_data.data()[offset + 0] = dark_mode ? hover_color_dark[0] : hover_color[0];
|
||||
hover_data.data()[offset + 1] = dark_mode ? hover_color_dark[1] : hover_color[1];
|
||||
hover_data.data()[offset + 2] = dark_mode ? hover_color_dark[2] : hover_color[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
::memcpy((void*)sprite_white_only_data.data(), (const void*)sprite_data.data(), sprite_bytes);
|
||||
for (int i = 0; i < sprite_n_pixels; ++i) {
|
||||
int offset = i * 4;
|
||||
if (sprite_white_only_data.data()[offset + 0] != 0 ||
|
||||
sprite_white_only_data.data()[offset + 1] != 0 ||
|
||||
sprite_white_only_data.data()[offset + 2] != 0){
|
||||
sprite_white_only_data.data()[offset + 0] = (unsigned char) 43;
|
||||
sprite_white_only_data.data()[offset + 1] = (unsigned char) 52;
|
||||
sprite_white_only_data.data()[offset + 2] = (unsigned char) 54;
|
||||
sprite_white_only_data.data()[offset + 1] != 0 ||
|
||||
sprite_white_only_data.data()[offset + 2] != 0) {
|
||||
sprite_white_only_data.data()[offset + 0] = dark_mode ? normal_color_dark[0] : normal_color[0];
|
||||
sprite_white_only_data.data()[offset + 1] = dark_mode ? normal_color_dark[1] : normal_color[1];
|
||||
sprite_white_only_data.data()[offset + 2] = dark_mode ? normal_color_dark[2] : normal_color[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,9 +355,11 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri
|
|||
for (int i = 0; i < sprite_n_pixels; ++i) {
|
||||
int offset = i * 4;
|
||||
if (sprite_gray_only_data.data()[offset + 0] != 0 ||
|
||||
sprite_gray_only_data.data()[offset + 1] != 0 ||
|
||||
sprite_gray_only_data.data()[offset + 2] != 0 ) {
|
||||
::memset((void*)&sprite_gray_only_data.data()[offset], 200, 3);
|
||||
sprite_gray_only_data.data()[offset + 1] != 0 ||
|
||||
sprite_gray_only_data.data()[offset + 2] != 0) {
|
||||
sprite_gray_only_data.data()[offset + 0] = dark_mode ? disable_color_dark[0] : disable_color[0];
|
||||
sprite_gray_only_data.data()[offset + 1] = dark_mode ? disable_color_dark[1] : disable_color[1];
|
||||
sprite_gray_only_data.data()[offset + 2] = dark_mode ? disable_color_dark[2] : disable_color[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -268,9 +268,6 @@ GLToolbar::~GLToolbar()
|
|||
|
||||
bool GLToolbar::init(const BackgroundTexture::Metadata& background_texture)
|
||||
{
|
||||
if (m_background_texture.texture.get_id() != 0)
|
||||
return true;
|
||||
|
||||
std::string path = resources_dir() + "/images/";
|
||||
bool res = false;
|
||||
|
||||
|
|
|
@ -356,6 +356,7 @@ public:
|
|||
|
||||
Layout::EType get_layout_type() const;
|
||||
void set_layout_type(Layout::EType type);
|
||||
void set_icon_dirty() { m_icons_texture_dirty = true; }
|
||||
Layout::EHorizontalOrientation get_horizontal_orientation() const { return m_layout.horizontal_orientation; }
|
||||
void set_horizontal_orientation(Layout::EHorizontalOrientation orientation) { m_layout.horizontal_orientation = orientation; }
|
||||
Layout::EVerticalOrientation get_vertical_orientation() const { return m_layout.vertical_orientation; }
|
||||
|
|
|
@ -246,6 +246,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
|
|||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(m_desc.at("tool_type"));
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
std::array<wchar_t, 4> tool_icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon, ImGui::FillButtonIcon, ImGui::GapFillIcon };
|
||||
std::array<wxString, 4> tool_tips = { _L("Circle"), _L("Sphere"), _L("Fill"), _L("Gap Fill") };
|
||||
for (int i = 0; i < tool_icons.size(); i++) {
|
||||
|
@ -256,9 +257,9 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
|
|||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
|
||||
if (m_current_tool == tool_icons[i]) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.00f, 0.68f, 0.26f, 1.00f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
|
||||
|
@ -284,7 +285,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
|
|||
}
|
||||
}
|
||||
|
||||
m_imgui->checkbox(m_desc["on_overhangs_only"], m_paint_on_overhangs_only);
|
||||
m_imgui->bbl_checkbox(m_desc["on_overhangs_only"], m_paint_on_overhangs_only);
|
||||
if (ImGui::IsItemHovered())
|
||||
m_imgui->tooltip(format_wxstr(_L("Allows painting only on facets selected by: \"%1%\""), m_desc["highlight_by_angle"]), max_tooltip_width);
|
||||
ImGui::Separator();
|
||||
|
|
|
@ -464,6 +464,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||
|
||||
m_imgui->text(m_desc.at("tool_type"));
|
||||
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
std::array<wchar_t, 6> tool_icons = { ImGui::CircleButtonIcon,ImGui::SphereButtonIcon, ImGui::TriangleButtonIcon, ImGui::HeightRangeIcon, ImGui::FillButtonIcon, ImGui::GapFillIcon };
|
||||
std::array<wxString, 6> tool_tips = { _L("Circle"), _L("Sphere"), _L("Triangle"), _L("Height Range"), _L("Fill"), _L("Gap Fill") };
|
||||
for (int i = 0; i < tool_icons.size(); i++) {
|
||||
|
@ -473,9 +474,9 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||
if (i != 0) ImGui::SameLine((empty_button_width + m_imgui->scaled(1.75f)) * i + m_imgui->scaled(1.5f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
|
||||
if (m_current_tool == tool_icons[i]) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.00f, 0.68f, 0.26f, 1.00f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
|
||||
|
|
|
@ -207,6 +207,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(m_desc.at("cursor_type"));
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
std::array<wchar_t, 2> tool_icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon};
|
||||
std::array<wxString, 2> tool_tips = { _L("Circle"), _L("Sphere")};
|
||||
for (int i = 0; i < tool_icons.size(); i++) {
|
||||
|
@ -216,9 +217,9 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||
if (i != 0) ImGui::SameLine((empty_button_width + m_imgui->scaled(1.75f)) * i + m_imgui->scaled(1.3f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
|
||||
if (m_current_tool == tool_icons[i]) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f)); // r, g, b, a
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, dark_mode ? ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f) : ImVec4(0.86f, 0.99f, 0.91f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.00f, 0.68f, 0.26f, 1.00f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0);
|
||||
|
|
|
@ -236,7 +236,7 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
|
|||
ImGuiWindowFlags_NoCollapse;
|
||||
m_imgui->begin(on_get_name(), flag);
|
||||
|
||||
m_imgui->text_colored(ImVec4(0.15f, 0.18f, 0.19f, 1.00f), tr_mesh_name + ":");
|
||||
m_imgui->text(tr_mesh_name + ":");
|
||||
// BBS: somehow the calculated utf8 width is too narrow, have to add 35 here
|
||||
ImGui::SameLine(text_left_width + space_size);
|
||||
std::string name = m_volume->name;
|
||||
|
@ -244,7 +244,7 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
|
|||
name = name.substr(0, m_gui_cfg->max_char_in_name - 3) + "...";
|
||||
m_imgui->text_colored(ImVec4(0.42f, 0.42f, 0.42f, 1.00f), name);
|
||||
|
||||
m_imgui->text_colored(ImVec4(0.15f, 0.18f, 0.19f, 1.00f), tr_triangles + ":");
|
||||
m_imgui->text(tr_triangles + ":");
|
||||
ImGui::SameLine(text_left_width + space_size);
|
||||
|
||||
size_t orig_triangle_count = m_volume->mesh().its.indices.size();
|
||||
|
@ -361,22 +361,26 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
|
|||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.15f, 0.18f, 0.19f, 1.00f));
|
||||
|
||||
m_imgui->disabled_begin(is_worker_running || ! is_result_ready);
|
||||
m_imgui->push_confirm_button_style();
|
||||
if (m_imgui->bbl_button(_L("Apply"))) {
|
||||
apply_simplify();
|
||||
}
|
||||
else if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && is_worker_running) {
|
||||
ImGui::SetTooltip("%s", _u8L("Can't apply when proccess preview.").c_str());
|
||||
}
|
||||
m_imgui->pop_confirm_button_style();
|
||||
m_imgui->disabled_end(); // state !settings
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
m_imgui->disabled_begin(is_cancelling);
|
||||
m_imgui->push_cancel_button_style();
|
||||
if (m_imgui->bbl_button(_L("Cancel"))) {
|
||||
close();
|
||||
}
|
||||
else if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && is_cancelling)
|
||||
ImGui::SetTooltip("%s", _u8L("Operation already cancelling. Please wait few seconds.").c_str());
|
||||
m_imgui->pop_cancel_button_style();
|
||||
m_imgui->disabled_end(); // state cancelling
|
||||
|
||||
ImGui::PopStyleVar(3);
|
||||
|
|
|
@ -68,17 +68,65 @@ void GLGizmoText::on_render_for_picking()
|
|||
// TODO:
|
||||
}
|
||||
|
||||
void GLGizmoText::push_combo_style(const float scale)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BG);
|
||||
ImGui::PushStyleColor(ImGuiCol_BorderActive, ImVec4(0.00f, 0.68f, 0.26f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.00f, 0.68f, 0.26f, 0.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarBg, ImGuiWrapper::COL_WINDOW_BG);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, { 1.00f, 1.00f, 1.00f, 0.0f });
|
||||
void GLGizmoText::push_button_style(bool pressed) {
|
||||
if (wxGetApp().app_config->get("dark_color_mode") == "1") {
|
||||
if (pressed) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(43 / 255.f, 64 / 255.f, 54 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(43 / 255.f, 64 / 255.f, 54 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(43 / 255.f, 64 / 255.f, 54 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f, 174 / 255.f, 66 / 255.f, 1.f));
|
||||
}
|
||||
else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(45.f / 255.f, 45.f / 255.f, 49.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(84 / 255.f, 84 / 255.f, 90 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(84 / 255.f, 84 / 255.f, 90 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(45.f / 255.f, 45.f / 255.f, 49.f / 255.f, 1.f));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (pressed) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(219 / 255.f, 253 / 255.f, 231 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(219 / 255.f, 253 / 255.f, 231 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(219 / 255.f, 253 / 255.f, 231 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f, 174 / 255.f, 66 / 255.f, 1.f));
|
||||
}
|
||||
else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.f, 1.f, 1.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(238 / 255.f, 238 / 255.f, 238 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(238 / 255.f, 238 / 255.f, 238 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(1.f, 1.f, 1.f, 1.f));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void GLGizmoText::pop_button_style() {
|
||||
ImGui::PopStyleColor(4);
|
||||
}
|
||||
|
||||
void GLGizmoText::push_combo_style(const float scale) {
|
||||
if (wxGetApp().app_config->get("dark_color_mode") == "1") {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BG_DARK);
|
||||
ImGui::PushStyleColor(ImGuiCol_BorderActive, ImVec4(0.00f, 0.68f, 0.26f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.00f, 0.68f, 0.26f, 0.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarBg, ImGuiWrapper::COL_WINDOW_BG_DARK);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, { 1.00f, 1.00f, 1.00f, 0.0f });
|
||||
}
|
||||
else {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BG);
|
||||
ImGui::PushStyleColor(ImGuiCol_BorderActive, ImVec4(0.00f, 0.68f, 0.26f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.00f, 0.68f, 0.26f, 0.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarBg, ImGuiWrapper::COL_WINDOW_BG);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, { 1.00f, 1.00f, 1.00f, 0.0f });
|
||||
}
|
||||
}
|
||||
|
||||
void GLGizmoText::pop_combo_style()
|
||||
|
@ -116,12 +164,9 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
float input_size = input_text_size - button_size * 2 - ImGui::GetStyle().ItemSpacing.x * 4;
|
||||
|
||||
ImTextureID normal_B = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TEXT_B);
|
||||
ImTextureID press_B_hover = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TEXT_B_HOVER);
|
||||
ImTextureID press_B_press = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TEXT_B_PRESS);
|
||||
|
||||
ImTextureID normal_T = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TEXT_T);
|
||||
ImTextureID press_T_hover = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TEXT_T_HOVER);
|
||||
ImTextureID press_T_press = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TEXT_T_PRESS);
|
||||
ImTextureID normal_B_dark = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TEXT_B_DARK);
|
||||
ImTextureID normal_T_dark = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TEXT_T_DARK);
|
||||
|
||||
// adjust window position to avoid overlap the view toolbar
|
||||
if (last_h != win_h || last_y != y) {
|
||||
|
@ -174,12 +219,20 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
if (m_font_size < 3.0f)m_font_size = 3.0f;
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {0.0,0.0});
|
||||
ImGui::BBLImageButton(normal_B,press_B_hover,press_B_press,{button_size,button_size},m_bold);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * currt_scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {1.0f * currt_scale, 1.0f * currt_scale });
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0f * currt_scale);
|
||||
push_button_style(m_bold);
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
if (ImGui::ImageButton(dark_mode ? normal_B_dark : normal_B, { button_size - 2 * ImGui::GetStyle().FramePadding.x, button_size - 2 * ImGui::GetStyle().FramePadding.y }))
|
||||
m_bold = !m_bold;
|
||||
pop_button_style();
|
||||
ImGui::SameLine();
|
||||
ImGui::BBLImageButton(normal_T,press_T_hover,press_T_press,{button_size,button_size},m_italic);
|
||||
ImGui::PopStyleVar(2);
|
||||
push_button_style(m_italic);
|
||||
if (ImGui::ImageButton(dark_mode ? normal_T_dark : normal_T, { button_size - 2 * ImGui::GetStyle().FramePadding.x, button_size - 2 * ImGui::GetStyle().FramePadding.y }))
|
||||
m_italic = !m_italic;
|
||||
pop_button_style();
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(_L("Thickness"));
|
||||
|
|
|
@ -34,6 +34,8 @@ protected:
|
|||
virtual void on_render_for_picking() override;
|
||||
void push_combo_style(const float scale);
|
||||
void pop_combo_style();
|
||||
void push_button_style(bool pressed);
|
||||
void pop_button_style();
|
||||
virtual void on_set_state() override;
|
||||
virtual CommonGizmosDataID on_get_requirements() const override;
|
||||
virtual void on_render_input_window(float x, float y, float bottom_limit);
|
||||
|
|
|
@ -125,7 +125,8 @@ bool GLGizmosManager::init()
|
|||
bool result = init_icon_textures();
|
||||
if (!result) return result;
|
||||
|
||||
m_background_texture.metadata.filename = "toolbar_background.png";
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
m_background_texture.metadata.filename = dark_mode ? "toolbar_background_dark.png" : "toolbar_background.png";
|
||||
m_background_texture.metadata.left = 16;
|
||||
m_background_texture.metadata.top = 16;
|
||||
m_background_texture.metadata.right = 16;
|
||||
|
@ -139,16 +140,17 @@ bool GLGizmosManager::init()
|
|||
|
||||
// Order of gizmos in the vector must match order in EType!
|
||||
//BBS: GUI refactor: add obj manipulation
|
||||
m_gizmos.clear();
|
||||
unsigned int sprite_id = 0;
|
||||
m_gizmos.emplace_back(new GLGizmoMove3D(m_parent, "toolbar_move.svg", EType::Move, &m_object_manipulation));
|
||||
m_gizmos.emplace_back(new GLGizmoRotate3D(m_parent, "toolbar_rotate.svg", EType::Rotate, &m_object_manipulation));
|
||||
m_gizmos.emplace_back(new GLGizmoScale3D(m_parent, "toolbar_scale.svg", EType::Scale, &m_object_manipulation));
|
||||
m_gizmos.emplace_back(new GLGizmoFlatten(m_parent, "toolbar_flatten.svg", EType::Flatten));
|
||||
m_gizmos.emplace_back(new GLGizmoAdvancedCut(m_parent, "toolbar_cut.svg", EType::Cut));
|
||||
m_gizmos.emplace_back(new GLGizmoFdmSupports(m_parent, "toolbar_support.svg", EType::FdmSupports));
|
||||
m_gizmos.emplace_back(new GLGizmoSeam(m_parent, "toolbar_seam.svg", EType::Seam));
|
||||
m_gizmos.emplace_back(new GLGizmoText(m_parent, "toolbar_text.svg", EType::Text));
|
||||
m_gizmos.emplace_back(new GLGizmoMmuSegmentation(m_parent, "mmu_segmentation.svg", EType::MmuSegmentation));
|
||||
m_gizmos.emplace_back(new GLGizmoMove3D(m_parent, dark_mode ? "toolbar_move_dark.svg" : "toolbar_move.svg", EType::Move, &m_object_manipulation));
|
||||
m_gizmos.emplace_back(new GLGizmoRotate3D(m_parent, dark_mode ? "toolbar_rotate_dark.svg" : "toolbar_rotate.svg", EType::Rotate, &m_object_manipulation));
|
||||
m_gizmos.emplace_back(new GLGizmoScale3D(m_parent, dark_mode ? "toolbar_scale_dark.svg" : "toolbar_scale.svg", EType::Scale, &m_object_manipulation));
|
||||
m_gizmos.emplace_back(new GLGizmoFlatten(m_parent, dark_mode ? "toolbar_flatten_dark.svg" : "toolbar_flatten.svg", EType::Flatten));
|
||||
m_gizmos.emplace_back(new GLGizmoAdvancedCut(m_parent, dark_mode ? "toolbar_cut_dark.svg" : "toolbar_cut.svg", EType::Cut));
|
||||
m_gizmos.emplace_back(new GLGizmoFdmSupports(m_parent, dark_mode ? "toolbar_support_dark.svg" : "toolbar_support.svg", EType::FdmSupports));
|
||||
m_gizmos.emplace_back(new GLGizmoSeam(m_parent, dark_mode ? "toolbar_seam_dark.svg" : "toolbar_seam.svg", EType::Seam));
|
||||
m_gizmos.emplace_back(new GLGizmoText(m_parent, dark_mode ? "toolbar_text_dark.svg" : "toolbar_text.svg", EType::Text));
|
||||
m_gizmos.emplace_back(new GLGizmoMmuSegmentation(m_parent, dark_mode ? "mmu_segmentation_dark.svg" : "mmu_segmentation.svg", EType::MmuSegmentation));
|
||||
m_gizmos.emplace_back(new GLGizmoSimplify(m_parent, "reduce_triangles.svg", EType::Simplify));
|
||||
//m_gizmos.emplace_back(new GLGizmoSlaSupports(m_parent, "sla_supports.svg", sprite_id++));
|
||||
//m_gizmos.emplace_back(new GLGizmoFaceDetector(m_parent, "face recognition.svg", sprite_id++));
|
||||
|
@ -203,30 +205,20 @@ bool GLGizmosManager::init_icon_textures()
|
|||
else
|
||||
return false;
|
||||
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/text_B_hover.svg", 20, 20, texture_id))
|
||||
icon_list.insert(std::make_pair((int)IC_TEXT_B_HOVER, texture_id));
|
||||
else
|
||||
return false;
|
||||
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/text_B_press.svg", 20, 20, texture_id))
|
||||
icon_list.insert(std::make_pair((int)IC_TEXT_B_PRESS, texture_id));
|
||||
else
|
||||
return false;
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/text_B_dark.svg", 20, 20, texture_id))
|
||||
icon_list.insert(std::make_pair((int)IC_TEXT_B_DARK, texture_id));
|
||||
else
|
||||
return false;
|
||||
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/text_T.svg", 20, 20, texture_id))
|
||||
icon_list.insert(std::make_pair((int)IC_TEXT_T, texture_id));
|
||||
else
|
||||
return false;
|
||||
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/text_T_hover.svg", 20, 20, texture_id))
|
||||
icon_list.insert(std::make_pair((int)IC_TEXT_T_HOVER, texture_id));
|
||||
else
|
||||
return false;
|
||||
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/text_T_press.svg", 20, 20, texture_id))
|
||||
icon_list.insert(std::make_pair((int)IC_TEXT_T_PRESS, texture_id));
|
||||
else
|
||||
return false;
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/text_T_dark.svg", 20, 20, texture_id))
|
||||
icon_list.insert(std::make_pair((int)IC_TEXT_T_DARK, texture_id));
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -653,7 +645,7 @@ void GLGizmosManager::render_current_gizmo_for_picking_pass() const
|
|||
m_gizmos[m_current]->render_for_picking();
|
||||
}
|
||||
|
||||
void GLGizmosManager::render_overlay() const
|
||||
void GLGizmosManager::render_overlay()
|
||||
{
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
|
|
@ -153,11 +153,9 @@ public:
|
|||
IC_TOOLBAR_TOOLTIP,
|
||||
IC_TOOLBAR_TOOLTIP_HOVER,
|
||||
IC_TEXT_B,
|
||||
IC_TEXT_B_HOVER,
|
||||
IC_TEXT_B_PRESS,
|
||||
IC_TEXT_B_DARK,
|
||||
IC_TEXT_T,
|
||||
IC_TEXT_T_HOVER,
|
||||
IC_TEXT_T_PRESS,
|
||||
IC_TEXT_T_DARK,
|
||||
IC_NAME_COUNT,
|
||||
};
|
||||
|
||||
|
@ -209,6 +207,7 @@ public:
|
|||
bool is_enabled() const { return m_enabled; }
|
||||
void set_enabled(bool enable) { m_enabled = enable; }
|
||||
|
||||
void set_icon_dirty() { m_icons_texture_dirty = true; }
|
||||
void set_overlay_icon_size(float size);
|
||||
void set_overlay_scale(float scale);
|
||||
|
||||
|
@ -284,7 +283,7 @@ public:
|
|||
void render_painter_gizmo() const;
|
||||
void render_painter_assemble_view() const;
|
||||
|
||||
void render_overlay() const;
|
||||
void render_overlay();
|
||||
|
||||
void render_arrow(const GLCanvas3D& parent, EType highlighted_type) const;
|
||||
|
||||
|
|
|
@ -929,17 +929,17 @@ void NotificationManager::HintNotification::render_close_button(ImGuiWrapper& im
|
|||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
|
||||
|
||||
|
||||
std::string button_text;
|
||||
button_text = ImGui::CloseNotifButton;
|
||||
std::wstring button_text;
|
||||
button_text = m_is_dark_mode ? ImGui::CloseNotifDarkButton : ImGui::CloseNotifButton;
|
||||
|
||||
ImVec2 button_pic_size = ImGui::CalcTextSize(button_text.c_str());
|
||||
ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
|
||||
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
|
||||
m_close_b_w = button_size.y;
|
||||
if (ImGui::IsMouseHoveringRect(ImVec2(win_pos.x - win_size.x / 10.f, win_pos.y + win_size.y / 2 - button_pic_size.y),
|
||||
ImVec2(win_pos.x, win_pos.y + win_size.y / 2 + button_pic_size.y),
|
||||
true))
|
||||
{
|
||||
button_text = ImGui::CloseNotifHoverButton;
|
||||
button_text = m_is_dark_mode ? ImGui::CloseNotifHoverDarkButton : ImGui::CloseNotifHoverButton;
|
||||
if (ImGui::IsMouseClicked(ImGuiMouseButton_Left))
|
||||
close();
|
||||
}
|
||||
|
@ -973,13 +973,13 @@ void NotificationManager::HintNotification::render_preferences_button(ImGuiWrapp
|
|||
push_style_color(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
|
||||
push_style_color(ImGuiCol_TextSelectedBg, ImVec4(0, .75f, .75f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
|
||||
|
||||
std::string button_text;
|
||||
button_text = ImGui::PreferencesButton;
|
||||
std::wstring button_text;
|
||||
button_text = m_is_dark_mode ? ImGui::PreferencesDarkButton : ImGui::PreferencesButton;
|
||||
//hover
|
||||
if (ImGui::IsMouseHoveringRect(ImVec2(win_pos_x - m_window_width / 15.f, win_pos_y + m_window_height - 1.5f * m_line_height),
|
||||
ImVec2(win_pos_x, win_pos_y + m_window_height),
|
||||
true)) {
|
||||
button_text = ImGui::PreferencesHoverButton;
|
||||
button_text = m_is_dark_mode ? ImGui::PreferencesHoverDarkButton : ImGui::PreferencesHoverButton;
|
||||
// tooltip
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BACKGROUND);
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, { 0,0,0,0 });
|
||||
|
@ -991,7 +991,7 @@ void NotificationManager::HintNotification::render_preferences_button(ImGuiWrapp
|
|||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
ImVec2 button_pic_size = ImGui::CalcTextSize(button_text.c_str());
|
||||
ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
|
||||
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
|
||||
ImGui::SetCursorPosX(m_window_width - m_line_height * 1.75f);
|
||||
ImGui::SetCursorPosY(m_window_height - button_size.y - m_close_b_w / 4.f);
|
||||
|
@ -1016,16 +1016,16 @@ void NotificationManager::HintNotification::render_right_arrow_button(ImGuiWrapp
|
|||
push_style_color(ImGuiCol_TextSelectedBg, ImVec4(0, .75f, .75f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
|
||||
|
||||
std::string button_text;
|
||||
button_text = ImGui::RightArrowButton;
|
||||
std::wstring button_text;
|
||||
button_text = m_is_dark_mode ? ImGui::RightArrowDarkButton : ImGui::RightArrowButton;
|
||||
|
||||
ImVec2 button_pic_size = ImGui::CalcTextSize(button_text.c_str());
|
||||
ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
|
||||
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
|
||||
if (ImGui::IsMouseHoveringRect(ImVec2(win_pos_x - m_window_width / 7.5f, win_pos_y + m_window_height - 1.5f * m_line_height),
|
||||
ImVec2(win_pos_x - m_window_width / 15.f, win_pos_y + m_window_height),
|
||||
true))
|
||||
{
|
||||
button_text = ImGui::RightArrowHoverButton;
|
||||
button_text = m_is_dark_mode ? ImGui::RightArrowHoverDarkButton : ImGui::RightArrowHoverButton;
|
||||
// tooltip
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BACKGROUND);
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, { 0,0,0,0 });
|
||||
|
@ -1068,7 +1068,7 @@ void NotificationManager::HintNotification::render_documentation_button(ImGuiWra
|
|||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
|
||||
|
||||
std::wstring button_text;
|
||||
button_text = ImGui::DocumentationButton;
|
||||
button_text = m_is_dark_mode ? ImGui::DocumentationDarkButton : ImGui::DocumentationButton;
|
||||
std::string placeholder_text;
|
||||
placeholder_text = ImGui::EjectButton;
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ void NotificationManager::HintNotification::render_documentation_button(ImGuiWra
|
|||
ImVec2(win_pos.x - m_line_height * 2.5f, win_pos.y + win_size.y / 2 + button_pic_size.y),
|
||||
true))
|
||||
{
|
||||
button_text = ImGui::DocumentationHoverButton;
|
||||
button_text = m_is_dark_mode ? ImGui::DocumentationHoverDarkButton : ImGui::DocumentationHoverButton;
|
||||
// tooltip
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BACKGROUND);
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, { 0,0,0,0 });
|
||||
|
|
|
@ -453,13 +453,14 @@ bool IMSlider::init_texture()
|
|||
bool result = true;
|
||||
if (!is_horizontal()) {
|
||||
// BBS init image texture id
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/reset_normal.svg", 20, 20, m_reset_normal_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/reset_hover.svg", 20, 20, m_reset_hover_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/one_layer_on.svg", 24, 24, m_one_layer_on_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/one_layer_on_hover.svg", 28, 28, m_one_layer_on_hover_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/one_layer_off.svg", 28, 28, m_one_layer_off_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/one_layer_off_hover.svg", 28, 28, m_one_layer_off_hover_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/one_layer_arrow.svg", 28, 28, m_one_layer_arrow_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/one_layer_on_dark.svg", 24, 24, m_one_layer_on_dark_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/one_layer_on_hover_dark.svg", 28, 28, m_one_layer_on_hover_dark_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/one_layer_off_dark.svg", 28, 28, m_one_layer_off_dark_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/one_layer_off_hover_dark.svg", 28, 28, m_one_layer_off_hover_dark_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/im_gcode_pause.svg", 14, 14, m_pause_icon_id);
|
||||
result &= IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/im_slider_delete.svg", 14, 14, m_delete_icon_id);
|
||||
}
|
||||
|
@ -723,8 +724,8 @@ bool IMSlider::switch_one_layer_mode()
|
|||
}
|
||||
|
||||
void IMSlider::draw_background(const ImRect& groove) {
|
||||
const ImU32 bg_rect_col = IM_COL32(255, 255, 255, 255);
|
||||
const ImU32 groove_col = IM_COL32(206, 206, 206, 255);
|
||||
const ImU32 bg_rect_col = wxGetApp().app_config->get("dark_color_mode") == "1" ? IM_COL32(65, 65, 71, 255) : IM_COL32(255, 255, 255, 255);
|
||||
const ImU32 groove_col = wxGetApp().app_config->get("dark_color_mode") == "1" ? IM_COL32(45, 45, 49, 255) : IM_COL32(206, 206, 206, 255);
|
||||
|
||||
if (is_horizontal() || m_ticks.empty()) {
|
||||
ImVec2 groove_padding = ImVec2(2.0f, 2.0f) * m_scale;
|
||||
|
@ -773,9 +774,9 @@ bool IMSlider::horizontal_slider(const char* str_id, int* value, int v_min, int
|
|||
float triangle_offsets[3] = {-3.5f * m_scale, 3.5f * m_scale, -6.06f * m_scale};
|
||||
|
||||
|
||||
const ImU32 white_bg = IM_COL32(255, 255, 255, 255);
|
||||
const ImU32 white_bg = wxGetApp().app_config->get("dark_color_mode") == "1" ? IM_COL32(65, 65, 71, 255) : IM_COL32(255, 255, 255, 255);
|
||||
const ImU32 handle_clr = IM_COL32(0, 174, 66, 255);
|
||||
const ImU32 handle_border_clr = IM_COL32(248, 248, 248, 255);
|
||||
const ImU32 handle_border_clr = wxGetApp().app_config->get("dark_color_mode") == "1" ? IM_COL32(65, 65, 71, 255) : IM_COL32(248, 248, 248, 255);
|
||||
|
||||
// calc groove size
|
||||
ImVec2 groove_start = ImVec2(pos.x + handle_dummy_width, pos.y + size.y - groove_y - bottom_dummy);
|
||||
|
@ -836,7 +837,7 @@ void IMSlider::draw_colored_band(const ImRect& groove, const ImRect& slideable_r
|
|||
if (m_ticks.empty())
|
||||
return;
|
||||
|
||||
const ImU32 blank_col = IM_COL32(255, 255, 255, 255);
|
||||
const ImU32 blank_col = wxGetApp().app_config->get("dark_color_mode") == "1" ? IM_COL32(65, 65, 71, 255) : IM_COL32(255, 255, 255, 255);
|
||||
|
||||
ImVec2 blank_padding = ImVec2(6.0f, 5.0f) * m_scale;
|
||||
float blank_width = 1.0f * m_scale;
|
||||
|
@ -909,8 +910,7 @@ void IMSlider::draw_ticks(const ImRect& slideable_region) {
|
|||
ImVec2 icon_size = ImVec2(14.0f, 14.0f) * m_scale;
|
||||
|
||||
const ImU32 tick_clr = IM_COL32(144, 144, 144, 255);
|
||||
const ImU32 tick_hover_box_clr = IM_COL32(219, 253, 231, 255);
|
||||
const ImU32 delete_btn_clr = IM_COL32(144, 144, 144, 255);
|
||||
const ImU32 tick_hover_box_clr = wxGetApp().app_config->get("dark_color_mode") == "1" ? IM_COL32(65, 65, 71, 255) : IM_COL32(219, 253, 231, 255);
|
||||
|
||||
auto get_tick_pos = [this, slideable_region](int tick)
|
||||
{
|
||||
|
@ -1011,10 +1011,9 @@ bool IMSlider::vertical_slider(const char* str_id, int* higher_value, int* lower
|
|||
ImVec2 text_content_size;
|
||||
ImVec2 text_size;
|
||||
|
||||
const ImU32 white_bg = IM_COL32(255, 255, 255, 255);
|
||||
const ImU32 white_bg = wxGetApp().app_config->get("dark_color_mode") == "1" ? IM_COL32(65, 65, 71, 255) : IM_COL32(255, 255, 255, 255);
|
||||
const ImU32 handle_clr = IM_COL32(0, 174, 66, 255);
|
||||
const ImU32 handle_border_clr = IM_COL32(248, 248, 248, 255);
|
||||
const ImU32 delete_btn_clr = IM_COL32(144, 144, 144, 255);
|
||||
const ImU32 handle_border_clr = wxGetApp().app_config->get("dark_color_mode") == "1" ? IM_COL32(65, 65, 71, 255) : IM_COL32(248, 248, 248, 255);
|
||||
|
||||
// calc slider groove size
|
||||
ImVec2 groove_start = ImVec2(pos.x + size.x - groove_x - right_dummy, pos.y + text_dummy_height);
|
||||
|
@ -1264,8 +1263,13 @@ bool IMSlider::render(int canvas_width, int canvas_height)
|
|||
|
||||
ImGui::Spacing();
|
||||
ImGui::SameLine((VERTICAL_SLIDER_SIZE.x - ONE_LAYER_OFFSET.x) * scale * m_scale);
|
||||
ImTextureID normal_id = is_one_layer() ? m_one_layer_on_id : m_one_layer_off_id;
|
||||
ImTextureID hover_id = is_one_layer() ? m_one_layer_on_hover_id : m_one_layer_off_hover_id;
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
ImTextureID normal_id = dark_mode ?
|
||||
is_one_layer() ? m_one_layer_on_dark_id : m_one_layer_off_dark_id :
|
||||
is_one_layer() ? m_one_layer_on_id : m_one_layer_off_id;
|
||||
ImTextureID hover_id = dark_mode ?
|
||||
is_one_layer() ? m_one_layer_on_hover_dark_id : m_one_layer_off_hover_dark_id :
|
||||
is_one_layer() ? m_one_layer_on_hover_id : m_one_layer_off_hover_id;
|
||||
if (ImGui::ImageButton3(normal_id, hover_id, ImVec2(28 * m_scale, 28 * m_scale))) {
|
||||
switch_one_layer_mode();
|
||||
}
|
||||
|
@ -1320,7 +1324,7 @@ void IMSlider::render_input_custom_gcode()
|
|||
ImGui::NewLine();
|
||||
ImGui::SameLine(ImGui::GetStyle().WindowPadding.x * 14);
|
||||
imgui.push_confirm_button_style();
|
||||
if (imgui.bbl_button(_L("OK"))) {
|
||||
if (imgui.bbl_button(_L("OK")) || ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Enter))) {
|
||||
m_show_custom_gcode_window = false;
|
||||
add_custom_gcode(m_custom_gcode);
|
||||
move_to_center = true;
|
||||
|
@ -1330,7 +1334,7 @@ void IMSlider::render_input_custom_gcode()
|
|||
|
||||
ImGui::SameLine();
|
||||
imgui.push_cancel_button_style();
|
||||
if (imgui.bbl_button(_L("Cancel"))) {
|
||||
if (imgui.bbl_button(_L("Cancel")) || ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape))) {
|
||||
m_show_custom_gcode_window = false;
|
||||
move_to_center = true;
|
||||
set_focus_when_appearing = true;
|
||||
|
|
|
@ -341,13 +341,14 @@ private:
|
|||
int m_selected_tick_value = -1;
|
||||
|
||||
/* BBS slider images */
|
||||
void *m_reset_normal_id;
|
||||
void *m_reset_hover_id;
|
||||
void *m_one_layer_on_id;
|
||||
void *m_one_layer_on_hover_id;
|
||||
void *m_one_layer_arrow_id;
|
||||
void *m_one_layer_off_id;
|
||||
void *m_one_layer_off_hover_id;
|
||||
void* m_one_layer_on_dark_id;
|
||||
void* m_one_layer_on_hover_dark_id;
|
||||
void* m_one_layer_off_dark_id;
|
||||
void* m_one_layer_off_hover_dark_id;
|
||||
void *m_pause_icon_id;
|
||||
void *m_delete_icon_id;
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "nanosvg/nanosvg.h"
|
||||
#include "nanosvg/nanosvgrast.h"
|
||||
#include "OpenGLManager.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
@ -66,6 +67,13 @@ static const std::map<const wchar_t, std::string> font_icons = {
|
|||
{ImGui::FoldButtonIcon , "im_fold" },
|
||||
{ImGui::UnfoldButtonIcon , "im_unfold" },
|
||||
{ImGui::SphereButtonIcon , "toolbar_modifier_sphere" },
|
||||
// dark mode icon
|
||||
{ImGui::MinimalizeDarkButton , "notification_minimalize_dark" },
|
||||
{ImGui::MinimalizeHoverDarkButton , "notification_minimalize_hover_dark" },
|
||||
{ImGui::RightArrowDarkButton , "notification_right_dark" },
|
||||
{ImGui::RightArrowHoverDarkButton , "notification_right_hover_dark" },
|
||||
{ImGui::PreferencesDarkButton , "notification_preferences_dark" },
|
||||
{ImGui::PreferencesHoverDarkButton , "notification_preferences_hover_dark"},
|
||||
|
||||
};
|
||||
static const std::map<const wchar_t, std::string> font_icons_large = {
|
||||
|
@ -87,6 +95,11 @@ static const std::map<const wchar_t, std::string> font_icons_large = {
|
|||
{ImGui::DocumentationButton , "notification_documentation" },
|
||||
{ImGui::DocumentationHoverButton, "notification_documentation_hover"},
|
||||
//{ImGui::InfoMarker , "notification_info" },
|
||||
// dark mode icon
|
||||
{ImGui::CloseNotifDarkButton , "notification_close_dark" },
|
||||
{ImGui::CloseNotifHoverDarkButton , "notification_close_hover_dark" },
|
||||
{ImGui::DocumentationDarkButton , "notification_documentation_dark" },
|
||||
{ImGui::DocumentationHoverDarkButton, "notification_documentation_hover_dark"},
|
||||
};
|
||||
|
||||
static const std::map<const wchar_t, std::string> font_icons_extra_large = {
|
||||
|
@ -109,9 +122,11 @@ const ImVec4 ImGuiWrapper::COL_BLUE_LIGHT = ImVec4(0.122f, 0.557f, 0.918f
|
|||
const ImVec4 ImGuiWrapper::COL_GREEN_LIGHT = ImVec4(0.86f, 0.99f, 0.91f, 1.0f);
|
||||
const ImVec4 ImGuiWrapper::COL_HOVER = { 0.933f, 0.933f, 0.933f, 1.0f };
|
||||
const ImVec4 ImGuiWrapper::COL_ACTIVE = { 0.675f, 0.675f, 0.675f, 1.0f };
|
||||
const ImVec4 ImGuiWrapper::COL_SEPARATOR = { 0.93f, 0.93f, 0.93f,1.0f };
|
||||
const ImVec4 ImGuiWrapper::COL_SEPARATOR = { 0.93f, 0.93f, 0.93f, 1.0f };
|
||||
const ImVec4 ImGuiWrapper::COL_SEPARATOR_DARK = { 0.24f, 0.24f, 0.27f, 1.0f };
|
||||
const ImVec4 ImGuiWrapper::COL_TITLE_BG = { 0.745f, 0.745f, 0.745f, 1.0f };
|
||||
const ImVec4 ImGuiWrapper::COL_WINDOW_BG = { 1.000f, 1.000f, 1.000f, 0.95f };
|
||||
const ImVec4 ImGuiWrapper::COL_WINDOW_BG = { 1.000f, 1.000f, 1.000f, 1.0f };
|
||||
const ImVec4 ImGuiWrapper::COL_WINDOW_BG_DARK = { 45 / 255.f, 45 / 255.f, 49 / 255.f, 1.f };
|
||||
|
||||
int ImGuiWrapper::TOOLBAR_WINDOW_FLAGS = ImGuiWindowFlags_AlwaysAutoResize
|
||||
| ImGuiWindowFlags_NoMove
|
||||
|
@ -1667,50 +1682,88 @@ std::vector<unsigned char> ImGuiWrapper::load_svg(const std::string& bitmap_name
|
|||
return data;
|
||||
}
|
||||
|
||||
|
||||
//BBS
|
||||
void ImGuiWrapper::push_toolbar_style(const float scale)
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(50/255.0f, 58/255.0f, 61/255.0f, 1.00f)); // 1
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGuiWrapper::COL_WINDOW_BG); // 2
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, ImGuiWrapper::COL_TITLE_BG); // 3
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImGuiWrapper::COL_TITLE_BG); // 4
|
||||
ImGui::PushStyleColor(ImGuiCol_Separator, ImGuiWrapper::COL_SEPARATOR); // 5
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 6
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGuiWrapper::COL_HOVER); // 7
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 8
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(238/255.0f, 238/255.0f, 238/255.0f, 1.00f)); // 9
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(238/255.0f, 238/255.0f, 238/255.0f, 0.00f)); // 10
|
||||
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, COL_GREEN_LIGHT); // 11
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.00f, 1.00f, 1.00f, 1.00f));//12
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrab, ImVec4(0.42f, 0.42f, 0.42f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabHovered, ImVec4(0.93f, 0.93f, 0.93f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabActive, ImVec4(0.93f, 0.93f, 0.93f, 1.00f));
|
||||
if (wxGetApp().app_config->get("dark_color_mode") == "1") {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 0.88f)); // 1
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGuiWrapper::COL_WINDOW_BG_DARK); // 2
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, ImGuiWrapper::COL_TITLE_BG); // 3
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImGuiWrapper::COL_TITLE_BG); // 4
|
||||
ImGui::PushStyleColor(ImGuiCol_Separator, ImGuiWrapper::COL_SEPARATOR_DARK); // 5
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(62 / 255.0f, 62 / 255.0f, 69 / 255.0f, 1.00f)); // 6
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(73 / 255.0f, 73 / 255.0f, 78 / 255.0f, 1.00f)); // 7
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(73 / 255.0f, 73 / 255.0f, 78 / 255.0f, 1.00f)); // 8
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(84 / 255.0f, 84 / 255.0f, 90 / 255.0f, 1.00f)); // 9
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(62 / 255.0f, 62 / 255.0f, 69 / 255.0f, 1.00f)); // 10
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f)); // 11
|
||||
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f)); // 12
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 13
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrab, ImVec4(0.42f, 0.42f, 0.42f, 1.00f)); // 14
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabHovered, ImVec4(0.93f, 0.93f, 0.93f, 1.00f)); // 15
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabActive, ImVec4(0.93f, 0.93f, 0.93f, 1.00f)); // 16
|
||||
}
|
||||
else {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(50 / 255.0f, 58 / 255.0f, 61 / 255.0f, 1.00f)); // 1
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGuiWrapper::COL_WINDOW_BG); // 2
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, ImGuiWrapper::COL_TITLE_BG); // 3
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImGuiWrapper::COL_TITLE_BG); // 4
|
||||
ImGui::PushStyleColor(ImGuiCol_Separator, ImGuiWrapper::COL_SEPARATOR); // 5
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 6
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGuiWrapper::COL_HOVER); // 7
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 8
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.00f, 0.68f, 0.26f, 1.00f)); // 9
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 10
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f)); // 11
|
||||
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, COL_GREEN_LIGHT); // 12
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.00f, 1.00f, 1.00f, 1.00f));//13
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrab, ImVec4(0.42f, 0.42f, 0.42f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabHovered, ImVec4(0.93f, 0.93f, 0.93f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabActive, ImVec4(0.93f, 0.93f, 0.93f, 1.00f));
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiWrapper::pop_toolbar_style()
|
||||
{
|
||||
// size in push toolbar style
|
||||
ImGui::PopStyleColor(15);
|
||||
ImGui::PopStyleColor(16);
|
||||
ImGui::PopStyleVar(6);
|
||||
}
|
||||
|
||||
void ImGuiWrapper::push_menu_style(const float scale)
|
||||
{
|
||||
ImGuiWrapper::push_toolbar_style(scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 4.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, 0.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BG);
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
if (wxGetApp().app_config->get("dark_color_mode") == "1") {
|
||||
ImGuiWrapper::push_toolbar_style(scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 4.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, 0.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BG_DARK);
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
}
|
||||
else {
|
||||
ImGuiWrapper::push_toolbar_style(scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 4.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, 0.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BG);
|
||||
ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.00f, 0.68f, 0.26f, 1.0f));
|
||||
}
|
||||
}
|
||||
void ImGuiWrapper::pop_menu_style()
|
||||
{
|
||||
|
@ -1720,25 +1773,48 @@ void ImGuiWrapper::pop_menu_style()
|
|||
}
|
||||
|
||||
void ImGuiWrapper::push_common_window_style(const float scale) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2(0.05f, 0.50f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(38 / 255.0f, 46 / 255.0f, 48 / 255.0f, 1.00f)); // 1
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 2
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, ImVec4(245 / 255.0f, 245 / 255.0f, 245 / 255.0f, 1.00f)); // 3
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImVec4(245 / 255.0f, 245 / 255.0f, 245 / 255.0f, 1.00f)); // 4
|
||||
ImGui::PushStyleColor(ImGuiCol_Separator, ImGuiWrapper::COL_SEPARATOR); // 5
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 6
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.00f, 0.68f, 0.26f, 1.00f)); // 7
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.00f, 0.68f, 0.26f, 1.00f)); // 8
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 9
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 10
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f)); // 11
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 12
|
||||
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, ImGuiWrapper::COL_GREEN_LIGHT); // 13
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, ImVec4(0.00f, 0.68f, 0.26f, 1.00f)); // 14
|
||||
if (wxGetApp().app_config->get("dark_color_mode") == "1") {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2(0.05f, 0.50f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 0.88f)); // 1
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGuiWrapper::COL_WINDOW_BG_DARK); // 2
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, ImVec4(54 / 255.0f, 54 / 255.0f, 60 / 255.0f, 1.00f)); // 3
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImVec4(54 / 255.0f, 54 / 255.0f, 60 / 255.0f, 1.00f)); // 4
|
||||
ImGui::PushStyleColor(ImGuiCol_Separator, ImGuiWrapper::COL_SEPARATOR_DARK); // 5
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 6
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.00f, 0.68f, 0.26f, 1.00f)); // 7
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.00f, 0.68f, 0.26f, 1.00f)); // 8
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(84 / 255.0f, 84 / 255.0f, 90 / 255.0f, 1.00f)); // 9
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(62 / 255.0f, 62 / 255.0f, 69 / 255.0f, 1.00f)); // 10
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f)); // 11
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 12
|
||||
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f)); // 13
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, ImVec4(0.00f, 0.68f, 0.26f, 1.00f)); // 14
|
||||
}
|
||||
else {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2(0.05f, 0.50f) * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(38 / 255.0f, 46 / 255.0f, 48 / 255.0f, 1.00f)); // 1
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 2
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, ImVec4(245 / 255.0f, 245 / 255.0f, 245 / 255.0f, 1.00f)); // 3
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImVec4(245 / 255.0f, 245 / 255.0f, 245 / 255.0f, 1.00f)); // 4
|
||||
ImGui::PushStyleColor(ImGuiCol_Separator, ImGuiWrapper::COL_SEPARATOR); // 5
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 6
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.00f, 0.68f, 0.26f, 1.00f)); // 7
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.00f, 0.68f, 0.26f, 1.00f)); // 8
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 9
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 10
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f)); // 11
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 12
|
||||
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, ImGuiWrapper::COL_GREEN_LIGHT); // 13
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, ImVec4(0.00f, 0.68f, 0.26f, 1.00f)); // 14
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiWrapper::pop_common_window_style() {
|
||||
|
@ -1747,33 +1823,62 @@ void ImGuiWrapper::pop_common_window_style() {
|
|||
}
|
||||
|
||||
void ImGuiWrapper::push_confirm_button_style() {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f / 255.f, 174.f / 255.f, 66.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(61.f / 255.f, 203.f / 255.f, 115.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(27.f / 255.f, 136.f / 255.f, 68.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.f, 1.f, 1.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f));
|
||||
if (wxGetApp().app_config->get("dark_color_mode") == "1") {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f / 255.f, 174.f / 255.f, 66.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f / 255.f, 174.f / 255.f, 66.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(61.f / 255.f, 203.f / 255.f, 115.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(27.f / 255.f, 136.f / 255.f, 68.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.f, 1.f, 1.f, 0.88f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 0.88f));
|
||||
}
|
||||
else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f / 255.f, 174.f / 255.f, 66.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f / 255.f, 174.f / 255.f, 66.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(61.f / 255.f, 203.f / 255.f, 115.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(27.f / 255.f, 136.f / 255.f, 68.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.f, 1.f, 1.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f));
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiWrapper::pop_confirm_button_style() {
|
||||
ImGui::PopStyleColor(5);
|
||||
ImGui::PopStyleColor(6);
|
||||
}
|
||||
|
||||
void ImGuiWrapper::push_cancel_button_style() {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(255.f / 255.f, 255.f / 255.f, 255.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(238.f / 255.f, 238.f / 255.f, 238.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(206.f / 255.f, 206.f / 255.f, 206.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(0.f, 0.f, 0.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(38.f / 255.0f, 46.f / 255.0f, 48.f / 255.0f, 1.00f));
|
||||
if (wxGetApp().app_config->get("dark_color_mode") == "1") {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.f, 0.f, 0.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(1.f, 1.f, 1.f, 0.64f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(73 / 255.f, 73 / 255.f, 78 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(129 / 255.f, 129 / 255.f, 131 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.f, 1.f, 1.f, 0.64f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 0.64f));
|
||||
}
|
||||
else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.f, 1.f, 1.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(38 / 255.f, 46 / 255.f, 48 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(238.f / 255.f, 238.f / 255.f, 238.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(206.f / 255.f, 206.f / 255.f, 206.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(0.f, 0.f, 0.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(38.f / 255.0f, 46.f / 255.0f, 48.f / 255.0f, 1.00f));
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiWrapper::pop_cancel_button_style() {
|
||||
ImGui::PopStyleColor(5);
|
||||
ImGui::PopStyleColor(6);
|
||||
}
|
||||
|
||||
void ImGuiWrapper::push_button_disable_style() {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(206.f / 255.f, 206.f / 255.f, 206.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(206.f / 255.f, 206.f / 255.f, 206.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f));
|
||||
if (wxGetApp().app_config->get("dark_color_mode") == "1") {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(54 / 255.f, 54 / 255.f, 60 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(54 / 255.f, 54 / 255.f, 60 / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 0.4f));
|
||||
}
|
||||
else {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(206.f / 255.f, 206.f / 255.f, 206.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(206.f / 255.f, 206.f / 255.f, 206.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f));
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiWrapper::pop_button_disable_style() {
|
||||
|
|
|
@ -191,7 +191,9 @@ public:
|
|||
static const ImVec4 COL_ACTIVE;
|
||||
static const ImVec4 COL_TITLE_BG;
|
||||
static const ImVec4 COL_WINDOW_BG;
|
||||
static const ImVec4 COL_WINDOW_BG_DARK;
|
||||
static const ImVec4 COL_SEPARATOR;
|
||||
static const ImVec4 COL_SEPARATOR_DARK;
|
||||
|
||||
//BBS
|
||||
static void push_toolbar_style(const float scale);
|
||||
|
|
|
@ -161,6 +161,7 @@ NotificationManager::PopNotification::PopNotification(const NotificationData &n,
|
|||
|
||||
void NotificationManager::PopNotification::use_bbl_theme()
|
||||
{
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
ImGuiStyle &OldStyle = ImGui::GetStyle();
|
||||
|
||||
m_DefaultTheme.mWindowPadding = OldStyle.WindowPadding;
|
||||
|
@ -188,9 +189,13 @@ void NotificationManager::PopNotification::use_bbl_theme()
|
|||
// OldStyle.Colors[ImGuiCol_WindowBg] = m_WindowBkgColor;
|
||||
// OldStyle.Colors[ImGuiCol_Text] = m_TextColor;
|
||||
|
||||
push_style_color(ImGuiCol_Border, m_CurrentColor, true, m_current_fade_opacity);
|
||||
m_WindowBkgColor = dark_mode ? ImVec4(45 / 255.f, 45 / 255.f, 49 / 255.f, 1.f) : ImVec4(1, 1, 1, 1);
|
||||
m_TextColor = dark_mode ? ImVec4(1, 1, 1, 0.4f) : ImVec4(.2f, .2f, .2f, 1.0f);
|
||||
m_HyperTextColor = dark_mode ? ImVec4(0.03, 0.6, 0.18, 1) : ImVec4(0.03, 0.6, 0.18, 1);
|
||||
dark_mode ? push_style_color(ImGuiCol_Border, {62 / 255.f, 62 / 255.f, 69 / 255.f, 1.f}, true, m_current_fade_opacity) : push_style_color(ImGuiCol_Border, m_CurrentColor, true, m_current_fade_opacity);
|
||||
push_style_color(ImGuiCol_WindowBg, m_WindowBkgColor, true, m_current_fade_opacity);
|
||||
push_style_color(ImGuiCol_Text, m_TextColor, true, m_current_fade_opacity);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, m_WindowRadius / 4);
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,6 +207,7 @@ void NotificationManager::PopNotification::restore_default_theme()
|
|||
OldStyle.WindowRounding = m_DefaultTheme.mWindowRound;
|
||||
|
||||
ImGui::PopStyleColor(3);
|
||||
ImGui::PopStyleVar();
|
||||
//OldStyle.Colors[ImGuiCol_WindowBg] = m_DefaultTheme.mWindowBkg;
|
||||
// OldStyle.Colors[ImGuiCol_Text] = m_DefaultTheme.mTextColor;
|
||||
// OldStyle.Colors[ImGuiCol_Border] = m_DefaultTheme.mBorderColor;
|
||||
|
@ -273,6 +279,8 @@ void NotificationManager::PopNotification::render(GLCanvas3D& canvas, float init
|
|||
|
||||
use_bbl_theme();
|
||||
|
||||
m_is_dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
|
||||
if (imgui.begin(name, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
|
||||
ImVec2 win_size = ImGui::GetWindowSize();
|
||||
|
||||
|
@ -541,8 +549,8 @@ void NotificationManager::PopNotification::render_close_button(ImGuiWrapper& img
|
|||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
|
||||
|
||||
|
||||
std::string button_text;
|
||||
button_text = ImGui::CloseNotifButton;
|
||||
std::wstring button_text;
|
||||
button_text = m_is_dark_mode ? ImGui::CloseNotifDarkButton : ImGui::CloseNotifButton;
|
||||
//button_text = ImGui::PreferencesButton;
|
||||
|
||||
//if (ImGui::IsMouseHoveringRect(ImVec2(win_pos.x - win_size.x / 10.f, win_pos.y),
|
||||
|
@ -550,9 +558,9 @@ void NotificationManager::PopNotification::render_close_button(ImGuiWrapper& img
|
|||
// true))
|
||||
if (ImGui::IsMouseHoveringRect(ImVec2(win_pos.x - win_size.x / 10.f, win_pos.y), ImVec2(win_pos.x, win_pos.y + 2 * m_line_height+10),true))
|
||||
{
|
||||
button_text = ImGui::CloseNotifHoverButton;
|
||||
button_text = m_is_dark_mode ? ImGui::CloseNotifHoverDarkButton : ImGui::CloseNotifHoverButton;
|
||||
}
|
||||
ImVec2 button_pic_size = ImGui::CalcTextSize(button_text.c_str());
|
||||
ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
|
||||
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
|
||||
ImGui::SetCursorPosX(win_size.x - m_line_height * 2.75f);
|
||||
//ImGui::SetCursorPosY(win_size.y / 2 - button_size.y);
|
||||
|
@ -587,12 +595,11 @@ void NotificationManager::PopNotification::render_close_button(ImGuiWrapper& img
|
|||
void NotificationManager::PopNotification::bbl_render_left_sign(ImGuiWrapper &imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
|
||||
{
|
||||
ImDrawList *draw_list = ImGui::GetWindowDrawList();
|
||||
|
||||
ImVec2 round_rect_pos = ImVec2(win_pos_x - win_size_x, win_pos_y);
|
||||
ImVec2 round_rect_size = ImVec2(m_WindowRadius * 2, win_size_y);
|
||||
ImVec2 round_rect_pos = ImVec2(win_pos_x - win_size_x + ImGui::GetStyle().WindowBorderSize, win_pos_y + ImGui::GetStyle().WindowBorderSize);
|
||||
ImVec2 round_rect_size = ImVec2(m_WindowRadius * 2, win_size_y - 2 * ImGui::GetStyle().WindowBorderSize);
|
||||
|
||||
ImVec2 rect_pos = round_rect_pos + ImVec2(m_WindowRadius, 0);
|
||||
ImVec2 rect_size = ImVec2(m_WindowRadius + 2 * wxGetApp().plater()->get_current_canvas3D()->get_scale(), win_size_y);
|
||||
ImVec2 rect_size = ImVec2(round_rect_size.x / 2, round_rect_size.y);
|
||||
|
||||
ImU32 clr = ImGui::GetColorU32(ImVec4(m_CurrentColor.x, m_CurrentColor.y, m_CurrentColor.z, m_current_fade_opacity));
|
||||
|
||||
|
@ -626,15 +633,15 @@ void NotificationManager::PopNotification::render_minimize_button(ImGuiWrapper&
|
|||
|
||||
|
||||
//button - if part if treggered
|
||||
std::string button_text;
|
||||
button_text = ImGui::MinimalizeButton;
|
||||
std::wstring button_text;
|
||||
button_text = m_is_dark_mode ? ImGui::MinimalizeDarkButton : ImGui::MinimalizeButton;
|
||||
if (ImGui::IsMouseHoveringRect(ImVec2(win_pos_x - m_window_width / 10.f, win_pos_y + m_window_height - 2 * m_line_height + 1),
|
||||
ImVec2(win_pos_x, win_pos_y + m_window_height),
|
||||
true))
|
||||
{
|
||||
button_text = ImGui::MinimalizeHoverButton;
|
||||
button_text = m_is_dark_mode ? ImGui::MinimalizeHoverDarkButton : ImGui::MinimalizeHoverButton;
|
||||
}
|
||||
ImVec2 button_pic_size = ImGui::CalcTextSize(button_text.c_str());
|
||||
ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
|
||||
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
|
||||
ImGui::SetCursorPosX(m_window_width - m_line_height * 1.8f);
|
||||
ImGui::SetCursorPosY(m_window_height - button_size.y - 5);
|
||||
|
|
|
@ -395,6 +395,8 @@ private:
|
|||
void reset_timer() { m_notification_start = GLCanvas3D::timestamp_now(); m_state = EState::Shown; }
|
||||
void set_Multiline(bool Multi) { m_multiline = Multi; }
|
||||
|
||||
bool m_is_dark_mode = false;
|
||||
|
||||
protected:
|
||||
// Call after every size change
|
||||
virtual void init();
|
||||
|
|
|
@ -64,9 +64,12 @@ class Bed3D;
|
|||
|
||||
std::array<float, 4> PartPlate::SELECT_COLOR = { 0.2666f, 0.2784f, 0.2784f, 1.0f }; //{ 0.4196f, 0.4235f, 0.4235f, 1.0f };
|
||||
std::array<float, 4> PartPlate::UNSELECT_COLOR = { 0.82f, 0.82f, 0.82f, 1.0f };
|
||||
std::array<float, 4> PartPlate::UNSELECT_DARK_COLOR = { 0.384f, 0.384f, 0.412f, 1.0f };
|
||||
std::array<float, 4> PartPlate::DEFAULT_COLOR = { 0.5f, 0.5f, 0.5f, 1.0f };
|
||||
std::array<float, 4> PartPlate::LINE_TOP_COLOR = { 0.89f, 0.89f, 0.89f, 1.0f };
|
||||
std::array<float, 4> PartPlate::LINE_TOP_DARK_COLOR = { 0.431f, 0.431f, 0.463f, 1.0f };
|
||||
std::array<float, 4> PartPlate::LINE_TOP_SEL_COLOR = { 0.5294f, 0.5451, 0.5333f, 1.0f};
|
||||
std::array<float, 4> PartPlate::LINE_TOP_SEL_DARK_COLOR = { 0.298f, 0.298f, 0.3333f, 1.0f};
|
||||
std::array<float, 4> PartPlate::LINE_BOTTOM_COLOR = { 0.8f, 0.8f, 0.8f, 0.4f };
|
||||
std::array<float, 4> PartPlate::HEIGHT_LIMIT_TOP_COLOR = { 0.6f, 0.6f, 1.0f, 1.0f };
|
||||
std::array<float, 4> PartPlate::HEIGHT_LIMIT_BOTTOM_COLOR = { 0.4f, 0.4f, 1.0f, 1.0f };
|
||||
|
@ -393,7 +396,7 @@ void PartPlate::render_background(bool force_default_color) const {
|
|||
glsafe(::glColor4fv(PartPlate::SELECT_COLOR.data()));
|
||||
}
|
||||
else {
|
||||
glsafe(::glColor4fv(PartPlate::UNSELECT_COLOR.data()));
|
||||
glsafe(wxGetApp().app_config->get("dark_color_mode") == "1" ? ::glColor4fv(PartPlate::UNSELECT_DARK_COLOR.data()) : ::glColor4fv(PartPlate::UNSELECT_COLOR.data()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -593,14 +596,15 @@ void PartPlate::render_exclude_area(bool force_default_color) const {
|
|||
void PartPlate::render_grid(bool bottom) const {
|
||||
//glsafe(::glEnable(GL_MULTISAMPLE));
|
||||
// draw grid
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
glsafe(::glLineWidth(1.0f * m_scale_factor));
|
||||
if (bottom)
|
||||
glsafe(::glColor4fv(LINE_BOTTOM_COLOR.data()));
|
||||
else {
|
||||
if (m_selected)
|
||||
glsafe(::glColor4fv(LINE_TOP_SEL_COLOR.data()));
|
||||
glsafe(dark_mode ? ::glColor4fv(LINE_TOP_SEL_DARK_COLOR.data()) : ::glColor4fv(LINE_TOP_SEL_COLOR.data()));
|
||||
else
|
||||
glsafe(::glColor4fv(LINE_TOP_COLOR.data()));
|
||||
glsafe(dark_mode ? ::glColor4fv(LINE_TOP_DARK_COLOR.data()) : ::glColor4fv(LINE_TOP_COLOR.data()));
|
||||
}
|
||||
glsafe(::glVertexPointer(3, GL_FLOAT, m_gridlines.get_vertex_data_size(), (GLvoid*)m_gridlines.get_vertices_data()));
|
||||
glsafe(::glDrawArrays(GL_LINES, 0, (GLsizei)m_gridlines.get_vertices_count()));
|
||||
|
@ -2347,118 +2351,119 @@ Vec2d PartPlateList::compute_shape_position(int index, int cols)
|
|||
//generate icon textures
|
||||
void PartPlateList::generate_icon_textures()
|
||||
{
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
// use higher resolution images if graphic card and opengl version allow
|
||||
GLint max_tex_size = OpenGLManager::get_gl_info().get_max_tex_size();
|
||||
std::string path = resources_dir() + "/images/";
|
||||
std::string file_name;
|
||||
|
||||
if (m_del_texture.get_id() == 0)
|
||||
//if (m_del_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_close.svg";
|
||||
file_name = path + (dark_mode ? "plate_close_dark.svg" : "plate_close.svg");
|
||||
if (!m_del_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_del_hovered_texture.get_id() == 0)
|
||||
//if (m_del_hovered_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_close_hover.svg";
|
||||
file_name = path + (dark_mode ? "plate_close_hover_dark.svg" : "plate_close_hover.svg");
|
||||
if (!m_del_hovered_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_arrange_texture.get_id() == 0)
|
||||
//if (m_arrange_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_arrange.svg";
|
||||
file_name = path + (dark_mode ? "plate_arrange_dark.svg" : "plate_arrange.svg");
|
||||
if (!m_arrange_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_arrange_hovered_texture.get_id() == 0)
|
||||
//if (m_arrange_hovered_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_arrange_hover.svg";
|
||||
file_name = path + (dark_mode ? "plate_arrange_hover_dark.svg" : "plate_arrange_hover.svg");
|
||||
if (!m_arrange_hovered_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_orient_texture.get_id() == 0)
|
||||
//if (m_orient_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_orient.svg";
|
||||
file_name = path + (dark_mode ? "plate_orient_dark.svg" : "plate_orient.svg");
|
||||
if (!m_orient_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_orient_hovered_texture.get_id() == 0)
|
||||
//if (m_orient_hovered_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_orient_hover.svg";
|
||||
file_name = path + (dark_mode ? "plate_orient_hover_dark.svg" : "plate_orient_hover.svg");
|
||||
if (!m_orient_hovered_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_locked_texture.get_id() == 0)
|
||||
//if (m_locked_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_locked.svg";
|
||||
file_name = path + (dark_mode ? "plate_locked_dark.svg" : "plate_locked.svg");
|
||||
if (!m_locked_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_locked_hovered_texture.get_id() == 0)
|
||||
//if (m_locked_hovered_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_locked_hover.svg";
|
||||
file_name = path + (dark_mode ? "plate_locked_hover_dark.svg" : "plate_locked_hover.svg");
|
||||
if (!m_locked_hovered_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_lockopen_texture.get_id() == 0)
|
||||
//if (m_lockopen_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_unlocked.svg";
|
||||
file_name = path + (dark_mode ? "plate_unlocked_dark.svg" : "plate_unlocked.svg");
|
||||
if (!m_lockopen_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_lockopen_hovered_texture.get_id() == 0)
|
||||
//if (m_lockopen_hovered_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_unlocked_hover.svg";
|
||||
file_name = path + (dark_mode ? "plate_unlocked_hover_dark.svg" : "plate_unlocked_hover.svg");
|
||||
if (!m_lockopen_hovered_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bedtype_texture.get_id() == 0)
|
||||
//if (m_bedtype_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_set_bedtype.svg";
|
||||
file_name = path + (dark_mode ? "plate_set_bedtype_dark.svg" : "plate_set_bedtype.svg");
|
||||
if (!m_bedtype_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bedtype_changed_texture.get_id() == 0)
|
||||
//if (m_bedtype_changed_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_set_bedtype_changed.svg";
|
||||
file_name = path + (dark_mode ? "plate_set_bedtype_changed_dark.svg" : "plate_set_bedtype_changed.svg");
|
||||
if (!m_bedtype_changed_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bedtype_hovered_texture.get_id() == 0)
|
||||
//if (m_bedtype_hovered_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_set_bedtype_hover.svg";
|
||||
file_name = path + (dark_mode ? "plate_set_bedtype_hover_dark.svg" : "plate_set_bedtype_hover.svg");
|
||||
if (!m_bedtype_hovered_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bedtype_changed_hovered_texture.get_id() == 0)
|
||||
//if (m_bedtype_changed_hovered_texture.get_id() == 0)
|
||||
{
|
||||
file_name = path + "plate_set_bedtype_changed_hover.svg";
|
||||
file_name = path + (dark_mode ? "plate_set_bedtype_changed_hover_dark.svg" : "plate_set_bedtype_changed_hover.svg");
|
||||
if (!m_bedtype_changed_hovered_texture.load_from_svg_file(file_name, true, false, false, max_tex_size / 8)) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":load file %1% failed") % file_name;
|
||||
}
|
||||
|
@ -3753,7 +3758,12 @@ void PartPlateList::render(bool bottom, bool only_current, bool only_body, int h
|
|||
plate_hover_action = hover_id % PartPlate::GRABBER_COUNT;
|
||||
}
|
||||
|
||||
if (m_del_texture.get_id() == 0)
|
||||
static bool last_dark_mode_tatus = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
bool dark_mode_status = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
if (dark_mode_status != last_dark_mode_tatus) {
|
||||
last_dark_mode_tatus = dark_mode_status;
|
||||
generate_icon_textures();
|
||||
}else if(m_del_texture.get_id() == 0)
|
||||
generate_icon_textures();
|
||||
for (it = m_plate_list.begin(); it != m_plate_list.end(); it++) {
|
||||
int current_index = (*it)->get_index();
|
||||
|
|
|
@ -191,10 +191,13 @@ public:
|
|||
|
||||
static std::array<float, 4> SELECT_COLOR;
|
||||
static std::array<float, 4> UNSELECT_COLOR;
|
||||
static std::array<float, 4> UNSELECT_DARK_COLOR;
|
||||
static std::array<float, 4> DEFAULT_COLOR;
|
||||
static std::array<float, 4> LINE_BOTTOM_COLOR;
|
||||
static std::array<float, 4> LINE_TOP_COLOR;
|
||||
static std::array<float, 4> LINE_TOP_DARK_COLOR;
|
||||
static std::array<float, 4> LINE_TOP_SEL_COLOR;
|
||||
static std::array<float, 4> LINE_TOP_SEL_DARK_COLOR;
|
||||
static std::array<float, 4> HEIGHT_LIMIT_BOTTOM_COLOR;
|
||||
static std::array<float, 4> HEIGHT_LIMIT_TOP_COLOR;
|
||||
|
||||
|
|
|
@ -6381,8 +6381,10 @@ bool Plater::priv::init_collapse_toolbar()
|
|||
// already initialized
|
||||
return true;
|
||||
|
||||
bool dark_mode = wxGetApp().app_config->get("dark_color_mode") == "1";
|
||||
|
||||
BackgroundTexture::Metadata background_data;
|
||||
background_data.filename = "toolbar_background.png";
|
||||
background_data.filename = dark_mode ? "toolbar_background_dark.png" : "toolbar_background.png";
|
||||
background_data.left = 16;
|
||||
background_data.top = 16;
|
||||
background_data.right = 16;
|
||||
|
@ -6398,6 +6400,8 @@ bool Plater::priv::init_collapse_toolbar()
|
|||
collapse_toolbar.set_separator_size(5);
|
||||
collapse_toolbar.set_gap_size(2);
|
||||
|
||||
collapse_toolbar.del_all_item();
|
||||
|
||||
GLToolbarItem::Data item;
|
||||
|
||||
item.name = "collapse_sidebar";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue