Fixed non_MSW build

+ fixed some warnings
This commit is contained in:
YuSanka 2020-10-06 11:15:24 +02:00
parent cbf36de600
commit 19c267e890
5 changed files with 18 additions and 18 deletions

View file

@ -275,26 +275,30 @@ private:
bmp = wxBitmap(std::move(image));
}
// Workaround for the font scaling in respect to the current active display,
// not for the primary display, as it's implemented in Font.cpp
// See https://github.com/wxWidgets/wxWidgets/blob/master/src/msw/font.cpp
// void wxNativeFontInfo::SetFractionalPointSize(float pointSizeNew)
void scale_font(wxFont& font, float scale)
{
#ifdef __WXMSW__
// Workaround for the font scaling in respect to the current active display,
// not for the primary display, as it's implemented in Font.cpp
// See https://github.com/wxWidgets/wxWidgets/blob/master/src/msw/font.cpp
// void wxNativeFontInfo::SetFractionalPointSize(float pointSizeNew)
wxNativeFontInfo nfi= *font.GetNativeFontInfo();
float pointSizeNew = scale * font.GetPointSize();
nfi.lf.lfHeight = nfi.GetLogFontHeightAtPPI(pointSizeNew, get_dpi_for_window(this));
nfi.pointSize = pointSizeNew;
font = wxFont(nfi);
#else
font.Scale(scale);
#endif //__WXMSW__
}
// wrap a string for the strings no longer then 55 symbols
// return extent of the longest string
int word_wrap_string(wxString& input)
{
int line_len = 55;// count of symbols in one line
size_t line_len = 55;// count of symbols in one line
int idx = -1;
int cur_len = 0;
size_t cur_len = 0;
wxString longest_sub_string;
auto get_longest_sub_string = [longest_sub_string, input](wxString &longest_sub_str, int cur_len, size_t i) {
@ -317,7 +321,7 @@ private:
{
get_longest_sub_string(longest_sub_string, cur_len, i);
input[idx] = '\n';
cur_len = static_cast<int>(i) - idx;
cur_len = i - static_cast<size_t>(idx);
}
}

View file

@ -1767,7 +1767,7 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
// when tab == -1, it means we should show the last selected tab
size_t new_selection = tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab;
if (m_tabpanel->GetSelection() != new_selection)
if (m_tabpanel->GetSelection() != (int)new_selection)
m_tabpanel->SetSelection(new_selection);
else if (was_hidden) {
Tab* cur_tab = dynamic_cast<Tab*>(m_tabpanel->GetPage(new_selection));

View file

@ -592,7 +592,7 @@ bool ConfigOptionsGroup::is_visible(ConfigOptionMode mode)
if (m_options_mode.size() == 1)
return m_options_mode[0] <= mode;
int hidden_row_cnt = 0;
size_t hidden_row_cnt = 0;
for (auto opt_mode : m_options_mode)
if (opt_mode > mode)
hidden_row_cnt++;

View file

@ -686,7 +686,7 @@ void PlaterPresetComboBox::update()
{
if (m_type == Preset::TYPE_FILAMENT &&
(m_preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA ||
m_preset_bundle->filament_presets.size() <= m_extruder_idx) )
m_preset_bundle->filament_presets.size() <= (size_t)m_extruder_idx) )
return;
// Otherwise fill in the list from scratch.
@ -883,15 +883,12 @@ void TabPresetComboBox::update()
wxString selected = "";
if (!presets.front().is_visible)
set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
int idx_selected = m_collection->get_selected_idx();
size_t idx_selected = m_collection->get_selected_idx();
PrinterTechnology proper_pt = ptAny;
if (m_type == Preset::TYPE_PRINTER && m_preset_bundle->physical_printers.has_selection()) {
std::string sel_preset_name = m_preset_bundle->physical_printers.get_selected_printer_preset_name();
Preset* preset = m_collection->find_preset(sel_preset_name);
if (preset)
proper_pt = preset->printer_technology();
else
if (!preset)
m_preset_bundle->physical_printers.unselect_printer();
}

View file

@ -2906,7 +2906,7 @@ void TabPrinter::toggle_options()
wxString extruder_number;
long val;
if (m_active_page->title().StartsWith("Extruder ", &extruder_number) && extruder_number.ToLong(&val) &&
val > 0 && val <= m_extruders_count)
val > 0 && (size_t)val <= m_extruders_count)
{
size_t i = size_t(val - 1);
bool have_retract_length = m_config->opt_float("retract_length", i) > 0;
@ -3404,7 +3404,6 @@ void Tab::clear_pages()
// clear pages from the controlls
for (auto p : m_pages)
p->clear();
int i = m_page_sizer->GetItemCount();
// nulling pointers
m_parent_preset_description_line = nullptr;