mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
NEW:add Gizmo text menu
Change-Id: Ie5a5793e4d852188af60b40dfd6a9072727cf3d0
This commit is contained in:
parent
cf1ed35011
commit
ea4651e70e
13 changed files with 215 additions and 34 deletions
3
resources/images/text_B.svg
Normal file
3
resources/images/text_B.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.676 10.236C12.588 10.604 13.044 11.268 13.044 12.228C13.044 13.028 12.744 13.656 12.144 14.112C11.544 14.56 10.72 14.784 9.672 14.784H6V6H9.372C10.316 6 11.092 6.212 11.7 6.636C12.308 7.06 12.612 7.676 12.612 8.484C12.612 9.268 12.3 9.852 11.676 10.236ZM8.004 7.764V9.492H9.204C9.596 9.492 9.908 9.408 10.14 9.24C10.372 9.072 10.488 8.848 10.488 8.568C10.488 8.304 10.376 8.104 10.152 7.968C9.928 7.832 9.612 7.764 9.204 7.764H8.004ZM9.552 13.008C9.984 13.008 10.32 12.932 10.56 12.78C10.8 12.62 10.92 12.396 10.92 12.108C10.92 11.82 10.796 11.596 10.548 11.436C10.308 11.268 9.972 11.184 9.54 11.184H8.004V13.008H9.552Z" fill="#262E30"/>
|
||||
</svg>
|
After Width: | Height: | Size: 755 B |
4
resources/images/text_B_hover.svg
Normal file
4
resources/images/text_B_hover.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="20" height="20" rx="2" fill="#EEEEEE"/>
|
||||
<path d="M12.2195 10.0622C13.1315 10.4302 13.5875 11.0942 13.5875 12.0542C13.5875 12.8542 13.2875 13.4822 12.6875 13.9382C12.0875 14.3862 11.2635 14.6102 10.2155 14.6102H6.54346V5.82617H9.91546C10.8595 5.82617 11.6355 6.03817 12.2435 6.46217C12.8515 6.88617 13.1555 7.50217 13.1555 8.31017C13.1555 9.09417 12.8435 9.67817 12.2195 10.0622ZM8.54746 7.59017V9.31817H9.74746C10.1395 9.31817 10.4515 9.23417 10.6835 9.06617C10.9155 8.89817 11.0315 8.67417 11.0315 8.39417C11.0315 8.13017 10.9195 7.93017 10.6955 7.79417C10.4715 7.65817 10.1555 7.59017 9.74746 7.59017H8.54746ZM10.0955 12.8342C10.5275 12.8342 10.8635 12.7582 11.1035 12.6062C11.3435 12.4462 11.4635 12.2222 11.4635 11.9342C11.4635 11.6462 11.3395 11.4222 11.0915 11.2622C10.8515 11.0942 10.5155 11.0102 10.0835 11.0102H8.54746V12.8342H10.0955Z" fill="#262E30"/>
|
||||
</svg>
|
After Width: | Height: | Size: 979 B |
4
resources/images/text_B_press.svg
Normal file
4
resources/images/text_B_press.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="0.5" y="0.5" width="19" height="19" rx="1.5" fill="#DBFDE7" stroke="#00AE42"/>
|
||||
<path d="M12.2195 9.236C13.1315 9.604 13.5875 10.268 13.5875 11.228C13.5875 12.028 13.2875 12.656 12.6875 13.112C12.0875 13.56 11.2635 13.784 10.2155 13.784H6.54346V5H9.91546C10.8595 5 11.6355 5.212 12.2435 5.636C12.8515 6.06 13.1555 6.676 13.1555 7.484C13.1555 8.268 12.8435 8.852 12.2195 9.236ZM8.54746 6.764V8.492H9.74746C10.1395 8.492 10.4515 8.408 10.6835 8.24C10.9155 8.072 11.0315 7.848 11.0315 7.568C11.0315 7.304 10.9195 7.104 10.6955 6.968C10.4715 6.832 10.1555 6.764 9.74746 6.764H8.54746ZM10.0955 12.008C10.5275 12.008 10.8635 11.932 11.1035 11.78C11.3435 11.62 11.4635 11.396 11.4635 11.108C11.4635 10.82 11.3395 10.596 11.0915 10.436C10.8515 10.268 10.5155 10.184 10.0835 10.184H8.54746V12.008H10.0955Z" fill="#262E30"/>
|
||||
</svg>
|
After Width: | Height: | Size: 926 B |
4
resources/images/text_T.svg
Normal file
4
resources/images/text_T.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M9.29796 6H10.298L7.86755 14.5945H6.86755L9.29796 6Z" fill="#262E30"/>
|
||||
<path d="M6.38243 6H13.3824L13 6.91839H6L6.38243 6Z" fill="#262E30"/>
|
||||
</svg>
|
After Width: | Height: | Size: 253 B |
5
resources/images/text_T_hover.svg
Normal file
5
resources/images/text_T_hover.svg
Normal file
|
@ -0,0 +1,5 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="20" height="20" rx="2" fill="#EEEEEE"/>
|
||||
<path d="M9.29796 6H10.298L7.86755 14.5945H6.86755L9.29796 6Z" fill="#262E30"/>
|
||||
<path d="M6.38243 6H13.3824L13 6.91839H6L6.38243 6Z" fill="#262E30"/>
|
||||
</svg>
|
After Width: | Height: | Size: 306 B |
5
resources/images/text_T_press.svg
Normal file
5
resources/images/text_T_press.svg
Normal file
|
@ -0,0 +1,5 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="0.5" y="0.5" width="19" height="19" rx="1.5" fill="#DBFDE7" stroke="#00AE42"/>
|
||||
<path d="M10.298 5.2832H11.298L8.86755 13.8777H7.86755L10.298 5.2832Z" fill="#262E30"/>
|
||||
<path d="M7.38243 5.2832H14.3824L14 6.20159H7L7.38243 5.2832Z" fill="#262E30"/>
|
||||
</svg>
|
After Width: | Height: | Size: 359 B |
|
@ -491,6 +491,7 @@ namespace ImGui
|
|||
IMGUI_API bool ImageButton2(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec2& margin = ImVec2(0, 0)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
||||
IMGUI_API bool ImageTextButton(const ImVec2& button_size, const char* text, ImTextureID user_texture_id, const ImVec2& image_size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec2& margin = ImVec2(0, 0));
|
||||
IMGUI_API bool ImageButton3(ImTextureID user_texture_id,ImTextureID user_texture_id_hover, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec2& margin = ImVec2(0, 0)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
||||
IMGUI_API bool BBLImageButton(ImTextureID user_texture_id,ImTextureID user_texture_id_hover,ImTextureID user_texture_id_press, const ImVec2& size, bool &value, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec2& margin = ImVec2(0, 0)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
||||
IMGUI_API bool Checkbox(const char* label, bool* v);
|
||||
IMGUI_API bool BBLCheckbox(const char* label, bool* v);
|
||||
IMGUI_API bool CheckboxFlags(const char* label, int* flags, int flags_value);
|
||||
|
|
|
@ -2554,6 +2554,7 @@ namespace ImGui
|
|||
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col);
|
||||
IMGUI_API bool ImageButtonEx2(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col, const ImVec2& margin);
|
||||
IMGUI_API bool ImageButtonEx3(ImGuiID id, ImTextureID texture_id,ImTextureID texture_id_hover, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col, const ImVec2& margin);
|
||||
IMGUI_API bool BBLImageButtonEx(ImGuiID id, ImTextureID texture_id,ImTextureID texture_id_hover,ImTextureID texture_id_press, const ImVec2& size, bool &value, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col, const ImVec2& margin);
|
||||
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
||||
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
||||
IMGUI_API ImGuiID GetWindowResizeCornerID(ImGuiWindow* window, int n); // 0..3: corners
|
||||
|
|
|
@ -1205,6 +1205,40 @@ bool ImGui::ImageButtonEx3(ImGuiID id,ImTextureID texture_id,ImTextureID tex
|
|||
return pressed;
|
||||
}
|
||||
|
||||
bool ImGui::BBLImageButtonEx(ImGuiID id,ImTextureID texture_id,ImTextureID texture_id_hover, ImTextureID texture_id_press, const ImVec2 &size, bool &value,const ImVec2 &uv0,const ImVec2 &uv1,const ImVec2 &padding,const ImVec4 &bg_col,const ImVec4 &tint_col,const ImVec2 &margin)
|
||||
{
|
||||
ImGuiContext &g = *GImGui;
|
||||
ImGuiWindow * window = GetCurrentWindow();
|
||||
if (window->SkipItems) return false;
|
||||
|
||||
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2 + margin * 2);
|
||||
ItemSize(bb);
|
||||
if (!ItemAdd(bb, id)) return false;
|
||||
|
||||
bool hovered, held;
|
||||
bool pressed = ButtonBehavior(bb, id, &hovered, &held);
|
||||
if (pressed) value = !value;
|
||||
|
||||
// Render
|
||||
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
||||
RenderNavHighlight(bb, id);
|
||||
|
||||
const float border_size = g.Style.FrameBorderSize;
|
||||
if (border_size > 0.0f) {
|
||||
window->DrawList->AddRect(bb.Min + ImVec2(1, 1), bb.Max + ImVec2(1, 1), col, g.Style.FrameRounding, 0, border_size);
|
||||
window->DrawList->AddRect(bb.Min, bb.Max, col, g.Style.FrameRounding, 0, border_size);
|
||||
}
|
||||
|
||||
if (bg_col.w > 0.0f) window->DrawList->AddRectFilled(bb.Min + padding, bb.Max - padding, GetColorU32(bg_col));
|
||||
|
||||
window->DrawList->AddImage(texture_id, bb.Min + padding + margin, bb.Max - padding - margin, uv0, uv1, GetColorU32(tint_col));
|
||||
|
||||
if (hovered)window->DrawList->AddImage(texture_id_hover, bb.Min + padding + margin, bb.Max - padding - margin, uv0, uv1, GetColorU32(tint_col));
|
||||
|
||||
if (value)window->DrawList->AddImage(texture_id_press, bb.Min + padding + margin, bb.Max - padding - margin, uv0, uv1, GetColorU32(tint_col));
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col)
|
||||
{
|
||||
|
@ -1256,6 +1290,20 @@ bool ImGui::ImageButton3(ImTextureID user_texture_id,ImTextureID user_texture_id
|
|||
return ImageButtonEx3(id, user_texture_id, user_texture_id_hover, size, uv0, uv1, padding, bg_col, tint_col, margin);
|
||||
}
|
||||
|
||||
bool ImGui::BBLImageButton(ImTextureID user_texture_id,ImTextureID user_texture_id_hover, ImTextureID user_texture_id_press, const ImVec2 &size, bool &value, const ImVec2 &uv0, const ImVec2 &uv1, int frame_padding, const ImVec4 &bg_col, const ImVec4 &tint_col, const ImVec2 &margin)
|
||||
{
|
||||
ImGuiContext &g = *GImGui;
|
||||
ImGuiWindow * window = g.CurrentWindow;
|
||||
if (window->SkipItems) return false;
|
||||
|
||||
// Default to using texture ID as ID. User can still push string/integer prefixes.
|
||||
PushID((void *) (intptr_t) user_texture_id);
|
||||
const ImGuiID id = window->GetID("#image");
|
||||
PopID();
|
||||
|
||||
const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float) frame_padding, (float) frame_padding) : g.Style.FramePadding;
|
||||
return BBLImageButtonEx(id, user_texture_id, user_texture_id_hover, user_texture_id_press, size,value, uv0, uv1, padding, bg_col, tint_col, margin);
|
||||
}
|
||||
|
||||
bool ImGui::ImageTextButton(const ImVec2& button_size, const char* text, ImTextureID user_texture_id, const ImVec2& image_size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col, const ImVec2& margin)
|
||||
{
|
||||
|
|
|
@ -63,24 +63,59 @@ void GLGizmoText::on_render_for_picking()
|
|||
// TODO:
|
||||
}
|
||||
|
||||
void GLGizmoText::push_combo_style()
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
|
||||
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()
|
||||
{
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopStyleColor(7);
|
||||
}
|
||||
|
||||
// BBS
|
||||
void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
||||
{
|
||||
const float win_h = ImGui::GetWindowHeight();
|
||||
y = std::min(y, bottom_limit - win_h);
|
||||
GizmoImguiSetNextWIndowPos(x, y, ImGuiCond_Always, 0.0f, 0.0f);
|
||||
|
||||
static float last_y = 0.0f;
|
||||
static float last_h = 0.0f;
|
||||
|
||||
float space_size = m_imgui->get_style_scaling() * 8;
|
||||
float font_cap = m_imgui->calc_text_size("Font ").x;
|
||||
float size_cap = m_imgui->calc_text_size("Size ").x;
|
||||
float thickness_cap = m_imgui->calc_text_size("Thickness ").x;
|
||||
float caption_size = std::max(std::max(font_cap, size_cap), thickness_cap) + 2 * space_size;
|
||||
ImGuiWrapper::push_toolbar_style(m_parent.get_scale());
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {4.0,5.0});
|
||||
GizmoImguiBegin("Text", ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
|
||||
|
||||
m_imgui->begin(_L("Text"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
|
||||
float space_size = m_imgui->get_style_scaling() * 8;
|
||||
float font_cap = m_imgui->calc_text_size(_L("Font")).x;
|
||||
float size_cap = m_imgui->calc_text_size(_L("Size")).x;
|
||||
float thickness_cap = m_imgui->calc_text_size(_L("Thickness")).x;
|
||||
float input_cap = m_imgui->calc_text_size(_L("Input text")).x;
|
||||
float caption_size = std::max(std::max(font_cap, size_cap), std::max(thickness_cap, input_cap)) + space_size + ImGui::GetStyle().WindowPadding.x;
|
||||
|
||||
float input_text_size = m_imgui->scaled(12.0f);
|
||||
float button_size = m_imgui->scaled(1.4f);
|
||||
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);
|
||||
|
||||
// adjust window position to avoid overlap the view toolbar
|
||||
const float win_h = ImGui::GetWindowHeight();
|
||||
y = std::min(y, bottom_limit - win_h);
|
||||
ImGui::SetWindowPos(ImVec2(x, y), ImGuiCond_Always);
|
||||
if (last_h != win_h || last_y != y) {
|
||||
// ask canvas for another frame to render the window in the correct position
|
||||
m_imgui->set_requires_extra_frame();
|
||||
|
@ -96,32 +131,61 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
for (int i = 0; i < m_avail_font_names.size(); i++)
|
||||
cstr_font_names[i] = m_avail_font_names[i].c_str();
|
||||
|
||||
m_imgui->text(_L("Font"));
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(input_text_size + ImGui::GetFrameHeight() * 2);
|
||||
push_combo_style();
|
||||
if (ImGui::BBLBeginCombo("##Font", cstr_font_names[m_curr_font_idx], 0)) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(4.0f, 0.0f));
|
||||
for (int i = 0; i < m_avail_font_names.size(); i++) {
|
||||
const bool is_selected = (m_curr_font_idx == i);
|
||||
if (ImGui::BBLSelectable(cstr_font_names[i], is_selected)) {
|
||||
m_curr_font_idx = i;
|
||||
}
|
||||
if (is_selected) {
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
pop_combo_style();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f));
|
||||
m_imgui->text(_L("Size"));
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(input_size);
|
||||
ImGui::InputFloat("###font_size", &m_font_size, 0.0f, 0.0f, "%.2f");
|
||||
if (m_font_size < 3.0f)m_font_size = 3.0f;
|
||||
ImGui::PopStyleVar(1);
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
|
||||
ImGui::BBLImageButton(normal_B,press_B_hover,press_B_press,{button_size,button_size},m_bold);
|
||||
ImGui::SameLine();
|
||||
ImGui::BBLImageButton(normal_T,press_T_hover,press_T_press,{button_size,button_size},m_italic);
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(_L("Thickness"));
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(input_text_size);
|
||||
ImGui::InputFloat("###text_thickness", &m_thickness,0.0f, 0.0f, "%.2f");
|
||||
if (m_thickness < 0.1f)m_thickness = 0.1f;
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(_L("Input text"));
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(input_text_size);
|
||||
ImGui::InputText("", m_text, sizeof(m_text));
|
||||
|
||||
ImGui::PushItemWidth(caption_size);
|
||||
ImGui::Text("Font ");
|
||||
ImGui::SameLine();
|
||||
ImGui::PushItemWidth(150);
|
||||
ImGui::Combo("##Font", &m_curr_font_idx, cstr_font_names, m_avail_font_names.size());
|
||||
|
||||
ImGui::PushItemWidth(caption_size);
|
||||
ImGui::Text("Size ");
|
||||
ImGui::SameLine();
|
||||
ImGui::PushItemWidth(150);
|
||||
ImGui::InputFloat("###font_size", &m_font_size);
|
||||
|
||||
ImGui::PushItemWidth(caption_size);
|
||||
ImGui::Text("Thickness ");
|
||||
ImGui::SameLine();
|
||||
ImGui::PushItemWidth(150);
|
||||
ImGui::InputFloat("###text_thickness", &m_thickness);
|
||||
|
||||
ImGui::Checkbox("Bold", &m_bold);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Italic", &m_italic);
|
||||
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
m_imgui->disabled_begin(m_text[0] == '\0' || m_text[0] == ' ');
|
||||
float offset = caption_size + input_text_size - m_imgui->calc_text_size(_L("Add")).x - space_size;
|
||||
ImGui::Dummy({0.0, 0.0});
|
||||
ImGui::SameLine(offset);
|
||||
bool add_clicked = m_imgui->button(_L("Add"));
|
||||
if (add_clicked) {
|
||||
TriangleMesh mesh;
|
||||
|
@ -129,8 +193,11 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
ObjectList* obj_list = wxGetApp().obj_list();
|
||||
obj_list->load_mesh_part(mesh, "text_shape");
|
||||
}
|
||||
m_imgui->disabled_end();
|
||||
|
||||
m_imgui->end();
|
||||
GizmoImguiEnd();
|
||||
ImGui::PopStyleVar();
|
||||
ImGuiWrapper::pop_toolbar_style();
|
||||
}
|
||||
|
||||
} // namespace GUI
|
||||
|
|
|
@ -32,6 +32,8 @@ protected:
|
|||
virtual bool on_is_activable() const override;
|
||||
virtual void on_render() override;
|
||||
virtual void on_render_for_picking() override;
|
||||
void push_combo_style();
|
||||
void pop_combo_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);
|
||||
|
|
|
@ -196,6 +196,37 @@ bool GLGizmosManager::init_icon_textures()
|
|||
else
|
||||
return false;
|
||||
|
||||
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/text_B.svg", 20, 20, texture_id))
|
||||
icon_list.insert(std::make_pair((int)IC_TEXT_B, texture_id));
|
||||
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_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;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,12 @@ public:
|
|||
IC_TOOLBAR_RESET_HOVER,
|
||||
IC_TOOLBAR_TOOLTIP,
|
||||
IC_TOOLBAR_TOOLTIP_HOVER,
|
||||
IC_TEXT_B,
|
||||
IC_TEXT_B_HOVER,
|
||||
IC_TEXT_B_PRESS,
|
||||
IC_TEXT_T,
|
||||
IC_TEXT_T_HOVER,
|
||||
IC_TEXT_T_PRESS,
|
||||
IC_NAME_COUNT,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue