mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-10 00:07:52 -06:00
FIX: optimize media file panel
1. disable select when no file 2. disable batch edit button when no selection 3. hide batch edit when no file 4. delete/play/open_folder for downloaded file 5. hide type panel Change-Id: Ida00da366a8f59b2c5028ddcf87e197c20a21e44
This commit is contained in:
parent
c2c7a6786d
commit
76d021ceaf
8 changed files with 117 additions and 32 deletions
|
@ -17,6 +17,7 @@
|
|||
wxDEFINE_EVENT(EVT_STATUS_CHANGED, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_MODE_CHANGED, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_FILE_CHANGED, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_SELECT_CHANGED, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_THUMBNAIL, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_DOWNLOAD, wxCommandEvent);
|
||||
|
||||
|
@ -37,7 +38,7 @@ PrinterFileSystem::PrinterFileSystem()
|
|||
m_session.owner = this;
|
||||
#ifdef PRINTER_FILE_SYSTEM_TEST
|
||||
auto time = wxDateTime::Now();
|
||||
for (int i = 0; i < 800; ++i) {
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
auto name = wxString::Format(L"img-%03d.jpg", i + 1);
|
||||
wxImage im(L"D:\\work\\pic\\" + name);
|
||||
m_file_list.push_back({name.ToUTF8().data(), time.GetTicks(), 26937, im, i < 20 ? FF_DOWNLOAD : 0, i * 10 - 40});
|
||||
|
@ -226,17 +227,30 @@ size_t PrinterFileSystem::GetIndexAtTime(boost::uint32_t time)
|
|||
|
||||
void PrinterFileSystem::ToggleSelect(size_t index)
|
||||
{
|
||||
if (index < m_file_list.size()) m_file_list[index].flags ^= FF_SELECT;
|
||||
if (index < m_file_list.size()) {
|
||||
m_file_list[index].flags ^= FF_SELECT;
|
||||
if (m_file_list[index].flags & FF_SELECT)
|
||||
++m_select_count;
|
||||
else
|
||||
--m_select_count;
|
||||
}
|
||||
SendChangedEvent(EVT_SELECT_CHANGED, m_select_count);
|
||||
}
|
||||
|
||||
void PrinterFileSystem::SelectAll(bool select)
|
||||
{
|
||||
if (select)
|
||||
if (select) {
|
||||
for (auto &f : m_file_list) f.flags |= FF_SELECT;
|
||||
else
|
||||
m_select_count = m_file_list.size();
|
||||
} else {
|
||||
for (auto &f : m_file_list) f.flags &= ~FF_SELECT;
|
||||
m_select_count = 0;
|
||||
}
|
||||
SendChangedEvent(EVT_SELECT_CHANGED, m_select_count);
|
||||
}
|
||||
|
||||
size_t PrinterFileSystem::GetSelectCount() const { return m_select_count; }
|
||||
|
||||
void PrinterFileSystem::SetFocusRange(size_t start, size_t count)
|
||||
{
|
||||
m_lock_start = start;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue