Add 'select folder' mode for file dialog
parent
a3dbeb9829
commit
3566fb4826
|
@ -209,6 +209,9 @@ msgstr ""
|
||||||
msgid "Overwrite existing file?"
|
msgid "Overwrite existing file?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Select Folder"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Original game developed by:"
|
msgid "Original game developed by:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
3
po/de.po
3
po/de.po
|
@ -1380,6 +1380,9 @@ msgstr "Speichern\\Aktuelle Mission speichern"
|
||||||
msgid "Save\\Saves the current mission"
|
msgid "Save\\Saves the current mission"
|
||||||
msgstr "Speichern\\Speichert die Mission"
|
msgstr "Speichern\\Speichert die Mission"
|
||||||
|
|
||||||
|
msgid "Select Folder"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Select the astronaut\\Selects the astronaut"
|
msgid "Select the astronaut\\Selects the astronaut"
|
||||||
msgstr "Astronauten auswählen\\Astronauten auswählen"
|
msgstr "Astronauten auswählen\\Astronauten auswählen"
|
||||||
|
|
||||||
|
|
3
po/fr.po
3
po/fr.po
|
@ -1382,6 +1382,9 @@ msgstr "Enregistrer\\Enregistrer la mission en cours"
|
||||||
msgid "Save\\Saves the current mission"
|
msgid "Save\\Saves the current mission"
|
||||||
msgstr "Enregistrer\\Enregistrer la mission en cours"
|
msgstr "Enregistrer\\Enregistrer la mission en cours"
|
||||||
|
|
||||||
|
msgid "Select Folder"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Select the astronaut\\Selects the astronaut"
|
msgid "Select the astronaut\\Selects the astronaut"
|
||||||
msgstr "Sélectionner le cosmonaute\\Sélectionner le cosmonaute"
|
msgstr "Sélectionner le cosmonaute\\Sélectionner le cosmonaute"
|
||||||
|
|
||||||
|
|
3
po/pl.po
3
po/pl.po
|
@ -1362,6 +1362,9 @@ msgstr "Zapisz\\Zapisuje bieżącą misję"
|
||||||
msgid "Save\\Saves the current mission"
|
msgid "Save\\Saves the current mission"
|
||||||
msgstr "Zapisz\\Zapisuje bieżącą misję"
|
msgstr "Zapisz\\Zapisuje bieżącą misję"
|
||||||
|
|
||||||
|
msgid "Select Folder"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Select the astronaut\\Selects the astronaut"
|
msgid "Select the astronaut\\Selects the astronaut"
|
||||||
msgstr "Zaznacz astronautę\\Zaznacza astronautę"
|
msgstr "Zaznacz astronautę\\Zaznacza astronautę"
|
||||||
|
|
||||||
|
|
3
po/ru.po
3
po/ru.po
|
@ -1391,6 +1391,9 @@ msgstr "Сохранить\\Сохранить текущую миссию"
|
||||||
msgid "Save\\Saves the current mission"
|
msgid "Save\\Saves the current mission"
|
||||||
msgstr "Сохранить\\Сохранить текущую миссию"
|
msgstr "Сохранить\\Сохранить текущую миссию"
|
||||||
|
|
||||||
|
msgid "Select Folder"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Select the astronaut\\Selects the astronaut"
|
msgid "Select the astronaut\\Selects the astronaut"
|
||||||
msgstr "Выбор астронавта\\Выбор астронавта"
|
msgstr "Выбор астронавта\\Выбор астронавта"
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,7 @@ void InitializeRestext()
|
||||||
stringsText[RT_IO_PRIVATE] = TR("Private\\Private folder");
|
stringsText[RT_IO_PRIVATE] = TR("Private\\Private folder");
|
||||||
stringsText[RT_IO_PUBLIC] = TR("Public\\Common folder");
|
stringsText[RT_IO_PUBLIC] = TR("Public\\Common folder");
|
||||||
stringsText[RT_IO_REPLACE] = TR("Overwrite existing file?");
|
stringsText[RT_IO_REPLACE] = TR("Overwrite existing file?");
|
||||||
|
stringsText[RT_IO_SELECT_DIR] = TR("Select Folder");
|
||||||
|
|
||||||
stringsText[RT_GENERIC_DEV1] = TR("Original game developed by:");
|
stringsText[RT_GENERIC_DEV1] = TR("Original game developed by:");
|
||||||
stringsText[RT_GENERIC_DEV2] = TR("epsitec.com");
|
stringsText[RT_GENERIC_DEV2] = TR("epsitec.com");
|
||||||
|
|
|
@ -119,6 +119,7 @@ enum ResTextType
|
||||||
RT_IO_PRIVATE = 155,
|
RT_IO_PRIVATE = 155,
|
||||||
RT_IO_PUBLIC = 156,
|
RT_IO_PUBLIC = 156,
|
||||||
RT_IO_REPLACE = 157,
|
RT_IO_REPLACE = 157,
|
||||||
|
RT_IO_SELECT_DIR = 158,
|
||||||
|
|
||||||
RT_GENERIC_DEV1 = 170,
|
RT_GENERIC_DEV1 = 170,
|
||||||
RT_GENERIC_DEV2 = 171,
|
RT_GENERIC_DEV2 = 171,
|
||||||
|
|
|
@ -224,6 +224,9 @@ void CFileDialog::StartFileDialog()
|
||||||
|
|
||||||
if (m_dialogtype == CFileDialog::Type::Save)
|
if (m_dialogtype == CFileDialog::Type::Save)
|
||||||
GetResource(RES_TEXT, RT_IO_SAVE, m_title);
|
GetResource(RES_TEXT, RT_IO_SAVE, m_title);
|
||||||
|
|
||||||
|
if (m_dialogtype == CFileDialog::Type::Folder)
|
||||||
|
GetResource(RES_TEXT, RT_IO_SELECT_DIR, m_title);
|
||||||
}
|
}
|
||||||
pw->SetName(m_title);
|
pw->SetName(m_title);
|
||||||
|
|
||||||
|
@ -237,8 +240,6 @@ void CFileDialog::StartFileDialog()
|
||||||
|
|
||||||
CButton* pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_NEWDIR); // New Folder button
|
CButton* pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_NEWDIR); // New Folder button
|
||||||
pb->SetState(STATE_SHADOW);
|
pb->SetState(STATE_SHADOW);
|
||||||
GetResource(RES_EVENT, EVENT_DIALOG_NEWDIR, name);
|
|
||||||
pb->SetName(name);
|
|
||||||
|
|
||||||
CList* pli = pw->CreateList(pos, dim, 0, EVENT_DIALOG_LIST); // file list
|
CList* pli = pw->CreateList(pos, dim, 0, EVENT_DIALOG_LIST); // file list
|
||||||
pli->SetState(STATE_SHADOW);
|
pli->SetState(STATE_SHADOW);
|
||||||
|
@ -246,13 +247,6 @@ void CFileDialog::StartFileDialog()
|
||||||
CEdit* pe = pw->CreateEdit(pos, dim, 0, EVENT_DIALOG_EDIT2); // new folder edit box
|
CEdit* pe = pw->CreateEdit(pos, dim, 0, EVENT_DIALOG_EDIT2); // new folder edit box
|
||||||
pe->ClearState(STATE_VISIBLE | STATE_ENABLE);
|
pe->ClearState(STATE_VISIBLE | STATE_ENABLE);
|
||||||
|
|
||||||
GetResource(RES_TEXT, RT_IO_NAME, name);
|
|
||||||
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL2, name); // "Name:" label
|
|
||||||
pla->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
|
||||||
|
|
||||||
pe = pw->CreateEdit(pos, dim, 0, EVENT_DIALOG_EDIT); // file name edit box
|
|
||||||
pe->SetState(STATE_SHADOW);
|
|
||||||
|
|
||||||
if ( m_usePublicPrivate )
|
if ( m_usePublicPrivate )
|
||||||
{
|
{
|
||||||
GetResource(RES_TEXT, RT_IO_DIR, name);
|
GetResource(RES_TEXT, RT_IO_DIR, name);
|
||||||
|
@ -270,16 +264,33 @@ void CFileDialog::StartFileDialog()
|
||||||
pc->SetState(STATE_SHADOW);
|
pc->SetState(STATE_SHADOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_CANCEL); // Cancel button
|
||||||
|
pb->SetState(STATE_SHADOW);
|
||||||
|
|
||||||
pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_OK); // open/save button
|
pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_OK); // open/save button
|
||||||
pb->SetState(STATE_SHADOW);
|
pb->SetState(STATE_SHADOW);
|
||||||
|
|
||||||
|
if (m_dialogtype == CFileDialog::Type::Folder)
|
||||||
|
{
|
||||||
|
m_selectFolderMode = true;
|
||||||
|
AdjustDialog();
|
||||||
|
UpdatePublic(m_public);
|
||||||
|
PopulateList();
|
||||||
|
UpdatePathLabel();
|
||||||
|
UpdateSelectFolder();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GetResource(RES_TEXT, RT_IO_OPEN, name);
|
GetResource(RES_TEXT, RT_IO_OPEN, name);
|
||||||
if ( m_dialogtype == CFileDialog::Type::Save ) GetResource(RES_TEXT, RT_IO_SAVE, name);
|
if ( m_dialogtype == CFileDialog::Type::Save ) GetResource(RES_TEXT, RT_IO_SAVE, name);
|
||||||
pb->SetName(name);
|
pb->SetName(name);
|
||||||
|
|
||||||
pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_CANCEL); // Cancel button
|
GetResource(RES_TEXT, RT_IO_NAME, name);
|
||||||
pb->SetState(STATE_SHADOW);
|
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL2, name); // "Name:" label
|
||||||
GetResource(RES_EVENT, EVENT_DIALOG_CANCEL, name);
|
pla->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
||||||
pb->SetName(name);
|
|
||||||
|
pe = pw->CreateEdit(pos, dim, 0, EVENT_DIALOG_EDIT); // file name edit box
|
||||||
|
pe->SetState(STATE_SHADOW);
|
||||||
|
|
||||||
// create "Overwrite existing file?" controls
|
// create "Overwrite existing file?" controls
|
||||||
CGroup* pg = pw->CreateGroup(pos, dim, 0, EVENT_DIALOG_GROUP1); // box "Overwrite ?"
|
CGroup* pg = pw->CreateGroup(pos, dim, 0, EVENT_DIALOG_GROUP1); // box "Overwrite ?"
|
||||||
|
@ -393,29 +404,32 @@ void CFileDialog::AdjustDialog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ppos.y = wpos.y+30.0f/480.0f;
|
if (!m_selectFolderMode)
|
||||||
ddim.x = 50.0f/640.0f;
|
|
||||||
ddim.y = 20.0f/480.0f;
|
|
||||||
pla = static_cast< CLabel* >(pw->SearchControl(EVENT_DIALOG_LABEL2)); // "Name:" label
|
|
||||||
if ( pla != nullptr )
|
|
||||||
{
|
{
|
||||||
pla->SetPos(ppos);
|
ppos.y = wpos.y+30.0f/480.0f;
|
||||||
pla->SetDim(ddim);
|
ddim.x = 50.0f/640.0f;
|
||||||
}
|
ddim.y = 20.0f/480.0f;
|
||||||
|
pla = static_cast< CLabel* >(pw->SearchControl(EVENT_DIALOG_LABEL2)); // "Name:" label
|
||||||
|
if ( pla != nullptr )
|
||||||
|
{
|
||||||
|
pla->SetPos(ppos);
|
||||||
|
pla->SetDim(ddim);
|
||||||
|
}
|
||||||
|
|
||||||
ppos.x += 50.0f/640.0f;
|
ppos.x += 50.0f/640.0f;
|
||||||
ppos.y = wpos.y+36.0f/480.0f;
|
ppos.y = wpos.y+36.0f/480.0f;
|
||||||
ddim.x = wdim.x-170.0f/640.0f;
|
ddim.x = wdim.x-170.0f/640.0f;
|
||||||
CEdit* pe = static_cast< CEdit* >(pw->SearchControl(EVENT_DIALOG_EDIT)); // file name edit box
|
CEdit* pe = static_cast< CEdit* >(pw->SearchControl(EVENT_DIALOG_EDIT)); // file name edit box
|
||||||
if ( pe != nullptr )
|
if ( pe != nullptr )
|
||||||
{
|
{
|
||||||
pe->SetPos(ppos);
|
pe->SetPos(ppos);
|
||||||
pe->SetDim(ddim);
|
pe->SetDim(ddim);
|
||||||
|
|
||||||
int nch = static_cast< int >((ddim.x*640.0f-22.0f)/5.75f);
|
int nch = static_cast< int >((ddim.x*640.0f-22.0f)/5.75f);
|
||||||
std::string name = pe->GetText(nch);
|
std::string name = pe->GetText(nch);
|
||||||
pe->SetMaxChar(nch);
|
pe->SetMaxChar(nch);
|
||||||
pe->SetText(name);
|
pe->SetText(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_usePublicPrivate )
|
if ( m_usePublicPrivate )
|
||||||
|
@ -561,12 +575,19 @@ bool CFileDialog::EventProcess(const Event &event)
|
||||||
m_captureClick = true;
|
m_captureClick = true;
|
||||||
m_lastTimeClickDir = m_time;
|
m_lastTimeClickDir = m_time;
|
||||||
}
|
}
|
||||||
|
if (m_selectFolderMode) UpdateSelectFolder();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// a file name was clicked
|
// a file name was clicked
|
||||||
if ( !m_newFolderMode ) GetListChoice();
|
|
||||||
m_captureClick = false;
|
m_captureClick = false;
|
||||||
|
if (m_selectFolderMode)
|
||||||
|
{
|
||||||
|
UpdateSelectFolder();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_newFolderMode) GetListChoice();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,6 +619,7 @@ bool CFileDialog::EventProcess(const Event &event)
|
||||||
PopulateList();
|
PopulateList();
|
||||||
UpdatePathLabel();
|
UpdatePathLabel();
|
||||||
if (pe != nullptr) SearchList(pe->GetText(999), m_newFolderMode);
|
if (pe != nullptr) SearchList(pe->GetText(999), m_newFolderMode);
|
||||||
|
if (m_selectFolderMode) UpdateSelectFolder();
|
||||||
}
|
}
|
||||||
else if ( event.type == EVENT_DIALOG_CHECK2 ) // public?
|
else if ( event.type == EVENT_DIALOG_CHECK2 ) // public?
|
||||||
{
|
{
|
||||||
|
@ -606,6 +628,7 @@ bool CFileDialog::EventProcess(const Event &event)
|
||||||
PopulateList();
|
PopulateList();
|
||||||
UpdatePathLabel();
|
UpdatePathLabel();
|
||||||
if (pe != nullptr) SearchList(pe->GetText(999), m_newFolderMode);
|
if (pe != nullptr) SearchList(pe->GetText(999), m_newFolderMode);
|
||||||
|
if (m_selectFolderMode) UpdateSelectFolder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,6 +645,8 @@ bool CFileDialog::EventProcess(const Event &event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_selectFolderMode) return EventSelectFolder(event);
|
||||||
|
|
||||||
if ( event.type == EVENT_DIALOG_OK ||
|
if ( event.type == EVENT_DIALOG_OK ||
|
||||||
(event.type == EVENT_KEY_DOWN && event.GetData<KeyEventData>()->key == KEY(RETURN)) )
|
(event.type == EVENT_KEY_DOWN && event.GetData<KeyEventData>()->key == KEY(RETURN)) )
|
||||||
{
|
{
|
||||||
|
@ -650,9 +675,12 @@ bool CFileDialog::StartNewFolderMode()
|
||||||
CWindow* pw = static_cast< CWindow* >(m_interface->SearchControl(m_windowEvent)); // dialog window
|
CWindow* pw = static_cast< CWindow* >(m_interface->SearchControl(m_windowEvent)); // dialog window
|
||||||
if ( pw == nullptr ) return false;
|
if ( pw == nullptr ) return false;
|
||||||
|
|
||||||
CEdit* pe = static_cast< CEdit* >(pw->SearchControl(EVENT_DIALOG_EDIT)); // filename edit box
|
if (!m_selectFolderMode)
|
||||||
if ( pe == nullptr ) return false;
|
{
|
||||||
pe->SetState(STATE_ENABLE, false);
|
CEdit* pe = static_cast< CEdit* >(pw->SearchControl(EVENT_DIALOG_EDIT)); // filename edit box
|
||||||
|
if ( pe == nullptr ) return false;
|
||||||
|
pe->SetState(STATE_ENABLE, false);
|
||||||
|
}
|
||||||
|
|
||||||
CButton* pb = static_cast< CButton* >(pw->SearchControl(EVENT_DIALOG_NEWDIR)); // new folder button
|
CButton* pb = static_cast< CButton* >(pw->SearchControl(EVENT_DIALOG_NEWDIR)); // new folder button
|
||||||
if ( pb == nullptr ) return false;
|
if ( pb == nullptr ) return false;
|
||||||
|
@ -674,7 +702,7 @@ bool CFileDialog::StartNewFolderMode()
|
||||||
pos.y += dim.y-3.0f/480.0f;
|
pos.y += dim.y-3.0f/480.0f;
|
||||||
dim.y = 20.0f/480.0f;
|
dim.y = 20.0f/480.0f;
|
||||||
|
|
||||||
pe = static_cast< CEdit* >(pw->SearchControl(EVENT_DIALOG_EDIT2)); // new folder edit box
|
CEdit* pe = static_cast< CEdit* >(pw->SearchControl(EVENT_DIALOG_EDIT2)); // new folder edit box
|
||||||
if ( pe == nullptr ) return false;
|
if ( pe == nullptr ) return false;
|
||||||
pe->SetState(STATE_VISIBLE, true);
|
pe->SetState(STATE_VISIBLE, true);
|
||||||
pe->SetState(STATE_ENABLE, true);
|
pe->SetState(STATE_ENABLE, true);
|
||||||
|
@ -704,11 +732,14 @@ bool CFileDialog::StopNewFolderMode(bool bCancel)
|
||||||
pe->ClearState(STATE_VISIBLE | STATE_ENABLE);
|
pe->ClearState(STATE_VISIBLE | STATE_ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pe = static_cast< CEdit* >(pw->SearchControl(EVENT_DIALOG_EDIT)); // filename edit box
|
if (!m_selectFolderMode)
|
||||||
if ( pe != nullptr )
|
|
||||||
{
|
{
|
||||||
pe->SetState(STATE_ENABLE, true);
|
pe = static_cast< CEdit* >(pw->SearchControl(EVENT_DIALOG_EDIT)); // filename edit box
|
||||||
pw->SetFocus(pe);
|
if ( pe != nullptr )
|
||||||
|
{
|
||||||
|
pe->SetState(STATE_ENABLE, true);
|
||||||
|
pw->SetFocus(pe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CButton* pb = static_cast< CButton* >(pw->SearchControl(EVENT_DIALOG_NEWDIR)); // new folder button
|
CButton* pb = static_cast< CButton* >(pw->SearchControl(EVENT_DIALOG_NEWDIR)); // new folder button
|
||||||
|
@ -721,6 +752,12 @@ bool CFileDialog::StopNewFolderMode(bool bCancel)
|
||||||
|
|
||||||
AdjustDialog();
|
AdjustDialog();
|
||||||
|
|
||||||
|
if (m_selectFolderMode)
|
||||||
|
{
|
||||||
|
UpdateSelectFolder();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( pe != nullptr )
|
if ( pe != nullptr )
|
||||||
{
|
{
|
||||||
pe->SetCursor(999, 0);
|
pe->SetCursor(999, 0);
|
||||||
|
@ -765,6 +802,48 @@ bool CFileDialog::EventNewFolder(const Event &event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CFileDialog::EventSelectFolder(const Event &event)
|
||||||
|
{
|
||||||
|
CWindow* pw = static_cast< CWindow* >(m_interface->SearchControl(m_windowEvent));
|
||||||
|
if ( pw == nullptr ) return false;
|
||||||
|
|
||||||
|
if ( event.type == EVENT_DIALOG_OK )
|
||||||
|
{
|
||||||
|
CList* pl = static_cast< CList* >(pw->SearchControl(EVENT_DIALOG_LIST));
|
||||||
|
if ( pl == nullptr ) return false;
|
||||||
|
std::string name = pl->GetItemName(pl->GetSelect());
|
||||||
|
name = name.substr(0, name.find_first_of("\t"));
|
||||||
|
m_subDirPath += m_subDirPath.empty() ? name : "/" + name;
|
||||||
|
m_eventQueue->AddEvent(Event(EVENT_DIALOG_ACTION));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.type == EVENT_KEY_DOWN)
|
||||||
|
{
|
||||||
|
if (event.GetData<KeyEventData>()->key == KEY(ESCAPE))
|
||||||
|
{
|
||||||
|
m_eventQueue->AddEvent(Event(EVENT_DIALOG_STOP));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.GetData<KeyEventData>()->key == KEY(RETURN))
|
||||||
|
{
|
||||||
|
if ( ListItemIsFolder() )
|
||||||
|
{
|
||||||
|
CList* pl = static_cast< CList* >(pw->SearchControl(EVENT_DIALOG_LIST));
|
||||||
|
if ( pl == nullptr ) return false;
|
||||||
|
std::string name = pl->GetItemName(pl->GetSelect());
|
||||||
|
name = name.substr(0, name.find_first_of("\t"));
|
||||||
|
if ( name != ".." )
|
||||||
|
{
|
||||||
|
m_subDirPath += m_subDirPath.empty() ? name : "/" + name;
|
||||||
|
m_eventQueue->AddEvent(Event(EVENT_DIALOG_ACTION));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Updates the file name edit box after a click in the list.
|
// Updates the file name edit box after a click in the list.
|
||||||
|
|
||||||
void CFileDialog::GetListChoice()
|
void CFileDialog::GetListChoice()
|
||||||
|
@ -863,6 +942,28 @@ void CFileDialog::UpdateAction()
|
||||||
pb->SetState(STATE_ENABLE, !bError);
|
pb->SetState(STATE_ENABLE, !bError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFileDialog::UpdateSelectFolder()
|
||||||
|
{
|
||||||
|
CWindow* pw = static_cast< CWindow* >(m_interface->SearchControl(m_windowEvent));
|
||||||
|
if ( pw == nullptr ) return;
|
||||||
|
CButton* pb = static_cast< CButton* >(pw->SearchControl(EVENT_DIALOG_OK));
|
||||||
|
if ( pb == nullptr ) return;
|
||||||
|
|
||||||
|
bool bError = true;
|
||||||
|
if (!m_newFolderMode && ListItemIsFolder())
|
||||||
|
{
|
||||||
|
CList* pl = static_cast< CList* >(pw->SearchControl(EVENT_DIALOG_LIST));
|
||||||
|
if ( pl != nullptr )
|
||||||
|
{
|
||||||
|
std::string name = pl->GetItemName(pl->GetSelect());
|
||||||
|
name = name.substr(0, name.find_first_of("\t"));
|
||||||
|
if (name != "..") bError = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pb->SetState(STATE_ENABLE, !bError);
|
||||||
|
}
|
||||||
|
|
||||||
// Updates the New Folder button.
|
// Updates the New Folder button.
|
||||||
|
|
||||||
void CFileDialog::UpdateNewFolder()
|
void CFileDialog::UpdateNewFolder()
|
||||||
|
|
|
@ -46,11 +46,15 @@ public:
|
||||||
void StopDialog();
|
void StopDialog();
|
||||||
bool EventProcess(const Event &event);
|
bool EventProcess(const Event &event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Identifies the type of dialog to display.
|
||||||
|
*/
|
||||||
enum class Type
|
enum class Type
|
||||||
{
|
{
|
||||||
None,
|
None, //!< Type was not set
|
||||||
Open,
|
Open, //!< Open dialog
|
||||||
Save,
|
Save, //!< Save dialog
|
||||||
|
Folder, //!< Select Folder dialog
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetDialogType(CFileDialog::Type type) { m_dialogtype = type; }
|
void SetDialogType(CFileDialog::Type type) { m_dialogtype = type; }
|
||||||
|
@ -111,6 +115,9 @@ private:
|
||||||
void UpdateNewFolder();
|
void UpdateNewFolder();
|
||||||
void CreateNewFolder();
|
void CreateNewFolder();
|
||||||
|
|
||||||
|
bool EventSelectFolder(const Event &event);
|
||||||
|
void UpdateSelectFolder();
|
||||||
|
|
||||||
bool ListItemIsFolder();
|
bool ListItemIsFolder();
|
||||||
bool DirectoryExists(const std::string &name);
|
bool DirectoryExists(const std::string &name);
|
||||||
|
|
||||||
|
@ -157,6 +164,7 @@ private:
|
||||||
bool m_captureClick = false;
|
bool m_captureClick = false;
|
||||||
|
|
||||||
bool m_newFolderMode = false;
|
bool m_newFolderMode = false;
|
||||||
|
bool m_selectFolderMode = false;
|
||||||
bool m_askOverwriteMode = false;
|
bool m_askOverwriteMode = false;
|
||||||
bool m_confirmOverwrite = false;
|
bool m_confirmOverwrite = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue