mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-04-06 00:32:05 +02:00
Tool position window Fixes / Improvements (#12068)
* init * fix fold/unfold button direction * remove window border * remove unused icons * add scaling support * match libvgcode roles with orca terms * fix expanding table window * Update GCodeViewer.cpp * fix translation support * fix translations * fix imgui styles
This commit is contained in:
@@ -153,8 +153,8 @@ namespace ImGui
|
||||
// const wchar_t CustomSupportsMarker = 0x1D;
|
||||
// const wchar_t CustomSeamMarker = 0x1E;
|
||||
// const wchar_t MmuSegmentationMarker = 0x1F;
|
||||
const wchar_t HorizontalHide = 0xB1;
|
||||
const wchar_t HorizontalShow = 0xB2;
|
||||
//const wchar_t HorizontalHide = 0xB1; // ORCA use FoldButtonIcon / UnfoldButtonIcon
|
||||
//const wchar_t HorizontalShow = 0xB2;
|
||||
|
||||
// Do not forget use following letters only in wstring
|
||||
//BBS use 08xx to avoid unicode character which may be used
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
version="1.0"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 16 16"
|
||||
enable-background="new 0 0 16 16"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="hide_horizontal.svg"
|
||||
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs945">
|
||||
|
||||
|
||||
|
||||
</defs><sodipodi:namedview
|
||||
id="namedview943"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:pageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
showgrid="false"
|
||||
inkscape:zoom="50.75"
|
||||
inkscape:cx="7.9901478"
|
||||
inkscape:cy="8.0098522"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1001"
|
||||
inkscape:window-x="3191"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
<polygon
|
||||
fill="#009688"
|
||||
points="1,8 1,11 8,16 15,11 15,8 "
|
||||
style="stroke:none;stroke-width:1"
|
||||
id="polygon937"
|
||||
transform="translate(0,-4)" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
version="1.0"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 16 16"
|
||||
enable-background="new 0 0 16 16"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="show_horizontal.svg"
|
||||
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs1127">
|
||||
|
||||
|
||||
|
||||
</defs><sodipodi:namedview
|
||||
id="namedview1125"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:pageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
showgrid="false"
|
||||
inkscape:zoom="50.75"
|
||||
inkscape:cx="7.9901478"
|
||||
inkscape:cy="8.0098522"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1001"
|
||||
inkscape:window-x="3191"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
<polygon
|
||||
fill="#009688"
|
||||
points="15,7 15,5 8,0 1,5 1,7 1,8 15,8 "
|
||||
style="stroke:none;stroke-width:1"
|
||||
id="polygon1119"
|
||||
transform="translate(0,4)" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -157,7 +157,7 @@ int GCodeViewer::SequentialView::ActualSpeedImguiWidget::plot(const char* label,
|
||||
const float y0 = y_range.first;
|
||||
|
||||
const ImU32 grid_main_color = ImGui::GetColorU32(ImVec4(0.5f, 0.5f, 0.5f, 0.5f));
|
||||
const ImU32 grid_secondary_color = ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.5f, 0.5f));
|
||||
const ImU32 grid_secondary_color = ImGui::GetColorU32(ImVec4(0.0f, 150.f / 255.0f, 136.0f / 255.f, 0.5f)); // ORCA color with opacity
|
||||
|
||||
// horizontal levels
|
||||
for (const auto& [level, color] : levels) {
|
||||
@@ -177,7 +177,7 @@ int GCodeViewer::SequentialView::ActualSpeedImguiWidget::plot(const char* label,
|
||||
|
||||
// profiile
|
||||
const ImU32 col_base = ImGui::GetColorU32(ImVec4(0.8f, 0.8f, 0.8f, 1.0f));
|
||||
const ImU32 col_hovered = ImGui::GetColorU32(ImGuiCol_PlotLinesHovered);
|
||||
const ImU32 col_hovered = ImGui::GetColorU32(ImVec4(0.0f, 150.f / 255.0f, 136.0f / 255.f, 1.0f)); // ORCA color
|
||||
for (int n = 0; n < values_count - 1; ++n) {
|
||||
const ImVec2 tp1(ImSaturate((data[n].pos - x0) * inv_scale_x), 1.0f - ImSaturate((data[n].speed - y0) * inv_scale_y));
|
||||
const ImVec2 tp2(ImSaturate((data[n + 1].pos - x0) * inv_scale_x), 1.0f - ImSaturate((data[n + 1].speed - y0) * inv_scale_y));
|
||||
@@ -253,7 +253,7 @@ static std::string to_string(libvgcode::EMoveType type)
|
||||
case libvgcode::EMoveType::ToolChange: { return _u8L("Tool Change"); }
|
||||
case libvgcode::EMoveType::ColorChange: { return _u8L("Color Change"); }
|
||||
case libvgcode::EMoveType::PausePrint: { return _u8L("Pause Print"); }
|
||||
case libvgcode::EMoveType::CustomGCode: { return _u8L("Custom GCode"); }
|
||||
case libvgcode::EMoveType::CustomGCode: { return _u8L("Custom G-code"); }
|
||||
case libvgcode::EMoveType::Travel: { return _u8L("Travel"); }
|
||||
case libvgcode::EMoveType::Wipe: { return _u8L("Wipe"); }
|
||||
case libvgcode::EMoveType::Extrude: { return _u8L("Extrude"); }
|
||||
@@ -264,25 +264,25 @@ static std::string to_string(libvgcode::EMoveType type)
|
||||
static std::string to_string(libvgcode::EGCodeExtrusionRole role)
|
||||
{
|
||||
switch (role)
|
||||
{
|
||||
{ // ORCA matched terms
|
||||
case libvgcode::EGCodeExtrusionRole::None: { return _u8L("Unknown"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Perimeter: { return _u8L("Perimeter"); }
|
||||
case libvgcode::EGCodeExtrusionRole::ExternalPerimeter: { return _u8L("External perimeter"); }
|
||||
case libvgcode::EGCodeExtrusionRole::OverhangPerimeter: { return _u8L("Overhang perimeter"); }
|
||||
case libvgcode::EGCodeExtrusionRole::InternalInfill: { return _u8L("Internal infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::SolidInfill: { return _u8L("Solid infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::TopSolidInfill: { return _u8L("Top solid infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Perimeter: { return _u8L("Inner wall"); }
|
||||
case libvgcode::EGCodeExtrusionRole::ExternalPerimeter: { return _u8L("Outer wall"); }
|
||||
case libvgcode::EGCodeExtrusionRole::OverhangPerimeter: { return _u8L("Overhang wall"); }
|
||||
case libvgcode::EGCodeExtrusionRole::InternalInfill: { return _u8L("Sparse infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::SolidInfill: { return _u8L("Internal solid infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::TopSolidInfill: { return _u8L("Top surface"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Ironing: { return _u8L("Ironing"); }
|
||||
case libvgcode::EGCodeExtrusionRole::BridgeInfill: { return _u8L("Bridge infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::GapFill: { return _u8L("Gap fill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Skirt: { return _u8L("Skirt"); } // ORCA
|
||||
case libvgcode::EGCodeExtrusionRole::SupportMaterial: { return _u8L("Support material"); }
|
||||
case libvgcode::EGCodeExtrusionRole::SupportMaterialInterface: { return _u8L("Support material interface"); }
|
||||
case libvgcode::EGCodeExtrusionRole::WipeTower: { return _u8L("Wipe tower"); }
|
||||
case libvgcode::EGCodeExtrusionRole::BridgeInfill: { return _u8L("Bridge"); }
|
||||
case libvgcode::EGCodeExtrusionRole::GapFill: { return _u8L("Gap infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Skirt: { return _u8L("Skirt"); }
|
||||
case libvgcode::EGCodeExtrusionRole::SupportMaterial: { return _u8L("Support"); }
|
||||
case libvgcode::EGCodeExtrusionRole::SupportMaterialInterface: { return _u8L("Support interface"); }
|
||||
case libvgcode::EGCodeExtrusionRole::WipeTower: { return _u8L("Prime tower"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Custom: { return _u8L("Custom"); }
|
||||
// ORCA
|
||||
case libvgcode::EGCodeExtrusionRole::BottomSurface: { return _u8L("Bottom surface"); }
|
||||
case libvgcode::EGCodeExtrusionRole::InternalBridgeInfill: { return _u8L("Internal bridge infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::InternalBridgeInfill: { return _u8L("Internal bridge"); } // ORCA
|
||||
case libvgcode::EGCodeExtrusionRole::Brim: { return _u8L("Brim"); }
|
||||
case libvgcode::EGCodeExtrusionRole::SupportTransition: { return _u8L("Support transition"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Mixed: { return _u8L("Mixed"); }
|
||||
@@ -306,7 +306,10 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImGuiWrapper::COL_BUTTON_BACKGROUND);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGuiWrapper::COL_BUTTON_ACTIVE);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGuiWrapper::COL_BUTTON_HOVERED);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Border , ImVec4(.0f,.0f,.0f,.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Separator, ImVec4(1.f,1.f,1.f,.6f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f * m_scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding , ImVec2(10.f, 10.f) * m_scale);
|
||||
ImGui::SetNextWindowBgAlpha(0.8f);
|
||||
imgui.begin(std::string("ToolPosition"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove);
|
||||
ImGui::AlignTextToFramePadding();
|
||||
@@ -319,77 +322,7 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
||||
vertex = viewer->get_vertex_at(vertex_id);
|
||||
}
|
||||
|
||||
const bool is_extrusion = vertex.is_extrusion();
|
||||
char buf[1024]; char valBuf[32];
|
||||
sprintf(buf, "X: %.3f, Y: %.3f, Z: %.3f Speed: %.0f ", vertex.position[0], vertex.position[1], vertex.position[2], vertex.feedrate);
|
||||
switch (view_type) {
|
||||
case libvgcode::EViewType::Height: {
|
||||
if (is_extrusion)
|
||||
sprintf(valBuf, "%.2f", vertex.height);
|
||||
else
|
||||
sprintf(valBuf, "%s", NA_CSTR);
|
||||
sprintf(buf, "%s %s%s", buf, _u8L("Height: ").c_str(), valBuf);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::Width: {
|
||||
if (is_extrusion)
|
||||
sprintf(valBuf, "%.2f", vertex.width);
|
||||
else
|
||||
sprintf(valBuf, "%s", NA_CSTR);
|
||||
sprintf(buf, "%s %s%s", buf, _u8L("Width: ").c_str(), valBuf);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::VolumetricFlowRate: {
|
||||
if (is_extrusion)
|
||||
sprintf(valBuf, "%.2f", vertex.volumetric_rate());
|
||||
else
|
||||
sprintf(valBuf, "%s", NA_CSTR);
|
||||
sprintf(buf, "%s %s%s", buf, _u8L("Flow: ").c_str(), valBuf);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::FanSpeed: {
|
||||
sprintf(buf, "%s %s%.0f", buf, _u8L("Fan: ").c_str(), vertex.fan_speed);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::Temperature: {
|
||||
sprintf(buf, "%s %s%.0f", buf, _u8L("Temperature: ").c_str(), vertex.temperature);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::LayerTimeLinear:
|
||||
case libvgcode::EViewType::LayerTimeLogarithmic: {
|
||||
sprintf(buf, "%s %s%.1f", buf, _u8L("Layer Time: ").c_str(), vertex.layer_duration);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::Tool: {
|
||||
sprintf(buf, "%s %s%d", buf, _u8L("Tool: ").c_str(), vertex.extruder_id + 1);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::ColorPrint: {
|
||||
sprintf(buf, "%s %s%d", buf, _u8L("Color: ").c_str(), vertex.color_id + 1);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::ActualVolumetricFlowRate: {
|
||||
// Don't display the actual flow, since it only gives data for the end of a segment
|
||||
// sprintf(buf, "%s %s%.2f", buf, _u8L("Actual Flow: ").c_str(), vertex.actual_volumetric_rate());
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::ActualSpeed: {
|
||||
sprintf(buf, "%s %s%.1f", buf, _u8L("Actual Speed: ").c_str(), vertex.actual_feedrate);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ImGuiWrapper::text(std::string(buf));
|
||||
if (view_type == libvgcode::EViewType::FeatureType) {
|
||||
ImGui::SameLine();
|
||||
ImGuiWrapper::text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, vertex.is_extrusion() ? to_string(vertex.role).c_str() : NA_CSTR);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (imgui.image_button(properties_shown ? ImGui::HorizontalHide : ImGui::HorizontalShow, properties_shown ? _u8L("Hide properties") : _u8L("Show properties"))) {
|
||||
properties_shown = !properties_shown;
|
||||
}
|
||||
// ORCA Moved position and information to bottom
|
||||
|
||||
if (properties_shown) {
|
||||
auto append_table_row = [](const std::string& label, std::function<void(void)> value_callback) {
|
||||
@@ -400,14 +333,14 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
||||
value_callback();
|
||||
};
|
||||
|
||||
ImGui::Separator();
|
||||
//ImGui::Separator();
|
||||
if (ImGui::BeginTable("Properties", 2)) {
|
||||
char buff[1024];
|
||||
|
||||
append_table_row(_u8L("Type"), [&vertex]() {
|
||||
ImGuiWrapper::text(_u8L(to_string(vertex.type)));
|
||||
});
|
||||
append_table_row(_u8L("Feature type"), [&vertex, NA_TXT]() {
|
||||
append_table_row(_u8L("Line Type"), [&vertex, NA_TXT]() {
|
||||
std::string text;
|
||||
if (vertex.is_extrusion())
|
||||
text = _u8L(to_string(vertex.role));
|
||||
@@ -415,20 +348,20 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
||||
text = NA_TXT;
|
||||
ImGuiWrapper::text(text);
|
||||
});
|
||||
append_table_row(_u8L("Width") + " (" + _u8L("mm") + ")", [&vertex, &buff, NA_TXT]() {
|
||||
append_table_row(_u8L("Width"), [&vertex, &buff, NA_TXT]() {
|
||||
std::string text;
|
||||
if (vertex.is_extrusion()) {
|
||||
sprintf(buff, "%.3f", vertex.width);
|
||||
sprintf(buff, ("%.3f " + _u8L("mm")).c_str(), vertex.width);
|
||||
text = std::string(buff);
|
||||
}
|
||||
else
|
||||
text = NA_TXT;
|
||||
ImGuiWrapper::text(text);
|
||||
});
|
||||
append_table_row(_u8L("Height") + " (" + _u8L("mm") + ")", [&vertex, &buff, NA_TXT]() {
|
||||
append_table_row(_u8L("Height"), [&vertex, &buff, NA_TXT]() {
|
||||
std::string text;
|
||||
if (vertex.is_extrusion()) {
|
||||
sprintf(buff, "%.3f", vertex.height);
|
||||
sprintf(buff, ("%.3f " + _u8L("mm")).c_str(), vertex.height);
|
||||
text = std::string(buff);
|
||||
}
|
||||
else
|
||||
@@ -440,28 +373,28 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
||||
const std::string text = std::string(buff);
|
||||
ImGuiWrapper::text(text);
|
||||
});
|
||||
append_table_row(_u8L("Speed") + " (" + _u8L("mm/s") + ")", [&vertex, &buff]() {
|
||||
sprintf(buff, "%.1f", vertex.feedrate);
|
||||
append_table_row(_u8L("Speed"), [&vertex, &buff]() {
|
||||
sprintf(buff, ("%.1f " + _u8L("mm/s")).c_str(), vertex.feedrate);
|
||||
const std::string text = std::string(buff);
|
||||
ImGuiWrapper::text(text);
|
||||
});
|
||||
append_table_row(_u8L("Volumetric flow rate") + " (" + _u8L("mm³/s") + ")", [&vertex, &buff, NA_TXT]() {
|
||||
append_table_row(_u8L("Flow rate"), [&vertex, &buff, NA_TXT]() { // ORCA use "Flow rate" instead "Volumetric flow Rate" to make window more compact
|
||||
std::string text;
|
||||
if (vertex.is_extrusion()) {
|
||||
sprintf(buff, "%.3f", vertex.volumetric_rate());
|
||||
sprintf(buff, ("%.3f " + _u8L("mm³/s")).c_str(), vertex.volumetric_rate());
|
||||
text = std::string(buff);
|
||||
}
|
||||
else
|
||||
text = NA_TXT;
|
||||
ImGuiWrapper::text(text);
|
||||
});
|
||||
append_table_row(_u8L("Fan speed") + " (" + _u8L("%") + ")", [&vertex, &buff]() {
|
||||
sprintf(buff, "%.0f", vertex.fan_speed);
|
||||
append_table_row(_u8L("Fan speed"), [&vertex, &buff]() {
|
||||
sprintf(buff, "%.0f %%", vertex.fan_speed);
|
||||
const std::string text = std::string(buff);
|
||||
ImGuiWrapper::text(text);
|
||||
});
|
||||
append_table_row(_u8L("Temperature") + " (" + _u8L("°C") + ")", [&vertex, &buff]() {
|
||||
sprintf(buff, "%.0f", vertex.temperature);
|
||||
append_table_row(_u8L("Temperature"), [&vertex, &buff]() {
|
||||
sprintf(buff, ("%.0f " + _u8L("°C")).c_str(), vertex.temperature);
|
||||
ImGuiWrapper::text(std::string(buff));
|
||||
});
|
||||
append_table_row(_u8L("Time"), [viewer, &vertex, &buff, vertex_id]() {
|
||||
@@ -475,35 +408,52 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
||||
}
|
||||
|
||||
#if ENABLE_ACTUAL_SPEED_DEBUG
|
||||
if (vertex.is_extrusion() || vertex.is_travel() || vertex.is_wipe()) {
|
||||
bool actual_speed_exist = vertex.is_extrusion() || vertex.is_travel() || vertex.is_wipe();
|
||||
//if (vertex.is_extrusion() || vertex.is_travel() || vertex.is_wipe()) { // ORCA always show button to keep properties on same place
|
||||
ImGui::Spacing();
|
||||
ImGuiWrapper::text(_u8L("Actual speed profile"));
|
||||
ImGui::SameLine();
|
||||
//ImGuiWrapper::text(_u8L("Actual speed profile"));
|
||||
//ImGui::SameLine();
|
||||
|
||||
static bool table_shown = false;
|
||||
if (imgui.button(table_shown ? _u8L("Hide table") : _u8L("Show table")))
|
||||
imgui.push_confirm_button_style();
|
||||
const float table_btn_width = std::max(ImGui::CalcTextSize(_u8L("Hide").c_str()).x, ImGui::CalcTextSize(_u8L("Show").c_str()).x);
|
||||
float btn_padding_x = 8.0f * m_scale;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding , 3.f * m_scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding , ImVec2(btn_padding_x, 3.f * m_scale));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(.5f, .5f));
|
||||
if (imgui.button((table_shown ? _L("Hide") : _L("Show")).c_str(), ImVec2(table_btn_width + btn_padding_x * 2.f, 0.f), actual_speed_exist))
|
||||
table_shown = !table_shown;
|
||||
ImGui::Separator();
|
||||
const int hover_id = m_actual_speed_imgui_widget.plot("##ActualSpeedProfile", { -1.0f, 150.0f });
|
||||
if (table_shown) {
|
||||
ImGui::PopStyleVar(3);
|
||||
imgui.pop_confirm_button_style();
|
||||
ImGui::SameLine();
|
||||
ImGuiWrapper::text(_u8L("Actual speed profile").c_str()); // ORCA show label and plot on external window to make main window more compact
|
||||
|
||||
//ImGui::Separator();
|
||||
//const int hover_id = m_actual_speed_imgui_widget.plot("##ActualSpeedProfile", { -1.0f, 150.0f });
|
||||
if (actual_speed_exist && table_shown) {
|
||||
static float table_wnd_height = 0.0f;
|
||||
const ImVec2 wnd_size = ImGui::GetWindowSize();
|
||||
imgui.set_next_window_pos(ImGui::GetWindowPos().x + wnd_size.x, static_cast<float>(canvas_height), ImGuiCond_Always, 0.0f, 1.0f);
|
||||
ImGui::SetNextWindowSizeConstraints({ 0.0f, 0.0f }, { -1.0f, wnd_size.y });
|
||||
//const ImVec2 wnd_size = ImGui::GetWindowSize();
|
||||
imgui.set_next_window_pos(ImGui::GetWindowPos().x - 5.f * m_scale /*+ wnd_size.x*/, static_cast<float>(canvas_height), ImGuiCond_Always, 1.0f, 1.0f);
|
||||
//ImGui::SetNextWindowSizeConstraints({ 0.0f, 0.0f }, { -1.0f, wnd_size.y });
|
||||
imgui.begin(std::string("ToolPositionTableWnd"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar |
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove);
|
||||
if (ImGui::BeginTable("ToolPositionTable", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY)) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(9.f, 1.f) * m_scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.f, 0.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered , ImGui::GetStyle().Colors[ImGuiCol_TableHeaderBg]);
|
||||
const int hover_id = m_actual_speed_imgui_widget.plot("##ActualSpeedProfile", { -1.f, 135.f * m_scale});
|
||||
if (ImGui::BeginTable("ToolPositionTable", 2, ImGuiTableFlags_Borders /*| ImGuiTableFlags_ScrollY*/)) { // ORCA showing scrollbar causes expanding window
|
||||
char buff[1024];
|
||||
ImGui::TableSetupScrollFreeze(0, 1); // Make top row always visible
|
||||
ImGui::TableSetupColumn("Position (mm)");
|
||||
ImGui::TableSetupColumn("Speed (mm/s)");
|
||||
//ImGui::TableSetupScrollFreeze(0, 1); // Make top row always visible
|
||||
ImGui::TableSetupColumn((_u8L("Position") + " (" + _u8L("mm") + ")").c_str());
|
||||
ImGui::TableSetupColumn((_u8L("Speed") + " (" + _u8L("mm/s") + ")").c_str());
|
||||
ImGui::TableHeadersRow();
|
||||
int counter = 0;
|
||||
for (const ActualSpeedImguiWidget::Item& item : m_actual_speed_imgui_widget.data) {
|
||||
const bool highlight = hover_id >= 0 && (counter == hover_id || counter == hover_id + 1);
|
||||
if (highlight && counter == hover_id)
|
||||
ImGui::SetScrollHereY();
|
||||
//if (highlight && counter == hover_id)
|
||||
// ImGui::SetScrollHereY();
|
||||
ImGui::TableNextRow();
|
||||
const ImU32 row_bg_color = ImGui::GetColorU32(item.internal ? ImVec4(0.0f, 0.0f, 0.5f, 0.25f) : ImVec4(0.5f, 0.5f, 0.5f, 0.25f));
|
||||
const ImU32 row_bg_color = ImGui::GetColorU32(item.internal ? ImVec4(0.0f, 150.f / 255.0f, 136.0f / 255.f, 0.15f) : ImVec4(0.2f, 0.2f, 0.2f, 0.25f)); // ORCA
|
||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, row_bg_color);
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
sprintf(buff, "%.3f", item.pos);
|
||||
@@ -513,8 +463,18 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
||||
imgui.text_colored(highlight ? ImGuiWrapper::COL_ORCA : ImGuiWrapper::to_ImVec4(ColorRGBA::WHITE()), buff);
|
||||
++counter;
|
||||
}
|
||||
|
||||
// ORCA add blank rows to keep plot in same place. row count can be 9 but mostly it shows between 3 to 5
|
||||
for (int id = 7 - counter; id > 0; --id) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
imgui.text_colored(ImVec4(0.f, 0.f, 0.f, 0.f), "f");
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopStyleColor(1);
|
||||
const float curr_table_wnd_height = ImGui::GetWindowHeight();
|
||||
if (table_wnd_height != curr_table_wnd_height) {
|
||||
table_wnd_height = curr_table_wnd_height;
|
||||
@@ -523,46 +483,192 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode
|
||||
}
|
||||
imgui.end();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ENABLE_ACTUAL_SPEED_DEBUG
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
ImGui::Dummy({0, ImGui::GetStyle().FramePadding.y});
|
||||
}
|
||||
|
||||
// force extra frame to automatically update window size
|
||||
const float width = ImGui::GetWindowWidth();
|
||||
const size_t length = strlen(buf);
|
||||
if (width != last_window_width || length != last_text_length) {
|
||||
last_window_width = width;
|
||||
last_text_length = length;
|
||||
imgui.set_requires_extra_frame();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding , 3.f * m_scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(.5f, .5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button , ImVec4(0, 0, 0, 0));
|
||||
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));
|
||||
|
||||
const float main_wnd_height = ImGui::GetWindowHeight();
|
||||
if (ImGui::Button(into_u8(properties_shown ? ImGui::UnfoldButtonIcon : ImGui::FoldButtonIcon).c_str(), ImVec2(24.f, 24.f) * m_scale)) {
|
||||
properties_shown = !properties_shown;
|
||||
static float main_wnd_height_temp = ImGui::GetWindowHeight();
|
||||
static float first_click = true;
|
||||
if (first_click || main_wnd_height_temp != main_wnd_height) {
|
||||
main_wnd_height_temp = main_wnd_height;
|
||||
first_click = false;
|
||||
imgui.set_requires_extra_frame();
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleColor(3);
|
||||
ImGui::PopStyleVar(2);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - ImGui::GetStyle().FramePadding.y); // aligns button with next group
|
||||
|
||||
ImGui::BeginGroup(); // group contents to make information area more compact
|
||||
|
||||
// ORCA Use colorized axes labels & reduce precision on big scaled prints
|
||||
auto pos =vertex.position;
|
||||
int max_value = std::round(std::max(std::max(pos[0], pos[1]),pos[2]));
|
||||
auto precision = max_value > 9999 ? "%.1f" : max_value > 999 ? "%.2f" : "%.3f";
|
||||
const float axes_width = ImGui::CalcTextSize("X 999.999sp").x;
|
||||
|
||||
char xBuf[32];
|
||||
ImGui::TextColored(ImGuiWrapper::to_ImVec4(ColorRGBA::X()),"X ");
|
||||
ImGui::SameLine(0,0); // ignore item spacing
|
||||
sprintf(xBuf, precision, pos[0]);
|
||||
ImGui::Text("%s", xBuf);
|
||||
|
||||
char yBuf[32];
|
||||
ImGui::SameLine(axes_width);
|
||||
ImGui::TextColored(ImGuiWrapper::to_ImVec4(ColorRGBA::Y()),"Y ");
|
||||
ImGui::SameLine(0,0); // ignore item spacing
|
||||
sprintf(yBuf, precision, pos[1]);
|
||||
ImGui::Text("%s", yBuf);
|
||||
|
||||
char zBuf[32];
|
||||
ImGui::SameLine(axes_width * 2);
|
||||
ImGui::TextColored(ImGuiWrapper::to_ImVec4(ColorRGBA::Z()),"Z ");
|
||||
ImGui::SameLine(0,0); // ignore item spacing
|
||||
sprintf(zBuf, precision, pos[2]);
|
||||
ImGui::Text("%s", zBuf);
|
||||
|
||||
ImGui::SameLine(axes_width * 3);
|
||||
ImGui::Dummy({0,0});
|
||||
|
||||
const bool is_extrusion = vertex.is_extrusion();
|
||||
char buf[1024]; char valBuf[32]; char spdBuf[128];
|
||||
sprintf(spdBuf, "%s%.0f ", _u8L("Speed: ").c_str(), vertex.feedrate);
|
||||
const float speed_width = ImGui::CalcTextSize((_u8L("Speed: ") + "9999 ").c_str()).x;
|
||||
ImGuiWrapper::text(std::string(spdBuf)); // render Speed as differrent item to keep next item in same place
|
||||
switch (view_type) {
|
||||
case libvgcode::EViewType::Height: {
|
||||
if (is_extrusion)
|
||||
sprintf(valBuf, "%.2f", vertex.height);
|
||||
else
|
||||
sprintf(valBuf, "%s", NA_CSTR);
|
||||
sprintf(buf, "%s %s%s", buf, _u8L("Height: ").c_str(), valBuf);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::Width: {
|
||||
if (is_extrusion)
|
||||
sprintf(valBuf, "%.2f", vertex.width);
|
||||
else
|
||||
sprintf(valBuf, "%s", NA_CSTR);
|
||||
sprintf(buf, "%s %s%s", buf, _u8L("Width: ").c_str(), valBuf);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::VolumetricFlowRate: {
|
||||
if (is_extrusion)
|
||||
sprintf(valBuf, "%.2f", vertex.volumetric_rate());
|
||||
else
|
||||
sprintf(valBuf, "%s", NA_CSTR);
|
||||
sprintf(buf, "%s %s%s", buf, _u8L("Flow: ").c_str(), valBuf);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::FanSpeed: {
|
||||
sprintf(buf, "%s %s%.0f", buf, _u8L("Fan: ").c_str(), vertex.fan_speed);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::Temperature: {
|
||||
sprintf(buf, "%s %s%.0f", buf, _u8L("Temperature: ").c_str(), vertex.temperature);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::LayerTimeLinear:
|
||||
case libvgcode::EViewType::LayerTimeLogarithmic: {
|
||||
sprintf(buf, "%s %s%.1f", buf, _u8L("Layer Time: ").c_str(), vertex.layer_duration);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::Tool: {
|
||||
sprintf(buf, "%s %s%d", buf, _u8L("Tool: ").c_str(), vertex.extruder_id + 1);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::ColorPrint: {
|
||||
sprintf(buf, "%s %s%d", buf, _u8L("Color: ").c_str(), vertex.color_id + 1);
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::ActualVolumetricFlowRate: {
|
||||
// Don't display the actual flow, since it only gives data for the end of a segment
|
||||
// sprintf(buf, "%s %s%.2f", buf, _u8L("Actual Flow: ").c_str(), vertex.actual_volumetric_rate());
|
||||
break;
|
||||
}
|
||||
case libvgcode::EViewType::ActualSpeed: {
|
||||
sprintf(buf, "%s %s%.1f", buf, _u8L("Actual Speed: ").c_str(), vertex.actual_feedrate);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ImGui::SameLine(speed_width);
|
||||
if (view_type == libvgcode::EViewType::FeatureType) {
|
||||
ImGuiWrapper::text(vertex.is_extrusion() ? to_string(vertex.role).c_str() : NA_CSTR);
|
||||
}
|
||||
else {
|
||||
ImGuiWrapper::text(std::string(buf));
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
imgui.end();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor(5);
|
||||
ImGui::PopStyleVar(2);
|
||||
}
|
||||
else {
|
||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||
const Size cnv_size = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size();
|
||||
imgui.set_next_window_pos(0.5f * static_cast<float>(cnv_size.get_width()), static_cast<float>(cnv_size.get_height()), ImGuiCond_Always, 0.5f, 1.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
//const Size cnv_size = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size();
|
||||
//imgui.set_next_window_pos(0.5f * static_cast<float>(cnv_size.get_width()), static_cast<float>(cnv_size.get_height()), ImGuiCond_Always, 0.5f, 1.0f);
|
||||
imgui.set_next_window_pos(0.5f * static_cast<float>(canvas_width), static_cast<float>(canvas_height), ImGuiCond_Always, 0.5f, 1.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Border , ImVec4(.0f,.0f,.0f,.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Separator, ImVec4(1.f,1.f,1.f,.6f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f * m_scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding , ImVec2(10.f, 10.f) * m_scale);
|
||||
ImGui::SetNextWindowBgAlpha(0.8f);
|
||||
imgui.begin(std::string("ToolPosition"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove);
|
||||
imgui.text_colored(ImGuiWrapper::COL_ORCA, _u8L("Tool position") + ":");
|
||||
ImGui::SameLine();
|
||||
char buf[1024];
|
||||
const Vec3f position = m_world_position + m_world_offset + m_z_offset * Vec3f::UnitZ();
|
||||
sprintf(buf, "X: %.3f, Y: %.3f, Z: %.3f", position.x(), position.y(), position.z());
|
||||
ImGuiWrapper::text(std::string(buf));
|
||||
|
||||
// force extra frame to automatically update window size
|
||||
const float width = ImGui::GetWindowWidth();
|
||||
const size_t length = strlen(buf);
|
||||
if (width != last_window_width || length != last_text_length) {
|
||||
last_window_width = width;
|
||||
last_text_length = length;
|
||||
imgui.set_requires_extra_frame();
|
||||
}
|
||||
const Vec3f pos = m_world_position + m_world_offset + m_z_offset * Vec3f::UnitZ();
|
||||
|
||||
int max_value = std::round(std::max(std::max(pos.x(), pos.y()),pos.z()));
|
||||
auto precision = max_value > 9999 ? "%.1f" : max_value > 999 ? "%.2f" : "%.3f";
|
||||
const float axes_width = ImGui::CalcTextSize("X 999.999sp").x;
|
||||
|
||||
char xBuf[32];
|
||||
ImGui::TextColored(ImGuiWrapper::to_ImVec4(ColorRGBA::X()),"X ");
|
||||
ImGui::SameLine(0,0); // ignore item spacing
|
||||
sprintf(xBuf, precision, pos.x());
|
||||
ImGui::Text("%s", xBuf);
|
||||
|
||||
char yBuf[32];
|
||||
ImGui::SameLine(axes_width);
|
||||
ImGui::TextColored(ImGuiWrapper::to_ImVec4(ColorRGBA::Y()),"Y ");
|
||||
ImGui::SameLine(0,0); // ignore item spacing
|
||||
sprintf(yBuf, precision, pos.y());
|
||||
ImGui::Text("%s", yBuf);
|
||||
|
||||
char zBuf[32];
|
||||
ImGui::SameLine(axes_width * 2);
|
||||
ImGui::TextColored(ImGuiWrapper::to_ImVec4(ColorRGBA::Z()),"Z ");
|
||||
ImGui::SameLine(0,0); // ignore item spacing
|
||||
sprintf(zBuf, precision, pos.z());
|
||||
ImGui::Text("%s", zBuf);
|
||||
|
||||
ImGui::SameLine(axes_width * 3);
|
||||
ImGui::Dummy({0,0});
|
||||
|
||||
imgui.end();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor(2);
|
||||
ImGui::PopStyleVar(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,8 +100,8 @@ static const std::map<const wchar_t, std::string> font_icons = {
|
||||
{ImGui::CollapseBtn , "collapse_btn" },
|
||||
{ImGui::RevertBtn , "revert_btn" },
|
||||
|
||||
{ImGui::HorizontalHide , "horizontal_hide" },
|
||||
{ImGui::HorizontalShow , "horizontal_show" },
|
||||
//{ImGui::HorizontalHide , "horizontal_hide" }, // ORCA use ExpandBtn / CollapseBtn
|
||||
//{ImGui::HorizontalShow , "horizontal_show" },
|
||||
|
||||
{ImGui::CloseBlockNotifButton , "block_notification_close" },
|
||||
{ImGui::CloseBlockNotifHoverButton , "block_notification_close_hover" },
|
||||
@@ -2598,18 +2598,18 @@ void ImGuiWrapper::pop_common_window_style() {
|
||||
|
||||
void ImGuiWrapper::push_confirm_button_style() {
|
||||
if (m_is_dark_mode) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f / 255.f, 150.f / 255.f, 136.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, to_ImVec4(decode_color_to_float_array("#00675b")));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f / 255.f, 150.f / 255.f, 136.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, to_ImVec4(decode_color_to_float_array("#267E73")));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(27.f / 255.f, 136.f / 255.f, 68.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, to_ImVec4(decode_color_to_float_array("#008172")));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, to_ImVec4(decode_color_to_float_array("#00675b")));
|
||||
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, 150.f / 255.f, 136.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, to_ImVec4(decode_color_to_float_array("#009688")));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f / 255.f, 150.f / 255.f, 136.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, to_ImVec4(decode_color_to_float_array("#26A69A")));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(27.f / 255.f, 136.f / 255.f, 68.f / 255.f, 1.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, to_ImVec4(decode_color_to_float_array("#009688")));
|
||||
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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user