]> git.lyx.org Git - features.git/commitdiff
Add default export to the menu
authorGuillaume Munch <gm@lyx.org>
Sat, 4 Mar 2017 22:44:34 +0000 (23:44 +0100)
committerGuillaume Munch <gm@lyx.org>
Sun, 5 Mar 2017 07:45:52 +0000 (08:45 +0100)
lib/ui/stdmenus.inc
src/frontends/qt4/Menus.cpp

index f134e4875ca54ec045e25bc7efbf56193a2e231d..01499af023ac4860a710e953b0acb122d2c4d649 100644 (file)
@@ -88,7 +88,9 @@ Menuset
        End
 
        Menu "file_export"
+               ExportFormat
                Item "Export As...|s" "buffer-export-as"
+               Separator
                ExportFormats
                Item "More Formats & Options...|r" "buffer-export custom"
        End
index 3e2d3c2884c65ca070ce8887493bb6bf56d95678..902eca41149ae66e9ce2a83f96bf8541d9bb8268 100644 (file)
@@ -135,6 +135,9 @@ public:
                /** This is a list of exportable formats
                    typically for the File->Export menu. */
                ExportFormats,
+               /** This exports the document default format
+                   typically for the File->Export menu. */
+               ExportFormat,
                /** This is a list of importable formats
                    typically for the File->Import menu. */
                ImportFormats,
@@ -455,6 +458,7 @@ void MenuDefinition::read(Lexer & lex)
                md_elements,
                md_endmenu,
                md_exportformats,
+               md_exportformat,
                md_importformats,
                md_indices,
                md_indicescontext,
@@ -496,6 +500,7 @@ void MenuDefinition::read(Lexer & lex)
                { "end", md_endmenu },
                { "environmentseparators", md_env_separators },
                { "exportformats", md_exportformats },
+               { "exportformat", md_exportformat },
                { "floatinsert", md_floatinsert },
                { "floatlistinsert", md_floatlistinsert },
                { "graphicsgroups", md_graphicsgroups },
@@ -587,6 +592,10 @@ void MenuDefinition::read(Lexer & lex)
                        add(MenuItem(MenuItem::ExportFormats));
                        break;
 
+               case md_exportformat:
+                       add(MenuItem(MenuItem::ExportFormat));
+                       break;
+
                case md_importformats:
                        add(MenuItem(MenuItem::ImportFormats));
                        break;
@@ -2175,6 +2184,19 @@ void Menus::Impl::expand(MenuDefinition const & frommenu,
                        tomenu.expandFormats(cit->kind(), buf);
                        break;
 
+               case MenuItem::ExportFormat: {
+                       if (!buf)
+                               break;
+                       string const format = buf->params().getDefaultOutputFormat();
+                       Format const * f = formats.getFormat(format);
+                       docstring const name = f ? f->prettyname() : from_utf8(format);
+                       docstring const label = bformat(_("Export [%1$s]|E"), name);
+                       MenuItem item(MenuItem::Command, toqstr(label),
+                                     FuncRequest(LFUN_BUFFER_EXPORT));
+                       tomenu.addWithStatusCheck(item);
+                       break;
+               }
+
                case MenuItem::CharStyles:
                        tomenu.expandFlexInsert(buf, InsetLayout::CHARSTYLE);
                        break;