This commit is contained in:
bubnikv 2018-12-20 10:56:04 +01:00
commit 6282e904b9
24 changed files with 166 additions and 93 deletions

View file

@ -1549,7 +1549,7 @@ void GLCanvas3D::Selection::start_dragging()
_set_caches();
}
void GLCanvas3D::Selection::translate(const Vec3d& displacement)
void GLCanvas3D::Selection::translate(const Vec3d& displacement, bool local)
{
if (!m_valid)
return;
@ -1559,7 +1559,7 @@ void GLCanvas3D::Selection::translate(const Vec3d& displacement)
#if ENABLE_MODELVOLUME_TRANSFORM
if ((m_mode == Volume) || (*m_volumes)[i]->is_wipe_tower)
{
if (_requires_local_axes())
if (local)
(*m_volumes)[i]->set_volume_offset(m_cache.volumes_data[i].get_volume_position() + displacement);
else
{
@ -1614,7 +1614,7 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation, bool local)
else if (is_single_volume() || is_single_modifier())
#if ENABLE_WORLD_ROTATIONS
{
if (_requires_local_axes())
if (requires_local_axes())
(*m_volumes)[i]->set_volume_rotation(rotation);
else
{
@ -2118,6 +2118,11 @@ void GLCanvas3D::Selection::render_sidebar_hints(const std::string& sidebar_fiel
}
#endif // ENABLE_SIDEBAR_VISUAL_HINTS
bool GLCanvas3D::Selection::requires_local_axes() const
{
return (m_mode == Volume) && is_from_single_instance();
}
void GLCanvas3D::Selection::_update_valid()
{
m_valid = (m_volumes != nullptr) && (m_model != nullptr);
@ -2746,11 +2751,6 @@ void GLCanvas3D::Selection::_ensure_on_bed()
}
#endif // ENABLE_ENSURE_ON_BED_WHILE_SCALING
bool GLCanvas3D::Selection::_requires_local_axes() const
{
return (m_mode == Volume) && is_from_single_instance();
}
const float GLCanvas3D::Gizmos::OverlayIconsScale = 1.0f;
const float GLCanvas3D::Gizmos::OverlayBorder = 5.0f;
const float GLCanvas3D::Gizmos::OverlayGapY = 5.0f * OverlayIconsScale;

View file

@ -578,7 +578,7 @@ public:
void start_dragging();
void translate(const Vec3d& displacement);
void translate(const Vec3d& displacement, bool local = false);
void rotate(const Vec3d& rotation, bool local);
void flattening_rotate(const Vec3d& normal);
void scale(const Vec3d& scale, bool local);
@ -597,6 +597,8 @@ public:
void render_sidebar_hints(const std::string& sidebar_field) const;
#endif // ENABLE_SIDEBAR_VISUAL_HINTS
bool requires_local_axes() const;
private:
void _update_valid();
void _update_type();
@ -626,7 +628,6 @@ public:
#if ENABLE_ENSURE_ON_BED_WHILE_SCALING
void _ensure_on_bed();
#endif // ENABLE_ENSURE_ON_BED_WHILE_SCALING
bool _requires_local_axes() const;
};
class ClippingPlane

View file

@ -137,7 +137,7 @@ bool GUI_App::OnInit()
std::cerr << "Creating main frame..." << std::endl;
if (wxImage::FindHandler(wxBITMAP_TYPE_PNG) == nullptr)
wxImage::AddHandler(new wxPNGHandler());
mainframe = new MainFrame(no_plater, false);
mainframe = new MainFrame();
sidebar().obj_list()->init_objects(); // propagate model objects to object list
update_mode();
SetTopWindow(mainframe);
@ -277,8 +277,8 @@ void GUI_App::recreate_GUI()
{
std::cerr << "recreate_GUI" << std::endl;
auto topwindow = GetTopWindow();
mainframe = new MainFrame(no_plater,false);
MainFrame* topwindow = dynamic_cast<MainFrame*>(GetTopWindow());
mainframe = new MainFrame();
sidebar().obj_list()->init_objects(); // propagate model objects to object list
update_mode();
@ -287,6 +287,20 @@ void GUI_App::recreate_GUI()
topwindow->Destroy();
}
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
CallAfter([this]() {
// temporary workaround for the correct behavior of the Scrolled sidebar panel
auto& panel = sidebar();
if (panel.obj_list()->GetMinHeight() > 200) {
wxWindowUpdateLocker noUpdates_sidebar(&panel);
panel.obj_list()->SetMinSize(wxSize(-1, 200));
panel.Layout();
}
});
mainframe->Show(true);
// On OSX the UI was not initialized correctly if the wizard was called
// before the UI was up and running.
CallAfter([]() {
@ -434,7 +448,7 @@ bool GUI_App::select_language( wxArrayString & names,
m_wxLocale = new wxLocale;
m_wxLocale->Init(identifiers[index]);
m_wxLocale->AddCatalogLookupPathPrefix(localization_dir());
m_wxLocale->AddCatalog(GetAppName());
m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE");
wxSetlocale(LC_NUMERIC, "C");
Preset::update_suffix_modified();
return true;
@ -461,7 +475,7 @@ bool GUI_App::load_language()
m_wxLocale = new wxLocale;
m_wxLocale->Init(identifiers[i]);
m_wxLocale->AddCatalogLookupPathPrefix(localization_dir());
m_wxLocale->AddCatalog(GetAppName());
m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE");
wxSetlocale(LC_NUMERIC, "C");
Preset::update_suffix_modified();
return true;
@ -504,7 +518,8 @@ void GUI_App::get_installed_languages(wxArrayString & names, wxArrayLong & ident
{
auto full_file_name = dir.GetName() + wxFileName::GetPathSeparator() +
filename + wxFileName::GetPathSeparator() +
GetAppName() + wxT(".mo");
/*GetAppName()*/"Slic3rPE" +
wxT(".mo");
if (wxFileExists(full_file_name))
{
names.Add(langinfo->Description);

View file

@ -71,7 +71,6 @@ static wxString dots("…", wxConvUTF8);
class GUI_App : public wxApp
{
bool no_plater{ false };
bool app_conf_exists{ false };
// Lock to guard the callback stack

View file

@ -361,8 +361,9 @@ void ObjectManipulation::update_rotation_value(const Vec3d& rotation)
void ObjectManipulation::change_position_value(const Vec3d& position)
{
auto canvas = wxGetApp().plater()->canvas3D();
canvas->get_selection().start_dragging();
canvas->get_selection().translate(position - cache_position);
GLCanvas3D::Selection& selection = canvas->get_selection();
selection.start_dragging();
selection.translate(position - cache_position, selection.requires_local_axes());
canvas->do_move();
cache_position = position;

View file

@ -586,7 +586,8 @@ void Preview::create_double_slider()
auto& config = wxGetApp().preset_bundle->project_config;
((config.option<ConfigOptionFloats>("colorprint_heights"))->values) = (m_slider->GetTicksValues());
m_schedule_background_process();
int type = m_choice_view_type->FindString(_(L("Color Print")));
bool color_print = !config.option<ConfigOptionFloats>("colorprint_heights")->values.empty();
int type = m_choice_view_type->FindString(color_print ? _(L("Color Print")) : _(L("Feature type")) );
if (m_choice_view_type->GetSelection() != type) {
m_choice_view_type->SetSelection(type);
if ((0 <= type) && (type < (int)GCodePreviewData::Extrusion::Num_View_Types))

View file

@ -23,7 +23,7 @@ KBShortcutsDialog::KBShortcutsDialog()
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
font.SetPointSize(10);
const wxFont bold_font = font.Bold();
wxFont bold_font = font.Bold();
#ifdef __WXOSX__
font.SetPointSize(12);
bold_font.SetPointSize(14);

View file

@ -28,10 +28,8 @@
namespace Slic3r {
namespace GUI {
MainFrame::MainFrame(const bool no_plater, const bool loaded) :
MainFrame::MainFrame() :
wxFrame(NULL, wxID_ANY, SLIC3R_BUILD, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE),
m_no_plater(no_plater),
m_loaded(loaded),
m_printhost_queue_dlg(new PrintHostQueueDialog(this))
{
// Load the icon either from the exe, or from the ico file.
@ -125,11 +123,9 @@ void MainFrame::init_tabpanel()
}
});
if (!m_no_plater) {
m_plater = new Slic3r::GUI::Plater(m_tabpanel, this);
wxGetApp().plater_ = m_plater;
m_tabpanel->AddPage(m_plater, _(L("Plater")));
}
m_plater = new Slic3r::GUI::Plater(m_tabpanel, this);
wxGetApp().plater_ = m_plater;
m_tabpanel->AddPage(m_plater, _(L("Plater")));
// The following event is emited by Tab implementation on config value change.
Bind(EVT_TAB_VALUE_CHANGED, &MainFrame::on_value_changed, this);

View file

@ -42,10 +42,7 @@ struct PresetTab {
class MainFrame : public wxFrame
{
bool m_no_plater;
bool m_loaded;
int m_lang_ch_event;
int m_preferences_event;
bool m_loaded {false};
wxString m_qs_last_input_file = wxEmptyString;
wxString m_qs_last_output_file = wxEmptyString;
@ -71,8 +68,7 @@ class MainFrame : public wxFrame
bool can_delete_all() const;
public:
MainFrame() {}
MainFrame(const bool no_plater, const bool loaded);
MainFrame();
~MainFrame() {}
Plater* plater() { return m_plater; }

View file

@ -102,7 +102,7 @@ PrintHostQueueDialog::PrintHostQueueDialog(wxWindow *parent)
job_list->AppendTextColumn("Filename", wxDATAVIEW_CELL_INERT);
auto *btnsizer = new wxBoxSizer(wxHORIZONTAL);
auto *btn_cancel = new wxButton(this, wxID_DELETE, _(L("Cancel selected")));
auto *btn_cancel = new wxButton(this, wxID_DELETE, _(L("Cancel selected"))); // TODO: enable based on status ("show error" for failed jobs)
auto *btn_close = new wxButton(this, wxID_CANCEL, _(L("Close")));
btnsizer->Add(btn_cancel, 0, wxRIGHT, SPACING);
btnsizer->AddStretchSpacer();
@ -140,7 +140,13 @@ void PrintHostQueueDialog::on_error(Event &evt)
{
wxCHECK_RET(evt.job_id < job_list->GetItemCount(), "Out of bounds access to job list");
// TODO
job_list->SetValue(wxVariant(0), evt.job_id, 1);
job_list->SetValue(wxVariant(_(L("Error"))), evt.job_id, 2);
// TODO: keep the error for repeated display
auto errormsg = wxString::Format("%s\n%s", _(L("Error uploading to print host:")), evt.error);
GUI::show_error(nullptr, std::move(errormsg));
}

View file

@ -1551,7 +1551,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
auto printhost_browse = [this, optgroup] (wxWindow* parent) {
// TODO: SLA
// TODO: SLA Bonjour
auto btn = m_printhost_browse_btn = new wxButton(parent, wxID_ANY, _(L(" Browse "))+dots, wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
btn->SetBitmap(wxBitmap(from_u8(Slic3r::var("zoom.png")), wxBITMAP_TYPE_PNG));
@ -1562,6 +1562,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
BonjourDialog dialog(parent);
if (dialog.show_and_lookup()) {
optgroup->set_value("print_host", std::move(dialog.get_selected()), true);
// FIXME: emit killfocus on the edit widget
}
});

View file

@ -2058,7 +2058,7 @@ void PrusaDoubleSlider::enter_window(wxMouseEvent& event, const bool enter)
// - value decrease (if wxSL_HORIZONTAL)
void PrusaDoubleSlider::move_current_thumb(const bool condition)
{
m_is_one_layer = wxGetKeyState(WXK_CONTROL);
// m_is_one_layer = wxGetKeyState(WXK_CONTROL);
int delta = condition ? -1 : 1;
if (is_horizontal())
delta *= -1;