]> git.lyx.org Git - features.git/commitdiff
shuffle stuff around
authorAndré Pönitz <poenitz@gmx.net>
Tue, 11 Sep 2007 21:27:57 +0000 (21:27 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 11 Sep 2007 21:27:57 +0000 (21:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20225 a592a061-630c-0410-9148-cb99ea01b6c8

21 files changed:
src/EmbeddedFiles.cpp
src/EmbeddedFiles.h
src/frontends/LyXView.cpp
src/frontends/controllers/ControlCharacter.h
src/frontends/controllers/ControlTexinfo.cpp
src/frontends/controllers/frontend_helpers.cpp
src/frontends/controllers/frontend_helpers.h
src/frontends/qt4/GuiCharacter.cpp
src/frontends/qt4/GuiCharacter.h
src/frontends/qt4/GuiClipboard.cpp
src/frontends/qt4/GuiEmbeddedFiles.cpp
src/frontends/qt4/GuiFontLoader.cpp
src/frontends/qt4/GuiImage.cpp
src/frontends/qt4/GuiListings.cpp
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/GuiTabular.cpp
src/frontends/qt4/GuiTexinfo.cpp
src/frontends/qt4/GuiVSpace.cpp
src/frontends/qt4/GuiWorkArea.cpp
src/frontends/qt4/GuiWrap.cpp
src/frontends/qt4/qt_helpers.cpp

index 28add45c67de952b707a1bd272077ee6096421a2..e6a02c4aac5a519c958b840d509c2240833222f0 100644 (file)
@@ -231,13 +231,13 @@ bool EmbeddedFiles::enabled() const
 }
 
 
-bool EmbeddedFiles::enable(bool flag)
+void EmbeddedFiles::enable(bool flag)
 {
        if (enabled() != flag) {
                // if enable, copy all files to temppath()
                // if disable, extract all files
                if ((flag && !updateFromExternalFile()) || (!flag && !extract()))
-                       return false;
+                       return;
                // if operation is successful
                buffer_->markDirty();
                buffer_->params().embedded = flag;
index a8f570b730e453012dea6a201186840c408b06e4..115a8e5b6c424fdc3756188f7ff6ee93418baebb 100644 (file)
@@ -174,7 +174,7 @@ public:
        typedef std::vector<EmbeddedFile> EmbeddedFileList;
 public:
        ///
-       EmbeddedFiles(Buffer * buffer = NULL): file_list_(), buffer_(buffer) {}
+       EmbeddedFiles(Buffer * buffer = 0) : file_list_(), buffer_(buffer) {}
        ///
        ~EmbeddedFiles() {}
 
@@ -182,7 +182,7 @@ public:
        bool enabled() const;
        /// set buffer params embedded flag. Files will be updated or extracted
        /// if such an operation fails, enable will fail.
-       bool enable(bool flag);
+       void enable(bool flag);
 
        /// add a file item. 
        /* \param filename filename to add
@@ -192,7 +192,7 @@ public:
         * \param inzipName suggested inzipname
         */
        void registerFile(std::string const & filename, bool embed = false,
-               Inset const * inset = NULL,
+               Inset const * inset = 0,
                std::string const & inzipName = std::string());
 
        /// scan the buffer and get a list of EmbeddedFile
@@ -229,6 +229,6 @@ private:
        Buffer * buffer_;
 };
 
+} // namespace lyx
 
-}
 #endif
index 926ceaa59c7e3a59ab9bcc75a488883695bb9179..0ebbe0b67651eacc8b750cfeb862858e53939012 100644 (file)
@@ -115,9 +115,10 @@ void LyXView::setBuffer(Buffer * newBuffer)
        if (wa == 0) {
                updateLabels(*newBuffer->getMasterBuffer());
                wa = addWorkArea(*newBuffer);
-       } else
+       } else {
                //Disconnect the old buffer...there's no new one.
                disconnectBuffer();
+       }
        connectBuffer(*newBuffer);
        connectBufferView(wa->bufferView());
        setCurrentWorkArea(wa);
