Fixed conflicts after merge with master

This commit is contained in:
enricoturri1966 2020-08-03 08:56:58 +02:00
commit 69a0a1c96e
5 changed files with 57 additions and 76 deletions

View File

@ -220,41 +220,30 @@ void GLCanvas3D::LayersEditing::render_overlay(const GLCanvas3D& canvas) const
return;
const Size& cnv_size = canvas.get_canvas_size();
float canvas_w = (float)cnv_size.get_width();
float canvas_h = (float)cnv_size.get_height();
ImGuiWrapper& imgui = *wxGetApp().imgui();
imgui.set_next_window_pos(canvas_w - imgui.get_style_scaling() * THICKNESS_BAR_WIDTH, canvas_h, ImGuiCond_Always, 1.0f, 1.0f);
imgui.set_next_window_pos(static_cast<float>(cnv_size.get_width()) - imgui.get_style_scaling() * THICKNESS_BAR_WIDTH,
static_cast<float>(cnv_size.get_height()), ImGuiCond_Always, 1.0f, 1.0f);
imgui.begin(_L("Variable layer height"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::COL_ORANGE_LIGHT);
imgui.text(_L("Left mouse button:"));
ImGui::PopStyleColor();
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _L("Left mouse button:"));
ImGui::SameLine();
imgui.text(_L("Add detail"));
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::COL_ORANGE_LIGHT);
imgui.text(_L("Right mouse button:"));
ImGui::PopStyleColor();
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _L("Right mouse button:"));
ImGui::SameLine();
imgui.text(_L("Remove detail"));
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::COL_ORANGE_LIGHT);
imgui.text(_L("Shift + Left mouse button:"));
ImGui::PopStyleColor();
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _L("Shift + Left mouse button:"));
ImGui::SameLine();
imgui.text(_L("Reset to base"));
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::COL_ORANGE_LIGHT);
imgui.text(_L("Shift + Right mouse button:"));
ImGui::PopStyleColor();
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _L("Shift + Right mouse button:"));
ImGui::SameLine();
imgui.text(_L("Smoothing"));
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::COL_ORANGE_LIGHT);
imgui.text(_L("Mouse wheel:"));
ImGui::PopStyleColor();
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _L("Mouse wheel:"));
ImGui::SameLine();
imgui.text(_L("Increase/decrease edit area"));
@ -266,8 +255,7 @@ void GLCanvas3D::LayersEditing::render_overlay(const GLCanvas3D& canvas) const
float text_align = ImGui::GetCursorPosX();
ImGui::AlignTextToFramePadding();
imgui.text(_L("Quality / Speed"));
if (ImGui::IsItemHovered())
{
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::TextUnformatted(_L("Higher print quality versus higher print speed.").ToUTF8());
ImGui::EndTooltip();
@ -1408,8 +1396,7 @@ void GLCanvas3D::Tooltip::render(const Vec2d& mouse_position, GLCanvas3D& canvas
#if ENABLE_SLOPE_RENDERING
void GLCanvas3D::Slope::render() const
{
if (m_dialog_shown)
{
if (m_dialog_shown) {
const std::array<float, 2>& z_range = m_volumes.get_slope_z_range();
std::array<float, 2> angle_range = { Geometry::rad2deg(::acos(z_range[0])) - 90.0f, Geometry::rad2deg(::acos(z_range[1])) - 90.0f };
bool modified = false;
@ -1417,9 +1404,9 @@ void GLCanvas3D::Slope::render() const
ImGuiWrapper& imgui = *wxGetApp().imgui();
const Size& cnv_size = m_canvas.get_canvas_size();
imgui.set_next_window_pos((float)cnv_size.get_width(), (float)cnv_size.get_height(), ImGuiCond_Always, 1.0f, 1.0f);
imgui.begin(_(L("Slope visualization")), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
imgui.begin(_L("Slope visualization"), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
imgui.text(_(L("Facets' slope range (degrees)")) + ":");
imgui.text(_L("Facets' slope range (degrees)") + ":");
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.75f, 0.0f, 0.0f, 0.5f));
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(1.0f, 0.0f, 0.0f, 0.5f));
@ -1431,8 +1418,7 @@ void GLCanvas3D::Slope::render() const
float slope_bound = 90.f - angle_range[1];
bool mod = ImGui::SliderFloat("##red", &slope_bound, 0.0f, 90.0f, "%.1f");
angle_range[1] = 90.f - slope_bound;
if (mod)
{
if (mod) {
modified = true;
if (angle_range[0] > angle_range[1])
angle_range[0] = angle_range[1];
@ -1440,15 +1426,14 @@ void GLCanvas3D::Slope::render() const
ImGui::PopStyleColor(4);
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.75f, 0.75f, 0.0f, 0.5f));
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(1.0f, 1.0f, 0.0f, 0.5f));
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.85f, 0.85f, 0.0f, 0.5f));
ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.25f, 0.25f, 0.0f, 1.0f));
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(1.0f, 1.0f, 0.0f, 0.5f));
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.85f, 0.85f, 0.0f, 0.5f));
ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.25f, 0.25f, 0.0f, 1.0f));
slope_bound = 90.f - angle_range[0];
mod = ImGui::SliderFloat("##yellow", &slope_bound, 0.0f, 90.0f, "%.1f");
angle_range[0] = 90.f - slope_bound;
if (mod)
{
if (mod) {
modified = true;
if (angle_range[1] < angle_range[0])
angle_range[1] = angle_range[0];

View File

@ -512,9 +512,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
window_width = std::max(window_width, button_width);
auto draw_text_with_caption = [this, &caption_max](const wxString& caption, const wxString& text) {
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::COL_ORANGE_LIGHT);
m_imgui->text(caption);
ImGui::PopStyleColor();
m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, caption);
ImGui::SameLine(caption_max);
m_imgui->text(text);
};

