Compare commits

..
Author SHA1 Message Date
Hanif Koh 138fa26847 Support the 02.08.04 Bambu Network Plug-in Series
The 02.08.02 series appended queue_plate_id to PrintParams and nothing
after it changed the ABI OrcaSlicer calls, so adding the field brings
the current layout up to 02.08.04. Make 02.08.04 the latest series and
drop 02.08.01 from the whitelist: its PrintParams no longer matches, and
its malformed bind table is refused by dyld on macOS 27, so it cannot
load there. A stored 02.08.01 falls back to the latest series through
the existing unsupported-version path.
2026-10-06 17:20:11 +08:00
110 changed files with 411 additions and 836 deletions
+14 -45
View File
@@ -8,9 +8,6 @@ include) fails wherever the error is. Headers are compiled on their own, and
fail only on errors in their changed lines. Deleting an #include also fails
on every use, changed or not, that now lacks the header it provided.
With -- --fix, clang-tidy adds the missing includes, on those lines only, and
each file it changed is checked again so that only what remains is reported.
The checks come from .clang-tidy at the repository root. The compile database
must come from a configure with SLIC3R_PCH=OFF, or the precompiled header hides
missing includes.
@@ -105,10 +102,9 @@ def is_checked(path):
def changed_files(merge_base):
# Against the working tree, so a local run covers uncommitted edits too.
# core.quotePath=false keeps a non-ASCII path unquoted, and the explicit prefixes
# override diff.noprefix and diff.mnemonicPrefix, so parse_diff sees its b/ prefix.
# core.quotePath=false keeps a non-ASCII path unquoted, so parse_diff sees its b/ prefix.
diff = subprocess.run(["git", "-c", "core.quotePath=false", "diff", "-U0", "--no-color", "--no-ext-diff",
"--src-prefix=a/", "--dst-prefix=b/", "--diff-filter=AMR", merge_base],
"--diff-filter=AMR", merge_base],
check=True, capture_output=True, **UTF8).stdout
return {path: change for path, change in parse_diff(diff).items() if is_checked(path)}
@@ -205,19 +201,13 @@ def errors_alone_at(revision, clang_tidy, build_dir, path):
def check_file(clang_tidy, build_dir, merge_base, path, change, extra_args):
"""Run clang-tidy on one file and return (failed, output, failing diagnostics, fixed)."""
fixing = any(arg.startswith("--fix") for arg in extra_args)
if fixing:
with open(path, "rb") as f:
before = f.read()
"""Run clang-tidy on one file and return (failed, output, failing diagnostics)."""
# A deleted include can orphan uses on unchanged lines, so such a file is
# checked whole and the findings narrowed here. --fix keeps a line filter so
# it never rewrites unrelated code, which for such a file means a second,
# fixing run limited to the lines the first one found wanting.
whole = bool(change.removed_includes)
# checked whole and the findings narrowed here. --fix keeps the line filter
# so it never rewrites unrelated code.
whole = bool(change.removed_includes) and not extra_args
returncode, output, diagnostics = run_clang_tidy(clang_tidy, build_dir, path,
None if whole else change.lines,
[] if whole else extra_args)
None if whole else change.lines, extra_args)
real = os.path.realpath(path)
def introduced(d):
@@ -233,25 +223,14 @@ def check_file(clang_tidy, build_dir, merge_base, path, change, extra_args):
if errors and change.removed_includes:
with open(path, encoding="utf-8") as f:
text = f.read()
before_sites = errors_alone_at(merge_base, clang_tidy, build_dir, path)
before = errors_alone_at(merge_base, clang_tidy, build_dir, path)
failing += [d for d in errors if d not in failing
and (error_sites([d], text) - before_sites)]
failed = bool(failing)
elif whole:
and (error_sites([d], text) - before)]
return bool(failing), output, failing
if whole:
failing = [d for d in diagnostics if d.is_compile_error or introduced(d)]
failed = bool(failing)
else:
failing, failed = diagnostics, returncode != 0
if not fixing:
return failed, output, failing, False
if whole and failing:
lines = change.lines + [[d.line, d.line] for d in failing if os.path.realpath(d.file) == real]
run_clang_tidy(clang_tidy, build_dir, path, lines, extra_args)
with open(path, "rb") as f:
if f.read() == before:
return failed, output, failing, False
# Checked again, so what is reported is what the fixes left.
return check_file(clang_tidy, build_dir, merge_base, path, change, [])[:3] + (True,)
return bool(failing), output, failing
return returncode != 0, output, diagnostics
def main():
@@ -284,14 +263,11 @@ def main():
annotate = os.environ.get("GITHUB_ACTIONS") == "true"
root = os.getcwd() + os.sep
failed = []
fixed = []
with ThreadPoolExecutor(max_workers=args.jobs) as pool:
jobs = {path: pool.submit(check_file, args.clang_tidy, args.build_dir, merge_base, path, change, args.extra_args)
for path, change in todo}
for path, job in jobs.items():
file_failed, output, diagnostics, file_fixed = job.result()
if file_fixed:
fixed.append(path)
file_failed, output, diagnostics = job.result()
if not file_failed:
continue
failed.append(path)
@@ -306,13 +282,6 @@ def main():
if len(diagnostics) > MAX_REPORTED:
print(f"... and {len(diagnostics) - MAX_REPORTED} more")
if fixed:
print(f"\nAdded includes to {len(fixed)} file(s):")
for path in fixed:
print(f" {path}")
if failed and fixed:
print(f"\nclang-tidy still fails on {len(failed)} file(s); the findings above are what --fix could not add.")
return 1
if failed:
print(f"\nclang-tidy failed on {len(failed)} file(s). Add the includes it names, or apply its "
"suggestions locally with scripts/run_clang_tidy.sh --fix (scripts\\run_clang_tidy.ps1 -Fix on Windows).")
+10 -40
View File
@@ -6,9 +6,8 @@
# scripts/run_clang_tidy.sh --fix also add the missing includes it names
#
# It configures a separate build directory (build-tidy) without the precompiled
# header, uses the clang-tidy on your system or installs the pinned one into a
# virtual environment inside it, and runs scripts/clang_tidy_diff.py the way CI
# does. Uncommitted changes are checked too.
# header, installs the pinned clang-tidy into a virtual environment inside it, and
# runs scripts/clang_tidy_diff.py the way CI does. Uncommitted changes are checked too.
set -euo pipefail
@@ -24,8 +23,7 @@ Usage: scripts/run_clang_tidy.sh [options]
deps/build/<arch> on macOS)
-j, --jobs N parallel clang-tidy runs (default: all cores)
--fix apply clang-tidy's fixes (adds the missing includes)
-y, --yes install missing tools without asking; another clang-tidy
version found on the system is then not offered
-y, --yes install missing tools without asking
-h, --help show this help
EOF
}
@@ -138,38 +136,12 @@ REQUIREMENTS="$ROOT/scripts/clang_tidy_requirements.txt"
PINNED=$(sed -n 's/^clang-tidy==//p' "$REQUIREMENTS")
VENV="$BUILD_DIR/clang-tidy-venv"
is_pinned() {
[ -x "$1" ] && "$1" --version 2>/dev/null | grep -q "version $PINNED"
}
CLANG_TIDY="${CLANG_TIDY:-}"
if [ -n "$CLANG_TIDY" ]; then
if [ -n "${CLANG_TIDY:-}" ]; then
# Set by the caller: use it as is.
is_pinned "$CLANG_TIDY" || echo "Warning: $CLANG_TIDY is not clang-tidy $PINNED, so results may differ from CI." >&2
:
else
# One already on the system comes first: the pinned version outright, another
# version if the user accepts the difference. The pinned version is installed
# into a virtual environment otherwise.
INSTALLED=""
for candidate in $(command -v clang-tidy "clang-tidy-${PINNED%%.*}" || true) \
"/usr/lib/llvm-${PINNED%%.*}/bin/clang-tidy" \
"$(brew --prefix llvm 2>/dev/null || true)/bin/clang-tidy"; do
if is_pinned "$candidate"; then
CLANG_TIDY="$candidate"
break
fi
[ -z "$INSTALLED" ] && [ -x "$candidate" ] && INSTALLED="$candidate"
done
if [ -z "$CLANG_TIDY" ] && [ -n "$INSTALLED" ] && [ "$YES" = 0 ] && ! is_pinned "$VENV/bin/clang-tidy"; then
echo "Found $INSTALLED, which is $("$INSTALLED" --version | sed -n 's/.*version \([0-9.]*\).*/\1/p' | head -n 1), not the $PINNED CI uses, so results may differ slightly."
if ask "Use it anyway?"; then
CLANG_TIDY="$INSTALLED"
fi
fi
fi
if [ -z "$CLANG_TIDY" ]; then
CLANG_TIDY="$VENV/bin/clang-tidy"
if ! is_pinned "$CLANG_TIDY"; then
if [ ! -x "$CLANG_TIDY" ] || ! "$CLANG_TIDY" --version | grep -q "version $PINNED"; then
if ask "clang-tidy $PINNED (the version CI uses) is not installed. Install it into $VENV?"; then
mkdir -p "$BUILD_DIR"
if ! python3 -m venv "$VENV"; then
@@ -186,6 +158,9 @@ if [ -z "$CLANG_TIDY" ]; then
fi
fi
fi
if ! "$CLANG_TIDY" --version | grep -q "version $PINNED"; then
echo "Warning: $CLANG_TIDY is not clang-tidy $PINNED, so results may differ from CI." >&2
fi
# --- Dependencies -------------------------------------------------------------
@@ -242,12 +217,7 @@ cmake --build "$BUILD_DIR" --target git_commit_hash_header >/dev/null
if [ -z "$BASE" ]; then
REMOTE=$(git remote -v | awk '/github\.com[:\/]OrcaSlicer\/OrcaSlicer(\.git)? \(fetch\)/ { print $1; exit }')
if [ -z "$REMOTE" ]; then
# Against a fork's main that already has the commits, nothing is checked.
echo "Warning: no remote points at github.com/OrcaSlicer/OrcaSlicer, so this compares against origin/main." >&2
echo "If origin is your fork, add the upstream remote (git remote add upstream https://github.com/OrcaSlicer/OrcaSlicer.git) or pass --base." >&2
REMOTE=origin
fi
REMOTE="${REMOTE:-origin}"
if [ "$FETCH" = 1 ]; then
git fetch --quiet "$REMOTE" main
fi
-57
View File
@@ -155,8 +155,6 @@ class TestSubprocessCalls(unittest.TestCase):
diff = "+++ b/src/libslic3r/Über.cpp\n@@ -1,0 +2 @@\n+// 打印\n"
files, call, _ = self.run_patched(clang_tidy_diff.changed_files, "base", stdout=diff)
self.assertIn("core.quotePath=false", call.args[0])
# Whatever diff.noprefix or diff.mnemonicPrefix a user has set.
self.assertIn("--dst-prefix=b/", call.args[0])
self.assertEqual(call.kwargs["encoding"], "utf-8")
self.assertEqual(files["src/libslic3r/Über.cpp"].lines, [[2, 2]])
@@ -169,60 +167,5 @@ class TestSubprocessCalls(unittest.TestCase):
self.assertEqual(call.kwargs["encoding"], "utf-8")
class TestCheckFileFix(unittest.TestCase):
"""check_file with -- --fix: what clang-tidy is run on, and what is reported afterwards."""
def setUp(self):
self.dir = tempfile.TemporaryDirectory()
self.addCleanup(self.dir.cleanup)
self.path = os.path.join(self.dir.name, "Color.cpp")
with open(self.path, "w") as f:
f.write("int x;\n")
def finding(self, line, include=""):
return clang_tidy_diff.Diagnostic(self.path, line, 1, "error",
'no header providing "x" is directly included [misc-include-cleaner]', include)
def check(self, change, results, fix_writes=None):
"""Run check_file with run_clang_tidy answering from `results` in turn; the --fix run
rewrites the file with `fix_writes` when given. Returns (result, calls)."""
calls = []
def run(clang_tidy, build_dir, path, lines, extra_args):
calls.append((lines, extra_args))
if "--fix" in extra_args and fix_writes is not None:
with open(path, "w") as f:
f.write(fix_writes)
return results[len(calls) - 1]
with mock.patch.object(clang_tidy_diff, "run_clang_tidy", side_effect=run):
result = clang_tidy_diff.check_file("clang-tidy", "build", "base", self.path, change, ["--fix"])
return result, calls
def test_a_deleted_include_is_fixed_on_the_lines_it_orphaned_only(self):
change = clang_tidy_diff.FileChange(lines=[[4, 4]], removed_includes={"libslic3r/Point.hpp"})
orphaned = self.finding(50, "<libslic3r/Point.hpp>")
unrelated = self.finding(60, "<vector>")
(failed, _, failing, fixed), calls = self.check(
change, [(1, "", [orphaned, unrelated]), (1, "", [orphaned]), (0, "", [])], fix_writes="#include <libslic3r/Point.hpp>\n")
self.assertEqual(calls, [(None, []), ([[4, 4], [50, 50]], ["--fix"]), (None, [])])
self.assertEqual((failed, failing, fixed), (False, [], True))
def test_a_file_the_fix_did_not_change_keeps_its_findings(self):
change = clang_tidy_diff.FileChange(lines=[[4, 4]])
error = clang_tidy_diff.Diagnostic(self.path, 4, 1, "error", "unknown type name 'Foo' [clang-diagnostic-error]")
(failed, _, failing, fixed), calls = self.check(change, [(1, "", [error])])
self.assertEqual(calls, [([[4, 4]], ["--fix"])])
self.assertEqual((failed, failing, fixed), (True, [error], False))
def test_a_changed_file_is_checked_again_and_reports_what_is_left(self):
change = clang_tidy_diff.FileChange(lines=[[4, 4]])
error = clang_tidy_diff.Diagnostic(self.path, 4, 1, "error", "unknown type name 'Foo' [clang-diagnostic-error]")
(failed, _, failing, fixed), calls = self.check(
change, [(1, "", [self.finding(4, "<vector>"), error]), (1, "", [error])], fix_writes="#include <vector>\n")
self.assertEqual(calls, [([[4, 4]], ["--fix"]), ([[4, 4]], [])])
self.assertEqual((failed, failing, fixed), (True, [error], True))
if __name__ == "__main__":
unittest.main()
+7 -5
View File
@@ -23,6 +23,7 @@
#include <map>
#include <vector>
#include "libslic3r/PrintBase.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <cerrno>
#include <utility>
@@ -77,10 +78,12 @@
#include <condition_variable>
#include <mutex>
#include <boost/thread.hpp>
#endif
//add json logic
#include "nlohmann/json.hpp"
using namespace nlohmann;
#endif
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
#include <boost/nowide/args.hpp>
@@ -154,7 +157,6 @@
#include <stdio.h>
namespace fs = boost::filesystem;
using json = nlohmann::json;
#ifdef __WXGTK__
#if __has_include(<X11/Xlib.h>)
@@ -3522,7 +3524,7 @@ int CLI::run(int argc, char **argv)
ConfigOptionStrings *curr_variant_opt = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant");
if (!curr_variant_opt) {
curr_variant_opt = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant", true);
std::vector<std::string>& filament_variants = curr_variant_opt->values;
std::vector<string>& filament_variants = curr_variant_opt->values;
filament_variants.resize(filament_count, get_extruder_variant_string(etDirectDrive, nvtStandard));
}
const ConfigOptionStrings *new_variant_opt = dynamic_cast<const ConfigOptionStrings*>(config.option("filament_extruder_variant", true));
@@ -6552,7 +6554,7 @@ int CLI::run(int argc, char **argv)
std::vector<int> result_filaments;
//result_filaments.reserve(conflict_filaments.size());
std::set_intersection(conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(),
unprintable_filament_vec[index].end(), std::insert_iterator<std::vector<int>>(result_filaments, result_filaments.begin()));
unprintable_filament_vec[index].end(), insert_iterator<vector<int>>(result_filaments, result_filaments.begin()));
conflict_filament_vector = result_filaments;
}
}
+2
View File
@@ -15,6 +15,8 @@
#include "libslic3r/Semver.hpp"
#include "calib.hpp"
using namespace nlohmann;
#define ENV_DEV_HOST "0"
#define ENV_QAT_HOST "1"
#define ENV_PRE_HOST "2"
-10
View File
@@ -352,16 +352,6 @@ void FillSpiralInset::_fill_surface_single(const FillParams& params,
assert(params.use_arachne);
assert(this->print_config != nullptr && this->print_object_config != nullptr);
// Internal solid infill must not add Arachne's standalone thin walls: one of those walls can
// become the extra centre point after the spiral has finished. Top and bottom surfaces keep
// Arachne, including the centre plug handled by generate_spiral_insets().
if (params.extrusion_role == erSolidInfill) {
Polylines polylines;
this->_fill_surface_single(params, thickness_layers, direction, expolygon, polylines);
append(thick_polylines_out, to_thick_polylines(std::move(polylines), scaled<coord_t>(this->spacing)));
return;
}
// Only a solid surface is worth the variable width walls; a sparse one falls back to plain loops.
if (params.density <= 0.9999f || params.dont_adjust) {
Polylines polylines;
+105 -83
View File
@@ -751,50 +751,6 @@ template<typename T>
}
}
namespace {
// Writes G-code to a file in blocks and records in lines_ends the file offset after every '\n'
class GCodeFileWriter
{
public:
GCodeFileWriter(FilePtr& out, const std::string& out_path, std::vector<size_t>& lines_ends, const char* error_message)
: m_out(out), m_out_path(out_path), m_lines_ends(lines_ends), m_error_message(error_message)
{}
~GCodeFileWriter() { assert(m_buffer.empty() || std::uncaught_exceptions() > 0); }
void append(std::string_view text)
{
const size_t text_pos = m_file_pos + m_buffer.size();
for (size_t i = text.find('\n'); i != std::string_view::npos; i = text.find('\n', i + 1))
m_lines_ends.emplace_back(text_pos + i + 1);
m_buffer += text;
if (m_buffer.size() >= GCodeProcessor::Output_Block_Size)
flush();
}
void flush()
{
if (m_buffer.empty())
return;
fwrite(m_buffer.data(), 1, m_buffer.size(), m_out.f);
if (ferror(m_out.f)) {
m_out.close();
boost::nowide::remove(m_out_path.c_str());
throw Slic3r::RuntimeError(m_error_message);
}
m_file_pos += m_buffer.size();
m_buffer.clear();
}
private:
FilePtr& m_out;
const std::string& m_out_path;
std::vector<size_t>& m_lines_ends;
const char* m_error_message;
std::string m_buffer;
size_t m_file_pos{0};
};
} // namespace
// Helper class to modify and export gcode to file
class ExportLines
{
@@ -809,6 +765,16 @@ public:
enum class EWriteType { BySize, ByTime };
private:
static void update_lines_ends_and_out_file_pos(const std::string& out_string, std::vector<size_t>& lines_ends, size_t* out_file_pos)
{
for (size_t i = 0; i < out_string.size(); ++i) {
if (out_string[i] == '\n')
lines_ends.emplace_back((out_file_pos != nullptr) ? *out_file_pos + i + 1 : i + 1);
}
if (out_file_pos != nullptr)
*out_file_pos += out_string.size();
}
struct LineData
{
std::string line;
@@ -848,14 +814,12 @@ private:
EWriteType m_write_type{EWriteType::BySize};
// Time machines containing g1 times cache
const std::array<GCodeProcessor::TimeMachine, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)>& m_machines;
// Output file writer
GCodeFileWriter& m_writer;
// Current time
std::array<float, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)> m_times{0.0f, 0.0f};
// Current size of the cache in bytes
// Current size in bytes
size_t m_size{0};
// gcode lines cache, used only when writing by time
// gcode lines cache
std::deque<LineData> m_lines;
size_t m_added_lines_counter{0};
// map of gcode line ids from original to final
@@ -863,16 +827,16 @@ private:
std::vector<std::pair<size_t, size_t>> m_gcode_lines_map;
size_t m_times_cache_id{0};
size_t m_out_file_pos{0};
public:
ExportLines(EWriteType type, const std::array<GCodeProcessor::TimeMachine, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)>& machines, GCodeFileWriter& writer)
ExportLines(EWriteType type, const std::array<GCodeProcessor::TimeMachine, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)>& machines)
#ifndef NDEBUG
: m_statistics(*this)
, m_write_type(type)
, m_machines(machines)
, m_writer(writer){}
, m_machines(machines){}
#else
: m_write_type(type), m_machines(machines), m_writer(writer)
: m_write_type(type), m_machines(machines)
{}
#endif // NDEBUG
@@ -926,14 +890,11 @@ public:
if (line.empty())
return;
if (m_write_type == EWriteType::ByTime) {
m_lines.push_back({line, m_times});
m_lines.push_back({line, m_times});
#ifndef NDEBUG
m_statistics.add_line(line.length());
m_statistics.add_line(line.length());
#endif // NDEBUG
m_size += line.length();
} else
m_writer.append(line);
m_size += line.length();
++m_added_lines_counter;
if (!ignore_from_move) {
assert(!m_gcode_lines_map.empty());
@@ -999,35 +960,65 @@ public:
}
}
// when writing by time, pass the cached lines older than m_times[Normal] - backtrace_time to the writer
void write(float backtrace_time)
// write to file:
// m_write_type == EWriteType::ByTime - all lines older than m_time - backtrace_time
// m_write_type == EWriteType::BySize - all lines if current size is greater than 65535 bytes
void write(FilePtr& out, float backtrace_time, GCodeProcessorResult& result, const std::string& out_path)
{
if (m_write_type != EWriteType::ByTime)
if (m_lines.empty())
return;
while (!m_lines.empty() && m_lines.front().times[Normal] < m_times[Normal] - backtrace_time) {
const LineData& data = m_lines.front();
m_writer.append(data.line);
m_size -= data.line.length();
m_lines.pop_front();
// collect lines to write into a single string
std::string out_string;
if (!m_lines.empty()) {
if (m_write_type == EWriteType::ByTime) {
while (m_lines.front().times[Normal] < m_times[Normal] - backtrace_time) {
const LineData& data = m_lines.front();
out_string += data.line;
m_size -= data.line.length();
m_lines.pop_front();
#ifndef NDEBUG
m_statistics.remove_line();
m_statistics.remove_line();
#endif // NDEBUG
}
} else {
if (m_size > 65535) {
while (!m_lines.empty()) {
out_string += m_lines.front().line;
m_lines.pop_front();
}
m_size = 0;
#ifndef NDEBUG
m_statistics.remove_all_lines();
#endif // NDEBUG
}
}
}
{
write_to_file(out, out_string, result, out_path);
update_lines_ends_and_out_file_pos(out_string, result.lines_ends, &m_out_file_pos);
}
}
// flush the current content of the cache and the writer to file
void flush()
// flush the current content of the cache to file
void flush(FilePtr& out, GCodeProcessorResult& result, const std::string& out_path)
{
// collect lines to flush into a single string
std::string out_string;
while (!m_lines.empty()) {
m_writer.append(m_lines.front().line);
out_string += m_lines.front().line;
m_lines.pop_front();
}
m_size = 0;
#ifndef NDEBUG
m_statistics.remove_all_lines();
#endif // NDEBUG
m_writer.flush();
{
write_to_file(out, out_string, result, out_path);
update_lines_ends_and_out_file_pos(out_string, result.lines_ends, &m_out_file_pos);
}
}
void synchronize_moves(GCodeProcessorResult& result) const
@@ -1060,7 +1051,20 @@ public:
size_t get_size() const { return m_size; }
void reserve(size_t lines_count) { m_gcode_lines_map.reserve(lines_count); }
private:
void write_to_file(FilePtr& out, const std::string& out_string, GCodeProcessorResult& result, const std::string& out_path)
{
if (!out_string.empty()) {
if (true) {
fwrite((const void*) out_string.c_str(), 1, out_string.length(), out.f);
if (ferror(out.f)) {
out.close();
boost::nowide::remove(out_path.c_str());
throw Slic3r::RuntimeError("GCode processor post process export failed.\nIs the disk full?");
}
}
}
}
};
void GCodeProcessor::run_post_process()
@@ -1156,13 +1160,8 @@ void GCodeProcessor::run_post_process()
last_exported_stop[i] = time_in_minutes(m_time_processor.machines[i].time);
}
m_result.lines_ends.clear();
// m_result.lines_ends.emplace_back(std::vector<size_t>());
GCodeFileWriter writer(out, out_path, m_result.lines_ends, "GCode processor post process export failed.\nIs the disk full?");
ExportLines export_line(m_result.backtrace_enabled ? ExportLines::EWriteType::ByTime : ExportLines::EWriteType::BySize,
m_time_processor.machines, writer);
// The line map holds an entry for each line of the file, and the first pass counted them
export_line.reserve(m_line_id);
m_time_processor.machines);
// replace placeholder lines with the proper final value
// gcode_line is in/out parameter, to reduce expensive memory allocation
@@ -1536,6 +1535,9 @@ void GCodeProcessor::run_post_process()
}
};
m_result.lines_ends.clear();
// m_result.lines_ends.emplace_back(std::vector<size_t>());
// Orca: freshly collect SKIPPABLE ranges each post-process pass. The ranges are stored on the
// member (rather than a local) so the injection pass can consume them, hence the clear here to
// avoid stale ranges on re-invocation.
@@ -1800,7 +1802,7 @@ void GCodeProcessor::run_post_process()
if (!gcode_line.empty())
export_line.append_line(gcode_line);
export_line.write(1.1f * max_backtrace_time);
export_line.write(out, 1.1f * max_backtrace_time, m_result, out_path);
gcode_line.clear();
}
}
@@ -1842,7 +1844,7 @@ void GCodeProcessor::run_post_process()
}
}
export_line.flush();
export_line.flush(out, m_result, out_path);
out.close();
in.close();
@@ -1990,13 +1992,31 @@ void GCodeProcessor::run_second_pass_injection()
// The rewrite may shift byte positions (once the injector inserts lines), so rebuild lines_ends from scratch.
// With an empty map the scanned '\n' offsets reproduce the current lines_ends exactly.
m_result.lines_ends.clear();
GCodeFileWriter writer(out, out_path, m_result.lines_ends, "GCode processor pre-heat injection pass failed.\nIs the disk full?\n");
size_t out_file_pos = 0;
auto write_out = [&out, &out_path, this, &out_file_pos](std::string& str) {
if (str.empty())
return;
fwrite((const void*) str.c_str(), 1, str.length(), out.f);
if (ferror(out.f)) {
out.close();
boost::nowide::remove(out_path.c_str());
throw Slic3r::RuntimeError(std::string("GCode processor pre-heat injection pass failed.\nIs the disk full?\n"));
}
for (size_t i = 0; i < str.size(); ++i) {
if (str[i] == '\n')
m_result.lines_ends.emplace_back(out_file_pos + i + 1);
}
out_file_pos += str.size();
str.clear();
};
// Orca: read/split lines with EOL-preserving semantics (keep the original \r and \n bytes, and
// synthesize no trailing newline). This is required for the empty-map identity: normalizing every
// line ending to "\n" would not be byte-identical if the finished file used \r\n or lacked a
// final newline.
std::string gcode_line;
std::string export_buffer;
unsigned int line_id = 0;
auto op_it = inserted_operation_lines.begin();
std::vector<char> buffer(65536 * 10, 0);
@@ -2038,14 +2058,16 @@ void GCodeProcessor::run_second_pass_injection()
}
++op_it;
}
writer.append(gcode_line);
export_buffer += gcode_line;
gcode_line.clear();
if (export_buffer.length() >= 65536)
write_out(export_buffer);
}
}
if (eof)
break;
}
writer.flush();
write_out(export_buffer);
out.close();
in.close();
-3
View File
@@ -491,9 +491,6 @@ class Print;
static const std::string VFlush_End_Tag;
static const std::string External_Purge_Tag;
public:
// Size of the blocks the post-processing passes write the G-code in
static constexpr size_t Output_Block_Size = 65536;
// Orca: SKIPPABLE region tags, stored as static strings (the FLUSH idiom above) rather than
// a CustomETags/CustomTags array. Public so the emission sites (WipeTower / change_filament
// path) can reference them single-sourced.
+26 -125
View File
@@ -759,59 +759,6 @@ static void clip_inner_walls_over_top(std::vector<Arachne::VariableWidthLines> &
}
}
// ORCA: only_one_wall_top - widest bead of the given walls.
static coord_t widest_bead(const std::vector<Arachne::VariableWidthLines> &walls)
{
coord_t widest = 0;
for (const Arachne::VariableWidthLines &group : walls)
for (const Arachne::ExtrusionLine &el : group)
for (const Arachne::ExtrusionJunction &j : el.junctions)
widest = std::max(widest, j.w);
return widest;
}
// ORCA: only_one_wall_top - length of the walls running further than tolerance from the reference walls, outside the
// excluded area.
static double length_off_reference(const std::vector<Arachne::VariableWidthLines> &walls, const Arachne::VariableWidthLines &reference,
const ExPolygons &excluded, coord_t tolerance)
{
auto append_centerlines = [](const Arachne::VariableWidthLines &lines, Polylines &out) {
for (const Arachne::ExtrusionLine &el : lines) {
if (el.junctions.size() < 2)
continue;
Polyline &centerline = out.emplace_back();
centerline.points.reserve(el.junctions.size());
for (const Arachne::ExtrusionJunction &j : el.junctions)
centerline.points.emplace_back(j.p);
}
};
Polylines wall_centerlines;
Polylines reference_centerlines;
for (const Arachne::VariableWidthLines &group : walls)
append_centerlines(group, wall_centerlines);
append_centerlines(reference, reference_centerlines);
Polylines off_reference = diff_pl(wall_centerlines, offset(reference_centerlines, float(tolerance)));
if (! excluded.empty())
off_reference = diff_pl(off_reference, excluded);
return total_length(off_reference);
}
// ORCA: only_one_wall_top - area covered by the given walls at their local widths.
static Polygons walls_footprint(const Arachne::VariableWidthLines &walls)
{
Polygons footprint;
for (const Arachne::ExtrusionLine &el : walls)
for (size_t i = 1; i < el.junctions.size(); ++ i) {
const Arachne::ExtrusionJunction &a = el.junctions[i - 1];
const Arachne::ExtrusionJunction &b = el.junctions[i];
const coord_t width = std::max(a.w, b.w);
if (width > 0)
append(footprint, offset(Polyline(a.p, b.p), float(width) / 2.f));
}
return union_(footprint);
}
void PerimeterGenerator::split_top_surfaces(const ExPolygons &orig_polygons, ExPolygons &top_fills,
ExPolygons &non_top_polygons, ExPolygons &fill_clip) const {
// other perimeters
@@ -2599,90 +2546,44 @@ void PerimeterGenerator::process_arachne()
if (inner_loop_number >= 0) {
assert(upper_slices != nullptr);
// Infill contour bounding box.
BoundingBox infill_contour_bbox = get_extents(infill_contour);
infill_contour_bbox.offset(SCALED_EPSILON);
coord_t perimeter_width = this->perimeter_flow.scaled_width();
// Filter out areas that are too thin and expand top surface polygons a bit to hide the wall line.
// ORCA: skip if the top surface area is smaller than "min_width_top_surface"
const float top_surface_min_width = std::max<float>(float(ext_perimeter_spacing) / 4.f + scaled<float>(0.00001), float(scale_(config->min_width_top_surface.get_abs_value(unscale_(perimeter_width)))) / 4.f);
// Get top ExPolygons from current infill contour.
Polygons upper_slices_clipped;
if (object_config->interface_shells) {
auto upper_slicer_same_region = to_expolygons(this->upper_slices_same_region->surfaces);
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(upper_slicer_same_region, infill_contour_bbox);
} else
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*upper_slices, infill_contour_bbox);
// Get top ExPolygons from the given contour. uncovered reports whether the upper layer leaves any of the
// contour uncovered, before bridges and too thin areas are filtered out.
auto get_top_expolygons = [&](const ExPolygons &contour, bool &uncovered) {
// Contour bounding box.
BoundingBox contour_bbox = get_extents(contour);
contour_bbox.offset(SCALED_EPSILON);
Polygons upper_slices_clipped;
if (object_config->interface_shells) {
auto upper_slicer_same_region = to_expolygons(this->upper_slices_same_region->surfaces);
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(upper_slicer_same_region, contour_bbox);
} else
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*upper_slices, contour_bbox);
ExPolygons top = diff_ex(contour, upper_slices_clipped);
uncovered = !top.empty();
if (top.empty())
return top;
top_expolygons = diff_ex(infill_contour, upper_slices_clipped);
if (!top_expolygons.empty()) {
if (lower_slices != nullptr) {
const float bridge_offset = float(std::max<coord_t>(ext_perimeter_spacing, perimeter_width));
const Polygons lower_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*lower_slices, contour_bbox);
const ExPolygons current_slices_bridges = offset_ex(diff_ex(top, lower_slices_clipped), bridge_offset);
const Polygons lower_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*lower_slices, infill_contour_bbox);
const ExPolygons current_slices_bridges = offset_ex(diff_ex(top_expolygons, lower_slices_clipped), bridge_offset);
// Remove bridges from top surface polygons.
top = diff_ex(top, current_slices_bridges);
top_expolygons = diff_ex(top_expolygons, current_slices_bridges);
}
// Filter out areas that are too thin and expand top surface polygons a bit to hide the wall line.
// ORCA: skip if the top surface area is smaller than "min_width_top_surface"
const float top_surface_min_width = std::max<float>(float(ext_perimeter_spacing) / 4.f + scaled<float>(0.00001), float(scale_(config->min_width_top_surface.get_abs_value(unscale_(perimeter_width)))) / 4.f);
// Shrink the polygon to remove the small areas, then expand it back out plus a maragin to hide the wall line a little.
// ORCA: Expand the polygon with half the perimeter width in addition to the contracted amount,
// not the full perimeter width as PS does, to enable thin lettering to print on the top surface without nozzle collisions
// due to thin lines being generated
top = offset2_ex(top, -top_surface_min_width, top_surface_min_width + float(perimeter_width * 0.85));
top_expolygons = offset2_ex(top_expolygons, -top_surface_min_width, top_surface_min_width + float(perimeter_width * 0.85));
// Get final top ExPolygons (bridges were excluded above, so they stay walled).
return intersection_ex(top, contour);
};
top_expolygons = intersection_ex(top_expolygons, infill_contour);
// Walls with the full count, as generated when the single perimeter feature is disabled. Generated on first use.
std::vector<Arachne::VariableWidthLines> full_perimeters;
Polygons full_inner_contour;
bool full_perimeters_generated = false;
auto generate_full_perimeters = [&]() {
if (full_perimeters_generated)
return;
Arachne::WallToolPaths full_tool_paths(last_p, bead_width_0, perimeter_spacing, coord_t(inner_loop_number + 2), wall_0_inset, layer_height, input_params_tmp);
full_perimeters = full_tool_paths.getToolPaths();
full_inner_contour = full_tool_paths.getInnerContour();
full_perimeters_generated = true;
};
// ORCA: the single wall pass allows Arachne 2 beads across a wall, so it fills a wall narrower than 3 outer wall
// widths by widening both, where the full pass adds a middle bead. Over the top surface that is the intent;
// anywhere else it leaves no room for the inner walls. When the single wall pass's outer walls run away from
// the full pass's outside the top surface, take the full pass's outer walls and the area inside them instead.
// Walls closer than outer_wall_tolerance count as the same wall: a widened bead's centerline moves by half
// the width added, and only beads widened by more than twice the tolerance are looked for.
const coord_t outer_wall_tolerance = bead_width_0 / 10;
if (widest_bead(perimeters) > bead_width_0 + 2 * outer_wall_tolerance) {
// The single wall pass's inner contour where it widens no bead: inside nominal width outer walls.
const ExPolygons nominal_infill_contour = offset_ex(last, -float(bead_width_0 + wall_0_inset));
bool nominal_uncovered = false;
// Grown by an outer wall width to take in the outer walls bordering the top surface.
const ExPolygons top_zone = offset_ex(get_top_expolygons(nominal_infill_contour, nominal_uncovered), float(bead_width_0));
if (nominal_uncovered) {
generate_full_perimeters();
if (! full_perimeters.empty() && ! full_perimeters.front().empty() &&
length_off_reference(perimeters, full_perimeters.front(), top_zone, outer_wall_tolerance) > double(perimeter_width)) {
perimeters = { full_perimeters.front() };
infill_contour = diff_ex(nominal_infill_contour, walls_footprint(full_perimeters.front()), ApplySafetyOffset::Yes);
}
}
}
bool uncovered = false;
top_expolygons = get_top_expolygons(infill_contour, uncovered);
if (uncovered) {
// ORCA: onion the real region (inside the outer wall) so the remaining walls follow the actual
// geometry, then cut away the parts over the top surface. Re-onioning the non-top complement
// instead - the fallback when there is no top fill - walls the top/non-top interface and rings
@@ -2711,11 +2612,11 @@ void PerimeterGenerator::process_arachne()
perimeters.insert(perimeters.end(), inner_perimeters.begin(), inner_perimeters.end());
infill_contour = union_ex(top_expolygons, inner_wall_tool_paths.getInnerContour());
} else {
// There is no top surface ExPolygon, so use the walls generated like when the single perimeter
// feature is disabled.
generate_full_perimeters();
perimeters = std::move(full_perimeters);
infill_contour = union_ex(full_inner_contour);
// There is no top surface ExPolygon, so we call Arachne again with parameters
// like when the single perimeter feature is disabled.
Arachne::WallToolPaths no_single_perimeter_tool_paths(last_p, bead_width_0, perimeter_spacing, coord_t(inner_loop_number + 2), wall_0_inset, layer_height, input_params_tmp);
perimeters = no_single_perimeter_tool_paths.getToolPaths();
infill_contour = union_ex(no_single_perimeter_tool_paths.getInnerContour());
}
}
//PS
-1
View File
@@ -87,7 +87,6 @@
#include "libslic3r/GCode/Thumbnails.hpp"
namespace fs = boost::filesystem;
using json = nlohmann::json;
using boost::property_tree::ptree;
-2
View File
@@ -87,8 +87,6 @@
// This breaks compatibility with the upstream Slic3r if the --datadir is used to switch between the two versions.
//#define SLIC3R_PROFILE_USE_PRESETS_SUBDIR
using json = nlohmann::json;
namespace Slic3r {
// Project-level options imported from a loaded 3MF into project_config. s_project_options_published
+1 -1
View File
@@ -1580,7 +1580,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
{
std::vector<int> result_filaments;
//result_filaments.reserve(conflict_filaments.size());
std::set_intersection (conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(), unprintable_filament_vec[index].end(), std::insert_iterator<std::vector<int>>(result_filaments, result_filaments.begin()));
std::set_intersection (conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(), unprintable_filament_vec[index].end(), insert_iterator<vector<int>>(result_filaments, result_filaments.begin()));
conflict_filament_vector = result_filaments;
}
}
-1
View File
@@ -69,7 +69,6 @@
#include <wx/dcmemory.h>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r { namespace GUI {
+2 -2
View File
@@ -11,7 +11,7 @@
#include "slic3r/GUI/Widgets/Button.hpp"
#include "slic3r/GUI/Widgets/ComboBox.hpp"
#include <string>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <wx/notebook.h>
#include <wx/scrolwin.h>
#include <wx/sizer.h>
@@ -246,7 +246,7 @@ public:
void create_folder(wxString name = wxEmptyString);
std::string replaceSpace(std::string s, std::string ts, std::string ns);
void on_import_file(wxCommandEvent &event);
void Reload(wxString aux_path, std::map<std::string, std::vector<nlohmann::json>> paths);
void Reload(wxString aux_path, std::map<std::string, std::vector<json>> paths);
void update_all_panel();
void update_all_cover();
+1 -3
View File
@@ -26,7 +26,7 @@
#include <memory>
#include "slic3r/GUI/BBLStatusBarBind.hpp"
#include "slic3r/GUI/Jobs/BindJob.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/DeviceCore/DevDefs.h"
#include "slic3r/GUI/Jobs/Worker.hpp"
#include <utility>
@@ -54,8 +54,6 @@
#include "DeviceCore/DevManager.h"
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -25,7 +25,7 @@
#include "slic3r/GUI/Widgets/RadioBox.hpp"
#include <cstdio>
#include <map>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <cstdlib>
#include "slic3r/GUI/GUI_Utils.hpp"
#include "slic3r/GUI/Widgets/Label.hpp"
@@ -91,8 +91,6 @@
#define SELECT_ALL_OPTION_COLOUR wxColour("#009688")
#define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC")
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -1,12 +1,10 @@
#include "DevAxis.h"
#include "DevUtil.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/DeviceCore/DevDefs.h"
using json = nlohmann::json;
namespace Slic3r
{
+2 -1
View File
@@ -2,6 +2,7 @@
#include <memory>
#include <nlohmann/json.hpp>
#include <string>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r {
@@ -21,7 +22,7 @@ public:
bool IsArchCoreXY() const;
public:
void ParseAxis(const nlohmann::json &print_json);
void ParseAxis(const json &print_json);
int Ctrl_GoHome();
int Ctrl_Axis(std::string axis, double unit = 1.0f, double input_val = 1.0f, int speed = 3000); // xyz e
+1 -3
View File
@@ -1,13 +1,11 @@
#include "DevAxis.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <string>
#include <cstdlib>
#include <cstdio>
using json = nlohmann::json;
namespace Slic3r
{
+1 -3
View File
@@ -1,9 +1,7 @@
#include "DevBed.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using json = nlohmann::json;
namespace Slic3r {
void DevBed::ParseV1_0(const json &print_json, DevBed *system)
+3 -2
View File
@@ -1,5 +1,6 @@
#pragma once
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r {
@@ -15,8 +16,8 @@ public:
public:
static void ParseV1_0(const nlohmann::json &print_json, DevBed *system);
static void ParseV2_0(const nlohmann::json &print_json, DevBed *system);
static void ParseV1_0(const json &print_json, DevBed *system);
static void ParseV2_0(const json &print_json, DevBed *system);
private:
+1 -3
View File
@@ -1,6 +1,6 @@
#include <algorithm>
#include <boost/log/trivial.hpp>
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
@@ -22,8 +22,6 @@
#include "DevFilaSystem.h"
#include "DevConfig.h"
using json = nlohmann::json;
namespace Slic3r {
static float string_to_float(const std::string &str_value)
+8 -7
View File
@@ -2,6 +2,7 @@
#include <nlohmann/json.hpp>
#include <optional>
#include <vector>
#include "slic3r/Utils/json_diff.hpp"
#include "DevDefs.h"
@@ -85,11 +86,11 @@ public:
std::vector<FlowRatioCalibResult> GetFlowRatioResult() const {return m_flow_ratio_results; }
protected:
void ExtrusionCalibSetParse(const nlohmann::json &jj);
void ExtrusionCalibSelectParse(const nlohmann::json &jj);
void ExtrusionCalibGetTableParse(const nlohmann::json &jj);
void ExtrusionCalibGetResultParse(const nlohmann::json &jj);
void FlowrateGetResultParse(const nlohmann::json &jj);
void ExtrusionCalibSetParse(const json &jj);
void ExtrusionCalibSelectParse(const json &jj);
void ExtrusionCalibGetTableParse(const json &jj);
void ExtrusionCalibGetResultParse(const json &jj);
void FlowrateGetResultParse(const json &jj);
private:
MachineObject* m_owner{nullptr};
@@ -118,11 +119,11 @@ private:
bool m_calib_finished{false};
public:
static void ParseCalibVersion(const nlohmann::json& j, DevCalib* system);
static void ParseCalibVersion(const json& j, DevCalib* system);
static void ParseSupportNewAutoCalib(int flag, DevCalib* system);
static void ParseV1_0(const nlohmann::json& print_json, DevCalib* system, bool key_field_only);
static void ParseV1_0(const json& print_json, DevCalib* system, bool key_field_only);
};
} // namespace Slic3r
+1 -3
View File
@@ -3,11 +3,9 @@
#include "DevConfig.h"
#include "DevUtil.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using json = nlohmann::json;
namespace Slic3r {
bool DevChamber::HasChamber() const { return m_owner->GetConfig()->HasChamber(); }
+4 -3
View File
@@ -1,6 +1,7 @@
#pragma once
#include <memory>
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r {
@@ -24,10 +25,10 @@ public: // getter
public:
// setter
void ParseChamber(const nlohmann::json &print_json);
void ParseChamber(const json &print_json);
void ParseChamberV1_0(const nlohmann::json& print_json);
void ParseChamberV2_0(const nlohmann::json& print_json);
void ParseChamberV1_0(const json& print_json);
void ParseChamberV2_0(const json& print_json);
// control
int CtrlSetChamberTemp(int temp);
+1 -3
View File
@@ -1,10 +1,8 @@
#include "DevChamber.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <string>
using json = nlohmann::json;
namespace Slic3r {
int DevChamber::CtrlSetChamberTemp(int temp)
+1
View File
@@ -2,6 +2,7 @@
#include "DevConfig.h"
#include "DevUtil.h"
#include "json_diff.hpp"
using namespace nlohmann;
+5 -5
View File
@@ -1,7 +1,7 @@
#pragma once
#include "libslic3r/CommonDefs.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <wx/string.h>
#include <limits>
@@ -47,11 +47,11 @@ public:
public:
/*Setters*/
void ParseConfig(const nlohmann::json& print_json);
void ParseConfig(const json& print_json);
void ParseChamberConfig(const nlohmann::json& print_json); // chamber
void ParsePrintOptionsConfig(const nlohmann::json& print_json); // print options
void ParseCalibrationConfig(const nlohmann::json& print_json); //cali
void ParseChamberConfig(const json& print_json); // chamber
void ParsePrintOptionsConfig(const json& print_json); // print options
void ParseCalibrationConfig(const json& print_json); //cali
private:
[[maybe_unused]] MachineObject* m_obj;
+1 -1
View File
@@ -1,6 +1,6 @@
#include "DevConfigUtil.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <string>
+1
View File
@@ -4,6 +4,7 @@
#include "DevCtrl.h"
// TODO: remove this include
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using namespace nlohmann;
+3 -3
View File
@@ -1,6 +1,6 @@
#pragma once
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <string>
#include <ctime>
#include <wx/string.h>
@@ -15,7 +15,7 @@ class DevCtrlInfo
{
public:
DevCtrlInfo() {};
DevCtrlInfo(MachineObject* obj, int sequence_id, const nlohmann::json& req_json, int interval_max = 3, int interval_min = 0);
DevCtrlInfo(MachineObject* obj, int sequence_id, const json& req_json, int interval_max = 3, int interval_min = 0);
public:
bool CheckCanUpdateData(const nlohmann::json& jj);
@@ -32,7 +32,7 @@ private:
time_t m_request_time = 0;
int m_request_seq = 0;
nlohmann::json m_request_json = nlohmann::json();
json m_request_json = json();
// check
int m_request_interval_max = 3;
+1 -1
View File
@@ -3,7 +3,7 @@
#include <optional>
#include "libslic3r/CommonDefs.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <wx/string.h>
#include "DevDefs.h"
@@ -15,6 +15,7 @@
#include "DevFilaSystem.h" // complete type for GetFilaSystem()->GetTrayIndexMap() in GetBackupAmsSlotInGroup
// TODO: remove this include
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/I18N.hpp"
@@ -5,7 +5,7 @@
#include <unordered_map>
#include "libslic3r/CommonDefs.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <vector>
#include <wx/string.h>
+1
View File
@@ -6,6 +6,7 @@
#include <string>
#include <vector>
#include <wx/app.h>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using namespace nlohmann;
+6 -5
View File
@@ -2,6 +2,7 @@
#include <functional>
#include <cstdint>
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <map>
#include <vector>
@@ -12,7 +13,7 @@ namespace Slic3r {
class MachineObject;
enum AirDuctType { AIR_FAN_TYPE, AIR_DOOR_TYPE };
typedef std::function<void(const nlohmann::json &)> CommandCallBack;
typedef std::function<void(const json &)> CommandCallBack;
enum AIR_FUN : int {
FAN_HEAT_BREAK_0_IDX = 0,
@@ -122,14 +123,14 @@ public:
AirDuctData GetAirDuctData() { return m_air_duct_data; };
void converse_to_duct(bool is_suppt_part_fun, bool is_suppt_aux_fun, bool is_suppt_cham_fun); // Convert the data to duct type to make the newand old protocols consistent
int command_handle_response(const nlohmann::json &response);
int command_handle_response(const json &response);
int command_control_fan(int fan_type, int val); // Old protocol
int command_control_fan_new(int fan_id, int val); // New protocol
int command_control_air_duct(int mode_id, int submode, const CommandCallBack& cb);
void ParseV1_0(const nlohmann::json &print_json);
void ParseV2_0(const nlohmann::json &print_json);
void ParseV3_0(const nlohmann::json &print_json);
void ParseV1_0(const json &print_json);
void ParseV2_0(const json &print_json);
void ParseV3_0(const json &print_json);
public:
bool GetSupportAirduct() { return is_support_airduct; };
@@ -1,13 +1,11 @@
#include "DevFilaAmsSetting.h"
#include "DevFilaSystem.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <string>
#include "slic3r/GUI/DeviceCore/DevCtrl.h"
using json = nlohmann::json;
namespace Slic3r {
int DevAmsSystemFirmwareSwitch::CrtlSwitchFirmware(int firmware_idx)
{
@@ -14,6 +14,7 @@
#include "slic3r/GUI/DeviceCore/DevDefs.h"
#include "DevFilaBlackList.h"
#include "json_diff.hpp"
#include "slic3r/Utils/NetworkAgent.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "DevFilaSystem.h"
+2 -2
View File
@@ -5,7 +5,7 @@
#include <string>
#include <vector>
#include <wx/string.h>
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r
{
@@ -67,7 +67,7 @@ public:
static CheckResult check_filaments_in_blacklist(const CheckFilamentInfo& info);
public:
static nlohmann::json filaments_blacklist;
static json filaments_blacklist;
};// class DevFilaBlacklist
}// namespace Slic3r
@@ -18,6 +18,7 @@
#include <set>
#include <utility>
#include "DevFilaSystem.h"
#include "json_diff.hpp"
#include "slic3r/Utils/NetworkAgent.hpp"
#include "DevNozzleSystem.h" // DevNozzle / DevNozzleSystem for GetNozzleFlowStringByAmsId
+3 -3
View File
@@ -1,6 +1,6 @@
#pragma once
#include "libslic3r/CommonDefs.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include "DevDefs.h"
#include "DevFilaAmsSetting.h"
@@ -415,9 +415,9 @@ private:
class DevFilaSystemParser
{
public:
static void ParseV1_0(const nlohmann::json& print_json, MachineObject* obj, DevFilaSystem* system, bool key_field_only);
static void ParseV1_0(const json& print_json, MachineObject* obj, DevFilaSystem* system, bool key_field_only);
static void ParseAgentFilament(const nlohmann::json& data, MachineObject* obj, DevFilaSystem* system);
static void ParseAgentFilament(const json& data, MachineObject* obj, DevFilaSystem* system);
};
struct DevFilamentDryingPreset
@@ -2,6 +2,7 @@
#include <string>
#include "DevFilaSystem.h"
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"// TODO: remove this include
using namespace nlohmann;
+5 -3
View File
@@ -1,9 +1,11 @@
#pragma once
#include "DevFirmware.h"
#include "slic3r/Utils/json_diff.hpp"
#include <nlohmann/json.hpp>
#include <string>
#include <wx/string.h>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r {
@@ -49,10 +51,10 @@ public:
bool isCuttingModule() const { return product_name.Contains("Cutting Module"); }
bool isRotary() const { return product_name.Contains("Rotary"); }// Rotary Attachment
bool isExtinguishSystem() const { return product_name.Contains("Extinguishing System"); }// Auto Fire Extinguishing System
bool isWTM() const { return name.find("wtm") != std::string::npos; } // nozzle
bool isWTM() const { return name.find("wtm") != string::npos; } // nozzle
bool isExhaustFan() const { return product_name.Contains("Exhaust Fan"); }
bool isHmshub() const { return product_name.find("Filament Buffer") != std::string::npos; }
bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != std::string::npos; }
bool isHmshub() const { return product_name.find("Filament Buffer") != string::npos; }
bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != string::npos; }
};
+1 -3
View File
@@ -2,12 +2,10 @@
#include "DevHMS.h"
#include <string>
#include <cstdio>
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include <exception>
#include <cassert>
using json = nlohmann::json;
namespace Slic3r
{
+3 -3
View File
@@ -1,6 +1,6 @@
#pragma once
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <vector>
#include <string>
#include <wx/string.h>
@@ -18,7 +18,7 @@ public:
DevHMS(MachineObject* obj) : m_object(obj) {}
public:
void ParseHMSItems(const nlohmann::json& hms_json);
void ParseHMSItems(const json& hms_json);
const std::vector<DevHMSItem>& GetHMSItems() const { return m_hms_list; };
private:
@@ -69,7 +69,7 @@ public:
bool has_read() const { return m_already_read; };
protected:
friend void DevHMS::ParseHMSItems(const nlohmann::json& hms_json);
friend void DevHMS::ParseHMSItems(const json& hms_json);
bool parse_hms_info(unsigned attr, unsigned code);
private:
@@ -3,6 +3,7 @@
#include "DevLamp.h"
// TODO: remove this include
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using namespace nlohmann;
+1
View File
@@ -23,6 +23,7 @@
#include "DevUtil.h"
// TODO: remove this include
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/GUI_App.hpp"
+1
View File
@@ -3,6 +3,7 @@
#include <mutex>
#include "libslic3r/CommonDefs.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <string>
#include <vector>
#include <wx/object.h>
@@ -6,6 +6,7 @@
#include "DevUtil.h"
#include "DevUtilBackend.h"
#include "json_diff.hpp"
#include "libslic3r/MultiNozzleUtils.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
+1 -1
View File
@@ -1,7 +1,7 @@
#pragma once
#include "libslic3r/CommonDefs.hpp"
#include "libslic3r/MultiNozzleUtils.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include "DevNozzleSystem.h"
#include "DevFirmware.h"
@@ -1,7 +1,7 @@
#include "DevNozzleRack.h"
#include "DevExtruderSystem.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/MsgDialog.hpp"
#include "slic3r/GUI/I18N.hpp"
@@ -14,8 +14,6 @@
#include "slic3r/GUI/DeviceCore/DevNozzleSystem.h"
using json = nlohmann::json;
namespace Slic3r
{
@@ -4,7 +4,7 @@
#include "DevNozzleSystem.h"
#include "DevUtil.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/I18N.hpp"
@@ -28,8 +28,6 @@
#include <optional>
#include <cmath>
using json = nlohmann::json;
namespace Slic3r
{
+2 -2
View File
@@ -4,7 +4,7 @@
#include "libslic3r/CommonDefs.hpp"
#include "libslic3r/MultiNozzleUtils.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include "libslic3r/PrintConfig.hpp"
#include <string>
@@ -195,6 +195,6 @@ namespace Slic3r
{
public:
static void ParseV1_0(const nlohmann::json& nozzletype_json, const nlohmann::json& diameter_json, DevNozzleSystem* system, std::optional<int> flag_e3d);
static void ParseV2_0(const nlohmann::json& device_json, DevNozzleSystem* system);
static void ParseV2_0(const json& device_json, DevNozzleSystem* system);
};
};
@@ -8,11 +8,9 @@
#include <ctime>
#include <exception>
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using json = nlohmann::json;
namespace Slic3r
{
+1 -3
View File
@@ -1,10 +1,8 @@
#include "DevStorage.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include <string>
using json = nlohmann::json;
namespace Slic3r {
DevStorage::SdcardState Slic3r::DevStorage::set_sdcard_state(int state)
+2 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#include <nlohmann/json.hpp>
#include <string>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r {
@@ -26,7 +27,7 @@ public:
SdcardState get_sdcard_state() const { return m_sdcard_state; };
SdcardState set_sdcard_state(int state);
static void ParseV1_0(const nlohmann::json &print_json, DevStorage *system);
static void ParseV1_0(const json &print_json, DevStorage *system);
bool is_timelapse_storage_low(const std::string& storage) const;
+1 -3
View File
@@ -1,7 +1,7 @@
#include "DevUpgrade.h"
#include "DevUtil.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/GUI_App.hpp"
@@ -13,8 +13,6 @@
#include "slic3r/GUI/DeviceCore/DevDefs.h"
#include <wx/string.h>
using json = nlohmann::json;
namespace Slic3r {
int DevUpgrade::GetUpgradeProgressInt() const
+4 -3
View File
@@ -4,6 +4,7 @@
#include <nlohmann/json.hpp>
#include <string>
#include <wx/string.h>
#include "slic3r/Utils/json_diff.hpp"
#include "DevDefs.h"
#include "DevFirmware.h"
@@ -46,8 +47,8 @@ public:
int CtrlUpgradeModule(std::string url, std::string module_type, std::string version);
// parser
void ParseUpgrade_V1_0(const nlohmann::json &print_jj);
void ParseUpgradeDisplayState(const nlohmann::json &upgrade_state_jj);
void ParseUpgrade_V1_0(const json &print_jj);
void ParseUpgradeDisplayState(const json &upgrade_state_jj);
protected:
DevUpgrade(MachineObject *owner) : m_owner(owner) {}
@@ -89,7 +90,7 @@ public:
public:
int CtrlGetVersion(bool with_retry = true);
void ParseGetVersion(const nlohmann::json &print_jj);
void ParseGetVersion(const json &print_jj);
private:
MachineObject *m_owner;
+1 -3
View File
@@ -1,12 +1,10 @@
#include "DevUpgrade.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <string>
#include "slic3r/GUI/DeviceCore/DevFirmware.h"
using json = nlohmann::json;
namespace Slic3r {
int DevUpgrade::CtrlUpgradeConfirm()
+1 -3
View File
@@ -1,5 +1,5 @@
#include "PrinterNetworkTypes.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "DeviceManager.hpp"
#include "HMS.hpp"
#include "I18N.hpp"
@@ -105,8 +105,6 @@
#include "libslic3r/PresetBundle.hpp"
#include "slic3r/GUI/Jobs/SendJob.hpp"
using json = nlohmann::json;
class wxWindow;
namespace fs = boost::filesystem;
+10 -9
View File
@@ -63,6 +63,7 @@
#define END_SEQ_ID 30000
#define SUBSCRIBE_RETRY_COUNT 5
using namespace nlohmann;
namespace Slic3r {
namespace GUI
@@ -466,7 +467,7 @@ public:
std::string get_print_error_str() const { return MachineObject::get_error_code_str(this->print_error); }
std::unordered_set<GUI::DeviceErrorDialog*> m_command_error_code_dlgs;
void add_command_error_code_dlg(int command_err, nlohmann::json action_json=nlohmann::json{});
void add_command_error_code_dlg(int command_err, json action_json=json{});
int curr_layer = 0;
int total_layers = 0;
@@ -758,9 +759,9 @@ public:
int command_set_printer_nozzle2(int id, std::string nozzle_type, float diameter);
int command_get_access_code();
int command_start_camera();
int command_ack_proceed(nlohmann::json& proceed);
int command_ack_proceed(json& proceed);
int command_purification_disable();
int command_dont_remind_next_time(nlohmann::json& mqtt_guard_json);
int command_dont_remind_next_time(json& mqtt_guard_json);
/* command upgrade */
int command_upgrade_confirm();
@@ -886,7 +887,7 @@ public:
static bool is_in_printing_status(std::string status);
void set_print_state(std::string status);
void update_print_progress(const nlohmann::json& value);
void update_print_progress(const json& value);
bool is_connected();
bool is_connecting();
@@ -902,7 +903,7 @@ public:
/* Msg for display MsgFn */
typedef std::function<void(std::string topic, std::string payload)> MsgFn;
int publish_json(const nlohmann::json& json_item, int qos = 0, int flag = 0) ;
int publish_json(const json& json_item, int qos = 0, int flag = 0) ;
int publish_json(const std::string& json_str, int qos = 0, int flag = 0) = delete;
int cloud_publish_json(std::string json_str, int qos = 0, int flag = 0);
int local_publish_json(std::string json_str, int qos = 0, int flag = 0);
@@ -946,16 +947,16 @@ public:
* or scenarios where users want to bypass the AMS.
*/
std::vector<DevAmsTray> vt_slot;
DevAmsTray parse_vt_tray(nlohmann::json vtray);
DevAmsTray parse_vt_tray(json vtray);
/*get ams slot info*/
bool contains_tray(const std::string &ams_id, const std::string &tray_id) const;
DevAmsTray get_tray(const std::string &ams_id, const std::string &tray_id) const;/*use contains_tray() check first*/
/*for parse new info*/
bool check_enable_np(const nlohmann::json& print) const;
void parse_new_info(nlohmann::json print);
void parse_new_info2(const nlohmann::json& info);
bool check_enable_np(const json& print) const;
void parse_new_info(json print);
void parse_new_info2(const json& info);
int get_flag_bits(std::string str, int start, int count = 1) const;
uint32_t get_flag_bits_no_border(std::string str, int start_idx, int count = 1) const;
int get_flag_bits(int num, int start, int count = 1, int base = 10) const;
+1 -1
View File
@@ -67,7 +67,7 @@ public:
void on_script_message(const nlohmann::json& payload) override;
void OnRequestPresets();
void OnExportData(const wxString& path, const wxString& name, nlohmann::json data);
void OnExportData(const wxString& path, const wxString& name, json data);
protected:
bool m_seq_top_layer_only_changed{false};
+7 -7
View File
@@ -2816,7 +2816,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
}
return ret;
};
auto calculate_offsets = [max_width, window_padding](const std::vector<std::pair<std::string, std::vector<std::string>>>& title_columns, float extra_size = 0.0f) {
auto calculate_offsets = [max_width, window_padding](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) {
const ImGuiStyle& style = ImGui::GetStyle();
std::vector<float> offsets;
offsets.push_back(max_width(title_columns[0].second, title_columns[0].first, extra_size) + 3.0f * style.ItemSpacing.x + style.WindowPadding.x);
@@ -2963,7 +2963,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
}
::sprintf(buff, "%.2f", longest_str);
std::vector<std::pair<std::string, std::vector<std::string>>> title_columns;
std::vector<std::pair<std::string, std::vector<::string>>> title_columns;
if (displayed_columns & ColumnData::Model) {
title_columns.push_back({ _u8L("Filament"), {""} });
title_columns.push_back({ _u8L("Model"), {buff} });
@@ -3184,7 +3184,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
float ams_item_height = 0;
float filament_group_item_align_width = 0;
{
float three_words_width = imgui.calc_text_size(std::string_view("ABC")).x;
float three_words_width = imgui.calc_text_size("ABC"sv).x;
const int line_capacity = 4;
for (const auto& extruder_filaments : {m_left_extruder_filament,m_right_extruder_filament })
@@ -3195,8 +3195,8 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
for (int j = idx; j < extruder_filaments.size() && j < idx + line_capacity; ++j) {
auto text_info = imgui.calculate_filament_group_text_size(get_filament_display_type(extruder_filaments[j]));
auto text_size = std::get<0>(text_info);
filament_group_item_align_width = std::max(filament_group_item_align_width, text_size.x);
text_line_height = std::max(text_line_height, text_size.y);
filament_group_item_align_width = max(filament_group_item_align_width, text_size.x);
text_line_height = max(text_line_height, text_size.y);
}
container_height += (three_words_width * 1.3f + text_line_height );
}
@@ -3589,7 +3589,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
return ret;
};
auto calculate_offsets = [max_width, this](const std::vector<std::pair<std::string, std::vector<std::string>>>& title_columns, float extra_size = 0.0f) {
auto calculate_offsets = [max_width, this](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) {
const ImGuiStyle& style = ImGui::GetStyle();
std::vector<float> offsets;
// ORCA increase spacing for more readable format. Using direct number requires much less code change in here. GetTextLineHeight for additional spacing for icon_size
@@ -4014,7 +4014,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
total_filaments.push_back(buffer);
std::vector<std::pair<std::string, std::vector<std::string>>> title_columns;
std::vector<std::pair<std::string, std::vector<::string>>> title_columns;
if (displayed_columns & ColumnData::Model) {
title_columns.push_back({ _u8L("Filament"), {""} });
title_columns.push_back({ _u8L("Model"), total_filaments });
-7
View File
@@ -7970,16 +7970,9 @@ void GLCanvas3D::_render_fps_overlay(int fps) const
const float margin = 10.0f * get_scale();
const ImVec2 display_size = ImGui::GetIO().DisplaySize;
ImVec2 pos(display_size.x - margin, margin);
// Last frame's size; zero until the overlay has been shown once.
const ImGuiWindow* self = ImGui::FindWindowByName("###fps_overlay");
const float left = pos.x - (self != nullptr ? self->Size.x : 0.0f);
// The Preview legend takes the top-right corner.
if (const ImGuiWindow* legend = ImGui::FindWindowByName("Legend"); m_canvas_type == ECanvasType::CanvasPreview && legend != nullptr && legend->Active)
pos = ImVec2(legend->Pos.x - margin, legend->Pos.y);
// The toolbar row can reach the corner on a narrow canvas; stack the overlay below it then.
else if (m_main_toolbar.is_enabled() &&
get_main_toolbar_offset() + m_main_toolbar.get_width() + m_separator_toolbar.get_width() + m_gizmos.get_scaled_total_width() + m_assemble_view_toolbar.get_width() > left)
pos.y = std::max(m_main_toolbar.get_height(), m_gizmos.get_scaled_total_height()) + margin;
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(1.0f, 0.0f));
ImGui::SetNextWindowBgAlpha(0.35f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f * get_scale());
-1
View File
@@ -311,7 +311,6 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS2)(
using namespace std::literals;
namespace pt = boost::property_tree;
using json = nlohmann::json;
struct StaticBambuLib
{
+27 -26
View File
@@ -41,20 +41,19 @@ namespace GUI
ObjectLayers::ObjectLayers(wxWindow* parent) :
OG_Settings(parent, true)
{
m_grid_sizer = new wxFlexGridSizer(5, parent ? parent->FromDIP(2) : 2, wxGetApp().em_unit()); // Title, Min Z, "to", Max Z, buttons sizer
m_grid_sizer = new wxFlexGridSizer(5, 0, wxGetApp().em_unit()); // Title, Min Z, "to", Max Z, unit & buttons sizer
m_grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
m_grid_sizer->AddGrowableCol(1);
m_grid_sizer->AddGrowableCol(3);
m_og->activate();
m_og->sizer->Clear(true);
m_og->sizer->Add(m_grid_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, parent ? parent->FromDIP(2) : 2);
m_og->sizer->Add(m_grid_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, 5);
if (auto stb = dynamic_cast<LabeledStaticBox*>(m_og->stb))
stb->SetCornerRadius(0);
m_bmp_delete = ScalableBitmap(parent, "delete");
m_bmp_add = ScalableBitmap(parent, "add");
m_bmp_layer = ScalableBitmap(parent, "height_range_layer");
}
void ObjectLayers::select_editor(LayerRangeEditor* editor, const bool is_last_edited_range)
@@ -96,14 +95,10 @@ wxSizer* ObjectLayers::create_layer(const t_layer_height_range& range, PlusMinus
};
// Add text
auto title_sizer = new wxBoxSizer(wxHORIZONTAL);
auto head_text = new wxStaticText(m_og->ctrl_parent(), wxID_ANY, _L("Range"));
auto head_text = new wxStaticText(m_og->ctrl_parent(), wxID_ANY, _L("Height Range"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
head_text->SetBackgroundStyle(wxBG_STYLE_PAINT);
head_text->SetFont(wxGetApp().normal_font());
auto icon = new wxStaticBitmap(m_og->ctrl_parent(), wxID_ANY, m_bmp_layer.bmp());
title_sizer->Add(icon, 0, wxALIGN_CENTER_VERTICAL);
title_sizer->Add(head_text, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, m_og->ctrl_parent()->FromDIP(5));
m_grid_sizer->Add(title_sizer, 0, wxALIGN_CENTER_VERTICAL);
m_grid_sizer->Add(head_text, 0, wxALIGN_CENTER_VERTICAL);
// Add control for the "Min Z"
@@ -131,7 +126,7 @@ wxSizer* ObjectLayers::create_layer(const t_layer_height_range& range, PlusMinus
m_grid_sizer->Add(editor, 1, wxEXPAND);
auto middle_text = new wxStaticText(m_og->ctrl_parent(), wxID_ANY, "-");
auto middle_text = new wxStaticText(m_og->ctrl_parent(), wxID_ANY, _L("to"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
middle_text->SetBackgroundStyle(wxBG_STYLE_PAINT);
middle_text->SetFont(wxGetApp().normal_font());
m_grid_sizer->Add(middle_text, 0, wxALIGN_CENTER_VERTICAL);
@@ -161,6 +156,11 @@ wxSizer* ObjectLayers::create_layer(const t_layer_height_range& range, PlusMinus
m_grid_sizer->Add(editor, 1, wxEXPAND);
auto sizer2 = new wxBoxSizer(wxHORIZONTAL);
auto unit_text = new wxStaticText(m_og->ctrl_parent(), wxID_ANY, _L("mm"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
unit_text->SetBackgroundStyle(wxBG_STYLE_PAINT);
unit_text->SetFont(wxGetApp().normal_font());
sizer2->Add(unit_text, 0, wxALIGN_CENTER_VERTICAL);
m_grid_sizer->Add(sizer2, 0, wxALIGN_CENTER_VERTICAL);
// BBS
@@ -205,9 +205,8 @@ void ObjectLayers::create_layers_list()
auto sizer = create_layer(range, del_btn, add_btn);
auto b_sizer = new wxBoxSizer(wxHORIZONTAL);
b_sizer->Add(del_btn, 0, wxLEFT, m_og->ctrl_parent()->FromDIP(5));
b_sizer->AddSpacer(m_og->ctrl_parent()->FromDIP(15));
b_sizer->Add(add_btn, 0, wxRIGHT, m_og->ctrl_parent()->FromDIP(5));
b_sizer->Add(del_btn, 0, wxRIGHT | wxLEFT, em_unit(m_parent));
b_sizer->Add(add_btn);
sizer->Add(b_sizer, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, m_parent->FromDIP(1)); // aligns +/- buttons vertically since we got 1px gap on bottom of icons
del_btn->Bind(wxEVT_BUTTON, [del_btn](wxEvent &) {
@@ -278,7 +277,6 @@ void ObjectLayers::msw_rescale()
{
m_bmp_delete.msw_rescale();
m_bmp_add.msw_rescale();
m_bmp_layer.msw_rescale();
m_grid_sizer->SetHGap(wxGetApp().em_unit());
@@ -369,17 +367,20 @@ LayerRangeEditor::LayerRangeEditor( ObjectLayers* parent,
m_valid_value(value),
m_type(type),
m_set_focus_data(set_focus_data_fn),
TextInput(parent->m_og->ctrl_parent(), value, _L("mm"), "", wxDefaultPosition, wxSize(em_unit(parent->m_parent), wxDefaultCoord), wxTE_PROCESS_ENTER)
wxTextCtrl(parent->m_og->ctrl_parent(), wxID_ANY, value, wxDefaultPosition,
wxSize(em_unit(parent->m_parent), wxDefaultCoord), wxTE_PROCESS_ENTER
#ifdef _WIN32
| wxBORDER_SIMPLE
#endif
)
{
this->SetFont(wxGetApp().normal_font());
wxGetApp().UpdateDarkUI(this);
wxTextCtrl* ctrl = GetTextCtrl();
// Reset m_enter_pressed flag to _false_, when value is editing
ctrl->Bind(wxEVT_TEXT, [this](wxEvent&) { m_enter_pressed = false; }, ctrl->GetId());
this->Bind(wxEVT_TEXT, [this](wxEvent&) { m_enter_pressed = false; }, this->GetId());
ctrl->Bind(wxEVT_TEXT_ENTER, [this, edit_fn](wxCommandEvent& e)
this->Bind(wxEVT_TEXT_ENTER, [this, edit_fn](wxEvent&)
{
m_enter_pressed = true;
// If LayersList wasn't updated/recreated, we can call wxEVT_KILL_FOCUS.Skip()
@@ -394,9 +395,9 @@ LayerRangeEditor::LayerRangeEditor( ObjectLayers* parent,
SetValue(m_valid_value);
m_call_kill_focus = true;
}
}, ctrl->GetId());
}, this->GetId());
ctrl->Bind(wxEVT_KILL_FOCUS, [this, edit_fn](wxFocusEvent& e)
this->Bind(wxEVT_KILL_FOCUS, [this, edit_fn](wxFocusEvent& e)
{
if (!m_enter_pressed) {
#ifndef __WXGTK__
@@ -425,14 +426,14 @@ LayerRangeEditor::LayerRangeEditor( ObjectLayers* parent,
m_call_kill_focus = false;
e.Skip();
}
}, ctrl->GetId());
}, this->GetId());
ctrl->Bind(wxEVT_SET_FOCUS, [this, parent](wxFocusEvent& e)
this->Bind(wxEVT_SET_FOCUS, [this, parent](wxFocusEvent& e)
{
set_focus_data();
parent->update_scene_from_editor_selection();
e.Skip();
}, ctrl->GetId());
}, this->GetId());
#ifdef __WXGTK__ // Workaround! To take information about selectable range
this->Bind(wxEVT_LEFT_DOWN, [this](wxEvent& e)
@@ -446,7 +447,7 @@ LayerRangeEditor::LayerRangeEditor( ObjectLayers* parent,
{
// select all text using Ctrl+A
if (wxGetKeyState(wxKeyCode('A')) && wxGetKeyState(WXK_CONTROL))
GetTextCtrl()->SetSelection(-1, -1); //select all
this->SetSelection(-1, -1); //select all
event.Skip();
}));
}
@@ -476,7 +477,7 @@ coordf_t LayerRangeEditor::get_value()
void LayerRangeEditor::msw_rescale()
{
Rescale();
SetMinSize(wxSize(wxGetApp().em_unit(), wxDefaultCoord));
}
} //namespace GUI
+1 -6
View File
@@ -9,8 +9,6 @@
#include <wx/sizer.h>
#include <wx/event.h>
#include <slic3r/GUI/Widgets/TextInput.hpp>
#ifdef __WXOSX__
#include "libslic3r/PrintConfig.hpp"
#endif
@@ -36,7 +34,7 @@ enum EditorType
etLayerHeight = 4,
};
class LayerRangeEditor : public TextInput
class LayerRangeEditor : public wxTextCtrl
{
bool m_enter_pressed { false };
bool m_call_kill_focus { false };
@@ -57,8 +55,6 @@ public:
EditorType type() const {return m_type;}
void set_focus_data() const { m_set_focus_data(m_type);}
void SetValue(const wxString& value) {GetTextCtrl()->SetValue(value);}
wxString GetValue() {return GetTextCtrl()->GetValue();}
void msw_rescale();
private:
@@ -69,7 +65,6 @@ class ObjectLayers : public OG_Settings
{
ScalableBitmap m_bmp_delete;
ScalableBitmap m_bmp_add;
ScalableBitmap m_bmp_layer;
ModelObject* m_object {nullptr};
wxFlexGridSizer* m_grid_sizer;
+1 -1
View File
@@ -3651,7 +3651,7 @@ void GLGizmoCut3D::perform_cut(const Selection& selection)
// model_name failing reason
std::vector<std::pair<std::string, std::string>> failed_models;
auto plater = wxGetApp().plater();
auto fix_and_update_progress = [keep_painting](ModelObject *model_object, const int vol_idx, const std::string &model_name, ProgressDialog &progress_dlg,
auto fix_and_update_progress = [keep_painting](ModelObject *model_object, const int vol_idx, const string &model_name, ProgressDialog &progress_dlg,
std::vector<std::string> &succes_models, std::vector<std::pair<std::string, std::string>> &failed_models) {
wxString msg = _L("Repairing model object");
msg += ": " + from_u8(model_name) + "\n";
+1 -2
View File
@@ -6,7 +6,7 @@
#include "DeviceCore/DevManager.h"
#include "DeviceCore/DevUtil.h"
#include "Http.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "libslic3r/AppConfig.hpp"
#include <boost/filesystem/operations.hpp>
@@ -26,7 +26,6 @@
#include <ctime>
namespace fs = boost::filesystem;
using json = nlohmann::json;
static const char* HMS_PATH = "hms";
static const char* HMS_LOCAL_IMG_PATH = "hms/local_image";
+1 -1
View File
@@ -1405,7 +1405,7 @@ void IMSlider::render_input_custom_gcode(std::string custom_gcode)
}
void IMSlider::do_go_to_layer(size_t layer_number) {
layer_number = std::clamp((int)layer_number, m_min_value, m_max_value);
layer_number = clamp((int)layer_number, m_min_value, m_max_value);
GetSelection() == ssLower ? SetLowerValue(layer_number) : SetHigherValue(layer_number);
}
+1 -2
View File
@@ -19,7 +19,7 @@
#include <boost/log/trivial.hpp>
#include <functional>
#include <cstddef>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <wx/string.h>
#include "slic3r/GUI/PartPlate.hpp"
#include "libslic3r/PrintConfig.hpp"
@@ -39,7 +39,6 @@
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -2
View File
@@ -1,5 +1,5 @@
#include "SendJob.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "bambu_networking.hpp"
#include "libslic3r/LifecycleEvents.hpp"
#include "slic3r/GUI/I18N.hpp"
@@ -23,7 +23,6 @@
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -34,7 +34,7 @@
#include "slic3r/GUI/Widgets/SideMenuPopup.hpp"
#include <utility>
#include "libslic3r/libslic3r.h"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <algorithm>
#include <wx/dirdlg.h>
#include <exception>
@@ -155,8 +155,6 @@
#include <wx/window.h>
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
-2
View File
@@ -45,8 +45,6 @@
#include "../Utils/MacDarkMode.hpp"
#endif
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -13,7 +13,7 @@
#include "slic3r/GUI/Widgets/WebView.hpp"
#include <wx/log.h>
#include <wx/webview.h>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <exception>
#include <wx/wx.h>
#include <wx/sizer.h>
@@ -24,8 +24,6 @@
#include "GUI_App.hpp"
#include "Plater.hpp"
using json = nlohmann::json;
namespace Slic3r::GUI { class Plater; }
namespace Slic3r {
+1 -3
View File
@@ -15,7 +15,7 @@
#include "slic3r/GUI/StatusPanel.hpp"
#include "slic3r/GUI/UpgradePanel.hpp"
#include "slic3r/GUI/Widgets/SideTools.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <wx/app.h>
#include <wx/bookctrl.h>
#include <wx/button.h>
@@ -57,8 +57,6 @@
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/Widgets/Button.hpp"
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+2 -2
View File
@@ -631,8 +631,8 @@ private:
// Aditional text after hypertext - currently not used
std::string m_text2;
// mark for render operation
size_t pos_start = std::string::npos;
size_t pos_end = std::string::npos;
size_t pos_start = string::npos;
size_t pos_end = string::npos;
std::string error_start = "<Error>";
std::string error_end = "</Error>";
+1 -4
View File
@@ -16,7 +16,7 @@
#include <vector>
#include <utility>
#include "slic3r/GUI/GUI.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <wx/app.h>
#include <wx/event.h>
#include <wx/filename.h>
@@ -32,9 +32,6 @@
#include <OrcaCloudServiceAgent.hpp>
#include <wx/event.h>
#include <wx/utils.h>
using json = nlohmann::json;
namespace Slic3r { namespace GUI {
PresetBundleDialog::PresetBundleDialog(
@@ -58,8 +58,6 @@
//#define PRINTER_FILE_SYSTEM_TEST
#endif
using json = nlohmann::json;
std::string last_system_error() {
return Slic3r::decode_path(std::error_code(
#ifdef _WIN32
+8 -7
View File
@@ -22,6 +22,7 @@
#include <boost/enable_shared_from_this.hpp>
#include "nlohmann/json_fwd.hpp"
using nlohmann::json;
#include <functional>
#include <deque>
@@ -289,17 +290,17 @@ private:
static void DumpLog(void* context, int level, tchar const *msg);
private:
template<typename T> using Translator = std::function<int(nlohmann::json const &, T &, unsigned char const *)>;
template<typename T> using Translator = std::function<int(json const &, T &, unsigned char const *)>;
typedef std::function<void(int, nlohmann::json const & resp)> callback_t;
typedef std::function<void(int, json const & resp)> callback_t;
typedef std::function<int(int, nlohmann::json const &resp, unsigned char const *data)> callback_t2;
typedef std::function<int(int, json const &resp, unsigned char const *data)> callback_t2;
typedef std::function<int(std::string &msg)> callback_t3;
template<typename T> boost::uint32_t SendRequest(int type, nlohmann::json const &req, Translator<T> const &translator, Callback<T> const &callback, const std::string &param = "")
template<typename T> boost::uint32_t SendRequest(int type, json const &req, Translator<T> const &translator, Callback<T> const &callback, const std::string &param = "")
{
auto c = [translator, callback, this](int result, nlohmann::json const &resp, unsigned char const *data) -> int
auto c = [translator, callback, this](int result, json const &resp, unsigned char const *data) -> int
{
T t;
if (result == 0 || result == CONTINUE || result == FILE_EXIST) {
@@ -322,7 +323,7 @@ private:
template<typename T>
void InstallNotify(int type, Translator<T> const& translator, Applier<T> const& applier)
{
auto c = [translator, applier, this](int result, nlohmann::json const &resp, unsigned char const *data) -> int
auto c = [translator, applier, this](int result, json const &resp, unsigned char const *data) -> int
{
T t;
if (result == 0 || result == CONTINUE) {
@@ -344,7 +345,7 @@ private:
InstallNotify(type, c);
}
boost::uint32_t SendRequest(int type, nlohmann::json const &req, callback_t2 const &callback, const std::string &param = "");
boost::uint32_t SendRequest(int type, json const &req, callback_t2 const &callback, const std::string &param = "");
void InstallNotify(int type, callback_t2 const &callback);
+1 -3
View File
@@ -6,6 +6,7 @@
#include <wx/gdicmn.h>
#include <wx/settings.h>
#include <cstddef>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/GUI.hpp"
#include <exception>
#include <wx/msgdlg.h>
@@ -29,9 +30,6 @@
#include <sstream>
#include <slic3r/GUI/Widgets/WebView.hpp>
using json = nlohmann::json;
//------------------------------------------
// PrinterCloundAuthDialog
//------------------------------------------
+2 -3
View File
@@ -16,7 +16,7 @@
#include <string>
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/Auxiliary.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <cstddef>
#include <memory>
#include <map>
@@ -54,8 +54,7 @@
#include <slic3r/GUI/Widgets/WebView.hpp>
#include "slic3r/GUI/Jobs/SendJob.hpp"
#include "slic3r/GUI/Plater.hpp"
using json = nlohmann::json;
#include "slic3r/Utils/json_diff.hpp"
class wxWindow;
+2 -1
View File
@@ -30,6 +30,7 @@
#include <wx/timer.h>
#include "nlohmann/json.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <atomic>
#include <map>
@@ -108,7 +109,7 @@ public:
void OnScriptMessage(wxWebViewEvent& evt);
void RunScript(std::string content);
std::map<std::string, std::vector<nlohmann::json>> Reload(wxString aux_path);
std::map<std::string, std::vector<json>> Reload(wxString aux_path);
std::string formatBytes(unsigned long bytes);
wxString to_base64(std::string path);
};
+1 -6
View File
@@ -74,8 +74,6 @@
#include "slic3r/Utils/NetworkAgent.hpp"
#include <boost/filesystem.hpp>
using json = nlohmann::json;
namespace Slic3r::GUI { class Plater; }
namespace fs = boost::filesystem;
@@ -1818,10 +1816,7 @@ void InputIpAddressDialog::set_machine_obj(MachineObject* obj)
m_input_printer_name->GetTextCtrl()->SetLabelText(m_obj->get_dev_name());
std::string img_str = DevPrinterConfigUtil::get_printer_connect_help_img(m_obj->printer_type);
if (img_str.empty()) { img_str = "input_access_code_x1"; }
std::string language = wxGetApp().app_config->get("language");
auto diagram_bmp = create_scaled_bitmap(img_str + (language == "zh_CN" ? "_cn" : "_en"), this, 198);
auto diagram_bmp = create_scaled_bitmap(img_str + "_en", this, 198);
m_img_help->SetBitmap(diagram_bmp);
+1 -3
View File
@@ -62,7 +62,7 @@
#include <cstdio>
#include <cstddef>
#include "libslic3r/Config.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <exception>
#include <cstdlib>
#include <map>
@@ -133,8 +133,6 @@
#include "slic3r/Utils/NetworkAgent.hpp"
#include <boost/filesystem.hpp>
using json = nlohmann::json;
namespace Slic3r { class PrintBase; }
namespace fs = boost::filesystem;
+1 -2
View File
@@ -26,7 +26,7 @@
#include "slic3r/GUI/DeviceCore/DevDefs.h"
#include "slic3r/GUI/PartPlate.hpp"
#include "libslic3r/PrintConfig.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/MsgDialog.hpp"
#include "slic3r/GUI/Widgets/Label.hpp"
#include "slic3r/GUI/Widgets/TextInput.hpp"
@@ -77,7 +77,6 @@
#include <wx/dcgraph.h>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+2 -2
View File
@@ -23,7 +23,7 @@
#include <unordered_set>
#include "slic3r/GUI/wxMediaCtrl3.h"
#include "slic3r/GUI/Widgets/StaticBox.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <boost/date_time/posix_time/ptime.hpp>
#include <map>
#include "libslic3r/calib.hpp"
@@ -689,7 +689,7 @@ protected:
int m_last_vcamera = -1;
int m_model_mall_request_count = 0;
bool m_is_load_with_temp = false;
nlohmann::json m_rating_result;
json m_rating_result;
wxWebRequest web_request;
bool bed_temp_input = false;
+1 -2
View File
@@ -15,7 +15,7 @@
#include "libslic3r/Utils.hpp"
#include <string>
#include "slic3r/GUI/BBLStatusBarPrint.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <cassert>
#include "libslic3r/PrintConfig.hpp"
#include <cstdlib>
@@ -85,7 +85,6 @@
#include "slic3r/Utils/NetworkAgent.hpp"
namespace fs = boost::filesystem;
using json = nlohmann::json;
using namespace Slic3r;
using namespace Slic3r::GUI;
+1 -1
View File
@@ -2928,7 +2928,7 @@ void TabPrint::build()
optgroup->append_single_option_line("skin_infill_line_width", "strength_settings_patterns#locked-zag");
optgroup->append_single_option_line("skeleton_infill_line_width", "strength_settings_patterns#locked-zag");
optgroup->append_single_option_line("symmetric_infill_y_axis", "strength_settings_infill#symmetric-infill-y-axis");
optgroup->append_single_option_line("infill_complete_top", "strength_settings_patterns#fill-pattern-tops");
optgroup->append_single_option_line("infill_complete_top", "strength_settings_infill#infill-complete-top");
optgroup->append_single_option_line("infill_shift_step", "strength_settings_patterns#cross-hatch");
optgroup->append_single_option_line("lateral_lattice_angle_1", "strength_settings_patterns#lateral-lattice");
optgroup->append_single_option_line("lateral_lattice_angle_2", "strength_settings_patterns#lateral-lattice");
+1
View File
@@ -20,6 +20,7 @@
#include <vector>
#include <map>
#include <utility>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
using namespace nlohmann;
+1 -3
View File
@@ -1,4 +1,4 @@
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "UserManager.hpp"
#include "BindDialog.hpp"
#include "GUI_App.hpp"
@@ -10,8 +10,6 @@
#include <wx/string.h>
using json = nlohmann::json;
namespace Slic3r {
UserManager::UserManager(NetworkAgent* agent)
+3
View File
@@ -9,9 +9,12 @@
#include <chrono>
#include <boost/thread.hpp>
#include "nlohmann/json.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include "slic3r/Utils/NetworkAgent.hpp"
using namespace nlohmann;
namespace Slic3r {
class NetworkAgent;
+1 -1
View File
@@ -4,7 +4,7 @@
#include "slic3r/GUI/GUI.hpp"
#include <boost/filesystem/path.hpp>
#include <boost/log/trivial.hpp>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <exception>
#include <string.h>
#include "I18N.hpp"
+2 -1
View File
@@ -36,7 +36,7 @@
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/PresetCacheFormat.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "libslic3r_version.h"
#include <string>
@@ -78,6 +78,7 @@
#include "libslic3r/PrintConfig.hpp"
#include "slic3r/Utils/NetworkAgent.hpp"
#include "slic3r/Utils/PresetUpdater.hpp"
#include "slic3r/Utils/json_diff.hpp"
class wxWindow;
+1
View File
@@ -5,6 +5,7 @@
#include "slic3r/GUI/HttpServer.hpp"
#include <memory>
#include <boost/log/trivial.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/GUI.hpp"
#include <exception>
#include <boost/filesystem/path.hpp>
+1 -2
View File
@@ -24,7 +24,7 @@
#include <wx/filename.h>
#include <sstream>
#include <string>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <functional>
#include <cstddef>
#include <wx/dialog.h>
@@ -44,7 +44,6 @@
#include <wx/infobar.h>
namespace pt = boost::property_tree;
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -3,7 +3,7 @@
#include "../I18N.hpp"
#include "../GUI_App.hpp"
#include "../MsgDialog.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include <wx/anybutton.h>
#include <wx/event.h>
@@ -28,8 +28,6 @@
#include <wx/stattext.h>
#include <wx/sizer.h>
using json = nlohmann::json;
namespace Slic3r { namespace GUI {
wxDEFINE_EVENT(EVT_FAN_SWITCH_ON, wxCommandEvent);
+1 -2
View File
@@ -12,7 +12,7 @@
#include "Label.hpp"
#include "ComboBox.hpp"
#include "StaticBox.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Utils.hpp"
@@ -55,7 +55,6 @@
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r { namespace GUI {
+2 -3
View File
@@ -38,12 +38,11 @@
#include "Widgets/Label.hpp"
#include "MainFrame.hpp"
#include "libslic3r/PresetBundle.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/Jobs/SendJob.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <boost/filesystem.hpp>
using json = nlohmann::json;
class wxWindow;
namespace fs = boost::filesystem;
+2 -9
View File
@@ -453,16 +453,9 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in,
const bool menu_bitmap/* = false*/,
const bool resize/* = false*/,
const bool bitmap2/* = false*/,
const std::vector<std::string>& array_new_color/* = vector<std::string>*/)//used for semi transparent material)
const vector<std::string>& array_new_color/* = vector<std::string>*/)//used for semi transparent material)
{
static Slic3r::GUI::BitmapCache cache;
// An empty name means the caller's icon lookup failed
if (bmp_name_in.empty() || bmp_name_in == ".png") {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": empty bitmap name";
return wxNullBitmap;
}
if (bitmap2) {
return create_scaled_bitmap2(bmp_name_in, cache, win, px_cnt, grayscale, resize, array_new_color);
}
@@ -501,7 +494,7 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in,
wxBitmap create_scaled_bitmap2(const std::string& bmp_name_in, Slic3r::GUI::BitmapCache& cache, wxWindow* win/* = nullptr*/ ,
const int px_cnt/* = 16*/, const bool grayscale/* = false*/ , const bool resize/* = false*/ ,
const std::vector<std::string>& array_new_color/* = vector<std::string>()*/) // color witch will used instead of orange
const vector<std::string>& array_new_color/* = vector<std::string>()*/) // color witch will used instead of orange
{
unsigned int width = 0;
// win may be nullptr; see create_scaled_bitmap() above.

Some files were not shown because too many files have changed in this diff Show More