@@ -384,8 +385,8 @@ void LyXView::updateLayoutChoice()
 
 void LyXView::updateWindowTitle()
 {
-       docstring maximize_title = lyx::from_ascii("LyX");
-       docstring minimize_title = lyx::from_ascii("LyX");
+       docstring maximize_title = from_ascii("LyX");
+       docstring minimize_title = from_ascii("LyX");
 
        Buffer * buf = buffer();
        if (buf) {
@@ -395,7 +396,7 @@ void LyXView::updateWindowTitle()
                        minimize_title = lyx::from_utf8(onlyFilename(cur_title));
                        if (!buf->isClean()) {
                                maximize_title += _(" (changed)");
-                               minimize_title += lyx::char_type('*');
+                               minimize_title += char_type('*');
                        }
                        if (buf->isReadonly())
                                maximize_title += _(" (read only)");
index d568f4a86c898665d932a2f3b2d1185c9f0b8296..b36888d46b74a038d229c565496afcdab5567ece 100644 (file)
@@ -12,9 +12,8 @@
 #ifndef CONTROLCHARACTER_H
 #define CONTROLCHARACTER_H
 
-
 #include "Dialog.h"
-#include "frontend_helpers.h"
+#include "Font.h"
 #include <boost/scoped_ptr.hpp>
 
 
@@ -24,6 +23,19 @@ class Color_color;
 
 namespace frontend {
 
+enum FONT_STATE {
+       ///
+       IGNORE,
+       ///
+       EMPH_TOGGLE,
+       ///
+       UNDERBAR_TOGGLE,
+       ///
+       NOUN_TOGGLE,
+       ///
+       INHERIT
+};
+
 class ControlCharacter : public Controller {
 public:
        ///
index 96106b3b8b43056f9be1c5fc94b365069fdbd8f7..1d2e7af7a00ef13e2f984173e2d790afce88bc0e 100644 (file)
@@ -14,6 +14,8 @@
 #include "FuncRequest.h"
 
 #include "support/filetools.h"
+#include "support/FileName.h"
+#include "support/lstrings.h"
 
 #include <algorithm>
 
@@ -21,44 +23,12 @@ using std::string;
 using std::vector;
 
 namespace lyx {
-
-using support::onlyFilename;
-
 namespace frontend {
 
-void getTexFileList(ControlTexinfo::texFileSuffix type,
-                   std::vector<string> & list, bool withPath)
-{
-       string filename;
-       switch (type) {
-       case ControlTexinfo::bst:
-               filename = "bstFiles.lst";
-               break;
-       case ControlTexinfo::cls:
-               filename = "clsFiles.lst";
-               break;
-       case ControlTexinfo::sty:
-               filename = "styFiles.lst";
-               break;
-       }
-       getTexFileList(filename, list);
-       if (list.empty()) {
-               // build filelists of all availabe bst/cls/sty-files.
-               // Done through kpsewhich and an external script,
-               // saved in *Files.lst
-               rescanTexStyles();
-               getTexFileList(filename, list);
-       }
-       if (withPath)
-               return;
-       vector<string>::iterator it  = list.begin();
-       vector<string>::iterator end = list.end();
-       for (; it != end; ++it) {
-               *it = onlyFilename(*it);
-       }
-       // sort on filename only (no path)
-       std::sort(list.begin(), list.end());
-}
+using support::FileName;
+using support::contains;
+using support::split;
+using support::token;
 
 
 ControlTexinfo::ControlTexinfo(Dialog & parent)
@@ -73,9 +43,24 @@ void ControlTexinfo::viewFile(string const & filename) const
 }
 
 
-string const ControlTexinfo::getClassOptions(string const & filename) const
+string const ControlTexinfo::getClassOptions(string const & classname) const
 {
-       return getListOfOptions(filename, "cls");
+       FileName const filename(getTexFileFromList(classname, "cls"));
+       if (filename.empty())
+               return string();
+       string optionList = string();
+       std::ifstream is(filename.toFilesystemEncoding().c_str());
+       while (is) {
+               string s;
+               is >> s;
+               if (contains(s, "DeclareOption")) {
+                       s = s.substr(s.find("DeclareOption"));
+                       s = split(s, '{');              // cut front
+                       s = token(s, '}', 0);           // cut end
+                       optionList += (s + '\n');
+               }
+       }
+       return optionList;
 }
 
 
index 1d383c5b419e1cf4de70e8e5aa04e992659ab134..4311a762fd351e2b2271928bc320a54a52204061 100644 (file)
@@ -27,7 +27,6 @@
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/Package.h"
-#include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/lyxalgo.h"
 #include "support/os.h"
@@ -47,273 +46,19 @@ using std::pair;
 using std::endl;
 
 namespace lyx {
-
 namespace frontend {
 
-vector<FamilyPair> const getFamilyData()
-{
-       vector<FamilyPair> family(5);
-
-       FamilyPair pr;
-
-       pr.first = _("No change");
-       pr.second = Font::IGNORE_FAMILY;
-       family[0] = pr;
-
-       pr.first = _("Roman");
-       pr.second = Font::ROMAN_FAMILY;
-       family[1] = pr;
-
-       pr.first = _("Sans Serif");
-       pr.second = Font::SANS_FAMILY;
-       family[2] = pr;
-
-       pr.first = _("Typewriter");
-       pr.second = Font::TYPEWRITER_FAMILY;
-       family[3] = pr;
-
-       pr.first = _("Reset");
-       pr.second = Font::INHERIT_FAMILY;
-       family[4] = pr;
-
-       return family;
-}
-
-
-vector<SeriesPair> const getSeriesData()
-{
-       vector<SeriesPair> series(4);
-
-       SeriesPair pr;
-
-       pr.first = _("No change");
-       pr.second = Font::IGNORE_SERIES;
-       series[0] = pr;
-
-       pr.first = _("Medium");
-       pr.second = Font::MEDIUM_SERIES;
-       series[1] = pr;
-
-       pr.first = _("Bold");
-       pr.second = Font::BOLD_SERIES;
-       series[2] = pr;
-
-       pr.first = _("Reset");
-       pr.second = Font::INHERIT_SERIES;
-       series[3] = pr;
-
-       return series;
-}
-
-
-vector<ShapePair> const getShapeData()
-{
-       vector<ShapePair> shape(6);
-
-       ShapePair pr;
-
-       pr.first = _("No change");
-       pr.second = Font::IGNORE_SHAPE;
-       shape[0] = pr;
-
-       pr.first = _("Upright");
-       pr.second = Font::UP_SHAPE;
-       shape[1] = pr;
-
-       pr.first = _("Italic");
-       pr.second = Font::ITALIC_SHAPE;
-       shape[2] = pr;
-
-       pr.first = _("Slanted");
-       pr.second = Font::SLANTED_SHAPE;
-       shape[3] = pr;
-
-       pr.first = _("Small Caps");
-       pr.second = Font::SMALLCAPS_SHAPE;
-       shape[4] = pr;
-
-       pr.first = _("Reset");
-       pr.second = Font::INHERIT_SHAPE;
-       shape[5] = pr;
-
-       return shape;
-}
-
-
-vector<SizePair> const getSizeData()
-{
-       vector<SizePair> size(14);
-
-       SizePair pr;
-
-       pr.first = _("No change");
-       pr.second = Font::IGNORE_SIZE;
-       size[0] = pr;
-
-       pr.first = _("Tiny");
-       pr.second = Font::SIZE_TINY;
-       size[1] = pr;
-
-       pr.first = _("Smallest");
-       pr.second = Font::SIZE_SCRIPT;
-       size[2] = pr;
-
-       pr.first = _("Smaller");
-       pr.second = Font::SIZE_FOOTNOTE;
-       size[3] = pr;
-
-       pr.first = _("Small");
-       pr.second = Font::SIZE_SMALL;
-       size[4] = pr;
-
-       pr.first = _("Normal");
-       pr.second = Font::SIZE_NORMAL;
-       size[5] = pr;
-
-       pr.first = _("Large");
-       pr.second = Font::SIZE_LARGE;
-       size[6] = pr;
-
-       pr.first = _("Larger");
-       pr.second = Font::SIZE_LARGER;
-       size[7] = pr;
-
-       pr.first = _("Largest");
-       pr.second = Font::SIZE_LARGEST;
-       size[8] = pr;
-
-       pr.first = _("Huge");
-       pr.second = Font::SIZE_HUGE;
-       size[9] = pr;
-
-       pr.first = _("Huger");
-       pr.second = Font::SIZE_HUGER;
-       size[10] = pr;
-
-       pr.first = _("Increase");
-       pr.second = Font::INCREASE_SIZE;
-       size[11] = pr;
-
-       pr.first = _("Decrease");
-       pr.second = Font::DECREASE_SIZE;
-       size[12] = pr;
-
-       pr.first = _("Reset");
-       pr.second = Font::INHERIT_SIZE;
-       size[13] = pr;
-
-       return size;
-}
-
-
-vector<BarPair> const getBarData()
-{
-       vector<BarPair> bar(5);
-
-       BarPair pr;
-
-       pr.first = _("No change");
-       pr.second = IGNORE;
-       bar[0] = pr;
-
-       pr.first = _("Emph");
-       pr.second = EMPH_TOGGLE;
-       bar[1] = pr;
-
-       pr.first = _("Underbar");
-       pr.second = UNDERBAR_TOGGLE;
-       bar[2] = pr;
-
-       pr.first = _("Noun");
-       pr.second = NOUN_TOGGLE;
-       bar[3] = pr;
-
-       pr.first = _("Reset");
-       pr.second = INHERIT;
-       bar[4] = pr;
-
-       return bar;
-}
-
-
-vector<ColorPair> const getColorData()
-{
-       vector<ColorPair> color(11);
-
-       ColorPair pr;
-
-       pr.first = _("No change");
-       pr.second = Color::ignore;
-       color[0] = pr;
-
-       pr.first = _("No color");
-       pr.second = Color::none;
-       color[1] = pr;
-
-       pr.first = _("Black");
-       pr.second = Color::black;
-       color[2] = pr;
-
-       pr.first = _("White");
-       pr.second = Color::white;
-       color[3] = pr;
-
-       pr.first = _("Red");
-       pr.second = Color::red;
-       color[4] = pr;
-
-       pr.first = _("Green");
-       pr.second = Color::green;
-       color[5] = pr;
-
-       pr.first = _("Blue");
-       pr.second = Color::blue;
-       color[6] = pr;
-
-       pr.first = _("Cyan");
-       pr.second = Color::cyan;
-       color[7] = pr;
-
-       pr.first = _("Magenta");
-       pr.second = Color::magenta;
-       color[8] = pr;
-
-       pr.first = _("Yellow");
-       pr.second = Color::yellow;
-       color[9] = pr;
-
-       pr.first = _("Reset");
-       pr.second = Color::inherit;
-       color[10] = pr;
-
-       return color;
-}
-
-
 
 namespace {
 
-class Sorter
-       : public std::binary_function<LanguagePair,
-                                     LanguagePair, bool>
+struct Sorter
 {
-public:
-       bool operator()(LanguagePair const & lhs,
-                       LanguagePair const & rhs) const {
+       bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const {
                return lhs.first < rhs.first;
        }
 };
 
 
-class ColorSorter
-{
-public:
-       bool operator()(Color::color const & lhs,
-                       Color::color const & rhs) const {
-               return lcolor.getGUIName(lhs) < lcolor.getGUIName(rhs);
-       }
-};
-
 } // namespace anon
 
 
@@ -348,14 +93,6 @@ vector<LanguagePair> const getLanguageData(bool character_dlg)
        return langs;
 }
 
-
-vector<Color_color> const getSortedColors(vector<Color_color> colors)
-{
-       // sort the colors
-       std::sort(colors.begin(), colors.end(), ColorSorter());
-       return colors;
-}
-
 } // namespace frontend
 
 using support::addName;
@@ -496,7 +233,6 @@ using support::libFileSearch;
 using support::onlyFilename;
 using support::package;
 using support::quoteName;
-using support::split;
 using support::Systemcall;
 using support::token;
 
@@ -553,27 +289,6 @@ void getTexFileList(string const & filename, std::vector<string> & list)
 }
 
 
-string const getListOfOptions(string const & classname, string const & type)
-{
-       FileName const filename(getTexFileFromList(classname, type));
-       if (filename.empty())
-               return string();
-       string optionList = string();
-       std::ifstream is(filename.toFilesystemEncoding().c_str());
-       while (is) {
-               string s;
-               is >> s;
-               if (contains(s,"DeclareOption")) {
-                       s = s.substr(s.find("DeclareOption"));
-                       s = split(s,'{');               // cut front
-                       s = token(s,'}',0);             // cut end
-                       optionList += (s + '\n');
-               }
-       }
-       return optionList;
-}
-
-
 string const getTexFileFromList(string const & file,
                            string const & type)
 {
index f0db68b326d87c19f127ef6c5b61b2ce7bf3315e..911eeb9490f4599aad83e994aea13ec58e455521 100644 (file)
@@ -13,7 +13,6 @@
 #ifndef FRONTEND_HELPERS_H
 #define FRONTEND_HELPERS_H
 
-#include "Font.h"
 #include "support/docstring.h"
 
 #include <utility>
 
 #include <boost/bind.hpp>
 
-class Color_color;
-
-/** Functions of use to the character GUI controller and view */
 namespace lyx {
 
 namespace support { class FileFilterList; }
 
 namespace frontend {
 
-///
-enum FONT_STATE {
-       ///
-       IGNORE,
-       ///
-       EMPH_TOGGLE,
-       ///
-       UNDERBAR_TOGGLE,
-       ///
-       NOUN_TOGGLE,
-       ///
-       INHERIT
-};
-
-///
-typedef std::pair<docstring, Font::FONT_FAMILY> FamilyPair;
-///
-typedef std::pair<docstring, Font::FONT_SERIES> SeriesPair;
-///
-typedef std::pair<docstring, Font::FONT_SHAPE>  ShapePair;
-///
-typedef std::pair<docstring, Font::FONT_SIZE>   SizePair;
-///
-typedef std::pair<docstring, FONT_STATE> BarPair;
-///
-typedef std::pair<docstring, Color_color> ColorPair;
-
-///
-std::vector<FamilyPair>   const getFamilyData();
-///
-std::vector<SeriesPair>   const getSeriesData();
-///
-std::vector<ShapePair>    const getShapeData();
-///
-std::vector<SizePair>     const getSizeData();
-///
-std::vector<BarPair>      const getBarData();
-///
-std::vector<ColorPair>    const getColorData();
-
 ///
 template<class Pair>
 std::vector<typename Pair::second_type> const
@@ -86,72 +42,70 @@ getSecond(std::vector<Pair> const & pr)
 typedef std::pair<docstring, std::string> LanguagePair;
 
 /** If the caller is the character dialog, add "No change" and "Reset"
- *  to the vector.
- */
+*  to the vector.
+*/
 std::vector<LanguagePair> const getLanguageData(bool character_dlg);
-/// sort colors for the gui
-std::vector<Color_color> const getSortedColors(std::vector<Color_color> colors);
 
 /** Launch a file dialog and return the chosen file.
-    filename: a suggested filename.
-    title: the title of the dialog.
-    pattern: *.ps etc.
-    dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
+       filename: a suggested filename.
+       title: the title of the dialog.
+       pattern: *.ps etc.
+       dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
 */
 docstring const
 browseFile(docstring const & filename,
-          docstring const & title,
-          support::FileFilterList const & filters,
-          bool save = false,
-          std::pair<docstring, docstring> const & dir1 =
-          std::make_pair(docstring(), docstring()),
-          std::pair<docstring, docstring> const & dir2 =
-          std::make_pair(docstring(), docstring()));
+        docstring const & title,
+        support::FileFilterList const & filters,
+        bool save = false,
+        std::pair<docstring, docstring> const & dir1 =
+        std::make_pair(docstring(), docstring()),
+        std::pair<docstring, docstring> const & dir2 =
+        std::make_pair(docstring(), docstring()));
 
 
 /** Wrapper around browseFile which tries to provide a filename
-    relative to relpath.  If the relative path is of the form "foo.txt"
-    or "bar/foo.txt", then it is returned as relative. OTOH, if it is
-    of the form "../baz/foo.txt", an absolute path is returned. This is
-    intended to be useful for insets which encapsulate files/
+       relative to relpath.  If the relative path is of the form "foo.txt"
+       or "bar/foo.txt", then it is returned as relative. OTOH, if it is
+       of the form "../baz/foo.txt", an absolute path is returned. This is
+       intended to be useful for insets which encapsulate files/
 */
 docstring const
 browseRelFile(docstring const & filename,
-             docstring const & refpath,
-             docstring const & title,
-             support::FileFilterList const & filters,
-             bool save = false,
-             std::pair<docstring, docstring> const & dir1 =
-             std::make_pair(docstring(), docstring()),
-             std::pair<docstring, docstring> const & dir2 =
-             std::make_pair(docstring(), docstring()));
+                       docstring const & refpath,
+                       docstring const & title,
+                       support::FileFilterList const & filters,
+                       bool save = false,
+                       std::pair<docstring, docstring> const & dir1 =
+                       std::make_pair(docstring(), docstring()),
+                       std::pair<docstring, docstring> const & dir2 =
+                       std::make_pair(docstring(), docstring()));
 
 
 /** Wrapper around browseFile which tries to provide a filename
- *  relative to the user or system directory. The dir, name and ext
- *  parameters have the same meaning as in the
- *  support::LibFileSearch function.
- */
+*  relative to the user or system directory. The dir, name and ext
+*  parameters have the same meaning as in the
+*  support::LibFileSearch function.
+*/
 docstring const
 browseLibFile(docstring const & dir,
-             docstring const & name,
-             docstring const & ext,
-             docstring const & title,
-             support::FileFilterList const & filters);
+                       docstring const & name,
+                       docstring const & ext,
+                       docstring const & title,
+                       support::FileFilterList const & filters);
 
 
 /** Launch a file dialog and return the chosen directory.
-    pathname: a suggested pathname.
-    title: the title of the dialog.
-    dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
+       pathname: a suggested pathname.
+       title: the title of the dialog.
+       dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
 */
 docstring const
 browseDir(docstring const & pathname,
-          docstring const & title,
-          std::pair<docstring, docstring> const & dir1 =
-          std::make_pair(docstring(), docstring()),
-          std::pair<docstring, docstring> const & dir2 =
-          std::make_pair(docstring(), docstring()));
+        docstring const & title,
+        std::pair<docstring, docstring> const & dir1 =
+        std::make_pair(docstring(), docstring()),
+        std::pair<docstring, docstring> const & dir2 =
+        std::make_pair(docstring(), docstring()));
 
 
 /// Returns a vector of units that can be used to create a valid LaTeX length.
@@ -159,8 +113,8 @@ std::vector<docstring> const getLatexUnits();
 
 
 /** Build filelists of all availabe bst/cls/sty-files. Done through
- *  kpsewhich and an external script, saved in *Files.lst.
- */
+*  kpsewhich and an external script, saved in *Files.lst.
+*/
 void rescanTexStyles();
 
 /// rebuild the textree
@@ -171,9 +125,6 @@ void texhash();
  */
 void getTexFileList(std::string const & filename, std::vector<std::string> & contents);
 
-/// get the options of stylefile
-std::string const getListOfOptions(std::string const & classname, std::string const & type);
-
 /// get a class with full path from the list
 std::string const getTexFileFromList(std::string const & classname, std::string const & type);
 
index 14c2b17f4b6aec15cb12c724f871f9be3efb43ad..8957ab3a906a0baf6d13fd20de462e4ff4b64598 100644 (file)
@@ -15,8 +15,8 @@
 
 #include "ControlCharacter.h"
 #include "qt_helpers.h"
-#include "frontend_helpers.h"
 #include "Color.h"
+#include "Font.h"
 
 #include <QCloseEvent>
 
@@ -25,6 +25,246 @@ using std::vector;
 namespace lyx {
 namespace frontend {
 
+static vector<ShapePair> const getShapeData()
+{
+       vector<ShapePair> shape(6);
+
+       ShapePair pr;
+
+       pr.first = qt_("No change");
+       pr.second = Font::IGNORE_SHAPE;
+       shape[0] = pr;
+
+       pr.first = qt_("Upright");
+       pr.second = Font::UP_SHAPE;
+       shape[1] = pr;
+
+       pr.first = qt_("Italic");
+       pr.second = Font::ITALIC_SHAPE;
+       shape[2] = pr;
+
+       pr.first = qt_("Slanted");
+       pr.second = Font::SLANTED_SHAPE;
+       shape[3] = pr;
+
+       pr.first = qt_("Small Caps");
+       pr.second = Font::SMALLCAPS_SHAPE;
+       shape[4] = pr;
+
+       pr.first = qt_("Reset");
+       pr.second = Font::INHERIT_SHAPE;
+       shape[5] = pr;
+
+       return shape;
+}
+
+
+static vector<SizePair> const getSizeData()
+{
+       vector<SizePair> size(14);
+
+       SizePair pr;
+
+       pr.first = qt_("No change");
+       pr.second = Font::IGNORE_SIZE;
+       size[0] = pr;
+
+       pr.first = qt_("Tiny");
+       pr.second = Font::SIZE_TINY;
+       size[1] = pr;
+
+       pr.first = qt_("Smallest");
+       pr.second = Font::SIZE_SCRIPT;
+       size[2] = pr;
+
+       pr.first = qt_("Smaller");
+       pr.second = Font::SIZE_FOOTNOTE;
+       size[3] = pr;
+
+       pr.first = qt_("Small");
+       pr.second = Font::SIZE_SMALL;
+       size[4] = pr;
+
+       pr.first = qt_("Normal");
+       pr.second = Font::SIZE_NORMAL;
+       size[5] = pr;
+
+       pr.first = qt_("Large");
+       pr.second = Font::SIZE_LARGE;
+       size[6] = pr;
+
+       pr.first = qt_("Larger");
+       pr.second = Font::SIZE_LARGER;
+       size[7] = pr;
+
+       pr.first = qt_("Largest");
+       pr.second = Font::SIZE_LARGEST;
+       size[8] = pr;
+
+       pr.first = qt_("Huge");
+       pr.second = Font::SIZE_HUGE;
+       size[9] = pr;
+
+       pr.first = qt_("Huger");
+       pr.second = Font::SIZE_HUGER;
+       size[10] = pr;
+
+       pr.first = qt_("Increase");
+       pr.second = Font::INCREASE_SIZE;
+       size[11] = pr;
+
+       pr.first = qt_("Decrease");
+       pr.second = Font::DECREASE_SIZE;
+       size[12] = pr;
+
+       pr.first = qt_("Reset");
+       pr.second = Font::INHERIT_SIZE;
+       size[13] = pr;
+
+       return size;
+}
+
+
+static vector<BarPair> const getBarData()
+{
+       vector<BarPair> bar(5);
+
+       BarPair pr;
+
+       pr.first = qt_("No change");
+       pr.second = IGNORE;
+       bar[0] = pr;
+
+       pr.first = qt_("Emph");
+       pr.second = EMPH_TOGGLE;
+       bar[1] = pr;
+
+       pr.first = qt_("Underbar");
+       pr.second = UNDERBAR_TOGGLE;
+       bar[2] = pr;
+
+       pr.first = qt_("Noun");
+       pr.second = NOUN_TOGGLE;
+       bar[3] = pr;
+
+       pr.first = qt_("Reset");
+       pr.second = INHERIT;
+       bar[4] = pr;
+
+       return bar;
+}
+
+
+static vector<ColorPair> const getColorData()
+{
+       vector<ColorPair> color(11);
+
+       ColorPair pr;
+
+       pr.first = qt_("No change");
+       pr.second = Color::ignore;
+       color[0] = pr;
+
+       pr.first = qt_("No color");
+       pr.second = Color::none;
+       color[1] = pr;
+
+       pr.first = qt_("Black");
+       pr.second = Color::black;
+       color[2] = pr;
+
+       pr.first = qt_("White");
+       pr.second = Color::white;
+       color[3] = pr;
+
+       pr.first = qt_("Red");
+       pr.second = Color::red;
+       color[4] = pr;
+
+       pr.first = qt_("Green");
+       pr.second = Color::green;
+       color[5] = pr;
+
+       pr.first = qt_("Blue");
+       pr.second = Color::blue;
+       color[6] = pr;
+
+       pr.first = qt_("Cyan");
+       pr.second = Color::cyan;
+       color[7] = pr;
+
+       pr.first = qt_("Magenta");
+       pr.second = Color::magenta;
+       color[8] = pr;
+
+       pr.first = qt_("Yellow");
+       pr.second = Color::yellow;
+       color[9] = pr;
+
+       pr.first = qt_("Reset");
+       pr.second = Color::inherit;
+       color[10] = pr;
+
+       return color;
+}
+
+
+static vector<SeriesPair> const getSeriesData()
+{
+       vector<SeriesPair> series(4);
+
+       SeriesPair pr;
+
+       pr.first = qt_("No change");
+       pr.second = Font::IGNORE_SERIES;
+       series[0] = pr;
+
+       pr.first = qt_("Medium");
+       pr.second = Font::MEDIUM_SERIES;
+       series[1] = pr;
+
+       pr.first = qt_("Bold");
+       pr.second = Font::BOLD_SERIES;
+       series[2] = pr;
+
+       pr.first = qt_("Reset");
+       pr.second = Font::INHERIT_SERIES;
+       series[3] = pr;
+
+       return series;
+}
+
+
+static vector<FamilyPair> const getFamilyData()
+{
+       vector<FamilyPair> family(5);
+
+       FamilyPair pr;
+
+       pr.first = qt_("No change");
+       pr.second = Font::IGNORE_FAMILY;
+       family[0] = pr;
+
+       pr.first = qt_("Roman");
+       pr.second = Font::ROMAN_FAMILY;
+       family[1] = pr;
+
+       pr.first = qt_("Sans Serif");
+       pr.second = Font::SANS_FAMILY;
+       family[2] = pr;
+
+       pr.first = qt_("Typewriter");
+       pr.second = Font::TYPEWRITER_FAMILY;
+       family[3] = pr;
+
+       pr.first = qt_("Reset");
+       pr.second = Font::INHERIT_FAMILY;
+       family[4] = pr;
+
+       return family;
+}
+
+
 GuiCharacterDialog::GuiCharacterDialog(LyXView & lv)
        : GuiDialog(lv, "character")
 {
@@ -55,28 +295,28 @@ GuiCharacterDialog::GuiCharacterDialog(LyXView & lv)
 
        for (vector<FamilyPair>::const_iterator cit = family.begin();
                cit != family.end(); ++cit) {
-               familyCO->addItem(toqstr(cit->first));
+               familyCO->addItem(cit->first);
        }
 
        for (vector<SeriesPair>::const_iterator cit = series.begin();
                cit != series.end(); ++cit) {
-               seriesCO->addItem(toqstr(cit->first));
+               seriesCO->addItem(cit->first);
        }
        for (vector<ShapePair>::const_iterator cit = shape.begin();
                cit != shape.end(); ++cit) {
-               shapeCO->addItem(toqstr(cit->first));
+               shapeCO->addItem(cit->first);
        }
        for (vector<SizePair>::const_iterator cit = size.begin();
                cit != size.end(); ++cit) {
-               sizeCO->addItem(toqstr(cit->first));
+               sizeCO->addItem(cit->first);
        }
        for (vector<BarPair>::const_iterator cit = bar.begin();
                cit != bar.end(); ++cit) {
-               miscCO->addItem(toqstr(cit->first));
+               miscCO->addItem(cit->first);
        }
        for (vector<ColorPair>::const_iterator cit = color.begin();
                cit != color.end(); ++cit) {
-               colorCO->addItem(toqstr(cit->first));
+               colorCO->addItem(cit->first);
        }
        for (vector<LanguagePair>::const_iterator cit = language.begin();
                cit != language.end(); ++cit) {
@@ -142,16 +382,15 @@ void GuiCharacterDialog::closeEvent(QCloseEvent * e)
 
 
 template<class A, class B>
-static int findPos2nd(vector<std::pair<A,B> > const & vec, B const & val)
+static int findPos2nd(vector<std::pair<A, B> > const & vec, B const & val)
 {
        typedef typename vector<std::pair<A, B> >::const_iterator
                const_iterator;
 
-       const_iterator cit = vec.begin();
-       for (; cit != vec.end(); ++cit) {
+       for (const_iterator cit = vec.begin(); cit != vec.end(); ++cit)
                if (cit->second == val)
                        return int(cit - vec.begin());
-       }
+
        return 0;
 }
 
@@ -160,16 +399,13 @@ void GuiCharacterDialog::updateContents()
 {
        ControlCharacter const & ctrl = controller();
 
-       familyCO->setCurrentIndex(findPos2nd(family,
-                                                    ctrl.getFamily()));
-       seriesCO->setCurrentIndex(findPos2nd(series,
-                                                    ctrl.getSeries()));
+       familyCO->setCurrentIndex(findPos2nd(family, ctrl.getFamily()));
+       seriesCO->setCurrentIndex(findPos2nd(series, ctrl.getSeries()));
        shapeCO->setCurrentIndex(findPos2nd(shape, ctrl.getShape()));
        sizeCO->setCurrentIndex(findPos2nd(size, ctrl.getSize()));
        miscCO->setCurrentIndex(findPos2nd(bar, ctrl.getBar()));
        colorCO->setCurrentIndex(findPos2nd(color, ctrl.getColor()));
-       langCO->setCurrentIndex(findPos2nd(language,
-                                                  ctrl.getLanguage()));
+       langCO->setCurrentIndex(findPos2nd(language, ctrl.getLanguage()));
 
        toggleallCB->setChecked(ctrl.getToggleAll());
 }
index b9e7eedc021dd4ce204ccdf22b4b89d0844b48ac..6283b6fc2cdaf6fe8bbcca9d154fccadb4f242fe 100644 (file)
 #include "GuiDialog.h"
 #include "ControlCharacter.h"
 #include "ui_CharacterUi.h"
+#include "frontend_helpers.h" // for LanguagePair
 
 #include <vector>
 
 namespace lyx {
 namespace frontend {
 
+typedef std::pair<QString, Font::FONT_FAMILY> FamilyPair;
+typedef std::pair<QString, Font::FONT_SERIES> SeriesPair;
+typedef std::pair<QString, Font::FONT_SHAPE>  ShapePair;
+typedef std::pair<QString, Font::FONT_SIZE>   SizePair;
+typedef std::pair<QString, FONT_STATE> BarPair;
+typedef std::pair<QString, Color_color> ColorPair;
+
 class GuiCharacterDialog : public GuiDialog, public Ui::CharacterUi
 {
        Q_OBJECT
index 13139ec08e6dec00eb2623c199be09f6df354c0a..cd9914cde6aca29bf7610da60d7abafe6692c0e8 100644 (file)
@@ -23,6 +23,7 @@
 #include <QString>
 
 #include "support/lstrings.h"
+
 using lyx::support::internalLineEnding;
 using lyx::support::externalLineEnding;
 
index be720a7023577a81f7753b3742a4f1cd4c95ecbf..71858db6c894a83cacb9e0e099ed20017b533d88 100644 (file)
 
 #include "GuiEmbeddedFiles.h"
 #include "debug.h"
-#include "support/convert.h"
 
-using std::string;
 
 namespace lyx {
-
 namespace frontend {
 
-
 GuiEmbeddedFilesDialog::GuiEmbeddedFilesDialog
                (ControlEmbeddedFiles & controller)
        : controller_(controller)
@@ -96,10 +92,9 @@ void GuiEmbeddedFilesDialog::on_filesLW_itemClicked(QListWidgetItem* item)
                k = (k + 1) % files[idx].refCount();
                item->setData(Qt::UserRole, k);
                // update label
-               string label = files[idx].inzipName() + " ("
-                       + convert<string>(k + 1)  + "/"
-                       + convert<string>(files[idx].refCount()) + ")";
-               item->setText(toqstr(label));
+               QString label = toqstr(files[idx].inzipName())
+                       + QString(" (%1/%2)").arg(k + 1).arg(files[idx].refCount());
+               item->setText(label);
        } else
                controller_.goTo(files[idx], 0);
 }
@@ -115,15 +110,14 @@ void GuiEmbeddedFilesDialog::on_filesLW_itemDoubleClicked(QListWidgetItem* item)
 void GuiEmbeddedFilesDialog::updateView()
 {
        filesLW->clear();
-       //
        EmbeddedFiles const & files = controller_.embeddedFiles();
        EmbeddedFiles::EmbeddedFileList::const_iterator it = files.begin();
        EmbeddedFiles::EmbeddedFileList::const_iterator it_end = files.end();
        for (; it != it_end; ++it) {
-               string label = it->inzipName();
+               QString label = toqstr(it->inzipName());
                if (it->refCount() > 1)
-                       label += " (1/" + convert<string>(it->refCount()) + ")";
-               QListWidgetItem * item = new QListWidgetItem(toqstr(label));
+                       label += " (1/" + QString::number(it->refCount()) + ")";
+               QListWidgetItem * item = new QListWidgetItem(label);
                Qt::ItemFlags flag = Qt::ItemIsUserCheckable | Qt::ItemIsSelectable;
                if (it->valid())
                        flag |= Qt::ItemIsEnabled;
index 41913a673b4779bd95e3351a5b249819ac803e71..08da0a032f64980fdc8aec9eb02b341ccc947607 100644 (file)
 #include "support/Package.h"
 #include "support/os.h"
 
-#include <qfontinfo.h>
+#include <QFontInfo>
 #include <QFontDatabase>
 
-#include <boost/tuple/tuple.hpp>
-
-#ifdef Q_WS_X11
-#include <qwidget.h>
-//#include <X11/Xlib.h>
-#include <algorithm>
-#endif
-
 using lyx::support::contains;
 using lyx::support::package;
 using lyx::support::addPath;
index a65a09deaaa84fd39d566d83199780df3c060f1d..d0d0e8d07147cfd95a367e0911dea8067365fe2a 100644 (file)
@@ -23,8 +23,6 @@
 #include "support/lstrings.h"       // ascii_lowercase
 
 #include <QPainter>
-#include <QPictureIO>
-#include <QPicture>
 #include <QImage>
 #include <QImageReader>
 
@@ -40,8 +38,6 @@ using std::equal_to;
 using std::find_if;
 using std::string;
 
-QPictureIO StaticPicture;
-
 namespace lyx {
 namespace graphics {
 
@@ -167,10 +163,8 @@ void GuiImage::load_impl(support::FileName const & filename)
 }
 
 
-namespace {
-
 // This code is taken from KImageEffect::toGray
-QImage & toGray(QImage & img)
+static QImage & toGray(QImage & img)
 {
        if (img.width() == 0 || img.height() == 0)
                return img;
@@ -189,8 +183,6 @@ QImage & toGray(QImage & img)
        return img;
 }
 
-} // namespace anon
-
 
 bool GuiImage::setPixmap_impl(Params const & params)
 {
index 3fd431839215446ef1f7c2472c1286126adb4939..01f671812e40e78403e5e82c763b74c543659fb8 100644 (file)
@@ -18,7 +18,6 @@
 #include "insets/InsetListingsParams.h"
 #include "debug.h"
 
-#include "support/convert.h"
 #include "support/lstrings.h"
 
 #include <QLineEdit>
index b30389ac1a22a0d47392f6b6c0d870aaef031fd5..26e23ac4a9f78f8cbc5dc6190351cb70f997f8a5 100644 (file)
@@ -43,9 +43,6 @@
 #include <QValidator>
 #include <QCloseEvent>
 
-#include <boost/tuple/tuple.hpp>
-#include <boost/bind.hpp>
-
 #include <iomanip>
 #include <sstream>
 #include <algorithm>
@@ -522,6 +519,17 @@ void PrefScreenFonts::select_typewriter(const QString& name)
 //
 /////////////////////////////////////////////////////////////////////
 
+namespace {
+
+struct ColorSorter
+{
+       bool operator()(Color::color const & lhs, Color::color const & rhs) const {
+               return lcolor.getGUIName(lhs) < lcolor.getGUIName(rhs);
+       }
+};
+
+} // namespace anon
+
 PrefColors::PrefColors(GuiPrefsDialog * form, QWidget * parent)
        : PrefModule( _("Colors"), form, parent)
 {
@@ -547,13 +555,11 @@ PrefColors::PrefColors(GuiPrefsDialog * form, QWidget * parent)
 
                lcolors_.push_back(lc);
        }
-       lcolors_ = frontend::getSortedColors(lcolors_);
+       std::sort(lcolors_.begin(), lcolors_.end(), ColorSorter());
        vector<Color_color>::const_iterator cit = lcolors_.begin();
        vector<Color_color>::const_iterator const end = lcolors_.end();
-       for (; cit != end; ++cit)
-       {
-               // This is not a memory leak:
-               /*QListWidgetItem * newItem =*/ new QListWidgetItem(QIcon(icon),
+       for (; cit != end; ++cit) {
+                       (void) new QListWidgetItem(QIcon(icon),
                        toqstr(lcolor.getGUIName(*cit)), lyxObjectsLW);
        }
        curcolors_.resize(lcolors_.size());
index 0d6066406897f819979f5adc6469b63665ee4998..cca86d5a596b2c071b1d4e846cd74711c0910a15 100644 (file)
@@ -20,8 +20,6 @@
 #include "Validator.h"
 #include "qt_helpers.h"
 
-#include "support/convert.h"
-
 #include <QCloseEvent>
 #include <QCheckBox>
 #include <QPushButton>
@@ -610,8 +608,8 @@ void GuiTabularDialog::updateContents()
        Tabular::row_type const row = tabular.cellRow(cell);
        Tabular::col_type const col = tabular.cellColumn(cell);
 
-       tabularRowED->setText(toqstr(convert<string>(row + 1)));
-       tabularColumnED->setText(toqstr(convert<string>(col + 1)));
+       tabularRowED->setText(QString::number(row + 1));
+       tabularColumnED->setText(QString::number(col + 1));
 
        bool const multicol(tabular.isMultiColumn(cell));
 
index 26a0d85d06dd2632cb9087d60bbf2ae0948326ba..db0c470fc42a8294b2da762b9ea5adb66be7c3a8 100644 (file)
@@ -126,12 +126,40 @@ void GuiTexinfoDialog::enableViewPB()
 }
 
 
-void GuiTexinfoDialog::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
+void GuiTexinfoDialog::updateStyles(ControlTexinfo::texFileSuffix type)
 {
-       ContentsType & data = texdata_[whichStyle];
+       ContentsType & data = texdata_[type];
+
+       string filename;
+       switch (type) {
+       case ControlTexinfo::bst:
+               filename = "bstFiles.lst";
+               break;
+       case ControlTexinfo::cls:
+               filename = "clsFiles.lst";
+               break;
+       case ControlTexinfo::sty:
+               filename = "styFiles.lst";
+               break;
+       }
+       getTexFileList(filename, data);
+       if (data.empty()) {
+               // build filelists of all availabe bst/cls/sty-files.
+               // Done through kpsewhich and an external script,
+               // saved in *Files.lst
+               rescanTexStyles();
+               getTexFileList(filename, data);
+       }
        bool const withFullPath = pathCB->isChecked();
+       if (withFullPath)
+               return;
+       vector<string>::iterator it1  = data.begin();
+       vector<string>::iterator end1 = data.end();
+       for (; it1 != end1; ++it1)
+               *it1 = support::onlyFilename(*it1);
 
-       getTexFileList(whichStyle, data, withFullPath);
+       // sort on filename only (no path)
+       std::sort(data.begin(), data.end());
 
        fileListLW->clear();
        ContentsType::const_iterator it  = data.begin();
@@ -139,7 +167,7 @@ void GuiTexinfoDialog::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
        for (; it != end; ++it)
                fileListLW->addItem(toqstr(*it));
 
-       activeStyle = whichStyle;
+       activeStyle = type;
 }
 
 
index e3332c95a82d2004d5807c011220a4498aadec66..c1a5dd113ce903d575152e707e88dcde600ae8a3 100644 (file)
@@ -26,9 +26,6 @@
 #include "Spacing.h"
 #include "VSpace.h"
 
-#include "ControlVSpace.h"
-#include "frontend_helpers.h"
-
 #include "support/lstrings.h"
 
 #include <QCheckBox>
index 99f0b4b712baeefea5d32d60665a148c43dfc648..ec30f9b2d71fd01f593e01016efc82b97bcbe85f 100644 (file)
@@ -28,7 +28,6 @@
 #include "version.h"
 
 #include "support/filetools.h" // LibFileSearch
-#include "support/convert.h"
 
 #include "graphics/GraphicsImage.h"
 #include "graphics/GraphicsLoader.h"
index 21122c3b3489deb7f89c5cf970b3510e05ea5c60..727cb589785ef5c426c70934b09a3fe6ca637c6b 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "insets/InsetWrap.h"
 
-#include "support/convert.h"
 #include "support/lstrings.h"
 
 #include <QLineEdit>
@@ -109,21 +108,14 @@ void GuiWrapDialog::applyView()
 }
 
 
-static string const numtostr(double val)
-{
-       string a = convert<string>(val);
-       return a;
-       //0pt is a legal width now, it yields a
-       //wrapfloat just wide enough for the contents.
-}
-
-
 void GuiWrapDialog::updateContents()
 {
        InsetWrapParams & params = controller().params();
 
        Length len(params.width);
-       widthED->setText(toqstr(numtostr(len.value())));
+       //0pt is a legal width now, it yields a
+       //wrapfloat just wide enough for the contents.
+       widthED->setText(QString::number(len.value()));
        unitsLC->setCurrentItem(len.unit());
 
        int item = 0;
index d89f1b2bf7f7cf6e97d2cdba0b0bf77367dd12c4..2c14d42149a32545d8bb9302fda74bb5d6603b95 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "support/os.h"
 #include "support/lstrings.h"
-#include "support/convert.h"
 
 #include "debug.h"
 
@@ -97,7 +96,7 @@ void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
                      Length const & len, Length::UNIT /*defaultUnit*/)
 {
        combo->setCurrentItem(Length(len).unit());
-       input->setText(toqstr(convert<string>(Length(len).value())));
+       input->setText(QString::number(Length(len).value()));
 }