Tech ENABLE_GCODE_APP_CONFIG as default
This commit is contained in:
parent
a633979d85
commit
f04d9c1806
@ -37,9 +37,9 @@ void AppConfig::reset()
|
||||
// Override missing or keys with their defaults.
|
||||
void AppConfig::set_defaults()
|
||||
{
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (m_mode == EAppMode::Editor) {
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// Reset the empty fields to defaults.
|
||||
if (get("autocenter").empty())
|
||||
set("autocenter", "0");
|
||||
@ -91,13 +91,13 @@ void AppConfig::set_defaults()
|
||||
if (get("auto_toolbar_size").empty())
|
||||
set("auto_toolbar_size", "100");
|
||||
|
||||
#if !ENABLE_GCODE_APP_CONFIG
|
||||
#if !ENABLE_GCODE_VIEWER
|
||||
if (get("use_perspective_camera").empty())
|
||||
set("use_perspective_camera", "1");
|
||||
|
||||
if (get("use_free_camera").empty())
|
||||
set("use_free_camera", "0");
|
||||
#endif // !ENABLE_GCODE_APP_CONFIG
|
||||
#endif // !ENABLE_GCODE_VIEWER
|
||||
|
||||
#if ENABLE_ENVIRONMENT_MAP
|
||||
if (get("use_environment_map").empty())
|
||||
@ -106,7 +106,7 @@ void AppConfig::set_defaults()
|
||||
|
||||
if (get("use_inches").empty())
|
||||
set("use_inches", "0");
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
if (get("use_perspective_camera").empty())
|
||||
@ -114,7 +114,7 @@ void AppConfig::set_defaults()
|
||||
|
||||
if (get("use_free_camera").empty())
|
||||
set("use_free_camera", "0");
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
if (get("show_splash_screen").empty())
|
||||
set("show_splash_screen", "1");
|
||||
@ -197,13 +197,6 @@ std::string AppConfig::load()
|
||||
|
||||
void AppConfig::save()
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if !ENABLE_GCODE_APP_CONFIG
|
||||
if (!m_save_enabled)
|
||||
return;
|
||||
#endif // !ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// The config is first written to a file with a PID suffix and then moved
|
||||
// to avoid race conditions with multiple instances of Slic3r
|
||||
const auto path = config_path();
|
||||
@ -211,14 +204,14 @@ void AppConfig::save()
|
||||
|
||||
boost::nowide::ofstream c;
|
||||
c.open(path_pid, std::ios::out | std::ios::trunc);
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (m_mode == EAppMode::Editor)
|
||||
c << "# " << Slic3r::header_slic3r_generated() << std::endl;
|
||||
else
|
||||
c << "# " << Slic3r::header_gcodeviewer_generated() << std::endl;
|
||||
#else
|
||||
c << "# " << Slic3r::header_slic3r_generated() << std::endl;
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// Make sure the "no" category is written first.
|
||||
for (const std::pair<std::string, std::string> &kvp : m_storage[""])
|
||||
c << kvp.first << " = " << kvp.second << std::endl;
|
||||
@ -418,7 +411,7 @@ void AppConfig::reset_selections()
|
||||
|
||||
std::string AppConfig::config_path()
|
||||
{
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
std::string path = (m_mode == EAppMode::Editor) ?
|
||||
(boost::filesystem::path(Slic3r::data_dir()) / (SLIC3R_APP_KEY ".ini")).make_preferred().string() :
|
||||
(boost::filesystem::path(Slic3r::data_dir()) / (GCODEVIEWER_APP_KEY ".ini")).make_preferred().string();
|
||||
@ -426,7 +419,7 @@ std::string AppConfig::config_path()
|
||||
return path;
|
||||
#else
|
||||
return (boost::filesystem::path(Slic3r::data_dir()) / (SLIC3R_APP_KEY ".ini")).make_preferred().string();
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
std::string AppConfig::version_check_url() const
|
||||
@ -437,11 +430,11 @@ std::string AppConfig::version_check_url() const
|
||||
|
||||
bool AppConfig::exists()
|
||||
{
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
return boost::filesystem::exists(config_path());
|
||||
#else
|
||||
return boost::filesystem::exists(AppConfig::config_path());
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
}; // namespace Slic3r
|
||||
|
@ -15,7 +15,7 @@ namespace Slic3r {
|
||||
class AppConfig
|
||||
{
|
||||
public:
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
enum class EAppMode : unsigned char
|
||||
{
|
||||
Editor,
|
||||
@ -25,15 +25,11 @@ public:
|
||||
explicit AppConfig(EAppMode mode) :
|
||||
#else
|
||||
AppConfig() :
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
m_dirty(false),
|
||||
m_orig_version(Semver::invalid()),
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
m_mode(mode),
|
||||
#else
|
||||
m_save_enabled(true),
|
||||
#endif // !ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
m_legacy_datadir(false)
|
||||
{
|
||||
@ -139,11 +135,11 @@ public:
|
||||
void reset_selections();
|
||||
|
||||
// Get the default config path from Slic3r::data_dir().
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
std::string config_path();
|
||||
#else
|
||||
static std::string config_path();
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// Returns true if the user's data directory comes from before Slic3r 1.40.0 (no updating)
|
||||
bool legacy_datadir() const { return m_legacy_datadir; }
|
||||
@ -158,11 +154,11 @@ public:
|
||||
Semver orig_version() const { return m_orig_version; }
|
||||
|
||||
// Does the config file exist?
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool exists();
|
||||
#else
|
||||
static bool exists();
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
std::vector<std::string> get_recent_projects() const;
|
||||
void set_recent_projects(const std::vector<std::string>& recent_projects);
|
||||
@ -182,12 +178,6 @@ public:
|
||||
bool get_mouse_device_swap_yz(const std::string& name, bool& swap) const
|
||||
{ return get_3dmouse_device_numeric_value(name, "swap_yz", swap); }
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if !ENABLE_GCODE_APP_CONFIG
|
||||
void enable_save(bool enable) { m_save_enabled = enable; }
|
||||
#endif // !ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
static const std::string SECTION_FILAMENTS;
|
||||
static const std::string SECTION_MATERIALS;
|
||||
|
||||
@ -206,9 +196,9 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
EAppMode m_mode { EAppMode::Editor };
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// Map of section, name -> value
|
||||
std::map<std::string, std::map<std::string, std::string>> m_storage;
|
||||
@ -218,12 +208,6 @@ private:
|
||||
bool m_dirty;
|
||||
// Original version found in the ini file before it was overwritten
|
||||
Semver m_orig_version;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if !ENABLE_GCODE_APP_CONFIG
|
||||
// Whether or not calls to save() should take effect
|
||||
bool m_save_enabled;
|
||||
#endif // !ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// Whether the existing version is before system profiles & configuration updating
|
||||
bool m_legacy_datadir;
|
||||
};
|
||||
|
@ -55,7 +55,6 @@
|
||||
#define ENABLE_GCODE_VIEWER (1 && ENABLE_2_3_0_ALPHA1)
|
||||
#define ENABLE_GCODE_VIEWER_STATISTICS (0 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_VIEWER_DATA_CHECKING (0 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_APP_CONFIG (1 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_DRAG_AND_DROP_GCODE_FILES (1 && ENABLE_GCODE_VIEWER)
|
||||
|
||||
#endif // _prusaslicer_technologies_h_
|
||||
|
@ -107,11 +107,11 @@ std::string string_printf(const char *format, ...);
|
||||
// to be placed at the top of Slic3r generated files.
|
||||
std::string header_slic3r_generated();
|
||||
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
// Standard "generated by PrusaGCodeViewer version xxx timestamp xxx" header string,
|
||||
// to be placed at the top of Slic3r generated files.
|
||||
std::string header_gcodeviewer_generated();
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// getpid platform wrapper
|
||||
extern unsigned get_current_pid();
|
||||
|
@ -607,12 +607,12 @@ std::string header_slic3r_generated()
|
||||
return std::string("generated by " SLIC3R_APP_NAME " " SLIC3R_VERSION " on " ) + Utils::utc_timestamp();
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
std::string header_gcodeviewer_generated()
|
||||
{
|
||||
return std::string("generated by " GCODEVIEWER_APP_NAME " " SLIC3R_VERSION " on ") + Utils::utc_timestamp();
|
||||
}
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
unsigned get_current_pid()
|
||||
{
|
||||
|
@ -557,9 +557,9 @@ struct ConfigWizard::priv
|
||||
|
||||
priv(ConfigWizard *q)
|
||||
: q(q)
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
, appconfig_new(AppConfig::EAppMode::Editor)
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
, filaments(T_FFF)
|
||||
, sla_materials(T_SLA)
|
||||
{}
|
||||
|
@ -632,25 +632,17 @@ void GUI_App::init_app_config()
|
||||
set_data_dir(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data());
|
||||
|
||||
if (!app_config)
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
app_config = new AppConfig(is_editor() ? AppConfig::EAppMode::Editor : AppConfig::EAppMode::GCodeViewer);
|
||||
#else
|
||||
app_config = new AppConfig();
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if !ENABLE_GCODE_APP_CONFIG
|
||||
if (is_gcode_viewer())
|
||||
// disable config save to avoid to mess it up for the editor
|
||||
app_config->enable_save(false);
|
||||
#endif // !ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
// load settings
|
||||
m_app_conf_exists = app_config->exists();
|
||||
if (m_app_conf_exists) {
|
||||
std::string error = app_config->load();
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (!error.empty()) {
|
||||
// Error while parsing config file. We'll customize the error message and rethrow to be displayed.
|
||||
if (is_editor()) {
|
||||
@ -673,7 +665,7 @@ void GUI_App::init_app_config()
|
||||
_u8L("Error parsing PrusaSlicer config file, it is probably corrupted. "
|
||||
"Try to manually delete the file to recover from the error. Your user profiles will not be affected.") +
|
||||
"\n\n" + AppConfig::config_path() + "\n\n" + error);
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
}
|
||||
|
||||
@ -1087,9 +1079,9 @@ void GUI_App::check_printer_presets()
|
||||
|
||||
void GUI_App::recreate_GUI(const wxString& msg_name)
|
||||
{
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
m_is_recreating_gui = true;
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
mainframe->shutdown();
|
||||
|
||||
@ -1099,9 +1091,9 @@ void GUI_App::recreate_GUI(const wxString& msg_name)
|
||||
|
||||
MainFrame *old_main_frame = mainframe;
|
||||
mainframe = new MainFrame();
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (is_editor())
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// hide settings tabs after first Layout
|
||||
mainframe->select_tab(size_t(0));
|
||||
// Propagate model objects to object list.
|
||||
@ -1134,9 +1126,9 @@ void GUI_App::recreate_GUI(const wxString& msg_name)
|
||||
// config_wizard_startup(true);
|
||||
// });
|
||||
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
m_is_recreating_gui = false;
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
void GUI_App::system_info()
|
||||
@ -1469,17 +1461,17 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
||||
const auto config_wizard_name = _(ConfigWizard::name(true));
|
||||
const auto config_wizard_tooltip = from_u8((boost::format(_utf8(L("Run %s"))) % config_wizard_name).str());
|
||||
// Cmd+, is standard on OS X - what about other operating systems?
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (is_editor()) {
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
local_menu->Append(config_id_base + ConfigMenuWizard, config_wizard_name + dots, config_wizard_tooltip);
|
||||
local_menu->Append(config_id_base + ConfigMenuSnapshots, _L("&Configuration Snapshots") + dots, _L("Inspect / activate configuration snapshots"));
|
||||
local_menu->Append(config_id_base + ConfigMenuTakeSnapshot, _L("Take Configuration &Snapshot"), _L("Capture a configuration snapshot"));
|
||||
local_menu->Append(config_id_base + ConfigMenuUpdate, _L("Check for updates"), _L("Check for configuration updates"));
|
||||
local_menu->AppendSeparator();
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
local_menu->Append(config_id_base + ConfigMenuPreferences, _L("&Preferences") + dots +
|
||||
#ifdef __APPLE__
|
||||
"\tCtrl+,",
|
||||
@ -1487,16 +1479,16 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
||||
"\tCtrl+P",
|
||||
#endif
|
||||
_L("Application preferences"));
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
wxMenu* mode_menu = nullptr;
|
||||
if (is_editor()) {
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
local_menu->AppendSeparator();
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
mode_menu = new wxMenu();
|
||||
#else
|
||||
auto mode_menu = new wxMenu();
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeSimple, _L("Simple"), _L("Simple View Mode"));
|
||||
// mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeAdvanced, _L("Advanced"), _L("Advanced View Mode"));
|
||||
mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeAdvanced, _CTX(L_CONTEXT("Advanced", "Mode"), "Mode"), _L("Advanced View Mode"));
|
||||
@ -1506,21 +1498,21 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { if (get_mode() == comExpert) evt.Check(true); }, config_id_base + ConfigMenuModeExpert);
|
||||
|
||||
local_menu->AppendSubMenu(mode_menu, _L("Mode"), wxString::Format(_L("%s View Mode"), SLIC3R_APP_NAME));
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
local_menu->AppendSeparator();
|
||||
local_menu->Append(config_id_base + ConfigMenuLanguage, _L("&Language"));
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (is_editor()) {
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
local_menu->AppendSeparator();
|
||||
local_menu->Append(config_id_base + ConfigMenuFlashFirmware, _L("Flash printer &firmware"), _L("Upload a firmware image into an Arduino based printer"));
|
||||
// TODO: for when we're able to flash dictionaries
|
||||
// local_menu->Append(config_id_base + FirmwareMenuDict, _L("Flash language file"), _L("Upload a language dictionary file into a Prusa printer"));
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
local_menu->Bind(wxEVT_MENU, [this, config_id_base](wxEvent &event) {
|
||||
switch (event.GetId() - config_id_base) {
|
||||
@ -1592,19 +1584,19 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
||||
// the dialog needs to be destroyed before the call to switch_language()
|
||||
// or sometimes the application crashes into wxDialogBase() destructor
|
||||
// so we put it into an inner scope
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
wxString title = is_editor() ? wxString(SLIC3R_APP_NAME) : wxString(GCODEVIEWER_APP_NAME);
|
||||
title += " - " + _L("Language selection");
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
wxMessageDialog dialog(nullptr,
|
||||
_L("Switching the language will trigger application restart.\n"
|
||||
"You will lose content of the plater.") + "\n\n" +
|
||||
_L("Do you want to proceed?"),
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
title,
|
||||
#else
|
||||
wxString(SLIC3R_APP_NAME) + " - " + _L("Language selection"),
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
wxICON_QUESTION | wxOK | wxCANCEL);
|
||||
if (dialog.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
@ -1622,17 +1614,17 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
||||
});
|
||||
|
||||
using std::placeholders::_1;
|
||||
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (mode_menu != nullptr) {
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
auto modfn = [this](int mode, wxCommandEvent&) { if (get_mode() != mode) save_mode(mode); };
|
||||
mode_menu->Bind(wxEVT_MENU, std::bind(modfn, comSimple, _1), config_id_base + ConfigMenuModeSimple);
|
||||
mode_menu->Bind(wxEVT_MENU, std::bind(modfn, comAdvanced, _1), config_id_base + ConfigMenuModeAdvanced);
|
||||
mode_menu->Bind(wxEVT_MENU, std::bind(modfn, comExpert, _1), config_id_base + ConfigMenuModeExpert);
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
menu->Append(local_menu, _L("&Configuration"));
|
||||
}
|
||||
|
@ -109,9 +109,7 @@ private:
|
||||
bool m_app_conf_exists{ false };
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
EAppMode m_app_mode{ EAppMode::Editor };
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
bool m_is_recreating_gui{ false };
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
wxColour m_color_label_modified;
|
||||
@ -190,9 +188,7 @@ public:
|
||||
EAppMode get_app_mode() const { return m_app_mode; }
|
||||
bool is_editor() const { return m_app_mode == EAppMode::Editor; }
|
||||
bool is_gcode_viewer() const { return m_app_mode == EAppMode::GCodeViewer; }
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
bool is_recreating_gui() const { return m_is_recreating_gui; }
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
static std::string get_gl_info(bool format_as_html, bool extensions);
|
||||
|
@ -1212,11 +1212,7 @@ void Preview::update_double_slider_from_canvas(wxKeyEvent & event)
|
||||
void Preview::load_print_as_fff(bool keep_z_range)
|
||||
{
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
if (wxGetApp().mainframe == nullptr || wxGetApp().is_recreating_gui())
|
||||
#else
|
||||
if (wxGetApp().mainframe == nullptr)
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
// avoid processing while mainframe is being constructed
|
||||
return;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
@ -1410,10 +1410,10 @@ void MainFrame::init_menubar_as_gcodeviewer()
|
||||
m_menubar = new wxMenuBar();
|
||||
m_menubar->Append(fileMenu, _L("&File"));
|
||||
if (viewMenu != nullptr) m_menubar->Append(viewMenu, _L("&View"));
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
// Add additional menus from C++
|
||||
wxGetApp().add_config_menu(m_menubar);
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
m_menubar->Append(helpMenu, _L("&Help"));
|
||||
SetMenuBar(m_menubar);
|
||||
|
||||
|
@ -36,25 +36,25 @@ void PreferencesDialog::build()
|
||||
// readonly = > !wxTheApp->have_version_check,
|
||||
// ));
|
||||
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool is_editor = wxGetApp().is_editor();
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
ConfigOptionDef def;
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
Option option(def, "");
|
||||
if (is_editor) {
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
def.label = L("Remember output directory");
|
||||
def.type = coBool;
|
||||
def.tooltip = L("If this is enabled, Slic3r will prompt the last output directory "
|
||||
"instead of the one containing the input files.");
|
||||
def.set_default_value(new ConfigOptionBool{ app_config->has("remember_output_path") ? app_config->get("remember_output_path") == "1" : true });
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
option = Option(def, "remember_output_path");
|
||||
#else
|
||||
Option option(def, "remember_output_path");
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
m_optgroup_general->append_single_option_line(option);
|
||||
|
||||
def.label = L("Auto-center parts");
|
||||
@ -123,9 +123,9 @@ void PreferencesDialog::build()
|
||||
def.set_default_value(new ConfigOptionBool{ app_config->has("single_instance") ? app_config->get("single_instance") == "1" : false });
|
||||
option = Option(def, "single_instance");
|
||||
m_optgroup_general->append_single_option_line(option);
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
#if __APPLE__
|
||||
def.label = L("Use Retina resolution for the 3D scene");
|
||||
@ -179,9 +179,9 @@ void PreferencesDialog::build()
|
||||
|
||||
m_optgroup_camera->activate();
|
||||
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (is_editor) {
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
m_optgroup_gui = std::make_shared<ConfigOptionsGroup>(this, _L("GUI"));
|
||||
m_optgroup_gui->label_width = 40;
|
||||
m_optgroup_gui->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
||||
@ -229,21 +229,21 @@ void PreferencesDialog::build()
|
||||
|
||||
m_optgroup_render->activate();
|
||||
#endif // ENABLE_ENVIRONMENT_MAP
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->Add(m_optgroup_general->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||
sizer->Add(m_optgroup_camera->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (m_optgroup_gui != nullptr)
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
sizer->Add(m_optgroup_gui->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||
#if ENABLE_ENVIRONMENT_MAP
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (m_optgroup_render != nullptr)
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
sizer->Add(m_optgroup_render->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||
#endif // ENABLE_ENVIRONMENT_MAP
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user