Am Samstag, 7. Mai 2005 21:35 schrieb Andre Poenitz: > > Could anybody please make sure that 'his' code does not contain > unnecessary update() calls? > > As a first approximation I'd classify any update() with exception > of the one in lyxfunc.C as 'unnecessary'. > > Most notably the LFUN_INSET_MODIFY handling seems to have sneaked > something in...
All update() calls in src/insets are unnecessary. They are all in do_dispatch(), and LCursor->dispatch() makes sure that update is called. It is the other way round: We need to call cur.noUpdate() if no update is needed. I did also call noUpdate() instead of undispatched() in insetcommand.C. Is that correct? Georg
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/insets/insetcommand.C lyx-1.4-cvs/src/insets/insetcommand.C --- lyx-1.4-clean/src/insets/insetcommand.C 2005-04-23 10:15:05.000000000 +0200 +++ lyx-1.4-cvs/src/insets/insetcommand.C 2005-05-08 10:47:07.000000000 +0200 @@ -109,12 +109,10 @@ void InsetCommand::doDispatch(LCursor & case LFUN_INSET_MODIFY: { InsetCommandParams p; InsetCommandMailer::string2params(mailer_name_, cmd.argument, p); - if (p.getCmdName().empty()) { - cur.undispatched(); - } else { + if (p.getCmdName().empty()) + cur.noUpdate(); + else setParams(p); - cur.bv().update(); - } break; } diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/insets/insetfloat.C lyx-1.4-cvs/src/insets/insetfloat.C --- lyx-1.4-clean/src/insets/insetfloat.C 2005-04-23 10:15:08.000000000 +0200 +++ lyx-1.4-cvs/src/insets/insetfloat.C 2005-05-08 10:44:43.000000000 +0200 @@ -160,7 +160,6 @@ void InsetFloat::doDispatch(LCursor & cu params_.sideways = params.sideways; wide(params_.wide, cur.buffer().params()); sideways(params_.sideways, cur.buffer().params()); - cur.bv().update(); break; } diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/insets/insetgraphics.C lyx-1.4-cvs/src/insets/insetgraphics.C --- lyx-1.4-clean/src/insets/insetgraphics.C 2005-04-23 10:15:08.000000000 +0200 +++ lyx-1.4-cvs/src/insets/insetgraphics.C 2005-05-08 10:43:21.000000000 +0200 @@ -197,10 +206,10 @@ void InsetGraphics::doDispatch(LCursor & Buffer const & buffer = cur.buffer(); InsetGraphicsParams p; InsetGraphicsMailer::string2params(cmd.argument, buffer, p); - if (!p.filename.empty()) { + if (!p.filename.empty()) setParams(p); - cur.bv().update(); - } + else + cur.noUpdate(); break; } diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/insets/insetinclude.C lyx-1.4-cvs/src/insets/insetinclude.C --- lyx-1.4-clean/src/insets/insetinclude.C 2005-04-23 10:15:17.000000000 +0200 +++ lyx-1.4-cvs/src/insets/insetinclude.C 2005-05-08 10:43:57.000000000 +0200 @@ -128,10 +153,10 @@ void InsetInclude::doDispatch(LCursor & case LFUN_INSET_MODIFY: { InsetCommandParams p; InsetIncludeMailer::string2params(cmd.argument, p); - if (!p.getCmdName().empty()) { + if (!p.getCmdName().empty()) set(p, cur.buffer()); - cur.bv().update(); - } + else + cur.noUpdate(); break; } diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/insets/insetnote.C lyx-1.4-cvs/src/insets/insetnote.C --- lyx-1.4-clean/src/insets/insetnote.C 2005-04-23 10:15:17.000000000 +0200 +++ lyx-1.4-cvs/src/insets/insetnote.C 2005-05-08 10:45:43.000000000 +0200 @@ -192,7 +192,6 @@ void InsetNote::doDispatch(LCursor & cur case LFUN_INSET_MODIFY: InsetNoteMailer::string2params(cmd.argument, params_); setButtonLabel(); - cur.bv().update(); break; case LFUN_INSET_DIALOG_UPDATE: diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/insets/insetwrap.C lyx-1.4-cvs/src/insets/insetwrap.C --- lyx-1.4-clean/src/insets/insetwrap.C 2005-04-23 10:15:17.000000000 +0200 +++ lyx-1.4-cvs/src/insets/insetwrap.C 2005-05-08 10:45:51.000000000 +0200 @@ -83,7 +83,6 @@ void InsetWrap::doDispatch(LCursor & cur InsetWrapMailer::string2params(cmd.argument, params); params_.placement = params.placement; params_.width = params.width; - cur.bv().update(); break; } diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/insets/updatableinset.C lyx-1.4-cvs/src/insets/updatableinset.C --- lyx-1.4-clean/src/insets/updatableinset.C 2005-02-01 20:16:20.000000000 +0100 +++ lyx-1.4-cvs/src/insets/updatableinset.C 2005-05-08 10:44:22.000000000 +0200 @@ -99,8 +99,8 @@ void UpdatableInset::doDispatch(LCursor scroll(cur.bv(), static_cast<float>(convert<double>(cmd.argument))); else scroll(cur.bv(), convert<int>(cmd.argument)); - cur.bv().update(); - } + } else + cur.noUpdate(); break; default: