]> git.lyx.org Git - features.git/commitdiff
new alert code
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 26 Nov 2001 10:19:58 +0000 (10:19 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 26 Nov 2001 10:19:58 +0000 (10:19 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3074 a592a061-630c-0410-9148-cb99ea01b6c8

92 files changed:
lib/CREDITS
po/POTFILES.in
src/BufferView2.C
src/BufferView_pimpl.C
src/ChangeLog
src/buffer.C
src/bufferlist.C
src/bufferlist.h
src/bufferview_funcs.C
src/converter.C
src/exporter.C
src/figure_form.C
src/frontends/Alert.C [new file with mode: 0644]
src/frontends/Alert.h [new file with mode: 0644]
src/frontends/Alert_pimpl.h [new file with mode: 0644]
src/frontends/ChangeLog
src/frontends/GUIRunTime.h
src/frontends/Makefile.am
src/frontends/controllers/ControlExternal.C
src/frontends/controllers/ControlPrint.C
src/frontends/controllers/ControlTexinfo.C
src/frontends/controllers/helper_funcs.C
src/frontends/gnome/FormPrint.C
src/frontends/qt2/GUIRunTime.C
src/frontends/qt2/QDocument.C
src/frontends/xforms/Alert_pimpl.C [new file with mode: 0644]
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/FormMathsBitmap.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/GUIRunTime.C
src/frontends/xforms/Makefile.am
src/frontends/xforms/form_aboutlyx.C
src/frontends/xforms/form_bibitem.C
src/frontends/xforms/form_bibtex.C
src/frontends/xforms/form_browser.C
src/frontends/xforms/form_character.C
src/frontends/xforms/form_citation.C
src/frontends/xforms/form_document.C
src/frontends/xforms/form_error.C
src/frontends/xforms/form_ert.C
src/frontends/xforms/form_external.C
src/frontends/xforms/form_filedialog.C
src/frontends/xforms/form_float.C
src/frontends/xforms/form_graphics.C
src/frontends/xforms/form_include.C
src/frontends/xforms/form_index.C
src/frontends/xforms/form_maths_deco.C
src/frontends/xforms/form_maths_delim.C
src/frontends/xforms/form_maths_matrix.C
src/frontends/xforms/form_maths_panel.C
src/frontends/xforms/form_maths_space.C
src/frontends/xforms/form_minipage.C
src/frontends/xforms/form_paragraph.C
src/frontends/xforms/form_preamble.C
src/frontends/xforms/form_preferences.C
src/frontends/xforms/form_print.C
src/frontends/xforms/form_ref.C
src/frontends/xforms/form_search.C
src/frontends/xforms/form_spellchecker.C
src/frontends/xforms/form_tabular.C
src/frontends/xforms/form_tabular_create.C
src/frontends/xforms/form_texinfo.C
src/frontends/xforms/form_thesaurus.C
src/frontends/xforms/form_toc.C
src/frontends/xforms/form_url.C
src/frontends/xforms/forms/fdfix.sh
src/frontends/xforms/input_validators.C
src/frontends/xforms/xforms_helpers.C
src/frontends/xforms/xforms_helpers.h
src/importer.C
src/insets/ChangeLog
src/insets/figinset.C
src/insets/insetert.C
src/insets/insetlabel.C
src/insets/insettabular.C
src/insets/insettext.C
src/layout.C
src/lyx_cb.C
src/lyx_gui_misc.C
src/lyx_gui_misc.h
src/lyx_main.C
src/lyxfind.C
src/lyxfunc.C
src/lyxvc.C
src/mathed/formula.C
src/print_form.C
src/support/filetools.C
src/support/path.C
src/support/path.h
src/tabular.C

index 3eef3e7f7d2e5df9a8eb0dd4f9e532a33e5d98e0..ad67d75c58d30f6c67d083437e1450442a58a97b 100644 (file)
 @iE-mail: cfog@mech.ubc.ca
    Support for two-column figure (figure*) and table (table*)
    environments.  Fixed minibuffer entry of floats.  
+@bPanayotis "PAP" Papasotiriou
+@iE-mail: papasot@physics.upatras.gr
+   support for kluwer document class.
 @bJoacim Persson
 @iE-mail: sp2joap1@ida.his.se
    po-file for Swedish, a tool for picking shortcuts,
index 525ba0e7c2aa86df339755ee9cdcfbd0dff7d32e..60d41c124159b8f7051a1773f439093efc496817 100644 (file)
@@ -74,6 +74,7 @@ src/frontends/qt2/QToc.C
 src/frontends/qt2/QURL.C
 src/frontends/qt2/QVCLog.C
 src/frontends/qt2/lengthcombo.C
+src/frontends/xforms/Alert_pimpl.C
 src/frontends/xforms/FileDialog.C
 src/frontends/xforms/FormAboutlyx.C
 src/frontends/xforms/FormBibitem.C
@@ -180,7 +181,6 @@ src/kbsequence.C
 src/language.C
 src/layout.C
 src/lyx_cb.C
-src/lyx_gui_misc.C
 src/lyx_main.C
 src/lyxfind.C
 src/lyxfont.C
index e9274995557b6aa9ebdcb987124a013cea92e630..9641a26017f0d7ef7483e8300f3f0e064a8fe64e 100644 (file)
@@ -23,7 +23,7 @@
 #include "support/FileInfo.h"
 #include "lyxscreen.h"
 #include "support/filetools.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
 #include "LaTeX.h"
 #include "BufferView_pimpl.h"
 #include "insets/insetcommand.h" //ChangeRefs
@@ -63,7 +63,7 @@ bool BufferView::insertLyXFile(string const & filen)
        FileInfo const fi(fname);
 
        if (!fi.readable()) {
-               WriteAlert(_("Error!"),
+               Alert::alert(_("Error!"),
                           _("Specified file is unreadable: "),
                           MakeDisplayPath(fname, 50));
                return false;
@@ -73,7 +73,7 @@ bool BufferView::insertLyXFile(string const & filen)
 
        ifstream ifs(fname.c_str());
        if (!ifs) {
-               WriteAlert(_("Error!"),
+               Alert::alert(_("Error!"),
                           _("Cannot open specified file: "),
                           MakeDisplayPath(fname, 50));
                return false;
index 3d4851e5099c29cbe7e80422527b0d1663e10260..fdbd79098c30d277606116fd14eae7d9b435c2e9 100644 (file)
@@ -28,6 +28,7 @@
 #include "support/LAssert.h"
 #include "support/lstrings.h"
 #include "frontends/Dialogs.h"
+#include "frontends/Alert.h"
 #include "insets/insetbib.h"
 #include "insets/insettext.h"
 /// added for Dispatch functions
@@ -1814,7 +1815,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                if (!label.empty()) {
                        //bv_->savePosition(0);
                        if (!bv_->gotoLabel(label))
-                               WriteAlert(_("Error"), 
+                               Alert::alert(_("Error"), 
                                           _("Couldn't find this label"), 
                                           _("in current document."));
                }
index 85507493f6f94470052514616a8ed95d707b132e..c921167f6fcd77571612860623e0982daf36b2a1 100644 (file)
@@ -1,3 +1,7 @@
+2001-11-23  John Levon  <moz@compsoc.man.ac.uk>
+
+       * <various>: change to use Alert.h 
+        
 2001-11-25  Dekel Tsur  <dekelts@tau.ac.il>
 
        * buffer.C (parseSingleLyXformat2Token): Insert an error inset
index 437ae91b6d5967c8c7affe4b452d3c4f74be466a..c9777568b1f7cd743167b087de6efd454a4b3ffb 100644 (file)
@@ -97,8 +97,8 @@
 #include "lyxtext.h"
 #include "gettext.h"
 #include "language.h"
-#include "lyx_gui_misc.h"      // WarnReadonly()
 #include "frontends/Dialogs.h"
+#include "frontends/Alert.h"
 #include "encoding.h"
 #include "exporter.h"
 #include "Lsstream.h"
@@ -234,9 +234,6 @@ void Buffer::setReadonly(bool flag)
                updateTitles();
                users->owner()->getDialogs()->updateBufferDependent(false);
        }
-       if (read_only) {
-               WarnReadonly(filename);
-       }
 }
 
 
@@ -365,7 +362,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
                        s += tostr(unknown_layouts);
                        s += _(" paragraphs");
                }
-               WriteAlert(_("Textclass Loading Error!"), s,
+               Alert::alert(_("Textclass Loading Error!"), s,
                           _("When reading " + fileName()));
        }
 
@@ -377,7 +374,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
                        s += tostr(unknown_tokens);
                        s += _(" unknown tokens");
                }
-               WriteAlert(_("Textclass Loading Error!"), s,
+               Alert::alert(_("Textclass Loading Error!"), s,
                           _("When reading " + fileName()));
        }
 
@@ -666,19 +663,19 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                if (pp.first) {
                        params.textclass = pp.second;
                } else {
-                       WriteAlert(string(_("Textclass error")), 
+                       Alert::alert(string(_("Textclass error")), 
                                string(_("The document uses an unknown textclass \"")) + 
                                lex.getString() + string("\"."),
                                string(_("LyX will not be able to produce output correctly.")));
                        params.textclass = 0;
                }
                if (!textclasslist.Load(params.textclass)) {
-                               // if the textclass wasn't loaded properly
-                               // we need to either substitute another
-                               // or stop loading the file.
-                               // I can substitute but I don't see how I can
-                               // stop loading... ideas??  ARRae980418
-                       WriteAlert(_("Textclass Loading Error!"),
+                       // if the textclass wasn't loaded properly
+                       // we need to either substitute another
+                       // or stop loading the file.
+                       // I can substitute but I don't see how I can
+                       // stop loading... ideas??  ARRae980418
+                       Alert::alert(_("Textclass Loading Error!"),
                                   string(_("Can't load textclass ")) +
                                   textclasslist.NameOfClass(params.textclass),
                                   _("-- substituting default"));
@@ -1537,14 +1534,14 @@ bool Buffer::readFile(LyXLex & lex, Paragraph * par)
                                // current format
                        } else if (file_format > LYX_FORMAT) {
                                // future format
-                               WriteAlert(_("Warning!"),
+                               Alert::alert(_("Warning!"),
                                           _("LyX file format is newer that what"),
                                           _("is supported in this LyX version. Expect some problems."));
                                
                        } else if (file_format < LYX_FORMAT) {
                                // old formats
                                if (file_format < 200) {
-                                       WriteAlert(_("ERROR!"),
+                                       Alert::alert(_("ERROR!"),
                                                   _("Old LyX file format found. "
                                                     "Use LyX 0.10.x to read this!"));
                                        return false;
@@ -1556,16 +1553,17 @@ bool Buffer::readFile(LyXLex & lex, Paragraph * par)
                        if (file_format < 213)
                                the_end = true;
 
-                       if (!the_end)
-                               WriteAlert(_("Warning!"),
+                       if (!the_end) {
+                               Alert::alert(_("Warning!"),
                                           _("Reading of document is not complete"),
                                           _("Maybe the document is truncated"));
+                       }
                        return true;
                } else { // "\\lyxformat" not found
-                       WriteAlert(_("ERROR!"), _("Not a LyX file!"));
+                       Alert::alert(_("ERROR!"), _("Not a LyX file!"));
                }
        } else
-               WriteAlert(_("ERROR!"), _("Unable to read file!"));
+               Alert::alert(_("ERROR!"), _("Unable to read file!"));
        return false;
 }
                    
@@ -1661,7 +1659,7 @@ bool Buffer::writeFile(string const & fname, bool flag) const
                        lyxerr << _("Error! Document is read-only: ")
                               << fname << endl;
                else
-                       WriteAlert(_("Error! Document is read-only: "),
+                       Alert::alert(_("Error! Document is read-only: "),
                                   fname);
                return false;
        }
@@ -1674,7 +1672,7 @@ bool Buffer::writeFile(string const & fname, bool flag) const
                        lyxerr << _("Error! Cannot write file: ")
                               << fname << endl;
                else
-                       WriteFSAlert(_("Error! Cannot write file: "),
+                       Alert::err_alert(_("Error! Cannot write file: "),
                                     fname);
                return false;
        }
@@ -1685,7 +1683,7 @@ bool Buffer::writeFile(string const & fname, bool flag) const
                        lyxerr << _("Error! Cannot open file: ")
                               << fname << endl;
                else
-                       WriteFSAlert(_("Error! Cannot open file: "),
+                       Alert::err_alert(_("Error! Cannot open file: "),
                                     fname);
                return false;
        }
@@ -1922,7 +1920,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
 {
        ofstream ofs(fname.c_str());
        if (!ofs) {
-               WriteFSAlert(_("Error: Cannot write file:"), fname);
+               Alert::err_alert(_("Error: Cannot write file:"), fname);
                return;
        }
        writeFileAscii(ofs, linelen);
@@ -1956,7 +1954,7 @@ void Buffer::makeLaTeXFile(string const & fname,
 
        ofstream ofs(fname.c_str());
        if (!ofs) {
-               WriteFSAlert(_("Error: Cannot open file: "), fname);
+               Alert::err_alert(_("Error: Cannot open file: "), fname);
                return;
        }
        
@@ -2537,7 +2535,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
        ofstream ofs(fname.c_str());
 
        if (!ofs) {
-               WriteAlert(_("LYX_ERROR:"), _("Cannot write file"), fname);
+               Alert::alert(_("LYX_ERROR:"), _("Cannot write file"), fname);
                return;
        }
 
@@ -2975,7 +2973,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
 {
        ofstream ofs(fname.c_str());
        if (!ofs) {
-               WriteAlert(_("LYX_ERROR:"), _("Cannot write file"), fname);
+               Alert::alert(_("LYX_ERROR:"), _("Cannot write file"), fname);
                return;
        }
 
@@ -3371,7 +3369,7 @@ int Buffer::runChktex()
        int res = chktex.run(terr); // run chktex
 
        if (res == -1) {
-               WriteAlert(_("chktex did not work!"),
+               Alert::alert(_("chktex did not work!"),
                           _("Could not run with file:"), name);
        } else if (res > 0) {
                // Insert all errors as errors boxes
index c5af8316686d4dea579960ac7a608988cf70db86..3d39fd6de8d0e2e79c4a19ae8c7cae577b04dc0a 100644 (file)
@@ -22,6 +22,7 @@
 #include <algorithm>
 #include <functional>
 
+#include "frontends/Alert.h"
 #include "bufferlist.h"
 #include "lyx_main.h"
 #include "support/FileInfo.h"
@@ -97,53 +98,58 @@ bool BufferList::empty() const
 }
 
 
+bool BufferList::qwriteOne(Buffer * buf, string const & fname, string & unsaved_list)
+{
+       bool reask = true;
+       while (reask) {
+               switch (Alert::askConfirmation(_("Changes in document:"),
+                                      fname,
+                                      _("Save document?"))) {
+               case 1: // Yes
+                       // FIXME: WriteAs can be asynch !
+                       if (buf->isUnnamed())
+                               reask = !WriteAs(current_view, buf);
+                       else {
+                               reask = !MenuWrite(current_view, buf);
+                       }
+                       break;
+               case 2: // No
+                       // if we crash after this we could
+                       // have no autosave file but I guess
+                       // this is really inprobable (Jug)
+                       if (buf->isUnnamed()) {
+                               removeAutosaveFile(buf->fileName());
+                       }
+                       unsaved_list += MakeDisplayPath(fname, 50) + "\n";
+                       return true;
+               case 3: // Cancel
+                       return false;
+               }
+       }
+       return false;
+}
+
 bool BufferList::qwriteAll()
 {
-        bool askMoreConfirmation = false;
+        bool are_unsaved = false;
         string unsaved;
        for (BufferStorage::iterator it = bstore.begin();
-           it != bstore.end(); ++it) {
+               it != bstore.end(); ++it) {
                if (!(*it)->isLyxClean()) {
                        string fname;
                        if ((*it)->isUnnamed())
                                fname = OnlyFilename((*it)->fileName());
                        else
                                fname = MakeDisplayPath((*it)->fileName(), 50);
-                       bool reask = true;
-                       while (reask) {
-                               switch (AskConfirmation(_("Changes in document:"),
-                                                      fname,
-                                                      _("Save document?"))) {
-                               case 1: // Yes
-                                       if ((*it)->isUnnamed())
-                                               reask = !WriteAs(current_view, (*it));
-                                       else {
-                                               reask = !MenuWrite(current_view, (*it));
-                                       }
-                                       break;
-                               case 2: // No
-                                       // if we crash after this we could
-                                       // have no autosave file but I guess
-                                       // this is really inprobable (Jug)
-                                       if ((*it)->isUnnamed()) {
-                                               removeAutosaveFile((*it)->fileName());
-                                       }
-                                       askMoreConfirmation = true;
-                                       unsaved += MakeDisplayPath(fname, 50);
-                                       unsaved += "\n";
-                                       reask = false;
-                                       break;
-                               case 3: // Cancel
-                                       return false;
-                               }
-                       }
+                       are_unsaved = qwriteOne(*it, fname, unsaved);
                }
        }
-        if (askMoreConfirmation &&
-            lyxrc.exit_confirmation &&
-            !AskQuestion(_("Some documents were not saved:"),
-                         unsaved, _("Exit anyway?"))) {
-                return false;
+        if (are_unsaved && lyxrc.exit_confirmation) {
+               return Alert::askQuestion(_("Some documents were not saved:"),
+                       unsaved, _("Exit anyway?"));
         }
 
         return true;
@@ -183,7 +189,7 @@ bool BufferList::close(Buffer * buf)
                        fname = MakeDisplayPath(buf->fileName(), 50);
                bool reask = true;
                while (reask) {
-                       switch (AskConfirmation(_("Changes in document:"),
+                       switch (Alert::askConfirmation(_("Changes in document:"),
                                               fname,
                                               _("Save document?"))){
                        case 1: // Yes
@@ -351,7 +357,7 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
        FileInfo fileInfo2(s);
 
        if (!fileInfo2.exist()) {
-               WriteAlert(_("Error!"), _("Cannot open file"), 
+               Alert::alert(_("Error!"), _("Cannot open file"), 
                        MakeDisplayPath(s));
                return 0;
        }
@@ -365,7 +371,7 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
        if (fileInfoE.exist() && fileInfo2.exist()) {
                if (fileInfoE.getModificationTime()
                    > fileInfo2.getModificationTime()) {
-                       if (AskQuestion(_("An emergency save of this document exists!"),
+                       if (Alert::askQuestion(_("An emergency save of this document exists!"),
                                        MakeDisplayPath(s, 50),
                                        _("Try to load that instead?"))) {
                                ts = e;
@@ -389,7 +395,7 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
                if (fileInfoA.exist() && fileInfo2.exist()) {
                        if (fileInfoA.getModificationTime()
                            > fileInfo2.getModificationTime()) {
-                               if (AskQuestion(_("Autosave file is newer."),
+                               if (Alert::askQuestion(_("Autosave file is newer."),
                                                MakeDisplayPath(s, 50),
                                                _("Load that one instead?"))) {
                                        ts = a;
@@ -461,7 +467,7 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
                        }
                }
                if (!templateok) {
-                       WriteAlert(_("Error!"), _("Unable to open template"), 
+                       Alert::alert(_("Error!"), _("Unable to open template"), 
                                   MakeDisplayPath(tname));
                        // no template, start with empty buffer
                        b->paragraph = new Paragraph;
@@ -492,7 +498,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
 
        // file already open?
        if (exists(s)) {
-               if (AskQuestion(_("Document is already open:"), 
+               if (Alert::askQuestion(_("Document is already open:"), 
                                MakeDisplayPath(s, 50),
                                _("Do you want to reload that document?"))) {
                        // Reload is accomplished by closing and then loading
@@ -523,7 +529,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
                if (LyXVC::file_not_found_hook(s)) {
                        // Ask if the file should be checked out for
                        // viewing/editing, if so: load it.
-                       if (AskQuestion(_("Do you want to retrieve file under version control?"))) {
+                       if (Alert::askQuestion(_("Do you want to retrieve file under version control?"))) {
                                // How can we know _how_ to do the checkout?
                                // With the current VC support it has to be,
                                // a RCS file since CVS do not have special ,v files.
@@ -531,7 +537,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
                                return loadLyXFile(filename, tolastfiles);
                        }
                }
-               if (AskQuestion(_("Cannot open specified file:"), 
+               if (Alert::askQuestion(_("Cannot open specified file:"), 
                                MakeDisplayPath(s, 50),
                                _("Create new document with this name?")))
                        {
index 952060507094263bfeb183f3720852d1eafb88d3..adb65fde2c4498cc3ed6200e4c6712d33316a9c1 100644 (file)
@@ -142,6 +142,9 @@ public:
        Buffer * getBuffer(unsigned int);
 
 private:
+       /// ask to save a buffer on quit
+       bool qwriteOne(Buffer * buf, string const & fname, string & unsaved_list); 
+
        ///
        BufferStorage bstore;
        
index b8f1b5eff9abbaad253efd262fd823c656548d03..87d2a294867d4fcd470f9e8c97479d3d6a4f7a6e 100644 (file)
@@ -19,7 +19,7 @@
 #include "BufferView.h"
 #include "paragraph.h"
 #include "lyxfont.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
 #include "lyxtext.h"
 #include "buffer.h"
 #include "support/lstrings.h"
@@ -68,7 +68,7 @@ void lang(BufferView * bv, string const & l)
                font.setLanguage(lang);
                toggleAndShow(bv, font);
        } else
-               WriteAlert(_("Error! unknown language"),l);
+               Alert::alert(_("Error! unknown language"),l);
 }
 
 
@@ -226,8 +226,7 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
                bv->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
 
                if (font.language() != ignore_language ||
-                   font.number() != LyXFont::IGNORE)
-               {
+                   font.number() != LyXFont::IGNORE) {
                        LyXCursor & cursor = text->cursor;
                        text->computeBidiTables(bv->buffer(), cursor.row());
                        if (cursor.boundary() != 
index 93e7957730b8b9343248acf3031b447f645bfc94..0250142766ff8247a749af0b4e2f2ef2c8e01553 100644 (file)
@@ -28,6 +28,7 @@
 #include "lyx_gui_misc.h"
 #include "lyx_cb.h" // ShowMessage()
 #include "support/lyxfunctional.h"
+#include "frontends/Alert.h"
 #include "gettext.h"
 #include "BufferView.h"
 #include "debug.h"
@@ -168,7 +169,7 @@ bool Formats::view(Buffer const * buffer, string const & filename,
            format->isChildFormat())
                format = getFormat(format->parentFormat());
        if (!format || format->viewer().empty()) {
-               WriteAlert(_("Cannot view file"),
+               Alert::alert(_("Cannot view file"),
                           _("No information for viewing ")
                           + prettyName(format_name));
                           return false;
@@ -198,7 +199,7 @@ bool Formats::view(Buffer const * buffer, string const & filename,
        int const res = one.startscript(Systemcalls::SystemDontWait, command);
 
        if (res) {
-               WriteAlert(_("Cannot view file"),
+               Alert::alert(_("Cannot view file"),
                           _("Error while executing"),
                           command.substr(0, 50));
                return false;
@@ -574,7 +575,7 @@ bool Converters::convert(Buffer const * buffer,
 
        EdgePath edgepath = getPath(from_format, to_format);
        if (edgepath.empty()) {
-               WriteAlert(_("Cannot convert file"),
+               Alert::alert(_("Cannot convert file"),
                           _("No information for converting from ")
                           + formats.prettyName(from_format) + _(" to ")
                           + formats.prettyName(to_format));
@@ -665,10 +666,10 @@ bool Converters::convert(Buffer const * buffer,
 
                        if (res) {
                                if (conv.to == "program")
-                                       WriteAlert(_("There were errors during the Build process."),
+                                       Alert::alert(_("There were errors during the Build process."),
                                                   _("You should try to fix them."));
                                else
-                                       WriteAlert(_("Cannot convert file"),
+                                       Alert::alert(_("Cannot convert file"),
                                                   "Error while executing",
                                                   command.substr(0, 50));
                                return false;
@@ -691,7 +692,7 @@ bool Converters::convert(Buffer const * buffer,
                        string to = subst(conv.result_dir,
                                          token_base, to_base);
                        if (!lyx::rename(from, to)) {
-                               WriteAlert(_("Error while trying to move directory:"),
+                               Alert::alert(_("Error while trying to move directory:"),
                                           from, ("to ") + to);
                                return false;
                        }
@@ -727,7 +728,7 @@ bool Converters::move(string const & from, string const & to, bool copy)
                                ? lyx::copy(from2, to2)
                                : lyx::rename(from2, to2);
                        if (!moved && no_errors) {
-                               WriteAlert(_("Error while trying to move file:"),
+                               Alert::alert(_("Error while trying to move file:"),
                                           from2, _("to ") + to2);
                                no_errors = false;
                        }
@@ -818,13 +819,13 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
                }
                string head;
                split(command, head, ' ');
-               WriteAlert(_("There were errors during running of ") + head,
+               Alert::alert(_("There were errors during running of ") + head,
                           s, t);
                return false;
        } else if (result & LaTeX::NO_OUTPUT) {
                string const s = _("The operation resulted in");
                string const t = _("an empty file.");
-               WriteAlert(_("Resulting file is empty"), s, t);
+               Alert::alert(_("Resulting file is empty"), s, t);
                return false;
        }
        return true;
@@ -872,7 +873,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
 
        // check return value from latex.run().
        if ((result & LaTeX::NO_LOGFILE)) {
-               WriteAlert(_("LaTeX did not work!"),
+               Alert::alert(_("LaTeX did not work!"),
                           _("Missing log file:"), name);
        } else if ((result & LaTeX::ERRORS)) {
                int num_errors = latex.getNumErrors();
@@ -886,12 +887,12 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
                        s += _(" errors detected.");
                        t = _("You should try to fix them.");
                }
-               WriteAlert(_("There were errors during the LaTeX run."),
+               Alert::alert(_("There were errors during the LaTeX run."),
                           s, t);
        }  else if (result & LaTeX::NO_OUTPUT) {
                string const s = _("The operation resulted in");
                string const t = _("an empty file.");
-               WriteAlert(_("Resulting file is empty"), s, t);
+               Alert::alert(_("Resulting file is empty"), s, t);
        }
 
        if (bv)
index 8cea7fd389807e3a73295cea54124bc7047d16a3..68922a87fd3356fe773bca1f7d13c0d636ce884b 100644 (file)
@@ -22,7 +22,7 @@
 #include "support/filetools.h"
 #include "lyxrc.h"
 #include "converter.h"
-#include "lyx_gui_misc.h" //WriteAlert
+#include "frontends/Alert.h"
 #include "gettext.h"
 
 using std::vector;
@@ -45,7 +45,7 @@ bool Exporter::Export(Buffer * buffer, string const & format,
                        }
                }
                if (backend_format.empty()) {
-                       WriteAlert(_("Cannot export file"),
+                       Alert::alert(_("Cannot export file"),
                                   _("No information for exporting to ")
                                   + formats.prettyName(format));
                        return false;
@@ -72,7 +72,7 @@ bool Exporter::Export(Buffer * buffer, string const & format,
        else if (backend_format == format)
                buffer->makeLaTeXFile(filename, string(), true);
        else if (contains(buffer->filepath, ' ')) {
-               WriteAlert(_("Cannot run latex."),
+               Alert::alert(_("Cannot run latex."),
                           _("The path to the lyx file cannot contain spaces."));
                return false;
        } else
index 2227be05490658257c1801fd5547453c0a0a6607..5a257d6411d6dcf8ddee82be3741c889e1696b51 100644 (file)
@@ -2,6 +2,7 @@
 #include <config.h>
 #include "lyx_gui_misc.h"
 #include "gettext.h"
+#include "frontends/xforms/xforms_helpers.h" 
 
 /* Form definition file generated with fdesign. */
 
diff --git a/src/frontends/Alert.C b/src/frontends/Alert.C
new file mode 100644 (file)
index 0000000..474d536
--- /dev/null
@@ -0,0 +1,88 @@
+/**
+ * \file Alert.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+#include <cerrno>
+#include "debug.h"
+#include "lyxrc.h" 
+#include "Alert_pimpl.h"
+
+using std::endl;
+
+namespace Alert {
+       void alert(string const & s1, string const & s2, string const & s3) {
+               if (!lyxrc.use_gui) {
+                       lyxerr << "----------------------------------------" << endl
+                              << s1 << endl << s2 << endl << s3 << endl
+                              << "----------------------------------------" << endl;
+               } else { 
+                       alert_pimpl(s1, s2, s3);
+               }
+       }
+
+       void err_alert(string const & s1, string const & s2) {
+               alert(s1, s2, strerror(errno));
+       }
+
+       bool askQuestion(string const & s1, string const & s2, string const & s3, bool default_value) {
+               if (!lyxrc.use_gui) {
+                               lyxerr << "----------------------------------------" << endl
+                                      << s1 << endl;
+                               if (!s2.empty())
+                                       lyxerr << s2 << endl;
+                               if (!s3.empty())
+                                       lyxerr << s3 << endl;
+                       lyxerr << "Assuming answer is "
+                              << (default_value ? "yes" : "no")
+                              << endl
+                              << "----------------------------------------" << endl;
+                       return default_value;
+               } else {
+                       return askQuestion_pimpl(s1, s2, s3);
+               }
+       }
+
+       int askConfirmation(string const & s1, string const & s2, string const & s3, int default_value) {
+               if (!lyxrc.use_gui) {
+                       lyxerr << "----------------------------------------" << endl
+                              << s1 << endl;
+                       if (!s2.empty())
+                                       lyxerr << s2 << endl;
+                       if (!s3.empty())
+                               lyxerr << s3 << endl;
+                       lyxerr << "Assuming answer is ";
+                       if (default_value == 1)
+                               lyxerr << "yes";
+                       else if (default_value == 2)
+                               lyxerr << "no";
+                       else
+                               lyxerr << "cancel";
+                       lyxerr << endl
+                              << "----------------------------------------" << endl;
+                       return default_value;
+               } else {
+                       return askConfirmation_pimpl(s1, s2, s3);
+               }
+       }
+       std::pair<bool, string> const askForText(string const & msg, string const & dflt) {
+               if (!lyxrc.use_gui) {
+                       lyxerr << "----------------------------------------" << endl
+                              << msg << endl
+                              << "Assuming answer is " << dflt
+                              << "----------------------------------------" << endl;
+                       return std::make_pair<bool, string>(true, dflt);
+               } else {
+                       return askForText_pimpl(msg, dflt);
+               }
+       }
+}
diff --git a/src/frontends/Alert.h b/src/frontends/Alert.h
new file mode 100644 (file)
index 0000000..ead6f8a
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * \file Alert.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include "support/lstrings.h"
+#include <algorithm>
+namespace Alert {
+       /// show an alert message
+       void alert(string const & s1, string const & s2 = string(), 
+               string const & s3 = string());
+
+       /// show an alert message and strerror(errno)
+       void err_alert(string const & s1, string const & s2 = string());
+
+       /// ask a question 
+       bool askQuestion(string const & s1, string const & s2 = string(),
+                string const & s3 = string(), bool default_value = true);
+
+       /// Returns 1 for yes, 2 for no, 3 for cancel.
+       int askConfirmation(string const & s1, string const & s2 = string(), 
+               string const & s3 = string(), int default_value = 1);
+       /// Asks for a text
+       std::pair<bool, string> const askForText(string const & msg, 
+               string const & dflt = string());
+};
diff --git a/src/frontends/Alert_pimpl.h b/src/frontends/Alert_pimpl.h
new file mode 100644 (file)
index 0000000..cedbde7
--- /dev/null
@@ -0,0 +1,15 @@
+/**
+ * \file Alert_pimpl.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include "debug.h"
+// GUI-specific implementations
+void alert_pimpl(string const & s1, string const & s2, string const & s3);
+bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3);
+int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3);
+std::pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt);
index a6543aa6cdae058e71bdd191dc0b60ec16c23b0b..62b95805ae355c9b8c9fc21c137d104fac9377bc 100644 (file)
@@ -1,3 +1,10 @@
+2001-11-22  John Levon  <moz@compsoc.man.ac.uk>
+
+       * Makefile.am: 
+       * Alert.h:
+       * Alert.C:
+       * Alert_pimpl.h: alerts etc.
+
 2001-10-09  Herbert Voss  <voss@perce.de>
 
        * Dialogs.h: added showFile and showTexinfo signals.
index 48694441b7d7c4b6b1c7174c1bc86146ebd54ee3..5bfc5c57cbded9e664f023b34999acb8c66b875a 100644 (file)
@@ -53,5 +53,8 @@ public:
        /// The current visual depth
        static
        int x11VisualDepth();
+       /// the server's DPI estimate
+       static
+       float getScreenDPI(); 
 };
 #endif
index 7a441b7774d6603edf05794c6d84633477e144f9..5072965fbad6c9426c923a766f368195576cfe91 100644 (file)
@@ -20,6 +20,9 @@ libfrontends_la_DEPENDENCIES = @FRONTEND_GUILIB@ \
        controllers/libcontrollers.la
 
 libfrontends_la_SOURCES=\
+       Alert.C \
+       Alert.h \
+       Alert_pimpl.h \
        Dialogs.C \
        Dialogs.h \
        DialogBase.h \
index 73e5433df1b66a6d4c16f7390908d221bfa1b249..f9e357f5660b0672dc95916354decb2fa764a62e 100644 (file)
@@ -32,7 +32,7 @@
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "frontends/FileDialog.h"
-#include "lyx_gui_misc.h" // WriteAlert
+#include "frontends/Alert.h"
 #include "gettext.h"
 #include "BufferView.h"
 
@@ -193,7 +193,7 @@ string const ControlExternal::Browse(string const & input) const
                    contains(p, "~") ||
                    contains(p, "$") ||
                    contains(p, "%")) {
-                       WriteAlert(_("Filename can't contain any "
+                       Alert::alert(_("Filename can't contain any "
                                     "of these characters:"),
                                   // xgettext:no-c-format
                                   _("'#', '~', '$' or '%'."));
index a9fb35a0c3e0ffd69d845c90202e71914f11730e..cd9cb263c41e40be510a050418ee3ea2089df4b9 100644 (file)
@@ -28,7 +28,7 @@
 #include "PrinterParams.h"
 #include "Liason.h"
 #include "helper_funcs.h" // browseFile
-#include "lyx_gui_misc.h" // WriteAlert
+#include "frontends/Alert.h"
 #include "gettext.h"
 #include "BufferView.h"
 #include "support/LAssert.h"
@@ -53,7 +53,7 @@ void ControlPrint::apply()
        view().apply();
 
        if (!printBuffer(lv_.buffer(), params())) {
-               WriteAlert(_("Error:"),
+               Alert::alert(_("Error:"),
                           _("Unable to print"),
                           _("Check that your parameters are correct"));
        }
index 5dccb1afbd7f43511ab2f40d0ad2409371751902..ce4ddbb91ec3cc71a7597265e08198514e950002 100644 (file)
@@ -58,7 +58,7 @@ void ControlTexinfo::runTexhash() const
        //path to texhash through system
        Systemcalls one(Systemcalls::System,"texhash"); 
        p.pop();
-//     WriteAlert(_("texhash run!"), 
+//     Alert::alert(_("texhash run!"), 
 //                _("rebuilding of the TeX-tree could only be successfull"),
 //                _("if you have had user-write-permissions to the tex-dir."));
 }
index 91b07996c204ae6683dde9a947eb8d10606c27bc..d3fdf4435ebb63d9277bae475381ee141553aef2 100644 (file)
@@ -25,7 +25,7 @@
 #include "support/filetools.h" // OnlyPath, OnlyFilename
 #include "support/lstrings.h"
 #include "gettext.h" // _()
-#include "lyx_gui_misc.h" // WriteAlert
+#include "frontends/Alert.h"
 
 using std::pair;
 using std::vector;
@@ -99,7 +99,7 @@ string const browseFile(LyXView * lv, string const & filename,
                if (result.second.find_first_of("#~$% ") == string::npos)
                        break; 
  
-               WriteAlert(_("Filename can't contain any "
+               Alert::alert(_("Filename can't contain any "
                        "of these characters:"),
                        _("space, '#', '~', '$' or '%'."));
        }
index 960fb064291dcd8d366622f0cc8ba51d7a13185b..d2ee57de3b9f5f75a43c1ecddcb0a11cfccc9e5a 100644 (file)
@@ -154,7 +154,7 @@ void FormPrint::apply()
                                 copies_unsorted_->get_active(),
                                 copies_count_->get_value_as_int())))
     {
-      WriteAlert(_("Error:"),
+      Alert::alert(_("Error:"),
                 _("Unable to print"),
                 _("Check that your parameters are correct"));
     }
index 564afc25929b8b2a9248559ccbc77f74bfe95adc..4692ba0729d400f844e8b8bf1e47b33dbde4fa67 100644 (file)
@@ -118,6 +118,14 @@ int GUIRunTime::x11VisualDepth()
 }
 
  
+float GUIRunTime::getScreenDPI()
+{
+       Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
+       return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
+               (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2;
+}
+
 void GUIRunTime::setDefaults() 
 {
        FL_IOPT cntl;
index 920a7f2cc1999668a0a8fa8a54f994ad701d33e1..88906d724ff143b888d2c3a7cfdba3752b6d043a 100644 (file)
@@ -362,14 +362,14 @@ bool QDocument::class_apply()
                                        s += tostr(ret);
                                        s += _(" paragraphs couldn't be converted");
                                }
-                               WriteAlert(_("Conversion Errors!"),s,
+                               Alert::alert(_("Conversion Errors!"),s,
                                           _("into chosen document class"));
                        }
 
                        params.textclass = new_class;
                } else {
                        // problem changing class -- warn user and retain old style
-                       WriteAlert(_("Conversion Errors!"),
+                       Alert::alert(_("Conversion Errors!"),
                                   _("Errors loading new document class."),
                                   _("Reverting to original document class."));
                        dialog_->docClassCO->setCurrentItem( params.textclass );
@@ -993,7 +993,7 @@ void QDocument::CheckChoiceClass(FL_OBJECT * ob, long)
                BufferParams params = lv_->buffer()->params;
 
                if (params.textclass != tc
-                       && AskQuestion(_("Should I set some parameters to"),
+                       && Alert::askQuestion(_("Should I set some parameters to"),
                                   _("the defaults of this document class?"))) {
                        params.textclass = tc;
                        params.useClassDefaults();
@@ -1001,7 +1001,7 @@ void QDocument::CheckChoiceClass(FL_OBJECT * ob, long)
                }
        } else {
                // unable to load new style
-               WriteAlert(_("Conversion Errors!"),
+               Alert::alert(_("Conversion Errors!"),
                           _("Unable to switch to new document class."),
                           _("Reverting to original document class."));
                combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1);
diff --git a/src/frontends/xforms/Alert_pimpl.C b/src/frontends/xforms/Alert_pimpl.C
new file mode 100644 (file)
index 0000000..33436e3
--- /dev/null
@@ -0,0 +1,61 @@
+/**
+ * \file Alert_pimpl.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+
+#include FORMS_H_LOCATION
+#include <algorithm>
+#include <gettext.h>
+#include "xforms_helpers.h"
+#include "Alert.h"
+#include "Alert_pimpl.h" 
+using std::pair;
+using std::make_pair;
+
+void alert_pimpl(string const & s1, string const & s2, string const & s3)
+{
+       fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
+       fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
+}
+
+
+bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3)
+{
+       fl_set_resource("flQuestion.yes.label", idex(_("Yes|Yy#y")));
+       fl_set_resource("flQuestion.no.label", idex(_("No|Nn#n")));
+       return fl_show_question((s1 + "\n" + s2 + "\n" + s3).c_str(), 0);
+}
+
+
+int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3)
+{
+       fl_set_choices_shortcut(scex(_("Yes|Yy#y")),
+                               scex(_("No|Nn#n")),
+                               scex(_("Cancel|^[")));
+        return fl_show_choice(s1.c_str(), s2.c_str(), s3.c_str(), 
+                             3, idex(_("Yes|Yy#y")),
+                             idex(_("No|Nn#n")),
+                              idex(_("Cancel|^[")), 3);
+}
+
+
+pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt)
+{
+       fl_set_resource("flInput.cancel.label", idex(_("Cancel|^[")));
+       fl_set_resource("flInput.ok.label", idex(_("OK|#O")));
+       fl_set_resource("flInput.clear.label", idex(_("Clear|#e")));
+       char const * tmp = fl_show_input(msg.c_str(), dflt.c_str());
+       if (tmp != 0)
+         return make_pair<bool, string>(true, string(tmp));
+       else
+         return make_pair<bool, string>(false, string());
+}
index fd9e228572131db9071870168ab93ff2e0803479..efbb13730a34bbf66994d4926a8c07fbaaec59ed 100644 (file)
@@ -1,3 +1,14 @@
+2001-11-23  John Levon  <moz@compsoc.man.ac.uk>
+
+       * Makefile.am:
+       * Alert_pimpl.C: Alert etc.
+
+       * xforms_helpers.h:
+       * xforms_helpers.C:
+       * forms/fdfix.sh: move idex etc. to here
+
+       * GUIRunTime.C: move getScreenDPI() to here
 2001-11-20  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * forms/form_ref.fd, form_preferences.fd, form_citation.fd,
index ef32b626ad2722daf31d90452a4ca64c0470c5b3..24246d1049acc07371e6db73b785f5b12f428181 100644 (file)
@@ -18,8 +18,8 @@
 #pragma implementation
 #endif
 
-#include "lyx_gui_misc.h"
-
+#include "Alert.h"
 #include "FormDocument.h"
 #include "form_document.h"
 #include "Dialogs.h"
@@ -378,7 +378,7 @@ namespace {
 */
 bool saveParamsAsDefault(BufferParams const &params)
 {
-       if (!AskQuestion(_("Do you want to save the current settings"),
+       if (!Alert::askQuestion(_("Do you want to save the current settings"),
                         _("for the document layout as default?"),
                         _("(they will be valid for any new document)")))
                return false;
@@ -754,13 +754,13 @@ bool FormDocument::class_apply()
                                        s += tostr(ret);
                                        s += _(" paragraphs couldn't be converted");
                                }
-                               WriteAlert(_("Conversion Errors!"),s,
+                               Alert::alert(_("Conversion Errors!"),s,
                                           _("into chosen document class"));
                        }
                        
                } else {
                        // problem changing class -- warn user and retain old style
-                       WriteAlert(_("Conversion Errors!"),
+                       Alert::alert(_("Conversion Errors!"),
                                   _("Errors loading new document class."),
                                   _("Reverting to original document class."));
                        combo_doc_class->select(int(old_class) + 1);
@@ -1396,7 +1396,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
                }
        } else {
                // unable to load new style
-               WriteAlert(_("Conversion Errors!"),
+               Alert::alert(_("Conversion Errors!"),
                           _("Unable to switch to new document class."),
                           _("Reverting to original document class."));
                combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1);
index 3dc62330087ecef9d7486019c590133e8e63bf50..70a3094fcf127e56b2d6fc622ff58a268db6e99a 100644 (file)
@@ -21,7 +21,7 @@ using std::map;
 using std::max;
 using std::sort;
 
-#include "lyx_gui_misc.h" // for WriteFSAlert
+#include "frontends/Alert.h"
 #include "support/FileInfo.h"
 #include "support/lyxlib.h"
 #include "support/lstrings.h"
@@ -223,7 +223,7 @@ void FileDialog::Private::Reread()
        // Opens directory
        DIR * pDirectory = ::opendir(pszDirectory.c_str());
        if (!pDirectory) {
-               WriteFSAlert(_("Warning! Couldn't open directory."),
+               Alert::err_alert(_("Warning! Couldn't open directory."),
                             pszDirectory);
                pszDirectory = lyx::getcwd();
                pDirectory = ::opendir(pszDirectory.c_str());
@@ -389,7 +389,7 @@ void FileDialog::Private::SetDirectory(string const & Path)
        // must check the directory exists
        DIR * pDirectory = ::opendir(tmp.c_str());
        if (!pDirectory) {
-               WriteFSAlert(_("Warning! Couldn't open directory."), tmp);
+               Alert::err_alert(_("Warning! Couldn't open directory."), tmp);
        } else {
                ::closedir(pDirectory);
                pszDirectory = tmp;
index 0239867db3dee3fc6a94dabf71b713989bd78db6..51a960223d3d8eb25994f1ce09894700291d3be9 100644 (file)
@@ -24,7 +24,7 @@
 #include "LyXView.h"
 #include "bmtable.h"
 #include "debug.h"
-#include "lyx_gui_misc.h" // scex, idex
+#include "xforms_helpers.h"
 #include "gettext.h"
 #include "support/LAssert.h"
 
index 9027b8e74cb669b464a0742ef9add277eb6a565f..083a47c27b480e9f8b762888f79e0ab2678fe936 100644 (file)
@@ -38,7 +38,6 @@
 #include "debug.h"
 #include "support/filetools.h"
 #include "support/LAssert.h"
-#include "lyx_gui_misc.h" // idex, scex
 #include "lyxlex.h"
 #include "input_validators.h"
 #include "xforms_helpers.h"
index ae3c7fabfc5d063c069731b2359bb98b8b00c205..9d4305856ad91255adf62d93be521e0dc5756d73 100644 (file)
@@ -144,3 +144,10 @@ int GUIRunTime::x11VisualDepth()
 {
        return fl_get_visual_depth();
 }
+
+float GUIRunTime::getScreenDPI()
+{
+       Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
+       return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
+               (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2;
+}
index b5d112021eb1fec86f824e3b485a1b83590ec547..e9fcdf2bd19600bd3f40875d40564ebd5fe3ad2d 100644 (file)
@@ -13,6 +13,7 @@ LYXDATADIRS = forms
 ETAGS_ARGS = --lang=c++
 # Alphabetical order please.  It makes it easier to figure out what's missing. 
 libxforms_la_SOURCES = \
+       Alert_pimpl.C \
        bmtable.c \
        bmtable.h \
        Color.C \
index 90631bdbf0dee94485f6fdea6defedbe60df84d6..3af800144f95652773b38947255f409f50295aac 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index a2ffad5524cf07f347c24ac8d13d338f96dd49e8..d4cb2a397e33ed239c84a3b7a62d4bd0a7bb83bb 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 8113b90097651a31e81ba34ec87712f129a1b37b..2cb9d195b4546d2fecab81eb4a8fd5bf7b779092 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 326e955295c534325dda9b87a0c0d79763581698..1461173f759751cbd103804781a3f690aae2b9b9 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 99c089f438c6135df2fddb70753a37eaa39c78c0..73158cb025dfb5b9d77b4c249dd62b41ed9473d2 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 63fc203535f2641b063cef9dce17018d24387b62..e1283163ef8eb32c0779dd8ae7b4ab83aeea9fa3 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 8ddd56e37c54e2f0ecf837d4c8f60b0a3b9f6e54..2d9d63bbfa81e9817d7d466f172e98792c06283b 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 #include "bmtable.h"
 
index 591fa980fdc825bc5992b0cf0278a4625db4b7a1..04d7c200d20b5ab89d7e97a5c0f7e2223d4f257e 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index e310e2301ec664b0d500fe2285a1466177934236..aa5274bb036951b5edb60b5c7cc6eca54c86ecfd 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 42a2aeb88bcf7e541c3d35abe3248bcf60e88cd6..3c50ba861d53b70785cd4afa7a645d01512c3d37 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 3753d0046c025d0235d38d5d62c389cdc9e03d6e..5ddce8508940d2cf289c88c91a7429dadcb1e05a 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 342dbca0d5577ff86d75b606c063d55bf846bbc7..f4c073b5d7fe76e0ff64affa485736ade0301708 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index e8933410e6fb774194642a6ca7c38cf31d685f51..17c0778b3c7bd90a724d96b5bcfb48e87809a11d 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 1ebc27fdd02689bade5a52242279655d4f7b7168..113e53d246992e075a985fc82cd55ef942823dad 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index a1ff9c7b37cea22e1e5e90a7aab2a958c523388e..1ee1a363dfd5b8e5d284fcac4e6b09a699a058d6 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 27dab33de14992b380de2cfd86f08d9192a97637..f42c57fa2a526db9f7f0bdfd90e5d90d8921b38a 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 #include "bmtable.h"
 
index 19abad27d5265ba2516bdf73f6d423f2e4f3bf7d..6bbcb5115ec008fb4f53296cfd0100ab2b82b5c9 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 #include "bmtable.h"
 
index 2347431cfbf507287c91de3e2a52e4fc5d3eedaa..53c52ad519ebb13e8ab2b73e494853f6b1a1470a 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 29cfe4e123589024f46d2a69cb0f5c5de9c957ec..10effbce9180ece63f20b34b92f98714169cfbdc 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 931a3361081a06882ca36f7b7bc5f0a3f4b1975b..e3b9e2788c5c2cc2c999ec06e700d8fd8a6dea14 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index d706c63a3078d955a8f20df92d392d5bd7998250..1d9e30ded4283aea69f3b8d06cea31d4f1f00f02 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 9635d4d09fa6712a2f9fa5f1de1ea52535aa9c91..2fc61655ab9ae9cfd5f0d2c53365a99066ca0ac2 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 85e301e14b607ed7fd663038b28c83c76a64103e..39502e2df8ce6b9d6d72412be67c1e2fd8f3f7f4 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 4762431ff5b9fc54e07153906919e99226782b7d..19ccb6eacba9f1b5387f03cbf66c39820abfaa42 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 13b01f751df1678bc2ef67673975e0434f260b81..1fcf4a7e78b21bcd5b583eed487848d825ec81af 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index bc03e354d46667fb911ec027eccca7cbe713aa03..0986d4d944107e15837ca3d9bec60803e0c627e2 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 00bd8ba0ab58fb91da0d4c38c9d7d6a945eaa28f..5b496f703822ff587309d03fede392884c743343 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 6afe9d1ea5f14dd7448cf1460f12174a7718496b..6892eed544894a4627022e10cf96663f1bc28007 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 76eb5af3a368c88bd45fed8ed527d99043ce919d..f65d0d2d3cef68b164bba212f2e52c194049f0ac 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 80d46292c09fb72f774997547ce035f6491e5fc9..e30cb99202b8190af463dba12d35ec898a9e50bb 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 4b94255af5b53b2a263d8e4c0ad37a6fd55bdeb7..397680ae986f64e3886381732b1e142db2e64480 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 37139174004d210b4ebd0d76fb3c1ffaa706670d..bc1d5e56a4a998925d7e4678ba30e03e9bdc8435 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 46538a0e389634d05a3258ce7468c88631055a25..bb90e84b5862b164b2d33c49c57f6214daa4dbfc 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 4d5e4b002e13eadaed4b519a2f47cb4bc031ba00..63a443622bb4664d57d41c8825e14314f4abbc52 100644 (file)
@@ -1,6 +1,6 @@
 // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext
 #include <config.h>
-#include "lyx_gui_misc.h"
+#include "xforms_helpers.h"
 #include "gettext.h"
 
 /* Form definition file generated with fdesign. */
index 8579e3e1c856508e26f3363ad5c6c8e4316bd6bd..217b88f9c81cf398c8fccfacd247fcf660f74058 100644 (file)
@@ -67,7 +67,7 @@ sed -e "s/CLASSNAME/$CLASSNAME/" < $FDFIXC > $FDFIXC_MOD
 # Modify .c file for use by LyX
 echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $COUT
 echo "#include <config.h>" >> $COUT
-echo "#include \"lyx_gui_misc.h\"" >> $COUT
+echo "#include \"xforms_helpers.h\"" >> $COUT
 echo "#include \"gettext.h\"" >> $COUT
 
 grep bmtable $CIN > /dev/null
index f22740e67e859b685381454f0f939f129fdc5a67..cc237bf3de7e312d5ae97f86a7538f3cb579f439 100644 (file)
@@ -119,7 +119,7 @@ void fl_print_range_filter(FL_OBJECT * ob,
                piece = strip(piece) ;
                piece = frontStrip(piece) ;
                if (!stringOnlyContains (piece, "0123456789-")) {
-                       WriteAlert(_("ERROR!  Unable to print!"),
+                       Alert::alert(_("ERROR!  Unable to print!"),
                                   _("Check 'range of pages'!"));
                        return;
                }
index 5a0271c9b4f6de579567b34d49cc6227771b760e..03f34eeae5f480d3ffac02418e1d8702c5e718ea 100644 (file)
@@ -24,6 +24,42 @@ using std::ofstream;
 using std::pair;
 using std::vector;
 
+// Extract shortcut from <ident>|<shortcut> string
+char const * flyx_shortcut_extract(char const * sc)
+{
+       // Find '|' in the sc and return the string after that.
+       register char const * sd = sc;
+       while(sd[0]!= 0 && sd[0] != '|') ++sd;
+
+       if (sd[0] == '|') {
+               ++sd;
+               //lyxerr << sd << endl;
+               return sd;
+       }
+       return "";
+}
+
+
+// Extract identifier from <ident>|<shortcut> string
+char const * flyx_ident_extract(char const * sc)
+{
+       register char const * se = sc;
+       while(se[0]!= 0 && se[0] != '|') ++se;
+
+       if (se[0] == 0) return sc;
+       
+       char * sb = new char[se - sc + 1];
+       int index = 0;
+       register char const * sd = sc;
+       while (sd != se) {
+               sb[index] = sd[0];
+               ++index; ++sd;
+       }
+       sb[index] = 0;
+       return sb;
+}
+
+
 // Set an FL_OBJECT to activated or deactivated
 void setEnabled(FL_OBJECT * ob, bool enable)
 {
index 8604faa9c7d346f14a1ec337bd8d649402ac0f3e..f17fdd07585b03a98a51b9a38a1e7204bb6cbdc5 100644 (file)
@@ -7,7 +7,24 @@
 #pragma interface
 #endif
 
+#include <config.h>
+#include FORMS_H_LOCATION
 #include "Color.h"
+#include "support/lstrings.h"
+#include <vector>
+
+/// Extract shortcut from <ident>|<shortcut> string
+char const * flyx_shortcut_extract(char const * sc);
+/// Shortcut for flyx_shortcut_extract
+#define scex flyx_shortcut_extract
+
+/// Extract shortcut from <ident>|<shortcut> string
+char const * flyx_ident_extract(char const * sc);
+/// Shortcut for flyx_ident_extract
+#define idex flyx_ident_extract
 
 /// Set an FL_OBJECT to activated or deactivated
 void setEnabled(FL_OBJECT *, bool enable);
index 961cb23b8b5ff55f40a3e74d95463b352a9a98d6..65c3ce185ce8af390fb736a275e53ea5a155d225 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "bufferlist.h"
 #include "support/filetools.h"
-#include "lyx_gui_misc.h" //WriteAlert
+#include "frontends/Alert.h"
 #include "gettext.h"
 #include "BufferView.h"
 
@@ -58,7 +58,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
                        }
                }
                if (loader_format.empty()) {
-                       WriteAlert(_("Cannot import file"),
+                       Alert::alert(_("Cannot import file"),
                                   _("No information for importing from ")
                                   + formats.prettyName(format));
                        return false;
index 6b93fa563589b91b5e62a4f9b60e980c48b1f904..c6909bac7425d8d015c78f8e12a74dde0b360594 100644 (file)
@@ -1,3 +1,7 @@
+2001-11-23  John Levon  <moz@compsoc.man.ac.uk>
+
+       * various: update for Alert.h
 2001-11-22  John Levon  <moz@compsoc.man.ac.uk>
 
        * inset.h: fix comment
index 2c6352033f6aaf6bb7a49dd30a0e585f15facf6d..659e489c974d3ab9867014ab15c571ce16c17d33 100644 (file)
@@ -56,6 +56,7 @@
 #include "lyxrc.h"
 #include "gettext.h"
 #include "lyx_gui_misc.h" // CancelCloseBoxCB
+#include "frontends/Alert.h" 
 #include "support/FileInfo.h"
 #include "support/lyxlib.h"
 #include "support/os.h"
@@ -1218,17 +1219,11 @@ string const InsetFig::editMessage() const
 }
 
 
-void InsetFig::edit(BufferView * bv, int, int, unsigned int)
+void InsetFig::edit(BufferView *, int, int, unsigned int)
 {
        lyxerr[Debug::INFO] << "Editing InsetFig." << endl;
        regenerate();
 
-       // We should have RO-versions of the form instead.
-       // The actual prevention of altering a readonly doc
-       // is done in CallbackFig()
-       if (bv->buffer()->isReadonly()) 
-               WarnReadonly(bv->buffer()->fileName());
-
        if (!form) {
                form = create_form_Figure();
                fl_set_form_atclose(form->Figure, CancelCloseBoxCB, 0);
@@ -2004,7 +1999,7 @@ void InsetFig::browseFile()
                
                if (contains(p, "#") || contains(p, "~") || contains(p, "$")
                    || contains(p, "%") || contains(p, " ")) {
-                       WriteAlert(_("Filename can't contain any "
+                       Alert::alert(_("Filename can't contain any "
                                     "of these characters:"),
                                   // xgettext:no-c-format
                                   _("space, '#', '~', '$' or '%'.")); 
index f1bef0a34f01e0646536ec8b19aecc9c97559c36..4aeb306f0be4ef5bd404b3fdcbe6783e1e8feda7 100644 (file)
@@ -24,6 +24,7 @@
 #include "LyXView.h"
 #include "lyxtext.h"
 #include "frontends/Dialogs.h"
+#include "frontends/Alert.h"
 #include "debug.h"
 
 using std::ostream;
@@ -232,7 +233,7 @@ void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
        // if selectall is activated then the fontchange was an outside general
        // fontchange and this messages is not needed
        if (!selectall)
-               WriteAlert(_("Impossible Operation!"),
+               Alert::alert(_("Impossible Operation!"),
                           _("Not permitted to change font-types inside ERT-insets!"),
                           _("Sorry."));
 }
index b7065f4a8d5ff5758a2f327909176d4f0af4d397..590b50a65dd85f6a5218a630da96d86c7524a6c1 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "insetlabel.h"
 #include "support/LOstream.h"
-#include "lyx_gui_misc.h"     //askForText
+#include "frontends/Alert.h"
 #include "support/lstrings.h" //frontStrip, strip
 #include "lyxtext.h"
 #include "buffer.h"
@@ -44,12 +44,7 @@ vector<string> const InsetLabel::getLabelList() const
 
 void InsetLabel::edit(BufferView * bv, int, int, unsigned int)
 {
-       if (bv->buffer()->isReadonly()) {
-               WarnReadonly(bv->buffer()->fileName());
-               return;
-       }
-
-       pair<bool, string> result = askForText(_("Enter label:"), getContents());
+       pair<bool, string> result = Alert::askForText(_("Enter label:"), getContents());
        if (result.first) {
                string new_contents = frontStrip(strip(result.second));
                if (!new_contents.empty() &&
index 2d482028e2c36e121cf68abeb97bbb4444e3e038..fa5becf69e8a3b9f4ac04ef7cbecca0c11bbd767 100644 (file)
@@ -34,6 +34,7 @@
 #include "LyXView.h"
 #include "insets/insettext.h"
 #include "frontends/Dialogs.h"
+#include "frontends/Alert.h"
 #include "debug.h"
 #include "WorkArea.h"
 #include "gettext.h"
@@ -1825,7 +1826,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
        case LyXTabular::MULTICOLUMN:
        {
                if (sel_row_start != sel_row_end) {
-                       WriteAlert(_("Impossible Operation!"), 
+                       Alert::alert(_("Impossible Operation!"), 
                                   _("Multicolumns can only be horizontally."), 
                                   _("Sorry."));
                        return;
index 3d984c2a30ec7d7e7454c8ca13d4e233deb8df43..b4f3dbbf35ab5a6b94e9e6e9e02b141c1cf3407e 100644 (file)
@@ -32,7 +32,7 @@
 #include "layout.h"
 #include "LaTeXFeatures.h"
 #include "Painter.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
 #include "lyxtext.h"
 #include "lyxcursor.h"
 #include "CutAndPaste.h"
@@ -1188,7 +1188,7 @@ InsetText::localDispatch(BufferView * bv,
                if (!autoBreakRows) {
 
                        if (CutAndPaste::nrOfParagraphs() > 1) {
-                               WriteAlert(_("Impossible operation"),
+                               Alert::alert(_("Impossible operation"),
                                                   _("Cannot include more than one paragraph!"),
                                                   _("Sorry."));
                                break;
index 484f3a34ccb51b68ff95d6411411d6c65f164031..ba04bcb15de65568772b682b547dd4fbc78fa05b 100644 (file)
@@ -20,7 +20,7 @@
 #include "layout.h"
 #include "lyxlex.h"
 #include "support/filetools.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
 #include "debug.h"
 #include "gettext.h"
 #include "support/LAssert.h"
@@ -1366,7 +1366,7 @@ bool LyXTextClassList::Read ()
                        "textclass file  `" << MakeDisplayPath(real_file, 1000)
                       << "'. Exiting." << endl;
 
-               WriteAlert(_("LyX wasn't able to find its layout descriptions!"),
+               Alert::alert(_("LyX wasn't able to find its layout descriptions!"),
                           _("Check that the file \"textclass.lst\""),
                           _("is installed correctly. Sorry, has to exit :-("));
                return false;
@@ -1430,7 +1430,7 @@ bool LyXTextClassList::Read ()
        if (classlist.empty()) {
                lyxerr << "LyXTextClassList::Read: no textclasses found!"
                       << endl;
-               WriteAlert(_("LyX wasn't able to find any layout description!"),
+               Alert::alert(_("LyX wasn't able to find any layout description!"),
                           _("Check the contents of the file \"textclass.lst\""),
                           _("Sorry, has to exit :-("));
                return false;
index 739a7447353d6677f9b34c57c7e57a3433494da6..d94564d492d4ee8be92ff59615f46c3142f2aeab 100644 (file)
@@ -16,7 +16,6 @@
 #include <iostream>
 
 #include "lyx_cb.h"
-#include "lyx_gui_misc.h"
 #include "lyx_main.h"
 #include "buffer.h"
 #include "bufferlist.h"
@@ -26,6 +25,7 @@
 #include "LyXView.h"
 #include "lyxrc.h"
 #include "lyxtext.h"
+#include "frontends/Alert.h"
 #include "frontends/FileDialog.h"
 #include "frontends/GUIRunTime.h"
 #include "insets/insetlabel.h"
@@ -141,7 +141,7 @@ bool MenuWrite(BufferView * bv, Buffer * buffer)
        if (!buffer->save()) {
                string const fname = buffer->fileName();
                string const s = MakeAbsPath(fname);
-               if (AskQuestion(_("Save failed. Rename and try again?"),
+               if (Alert::askQuestion(_("Save failed. Rename and try again?"),
                                MakeDisplayPath(s, 50),
                                _("(If not, document is not saved.)"))) {
                        return WriteAs(bv, buffer);
@@ -196,7 +196,7 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
 
        // Same name as we have already?
        if (!buffer->isUnnamed() && fname == oldname) {
-               if (!AskQuestion(_("Same name as document already has:"),
+               if (!Alert::askQuestion(_("Same name as document already has:"),
                                 MakeDisplayPath(fname, 50),
                                 _("Save anyway?")))
                        return false;
@@ -204,7 +204,7 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
        } 
        // No, but do we have another file with this name open?
        else if (!buffer->isUnnamed() && bufferlist.exists(fname)) {
-               if (AskQuestion(_("Another document with same name open!"),
+               if (Alert::askQuestion(_("Another document with same name open!"),
                                MakeDisplayPath(fname, 50),
                                _("Replace with current document?")))
                        {
@@ -221,7 +221,7 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
        } // Check whether the file exists
        else {
                FileInfo const myfile(fname);
-               if (myfile.isOK() && !AskQuestion(_("Document already exists:"), 
+               if (myfile.isOK() && !Alert::askQuestion(_("Document already exists:"), 
                                                  MakeDisplayPath(fname, 50),
                                                  _("Replace file?")))
                        return false;
@@ -251,7 +251,7 @@ int MenuRunChktex(Buffer * buffer)
        int ret;
 
        if (buffer->isSGML()) {
-               WriteAlert(_("Chktex does not work with SGML derived documents."));
+               Alert::alert(_("Chktex does not work with SGML derived documents."));
                return 0;
        } else 
                ret = buffer->runChktex();
@@ -269,9 +269,9 @@ int MenuRunChktex(Buffer * buffer)
                        s += _(" warnings found.");
                        t = _("Use `Navigate->Error' to find them.");
                }
-               WriteAlert(_("Chktex run successfully"), s, t);
+               Alert::alert(_("Chktex run successfully"), s, t);
        } else {
-               WriteAlert(_("Error!"), _("It seems chktex does not work."));
+               Alert::alert(_("Error!"), _("It seems chktex does not work."));
        }
        return ret;
 }
@@ -430,14 +430,14 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
        FileInfo fi(fname);
 
        if (!fi.readable()) {
-               WriteFSAlert(_("Error! Specified file is unreadable: "),
+               Alert::err_alert(_("Error! Specified file is unreadable: "),
                             MakeDisplayPath(fname, 50));
                return;
        }
 
        ifstream ifs(fname.c_str());
        if (!ifs) {
-               WriteFSAlert(_("Error! Cannot open specified file: "),
+               Alert::err_alert(_("Error! Cannot open specified file: "),
                             MakeDisplayPath(fname, 50));
                return;
        }
@@ -512,7 +512,7 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
                }
 
                pair<bool, string> result =
-                       askForText(_("Enter new label to insert:"), text);
+                       Alert::askForText(_("Enter new label to insert:"), text);
                if (result.first) {
                        label = frontStrip(strip(result.second));
                }
@@ -539,7 +539,7 @@ void Reconfigure(BufferView * bv)
        p.pop();
        bv->owner()->message(_("Reloading configuration..."));
        lyxrc.read(LibFileSearch(string(), "lyxrc.defaults"));
-       WriteAlert(_("The system has been reconfigured."), 
+       Alert::alert(_("The system has been reconfigured."), 
                   _("You need to restart LyX to make use of any"),
                   _("updated document class specifications."));
 }
index dc4c6ca53734e13cab33fbfd70e6eb2cfed4863a..fb98996455345d615674f674bd7a9b68bdfd7928 100644 (file)
 #pragma implementation
 #endif
 
-#include <cerrno>
+#include FORMS_H_LOCATION
 #include "lyx_gui_misc.h"
-#include "BufferView.h"
-#include "buffer.h"
-#include "gettext.h"
 #include "figure_form.h"
-#include "lyx_cb.h"
-#include "lyx_main.h"
 #include "print_form.h"
-#include "LyXView.h"
-#include "bufferview_funcs.h"
-#include "support/filetools.h"
-#include "lyxrc.h"
-#include "debug.h"
-
-using std::pair;
-using std::make_pair;
-using std::endl;
-
-extern BufferView * current_view;
 
 extern FD_form_figure * fd_form_figure;
 extern FD_form_sendto * fd_form_sendto;
 
 extern void HideFiguresPopups();
 
-
-// Prevents LyX from being killed when the close box is pressed in a popup.
+// The code below is just waiting to go away really ...
 extern "C"
 int CancelCloseBoxCB(FL_FORM *, void *)
 {
        return FL_CANCEL;
 }
 
-
-// Redraw the form (on receipt of a Signal indicating, for example,
-// that the xform colors have been re-mapped).
 void RedrawAllBufferRelatedDialogs()
 {
        if (fd_form_figure->form_figure->visible) {
@@ -61,16 +43,8 @@ void RedrawAllBufferRelatedDialogs()
        }
 }
 
-// Prevents LyX from crashing when no buffers available
-// This is also one of the functions that we _really_ dont want
-// we should try to finds way to help us with that.
-// The signal/slot mechanism can probably help. 
 void CloseAllBufferRelatedDialogs()
 {
-       // don't forget to check that dynamically created forms
-       // have been created otherwise hiding one could cause a crash
-       // need the visible check otherwise XForms prints a warning
-       // if hiding an invisible form
        if (fd_form_figure->form_figure->visible) {
                fl_hide_form(fd_form_figure->form_figure);
        }
@@ -80,171 +54,7 @@ void CloseAllBufferRelatedDialogs()
        HideFiguresPopups();
 }
 
-// This is another function we really don't want.
-// Again the Signal/Slot mechanism is tailor made for this task.
 void updateAllVisibleBufferRelatedDialogs(bool)
 {
        HideFiguresPopups();
 }
-
-// Extract shortcut from <ident>|<shortcut> string
-char const * flyx_shortcut_extract(char const * sc)
-{
-       // Find '|' in the sc and return the string after that.
-       register char const * sd = sc;
-       while(sd[0]!= 0 && sd[0] != '|') ++sd;
-
-       if (sd[0] == '|') {
-               ++sd;
-               //lyxerr << sd << endl;
-               return sd;
-       }
-       return "";
-}
-
-
-// Extract identifier from <ident>|<shortcut> string
-char const * flyx_ident_extract(char const * sc)
-{
-       register char const * se = sc;
-       while(se[0]!= 0 && se[0] != '|') ++se;
-
-       if (se[0] == 0) return sc;
-       
-       char * sb = new char[se - sc + 1];
-       int index = 0;
-       register char const * sd = sc;
-       while (sd != se) {
-               sb[index] = sd[0];
-               ++index; ++sd;
-       }
-       sb[index] = 0;
-       return sb;
-}
-
-
-//
-void WriteAlert(string const & s1, string const & s2, string const & s3)
-{
-       LyXView * lview = 0;
-       if (current_view && current_view->owner())
-               lview = current_view->owner();
-       if (lview) {
-               /// Write to minibuffer
-               lview->prohibitInput();
-               string const msg = s1 + ' ' + s2 + ' ' + s3;
-               lview->message(msg);
-               fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
-               fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
-               lview->allowInput();
-       } else {
-               /// Write to lyxerr
-               lyxerr << "----------------------------------------" << endl
-                      << s1 << endl << s2 << endl << s3 << endl
-                      << "----------------------------------------" << endl;
-       }
-}
-
-
-// Alarms user of something related to files
-void WriteFSAlert(string const & s1, string const & s2)
-{
-       WriteAlert(s1, s2, strerror(errno));
-}
-
-
-bool AskQuestion(string const & s1, string const & s2, string const & s3,
-                bool default_value)
-{
-       if (!lyxrc.use_gui) {
-               lyxerr << "----------------------------------------" << endl
-                      << s1 << endl;
-               if (!s2.empty())
-                       lyxerr << s2 << endl;
-               if (!s3.empty())
-                       lyxerr << s3 << endl;
-               lyxerr << "Assuming answer is "
-                      << (default_value ? "yes" : "no")
-                      << endl
-                      << "----------------------------------------" << endl;
-               return default_value;
-       }
-
-       fl_set_resource("flQuestion.yes.label", idex(_("Yes|Yy#y")));
-       fl_set_resource("flQuestion.no.label", idex(_("No|Nn#n")));
-       return fl_show_question((s1 + "\n" + s2 + "\n" + s3).c_str(), 0);
-}
-
-
-// Returns 1 for yes, 2 for no, 3 for cancel.
-int AskConfirmation(string const & s1, string const & s2, string const & s3,
-                   int default_value)
-{
-       if (!lyxrc.use_gui) {
-               lyxerr << "----------------------------------------" << endl
-                      << s1 << endl;
-               if (!s2.empty())
-                       lyxerr << s2 << endl;
-               if (!s3.empty())
-                       lyxerr << s3 << endl;
-               lyxerr << "Assuming answer is ";
-               if (default_value == 1)
-                       lyxerr << "yes";
-               else if (default_value == 2)
-                       lyxerr << "no";
-               else
-                       lyxerr << "cancel";
-               lyxerr << endl
-                      << "----------------------------------------" << endl;
-               return default_value;
-       }
-
-       fl_set_choices_shortcut(scex(_("Yes|Yy#y")),
-                               scex(_("No|Nn#n")),
-                               scex(_("Cancel|^[")));
-        return fl_show_choice(s1.c_str(), s2.c_str(), s3.c_str(), 
-                             3, idex(_("Yes|Yy#y")),
-                             idex(_("No|Nn#n")),
-                              idex(_("Cancel|^[")), 3);
-}
-
-
-// Asks for a text
-pair<bool, string> const
-askForText(string const & msg, string const & dflt)
-{
-       if (!lyxrc.use_gui) {
-               lyxerr << "----------------------------------------" << endl
-                      << msg << endl
-                      << "Assuming answer is " << dflt
-                      << "----------------------------------------" << endl;
-               return make_pair<bool, string>(true, dflt);
-       }
-
-       fl_set_resource("flInput.cancel.label", idex(_("Cancel|^[")));
-       fl_set_resource("flInput.ok.label", idex(_("OK|#O")));
-       fl_set_resource("flInput.clear.label", idex(_("Clear|#e")));
-       char const * tmp = fl_show_input(msg.c_str(), dflt.c_str());
-       if (tmp != 0)
-         return make_pair<bool, string>(true, string(tmp));
-       else
-         return make_pair<bool, string>(false, string());
-}
-
-
-// Inform the user that the buffer is read-only, and that changes in the
-// dialog box that is to appear will be ignored.
-void WarnReadonly(string const & file)
-{
-       WriteAlert(_("Any changes will be ignored"),
-                  _("The document is read-only:"),
-                  MakeDisplayPath(file));
-}
-
-/// Get the dpi setting of the current screen
-float getScreenDPI()
-{
-       Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen); //DefaultScreen(fl_get_display());
-       return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
-               (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2;
-}
index 8ce53f9a007752293643fdda0da4ace6f8e2acc6..661eb9c751391886a6805880c4c2d2b07a245269 100644 (file)
@@ -19,8 +19,6 @@
 #endif
 
 #include FORMS_H_LOCATION
-#include "LString.h"
-#include <utility>  /* needed for pair<> definition */
 
 /// Prevents LyX from being killed when the close box is pressed in a popup.
 extern "C"
@@ -36,42 +34,4 @@ void CloseAllBufferRelatedDialogs();
 /// Ensures info in visible popups are always correct.
 void updateAllVisibleBufferRelatedDialogs(bool switched = false);
 
-/* These shortcut extractors should be shifted to frontends/xforms/ eventually */
-
-/// Extract shortcut from <ident>|<shortcut> string
-char const * flyx_shortcut_extract(char const * sc);
-/// Shortcut for flyx_shortcut_extract
-#define scex flyx_shortcut_extract
-
-/// Extract shortcut from <ident>|<shortcut> string
-char const * flyx_ident_extract(char const * sc);
-/// Shortcut for flyx_ident_extract
-#define idex flyx_ident_extract
-
-/// Show message
-void WriteAlert(string const & s1, string const & s2 = string(), 
-               string const & s3 = string());
-
-/// Alarms user of something related to files
-void WriteFSAlert(string const & s1, string const & s2 = string());
-
-/// Asks "Yes" or "No". Returns true for yes, false for no
-bool AskQuestion(string const & s1, string const & s2 = string(),
-                string const & s3 = string(), bool default_value = true);
-
-/// Asks "Yes", "No" or "Cancel". Returns 1 for yes, 2 for no, 3 for cancel
-int AskConfirmation(string const & s1, string const & s2 = string(), 
-                   string const & s3 = string(), int default_value = 1);
-
-/// returns a bool: false=cancelled, true=okay. string contains returned text
-std::pair<bool, string> const
-askForText(string const & msg,
-          string const & dflt = string());
-
-/// Informs the user that changes in the coming form will be ignored
-void WarnReadonly(string const & file);
-
-/// Get the dpi setting of the current screen
-float getScreenDPI();
-
 #endif
index 68cd2f04b3052c9a75f55551f7b7f69c9f369b66..1dfd3ced2ff7c763374806bf7bd9d935566efa1c 100644 (file)
@@ -22,7 +22,8 @@
 #include "lyx_gui.h"
 #include "LyXView.h"
 #include "lyxfunc.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
+#include "frontends/GUIRunTime.h"
 #include "lyxrc.h"
 #include "support/path.h"
 #include "support/filetools.h"
@@ -433,7 +434,7 @@ void LyX::init(bool gui)
  
         // Calculate screen dpi as average of x-DPI and y-DPI:
        if (lyxrc.use_gui) {
-               lyxrc.dpi = getScreenDPI();
+               lyxrc.dpi = GUIRunTime::getScreenDPI();
                lyxerr[Debug::INIT] << "DPI setting detected to be "
                                                 << lyxrc.dpi + 0.5 << endl;
        } else {
@@ -612,7 +613,7 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
        // If the user specified explicitely a directory, ask whether
        // to create it (otherwise, always create it)
        if (explicit_userdir &&
-           !AskQuestion(_("You have specified an invalid LyX directory."),
+           !Alert::askQuestion(_("You have specified an invalid LyX directory."),
                         _("It is needed to keep your own configuration."),
                         _("Should I try to set it up for you (recommended)?"))) {
                lyxerr << _("Running without personal LyX directory.") << endl;
@@ -651,7 +652,7 @@ bool LyX::readRcFile(string const & name)
                lyxerr[Debug::INIT] << "Found " << name
                                    << " in " << lyxrc_path << endl;
                if (lyxrc.read(lyxrc_path) < 0) { 
-                       WriteAlert(_("LyX Warning!"), 
+                       Alert::alert(_("LyX Warning!"), 
                                   _("Error while reading ") + lyxrc_path + ".",
                                   _("Using built-in defaults."));
                        return false;
@@ -910,5 +911,3 @@ bool LyX::easyParse(int * argc, char * argv[])
 
        return gui;
 }
-
-
index e5d0f75afbc6eb18d592aeb27ad6b1153d604f2f..777ad3e1011c7cdcefd6e6034256a1831e0a9254 100644 (file)
@@ -7,7 +7,7 @@
 #include "lyxtext.h"
 #include "lyxfind.h"
 #include "LyXView.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
 #include "support/textutils.h"
 #include "support/lstrings.h"
 #include "BufferView.h"
@@ -53,7 +53,7 @@ int LyXReplace(BufferView * bv,
        if (searchstr.length() == 0
                || (searchstr.length() == 1 && searchstr[0] == ' '))
        {
-               WriteAlert(_("Sorry!"), _("You cannot replace a single space, "
+               Alert::alert(_("Sorry!"), _("You cannot replace a single space, "
                                          "nor an empty character."));
                return 0;
        }
@@ -201,12 +201,11 @@ bool IsStringInText(Paragraph * par, Paragraph::size_type pos,
        }
        if (size == string::size_type(i)) {
                // if necessary, check whether string matches word
-               if (!mw || 
-                   (mw && ((pos <= 0 || !IsLetterCharOrDigit(par->getChar(pos - 1)))
-                            && (pos + Paragraph::size_type(size) >= par->size()
-                                || !IsLetterCharOrDigit(par->getChar(pos + size))))
-                    ))
-               {
+               if (!mw)
+                       return true;
+               if ((pos <= 0 || !IsLetterCharOrDigit(par->getChar(pos - 1)))
+                       && (pos + Paragraph::size_type(size) >= par->size()
+                       || !IsLetterCharOrDigit(par->getChar(pos + size)))) {
                        return true;
                }
        }
index dcd18e28773d9c4d59a2f8e3cb962952d5c8c2cd..360a7a31dfd9b78e8dbe11e129a638f14387bba0 100644 (file)
@@ -86,6 +86,7 @@
 #include "frontends/Dialogs.h"
 #include "frontends/Toolbar.h"
 #include "frontends/Menubar.h"
+#include "frontends/Alert.h"
 #include "FloatList.h"
 #include "converter.h"
 #include "exporter.h"
@@ -1739,7 +1740,7 @@ void LyXFunc::menuNew(bool fromTemplate)
 
                // Check if the document already is open
                if (bufferlist.exists(s)) {
-                       switch (AskConfirmation(_("Document is already open:"),
+                       switch (Alert::askConfirmation(_("Document is already open:"),
                                                MakeDisplayPath(s, 50),
                                                _("Do you want to close that document now?\n"
                                                  "('No' will just switch to the open version)")))
@@ -1760,7 +1761,7 @@ void LyXFunc::menuNew(bool fromTemplate)
                // Check whether the file already exists
                FileInfo fi(s);
                if (fi.readable() &&
-                   AskQuestion(_("File already exists:"), 
+                   Alert::askQuestion(_("File already exists:"), 
                                MakeDisplayPath(s, 50),
                                _("Do you want to open the document?"))) {
                                // loads document
@@ -1866,7 +1867,7 @@ void LyXFunc::open(string const & fname)
        // necessary
        string const fullpath = FileSearch(string(), filename, "lyx");
        if (fullpath.empty()) {
-               WriteAlert(_("Error"), _("Could not find file"), filename);
+               Alert::alert(_("Error"), _("Could not find file"), filename);
                return;
        }
 
@@ -1950,7 +1951,7 @@ void LyXFunc::doImport(string const & argument)
 
        // Check if the document already is open
        if (bufferlist.exists(lyxfile)) {
-               switch (AskConfirmation(_("Document is already open:"), 
+               switch (Alert::askConfirmation(_("Document is already open:"), 
                                        MakeDisplayPath(lyxfile, 50),
                                        _("Do you want to close that document now?\n"
                                          "('No' will just switch to the open version)")))
@@ -1971,7 +1972,7 @@ void LyXFunc::doImport(string const & argument)
 
        // Check if a LyX document by the same root exists in filesystem
        FileInfo const f(lyxfile, true);
-       if (f.exist() && !AskQuestion(_("A document by the name"), 
+       if (f.exist() && !Alert::askQuestion(_("A document by the name"), 
                                      MakeDisplayPath(lyxfile),
                                      _("already exists. Overwrite?"))) {
                owner->message(_("Canceled"));
index a5b9afd0d93704a1d005f190d59b51005cc8955f..c487f7887a222d2f5328a23b881c16219a7f8f34 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <unistd.h>
 
+#include "frontends/Alert.h"
 #include "lyxvc.h"
 #include "vc-backend.h"
 #include "debug.h"
@@ -83,7 +84,7 @@ void LyXVC::registrer()
        
        // If the document is changed, we might want to save it
        if (!vcs->owner()->isLyxClean() && 
-           AskQuestion(_("Changes in document:"),
+           Alert::askQuestion(_("Changes in document:"),
                        MakeDisplayPath(vcs->owner()->fileName(), 50),
                        _("Save document and proceed?"))) {
                vcs->owner()->getUser()->owner()
@@ -98,12 +99,12 @@ void LyXVC::registrer()
 
        lyxerr[Debug::LYXVC] << "LyXVC: registrer" << endl;
        pair<bool, string> tmp =
-               askForText(_("LyX VC: Initial description"),
+               Alert::askForText(_("LyX VC: Initial description"),
                           _("(no initial description)"));
        if (!tmp.first || tmp.second.empty()) {
                // should we insist on checking tmp.second.empty()?
                lyxerr[Debug::LYXVC] << "LyXVC: user cancelled" << endl;
-               WriteAlert(_("Info"),
+               Alert::alert(_("Info"),
                           _("This document has NOT been registered."));
                return;
        }
@@ -116,7 +117,7 @@ void LyXVC::checkIn()
 {
        // If the document is changed, we might want to save it
        if (!vcs->owner()->isLyxClean() && 
-           AskQuestion(_("Changes in document:"),
+           Alert::askQuestion(_("Changes in document:"),
                        MakeDisplayPath(vcs->owner()->fileName(), 50),
                        _("Save document and proceed?"))) {
                vcs->owner()->getUser()->owner()
@@ -130,7 +131,7 @@ void LyXVC::checkIn()
        }
 
        lyxerr[Debug::LYXVC] << "LyXVC: checkIn" << endl;
-       pair<bool, string> tmp = askForText(_("LyX VC: Log Message"));
+       pair<bool, string> tmp = Alert::askForText(_("LyX VC: Log Message"));
        if (tmp.first) {
                if (tmp.second.empty()) {
                        tmp.second = _("(no log message)");
@@ -146,7 +147,7 @@ void LyXVC::checkOut()
 {
        lyxerr[Debug::LYXVC] << "LyXVC: checkOut" << endl;
        if (!vcs->owner()->isLyxClean() 
-           && !AskQuestion(_("Changes in document:"),
+           && !Alert::askQuestion(_("Changes in document:"),
                           MakeDisplayPath(vcs->owner()->fileName(), 50),
                           _("Ignore changes and proceed with check out?"))) {
                return;
@@ -163,7 +164,7 @@ void LyXVC::revert()
        // Here we should check if the buffer is dirty. And if it is
        // we should warn the user that reverting will discard all
        // changes made since the last check in.
-       if (AskQuestion(_("When you revert, you will loose all changes made"),
+       if (Alert::askQuestion(_("When you revert, you will loose all changes made"),
                        _("to the document since the last check in."),
                        _("Do you still want to do it?"))) {
 
index bc70649fb34a5e5a4823b756f7553cf45d577f60..83fe96b561f4d0db4e7c21c98f5f1eecba87788a 100644 (file)
@@ -30,7 +30,7 @@
 #include "BufferView.h"
 #include "gettext.h"
 #include "debug.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
 #include "support/LOstream.h"
 #include "support/LAssert.h"
 #include "support/lyxlib.h"
@@ -423,8 +423,8 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
                                string const default_label =
                                        (lyxrc.label_init_length >= 0) ? "eq:" : "";
                                pair<bool, string> const res = old_label.empty()
-                                       ? askForText(_("Enter new label to insert:"), default_label)
-                                       : askForText(_("Enter label:"), old_label);
+                                       ? Alert::askForText(_("Enter new label to insert:"), default_label)
+                                       : Alert::askForText(_("Enter label:"), old_label);
                                
                                lyxerr << "res: " << res.first << " - '" << res.second << "'\n";
                                if (!res.first)
index b2665d7772c63c88514bc5a8ab9cd68b43babdd6..746505a2e09fe7c915cb0247c0da17994961ef73 100644 (file)
@@ -2,6 +2,7 @@
 #include <config.h>
 #include "lyx_gui_misc.h"
 #include "gettext.h"
+#include "frontends/xforms/xforms_helpers.h" 
 
 /* Form definition file generated with fdesign. */
 
index 3a332bd53610c6da441c8ccd4ad34a857cabb9ff..cb77c4b5cf43c3e3e834222e8059d2085be22cab 100644 (file)
@@ -28,6 +28,7 @@
 #endif
 
 #include <cstdlib>
+#include <cstdio> 
 #include <fcntl.h>
 #include <cerrno>
 #include "debug.h"
@@ -35,7 +36,7 @@
 
 #include "filetools.h"
 #include "LSubstring.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
 #include "FileInfo.h"
 #include "support/path.h"        // I know it's OS/2 specific (SMiyata)
 #include "gettext.h"
@@ -397,7 +398,7 @@ int DeleteAllFilesInDir (string const & path)
        // directory_iterator dit(path);
        // directory_iterator dend;
        // if (dit == dend) {
-       //         WriteFSAlert(_("Error! Cannot open directory:"), path);
+       //         Alert::err_alert(_("Error! Cannot open directory:"), path);
        //         return -1;
        // }
        // for (; dit != dend; ++dit) {
@@ -406,13 +407,13 @@ int DeleteAllFilesInDir (string const & path)
        //                 continue;
        //         string unlinkpath(AddName(path, filename));
        //         if (lyx::unlink(unlinkpath))
-       //                 WriteFSAlert(_("Error! Could not remove file:"),
+       //                 Alert::err_alert(_("Error! Could not remove file:"),
        //                              unlinkpath);
        // }
        // return 0;
        DIR * dir = ::opendir(path.c_str());
        if (!dir) {
-               WriteFSAlert (_("Error! Cannot open directory:"), path);
+               Alert::err_alert (_("Error! Cannot open directory:"), path);
                return -1;
        }
        struct dirent * de;
@@ -431,8 +432,8 @@ int DeleteAllFilesInDir (string const & path)
                        deleted = (DeleteAllFilesInDir(unlinkpath) == 0);
                deleted &= (lyx::unlink(unlinkpath) == 0);
                if (!deleted) {
-                       WriteFSAlert (_("Error! Could not remove file:"), 
-                                     unlinkpath);
+                       Alert::err_alert(_("Error! Could not remove file:"), 
+                               unlinkpath);
                        return_value = -1;
                }
         }
@@ -455,7 +456,7 @@ string const CreateTmpDir(string const & tempdir, string const & mask)
        lyx::unlink(tmpfl.c_str());
        
        if (tmpfl.empty() || lyx::mkdir(tmpfl, 0700)) {
-               WriteFSAlert(_("Error! Couldn't create temporary directory:"),
+               Alert::err_alert(_("Error! Couldn't create temporary directory:"),
                             tempdir);
                return string();
        }
@@ -472,7 +473,7 @@ int DestroyTmpDir(string const & tmpdir, bool Allfiles)
                return -1;
        }
        if (lyx::rmdir(tmpdir)) { 
-               WriteFSAlert(_("Error! Couldn't delete temporary directory:"), 
+               Alert::err_alert(_("Error! Couldn't delete temporary directory:"), 
                             tmpdir);
                return -1;
        }
@@ -491,7 +492,7 @@ string const CreateBufferTmpDir(string const & pathfor)
        // of EMX mkstemp().
        string const tmpfl = tmpdir + "/lyx_tmpbuf" + tostr(count++);
        if (lyx::mkdir(tmpfl, 0777)) {
-               WriteFSAlert(_("Error! Couldn't create temporary directory:"),
+               Alert::err_alert(_("Error! Couldn't create temporary directory:"),
                             tmpdir);
                return string();
        }
@@ -536,13 +537,13 @@ bool createDirectory(string const & path, int permission)
        string temp(strip(os::slashify_path(path), '/'));
 
        if (temp.empty()) {
-               WriteAlert(_("Internal error!"),
+               Alert::alert(_("Internal error!"),
                           _("Call to createDirectory with invalid name"));
                return false;
        }
 
        if (lyx::mkdir(temp, permission)) {
-               WriteFSAlert (_("Error! Couldn't create directory:"), temp);
+               Alert::err_alert (_("Error! Couldn't create directory:"), temp);
                return false;
        }
        return true;
@@ -1103,7 +1104,7 @@ void removeAutosaveFile(string const & filename)
        FileInfo const fileinfo(a);
        if (fileinfo.exist()) {
                if (lyx::unlink(a) != 0) {
-                       WriteFSAlert(_("Could not delete auto-save file!"), a);
+                       Alert::err_alert(_("Could not delete auto-save file!"), a);
                }
        }
 }
index fba75b46be4f437a3617eab56e125c48f923c22c..54e4fcb8d91971c0647bb7209ed45f28a9f42b28 100644 (file)
@@ -13,16 +13,16 @@ int Path::pop()
                // throw logical_error();
                // The use of WriteFSAlerrt makes this impossible
                // to inline.
-               //WriteFSAlert(_("Error: Dir already popped: "),
+               //Alert::err_alert(_("Error: Dir already popped: "),
                //           pushedDir_);
                return 0;
        }
        if (lyx::chdir(pushedDir_)) {
                // should throw an exception
                // throw DirChangeError();
-               // The use of WriteFSAlert makes this impossible
+               // The use of Alert::err_alert makes this impossible
                // to inline.
-               //WriteFSAlert(
+               //Alert::err_alert(
                //      _("Error: Could not change to directory: "), 
                //      pushedDir_);
        }
index 6081881062c7464f38861e3e88a2358cd976ac2c..88dba32bfaa050dae2fb1cc3888569ff87f9a991 100644 (file)
@@ -24,9 +24,9 @@ public:
                        if (pushedDir_.empty() || lyx::chdir(path)) {
                                // should throw an exception
                                // throw DirChangeError();
-                               // The use of WriteFSAlert makes this
+                               // The use of Alert::err_alert makes this
                                // impossible to inline.
-                               //WriteFSAlert(_("Error: Could not change to directory: "), 
+                               //Alert::err_alert(_("Error: Could not change to directory: "), 
                                //           path);
                        }
                } else {
index 58b9dbcd0cc7061c29ad1e88d65046b0b7fef084..07316512f8ffa678b088cdfa1c7600a1d679b53a 100644 (file)
@@ -26,7 +26,7 @@
 #include "debug.h"
 #include "vspace.h"
 #include "layout.h"
-#include "lyx_gui_misc.h"
+#include "frontends/Alert.h"
 #include "buffer.h"
 #include "BufferView.h"
 #include "Painter.h"
@@ -266,9 +266,6 @@ void LyXTabular::AppendRow(int cell)
 
 void LyXTabular::DeleteRow(int row)
 {
-       // Why make it so hard? (Lgb)
-       //if (!(rows_ - 1))
-       //return;
        if (rows_ == 1) return; // Not allowed to delete last row
        
        row_info.erase(row_info.begin() + row); //&row_info[row]);
@@ -1442,7 +1439,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
                lyxerr << "Tabular format < 5 is not supported anymore\n"
                        "Get an older version of LyX (< 1.1.x) for conversion!"
                           << endl;
-               WriteAlert(_("Warning:"),
+               Alert::alert(_("Warning:"),
                                   _("Tabular format < 5 is not supported anymore\n"),
                                   _("Get an older version of LyX (< 1.1.x) for conversion!"));
                if (version > 2) {
@@ -2651,16 +2648,9 @@ LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
 
        for (; par; par = par->next()) {
                for (int i = 0; i < par->size(); ++i) {
-                       if (par->getChar(i)     == Paragraph::META_NEWLINE)
+                       if (par->getChar(i) == Paragraph::META_NEWLINE)
                                return BOX_PARBOX;
                }
        }
        return BOX_NONE;
 }
-
-/* Emacs:
- * Local variables:
- * tab-width: 4
- * End:
- * vi:set tabstop=4:
- */