From 77d793c5404034be71a49a6026079929503deb5b Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 23 Aug 2019 09:43:38 +0200 Subject: [PATCH 1/2] KBShortcutsDialog is changed to ScrollWindow --- src/slic3r/GUI/KBShortcutsDialog.cpp | 15 +++++++++++++-- src/slic3r/GUI/KBShortcutsDialog.hpp | 6 +++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 08d46444c4..25facdd340 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -9,6 +9,11 @@ namespace Slic3r { namespace GUI { +enum { + DLG_WIDTH = 90, + DLG_HEIGHT = 60 +}; + KBShortcutsDialog::KBShortcutsDialog() : DPIDialog(NULL, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _(L("Keyboard Shortcuts")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) @@ -34,7 +39,11 @@ KBShortcutsDialog::KBShortcutsDialog() fill_shortcuts(); - auto panel = new wxPanel(this); + const int em = em_unit(); + const wxSize& size = wxSize(DLG_WIDTH * em, DLG_HEIGHT * em); + panel = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, size); + panel->SetScrollbars(1, 20, 1, 2); + auto main_grid_sizer = new wxFlexGridSizer(2, 10, 10); panel->SetSizer(main_grid_sizer); main_sizer->Add(panel, 1, wxEXPAND | wxALL, 0); @@ -207,7 +216,9 @@ void KBShortcutsDialog::on_dpi_changed(const wxRect &suggested_rect) msw_buttons_rescale(this, em, { wxID_OK }); - const wxSize& size = wxSize(85 * em, 75 * em); + const wxSize& size = wxSize(DLG_WIDTH * em, DLG_HEIGHT * em); + + panel->SetMinSize(size); SetMinSize(size); Fit(); diff --git a/src/slic3r/GUI/KBShortcutsDialog.hpp b/src/slic3r/GUI/KBShortcutsDialog.hpp index 66fe7c399b..2ba2664e8a 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.hpp +++ b/src/slic3r/GUI/KBShortcutsDialog.hpp @@ -23,10 +23,10 @@ class KBShortcutsDialog : public DPIDialog typedef std::vector< Shortcut > Shortcuts; typedef std::vector< std::pair> > ShortcutsVec; - wxString text_info {wxEmptyString}; + wxScrolledWindow* panel; - ShortcutsVec m_full_shortcuts; - ScalableBitmap m_logo_bmp; + ShortcutsVec m_full_shortcuts; + ScalableBitmap m_logo_bmp; std::vector m_head_bitmaps; public: From ac62734033f53b68ce10edac48fe2e53ea3e7133 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Fri, 23 Aug 2019 10:02:45 +0200 Subject: [PATCH 2/2] Fixed time stamps for the configuration snapshots (local / UTC time functions were mixed up) --- src/slic3r/Utils/Time.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/slic3r/Utils/Time.cpp b/src/slic3r/Utils/Time.cpp index f38c4b4074..db1aa31f6e 100644 --- a/src/slic3r/Utils/Time.cpp +++ b/src/slic3r/Utils/Time.cpp @@ -21,7 +21,11 @@ time_t parse_time_ISO8601Z(const std::string &sdate) tms.tm_hour = h; // 0-23 tms.tm_min = m; // 0-59 tms.tm_sec = s; // 0-61 (0-60 in C++11) - return mktime(&tms); +#ifdef WIN32 + return _mkgmtime(&tms); +#else /* WIN32 */ + return timegm(&tms); +#endif /* WIN32 */ } std::string format_time_ISO8601Z(time_t time) @@ -47,6 +51,7 @@ std::string format_local_date_time(time_t time) { struct tm tms; #ifdef WIN32 + // Converts a time_t time value to a tm structure, and corrects for the local time zone. localtime_s(&tms, &time); #else localtime_r(&time, &tms); @@ -60,6 +65,7 @@ time_t get_current_time_utc() { #ifdef WIN32 SYSTEMTIME st; + // Retrieves the current system date and time. The system time is expressed in Coordinated Universal Time (UTC). ::GetSystemTime(&st); std::tm tm; tm.tm_sec = st.wSecond; @@ -69,10 +75,10 @@ time_t get_current_time_utc() tm.tm_mon = st.wMonth - 1; tm.tm_year = st.wYear - 1900; tm.tm_isdst = -1; - return mktime(&tm); + return _mkgmtime(&tm); #else - const time_t current_local = time(nullptr); - return mktime(gmtime(¤t_local)); + // time() returns the time as the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). + return time(nullptr); #endif }