View File

@ -360,6 +360,22 @@ void ImGuiWrapper::text(const wxString &label)
this->text(label_utf8.c_str());
}
void ImGuiWrapper::text_colored(const ImVec4& color, const char* label)
{
ImGui::TextColored(color, label);
}
void ImGuiWrapper::text_colored(const ImVec4& color, const std::string& label)
{
this->text_colored(color, label.c_str());
}
void ImGuiWrapper::text_colored(const ImVec4& color, const wxString& label)
{
auto label_utf8 = into_u8(label);
this->text_colored(color, label_utf8.c_str());
}
bool ImGuiWrapper::slider_float(const char* label, float* v, float v_min, float v_max, const char* format/* = "%.3f"*/, float power/* = 1.0f*/)
{
return ImGui::SliderFloat(label, v, v_min, v_max, format, power);

View File

@ -73,6 +73,9 @@ public:
void text(const char *label);
void text(const std::string &label);
void text(const wxString &label);
void text_colored(const ImVec4& color, const char* label);
void text_colored(const ImVec4& color, const std::string& label);
void text_colored(const ImVec4& color, const wxString& label);
bool slider_float(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
bool slider_float(const std::string& label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
bool slider_float(const wxString& label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);

View File

@ -239,8 +239,7 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const
// when the user clicks on [X] or [Close] button we need to trigger
// an extra frame to let the dialog disappear
if (m_settings_dialog_closed_by_user)
{
if (m_settings_dialog_closed_by_user) {
m_show_settings_dialog = false;
m_settings_dialog_closed_by_user = false;
canvas.request_extra_frame();
@ -261,13 +260,10 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const
static ImVec2 last_win_size(0.0f, 0.0f);
bool shown = true;
if (imgui.begin(_(L("3Dconnexion settings")), &shown, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse))
{
if (shown)
{
if (imgui.begin(_L("3Dconnexion settings"), &shown, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse)) {
if (shown) {
ImVec2 win_size = ImGui::GetWindowSize();
if ((last_win_size.x != win_size.x) || (last_win_size.y != win_size.y))
{
if (last_win_size.x != win_size.x || last_win_size.y != win_size.y) {
// when the user clicks on [X] button, the next time the dialog is shown
// has a dummy size, so we trigger an extra frame to let it have the correct size
last_win_size = win_size;
@ -275,59 +271,51 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const
}
const ImVec4& color = ImGui::GetStyleColorVec4(ImGuiCol_Separator);
ImGui::PushStyleColor(ImGuiCol_Text, color);
imgui.text(_(L("Device:")));
ImGui::PopStyleColor();
imgui.text_colored(color, _L("Device:"));
ImGui::SameLine();
imgui.text(m_device_str);
ImGui::Separator();
ImGui::PushStyleColor(ImGuiCol_Text, color);
imgui.text(_(L("Speed:")));
ImGui::PopStyleColor();
imgui.text_colored(color, _L("Speed:"));
float translation_scale = (float)params_copy.translation.scale / Params::DefaultTranslationScale;
if (imgui.slider_float(_(L("Translation")) + "##1", &translation_scale, 0.1f, 10.0f, "%.1f")) {
if (imgui.slider_float(_L("Translation") + "##1", &translation_scale, 0.1f, 10.0f, "%.1f")) {
params_copy.translation.scale = Params::DefaultTranslationScale * (double)translation_scale;
params_changed = true;
}
float rotation_scale = params_copy.rotation.scale / Params::DefaultRotationScale;
if (imgui.slider_float(_(L("Rotation")) + "##1", &rotation_scale, 0.1f, 10.0f, "%.1f")) {
if (imgui.slider_float(_L("Rotation") + "##1", &rotation_scale, 0.1f, 10.0f, "%.1f")) {
params_copy.rotation.scale = Params::DefaultRotationScale * rotation_scale;
params_changed = true;
}
float zoom_scale = params_copy.zoom.scale / Params::DefaultZoomScale;
if (imgui.slider_float(_(L("Zoom")), &zoom_scale, 0.1f, 10.0f, "%.1f")) {
if (imgui.slider_float(_L("Zoom"), &zoom_scale, 0.1f, 10.0f, "%.1f")) {
params_copy.zoom.scale = Params::DefaultZoomScale * zoom_scale;
params_changed = true;
}
ImGui::Separator();
ImGui::PushStyleColor(ImGuiCol_Text, color);
imgui.text(_(L("Deadzone:")));
ImGui::PopStyleColor();
imgui.text_colored(color, _L("Deadzone:"));
float translation_deadzone = (float)params_copy.translation.deadzone;
if (imgui.slider_float(_(L("Translation")) + "/" + _(L("Zoom")), &translation_deadzone, 0.0f, (float)Params::MaxTranslationDeadzone, "%.2f")) {
if (imgui.slider_float(_L("Translation") + "/" + _L("Zoom"), &translation_deadzone, 0.0f, (float)Params::MaxTranslationDeadzone, "%.2f")) {
params_copy.translation.deadzone = (double)translation_deadzone;
params_changed = true;
}
float rotation_deadzone = params_copy.rotation.deadzone;
if (imgui.slider_float(_(L("Rotation")) + "##2", &rotation_deadzone, 0.0f, Params::MaxRotationDeadzone, "%.2f")) {
if (imgui.slider_float(_L("Rotation") + "##2", &rotation_deadzone, 0.0f, Params::MaxRotationDeadzone, "%.2f")) {
params_copy.rotation.deadzone = rotation_deadzone;
params_changed = true;
}
ImGui::Separator();
ImGui::PushStyleColor(ImGuiCol_Text, color);
imgui.text(_(L("Options:")));
ImGui::PopStyleColor();
imgui.text_colored(color, _L("Options:"));
bool swap_yz = params_copy.swap_yz;
if (imgui.checkbox("Swap Y/Z axes", swap_yz)) {
if (imgui.checkbox(_L("Swap Y/Z axes"), swap_yz)) {
params_copy.swap_yz = swap_yz;
params_changed = true;
}
@ -335,25 +323,20 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const
#if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
ImGui::Separator();
ImGui::Separator();
ImGui::PushStyleColor(ImGuiCol_Text, color);
imgui.text("DEBUG:");
imgui.text("Vectors:");
ImGui::PopStyleColor();
imgui.text_colored(color, "DEBUG:");
imgui.text_colored(color, "Vectors:");
Vec3f translation = m_state.get_first_vector_of_type(State::QueueItem::TranslationType).cast<float>();
Vec3f rotation = m_state.get_first_vector_of_type(State::QueueItem::RotationType).cast<float>();
ImGui::InputFloat3("Translation##3", translation.data(), "%.3f", ImGuiInputTextFlags_ReadOnly);
ImGui::InputFloat3("Rotation##3", rotation.data(), "%.3f", ImGuiInputTextFlags_ReadOnly);
ImGui::PushStyleColor(ImGuiCol_Text, color);
imgui.text("Queue size:");
ImGui::PopStyleColor();
imgui.text_colored(color, "Queue size:");
int input_queue_size_current[2] = { int(m_state.input_queue_size_current()), int(m_state.input_queue_max_size_achieved) };
ImGui::InputInt2("Current##4", input_queue_size_current, ImGuiInputTextFlags_ReadOnly);
int input_queue_size_param = int(params_copy.input_queue_max_size);
if (ImGui::InputInt("Max size", &input_queue_size_param, 1, 1, ImGuiInputTextFlags_ReadOnly))
{
if (ImGui::InputInt("Max size", &input_queue_size_param, 1, 1, ImGuiInputTextFlags_ReadOnly)) {
if (input_queue_size_param > 0) {
params_copy.input_queue_max_size = input_queue_size_param;
params_changed = true;
@ -361,23 +344,19 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const
}
ImGui::Separator();
ImGui::PushStyleColor(ImGuiCol_Text, color);
imgui.text("Camera:");
ImGui::PopStyleColor();
imgui.text_colored(color, "Camera:");
Vec3f target = wxGetApp().plater()->get_camera().get_target().cast<float>();
ImGui::InputFloat3("Target", target.data(), "%.3f", ImGuiInputTextFlags_ReadOnly);
#endif // ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
ImGui::Separator();
if (imgui.button(_(L("Close"))))
{
if (imgui.button(_L("Close"))) {
// the user clicked on the [Close] button
m_settings_dialog_closed_by_user = true;
canvas.set_as_dirty();
}
}
else
{
else {
// the user clicked on the [X] button
m_settings_dialog_closed_by_user = true;
canvas.set_as_dirty();