From 1b977718d41518e345177d43e42634da5dfc70b1 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 12 May 2019 11:45:23 +0200 Subject: [PATCH] Make wxPG_FILE_xxx built-in attributes All wxPG_FILE_xxx attributes are used only in wxFileProperty to set respective internal data members and don't have to be stored in the property's attribute store. --- interface/wx/propgrid/property.h | 24 +++++++++++++----------- interface/wx/propgrid/props.h | 4 ++-- src/propgrid/advprops.cpp | 2 +- src/propgrid/props.cpp | 8 +++----- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index c21c55df01..2cab67c25a 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -125,29 +125,31 @@ struct wxPGPaintData */ #define wxPG_UINT_PREFIX wxS("Prefix") -/** wxFileProperty/wxImageFileProperty specific, @c wxChar*, default is detected/varies. - Sets the wildcard used in the triggered wxFileDialog. Format is the - same. +/** wxFileProperty and wxImageFileProperty specific built-in attribute, + @c wxChar*, default is detected/varies. Sets the wildcard used in + the triggered wxFileDialog. Format is the same. */ #define wxPG_FILE_WILDCARD wxS("Wildcard") -/** wxFileProperty and wxImageFileProperty specific, @c int, default 1. - When 0, only the file name is shown (i.e. drive and directory are hidden). +/** wxFileProperty and wxImageFileProperty specific built-in attribute, @c bool, + default @true. When @false, only the file name is shown (i.e. drive and + directory are hidden). */ #define wxPG_FILE_SHOW_FULL_PATH wxS("ShowFullPath") -/** Specific to wxFileProperty and derived properties, wxString, default empty. - If set, then the filename is shown relative to the given path string. +/** Built-in attribute specific to wxFileProperty and derived properties, + wxString, default empty. If set, then the filename is shown relative + to the given path string. */ #define wxPG_FILE_SHOW_RELATIVE_PATH wxS("ShowRelativePath") -/** Specific to wxFileProperty and derived properties, wxString, default is empty. - Sets the initial path of where to look for files. +/** Built-in attribute specific to wxFileProperty and derived properties, + wxString, default is empty. Sets the initial path of where to look for files. */ #define wxPG_FILE_INITIAL_PATH wxS("InitialPath") -/** Specific to wxFileProperty and derivatives, wxString, default is empty. - Sets a specific title for the dir dialog. +/** Built-in attribute specific to wxFileProperty and derivatives, wxString, + default is empty. Sets a specific title for the dir dialog. */ #define wxPG_FILE_DIALOG_TITLE wxS("DialogTitle") diff --git a/interface/wx/propgrid/props.h b/interface/wx/propgrid/props.h index 4a40e72386..43103f066a 100644 --- a/interface/wx/propgrid/props.h +++ b/interface/wx/propgrid/props.h @@ -513,8 +513,8 @@ public: Supported special attributes: - ::wxPG_FILE_WILDCARD: Sets wildcard (see wxFileDialog for format details), "All files..." is default. - - ::wxPG_FILE_SHOW_FULL_PATH: Default 1. When 0, only the file name is shown - (i.e. drive and directory are hidden). + - ::wxPG_FILE_SHOW_FULL_PATH: Default @true. When @false, only the file name is + shown (i.e. drive and directory are hidden). - ::wxPG_FILE_SHOW_RELATIVE_PATH: If set, then the filename is shown relative to the given path string. - ::wxPG_FILE_INITIAL_PATH: Sets the initial path of where to look for files. diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 2446b117f3..1d84ae5c9a 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -1946,7 +1946,7 @@ wxImageFileProperty::wxImageFileProperty( const wxString& label, const wxString& const wxString& value ) : wxFileProperty(label,name,value) { - SetAttribute( wxPG_FILE_WILDCARD, wxPGGetDefaultImageWildcard() ); + m_wildcard = wxPGGetDefaultImageWildcard(); m_pImage = NULL; m_pBitmap = NULL; diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index 17bf88bda3..cf13a6b2b8 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -1938,7 +1938,7 @@ wxFileProperty::wxFileProperty( const wxString& label, const wxString& name, m_flags |= wxPG_PROP_SHOW_FULL_FILENAME; m_indFilter = -1; m_dlgStyle = 0; - SetAttribute( wxPG_FILE_WILDCARD, wxALL_FILES); + m_wildcard = wxALL_FILES; SetValue(value); } @@ -2091,8 +2091,6 @@ bool wxFileProperty::StringToValue( wxVariant& variant, const wxString& text, in bool wxFileProperty::DoSetAttribute( const wxString& name, wxVariant& value ) { - // Return false on some occasions to make sure those attributes will get - // stored in m_attributes. if ( name == wxPG_FILE_SHOW_FULL_PATH ) { ChangeFlag(wxPG_PROP_SHOW_FULL_FILENAME, value.GetBool()); @@ -2101,7 +2099,7 @@ bool wxFileProperty::DoSetAttribute( const wxString& name, wxVariant& value ) else if ( name == wxPG_FILE_WILDCARD ) { m_wildcard = value.GetString(); - return false; + return true; } else if ( name == wxPG_FILE_SHOW_RELATIVE_PATH ) { @@ -2109,7 +2107,7 @@ bool wxFileProperty::DoSetAttribute( const wxString& name, wxVariant& value ) // Make sure wxPG_FILE_SHOW_FULL_PATH is also set m_flags |= wxPG_PROP_SHOW_FULL_FILENAME; - return false; + return true; } else if ( name == wxPG_FILE_INITIAL_PATH ) {