Fix for assert after left click on tree in generic dir dialog in native MSW build. Source cleaning and readability fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -383,7 +383,7 @@ void wxDirItemData::SetNewDirName(const wxString& path)
|
|||||||
|
|
||||||
bool wxDirItemData::HasSubDirs() const
|
bool wxDirItemData::HasSubDirs() const
|
||||||
{
|
{
|
||||||
if (m_path.IsEmpty())
|
if (m_path.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxDir dir;
|
wxDir dir;
|
||||||
@@ -398,7 +398,7 @@ bool wxDirItemData::HasSubDirs() const
|
|||||||
|
|
||||||
bool wxDirItemData::HasFiles(const wxString& WXUNUSED(spec)) const
|
bool wxDirItemData::HasFiles(const wxString& WXUNUSED(spec)) const
|
||||||
{
|
{
|
||||||
if (m_path.IsEmpty())
|
if (m_path.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxDir dir;
|
wxDir dir;
|
||||||
@@ -522,7 +522,7 @@ bool wxGenericDirCtrl::Create(wxWindow *parent,
|
|||||||
m_treeCtrl = CreateTreeCtrl(this, wxID_TREECTRL,
|
m_treeCtrl = CreateTreeCtrl(this, wxID_TREECTRL,
|
||||||
wxPoint(0,0), GetClientSize(), treeStyle);
|
wxPoint(0,0), GetClientSize(), treeStyle);
|
||||||
|
|
||||||
if (!filter.IsEmpty() && (style & wxDIRCTRL_SHOW_FILTERS))
|
if (!filter.empty() && (style & wxDIRCTRL_SHOW_FILTERS))
|
||||||
m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL, wxDefaultPosition, wxDefaultSize, filterStyle);
|
m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL, wxDefaultPosition, wxDefaultSize, filterStyle);
|
||||||
|
|
||||||
m_defaultPath = dir;
|
m_defaultPath = dir;
|
||||||
@@ -642,7 +642,7 @@ void wxGenericDirCtrl::OnBeginEditItem(wxTreeEvent &event)
|
|||||||
|
|
||||||
void wxGenericDirCtrl::OnEndEditItem(wxTreeEvent &event)
|
void wxGenericDirCtrl::OnEndEditItem(wxTreeEvent &event)
|
||||||
{
|
{
|
||||||
if ((event.GetLabel().IsEmpty()) ||
|
if ((event.GetLabel().empty()) ||
|
||||||
(event.GetLabel() == _(".")) ||
|
(event.GetLabel() == _(".")) ||
|
||||||
(event.GetLabel() == _("..")) ||
|
(event.GetLabel() == _("..")) ||
|
||||||
(event.GetLabel().Find(wxT('/')) != wxNOT_FOUND) ||
|
(event.GetLabel().Find(wxT('/')) != wxNOT_FOUND) ||
|
||||||
@@ -905,7 +905,7 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString&
|
|||||||
{
|
{
|
||||||
wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(childId);
|
wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(childId);
|
||||||
|
|
||||||
if (data && !data->m_path.IsEmpty())
|
if (data && !data->m_path.empty())
|
||||||
{
|
{
|
||||||
wxString childPath(data->m_path);
|
wxString childPath(data->m_path);
|
||||||
if (!wxEndsWithPathSeparator(childPath))
|
if (!wxEndsWithPathSeparator(childPath))
|
||||||
@@ -1625,13 +1625,13 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime)
|
|||||||
Create();
|
Create();
|
||||||
|
|
||||||
#if wxUSE_MIMETYPE
|
#if wxUSE_MIMETYPE
|
||||||
if (!extension.IsEmpty())
|
if (!extension.empty())
|
||||||
{
|
{
|
||||||
wxFileIconEntry *entry = (wxFileIconEntry*) m_HashTable->Get(extension);
|
wxFileIconEntry *entry = (wxFileIconEntry*) m_HashTable->Get(extension);
|
||||||
if (entry) return (entry -> id);
|
if (entry) return (entry -> id);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileType *ft = (mime.IsEmpty()) ?
|
wxFileType *ft = (mime.empty()) ?
|
||||||
wxTheMimeTypesManager -> GetFileTypeFromExtension(extension) :
|
wxTheMimeTypesManager -> GetFileTypeFromExtension(extension) :
|
||||||
wxTheMimeTypesManager -> GetFileTypeFromMimeType(mime);
|
wxTheMimeTypesManager -> GetFileTypeFromMimeType(mime);
|
||||||
|
|
||||||
|
@@ -278,7 +278,13 @@ void wxGenericDirDialog::OnTreeSelected( wxTreeEvent &event )
|
|||||||
if (!m_dirCtrl)
|
if (!m_dirCtrl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxDirItemData *data = (wxDirItemData*)m_dirCtrl->GetTreeCtrl()->GetItemData(event.GetItem());
|
wxTreeItemId item = event.GetItem();
|
||||||
|
|
||||||
|
wxDirItemData *data = NULL;
|
||||||
|
|
||||||
|
if(item.IsOk())
|
||||||
|
data = (wxDirItemData*)m_dirCtrl->GetTreeCtrl()->GetItemData(item);
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
m_input->SetValue( data->m_path );
|
m_input->SetValue( data->m_path );
|
||||||
};
|
};
|
||||||
|
@@ -1497,8 +1497,14 @@ wxTreeItemId wxTreeCtrl::GetFirstChild(const wxTreeItemId& item,
|
|||||||
wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& WXUNUSED(item),
|
wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& WXUNUSED(item),
|
||||||
wxTreeItemIdValue& cookie) const
|
wxTreeItemIdValue& cookie) const
|
||||||
{
|
{
|
||||||
wxTreeItemId item(TreeView_GetNextSibling(GetHwnd(),
|
wxTreeItemId fromCookie(cookie);
|
||||||
HITEM(wxTreeItemId(cookie))));
|
|
||||||
|
HTREEITEM hitem = HITEM(fromCookie);
|
||||||
|
|
||||||
|
hitem = TreeView_GetNextSibling(GetHwnd(), hitem);
|
||||||
|
|
||||||
|
wxTreeItemId item(hitem);
|
||||||
|
|
||||||
cookie = item.m_pItem;
|
cookie = item.m_pItem;
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
@@ -1519,11 +1525,14 @@ wxTreeItemId wxTreeCtrl::GetFirstChild(const wxTreeItemId& item,
|
|||||||
wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& WXUNUSED(item),
|
wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& WXUNUSED(item),
|
||||||
long& cookie) const
|
long& cookie) const
|
||||||
{
|
{
|
||||||
wxTreeItemId item(TreeView_GetNextSibling
|
wxTreeItemId fromCookie((void *)cookie);
|
||||||
(
|
|
||||||
GetHwnd(),
|
HTREEITEM hitem = HITEM(fromCookie);
|
||||||
HITEM(wxTreeItemId((void *)cookie)
|
|
||||||
)));
|
hitem = TreeView_GetNextSibling(GetHwnd(), hitem);
|
||||||
|
|
||||||
|
wxTreeItemId item(hitem);
|
||||||
|
|
||||||
cookie = (long)item.m_pItem;
|
cookie = (long)item.m_pItem;
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
@@ -1646,7 +1655,7 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
UINT mask = 0;
|
UINT mask = 0;
|
||||||
if ( !text.IsEmpty() )
|
if ( !text.empty() )
|
||||||
{
|
{
|
||||||
mask |= TVIF_TEXT;
|
mask |= TVIF_TEXT;
|
||||||
tvIns.item.pszText = (wxChar *)text.c_str(); // cast is ok
|
tvIns.item.pszText = (wxChar *)text.c_str(); // cast is ok
|
||||||
|
Reference in New Issue
Block a user