diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 74a26c400..3ecb174ce 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3171,6 +3171,7 @@ void Plater::priv::update_fff_scene() this->preview->reload_print(); // In case this was MM print, wipe tower bounding box on 3D tab might need redrawing with exact depth: view3D->reload_scene(true); + show_action_buttons(false); } void Plater::priv::update_sla_scene() @@ -4052,7 +4053,7 @@ void Plater::priv::show_action_buttons(const bool is_ready_to_slice) const if (sidebar->show_reslice(false) | sidebar->show_export(true) | sidebar->show_send(send_gcode_shown) | - sidebar->show_disconnect(false/*disconnect_shown*/)) + sidebar->show_disconnect(disconnect_shown)) sidebar->Layout(); } else @@ -4606,9 +4607,10 @@ void Plater::export_gcode() } if (! output_path.empty()) { - RemovableDriveManager::get_instance().update(0, true); - RemovableDriveManager::get_instance().set_last_save_path(output_path.string()); + std::string path = output_path.string(); p->export_gcode(std::move(output_path), PrintHostJob()); + RemovableDriveManager::get_instance().update(0, true); + RemovableDriveManager::get_instance().set_last_save_path(path); } } diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp index 7ab34204b..cd360b580 100644 --- a/src/slic3r/GUI/RemovableDriveManager.cpp +++ b/src/slic3r/GUI/RemovableDriveManager.cpp @@ -24,9 +24,6 @@ GUID WceusbshGUID = { 0x25dbce51, 0x6c8f, 0x4a72, namespace Slic3r { namespace GUI { -//std::vector RemovableDriveManager::m_current_drives; -//std::vector> RemovableDriveManager::m_callbacks; - #if _WIN32 INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); @@ -42,7 +39,6 @@ void RemovableDriveManager::search_for_drives() std::string path (1,(char)('A' + i)); path+=":"; UINT drive_type = GetDriveTypeA(path.c_str()); - //std::cout << "found drive" << (char)('A' + i) << ": type:" < 0) { path += "\\"; @@ -74,12 +69,9 @@ void RemovableDriveManager::search_for_drives() } } } - //std::cout << "found drives:" << m_current_drives.size() << "\n"; } void RemovableDriveManager::eject_drive(const std::string &path) { - - //if (!update() || !is_drive_mounted(path)) if(m_current_drives.empty()) return; for (auto it = m_current_drives.begin(); it != m_current_drives.end(); ++it) @@ -88,7 +80,6 @@ void RemovableDriveManager::eject_drive(const std::string &path) { std::string mpath = "\\\\.\\" + path; mpath = mpath.substr(0, mpath.size() - 1); - //std::cout << "Ejecting " << mpath << "\n"; HANDLE handle = CreateFileA(mpath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr); if (handle == INVALID_HANDLE_VALUE) { @@ -138,7 +129,7 @@ std::string RemovableDriveManager::get_drive_from_path(const std::string& path) } void RemovableDriveManager::register_window() { - std::cout << "Registering for device notification\n"; + //creates new unvisible window that is recieving callbacks from system WNDCLASSEX wndClass; wndClass.cbSize = sizeof(WNDCLASSEX); wndClass.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; @@ -181,9 +172,6 @@ INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP LRESULT lRet = 1; static HDEVNOTIFY hDeviceNotify; - static HWND hEditWnd; - static ULONGLONG msgCount = 0; - switch (message) { case WM_CREATE: @@ -194,11 +182,7 @@ INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; NotificationFilter.dbcc_classguid = WceusbshGUID; - hDeviceNotify = RegisterDeviceNotification( - hWnd, // events recipient - &NotificationFilter, // type of device - DEVICE_NOTIFY_WINDOW_HANDLE // type of recipient handle - ); + hDeviceNotify = RegisterDeviceNotification(hWnd, &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE); break; case WM_DEVICECHANGE: @@ -280,7 +264,6 @@ void RemovableDriveManager::search_for_drives() } - //std::cout << "found drives:" < RemovableDriveManager::get_all_drives() } void RemovableDriveManager::check_and_notify() { - //std::cout<<"drives count: "<log("drives count not same"); - //std::cout<<" vs "<< m_current_drives.size(); if(m_callbacks.size() != 0 && m_drives_count > m_current_drives.size() && m_last_save_path != "" && !is_drive_mounted(m_last_save_path)) { for (auto it = m_callbacks.begin(); it != m_callbacks.end(); ++it) @@ -481,7 +461,6 @@ void RemovableDriveManager::check_and_notify() } m_drives_count = m_current_drives.size(); } - //std::cout<<"\n"; } void RemovableDriveManager::add_callback(std::function callback) { @@ -522,10 +501,4 @@ void RemovableDriveManager::reset_last_save_path() { m_last_save_path = ""; } - -void RemovableDriveManager::print() -{ - //std::cout << "Removed Device: "<<(int)is_last_drive_removed()<<"\n"; - std::cout << "notified\n"; -} -}}//namespace Slicer::Gui:: +}}//namespace Slicer::Gui diff --git a/src/slic3r/GUI/RemovableDriveManager.hpp b/src/slic3r/GUI/RemovableDriveManager.hpp index 9eea355f7..b4fc71e26 100644 --- a/src/slic3r/GUI/RemovableDriveManager.hpp +++ b/src/slic3r/GUI/RemovableDriveManager.hpp @@ -32,7 +32,7 @@ public: //update() searches for removable devices, returns false if empty. void init(); - bool update(const long time = 0, bool check = false); //time = 0 is forced update, time expects wxGetLocalTime() + bool update(const long time = 0,const bool check = false); //time = 0 is forced update, time expects wxGetLocalTime() bool is_drive_mounted(const std::string &path); void eject_drive(const std::string &path); std::string get_last_save_path(); @@ -44,8 +44,6 @@ public: void set_last_save_path(const std::string &path); bool is_last_drive_removed(); bool is_last_drive_removed_with_update(const long time = 0); // param as update() - void print(); - private: RemovableDriveManager(); void search_for_drives();