]> git.lyx.org Git - features.git/commitdiff
Simplify FuncRequest constructors
authorYuriy Skalko <yuriy.skalko@gmail.com>
Wed, 2 Dec 2020 12:23:01 +0000 (14:23 +0200)
committerYuriy Skalko <yuriy.skalko@gmail.com>
Wed, 2 Dec 2020 22:38:12 +0000 (00:38 +0200)
src/FuncRequest.cpp
src/FuncRequest.h

index 0d6a487b8ae256a154b047fdd3540ef570402477..25ea41a82f4029034cb29fad64447200fa6a2f84 100644 (file)
@@ -30,41 +30,35 @@ FuncRequest const FuncRequest::unknown(LFUN_UNKNOWN_ACTION);
 FuncRequest const FuncRequest::noaction(LFUN_NOACTION);
 
 FuncRequest::FuncRequest(Origin o)
 FuncRequest const FuncRequest::noaction(LFUN_NOACTION);
 
 FuncRequest::FuncRequest(Origin o)
-       : action_(LFUN_NOACTION), origin_(o), view_origin_(nullptr), x_(0), y_(0),
-         button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+       : origin_(o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, Origin o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, Origin o)
-       : action_(act), origin_(o), view_origin_(nullptr), x_(0), y_(0),
-       button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+       : action_(act), origin_(o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, docstring const & arg, Origin o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, docstring const & arg, Origin o)
-       : action_(act), argument_(arg), origin_(o), view_origin_(nullptr), x_(0), y_(0),
-         button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+       : action_(act), argument_(arg), origin_(o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, string const & arg, Origin o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, string const & arg, Origin o)
-       : action_(act), argument_(from_utf8(arg)),
-         origin_(o), view_origin_(nullptr), x_(0), y_(0),
-         button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+       : FuncRequest(act, from_utf8(arg), o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, int ax, int ay,
                         mouse_button::state button, KeyModifier modifier, Origin o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, int ax, int ay,
                         mouse_button::state button, KeyModifier modifier, Origin o)
-       : action_(act), origin_(o), view_origin_(nullptr), x_(ax), y_(ay),
-         button_(button), modifier_(modifier), allow_async_(true)
+       : action_(act), origin_(o),
+         x_(ax), y_(ay), button_(button), modifier_(modifier)
 {}
 
 
 FuncRequest::FuncRequest(FuncRequest const & cmd, docstring const & arg, Origin o)
 {}
 
 
 FuncRequest::FuncRequest(FuncRequest const & cmd, docstring const & arg, Origin o)
-       : action_(cmd.action()), argument_(arg),
-         origin_(o), view_origin_(nullptr), x_(cmd.x_), y_(cmd.y_),
-         button_(cmd.button_), modifier_(NoModifier), allow_async_(true)
+       : action_(cmd.action()), argument_(arg), origin_(o),
+         x_(cmd.x_), y_(cmd.y_), button_(cmd.button_)
 {}
 
 
 {}
 
 
index 19f571a091c7503dcf7d90c37a4e81e370cf8103..52fb1434aa7b3f3912f67970216da2803d9563e3 100644 (file)
@@ -105,25 +105,25 @@ public:
 
 private:
        /// the action
 
 private:
        /// the action
-       FuncCode action_;
+       FuncCode action_ = LFUN_NOACTION;
        /// the action's string argument
        docstring argument_;
        /// who initiated the action
        /// the action's string argument
        docstring argument_;
        /// who initiated the action
-       Origin origin_;
+       Origin origin_ = INTERNAL;
        /// to which view should be this command sent (see bug #11004)
        /// NULL=current view
        /// to which view should be this command sent (see bug #11004)
        /// NULL=current view
-       frontend::GuiView* view_origin_;
+       frontend::GuiView* view_origin_ = nullptr;
        /// the x coordinate of a mouse press
        /// the x coordinate of a mouse press
-       int x_;
+       int x_ = 0;
        /// the y coordinate of a mouse press
        /// the y coordinate of a mouse press
-       int y_;
+       int y_ = 0;
        /// some extra information (like button number)
        /// some extra information (like button number)
-       mouse_button::state button_;
+       mouse_button::state button_ = mouse_button::none;
        ///
        ///
-       KeyModifier modifier_;
+       KeyModifier modifier_ = NoModifier;
        /// Commands should be run synchronously when they
        /// are launched via "command-sequence" or "repeat" or "buffer-forall"
        /// Commands should be run synchronously when they
        /// are launched via "command-sequence" or "repeat" or "buffer-forall"
-       bool allow_async_;
+       bool allow_async_ = true;
 };
 
 
 };