ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG set as default

This commit is contained in:
Enrico Turri 2020-01-17 11:45:52 +01:00
parent 4eee702984
commit 94a3d38afd
4 changed files with 0 additions and 39 deletions

View file

@ -41,9 +41,6 @@
#define ENABLE_THUMBNAIL_GENERATOR (1 && ENABLE_2_2_0_ALPHA1) #define ENABLE_THUMBNAIL_GENERATOR (1 && ENABLE_2_2_0_ALPHA1)
#define ENABLE_THUMBNAIL_GENERATOR_DEBUG (0 && ENABLE_THUMBNAIL_GENERATOR) #define ENABLE_THUMBNAIL_GENERATOR_DEBUG (0 && ENABLE_THUMBNAIL_GENERATOR)
// Enable closing 3Dconnextion imgui settings dialog by clicking on [X] and [Close] buttons
#define ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG (1 && ENABLE_2_2_0_ALPHA1)
// Enable not applying volume transformation during 3mf and amf loading, but keeping it as a ModelVolume member // Enable not applying volume transformation during 3mf and amf loading, but keeping it as a ModelVolume member
#define ENABLE_KEEP_LOADED_VOLUME_TRANSFORM_AS_STAND_ALONE (1 && ENABLE_2_2_0_ALPHA1) #define ENABLE_KEEP_LOADED_VOLUME_TRANSFORM_AS_STAND_ALONE (1 && ENABLE_2_2_0_ALPHA1)

View file

@ -1799,11 +1799,7 @@ void GLCanvas3D::render()
m_camera.debug_render(); m_camera.debug_render();
#endif // ENABLE_CAMERA_STATISTICS #endif // ENABLE_CAMERA_STATISTICS
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
wxGetApp().plater()->get_mouse3d_controller().render_settings_dialog(*this); wxGetApp().plater()->get_mouse3d_controller().render_settings_dialog(*this);
#else
wxGetApp().plater()->get_mouse3d_controller().render_settings_dialog((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height());
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
wxGetApp().imgui()->render(); wxGetApp().imgui()->render();

View file

@ -5,9 +5,7 @@
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "PresetBundle.hpp" #include "PresetBundle.hpp"
#include "AppConfig.hpp" #include "AppConfig.hpp"
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
#include "GLCanvas3D.hpp" #include "GLCanvas3D.hpp"
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
#include <wx/glcanvas.h> #include <wx/glcanvas.h>
@ -200,9 +198,7 @@ Mouse3DController::Mouse3DController()
, m_device_str("") , m_device_str("")
, m_running(false) , m_running(false)
, m_show_settings_dialog(false) , m_show_settings_dialog(false)
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
, m_settings_dialog_closed_by_user(false) , m_settings_dialog_closed_by_user(false)
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
{ {
m_last_time = std::chrono::high_resolution_clock::now(); m_last_time = std::chrono::high_resolution_clock::now();
} }
@ -247,9 +243,7 @@ bool Mouse3DController::apply(Camera& camera)
disconnect_device(); disconnect_device();
// hides the settings dialog if the user un-plug the device // hides the settings dialog if the user un-plug the device
m_show_settings_dialog = false; m_show_settings_dialog = false;
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
m_settings_dialog_closed_by_user = false; m_settings_dialog_closed_by_user = false;
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
} }
// check if the user plugged the device // check if the user plugged the device
@ -259,16 +253,11 @@ bool Mouse3DController::apply(Camera& camera)
return is_device_connected() ? m_state.apply(camera) : false; return is_device_connected() ? m_state.apply(camera) : false;
} }
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const
#else
void Mouse3DController::render_settings_dialog(unsigned int canvas_width, unsigned int canvas_height) const
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
{ {
if (!m_running || !m_show_settings_dialog) if (!m_running || !m_show_settings_dialog)
return; return;
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
// when the user clicks on [X] or [Close] button we need to trigger // when the user clicks on [X] or [Close] button we need to trigger
// an extra frame to let the dialog disappear // an extra frame to let the dialog disappear
if (m_settings_dialog_closed_by_user) if (m_settings_dialog_closed_by_user)
@ -280,16 +269,10 @@ void Mouse3DController::render_settings_dialog(unsigned int canvas_width, unsign
} }
Size cnv_size = canvas.get_canvas_size(); Size cnv_size = canvas.get_canvas_size();
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
ImGuiWrapper& imgui = *wxGetApp().imgui(); ImGuiWrapper& imgui = *wxGetApp().imgui();
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
imgui.set_next_window_pos(0.5f * (float)cnv_size.get_width(), 0.5f * (float)cnv_size.get_height(), ImGuiCond_Always, 0.5f, 0.5f); imgui.set_next_window_pos(0.5f * (float)cnv_size.get_width(), 0.5f * (float)cnv_size.get_height(), ImGuiCond_Always, 0.5f, 0.5f);
#else
imgui.set_next_window_pos(0.5f * (float)canvas_width, 0.5f * (float)canvas_height, ImGuiCond_Always, 0.5f, 0.5f);
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
static ImVec2 last_win_size(0.0f, 0.0f); static ImVec2 last_win_size(0.0f, 0.0f);
bool shown = true; bool shown = true;
if (imgui.begin(_(L("3Dconnexion settings")), &shown, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse)) if (imgui.begin(_(L("3Dconnexion settings")), &shown, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse))
@ -304,9 +287,6 @@ void Mouse3DController::render_settings_dialog(unsigned int canvas_width, unsign
last_win_size = win_size; last_win_size = win_size;
canvas.request_extra_frame(); canvas.request_extra_frame();
} }
#else
imgui.begin(_(L("3Dconnexion settings")), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse);
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
const ImVec4& color = ImGui::GetStyleColorVec4(ImGuiCol_Separator); const ImVec4& color = ImGui::GetStyleColorVec4(ImGuiCol_Separator);
ImGui::PushStyleColor(ImGuiCol_Text, color); ImGui::PushStyleColor(ImGuiCol_Text, color);
@ -389,7 +369,6 @@ void Mouse3DController::render_settings_dialog(unsigned int canvas_width, unsign
Vec3f target = wxGetApp().plater()->get_camera().get_target().cast<float>(); Vec3f target = wxGetApp().plater()->get_camera().get_target().cast<float>();
ImGui::InputFloat3("Target", target.data(), "%.3f", ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat3("Target", target.data(), "%.3f", ImGuiInputTextFlags_ReadOnly);
#endif // ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT #endif // ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
ImGui::Separator(); ImGui::Separator();
if (imgui.button(_(L("Close")))) if (imgui.button(_(L("Close"))))
@ -406,7 +385,6 @@ void Mouse3DController::render_settings_dialog(unsigned int canvas_width, unsign
canvas.set_as_dirty(); canvas.set_as_dirty();
} }
} }
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
imgui.end(); imgui.end();
} }

