From a7c2c8e3d53f093e3707feee3489e91b3c3411d0 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 28 Feb 2007 21:48:04 +0000 Subject: [PATCH] * support/filetools.C (makeDisplayPath): if the file is in the lyx support directory, return as a relative path (enclosed in brackets) * frontends/qt4/GuiView.C (updateTabs): use makeDisplayPath instead of onlyFileName. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17384 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.C | 5 ++--- src/support/filetools.C | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/frontends/qt4/GuiView.C b/src/frontends/qt4/GuiView.C index c6c68b9a29..43cd3fca0f 100644 --- a/src/frontends/qt4/GuiView.C +++ b/src/frontends/qt4/GuiView.C @@ -64,9 +64,8 @@ using std::vector; namespace lyx { using support::FileName; -using support::onlyFilename; -using support::subst; using support::libFileSearch; +using support::makeDisplayPath; namespace frontend { @@ -512,7 +511,7 @@ void GuiView::updateTab() // rebuild tabbar and function map from scratch if (names.size() > 1) { for(size_t i = 0; i < names.size(); i++) { - tabbar.addTab(toqstr(onlyFilename(names[i]))); + tabbar.addTab(toqstr(makeDisplayPath(names[i], 30))); // set current tab if (names[i] == cur_title) tabbar.setCurrentIndex(i); diff --git a/src/support/filetools.C b/src/support/filetools.C index 4bc0d99595..4e6224a1ba 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -999,9 +999,14 @@ FileName const unzipFile(FileName const & zipped_file, string const & unzipped_f docstring const makeDisplayPath(string const & path, unsigned int threshold) { string str = path; - string const home = package().home_dir(); + + // If file is from LyXDir, display it as if it were relative. + string const system = package().system_support(); + if (prefixIs(str, system)) + return from_utf8("[" + str.erase(0, system.length()) + "]"); // replace /home/blah with ~/ + string const home = package().home_dir(); if (!home.empty() && prefixIs(str, home)) str = subst(str, home, "~");