mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Use ImGui::TextColored()
This commit is contained in:
parent
18594261d2
commit
a29b00a0b4
5 changed files with 70 additions and 89 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue