Integrate with GNOME's Recent Documents menu.
GTK+ provides GtkRecentManager for this purpose since 2.10. Use it in wxFileHistory if available. Integration is simple, we just add a file to GtkRecentManager in addition to normal wxFileHistory handling. A well-behaved GNOME application would use GtkRecentManager as the primary store for recent files, so that it reflects when the user works with supported files in another editor(s) too. But for now, this is much better than no support at all. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64240 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
21
Makefile.in
21
Makefile.in
@@ -2509,6 +2509,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_LOWLEVEL_HDR = \
|
|||||||
wx/gtk/evtloop.h \
|
wx/gtk/evtloop.h \
|
||||||
wx/gtk/evtloopsrc.h \
|
wx/gtk/evtloopsrc.h \
|
||||||
wx/gtk/font.h \
|
wx/gtk/font.h \
|
||||||
|
wx/gtk/filehistory.h \
|
||||||
wx/gtk/minifram.h \
|
wx/gtk/minifram.h \
|
||||||
wx/gtk/pen.h \
|
wx/gtk/pen.h \
|
||||||
wx/gtk/popupwin.h \
|
wx/gtk/popupwin.h \
|
||||||
@@ -4694,6 +4695,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS = \
|
|||||||
monodll_gtk_dnd.o \
|
monodll_gtk_dnd.o \
|
||||||
monodll_gtk_evtloop.o \
|
monodll_gtk_evtloop.o \
|
||||||
monodll_filectrl.o \
|
monodll_filectrl.o \
|
||||||
|
monodll_filehistory.o \
|
||||||
monodll_gtk_font.o \
|
monodll_gtk_font.o \
|
||||||
monodll_gtk_sockgtk.o \
|
monodll_gtk_sockgtk.o \
|
||||||
monodll_gtk_minifram.o \
|
monodll_gtk_minifram.o \
|
||||||
@@ -5543,6 +5545,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_1 = \
|
|||||||
monodll_gtk_dnd.o \
|
monodll_gtk_dnd.o \
|
||||||
monodll_gtk_evtloop.o \
|
monodll_gtk_evtloop.o \
|
||||||
monodll_filectrl.o \
|
monodll_filectrl.o \
|
||||||
|
monodll_filehistory.o \
|
||||||
monodll_gtk_font.o \
|
monodll_gtk_font.o \
|
||||||
monodll_gtk_sockgtk.o \
|
monodll_gtk_sockgtk.o \
|
||||||
monodll_gtk_minifram.o \
|
monodll_gtk_minifram.o \
|
||||||
@@ -6533,6 +6536,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_2 = \
|
|||||||
monolib_gtk_dnd.o \
|
monolib_gtk_dnd.o \
|
||||||
monolib_gtk_evtloop.o \
|
monolib_gtk_evtloop.o \
|
||||||
monolib_filectrl.o \
|
monolib_filectrl.o \
|
||||||
|
monolib_filehistory.o \
|
||||||
monolib_gtk_font.o \
|
monolib_gtk_font.o \
|
||||||
monolib_gtk_sockgtk.o \
|
monolib_gtk_sockgtk.o \
|
||||||
monolib_gtk_minifram.o \
|
monolib_gtk_minifram.o \
|
||||||
@@ -7382,6 +7386,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_3 = \
|
|||||||
monolib_gtk_dnd.o \
|
monolib_gtk_dnd.o \
|
||||||
monolib_gtk_evtloop.o \
|
monolib_gtk_evtloop.o \
|
||||||
monolib_filectrl.o \
|
monolib_filectrl.o \
|
||||||
|
monolib_filehistory.o \
|
||||||
monolib_gtk_font.o \
|
monolib_gtk_font.o \
|
||||||
monolib_gtk_sockgtk.o \
|
monolib_gtk_sockgtk.o \
|
||||||
monolib_gtk_minifram.o \
|
monolib_gtk_minifram.o \
|
||||||
@@ -8561,6 +8566,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_4 = \
|
|||||||
coredll_gtk_dnd.o \
|
coredll_gtk_dnd.o \
|
||||||
coredll_gtk_evtloop.o \
|
coredll_gtk_evtloop.o \
|
||||||
coredll_filectrl.o \
|
coredll_filectrl.o \
|
||||||
|
coredll_filehistory.o \
|
||||||
coredll_gtk_font.o \
|
coredll_gtk_font.o \
|
||||||
coredll_gtk_sockgtk.o \
|
coredll_gtk_sockgtk.o \
|
||||||
coredll_gtk_minifram.o \
|
coredll_gtk_minifram.o \
|
||||||
@@ -9410,6 +9416,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_5 = \
|
|||||||
coredll_gtk_dnd.o \
|
coredll_gtk_dnd.o \
|
||||||
coredll_gtk_evtloop.o \
|
coredll_gtk_evtloop.o \
|
||||||
coredll_filectrl.o \
|
coredll_filectrl.o \
|
||||||
|
coredll_filehistory.o \
|
||||||
coredll_gtk_font.o \
|
coredll_gtk_font.o \
|
||||||
coredll_gtk_sockgtk.o \
|
coredll_gtk_sockgtk.o \
|
||||||
coredll_gtk_minifram.o \
|
coredll_gtk_minifram.o \
|
||||||
@@ -10076,6 +10083,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_6 = \
|
|||||||
corelib_gtk_dnd.o \
|
corelib_gtk_dnd.o \
|
||||||
corelib_gtk_evtloop.o \
|
corelib_gtk_evtloop.o \
|
||||||
corelib_filectrl.o \
|
corelib_filectrl.o \
|
||||||
|
corelib_filehistory.o \
|
||||||
corelib_gtk_font.o \
|
corelib_gtk_font.o \
|
||||||
corelib_gtk_sockgtk.o \
|
corelib_gtk_sockgtk.o \
|
||||||
corelib_gtk_minifram.o \
|
corelib_gtk_minifram.o \
|
||||||
@@ -10925,6 +10933,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_7 = \
|
|||||||
corelib_gtk_dnd.o \
|
corelib_gtk_dnd.o \
|
||||||
corelib_gtk_evtloop.o \
|
corelib_gtk_evtloop.o \
|
||||||
corelib_filectrl.o \
|
corelib_filectrl.o \
|
||||||
|
corelib_filehistory.o \
|
||||||
corelib_gtk_font.o \
|
corelib_gtk_font.o \
|
||||||
corelib_gtk_sockgtk.o \
|
corelib_gtk_sockgtk.o \
|
||||||
corelib_gtk_minifram.o \
|
corelib_gtk_minifram.o \
|
||||||
@@ -17101,6 +17110,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
|
|||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(MONODLL_ODEP)
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(MONODLL_ODEP)
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
|
||||||
|
|
||||||
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_filehistory.o: $(srcdir)/src/gtk/filehistory.cpp $(MONODLL_ODEP)
|
||||||
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/filehistory.cpp
|
||||||
|
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_gtk_font.o: $(srcdir)/src/gtk/font.cpp $(MONODLL_ODEP)
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_gtk_font.o: $(srcdir)/src/gtk/font.cpp $(MONODLL_ODEP)
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
|
||||||
|
|
||||||
@@ -21961,6 +21973,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
|
|||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(MONOLIB_ODEP)
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(MONOLIB_ODEP)
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
|
||||||
|
|
||||||
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_filehistory.o: $(srcdir)/src/gtk/filehistory.cpp $(MONOLIB_ODEP)
|
||||||
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/filehistory.cpp
|
||||||
|
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_gtk_font.o: $(srcdir)/src/gtk/font.cpp $(MONOLIB_ODEP)
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_gtk_font.o: $(srcdir)/src/gtk/font.cpp $(MONOLIB_ODEP)
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
|
||||||
|
|
||||||
@@ -27013,6 +27028,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
|
|||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(COREDLL_ODEP)
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(COREDLL_ODEP)
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
|
||||||
|
|
||||||
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_filehistory.o: $(srcdir)/src/gtk/filehistory.cpp $(COREDLL_ODEP)
|
||||||
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/filehistory.cpp
|
||||||
|
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_gtk_font.o: $(srcdir)/src/gtk/font.cpp $(COREDLL_ODEP)
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_gtk_font.o: $(srcdir)/src/gtk/font.cpp $(COREDLL_ODEP)
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
|
||||||
|
|
||||||
@@ -30604,6 +30622,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
|
|||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(CORELIB_ODEP)
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(CORELIB_ODEP)
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
|
||||||
|
|
||||||
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_filehistory.o: $(srcdir)/src/gtk/filehistory.cpp $(CORELIB_ODEP)
|
||||||
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/filehistory.cpp
|
||||||
|
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_gtk_font.o: $(srcdir)/src/gtk/font.cpp $(CORELIB_ODEP)
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_gtk_font.o: $(srcdir)/src/gtk/font.cpp $(CORELIB_ODEP)
|
||||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
|
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
|
||||||
|
|
||||||
|
@@ -1039,6 +1039,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
src/gtk/dnd.cpp
|
src/gtk/dnd.cpp
|
||||||
src/gtk/evtloop.cpp
|
src/gtk/evtloop.cpp
|
||||||
src/gtk/filectrl.cpp
|
src/gtk/filectrl.cpp
|
||||||
|
src/gtk/filehistory.cpp
|
||||||
src/gtk/font.cpp
|
src/gtk/font.cpp
|
||||||
src/gtk/sockgtk.cpp
|
src/gtk/sockgtk.cpp
|
||||||
src/gtk/minifram.cpp
|
src/gtk/minifram.cpp
|
||||||
@@ -1077,6 +1078,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
wx/gtk/evtloop.h
|
wx/gtk/evtloop.h
|
||||||
wx/gtk/evtloopsrc.h
|
wx/gtk/evtloopsrc.h
|
||||||
wx/gtk/font.h
|
wx/gtk/font.h
|
||||||
|
wx/gtk/filehistory.h
|
||||||
wx/gtk/minifram.h
|
wx/gtk/minifram.h
|
||||||
wx/gtk/pen.h
|
wx/gtk/pen.h
|
||||||
wx/gtk/popupwin.h
|
wx/gtk/popupwin.h
|
||||||
|
@@ -28,10 +28,10 @@ class WXDLLIMPEXP_FWD_BASE wxConfigBase;
|
|||||||
// File history management
|
// File history management
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxFileHistory : public wxObject
|
class WXDLLIMPEXP_CORE wxFileHistoryBase : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1);
|
wxFileHistoryBase(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1);
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
virtual void AddFileToHistory(const wxString& file);
|
virtual void AddFileToHistory(const wxString& file);
|
||||||
@@ -79,17 +79,31 @@ private:
|
|||||||
// The ID of the first history menu item (Doesn't have to be wxID_FILE1)
|
// The ID of the first history menu item (Doesn't have to be wxID_FILE1)
|
||||||
wxWindowID m_idBase;
|
wxWindowID m_idBase;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxFileHistory)
|
wxDECLARE_NO_COPY_CLASS(wxFileHistoryBase);
|
||||||
wxDECLARE_NO_COPY_CLASS(wxFileHistory);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY_2_6
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
inline size_t wxFileHistory::GetNoHistoryFiles() const
|
inline size_t wxFileHistoryBase::GetNoHistoryFiles() const
|
||||||
{
|
{
|
||||||
return m_fileHistory.GetCount();
|
return m_fileHistory.GetCount();
|
||||||
}
|
}
|
||||||
#endif // WXWIN_COMPATIBILITY_2_6
|
#endif // WXWIN_COMPATIBILITY_2_6
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__WXGTK20__)
|
||||||
|
#include "wx/gtk/filehistory.h"
|
||||||
|
#else
|
||||||
|
// no platform-specific implementation of wxFileHistory yet
|
||||||
|
class WXDLLIMPEXP_CORE wxFileHistory : public wxFileHistoryBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1)
|
||||||
|
: wxFileHistoryBase(maxFiles, idBase) {}
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxFileHistory)
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // wxUSE_FILE_HISTORY
|
#endif // wxUSE_FILE_HISTORY
|
||||||
|
|
||||||
#endif // _WX_FILEHISTORY_H_
|
#endif // _WX_FILEHISTORY_H_
|
||||||
|
25
include/wx/gtk/filehistory.h
Normal file
25
include/wx/gtk/filehistory.h
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/gtk/filehistory.h
|
||||||
|
// Purpose: GTK+ bits for wxFileHistory
|
||||||
|
// Author: Vaclav Slavik
|
||||||
|
// Created: 2010-05-06
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2010 Vaclav Slavik
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_GTK_FILEHISTORY_H_
|
||||||
|
#define _WX_GTK_FILEHISTORY_H_
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_CORE wxFileHistory : public wxFileHistoryBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1)
|
||||||
|
: wxFileHistoryBase(maxFiles, idBase) {}
|
||||||
|
|
||||||
|
virtual void AddFileToHistory(const wxString& file);
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxFileHistory)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _WX_GTK_FILEHISTORY_H_
|
@@ -62,13 +62,13 @@ wxString GetMRUEntryLabel(int n, const wxString& path)
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject)
|
||||||
|
|
||||||
wxFileHistory::wxFileHistory(size_t maxFiles, wxWindowID idBase)
|
wxFileHistoryBase::wxFileHistoryBase(size_t maxFiles, wxWindowID idBase)
|
||||||
{
|
{
|
||||||
m_fileMaxFiles = maxFiles;
|
m_fileMaxFiles = maxFiles;
|
||||||
m_idBase = idBase;
|
m_idBase = idBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileHistory::AddFileToHistory(const wxString& file)
|
void wxFileHistoryBase::AddFileToHistory(const wxString& file)
|
||||||
{
|
{
|
||||||
// check if we don't already have this file
|
// check if we don't already have this file
|
||||||
const wxFileName fnNew(file);
|
const wxFileName fnNew(file);
|
||||||
@@ -138,11 +138,11 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileHistory::RemoveFileFromHistory(size_t i)
|
void wxFileHistoryBase::RemoveFileFromHistory(size_t i)
|
||||||
{
|
{
|
||||||
size_t numFiles = m_fileHistory.size();
|
size_t numFiles = m_fileHistory.size();
|
||||||
wxCHECK_RET( i < numFiles,
|
wxCHECK_RET( i < numFiles,
|
||||||
wxT("invalid index in wxFileHistory::RemoveFileFromHistory") );
|
wxT("invalid index in wxFileHistoryBase::RemoveFileFromHistory") );
|
||||||
|
|
||||||
// delete the element from the array
|
// delete the element from the array
|
||||||
m_fileHistory.RemoveAt(i);
|
m_fileHistory.RemoveAt(i);
|
||||||
@@ -181,19 +181,19 @@ void wxFileHistory::RemoveFileFromHistory(size_t i)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileHistory::UseMenu(wxMenu *menu)
|
void wxFileHistoryBase::UseMenu(wxMenu *menu)
|
||||||
{
|
{
|
||||||
if ( !m_fileMenus.Member(menu) )
|
if ( !m_fileMenus.Member(menu) )
|
||||||
m_fileMenus.Append(menu);
|
m_fileMenus.Append(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileHistory::RemoveMenu(wxMenu *menu)
|
void wxFileHistoryBase::RemoveMenu(wxMenu *menu)
|
||||||
{
|
{
|
||||||
m_fileMenus.DeleteObject(menu);
|
m_fileMenus.DeleteObject(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_CONFIG
|
#if wxUSE_CONFIG
|
||||||
void wxFileHistory::Load(const wxConfigBase& config)
|
void wxFileHistoryBase::Load(const wxConfigBase& config)
|
||||||
{
|
{
|
||||||
m_fileHistory.Clear();
|
m_fileHistory.Clear();
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ void wxFileHistory::Load(const wxConfigBase& config)
|
|||||||
AddFilesToMenu();
|
AddFilesToMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileHistory::Save(wxConfigBase& config)
|
void wxFileHistoryBase::Save(wxConfigBase& config)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < m_fileMaxFiles; i++)
|
for (i = 0; i < m_fileMaxFiles; i++)
|
||||||
@@ -228,7 +228,7 @@ void wxFileHistory::Save(wxConfigBase& config)
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_CONFIG
|
#endif // wxUSE_CONFIG
|
||||||
|
|
||||||
void wxFileHistory::AddFilesToMenu()
|
void wxFileHistoryBase::AddFilesToMenu()
|
||||||
{
|
{
|
||||||
if ( m_fileHistory.empty() )
|
if ( m_fileHistory.empty() )
|
||||||
return;
|
return;
|
||||||
@@ -241,7 +241,7 @@ void wxFileHistory::AddFilesToMenu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileHistory::AddFilesToMenu(wxMenu* menu)
|
void wxFileHistoryBase::AddFilesToMenu(wxMenu* menu)
|
||||||
{
|
{
|
||||||
if ( m_fileHistory.empty() )
|
if ( m_fileHistory.empty() )
|
||||||
return;
|
return;
|
||||||
|
56
src/gtk/filehistory.cpp
Normal file
56
src/gtk/filehistory.cpp
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: src/gtk/filehistory.cpp
|
||||||
|
// Purpose: GTK+ bits for wxFileHistory class
|
||||||
|
// Author: Vaclav Slavik
|
||||||
|
// Created: 2010-05-06
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2010 Vaclav Slavik
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/filehistory.h"
|
||||||
|
|
||||||
|
#if wxUSE_FILE_HISTORY
|
||||||
|
|
||||||
|
#include "wx/filename.h"
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include "wx/gtk/private/string.h"
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
void wxFileHistory::AddFileToHistory(const wxString& file)
|
||||||
|
{
|
||||||
|
wxFileHistoryBase::AddFileToHistory(file);
|
||||||
|
|
||||||
|
#ifdef __WXGTK210__
|
||||||
|
const wxString fullPath = wxFileName(file).GetFullPath();
|
||||||
|
if ( !gtk_check_version(2,10,0) )
|
||||||
|
{
|
||||||
|
wxGtkString uri(g_filename_to_uri(fullPath.fn_str(), NULL, NULL));
|
||||||
|
|
||||||
|
if ( uri )
|
||||||
|
gtk_recent_manager_add_item(gtk_recent_manager_get_default(), uri);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_FILE_HISTORY
|
Reference in New Issue
Block a user