+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
bool GView::on_delete_event(GdkEventAny * /*event*/)
{
- QuitLyX();
+ QuitLyX(false);
return true;
}
void QtView::closeEvent(QCloseEvent *)
{
- QuitLyX();
+ QuitLyX(false);
}
using std::string;
//extern void AutoSave(BufferView *);
-extern void QuitLyX();
+extern void QuitLyX(bool);
namespace lyx {
// Callback for close main form from window manager
int XFormsView::atCloseMainFormCB(FL_FORM *, void *)
{
- QuitLyX();
+ QuitLyX(false);
return FL_IGNORE;
}
}
-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);
/// 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);
///
#endif
-extern void QuitLyX();
+extern void QuitLyX(bool);
extern LyXServer * lyxserver;
if (last_loaded) {
bool success = false;
if (last_loaded->dispatch(batch_command, &success)) {
- QuitLyX();
+ QuitLyX(false);
exit(!success);
}
}
lyx_gui::start(batch_command, files);
else {
// Something went wrong above
- QuitLyX();
+ QuitLyX(false);
exit(EXIT_FAILURE);
}
}
{}
-LyXFont::FONT_MISC_STATE LyXFont::underbar() const
-{
- return bits.underbar;
-}
-
LColor_color LyXFont::color() const
{
}
-LyXFont::FONT_MISC_STATE LyXFont::number() const
-{
- return bits.number;
-}
-
-
bool LyXFont::isRightToLeft() const
{
return lang->RightToLeft();
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;
}
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;
{
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
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()) {
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();
/// 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;
/** 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;
-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
{
break;
case LFUN_QUIT:
- QuitLyX();
+ QuitLyX(argument == "force");
break;
case LFUN_TOCVIEW: {