diff --git a/Makefile.in b/Makefile.in
index abf89f2466..b4fc200a67 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3773,6 +3773,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
wx/evtloopsrc.h \
wx/fdrepdlg.h \
wx/filectrl.h \
+ wx/filehistory.h \
wx/filepicker.h \
wx/fontpicker.h \
wx/fmappriv.h \
@@ -4294,6 +4295,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS = \
monodll_effects.o \
monodll_fddlgcmn.o \
monodll_filectrlcmn.o \
+ monodll_filehistorycmn.o \
monodll_filepickercmn.o \
monodll_fontpickercmn.o \
monodll_fldlgcmn.o \
@@ -4490,6 +4492,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \
monodll_effects.o \
monodll_fddlgcmn.o \
monodll_filectrlcmn.o \
+ monodll_filehistorycmn.o \
monodll_filepickercmn.o \
monodll_fontpickercmn.o \
monodll_fldlgcmn.o \
@@ -6131,6 +6134,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 = \
monolib_effects.o \
monolib_fddlgcmn.o \
monolib_filectrlcmn.o \
+ monolib_filehistorycmn.o \
monolib_filepickercmn.o \
monolib_fontpickercmn.o \
monolib_fldlgcmn.o \
@@ -6327,6 +6331,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \
monolib_effects.o \
monolib_fddlgcmn.o \
monolib_filectrlcmn.o \
+ monolib_filehistorycmn.o \
monolib_filepickercmn.o \
monolib_fontpickercmn.o \
monolib_fldlgcmn.o \
@@ -8157,6 +8162,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 = \
coredll_effects.o \
coredll_fddlgcmn.o \
coredll_filectrlcmn.o \
+ coredll_filehistorycmn.o \
coredll_filepickercmn.o \
coredll_fontpickercmn.o \
coredll_fldlgcmn.o \
@@ -8353,6 +8359,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \
coredll_effects.o \
coredll_fddlgcmn.o \
coredll_filectrlcmn.o \
+ coredll_filehistorycmn.o \
coredll_filepickercmn.o \
coredll_fontpickercmn.o \
coredll_fldlgcmn.o \
@@ -9667,6 +9674,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 = \
corelib_effects.o \
corelib_fddlgcmn.o \
corelib_filectrlcmn.o \
+ corelib_filehistorycmn.o \
corelib_filepickercmn.o \
corelib_fontpickercmn.o \
corelib_fldlgcmn.o \
@@ -9863,6 +9871,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \
corelib_effects.o \
corelib_fddlgcmn.o \
corelib_filectrlcmn.o \
+ corelib_filehistorycmn.o \
corelib_filepickercmn.o \
corelib_fontpickercmn.o \
corelib_fldlgcmn.o \
@@ -18960,6 +18969,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@monodll_filectrlcmn.o: $(srcdir)/src/common/filectrlcmn.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/filectrlcmn.cpp
+@COND_USE_GUI_1@monodll_filehistorycmn.o: $(srcdir)/src/common/filehistorycmn.cpp $(MONODLL_ODEP)
+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/filehistorycmn.cpp
+
@COND_USE_GUI_1@monodll_filepickercmn.o: $(srcdir)/src/common/filepickercmn.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/filepickercmn.cpp
@@ -23817,6 +23829,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@monolib_filectrlcmn.o: $(srcdir)/src/common/filectrlcmn.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/filectrlcmn.cpp
+@COND_USE_GUI_1@monolib_filehistorycmn.o: $(srcdir)/src/common/filehistorycmn.cpp $(MONOLIB_ODEP)
+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/filehistorycmn.cpp
+
@COND_USE_GUI_1@monolib_filepickercmn.o: $(srcdir)/src/common/filepickercmn.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/filepickercmn.cpp
@@ -28863,6 +28878,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
@COND_USE_GUI_1@coredll_filectrlcmn.o: $(srcdir)/src/common/filectrlcmn.cpp $(COREDLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/filectrlcmn.cpp
+@COND_USE_GUI_1@coredll_filehistorycmn.o: $(srcdir)/src/common/filehistorycmn.cpp $(COREDLL_ODEP)
+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/filehistorycmn.cpp
+
@COND_USE_GUI_1@coredll_filepickercmn.o: $(srcdir)/src/common/filepickercmn.cpp $(COREDLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/filepickercmn.cpp
@@ -32445,6 +32463,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
@COND_USE_GUI_1@corelib_filectrlcmn.o: $(srcdir)/src/common/filectrlcmn.cpp $(CORELIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/filectrlcmn.cpp
+@COND_USE_GUI_1@corelib_filehistorycmn.o: $(srcdir)/src/common/filehistorycmn.cpp $(CORELIB_ODEP)
+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/filehistorycmn.cpp
+
@COND_USE_GUI_1@corelib_filepickercmn.o: $(srcdir)/src/common/filepickercmn.cpp $(CORELIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/filepickercmn.cpp
diff --git a/aclocal.m4 b/aclocal.m4
index 8e2f54a28a..0cefab11b7 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10 -*- Autoconf -*-
+# generated automatically by aclocal 1.10.3 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006 Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl
index 062ab7ea0b..dd96e0fd04 100644
--- a/build/bakefiles/files.bkl
+++ b/build/bakefiles/files.bkl
@@ -668,6 +668,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/common/effects.cpp
src/common/fddlgcmn.cpp
src/common/filectrlcmn.cpp
+ src/common/filehistorycmn.cpp
src/common/filepickercmn.cpp
src/common/fontpickercmn.cpp
src/common/fldlgcmn.cpp
@@ -905,6 +906,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/evtloopsrc.h
wx/fdrepdlg.h
wx/filectrl.h
+ wx/filehistory.h
wx/filepicker.h
wx/fontpicker.h
wx/fmappriv.h
diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc
index 46606ca5a6..464d370247 100644
--- a/build/msw/makefile.bcc
+++ b/build/msw/makefile.bcc
@@ -1800,6 +1800,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_effects.obj \
$(OBJS)\monodll_fddlgcmn.obj \
$(OBJS)\monodll_filectrlcmn.obj \
+ $(OBJS)\monodll_filehistorycmn.obj \
$(OBJS)\monodll_filepickercmn.obj \
$(OBJS)\monodll_fontpickercmn.obj \
$(OBJS)\monodll_fldlgcmn.obj \
@@ -2044,6 +2045,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_effects.obj \
$(OBJS)\monodll_fddlgcmn.obj \
$(OBJS)\monodll_filectrlcmn.obj \
+ $(OBJS)\monodll_filehistorycmn.obj \
$(OBJS)\monodll_filepickercmn.obj \
$(OBJS)\monodll_fontpickercmn.obj \
$(OBJS)\monodll_fldlgcmn.obj \
@@ -2505,6 +2507,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_effects.obj \
$(OBJS)\monolib_fddlgcmn.obj \
$(OBJS)\monolib_filectrlcmn.obj \
+ $(OBJS)\monolib_filehistorycmn.obj \
$(OBJS)\monolib_filepickercmn.obj \
$(OBJS)\monolib_fontpickercmn.obj \
$(OBJS)\monolib_fldlgcmn.obj \
@@ -2749,6 +2752,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_effects.obj \
$(OBJS)\monolib_fddlgcmn.obj \
$(OBJS)\monolib_filectrlcmn.obj \
+ $(OBJS)\monolib_filehistorycmn.obj \
$(OBJS)\monolib_filepickercmn.obj \
$(OBJS)\monolib_fontpickercmn.obj \
$(OBJS)\monolib_fldlgcmn.obj \
@@ -3103,6 +3107,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_effects.obj \
$(OBJS)\coredll_fddlgcmn.obj \
$(OBJS)\coredll_filectrlcmn.obj \
+ $(OBJS)\coredll_filehistorycmn.obj \
$(OBJS)\coredll_filepickercmn.obj \
$(OBJS)\coredll_fontpickercmn.obj \
$(OBJS)\coredll_fldlgcmn.obj \
@@ -3347,6 +3352,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_effects.obj \
$(OBJS)\coredll_fddlgcmn.obj \
$(OBJS)\coredll_filectrlcmn.obj \
+ $(OBJS)\coredll_filehistorycmn.obj \
$(OBJS)\coredll_filepickercmn.obj \
$(OBJS)\coredll_fontpickercmn.obj \
$(OBJS)\coredll_fldlgcmn.obj \
@@ -3597,6 +3603,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_effects.obj \
$(OBJS)\corelib_fddlgcmn.obj \
$(OBJS)\corelib_filectrlcmn.obj \
+ $(OBJS)\corelib_filehistorycmn.obj \
$(OBJS)\corelib_filepickercmn.obj \
$(OBJS)\corelib_fontpickercmn.obj \
$(OBJS)\corelib_fldlgcmn.obj \
@@ -3841,6 +3848,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_effects.obj \
$(OBJS)\corelib_fddlgcmn.obj \
$(OBJS)\corelib_filectrlcmn.obj \
+ $(OBJS)\corelib_filehistorycmn.obj \
$(OBJS)\corelib_filepickercmn.obj \
$(OBJS)\corelib_fontpickercmn.obj \
$(OBJS)\corelib_fldlgcmn.obj \
@@ -7185,6 +7193,11 @@ $(OBJS)\monodll_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\filectrlcmn.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_filehistorycmn.obj: ..\..\src\common\filehistorycmn.cpp
+ $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\filehistorycmn.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\common\filepickercmn.cpp
@@ -9381,6 +9394,11 @@ $(OBJS)\monolib_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\filectrlcmn.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_filehistorycmn.obj: ..\..\src\common\filehistorycmn.cpp
+ $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\filehistorycmn.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\filepickercmn.cpp
@@ -11586,6 +11604,11 @@ $(OBJS)\coredll_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\common\filectrlcmn.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_filehistorycmn.obj: ..\..\src\common\filehistorycmn.cpp
+ $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\common\filehistorycmn.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\common\filepickercmn.cpp
@@ -12873,6 +12896,11 @@ $(OBJS)\corelib_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\common\filectrlcmn.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_filehistorycmn.obj: ..\..\src\common\filehistorycmn.cpp
+ $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\common\filehistorycmn.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\common\filepickercmn.cpp
diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc
index 372d0d4ded..43b72a1402 100644
--- a/build/msw/makefile.gcc
+++ b/build/msw/makefile.gcc
@@ -1810,6 +1810,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_effects.o \
$(OBJS)\monodll_fddlgcmn.o \
$(OBJS)\monodll_filectrlcmn.o \
+ $(OBJS)\monodll_filehistorycmn.o \
$(OBJS)\monodll_filepickercmn.o \
$(OBJS)\monodll_fontpickercmn.o \
$(OBJS)\monodll_fldlgcmn.o \
@@ -2056,6 +2057,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_effects.o \
$(OBJS)\monodll_fddlgcmn.o \
$(OBJS)\monodll_filectrlcmn.o \
+ $(OBJS)\monodll_filehistorycmn.o \
$(OBJS)\monodll_filepickercmn.o \
$(OBJS)\monodll_fontpickercmn.o \
$(OBJS)\monodll_fldlgcmn.o \
@@ -2521,6 +2523,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_effects.o \
$(OBJS)\monolib_fddlgcmn.o \
$(OBJS)\monolib_filectrlcmn.o \
+ $(OBJS)\monolib_filehistorycmn.o \
$(OBJS)\monolib_filepickercmn.o \
$(OBJS)\monolib_fontpickercmn.o \
$(OBJS)\monolib_fldlgcmn.o \
@@ -2767,6 +2770,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_effects.o \
$(OBJS)\monolib_fddlgcmn.o \
$(OBJS)\monolib_filectrlcmn.o \
+ $(OBJS)\monolib_filehistorycmn.o \
$(OBJS)\monolib_filepickercmn.o \
$(OBJS)\monolib_fontpickercmn.o \
$(OBJS)\monolib_fldlgcmn.o \
@@ -3135,6 +3139,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_effects.o \
$(OBJS)\coredll_fddlgcmn.o \
$(OBJS)\coredll_filectrlcmn.o \
+ $(OBJS)\coredll_filehistorycmn.o \
$(OBJS)\coredll_filepickercmn.o \
$(OBJS)\coredll_fontpickercmn.o \
$(OBJS)\coredll_fldlgcmn.o \
@@ -3381,6 +3386,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_effects.o \
$(OBJS)\coredll_fddlgcmn.o \
$(OBJS)\coredll_filectrlcmn.o \
+ $(OBJS)\coredll_filehistorycmn.o \
$(OBJS)\coredll_filepickercmn.o \
$(OBJS)\coredll_fontpickercmn.o \
$(OBJS)\coredll_fldlgcmn.o \
@@ -3637,6 +3643,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_effects.o \
$(OBJS)\corelib_fddlgcmn.o \
$(OBJS)\corelib_filectrlcmn.o \
+ $(OBJS)\corelib_filehistorycmn.o \
$(OBJS)\corelib_filepickercmn.o \
$(OBJS)\corelib_fontpickercmn.o \
$(OBJS)\corelib_fldlgcmn.o \
@@ -3883,6 +3890,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_effects.o \
$(OBJS)\corelib_fddlgcmn.o \
$(OBJS)\corelib_filectrlcmn.o \
+ $(OBJS)\corelib_filehistorycmn.o \
$(OBJS)\corelib_filepickercmn.o \
$(OBJS)\corelib_fontpickercmn.o \
$(OBJS)\corelib_fldlgcmn.o \
@@ -7334,6 +7342,11 @@ $(OBJS)\monodll_filectrlcmn.o: ../../src/common/filectrlcmn.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\monodll_filehistorycmn.o: ../../src/common/filehistorycmn.cpp
+ $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_filepickercmn.o: ../../src/common/filepickercmn.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@@ -9530,6 +9543,11 @@ $(OBJS)\monolib_filectrlcmn.o: ../../src/common/filectrlcmn.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\monolib_filehistorycmn.o: ../../src/common/filehistorycmn.cpp
+ $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_filepickercmn.o: ../../src/common/filepickercmn.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -11735,6 +11753,11 @@ $(OBJS)\coredll_filectrlcmn.o: ../../src/common/filectrlcmn.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\coredll_filehistorycmn.o: ../../src/common/filehistorycmn.cpp
+ $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_filepickercmn.o: ../../src/common/filepickercmn.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -13022,6 +13045,11 @@ $(OBJS)\corelib_filectrlcmn.o: ../../src/common/filectrlcmn.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\corelib_filehistorycmn.o: ../../src/common/filehistorycmn.cpp
+ $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_filepickercmn.o: ../../src/common/filepickercmn.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc
index d5a3b59071..5d0440076b 100644
--- a/build/msw/makefile.vc
+++ b/build/msw/makefile.vc
@@ -2008,6 +2008,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_effects.obj \
$(OBJS)\monodll_fddlgcmn.obj \
$(OBJS)\monodll_filectrlcmn.obj \
+ $(OBJS)\monodll_filehistorycmn.obj \
$(OBJS)\monodll_filepickercmn.obj \
$(OBJS)\monodll_fontpickercmn.obj \
$(OBJS)\monodll_fldlgcmn.obj \
@@ -2252,6 +2253,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_effects.obj \
$(OBJS)\monodll_fddlgcmn.obj \
$(OBJS)\monodll_filectrlcmn.obj \
+ $(OBJS)\monodll_filehistorycmn.obj \
$(OBJS)\monodll_filepickercmn.obj \
$(OBJS)\monodll_fontpickercmn.obj \
$(OBJS)\monodll_fldlgcmn.obj \
@@ -2719,6 +2721,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_effects.obj \
$(OBJS)\monolib_fddlgcmn.obj \
$(OBJS)\monolib_filectrlcmn.obj \
+ $(OBJS)\monolib_filehistorycmn.obj \
$(OBJS)\monolib_filepickercmn.obj \
$(OBJS)\monolib_fontpickercmn.obj \
$(OBJS)\monolib_fldlgcmn.obj \
@@ -2963,6 +2966,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_effects.obj \
$(OBJS)\monolib_fddlgcmn.obj \
$(OBJS)\monolib_filectrlcmn.obj \
+ $(OBJS)\monolib_filehistorycmn.obj \
$(OBJS)\monolib_filepickercmn.obj \
$(OBJS)\monolib_fontpickercmn.obj \
$(OBJS)\monolib_fldlgcmn.obj \
@@ -3383,6 +3387,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_effects.obj \
$(OBJS)\coredll_fddlgcmn.obj \
$(OBJS)\coredll_filectrlcmn.obj \
+ $(OBJS)\coredll_filehistorycmn.obj \
$(OBJS)\coredll_filepickercmn.obj \
$(OBJS)\coredll_fontpickercmn.obj \
$(OBJS)\coredll_fldlgcmn.obj \
@@ -3627,6 +3632,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_effects.obj \
$(OBJS)\coredll_fddlgcmn.obj \
$(OBJS)\coredll_filectrlcmn.obj \
+ $(OBJS)\coredll_filehistorycmn.obj \
$(OBJS)\coredll_filepickercmn.obj \
$(OBJS)\coredll_fontpickercmn.obj \
$(OBJS)\coredll_fldlgcmn.obj \
@@ -3883,6 +3889,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_effects.obj \
$(OBJS)\corelib_fddlgcmn.obj \
$(OBJS)\corelib_filectrlcmn.obj \
+ $(OBJS)\corelib_filehistorycmn.obj \
$(OBJS)\corelib_filepickercmn.obj \
$(OBJS)\corelib_fontpickercmn.obj \
$(OBJS)\corelib_fldlgcmn.obj \
@@ -4127,6 +4134,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_effects.obj \
$(OBJS)\corelib_fddlgcmn.obj \
$(OBJS)\corelib_filectrlcmn.obj \
+ $(OBJS)\corelib_filehistorycmn.obj \
$(OBJS)\corelib_filepickercmn.obj \
$(OBJS)\corelib_fontpickercmn.obj \
$(OBJS)\corelib_fldlgcmn.obj \
@@ -7765,6 +7773,11 @@ $(OBJS)\monodll_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\filectrlcmn.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_filehistorycmn.obj: ..\..\src\common\filehistorycmn.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\filehistorycmn.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\filepickercmn.cpp
@@ -9961,6 +9974,11 @@ $(OBJS)\monolib_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\filectrlcmn.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_filehistorycmn.obj: ..\..\src\common\filehistorycmn.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\filehistorycmn.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\filepickercmn.cpp
@@ -12166,6 +12184,11 @@ $(OBJS)\coredll_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\common\filectrlcmn.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_filehistorycmn.obj: ..\..\src\common\filehistorycmn.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\common\filehistorycmn.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\common\filepickercmn.cpp
@@ -13453,6 +13476,11 @@ $(OBJS)\corelib_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\common\filectrlcmn.cpp
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_filehistorycmn.obj: ..\..\src\common\filehistorycmn.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\common\filehistorycmn.cpp
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\common\filepickercmn.cpp
diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat
index 8116672a87..931ba6fc53 100644
--- a/build/msw/makefile.wat
+++ b/build/msw/makefile.wat
@@ -372,6 +372,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = &
$(OBJS)\monodll_effects.obj &
$(OBJS)\monodll_fddlgcmn.obj &
$(OBJS)\monodll_filectrlcmn.obj &
+ $(OBJS)\monodll_filehistorycmn.obj &
$(OBJS)\monodll_filepickercmn.obj &
$(OBJS)\monodll_fontpickercmn.obj &
$(OBJS)\monodll_fldlgcmn.obj &
@@ -618,6 +619,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = &
$(OBJS)\monodll_effects.obj &
$(OBJS)\monodll_fddlgcmn.obj &
$(OBJS)\monodll_filectrlcmn.obj &
+ $(OBJS)\monodll_filehistorycmn.obj &
$(OBJS)\monodll_filepickercmn.obj &
$(OBJS)\monodll_fontpickercmn.obj &
$(OBJS)\monodll_fldlgcmn.obj &
@@ -1088,6 +1090,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = &
$(OBJS)\monolib_effects.obj &
$(OBJS)\monolib_fddlgcmn.obj &
$(OBJS)\monolib_filectrlcmn.obj &
+ $(OBJS)\monolib_filehistorycmn.obj &
$(OBJS)\monolib_filepickercmn.obj &
$(OBJS)\monolib_fontpickercmn.obj &
$(OBJS)\monolib_fldlgcmn.obj &
@@ -1334,6 +1337,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = &
$(OBJS)\monolib_effects.obj &
$(OBJS)\monolib_fddlgcmn.obj &
$(OBJS)\monolib_filectrlcmn.obj &
+ $(OBJS)\monolib_filehistorycmn.obj &
$(OBJS)\monolib_filepickercmn.obj &
$(OBJS)\monolib_fontpickercmn.obj &
$(OBJS)\monolib_fldlgcmn.obj &
@@ -1713,6 +1717,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = &
$(OBJS)\coredll_effects.obj &
$(OBJS)\coredll_fddlgcmn.obj &
$(OBJS)\coredll_filectrlcmn.obj &
+ $(OBJS)\coredll_filehistorycmn.obj &
$(OBJS)\coredll_filepickercmn.obj &
$(OBJS)\coredll_fontpickercmn.obj &
$(OBJS)\coredll_fldlgcmn.obj &
@@ -1959,6 +1964,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = &
$(OBJS)\coredll_effects.obj &
$(OBJS)\coredll_fddlgcmn.obj &
$(OBJS)\coredll_filectrlcmn.obj &
+ $(OBJS)\coredll_filehistorycmn.obj &
$(OBJS)\coredll_filepickercmn.obj &
$(OBJS)\coredll_fontpickercmn.obj &
$(OBJS)\coredll_fldlgcmn.obj &
@@ -2217,6 +2223,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = &
$(OBJS)\corelib_effects.obj &
$(OBJS)\corelib_fddlgcmn.obj &
$(OBJS)\corelib_filectrlcmn.obj &
+ $(OBJS)\corelib_filehistorycmn.obj &
$(OBJS)\corelib_filepickercmn.obj &
$(OBJS)\corelib_fontpickercmn.obj &
$(OBJS)\corelib_fldlgcmn.obj &
@@ -2463,6 +2470,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = &
$(OBJS)\corelib_effects.obj &
$(OBJS)\corelib_fddlgcmn.obj &
$(OBJS)\corelib_filectrlcmn.obj &
+ $(OBJS)\corelib_filehistorycmn.obj &
$(OBJS)\corelib_filepickercmn.obj &
$(OBJS)\corelib_fontpickercmn.obj &
$(OBJS)\corelib_fldlgcmn.obj &
@@ -7592,6 +7600,11 @@ $(OBJS)\monodll_filectrlcmn.obj : .AUTODEPEND ..\..\src\common\filectrlcmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
!endif
+!ifeq USE_GUI 1
+$(OBJS)\monodll_filehistorycmn.obj : .AUTODEPEND ..\..\src\common\filehistorycmn.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
+!endif
+
!ifeq USE_GUI 1
$(OBJS)\monodll_filepickercmn.obj : .AUTODEPEND ..\..\src\common\filepickercmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
@@ -9788,6 +9801,11 @@ $(OBJS)\monolib_filectrlcmn.obj : .AUTODEPEND ..\..\src\common\filectrlcmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
!endif
+!ifeq USE_GUI 1
+$(OBJS)\monolib_filehistorycmn.obj : .AUTODEPEND ..\..\src\common\filehistorycmn.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
+!endif
+
!ifeq USE_GUI 1
$(OBJS)\monolib_filepickercmn.obj : .AUTODEPEND ..\..\src\common\filepickercmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
@@ -11993,6 +12011,11 @@ $(OBJS)\coredll_filectrlcmn.obj : .AUTODEPEND ..\..\src\common\filectrlcmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
!endif
+!ifeq USE_GUI 1
+$(OBJS)\coredll_filehistorycmn.obj : .AUTODEPEND ..\..\src\common\filehistorycmn.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
+!endif
+
!ifeq USE_GUI 1
$(OBJS)\coredll_filepickercmn.obj : .AUTODEPEND ..\..\src\common\filepickercmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
@@ -13280,6 +13303,11 @@ $(OBJS)\corelib_filectrlcmn.obj : .AUTODEPEND ..\..\src\common\filectrlcmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
!endif
+!ifeq USE_GUI 1
+$(OBJS)\corelib_filehistorycmn.obj : .AUTODEPEND ..\..\src\common\filehistorycmn.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
+!endif
+
!ifeq USE_GUI 1
$(OBJS)\corelib_filepickercmn.obj : .AUTODEPEND ..\..\src\common\filepickercmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp
index c9a1a0ce21..6fb98417bd 100644
--- a/build/msw/wx_core.dsp
+++ b/build/msw/wx_core.dsp
@@ -398,6 +398,10 @@ SOURCE=..\..\src\common\filectrlcmn.cpp
# End Source File
# Begin Source File
+SOURCE=..\..\src\common\filehistorycmn.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\src\common\filepickercmn.cpp
# End Source File
# Begin Source File
@@ -6022,6 +6026,10 @@ SOURCE=..\..\include\wx\filedlg.h
# End Source File
# Begin Source File
+SOURCE=..\..\include\wx\filehistory.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\wx\filepicker.h
# End Source File
# Begin Source File
diff --git a/build/msw/wx_vc7_core.vcproj b/build/msw/wx_vc7_core.vcproj
index 39dbaf7ec9..37ff331afc 100644
--- a/build/msw/wx_vc7_core.vcproj
+++ b/build/msw/wx_vc7_core.vcproj
@@ -690,6 +690,9 @@
+
+
@@ -5122,6 +5125,9 @@
+
+
diff --git a/build/msw/wx_vc8_core.vcproj b/build/msw/wx_vc8_core.vcproj
index 7a01bfb23f..7d3946603d 100644
--- a/build/msw/wx_vc8_core.vcproj
+++ b/build/msw/wx_vc8_core.vcproj
@@ -954,6 +954,10 @@
RelativePath="..\..\src\common\filectrlcmn.cpp"
>
+
+
@@ -6847,6 +6851,10 @@
RelativePath="..\..\include\wx\filedlg.h"
>
+
+
diff --git a/build/msw/wx_vc9_core.vcproj b/build/msw/wx_vc9_core.vcproj
index a66bbc59cf..f509727aba 100644
--- a/build/msw/wx_vc9_core.vcproj
+++ b/build/msw/wx_vc9_core.vcproj
@@ -950,6 +950,10 @@
RelativePath="..\..\src\common\filectrlcmn.cpp"
>
+
+
@@ -6843,6 +6847,10 @@
RelativePath="..\..\include\wx\filedlg.h"
>
+
+
diff --git a/configure b/configure
index f2978cb345..4165801b8a 100755
--- a/configure
+++ b/configure
@@ -1736,6 +1736,7 @@ Optional Features:
--enable-exceptions build exception-safe library
--enable-ffile use wxFFile class
--enable-file use wxFile class
+ --enable-filehistory use wxFileHistory class
--enable-filesystem use virtual file systems classes
--enable-fontenum use wxFontEnumerator class
--enable-fontmap use font encodings conversion classes
@@ -7014,6 +7015,50 @@ fi
echo "${ECHO_T}$result" >&6; }
+ enablestring=
+ defaultval=$wxUSE_ALL_FEATURES
+ if test -z "$defaultval"; then
+ if test x"$enablestring" = xdisable; then
+ defaultval=yes
+ else
+ defaultval=no
+ fi
+ fi
+
+ { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-filehistory" >&5
+echo $ECHO_N "checking for --${enablestring:-enable}-filehistory... $ECHO_C" >&6; }
+ # Check whether --enable-filehistory was given.
+if test "${enable_filehistory+set}" = set; then
+ enableval=$enable_filehistory;
+ if test "$enableval" = yes; then
+ wx_cv_use_filehistory='wxUSE_FILE_HISTORY=yes'
+ else
+ wx_cv_use_filehistory='wxUSE_FILE_HISTORY=no'
+ fi
+
+else
+
+ wx_cv_use_filehistory='wxUSE_FILE_HISTORY=${'DEFAULT_wxUSE_FILE_HISTORY":-$defaultval}"
+
+fi
+
+
+ eval "$wx_cv_use_filehistory"
+
+ if test x"$enablestring" = xdisable; then
+ if test $wxUSE_FILE_HISTORY = no; then
+ result=yes
+ else
+ result=no
+ fi
+ else
+ result=$wxUSE_FILE_HISTORY
+ fi
+
+ { echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6; }
+
+
enablestring=
defaultval=$wxUSE_ALL_FEATURES
if test -z "$defaultval"; then
@@ -44100,6 +44145,13 @@ _ACEOF
fi
fi
+if test "$wxUSE_FILE_HISTORY" = "yes"; then
+ cat >>confdefs.h <<\_ACEOF
+#define wxUSE_FILE_HISTORY 1
+_ACEOF
+
+fi
+
if test "$wxUSE_FILESYSTEM" = "yes"; then
if test "$wxUSE_STREAMS" != yes -o \( "$wxUSE_FILE" != yes -a "$wxUSE_FFILE" != yes \); then
{ echo "$as_me:$LINENO: WARNING: wxFileSystem requires wxStreams and wxFile or wxFFile... disabled" >&5
diff --git a/configure.in b/configure.in
index 70aa4f4e09..edbde026bb 100644
--- a/configure.in
+++ b/configure.in
@@ -767,6 +767,7 @@ WX_ARG_FEATURE(dynamicloader, [ --enable-dynamicloader use (new) wxDynamicLibr
WX_ARG_FEATURE(exceptions, [ --enable-exceptions build exception-safe library], wxUSE_EXCEPTIONS)
WX_ARG_FEATURE(ffile, [ --enable-ffile use wxFFile class], wxUSE_FFILE)
WX_ARG_FEATURE(file, [ --enable-file use wxFile class], wxUSE_FILE)
+WX_ARG_FEATURE(filehistory, [ --enable-filehistory use wxFileHistory class], wxUSE_FILE_HISTORY)
WX_ARG_FEATURE(filesystem, [ --enable-filesystem use virtual file systems classes], wxUSE_FILESYSTEM)
WX_ARG_FEATURE(fontenum, [ --enable-fontenum use wxFontEnumerator class], wxUSE_FONTENUM)
WX_ARG_FEATURE(fontmap, [ --enable-fontmap use font encodings conversion classes], wxUSE_FONTMAP)
@@ -5893,6 +5894,10 @@ if test "$wxUSE_TARSTREAM" = "yes"; then
fi
fi
+if test "$wxUSE_FILE_HISTORY" = "yes"; then
+ AC_DEFINE(wxUSE_FILE_HISTORY)
+fi
+
if test "$wxUSE_FILESYSTEM" = "yes"; then
if test "$wxUSE_STREAMS" != yes -o \( "$wxUSE_FILE" != yes -a "$wxUSE_FFILE" != yes \); then
AC_MSG_WARN(wxFileSystem requires wxStreams and wxFile or wxFFile... disabled)
diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h
index 54c0c112fd..a7451822f1 100644
--- a/include/wx/chkconf.h
+++ b/include/wx/chkconf.h
@@ -1804,6 +1804,15 @@
# define wxUSE_STREAMS 1
# endif
# endif
+
+# if !wxUSE_FILE_HISTORY
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "DocView requires wxUSE_FILE_HISTORY"
+# else
+# undef wxUSE_FILE_HISTORY
+# define wxUSE_FILE_HISTORY 1
+# endif
+# endif
#endif /* wxUSE_DOC_VIEW_ARCHITECTURE */
#if wxUSE_PRINTING_ARCHITECTURE
diff --git a/include/wx/docview.h b/include/wx/docview.h
index f921f9b504..6f678c9b29 100644
--- a/include/wx/docview.h
+++ b/include/wx/docview.h
@@ -19,6 +19,7 @@
#include "wx/list.h"
#include "wx/string.h"
#include "wx/frame.h"
+#include "wx/filehistory.h"
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/print.h"
@@ -31,7 +32,6 @@ class WXDLLIMPEXP_FWD_CORE wxDocTemplate;
class WXDLLIMPEXP_FWD_CORE wxDocManager;
class WXDLLIMPEXP_FWD_CORE wxPrintInfo;
class WXDLLIMPEXP_FWD_CORE wxCommandProcessor;
-class WXDLLIMPEXP_FWD_CORE wxFileHistory;
class WXDLLIMPEXP_FWD_BASE wxConfigBase;
class wxDocChildFrameAnyBase;
@@ -828,72 +828,6 @@ private:
};
#endif // wxUSE_PRINTING_ARCHITECTURE
-// ----------------------------------------------------------------------------
-// File history management
-// ----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_CORE wxFileHistory : public wxObject
-{
-public:
- wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1);
-
- // Operations
- virtual void AddFileToHistory(const wxString& file);
- virtual void RemoveFileFromHistory(size_t i);
- virtual int GetMaxFiles() const { return (int)m_fileMaxFiles; }
- virtual void UseMenu(wxMenu *menu);
-
- // Remove menu from the list (MDI child may be closing)
- virtual void RemoveMenu(wxMenu *menu);
-
-#if wxUSE_CONFIG
- virtual void Load(const wxConfigBase& config);
- virtual void Save(wxConfigBase& config);
-#endif // wxUSE_CONFIG
-
- virtual void AddFilesToMenu();
- virtual void AddFilesToMenu(wxMenu* menu); // Single menu
-
- // Accessors
- virtual wxString GetHistoryFile(size_t i) const { return m_fileHistory[i]; }
- virtual size_t GetCount() const { return m_fileHistory.GetCount(); }
-
- const wxList& GetMenus() const { return m_fileMenus; }
-
- // Set/get base id
- void SetBaseId(wxWindowID baseId) { m_idBase = baseId; }
- wxWindowID GetBaseId() const { return m_idBase; }
-
-#if WXWIN_COMPATIBILITY_2_6
- // deprecated, use GetCount() instead
- wxDEPRECATED( size_t GetNoHistoryFiles() const );
-#endif // WXWIN_COMPATIBILITY_2_6
-
-protected:
- // Last n files
- wxArrayString m_fileHistory;
-
- // Menus to maintain (may need several for an MDI app)
- wxList m_fileMenus;
-
- // Max files to maintain
- size_t m_fileMaxFiles;
-
-private:
- // The ID of the first history menu item (Doesn't have to be wxID_FILE1)
- wxWindowID m_idBase;
-
- DECLARE_DYNAMIC_CLASS(wxFileHistory)
- wxDECLARE_NO_COPY_CLASS(wxFileHistory);
-};
-
-#if WXWIN_COMPATIBILITY_2_6
-inline size_t wxFileHistory::GetNoHistoryFiles() const
-{
- return m_fileHistory.GetCount();
-}
-#endif // WXWIN_COMPATIBILITY_2_6
-
// For compatibility with existing file formats:
// converts from/to a stream to/from a temporary file.
#if wxUSE_STD_IOSTREAM
diff --git a/include/wx/filehistory.h b/include/wx/filehistory.h
new file mode 100644
index 0000000000..2d86e064fb
--- /dev/null
+++ b/include/wx/filehistory.h
@@ -0,0 +1,95 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/filehistory.h
+// Purpose: wxFileHistory class
+// Author: Julian Smart, Vaclav Slavik
+// Created: 2010-05-03
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart, Vaclav Slavik
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FILEHISTORY_H_
+#define _WX_FILEHISTORY_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FILE_HISTORY
+
+#include "wx/windowid.h"
+#include "wx/object.h"
+#include "wx/list.h"
+#include "wx/string.h"
+#include "wx/arrstr.h"
+
+class WXDLLIMPEXP_FWD_CORE wxMenu;
+class WXDLLIMPEXP_FWD_BASE wxConfigBase;
+
+// ----------------------------------------------------------------------------
+// File history management
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxFileHistory : public wxObject
+{
+public:
+ wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1);
+
+ // Operations
+ virtual void AddFileToHistory(const wxString& file);
+ virtual void RemoveFileFromHistory(size_t i);
+ virtual int GetMaxFiles() const { return (int)m_fileMaxFiles; }
+ virtual void UseMenu(wxMenu *menu);
+
+ // Remove menu from the list (MDI child may be closing)
+ virtual void RemoveMenu(wxMenu *menu);
+
+#if wxUSE_CONFIG
+ virtual void Load(const wxConfigBase& config);
+ virtual void Save(wxConfigBase& config);
+#endif // wxUSE_CONFIG
+
+ virtual void AddFilesToMenu();
+ virtual void AddFilesToMenu(wxMenu* menu); // Single menu
+
+ // Accessors
+ virtual wxString GetHistoryFile(size_t i) const { return m_fileHistory[i]; }
+ virtual size_t GetCount() const { return m_fileHistory.GetCount(); }
+
+ const wxList& GetMenus() const { return m_fileMenus; }
+
+ // Set/get base id
+ void SetBaseId(wxWindowID baseId) { m_idBase = baseId; }
+ wxWindowID GetBaseId() const { return m_idBase; }
+
+#if WXWIN_COMPATIBILITY_2_6
+ // deprecated, use GetCount() instead
+ wxDEPRECATED( size_t GetNoHistoryFiles() const );
+#endif // WXWIN_COMPATIBILITY_2_6
+
+protected:
+ // Last n files
+ wxArrayString m_fileHistory;
+
+ // Menus to maintain (may need several for an MDI app)
+ wxList m_fileMenus;
+
+ // Max files to maintain
+ size_t m_fileMaxFiles;
+
+private:
+ // The ID of the first history menu item (Doesn't have to be wxID_FILE1)
+ wxWindowID m_idBase;
+
+ DECLARE_DYNAMIC_CLASS(wxFileHistory)
+ wxDECLARE_NO_COPY_CLASS(wxFileHistory);
+};
+
+#if WXWIN_COMPATIBILITY_2_6
+inline size_t wxFileHistory::GetNoHistoryFiles() const
+{
+ return m_fileHistory.GetCount();
+}
+#endif // WXWIN_COMPATIBILITY_2_6
+
+#endif // wxUSE_FILE_HISTORY
+
+#endif // _WX_FILEHISTORY_H_
diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h
index c035b658fa..c0b6859ddf 100644
--- a/include/wx/motif/setup0.h
+++ b/include/wx/motif/setup0.h
@@ -1083,6 +1083,13 @@
// use this function
#define wxUSE_ABOUTDLG 1
+// wxFileHistory class
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_FILE_HISTORY 1
+
// ----------------------------------------------------------------------------
// Metafiles support
// ----------------------------------------------------------------------------
diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h
index 924ef6f98e..c43c311be5 100644
--- a/include/wx/msw/setup0.h
+++ b/include/wx/msw/setup0.h
@@ -1083,6 +1083,13 @@
// use this function
#define wxUSE_ABOUTDLG 1
+// wxFileHistory class
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_FILE_HISTORY 1
+
// ----------------------------------------------------------------------------
// Metafiles support
// ----------------------------------------------------------------------------
diff --git a/include/wx/msw/wince/setup.h b/include/wx/msw/wince/setup.h
index 880ac1c5cf..1051aa20ba 100644
--- a/include/wx/msw/wince/setup.h
+++ b/include/wx/msw/wince/setup.h
@@ -1083,6 +1083,13 @@
// use this function
#define wxUSE_ABOUTDLG 1
+// wxFileHistory class
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_FILE_HISTORY 1
+
// ----------------------------------------------------------------------------
// Metafiles support
// ----------------------------------------------------------------------------
diff --git a/include/wx/os2/setup0.h b/include/wx/os2/setup0.h
index 0e38cfa189..8631562b17 100644
--- a/include/wx/os2/setup0.h
+++ b/include/wx/os2/setup0.h
@@ -1083,6 +1083,13 @@
// use this function
#define wxUSE_ABOUTDLG 1
+// wxFileHistory class
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_FILE_HISTORY 1
+
// ----------------------------------------------------------------------------
// Metafiles support
// ----------------------------------------------------------------------------
diff --git a/include/wx/osx/setup0.h b/include/wx/osx/setup0.h
index 97f4709ce6..e729456b09 100644
--- a/include/wx/osx/setup0.h
+++ b/include/wx/osx/setup0.h
@@ -1084,6 +1084,13 @@
// use this function
#define wxUSE_ABOUTDLG 1
+// wxFileHistory class
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_FILE_HISTORY 1
+
// ----------------------------------------------------------------------------
// Metafiles support
// ----------------------------------------------------------------------------
diff --git a/include/wx/palmos/setup0.h b/include/wx/palmos/setup0.h
index 71f12caea4..9199976d6d 100644
--- a/include/wx/palmos/setup0.h
+++ b/include/wx/palmos/setup0.h
@@ -1083,6 +1083,13 @@
// use this function
#define wxUSE_ABOUTDLG 1
+// wxFileHistory class
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_FILE_HISTORY 1
+
// ----------------------------------------------------------------------------
// Metafiles support
// ----------------------------------------------------------------------------
diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h
index 147f226c2e..a043c93e51 100644
--- a/include/wx/setup_inc.h
+++ b/include/wx/setup_inc.h
@@ -1079,6 +1079,13 @@
// use this function
#define wxUSE_ABOUTDLG 1
+// wxFileHistory class
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_FILE_HISTORY 1
+
// ----------------------------------------------------------------------------
// Metafiles support
// ----------------------------------------------------------------------------
diff --git a/include/wx/univ/setup0.h b/include/wx/univ/setup0.h
index d42ad35528..3e2c207de9 100644
--- a/include/wx/univ/setup0.h
+++ b/include/wx/univ/setup0.h
@@ -1082,6 +1082,13 @@
// use this function
#define wxUSE_ABOUTDLG 1
+// wxFileHistory class
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_FILE_HISTORY 1
+
// ----------------------------------------------------------------------------
// Metafiles support
// ----------------------------------------------------------------------------
diff --git a/interface/wx/docview.h b/interface/wx/docview.h
index d7f4448754..4dd49c4be8 100644
--- a/interface/wx/docview.h
+++ b/interface/wx/docview.h
@@ -1501,126 +1501,6 @@ protected:
};
-
-/**
- @class wxFileHistory
-
- The wxFileHistory encapsulates a user interface convenience, the list of
- most recently visited files as shown on a menu (usually the File menu).
-
- wxFileHistory can manage one or more file menus. More than one menu may be
- required in an MDI application, where the file history should appear on
- each MDI child menu as well as the MDI parent frame.
-
- @library{wxcore}
- @category{docview}
-
- @see @ref overview_docview, wxDocManager
-*/
-class wxFileHistory : public wxObject
-{
-public:
- /**
- Constructor. Pass the maximum number of files that should be stored and
- displayed.
-
- @a idBase defaults to wxID_FILE1 and represents the id given to the
- first history menu item. Since menu items can't share the same ID you
- should change @a idBase (to one of your own defined IDs) when using
- more than one wxFileHistory in your application.
- */
- wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1);
-
- /**
- Destructor.
- */
- virtual ~wxFileHistory();
-
- /**
- Adds a file to the file history list, if the object has a pointer to an
- appropriate file menu.
- */
- virtual void AddFileToHistory(const wxString& filename);
-
- /**
- Appends the files in the history list, to all menus managed by the file
- history object.
- */
- virtual void AddFilesToMenu();
- /**
- Appends the files in the history list, to the given menu only.
- */
- virtual void AddFilesToMenu(wxMenu* menu);
-
- /**
- Returns the base identifier for the range used for appending items.
- */
- wxWindowID GetBaseId() const;
-
- /**
- Returns the number of files currently stored in the file history.
- */
- virtual size_t GetCount() const;
-
- /**
- Returns the file at this index (zero-based).
- */
- virtual wxString GetHistoryFile(size_t index) const;
-
- /**
- Returns the maximum number of files that can be stored.
- */
- virtual int GetMaxFiles() const;
-
- /**
- Returns the list of menus that are managed by this file history object.
-
- @see UseMenu()
- */
- const wxList& GetMenus() const;
-
- /**
- Loads the file history from the given config object. This function
- should be called explicitly by the application.
-
- @see wxConfigBase
- */
- virtual void Load(const wxConfigBase& config);
-
- /**
- Removes the specified file from the history.
- */
- virtual void RemoveFileFromHistory(size_t i);
-
- /**
- Removes this menu from the list of those managed by this object.
- */
- virtual void RemoveMenu(wxMenu* menu);
-
- /**
- Saves the file history into the given config object. This must be
- called explicitly by the application.
-
- @see wxConfigBase
- */
- virtual void Save(wxConfigBase& config);
-
- /**
- Sets the base identifier for the range used for appending items.
- */
- void SetBaseId(wxWindowID baseId);
-
- /**
- Adds this menu to the list of those menus that are managed by this file
- history object. Also see AddFilesToMenu() for initializing the menu
- with filenames that are already in the history when this function is
- called, as this is not done automatically.
- */
- virtual void UseMenu(wxMenu* menu);
-};
-
-
-
// ============================================================================
// Global functions/macros
// ============================================================================
diff --git a/interface/wx/filehistory.h b/interface/wx/filehistory.h
new file mode 100644
index 0000000000..855e8c9e67
--- /dev/null
+++ b/interface/wx/filehistory.h
@@ -0,0 +1,124 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: filehistory.h
+// Purpose: wxFileHistory class
+// Author: wxWidgets team
+// RCS-ID: $Id$
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ @class wxFileHistory
+
+ The wxFileHistory encapsulates a user interface convenience, the list of
+ most recently visited files as shown on a menu (usually the File menu).
+
+ wxFileHistory can manage one or more file menus. More than one menu may be
+ required in an MDI application, where the file history should appear on
+ each MDI child menu as well as the MDI parent frame.
+
+ @library{wxcore}
+ @category{docview}
+
+ @see @ref overview_docview, wxDocManager
+*/
+class wxFileHistory : public wxObject
+{
+public:
+ /**
+ Constructor. Pass the maximum number of files that should be stored and
+ displayed.
+
+ @a idBase defaults to wxID_FILE1 and represents the id given to the
+ first history menu item. Since menu items can't share the same ID you
+ should change @a idBase (to one of your own defined IDs) when using
+ more than one wxFileHistory in your application.
+ */
+ wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1);
+
+ /**
+ Destructor.
+ */
+ virtual ~wxFileHistory();
+
+ /**
+ Adds a file to the file history list, if the object has a pointer to an
+ appropriate file menu.
+ */
+ virtual void AddFileToHistory(const wxString& filename);
+
+ /**
+ Appends the files in the history list, to all menus managed by the file
+ history object.
+ */
+ virtual void AddFilesToMenu();
+ /**
+ Appends the files in the history list, to the given menu only.
+ */
+ virtual void AddFilesToMenu(wxMenu* menu);
+
+ /**
+ Returns the base identifier for the range used for appending items.
+ */
+ wxWindowID GetBaseId() const;
+
+ /**
+ Returns the number of files currently stored in the file history.
+ */
+ virtual size_t GetCount() const;
+
+ /**
+ Returns the file at this index (zero-based).
+ */
+ virtual wxString GetHistoryFile(size_t index) const;
+
+ /**
+ Returns the maximum number of files that can be stored.
+ */
+ virtual int GetMaxFiles() const;
+
+ /**
+ Returns the list of menus that are managed by this file history object.
+
+ @see UseMenu()
+ */
+ const wxList& GetMenus() const;
+
+ /**
+ Loads the file history from the given config object. This function
+ should be called explicitly by the application.
+
+ @see wxConfigBase
+ */
+ virtual void Load(const wxConfigBase& config);
+
+ /**
+ Removes the specified file from the history.
+ */
+ virtual void RemoveFileFromHistory(size_t i);
+
+ /**
+ Removes this menu from the list of those managed by this object.
+ */
+ virtual void RemoveMenu(wxMenu* menu);
+
+ /**
+ Saves the file history into the given config object. This must be
+ called explicitly by the application.
+
+ @see wxConfigBase
+ */
+ virtual void Save(wxConfigBase& config);
+
+ /**
+ Sets the base identifier for the range used for appending items.
+ */
+ void SetBaseId(wxWindowID baseId);
+
+ /**
+ Adds this menu to the list of those menus that are managed by this file
+ history object. Also see AddFilesToMenu() for initializing the menu
+ with filenames that are already in the history when this function is
+ called, as this is not done automatically.
+ */
+ virtual void UseMenu(wxMenu* menu);
+};
diff --git a/setup.h.in b/setup.h.in
index 16aa2ae372..770c6fb9c2 100644
--- a/setup.h.in
+++ b/setup.h.in
@@ -485,6 +485,8 @@
#define wxUSE_ABOUTDLG 0
+#define wxUSE_FILE_HISTORY 0
+
#define wxUSE_METAFILE 0
#define wxUSE_ENH_METAFILE 0
diff --git a/src/common/docview.cpp b/src/common/docview.cpp
index 635a2529bb..64315afb60 100644
--- a/src/common/docview.cpp
+++ b/src/common/docview.cpp
@@ -92,8 +92,6 @@ IMPLEMENT_CLASS(wxDocParentFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout)
#endif
-IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject)
-
// ============================================================================
// implementation
// ============================================================================
@@ -115,18 +113,6 @@ wxString FindExtension(const wxString& path)
return ext.MakeLower();
}
-// return the string used for the MRU list items in the menu
-//
-// NB: the index n is 0-based, as usual, but the strings start from 1
-wxString GetMRUEntryLabel(int n, const wxString& path)
-{
- // we need to quote '&' characters which are used for mnemonics
- wxString pathInMenu(path);
- pathInMenu.Replace("&", "&&");
-
- return wxString::Format("&%d %s", n + 1, pathInMenu);
-}
-
} // anonymous namespace
// ----------------------------------------------------------------------------
@@ -2073,203 +2059,6 @@ void wxDocPrintout::GetPageInfo(int *minPage, int *maxPage,
#endif // wxUSE_PRINTING_ARCHITECTURE
-// ----------------------------------------------------------------------------
-// File history (a.k.a. MRU, most recently used, files list)
-// ----------------------------------------------------------------------------
-
-wxFileHistory::wxFileHistory(size_t maxFiles, wxWindowID idBase)
-{
- m_fileMaxFiles = maxFiles;
- m_idBase = idBase;
-}
-
-void wxFileHistory::AddFileToHistory(const wxString& file)
-{
- // check if we don't already have this file
- const wxFileName fnNew(file);
- size_t i,
- numFiles = m_fileHistory.size();
- for ( i = 0; i < numFiles; i++ )
- {
- if ( fnNew == m_fileHistory[i] )
- {
- // we do have it, move it to the top of the history
- RemoveFileFromHistory(i);
- numFiles--;
- break;
- }
- }
-
- // if we already have a full history, delete the one at the end
- if ( numFiles == m_fileMaxFiles )
- {
- RemoveFileFromHistory(--numFiles);
- }
-
- // add a new menu item to all file menus (they will be updated below)
- for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
- node;
- node = node->GetNext() )
- {
- wxMenu * const menu = (wxMenu *)node->GetData();
-
- if ( !numFiles && menu->GetMenuItemCount() )
- menu->AppendSeparator();
-
- // label doesn't matter, it will be set below anyhow, but it can't
- // be empty (this is supposed to indicate a stock item)
- menu->Append(m_idBase + numFiles, " ");
- }
-
- // insert the new file in the beginning of the file history
- m_fileHistory.insert(m_fileHistory.begin(), file);
- numFiles++;
-
- // update the labels in all menus
- for ( i = 0; i < numFiles; i++ )
- {
- // if in same directory just show the filename; otherwise the full path
- const wxFileName fnOld(m_fileHistory[i]);
-
- wxString pathInMenu;
- if ( fnOld.GetPath() == fnNew.GetPath() )
- {
- pathInMenu = fnOld.GetFullName();
- }
- else // file in different directory
- {
- // absolute path; could also set relative path
- pathInMenu = m_fileHistory[i];
- }
-
- for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
- node;
- node = node->GetNext() )
- {
- wxMenu * const menu = (wxMenu *)node->GetData();
-
- menu->SetLabel(m_idBase + i, GetMRUEntryLabel(i, pathInMenu));
- }
- }
-}
-
-void wxFileHistory::RemoveFileFromHistory(size_t i)
-{
- size_t numFiles = m_fileHistory.size();
- wxCHECK_RET( i < numFiles,
- wxT("invalid index in wxFileHistory::RemoveFileFromHistory") );
-
- // delete the element from the array
- m_fileHistory.RemoveAt(i);
- numFiles--;
-
- for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
- node;
- node = node->GetNext() )
- {
- wxMenu * const menu = (wxMenu *) node->GetData();
-
- // shift filenames up
- for ( size_t j = i; j < numFiles; j++ )
- {
- menu->SetLabel(m_idBase + j, GetMRUEntryLabel(j, m_fileHistory[j]));
- }
-
- // delete the last menu item which is unused now
- const wxWindowID lastItemId = m_idBase + numFiles;
- if ( menu->FindItem(lastItemId) )
- menu->Delete(lastItemId);
-
- // delete the last separator too if no more files are left
- if ( m_fileHistory.empty() )
- {
- const wxMenuItemList::compatibility_iterator
- nodeLast = menu->GetMenuItems().GetLast();
- if ( nodeLast )
- {
- wxMenuItem * const lastMenuItem = nodeLast->GetData();
- if ( lastMenuItem->IsSeparator() )
- menu->Delete(lastMenuItem);
- }
- //else: menu is empty somehow
- }
- }
-}
-
-void wxFileHistory::UseMenu(wxMenu *menu)
-{
- if ( !m_fileMenus.Member(menu) )
- m_fileMenus.Append(menu);
-}
-
-void wxFileHistory::RemoveMenu(wxMenu *menu)
-{
- m_fileMenus.DeleteObject(menu);
-}
-
-#if wxUSE_CONFIG
-void wxFileHistory::Load(const wxConfigBase& config)
-{
- m_fileHistory.Clear();
-
- wxString buf;
- buf.Printf(wxT("file%d"), 1);
-
- wxString historyFile;
- while ((m_fileHistory.GetCount() < m_fileMaxFiles) &&
- config.Read(buf, &historyFile) && !historyFile.empty())
- {
- m_fileHistory.Add(historyFile);
-
- buf.Printf(wxT("file%d"), (int)m_fileHistory.GetCount()+1);
- historyFile = wxEmptyString;
- }
-
- AddFilesToMenu();
-}
-
-void wxFileHistory::Save(wxConfigBase& config)
-{
- size_t i;
- for (i = 0; i < m_fileMaxFiles; i++)
- {
- wxString buf;
- buf.Printf(wxT("file%d"), (int)i+1);
- if (i < m_fileHistory.GetCount())
- config.Write(buf, wxString(m_fileHistory[i]));
- else
- config.Write(buf, wxEmptyString);
- }
-}
-#endif // wxUSE_CONFIG
-
-void wxFileHistory::AddFilesToMenu()
-{
- if ( m_fileHistory.empty() )
- return;
-
- for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
- node;
- node = node->GetNext() )
- {
- AddFilesToMenu((wxMenu *) node->GetData());
- }
-}
-
-void wxFileHistory::AddFilesToMenu(wxMenu* menu)
-{
- if ( m_fileHistory.empty() )
- return;
-
- if ( menu->GetMenuItemCount() )
- menu->AppendSeparator();
-
- for ( size_t i = 0; i < m_fileHistory.GetCount(); i++ )
- {
- menu->Append(m_idBase + i, GetMRUEntryLabel(i, m_fileHistory[i]));
- }
-}
-
// ----------------------------------------------------------------------------
// Permits compatibility with existing file formats and functions that
// manipulate files directly
diff --git a/src/common/filehistorycmn.cpp b/src/common/filehistorycmn.cpp
new file mode 100644
index 0000000000..59898ba52b
--- /dev/null
+++ b/src/common/filehistorycmn.cpp
@@ -0,0 +1,258 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: src/common/filehistorycmn.cpp
+// Purpose: wxFileHistory class
+// Author: Julian Smart, Vaclav Slavik, Vadim Zeitlin
+// Created: 2010-05-03
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart
+// 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/menu.h"
+#include "wx/confbase.h"
+#include "wx/filename.h"
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// private helpers
+// ----------------------------------------------------------------------------
+
+namespace
+{
+
+// return the string used for the MRU list items in the menu
+//
+// NB: the index n is 0-based, as usual, but the strings start from 1
+wxString GetMRUEntryLabel(int n, const wxString& path)
+{
+ // we need to quote '&' characters which are used for mnemonics
+ wxString pathInMenu(path);
+ pathInMenu.Replace("&", "&&");
+
+ return wxString::Format("&%d %s", n + 1, pathInMenu);
+}
+
+} // anonymous namespace
+
+// ----------------------------------------------------------------------------
+// File history (a.k.a. MRU, most recently used, files list)
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject)
+
+wxFileHistory::wxFileHistory(size_t maxFiles, wxWindowID idBase)
+{
+ m_fileMaxFiles = maxFiles;
+ m_idBase = idBase;
+}
+
+void wxFileHistory::AddFileToHistory(const wxString& file)
+{
+ // check if we don't already have this file
+ const wxFileName fnNew(file);
+ size_t i,
+ numFiles = m_fileHistory.size();
+ for ( i = 0; i < numFiles; i++ )
+ {
+ if ( fnNew == m_fileHistory[i] )
+ {
+ // we do have it, move it to the top of the history
+ RemoveFileFromHistory(i);
+ numFiles--;
+ break;
+ }
+ }
+
+ // if we already have a full history, delete the one at the end
+ if ( numFiles == m_fileMaxFiles )
+ {
+ RemoveFileFromHistory(--numFiles);
+ }
+
+ // add a new menu item to all file menus (they will be updated below)
+ for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxMenu * const menu = (wxMenu *)node->GetData();
+
+ if ( !numFiles && menu->GetMenuItemCount() )
+ menu->AppendSeparator();
+
+ // label doesn't matter, it will be set below anyhow, but it can't
+ // be empty (this is supposed to indicate a stock item)
+ menu->Append(m_idBase + numFiles, " ");
+ }
+
+ // insert the new file in the beginning of the file history
+ m_fileHistory.insert(m_fileHistory.begin(), file);
+ numFiles++;
+
+ // update the labels in all menus
+ for ( i = 0; i < numFiles; i++ )
+ {
+ // if in same directory just show the filename; otherwise the full path
+ const wxFileName fnOld(m_fileHistory[i]);
+
+ wxString pathInMenu;
+ if ( fnOld.GetPath() == fnNew.GetPath() )
+ {
+ pathInMenu = fnOld.GetFullName();
+ }
+ else // file in different directory
+ {
+ // absolute path; could also set relative path
+ pathInMenu = m_fileHistory[i];
+ }
+
+ for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxMenu * const menu = (wxMenu *)node->GetData();
+
+ menu->SetLabel(m_idBase + i, GetMRUEntryLabel(i, pathInMenu));
+ }
+ }
+}
+
+void wxFileHistory::RemoveFileFromHistory(size_t i)
+{
+ size_t numFiles = m_fileHistory.size();
+ wxCHECK_RET( i < numFiles,
+ wxT("invalid index in wxFileHistory::RemoveFileFromHistory") );
+
+ // delete the element from the array
+ m_fileHistory.RemoveAt(i);
+ numFiles--;
+
+ for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxMenu * const menu = (wxMenu *) node->GetData();
+
+ // shift filenames up
+ for ( size_t j = i; j < numFiles; j++ )
+ {
+ menu->SetLabel(m_idBase + j, GetMRUEntryLabel(j, m_fileHistory[j]));
+ }
+
+ // delete the last menu item which is unused now
+ const wxWindowID lastItemId = m_idBase + numFiles;
+ if ( menu->FindItem(lastItemId) )
+ menu->Delete(lastItemId);
+
+ // delete the last separator too if no more files are left
+ if ( m_fileHistory.empty() )
+ {
+ const wxMenuItemList::compatibility_iterator
+ nodeLast = menu->GetMenuItems().GetLast();
+ if ( nodeLast )
+ {
+ wxMenuItem * const lastMenuItem = nodeLast->GetData();
+ if ( lastMenuItem->IsSeparator() )
+ menu->Delete(lastMenuItem);
+ }
+ //else: menu is empty somehow
+ }
+ }
+}
+
+void wxFileHistory::UseMenu(wxMenu *menu)
+{
+ if ( !m_fileMenus.Member(menu) )
+ m_fileMenus.Append(menu);
+}
+
+void wxFileHistory::RemoveMenu(wxMenu *menu)
+{
+ m_fileMenus.DeleteObject(menu);
+}
+
+#if wxUSE_CONFIG
+void wxFileHistory::Load(const wxConfigBase& config)
+{
+ m_fileHistory.Clear();
+
+ wxString buf;
+ buf.Printf(wxT("file%d"), 1);
+
+ wxString historyFile;
+ while ((m_fileHistory.GetCount() < m_fileMaxFiles) &&
+ config.Read(buf, &historyFile) && !historyFile.empty())
+ {
+ m_fileHistory.Add(historyFile);
+
+ buf.Printf(wxT("file%d"), (int)m_fileHistory.GetCount()+1);
+ historyFile = wxEmptyString;
+ }
+
+ AddFilesToMenu();
+}
+
+void wxFileHistory::Save(wxConfigBase& config)
+{
+ size_t i;
+ for (i = 0; i < m_fileMaxFiles; i++)
+ {
+ wxString buf;
+ buf.Printf(wxT("file%d"), (int)i+1);
+ if (i < m_fileHistory.GetCount())
+ config.Write(buf, wxString(m_fileHistory[i]));
+ else
+ config.Write(buf, wxEmptyString);
+ }
+}
+#endif // wxUSE_CONFIG
+
+void wxFileHistory::AddFilesToMenu()
+{
+ if ( m_fileHistory.empty() )
+ return;
+
+ for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ AddFilesToMenu((wxMenu *) node->GetData());
+ }
+}
+
+void wxFileHistory::AddFilesToMenu(wxMenu* menu)
+{
+ if ( m_fileHistory.empty() )
+ return;
+
+ if ( menu->GetMenuItemCount() )
+ menu->AppendSeparator();
+
+ for ( size_t i = 0; i < m_fileHistory.GetCount(); i++ )
+ {
+ menu->Append(m_idBase + i, GetMRUEntryLabel(i, m_fileHistory[i]));
+ }
+}
+
+#endif // wxUSE_FILE_HISTORY