View file

@ -18,9 +18,7 @@ namespace Slic3r {
namespace GUI { namespace GUI {
struct Camera; struct Camera;
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
class GLCanvas3D; class GLCanvas3D;
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
class Mouse3DController class Mouse3DController
{ {
@ -143,13 +141,9 @@ class Mouse3DController
hid_device* m_device; hid_device* m_device;
std::string m_device_str; std::string m_device_str;
bool m_running; bool m_running;
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
mutable bool m_show_settings_dialog; mutable bool m_show_settings_dialog;
// set to true when ther user closes the dialog by clicking on [X] or [Close] buttons // set to true when ther user closes the dialog by clicking on [X] or [Close] buttons
mutable bool m_settings_dialog_closed_by_user; mutable bool m_settings_dialog_closed_by_user;
#else
bool m_show_settings_dialog;
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
std::chrono::time_point<std::chrono::high_resolution_clock> m_last_time; std::chrono::time_point<std::chrono::high_resolution_clock> m_last_time;
public: public:
@ -167,11 +161,7 @@ public:
bool is_settings_dialog_shown() const { return m_show_settings_dialog; } bool is_settings_dialog_shown() const { return m_show_settings_dialog; }
void show_settings_dialog(bool show) { m_show_settings_dialog = show && is_running(); } void show_settings_dialog(bool show) { m_show_settings_dialog = show && is_running(); }
#if ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
void render_settings_dialog(GLCanvas3D& canvas) const; void render_settings_dialog(GLCanvas3D& canvas) const;
#else
void render_settings_dialog(unsigned int canvas_width, unsigned int canvas_height) const;
#endif // ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG
private: private:
bool connect_device(); bool connect_device();