2003-07-29 Martin Vermeer <[EMAIL PROTECTED]> * insetcollapsable.C: * insetnote.C: * insetert.C: factor out the detection of clicking on the inset * button as 'hitButton'.
OK to commit? -- Martin Vermeer [EMAIL PROTECTED] Helsinki University of Technology Dept. of Surveying, Inst. of Geodesy P.O. Box 1200, FIN-02015 HUT, Finland :wq
Index: insetnote.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetnote.C,v retrieving revision 1.35 diff -u -p -r1.35 insetnote.C --- insetnote.C 29 Jul 2003 12:20:04 -0000 1.35 +++ insetnote.C 29 Jul 2003 15:20:21 -0000 @@ -132,8 +132,7 @@ dispatch_result InsetNote::localDispatch InsetNoteMailer("note", *this).updateDialog(bv); return DISPATCHED; case LFUN_MOUSE_RELEASE: - if (cmd.button() == mouse_button::button3 && cmd.x < button_length - && cmd.y >= button_top_y && cmd.y <= button_bottom_y) { + if (cmd.button() == mouse_button::button3 && hitButton(cmd)) { InsetNoteMailer("note", *this).showDialog(bv); return DISPATCHED; } Index: insetcollapsable.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v retrieving revision 1.156 diff -u -p -r1.156 insetcollapsable.C --- insetcollapsable.C 25 Jul 2003 21:20:13 -0000 1.156 +++ insetcollapsable.C 29 Jul 2003 15:20:21 -0000 @@ -241,8 +241,7 @@ void InsetCollapsable::lfunMouseRelease( return; } - if ((cmd.button() != mouse_button::button3) && (cmd.x < button_length) && - (cmd.y >= button_top_y) && (cmd.y <= button_bottom_y)) + if (cmd.button() != mouse_button::button3 && hitButton(cmd)) { if (collapsed_) { collapsed_ = false; @@ -285,6 +284,15 @@ int InsetCollapsable::linuxdoc(Buffer co int InsetCollapsable::docbook(Buffer const * buf, ostream & os, bool mixcont) const { return inset.docbook(buf, os, mixcont); +} + + +bool InsetCollapsable::hitButton(FuncRequest const & cmd) const +{ + return cmd.x < button_length + && cmd.x > 0 + && cmd.y >= button_top_y + && cmd.y <= button_bottom_y; } Index: insetert.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v retrieving revision 1.143 diff -u -p -r1.143 insetert.C --- insetert.C 28 Jul 2003 15:17:11 -0000 1.143 +++ insetert.C 29 Jul 2003 15:20:21 -0000 @@ -295,8 +295,7 @@ bool InsetERT::lfunMouseRelease(FuncRequ return true; } - if (status_ != Inlined && (cmd.x >= 0) && (cmd.x < button_length) && - (cmd.y >= button_top_y) && (cmd.y <= button_bottom_y)) { + if (status_ != Inlined && hitButton(cmd)) { updateStatus(bv, true); } else { FuncRequest cmd1 = cmd;
pgp00000.pgp
Description: PGP signature