Rename wxFileHistoryMenuPathStyle values too
Use common wxFH_PATH_ prefix for consistency and try to make the values more clear.
This commit is contained in:
@@ -26,9 +26,9 @@ class WXDLLIMPEXP_FWD_BASE wxFileName;
|
|||||||
|
|
||||||
enum wxFileHistoryMenuPathStyle
|
enum wxFileHistoryMenuPathStyle
|
||||||
{
|
{
|
||||||
wxFH_HIDE_CURRENT_PATH = 0,
|
wxFH_PATH_SHOW_IF_DIFFERENT,
|
||||||
wxFH_HIDE_ALL_PATHS = 1,
|
wxFH_PATH_SHOW_NEVER,
|
||||||
wxFH_SHOW_FULL_PATH = 2
|
wxFH_PATH_SHOW_ALWAYS
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -8,21 +8,36 @@
|
|||||||
/**
|
/**
|
||||||
Styles for the paths shown in wxFileHistory menus.
|
Styles for the paths shown in wxFileHistory menus.
|
||||||
|
|
||||||
The default style is wxFH_HIDE_CURRENT_PATH, i.e. the path of the file is
|
The values of this enum determine whether the labels in the menu managed by
|
||||||
only shown in the menu if it's different from the path of the first file.
|
wxFileHistory show the full path for the corresponding file or just the
|
||||||
|
base name.
|
||||||
|
|
||||||
|
The default style is wxFH_PATH_SHOW_IF_DIFFERENT, i.e. the full path of the
|
||||||
|
file is only shown in the menu if it's different from the path of the first
|
||||||
|
file.
|
||||||
|
|
||||||
@since 3.1.5
|
@since 3.1.5
|
||||||
*/
|
*/
|
||||||
enum wxFileHistoryMenuPathStyle
|
enum wxFileHistoryMenuPathStyle
|
||||||
{
|
{
|
||||||
/** Hide the file path if it matches the path of the first item */
|
/**
|
||||||
wxFH_HIDE_CURRENT_PATH,
|
Show the full path if it's different from the path of the first file.
|
||||||
|
|
||||||
/** Hide all paths and show only filenames */
|
Otherwise show just the file name.
|
||||||
wxFH_HIDE_ALL_PATHS,
|
|
||||||
|
|
||||||
/** Show the full path for all files */
|
This value corresponds to the default behaviour.
|
||||||
wxFH_SHOW_FULL_PATH
|
*/
|
||||||
|
wxFH_PATH_SHOW_IF_DIFFERENT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
Never show full path, always show just the base file name.
|
||||||
|
*/
|
||||||
|
wxFH_PATH_SHOW_NEVER,
|
||||||
|
|
||||||
|
/**
|
||||||
|
Always show the full path for all files.
|
||||||
|
*/
|
||||||
|
wxFH_PATH_SHOW_ALWAYS
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,7 +167,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Set the style of the menu item labels.
|
Set the style of the menu item labels.
|
||||||
|
|
||||||
By default, the menu item label style is ::wxFH_HIDE_CURRENT_PATH.
|
By default, the menu item label style is ::wxFH_PATH_SHOW_IF_DIFFERENT.
|
||||||
|
|
||||||
@remarks Use RefreshLabels() to update any existing menu items to the new style.
|
@remarks Use RefreshLabels() to update any existing menu items to the new style.
|
||||||
@since 3.1.5
|
@since 3.1.5
|
||||||
@@ -162,7 +177,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Get the current style of the menu item labels.
|
Get the current style of the menu item labels.
|
||||||
|
|
||||||
Initially returns ::wxFH_HIDE_CURRENT_PATH.
|
Initially returns ::wxFH_PATH_SHOW_IF_DIFFERENT.
|
||||||
|
|
||||||
@see SetMenuPathStyle()
|
@see SetMenuPathStyle()
|
||||||
|
|
||||||
|
@@ -1394,13 +1394,13 @@ void MyFrame::OnFileHistoryStyleItem(wxCommandEvent& event)
|
|||||||
switch( event.GetId() )
|
switch( event.GetId() )
|
||||||
{
|
{
|
||||||
case Menu_Menu_FileHistory1:
|
case Menu_Menu_FileHistory1:
|
||||||
m_fileHistory->SetMenuPathStyle(wxFH_HIDE_CURRENT_PATH);
|
m_fileHistory->SetMenuPathStyle(wxFH_PATH_SHOW_IF_DIFFERENT);
|
||||||
break;
|
break;
|
||||||
case Menu_Menu_FileHistory2:
|
case Menu_Menu_FileHistory2:
|
||||||
m_fileHistory->SetMenuPathStyle(wxFH_HIDE_ALL_PATHS);
|
m_fileHistory->SetMenuPathStyle(wxFH_PATH_SHOW_NEVER);
|
||||||
break;
|
break;
|
||||||
case Menu_Menu_FileHistory3:
|
case Menu_Menu_FileHistory3:
|
||||||
m_fileHistory->SetMenuPathStyle(wxFH_SHOW_FULL_PATH);
|
m_fileHistory->SetMenuPathStyle(wxFH_PATH_SHOW_ALWAYS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -70,7 +70,7 @@ wxFileHistoryBase::wxFileHistoryBase(size_t maxFiles, wxWindowID idBase)
|
|||||||
{
|
{
|
||||||
m_fileMaxFiles = maxFiles;
|
m_fileMaxFiles = maxFiles;
|
||||||
m_idBase = idBase;
|
m_idBase = idBase;
|
||||||
m_menuPathStyle = wxFH_HIDE_CURRENT_PATH;
|
m_menuPathStyle = wxFH_PATH_SHOW_IF_DIFFERENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
@@ -158,12 +158,12 @@ void wxFileHistoryBase::RefreshLabels()
|
|||||||
|
|
||||||
wxString pathInMenu;
|
wxString pathInMenu;
|
||||||
|
|
||||||
if ( m_menuPathStyle == wxFH_HIDE_ALL_PATHS )
|
if ( m_menuPathStyle == wxFH_PATH_SHOW_NEVER )
|
||||||
{
|
{
|
||||||
// Only show the filename + extension and not the path
|
// Only show the filename + extension and not the path
|
||||||
pathInMenu = currFn.GetFullName();
|
pathInMenu = currFn.GetFullName();
|
||||||
}
|
}
|
||||||
else if ( ( m_menuPathStyle == wxFH_HIDE_CURRENT_PATH ) &&
|
else if ( ( m_menuPathStyle == wxFH_PATH_SHOW_IF_DIFFERENT ) &&
|
||||||
( currFn.GetPath() == firstFn.GetPath() ) && currFn.HasName() )
|
( currFn.GetPath() == firstFn.GetPath() ) && currFn.HasName() )
|
||||||
{
|
{
|
||||||
// Hide the path if it is in the same folder as the first file
|
// Hide the path if it is in the same folder as the first file
|
||||||
@@ -171,7 +171,7 @@ void wxFileHistoryBase::RefreshLabels()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Either has wxFH_SHOW_FULL_PATH menu style, or the file is in a different directory
|
// Either has wxFH_PATH_SHOW_ALWAYS menu style, or the file is in a different directory
|
||||||
// from the first file
|
// from the first file
|
||||||
pathInMenu = m_fileHistory[i];
|
pathInMenu = m_fileHistory[i];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user