My old allow/prohibitInput() -> busy(bool) patch cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6151 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-02-14 14:49:51 +00:00
parent c9e78a825b
commit 13080e1cce
18 changed files with 79 additions and 89 deletions

View File

@ -263,7 +263,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
bool selection = false;
bool mark_set = false;
owner_->prohibitInput();
owner_->busy(true);
owner_->message(_("Formatting document..."));
@ -328,7 +328,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
bv_->text->first_y = screen().topCursorVisible(bv_->text->cursor, bv_->text->first_y);
switchKeyMap();
owner_->allowInput();
owner_->busy(false);
updateScrollbar();

View File

@ -1,3 +1,13 @@
2003-02-14 John Levon <levon@movementarian.org>
* BufferView_pimpl.C:
* bufferlist.C:
* buffer.C:
* converter.C:
* lyx_cb.C:
* lyxfunc.C: change prohibit/allowInput to busy(bool), as
it's a more accurate name. Remove some pointless uses.
2003-02-14 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* text2.C (LyXText): change order of initilizers to shut off

View File

@ -3142,7 +3142,7 @@ int Buffer::runChktex()
{
if (!users->text) return 0;
users->owner()->prohibitInput();
users->owner()->busy(true);
// get LaTeX-Filename
string const name = getLatexName();
@ -3181,7 +3181,7 @@ int Buffer::runChktex()
users->repaint();
users->fitCursor();
}
users->owner()->allowInput();
users->owner()->busy(false);
return res;
}

View File

@ -181,8 +181,6 @@ bool BufferList::close(Buffer * buf)
buf->getUser()->insetUnlock();
if (!buf->paragraphs.empty() && !buf->isClean() && !quitting) {
if (buf->getUser())
buf->getUser()->owner()->prohibitInput();
string fname;
if (buf->isUnnamed())
fname = OnlyFilename(buf->fileName());
@ -200,8 +198,6 @@ bool BufferList::close(Buffer * buf)
lastfiles->newFile(buf->fileName());
reask = false;
} else {
if (buf->getUser())
buf->getUser()->owner()->allowInput();
return false;
}
break;
@ -212,13 +208,9 @@ bool BufferList::close(Buffer * buf)
reask = false;
break;
case 3: // Cancel
if (buf->getUser())
buf->getUser()->owner()->allowInput();
return false;
}
}
if (buf->getUser())
buf->getUser()->owner()->allowInput();
}
bstore.release(buf);

View File

@ -119,6 +119,8 @@ void Formats::add(string const & name)
}
// FIXME: horrednously mis-named, especially given the other ::add
// function
void Formats::add(string const & name, string const & extension,
string const & prettyname, string const & shortcut)
{
@ -828,7 +830,7 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
BufferView * bv = buffer->getUser();
if (bv) {
bv->owner()->prohibitInput();
bv->owner()->busy(true);
// all error insets should have been removed by now
}
@ -843,7 +845,7 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
bv->repaint();
bv->fitCursor();
}
bv->owner()->allowInput();
bv->owner()->busy(false);
}
if ((result & LaTeX::ERRORS)) {
@ -886,7 +888,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
BufferView * bv = buffer->getUser();
if (bv) {
bv->owner()->prohibitInput();
bv->owner()->busy(true);
bv->owner()->message(_("Running LaTeX..."));
// all the autoinsets have already been removed
}
@ -933,7 +935,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
}
if (bv)
bv->owner()->allowInput();
bv->owner()->busy(false);
int const ERROR_MASK =
LaTeX::NO_LOGFILE |

View File

@ -1,3 +1,7 @@
2003-02-14 John Levon <levon@movementarian.org>
* LyXView.h: prohibit/allowInput() -> busy(bool)
2003-02-08 John Levon <levon@movementarian.org>
* Dialogs.h: add showMergeChanges()

View File

@ -64,10 +64,8 @@ public:
*/
void init();
/// start modal operation
virtual void prohibitInput() const = 0;
/// end modal operation
virtual void allowInput() const = 0;
/// show busy cursor
virtual void busy(bool) const = 0;
//@{ generic accessor functions

View File

@ -1,3 +1,7 @@
2003-02-14 John Levon <levon@movementarian.org>
* FileDialog.C: remove spurious allow/prohibitInput()
2003-02-12 Michael A. Koziarski <michael@koziarski.com>
* GChanges.C

View File

@ -109,9 +109,7 @@ FileDialog::open(string const & path, string const & mask,
private_->set_complete(mask);
private_->set_filename(path+suggested);
lv_->prohibitInput();
string const filename = private_->exec();
lv_->allowInput();
// Collect the info and return it for synchronous dialog.
return FileDialog::Result(Chosen, filename);

View File

@ -1,3 +1,9 @@
2003-02-14 John Levon <levon@movementarian.org>
* QtView.h:
* QtView.C: change prohibit/allowInput() to be busy(bool),
and actually implement the busy cursor
2003-02-09 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* QBibtexDialog.C: Fix browsing mechanism of *.sty files (bug 773).

View File

@ -35,6 +35,7 @@
#include "qt_helpers.h"
#include <qapplication.h>
#include <qcursor.h>
#include <qpixmap.h>
#include <qmenubar.h>
#include <qstatusbar.h>
@ -146,16 +147,10 @@ void QtView::show()
}
// it's not at all clear that these are actually
// needed anywhere in the source. Something to
// check on a rainy day.
void QtView::prohibitInput() const
void QtView::busy(bool yes) const
{
//setFocusPolicy(QWidget::NoFocus);
}
void QtView::allowInput() const
{
//setFocusPolicy(QWidget::strongFocus);
if (yes)
QApplication::setOverrideCursor(Qt::waitCursor);
else
QApplication::restoreOverrideCursor();
}

