Some refactoring and documentation, modified Windows dependencies to compile against patched wxWidgets

This commit is contained in:
Vojtech Bubnik 2019-04-23 12:35:26 +02:00
parent 0923bcec34
commit 31d377d09f
3 changed files with 16 additions and 28 deletions

View File

@ -210,10 +210,12 @@ endif ()
ExternalProject_Add(dep_wxwidgets
EXCLUDE_FROM_ALL 1
URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2"
URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e
GIT_REPOSITORY "https://github.com/prusa3d/wxWidgets"
GIT_TAG v3.1.1-patched
# URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2"
# URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e
BUILD_IN_SOURCE 1
PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}\\wxwidgets-pngprefix.h" src\\png\\pngprefix.h
# PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}\\wxwidgets-pngprefix.h" src\\png\\pngprefix.h
CONFIGURE_COMMAND ""
BUILD_COMMAND cd build\\msw && nmake /f makefile.vc BUILD=release SHARED=0 UNICODE=1 USE_GUI=1 "${DEP_WXWIDGETS_TARGET}"
INSTALL_COMMAND "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include"

View File

@ -508,31 +508,15 @@ void ObjectManipulation::on_fill_empty_value(const std::string& opt_key)
std::copy(opt_key.begin(), opt_key.end() - 2, std::back_inserter(param));
double value = 0.0;
if (param == "position") {
int axis = opt_key.back() == 'x' ? 0 :
opt_key.back() == 'y' ? 1 : 2;
value = m_cache.position(axis);
}
else if (param == "rotation") {
int axis = opt_key.back() == 'x' ? 0 :
opt_key.back() == 'y' ? 1 : 2;
value = m_cache.rotation(axis);
}
else if (param == "scale") {
int axis = opt_key.back() == 'x' ? 0 :
opt_key.back() == 'y' ? 1 : 2;
value = m_cache.scale(axis);
}
else if (param == "size") {
int axis = opt_key.back() == 'x' ? 0 :
opt_key.back() == 'y' ? 1 : 2;
value = m_cache.size(axis);
}
auto opt_key_to_axis = [&opt_key]() { return opt_key.back() == 'x' ? 0 : opt_key.back() == 'y' ? 1 : 2; };
if (param == "position")
value = m_cache.position(opt_key_to_axis());
else if (param == "rotation")
value = m_cache.rotation(opt_key_to_axis());
else if (param == "scale")
value = m_cache.scale(opt_key_to_axis());
else if (param == "size")
value = m_cache.size(opt_key_to_axis());
m_og->set_value(opt_key, double_to_string(value));
}

View File

@ -86,6 +86,8 @@ public:
wxSizer* sizer {nullptr};
column_t extra_column {nullptr};
t_change m_on_change { nullptr };
// To be called when the field loses focus, to assign a new initial value to the field.
// Used by the relative position / rotation / scale manipulation fields of the Object Manipulation UI.
t_kill_focus m_fill_empty_value { nullptr };
t_kill_focus m_set_focus { nullptr };
std::function<DynamicPrintConfig()> m_get_initial_config{ nullptr };