>>>>> "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

>> What I'd like actually is to display foo/bar/file.lyx when the file
>> is in $lyxdir/foo/bar/file.lyx. So we would see doc/Intro.lyx or
>> doc/fr/Intro,lyx. Would that be OK?

Abdelrazak> Yes, seems OK to me. How is it done for the View submenu?
Abdelrazak> I think both lists should (ideally) share the same code.

Here is what I cam up with. It would be even better to put lyxdir file
names in italics, but I am not sure how to do that (or even if qt can
do it).

JMarc

Index: src/support/filetools.C
===================================================================
--- src/support/filetools.C	(révision 17373)
+++ src/support/filetools.C	(copie de travail)
@@ -999,9 +999,14 @@ FileName const unzipFile(FileName const 
 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))
+		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, "~");
 
Index: src/frontends/qt4/GuiView.C
===================================================================
--- src/frontends/qt4/GuiView.C	(révision 17373)
+++ src/frontends/qt4/GuiView.C	(copie de travail)
@@ -64,9 +64,10 @@ using std::vector;
 namespace lyx {
 
 using support::FileName;
+using support::libFileSearch;
+using support::makeDisplayPath;
 using support::onlyFilename;
 using support::subst;
-using support::libFileSearch;
 
 namespace frontend {
 
@@ -512,7 +513,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);

Reply via email to