View File

@ -37,10 +37,8 @@ public:
/// show - display the top-level window
void show();
/// start modal operation
virtual void prohibitInput() const;
/// end modal operation
virtual void allowInput() const;
/// show busy cursor
virtual void busy(bool) const;
/// display a status message
virtual void message(string const & str);

View File

@ -1,3 +1,10 @@
2003-02-14 John Levon <levon@movementarian.org>
* FileDialog.C: remove spurious prohibit/allowInput()
* XFormsView.h:
* XFormsView.C: prohibit/allowInput() -> busy(bool)
2003-02-10 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* FormDocument.C: Reset paperpackage to NONE when

View File

@ -13,9 +13,6 @@
#include "FormFiledialog.h"
#include "frontends/FileDialog.h"
// temp. hack until Allow/prohibitInput is not
// needed any more in src/ - for now it's simplest
// to leave it there
#include "frontends/LyXView.h"
#include "bufferview_funcs.h"
#include "gettext.h"
@ -58,15 +55,11 @@ FileDialog::Result const FileDialog::opendir(string const & path, string const &
// no support for asynchronous selection yet
lv_->prohibitInput();
FileDialog::Result result;
result.first = FileDialog::Chosen;
result.second = private_->SelectDir(title_, path, suggested);
lv_->allowInput();
return result;
}
@ -88,14 +81,10 @@ FileDialog::Result const FileDialog::open(string const & path, string const & ma
// no support for asynchronous selection yet
lv_->prohibitInput();
FileDialog::Result result;
result.first = FileDialog::Chosen;
result.second = private_->Select(title_, path, filter, suggested);
lv_->allowInput();
return result;
}

View File

@ -197,15 +197,9 @@ void XFormsView::show_view_state()
}
// How should this actually work? Should it prohibit input in all BufferViews,
// or just in the current one? If "just the current one", then it should be
// placed in BufferView. If "all BufferViews" then LyXGUI (I think) should
// run "prohibitInput" on all LyXViews which will run prohibitInput on all
// BufferViews. Or is it perhaps just the (input in) BufferViews in the
// current LyXView that should be prohibited (Lgb) (This applies to
// "allowInput" as well.)
void XFormsView::prohibitInput() const
void XFormsView::busy(bool yes) const
{
if (yes) {
view()->hideCursor();
static Cursor cursor;
@ -217,20 +211,20 @@ void XFormsView::prohibitInput() const
cursor_undefined = false;
}
/* set the cursor to the watch for all forms and the canvas */
/// set the cursor to the watch for all forms and the canvas
XDefineCursor(fl_get_display(), getForm()->window, cursor);
XFlush(fl_get_display());
/// we only need to deactivate to prevent resetting the cursor
/// to I-beam over the workarea
fl_deactivate_all_forms();
}
void XFormsView::allowInput() const
{
/* reset the cursor from the watch for all forms and the canvas */
} else {
/// reset the cursor from the watch for all forms and the canvas
XUndefineCursor(fl_get_display(), getForm()->window);
XFlush(fl_get_display());
fl_activate_all_forms();
}
}

View File

@ -44,10 +44,8 @@ public:
FL_FORM * getForm() const;
/// redraw the main form.
virtual void redraw();
///
virtual void prohibitInput() const;
///
virtual void allowInput() const;
/// show busy cursor
virtual void busy(bool) const;
/// callback for close event from window manager
static int atCloseMainFormCB(FL_FORM *, void *);

View File

@ -473,7 +473,6 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
void MenuInsertLabel(BufferView * bv, string const & arg)
{
string label = arg;
bv->owner()->prohibitInput();
if (label.empty()) {
Paragraph * par = bv->getLyXText()->cursor.par();
LyXLayout_ptr layout = par->layout();
@ -518,7 +517,6 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
InsetLabel * inset = new InsetLabel(p);
bv->insertInset(inset);
}
bv->owner()->allowInput();
}

View File

@ -1139,12 +1139,10 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
setErrorMessage(N_("Missing argument"));
break;
}
owner->prohibitInput();
string const fname = i18nLibFileSearch("doc", arg, "lyx");
if (fname.empty()) {
lyxerr << "LyX: unable to find documentation file `"
<< arg << "'. Bad installation?" << endl;
owner->allowInput();
break;
}
ostringstream str;
@ -1157,7 +1155,6 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
#endif
owner->message(STRCONV(str.str()));
view()->buffer(bufferlist.loadLyXFile(fname, false));
owner->allowInput();
break;
}