From a5f72061d18ed48f53a3d33db349137a9e93d7fd Mon Sep 17 00:00:00 2001 From: Julien Rioux Date: Tue, 13 Sep 2011 21:50:07 +0000 Subject: [PATCH] Fix the guiName of external insets. - Remove hack with $$AbsOrRelPath substitution in the guiName. Instead, let LyX display the filename automatically in the gui, consistent with InsetInclude. - Use the guiName in the drop-down menu in the dialog instead of the internal lyxName. These guiNames ought to be more descriptive. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39675 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/external_templates | 12 ++++++------ src/frontends/qt4/GuiExternal.cpp | 2 +- src/insets/InsetExternal.cpp | 10 ++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/external_templates b/lib/external_templates index 61dbddf2fc..4c6278a1aa 100644 --- a/lib/external_templates +++ b/lib/external_templates @@ -34,7 +34,7 @@ PreambleDef InputOrWarn PreambleDefEnd Template GnumericSpreadsheet - GuiName "Spreadsheet" + GuiName "Gnumeric spreadsheet" HelpText A spreadsheet made with gnumeric, openoffice or excel. It imports as a long table, so any length @@ -76,7 +76,7 @@ TemplateEnd Template RasterImage # By default, InsetExternal is displayed as a grey button # containing this text. - GuiName "Bitmap: $$AbsOrRelPathParent$$Basename" + GuiName "Raster image" # This text is used in the External dialog. # Provide enough information to explain to the user just # what the template can provide him with. @@ -146,7 +146,7 @@ TemplateEnd Template XFig - GuiName "Xfig: $$AbsOrRelPathParent$$Basename" + GuiName "Xfig figure" HelpText An Xfig figure. HelpTextEnd @@ -199,7 +199,7 @@ TemplateEnd Template ChessDiagram - GuiName "Chess: $$AbsOrRelPathParent$$Basename" + GuiName "Chess diagram" HelpText A chess position diagram. This template will use XBoard to edit the position. @@ -298,7 +298,7 @@ Template LilyPond TemplateEnd Template PDFPages - GuiName "PDF pages: $$AbsOrRelPathParent$$Basename" + GuiName "PDF pages" HelpText Includes PDF documents, using the 'pdfpages' package. To include multiple pages, use the 'pages'-option, @@ -370,7 +370,7 @@ Template Date TemplateEnd Template Dia - GuiName "Dia: $$AbsOrRelPathParent$$Basename" + GuiName "Dia diagram" HelpText Dia diagram. HelpTextEnd diff --git a/src/frontends/qt4/GuiExternal.cpp b/src/frontends/qt4/GuiExternal.cpp index 00e2b66a3a..94decc7b3b 100644 --- a/src/frontends/qt4/GuiExternal.cpp +++ b/src/frontends/qt4/GuiExternal.cpp @@ -199,7 +199,7 @@ GuiExternal::GuiExternal(GuiView & lv) i1 = external::TemplateManager::get().getTemplates().begin(); i2 = external::TemplateManager::get().getTemplates().end(); for (; i1 != i2; ++i1) - externalCO->addItem(qt_(i1->second.lyxName)); + externalCO->addItem(qt_(i1->second.guiName)); // Fill the origins combo for (size_t i = 0; i != sizeof(origins) / sizeof(origins[0]); ++i) diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 8126d459a9..77d1b2f7bf 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -503,8 +503,14 @@ docstring screenLabel(InsetExternalParams const & params, from_utf8(params.templatename())); // FIXME UNICODE docstring gui = _(ptr->guiName); - return from_utf8(external::doSubstitution(params, buffer, - to_utf8(gui), false)); + gui += ": "; + + if (params.filename.empty()) + gui += "???"; + else + gui += from_utf8(params.filename.relFileName(buffer.filePath())); + + return gui; } } // namespace anon