]> git.lyx.org Git - features.git/commitdiff
* lyxfont.h: Change order of declarations to give the compiler
authorAndré Pönitz <poenitz@gmx.net>
Sat, 16 Jul 2005 10:35:43 +0000 (10:35 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sat, 16 Jul 2005 10:35:43 +0000 (10:35 +0000)
  a better chance to inline things

  * lyx_cb.[Ch]: Add 'force' argument to QuitLyX suppressing
  questions on unsaved docs for better scritability

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10236 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/frontends/gtk/GView.C
src/frontends/qt2/QtView.C
src/frontends/xforms/XFormsView.C
src/lyx_cb.C
src/lyx_cb.h
src/lyx_main.C
src/lyxfont.C
src/lyxfont.h
src/lyxfunc.C

index d34ed386b5d85f33f0a9c343c88661271ee94449..2a0752a89eb6c0d4b842b2ad2159140b8a3b92ce 100644 (file)
@@ -1,4 +1,12 @@
 
+2005-07-16  André Pönitz  <poenitz@gmx.net>
+
+       * lyxfont.h: Change order of declarations to give the compiler
+  a better chance to inline things
+
+  * lyx_cb.[Ch]: Add 'force' argument to QuitLyX suppressing
+  questions on unsaved docs for better scritability
+
 2005-07-16  André Pönitz  <poenitz@gmx.net>
 
        * paragraph.h (getChar): remove asserts as the same kind of security
index e695c21e65d20397c33fbf696ee3b83306a9cd07..dd91b1e730292935b3371d6227740017b12f4a42 100644 (file)
@@ -117,7 +117,7 @@ Gtk::Box & GView::getBox(Position pos)
 
 bool GView::on_delete_event(GdkEventAny * /*event*/)
 {
-       QuitLyX();
+       QuitLyX(false);
        return true;
 }
 
index 5eb054c797544516f193ca1a6abae017de93a0bb..5722d8957f96c246edf729d082d6d3de4f7d1f9f 100644 (file)
@@ -152,7 +152,7 @@ bool QtView::hasFocus() const
 
 void QtView::closeEvent(QCloseEvent *)
 {
-       QuitLyX();
+       QuitLyX(false);
 }
 
 
index 9abe89488abc6f59ab3ab202e32b07fc2b97639a..43f70585160299f3bcb46b7cb02ea6d97b1d74e2 100644 (file)
@@ -34,7 +34,7 @@ using std::endl;
 using std::string;
 
 //extern void AutoSave(BufferView *);
-extern void QuitLyX();
+extern void QuitLyX(bool);
 
 namespace lyx {
 
@@ -173,7 +173,7 @@ FL_FORM * XFormsView::getForm() const
 // Callback for close main form from window manager
 int XFormsView::atCloseMainFormCB(FL_FORM *, void *)
 {
-       QuitLyX();
+       QuitLyX(false);
        return FL_IGNORE;
 }
 
index c58ee30d7fec683b31cf1ba9a39f2456237bca41..ff6eeb49ac50f8c4bdfdf252ff3b0d18edee65dd 100644 (file)
@@ -188,12 +188,12 @@ bool WriteAs(Buffer * buffer, string const & filename)
 }
 
 
-void QuitLyX()
+void QuitLyX(bool noask)
 {
        lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
 
        if (lyx_gui::use_gui) {
-               if (!bufferlist.quitWriteAll())
+               if (!noask && !bufferlist.quitWriteAll())
                        return;
 
                LyX::cref().lastfiles().writeFile(lyxrc.lastfiles);
index 67bc2bddd82c954dc8404e6cdb3718bd806bf701..fa191c4fc2a96a865f2f04a71d951d78962b1a2e 100644 (file)
@@ -25,7 +25,7 @@ bool MenuWrite(Buffer * buffer);
 /// write the given file, or ask if no name given
 bool WriteAs(Buffer * buffer, std::string const & filename = std::string());
 ///
-void QuitLyX();
+void QuitLyX(bool noask);
 ///
 void AutoSave(BufferView * bv);
 ///
index 9a42be6b3faac2c7001fe555b562a261ab592839..8ecd3edabcd2bc96957d47e7f10d99854d7faff2 100644 (file)
@@ -87,7 +87,7 @@ using std::system;
 #endif
 
 
-extern void QuitLyX();
+extern void QuitLyX(bool);
 
 extern LyXServer * lyxserver;
 
@@ -271,7 +271,7 @@ void LyX::priv_exec(int & argc, char * argv[])
                if (last_loaded) {
                        bool success = false;
                        if (last_loaded->dispatch(batch_command, &success)) {
-                               QuitLyX();
+                               QuitLyX(false);
                                exit(!success);
                        }
                }
@@ -282,7 +282,7 @@ void LyX::priv_exec(int & argc, char * argv[])
                lyx_gui::start(batch_command, files);
        else {
                // Something went wrong above
-               QuitLyX();
+               QuitLyX(false);
                exit(EXIT_FAILURE);
        }
 }
index 6416713986ec2acf17785e508873608a6ba96c5e..6fefc131c90a3bfcc7854db223b1dee84928e91a 100644 (file)
@@ -197,11 +197,6 @@ LyXFont::LyXFont(LyXFont::FONT_INIT3, Language const * l)
 {}
 
 
-LyXFont::FONT_MISC_STATE LyXFont::underbar() const
-{
-       return bits.underbar;
-}
-
 
 LColor_color LyXFont::color() const
 {
@@ -215,12 +210,6 @@ Language const * LyXFont::language() const
 }
 
 
-LyXFont::FONT_MISC_STATE LyXFont::number() const
-{
-       return bits.number;
-}
-
-
 bool LyXFont::isRightToLeft() const
 {
        return lang->RightToLeft();
@@ -470,30 +459,30 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
                return *this;
        }
 
-       if (bits.family == INHERIT_FAMILY) {
+       if (bits.family == INHERIT_FAMILY)
                bits.family = tmplt.bits.family;
-       }
-       if (bits.series == INHERIT_SERIES) {
+
+       if (bits.series == INHERIT_SERIES)
                bits.series = tmplt.bits.series;
-       }
-       if (bits.shape == INHERIT_SHAPE) {
+
+       if (bits.shape == INHERIT_SHAPE)
                bits.shape = tmplt.bits.shape;
-       }
-       if (bits.size == INHERIT_SIZE) {
+
+       if (bits.size == INHERIT_SIZE)
                bits.size = tmplt.bits.size;
-       }
-       if (bits.emph == INHERIT) {
+
+       if (bits.emph == INHERIT)
                bits.emph = tmplt.bits.emph;
-       }
-       if (bits.underbar == INHERIT) {
+
+       if (bits.underbar == INHERIT)
                bits.underbar = tmplt.bits.underbar;
-       }
-       if (bits.noun == INHERIT) {
+
+       if (bits.noun == INHERIT)
                bits.noun = tmplt.bits.noun;
-       }
-       if (bits.color == LColor::inherit) {
+
+       if (bits.color == LColor::inherit)
                bits.color = tmplt.bits.color;
-       }
+
        return *this;
 }
 
@@ -580,11 +569,11 @@ LyXFont & LyXFont::setLyXShape(string const & sha)
        string const s = ascii_lowercase(sha);
 
        int i = 0;
-       while (LyXShapeNames[i] != s &&
-              LyXShapeNames[i] != string("error")) ++i;
-       if (s == LyXShapeNames[i]) {
+       while (LyXShapeNames[i] != s && LyXShapeNames[i] != string("error"))
+                       ++i;
+       if (s == LyXShapeNames[i])
                setShape(LyXFont::FONT_SHAPE(i));
-       else
+       else
                lyxerr << "LyXFont::setLyXShape: Unknown shape `"
                       << s << '\'' << endl;
        return *this;
@@ -596,8 +585,8 @@ LyXFont & LyXFont::setLyXSize(string const & siz)
 {
        string const s = ascii_lowercase(siz);
        int i = 0;
-       while (LyXSizeNames[i] != s &&
-              LyXSizeNames[i] != string("error")) ++i;
+       while (LyXSizeNames[i] != s && LyXSizeNames[i] != string("error"))
+               ++i;
        if (s == LyXSizeNames[i]) {
                setSize(LyXFont::FONT_SIZE(i));
        } else
@@ -704,24 +693,18 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont,
                              ostream & os) const
 {
        os << "\n";
-       if (orgfont.family() != family()) {
+       if (orgfont.family() != family())
                os << "\\family " << LyXFamilyNames[family()] << "\n";
-       }
-       if (orgfont.series() != series()) {
+       if (orgfont.series() != series())
                os << "\\series " << LyXSeriesNames[series()] << "\n";
-       }
-       if (orgfont.shape() != shape()) {
+       if (orgfont.shape() != shape())
                os << "\\shape " << LyXShapeNames[shape()] << "\n";
-       }
-       if (orgfont.size() != size()) {
+       if (orgfont.size() != size())
                os << "\\size " << LyXSizeNames[size()] << "\n";
-       }
-       if (orgfont.emph() != emph()) {
+       if (orgfont.emph() != emph())
                os << "\\emph " << LyXMiscNames[emph()] << "\n";
-       }
-       if (orgfont.number() != number()) {
+       if (orgfont.number() != number())
                os << "\\numeric " << LyXMiscNames[number()] << "\n";
-       }
        if (orgfont.underbar() != underbar()) {
                // This is only for backwards compatibility
                switch (underbar()) {
index 06eef154ea7efe1015a21df8d7a4644972ea64d9..58943b749b092c385caa35fb53d4cd849bc41ce8 100644 (file)
@@ -157,6 +157,28 @@ public:
                ALL_SANE
        };
 
+       struct FontBits {
+               ///
+               FONT_FAMILY family;
+               ///
+               FONT_SERIES series;
+               ///
+               FONT_SHAPE shape;
+               ///
+               FONT_SIZE size;
+               /** We store the LColor::color value as an int to get LColor.h out
+                *  of the header file.
+                */
+               int color;
+               ///
+               FONT_MISC_STATE emph;
+               ///
+               FONT_MISC_STATE underbar;
+               ///
+               FONT_MISC_STATE noun;
+               ///
+               FONT_MISC_STATE number;
+       };
        ///
        LyXFont();
 
@@ -178,46 +200,32 @@ public:
 
        /// Decreases font size by one
        LyXFont & decSize();
-
        /// Increases font size by one
        LyXFont & incSize();
-
        ///
-       FONT_FAMILY family() const;
-
+       FONT_FAMILY family() const { return bits.family; }
        ///
-       FONT_SERIES series() const;
-
+       FONT_SERIES series() const { return bits.series; }
        ///
-       FONT_SHAPE shape() const;
-
+       FONT_SHAPE shape() const { return bits.shape; }
        ///
-       FONT_SIZE size() const;
-
+       FONT_SIZE size() const { return bits.size; }
        ///
-       FONT_MISC_STATE emph() const;
-
+       FONT_MISC_STATE emph() const { return bits.emph; }
        ///
-       FONT_MISC_STATE underbar() const;
-
+       FONT_MISC_STATE underbar() const { return bits.underbar; }
        ///
-       FONT_MISC_STATE noun() const;
-
+       FONT_MISC_STATE noun() const { return bits.noun; }
        ///
-       FONT_MISC_STATE number() const;
-
+       FONT_MISC_STATE number() const { return bits.number; }
        ///
        LColor_color color() const;
-
        ///
        Language const * language() const;
-
        ///
        bool isRightToLeft() const;
-
        ///
        bool isVisibleRightToLeft() const;
-
        ///
        bool isSymbolFont() const;
 
@@ -316,28 +324,6 @@ public:
        /** Compaq cxx 6.5 requires that the definition be public so that
            it can compile operator==()
         */
-       struct FontBits {
-               ///
-               FONT_FAMILY family;
-               ///
-               FONT_SERIES series;
-               ///
-               FONT_SHAPE shape;
-               ///
-               FONT_SIZE size;
-               /** We store the LColor::color value as an int to get LColor.h out
-                *  of the header file.
-                */
-               int color;
-               ///
-               FONT_MISC_STATE emph;
-               ///
-               FONT_MISC_STATE underbar;
-               ///
-               FONT_MISC_STATE noun;
-               ///
-               FONT_MISC_STATE number;
-       };
 private:
        ///
        FontBits bits;
@@ -372,48 +358,6 @@ private:
 
 
 
-inline
-LyXFont::FONT_SHAPE LyXFont::shape() const
-{
-       return bits.shape;
-}
-
-
-inline
-LyXFont::FONT_FAMILY LyXFont::family() const
-{
-       return bits.family;
-}
-
-
-inline
-LyXFont::FONT_SERIES LyXFont::series() const
-{
-       return bits.series;
-}
-
-
-inline
-LyXFont::FONT_SIZE LyXFont::size() const
-{
-       return bits.size;
-}
-
-
-inline
-LyXFont::FONT_MISC_STATE LyXFont::emph() const
-{
-       return bits.emph;
-}
-
-
-inline
-LyXFont::FONT_MISC_STATE LyXFont::noun() const
-{
-       return bits.noun;
-}
-
-
 inline
 bool LyXFont::isSymbolFont() const
 {
index dd84ab6bd7d395d8e613848d9c73052b57c1f9dd..a679f52b4bb2ebd19bd10c2a03ca3f65b46f3ad4 100644 (file)
@@ -952,7 +952,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        break;
 
                case LFUN_QUIT:
-                       QuitLyX();
+                       QuitLyX(argument == "force");
                        break;
 
                case LFUN_TOCVIEW: {