This commit is contained in:
Enrico Turri 2019-08-23 12:28:03 +02:00
commit 1cf311529a
3 changed files with 26 additions and 9 deletions

View File

@ -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();

View File

@ -23,10 +23,10 @@ class KBShortcutsDialog : public DPIDialog
typedef std::vector< Shortcut > Shortcuts;
typedef std::vector< std::pair<wxString, std::pair<Shortcuts, PLACED_SIZER_ID>> > 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<wxStaticBitmap*> m_head_bitmaps;
public:

View File

@ -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(&current_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
}