mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 06:41:14 -06:00
Merge remote-tracking branch 'origin/main' into dev/gizmo
This commit is contained in:
commit
cf5c19fa24
19 changed files with 328 additions and 170 deletions
|
@ -2123,16 +2123,15 @@ void GUI_App::init_app_config()
|
|||
app_config = new AppConfig();
|
||||
//app_config = new AppConfig(is_editor() ? AppConfig::EAppMode::Editor : AppConfig::EAppMode::GCodeViewer);
|
||||
|
||||
m_config_corrupted = false;
|
||||
// load settings
|
||||
m_app_conf_exists = app_config->exists();
|
||||
if (m_app_conf_exists) {
|
||||
std::string error = app_config->load();
|
||||
if (!error.empty()) {
|
||||
// Error while parsing config file. We'll customize the error message and rethrow to be displayed.
|
||||
throw Slic3r::RuntimeError(
|
||||
_u8L("OrcaSlicer configuration file may be corrupted and is not abled to be parsed."
|
||||
"Please delete the file and try again.") +
|
||||
"\n\n" + app_config->config_path() + "\n\n" + error);
|
||||
// Orca: if the config file is corrupted, we will show a error dialog and create a default config file.
|
||||
m_config_corrupted = true;
|
||||
|
||||
}
|
||||
// Save orig_version here, so its empty if no app_config existed before this run.
|
||||
m_last_config_version = app_config->orig_version();//parse_semver_from_ini(app_config->config_path());
|
||||
|
@ -2749,6 +2748,7 @@ bool GUI_App::on_init_inner()
|
|||
|
||||
if (m_post_initialized && app_config->dirty())
|
||||
app_config->save();
|
||||
|
||||
});
|
||||
|
||||
m_initialized = true;
|
||||
|
@ -2756,6 +2756,13 @@ bool GUI_App::on_init_inner()
|
|||
flush_logs();
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "finished the gui app init";
|
||||
if (m_config_corrupted) {
|
||||
m_config_corrupted = false;
|
||||
show_error(nullptr,
|
||||
_u8L(
|
||||
"The OrcaSlicer configuration file may be corrupted and cannot be parsed.\nOrcaSlicer has attempted to recreate the "
|
||||
"configuration file.\nPlease note, application settings will be lost, but printer profiles will not be affected."));
|
||||
}
|
||||
//BBS: delete splash screen
|
||||
delete scrn;
|
||||
return true;
|
||||
|
|
|
@ -658,6 +658,7 @@ private:
|
|||
bool m_datadir_redefined { false };
|
||||
std::string m_older_data_dir_path;
|
||||
boost::optional<Semver> m_last_config_version;
|
||||
bool m_config_corrupted { false };
|
||||
};
|
||||
|
||||
DECLARE_APP(GUI_App)
|
||||
|
|
|
@ -149,6 +149,17 @@ bool GLGizmoText::on_init()
|
|||
|
||||
reset_text_info();
|
||||
|
||||
m_desc["font"] = _L("Font");
|
||||
m_desc["size"] = _L("Size");
|
||||
m_desc["thickness"] = _L("Thickness");
|
||||
m_desc["text_gap"] = _L("Text Gap");
|
||||
m_desc["angle"] = _L("Angle");
|
||||
m_desc["embeded_depth"] = _L("Embeded\ndepth");
|
||||
m_desc["input_text"] = _L("Input text");
|
||||
|
||||
m_desc["surface"] = _L("Surface");
|
||||
m_desc["horizontal_text"] = _L("Horizontal text");
|
||||
|
||||
m_desc["rotate_text_caption"] = _L("Shift + Mouse move up or dowm");
|
||||
m_desc["rotate_text"] = _L("Rotate text");
|
||||
|
||||
|
@ -667,13 +678,13 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 4.0f * currt_scale);
|
||||
GizmoImguiBegin("Text", ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
|
||||
|
||||
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 depth_cap = m_imgui->calc_text_size(_L("Embeded")).x;
|
||||
float caption_size = std::max(std::max(font_cap, size_cap), std::max(depth_cap, input_cap)) + space_size + ImGui::GetStyle().WindowPadding.x;
|
||||
const float space_size = m_imgui->get_style_scaling() * 8;
|
||||
const std::array<std::string, 7> cap_array = std::array<std::string, 7>{ "font", "size", "thickness", "text_gap", "angle", "embeded_depth", "input_text" };
|
||||
float caption_size = 0.0f;
|
||||
for (const auto &t : cap_array) {
|
||||
caption_size = std::max(caption_size, m_imgui->calc_text_size(m_desc[t]).x);
|
||||
}
|
||||
caption_size += space_size + ImGui::GetStyle().WindowPadding.x;
|
||||
|
||||
float input_text_size = m_imgui->scaled(10.0f);
|
||||
float button_size = ImGui::GetFrameHeight();
|
||||
|
@ -700,7 +711,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
|
||||
m_imgui->text(_L("Font"));
|
||||
m_imgui->text(m_desc["font"]);
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(list_width);
|
||||
push_combo_style(currt_scale);
|
||||
|
@ -740,7 +751,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
ImGui::PopStyleVar(2);
|
||||
pop_combo_style();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(_L("Size"));
|
||||
m_imgui->text(m_desc["size"]);
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(input_size);
|
||||
if(ImGui::InputFloat("###font_size", &m_font_size, 0.0f, 0.0f, "%.2f"))
|
||||
|
@ -767,7 +778,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
ImGui::PopStyleVar(3);
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(_L("Thickness"));
|
||||
m_imgui->text(m_desc["thickness"]);
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(list_width);
|
||||
float old_value = m_thickness;
|
||||
|
@ -782,7 +793,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
const float drag_left_width = caption_size + slider_width + space_size;
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(_L("Text Gap"));
|
||||
m_imgui->text(m_desc["text_gap"]);
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(slider_width);
|
||||
if (m_imgui->bbl_slider_float_style("##text_gap", &m_text_gap, -100, 100, "%.2f", 1.0f, true))
|
||||
|
@ -793,7 +804,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
m_need_update_text = true;
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(_L("Angle"));
|
||||
m_imgui->text(m_desc["angle"]);
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(slider_width);
|
||||
if (m_imgui->bbl_slider_float_style("##angle", &m_rotate_angle, 0, 360, "%.2f", 1.0f, true))
|
||||
|
@ -804,7 +815,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
m_need_update_text = true;
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(_L("Embeded\ndepth"));
|
||||
m_imgui->text(m_desc["embeded_depth"]);
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(list_width);
|
||||
old_value = m_embeded_depth;
|
||||
|
@ -815,7 +826,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
m_need_update_text = true;
|
||||
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(_L("Input text"));
|
||||
m_imgui->text(m_desc["input_text"]);
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::PushItemWidth(list_width);
|
||||
|
||||
|
@ -833,12 +844,12 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
|||
|
||||
ImGui::SameLine(caption_size);
|
||||
ImGui::AlignTextToFramePadding();
|
||||
if (m_imgui->bbl_checkbox(_L("Surface"), m_is_surface_text))
|
||||
if (m_imgui->bbl_checkbox(m_desc["surface"], m_is_surface_text))
|
||||
m_need_update_text = true;
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
if (m_imgui->bbl_checkbox(_L("Horizontal text"), m_keep_horizontal))
|
||||
if (m_imgui->bbl_checkbox(m_desc["horizontal_text"], m_keep_horizontal))
|
||||
m_need_update_text = true;
|
||||
|
||||
//ImGui::SameLine();
|
||||
|
|
|
@ -16,7 +16,7 @@ constexpr double miscalculation = scale_(scale_(1)); // equal to 1 mm2
|
|||
|
||||
static const float LEFT_MARGIN = 13.0f + 100.0f; // avoid thumbnail toolbar
|
||||
static const float HORIZONTAL_SLIDER_WINDOW_HEIGHT = 64.0f;
|
||||
static const float VERTICAL_SLIDER_WINDOW_WIDTH = 124.0f;
|
||||
static const float VERTICAL_SLIDER_WINDOW_WIDTH = 160.0f;
|
||||
static const float GROOVE_WIDTH = 12.0f;
|
||||
static const ImVec2 ONE_LAYER_MARGIN = ImVec2(20.0f, 20.0f);
|
||||
static const ImVec2 ONE_LAYER_BUTTON_SIZE = ImVec2(28.0f, 28.0f);
|
||||
|
|
|
@ -534,7 +534,7 @@ void PartPlate::calc_vertex_for_icons(int index, PickingModel &model)
|
|||
ExPolygon poly;
|
||||
auto bed_ext = get_extents(m_shape);
|
||||
Vec2d p = bed_ext[2];
|
||||
if (m_plater->get_build_volume_type() == BuildVolume_Type::Circle)
|
||||
if (m_plater && m_plater->get_build_volume_type() == BuildVolume_Type::Circle)
|
||||
p[1] -= std::max(
|
||||
0.0, (bed_ext.size()(1) - 5 * PARTPLATE_ICON_SIZE - 4 * PARTPLATE_ICON_GAP_Y - PARTPLATE_ICON_GAP_TOP) / 2);
|
||||
|
||||
|
|
|
@ -3232,6 +3232,17 @@ void TabPrinter::build_fff()
|
|||
option.opt.height = gcode_field_height;//150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("Change extrusion role G-code"), L"param_gcode", 0);
|
||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||
};
|
||||
|
||||
option = optgroup->get_option("change_extrusion_role_gcode");
|
||||
option.opt.full_width = true;
|
||||
option.opt.is_code = true;
|
||||
option.opt.height = gcode_field_height;//150;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("Pause G-code"), L"param_gcode", 0);
|
||||
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
|
||||
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue