Simplify FuncRequest constructors

This commit is contained in:
Yuriy Skalko 2020-12-02 14:23:01 +02:00
parent e0f553b941
commit 1dd676bed1
2 changed files with 16 additions and 22 deletions

View File

@ -30,41 +30,35 @@ FuncRequest const FuncRequest::unknown(LFUN_UNKNOWN_ACTION);
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)
: 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)
: 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)
: 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)
: 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)
: 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_)
{}

View File

@ -105,25 +105,25 @@ public:
private:
/// the action
FuncCode action_;
FuncCode action_ = LFUN_NOACTION;
/// 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
frontend::GuiView* view_origin_;
frontend::GuiView* view_origin_ = nullptr;
/// the x coordinate of a mouse press
int x_;
int x_ = 0;
/// the y coordinate of a mouse press
int y_;
int y_ = 0;
/// 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"
bool allow_async_;
bool allow_async_ = true;
};