FIX: fix display of long filename in preview-only hint
Change-Id: Ib365a39b262cbf03b14eeefa64e3e46d1b48306e
This commit is contained in:
parent
b77e96acdd
commit
a3730b9236
|
@ -979,7 +979,10 @@ bool MainFrame::preview_only_hint()
|
||||||
});
|
});
|
||||||
confirm_dlg.update_btn_label(_L("Yes"), _L("No"));
|
confirm_dlg.update_btn_label(_L("Yes"), _L("No"));
|
||||||
auto filename = wxString((m_plater->get_preview_only_filename()).c_str(), wxConvUTF8);
|
auto filename = wxString((m_plater->get_preview_only_filename()).c_str(), wxConvUTF8);
|
||||||
confirm_dlg.update_text(filename + _L(" will be closed before creating a new model. Do you want to continue?"));
|
//if size of filename is beyond limit
|
||||||
|
auto format_filename = confirm_dlg.format_text(filename, FromDIP(240));
|
||||||
|
|
||||||
|
confirm_dlg.update_text(format_filename + _L(" will be closed before creating a new model. Do you want to continue?"));
|
||||||
confirm_dlg.on_show();
|
confirm_dlg.on_show();
|
||||||
if (preview_only_to_editor) {
|
if (preview_only_to_editor) {
|
||||||
m_plater->new_project();
|
m_plater->new_project();
|
||||||
|
|
|
@ -667,6 +667,25 @@ void ConfirmBeforeSendDialog::update_btn_label(wxString ok_btn_text, wxString ca
|
||||||
rescale();
|
rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxString ConfirmBeforeSendDialog::format_text(wxString str, int warp)
|
||||||
|
{
|
||||||
|
Label st (this, str);
|
||||||
|
wxString out_txt = str;
|
||||||
|
wxString count_txt = "";
|
||||||
|
int new_line_pos = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < str.length(); i++) {
|
||||||
|
auto text_size = st.GetTextExtent(count_txt);
|
||||||
|
if (text_size.x < warp) {
|
||||||
|
count_txt += str[i];
|
||||||
|
} else {
|
||||||
|
out_txt.insert(i - 1, '\n');
|
||||||
|
count_txt = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out_txt;
|
||||||
|
}
|
||||||
|
|
||||||
ConfirmBeforeSendDialog::~ConfirmBeforeSendDialog()
|
ConfirmBeforeSendDialog::~ConfirmBeforeSendDialog()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,7 @@ public:
|
||||||
void on_show();
|
void on_show();
|
||||||
void on_hide();
|
void on_hide();
|
||||||
void update_btn_label(wxString ok_btn_text, wxString cancel_btn_text);
|
void update_btn_label(wxString ok_btn_text, wxString cancel_btn_text);
|
||||||
|
wxString format_text(wxString str, int warp);
|
||||||
void rescale();
|
void rescale();
|
||||||
~ConfirmBeforeSendDialog();
|
~ConfirmBeforeSendDialog();
|
||||||
void on_dpi_changed(const wxRect& suggested_rect);
|
void on_dpi_changed(const wxRect& suggested_rect);
|
||||||
|
|
Loading…
Reference in New Issue