1
// -*- Mode: C++; tab-width:2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
// vi:tw=80:et:ts=2:sts=2
4
// -----------------------------------------------------------------------
6
// This file is part of RLVM, a RealLive virtual machine clone.
8
// -----------------------------------------------------------------------
10
// Copyright (C) 2007 Elliot Glaysher
12
// This program is free software; you can redistribute it and/or modify
13
// it under the terms of the GNU General Public License as published by
14
// the Free Software Foundation; either version 3 of the License, or
15
// (at your option) any later version.
17
// This program is distributed in the hope that it will be useful,
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
// GNU General Public License for more details.
22
// You should have received a copy of the GNU General Public License
23
// along with this program; if not, write to the Free Software
24
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
26
// -----------------------------------------------------------------------
28
#ifndef SRC_LONG_OPERATIONS_PAUSE_LONG_OPERATION_H_
29
#define SRC_LONG_OPERATIONS_PAUSE_LONG_OPERATION_H_
31
#include "machine/long_operation.h"
32
#include "systems/base/event_listener.h"
34
// Main pause function. Exported for TextoutLongOperation to abuse.
35
class PauseLongOperation : public LongOperation {
37
explicit PauseLongOperation(RLMachine& machine);
38
virtual ~PauseLongOperation();
40
// Overridden from EventListener:
41
virtual void MouseMotion(const Point& new_location) override;
42
virtual bool MouseButtonStateChanged(MouseButton mouse_button,
43
bool pressed) override;
44
virtual bool KeyStateChanged(KeyCode key_code, bool pressed) override;
46
// Overridden from LongOperation:
47
virtual bool operator()(RLMachine& machine);
50
// Has this pause timed out?
51
bool AutomodeTimerFired();
58
// How long after start_time_ to automatically break out of this
59
// Longoperation if auto mode is enabled
60
unsigned int automode_time_;
62
// How long it's been since the last time we've added time to |total_time_|.
63
unsigned int time_at_last_pass_;
65
// When this hits |automode_time_|, we fire.
66
unsigned int total_time_;
69
// -----------------------------------------------------------------------
71
// -----------------------------------------------------------------------
72
class NewPageAfterLongop : public PerformAfterLongOperationDecorator {
74
explicit NewPageAfterLongop(LongOperation* inOp);
75
virtual ~NewPageAfterLongop();
78
virtual void PerformAfterLongOperation(RLMachine& machine) override;
81
// -----------------------------------------------------------------------
82
// NewPageOnAllAfterLongop
83
// -----------------------------------------------------------------------
84
class NewPageOnAllAfterLongop : public PerformAfterLongOperationDecorator {
86
explicit NewPageOnAllAfterLongop(LongOperation* inOp);
87
virtual ~NewPageOnAllAfterLongop();
90
virtual void PerformAfterLongOperation(RLMachine& machine) override;
93
// -----------------------------------------------------------------------
94
// NewParagraphAfterLongop
95
// -----------------------------------------------------------------------
96
class NewParagraphAfterLongop : public PerformAfterLongOperationDecorator {
98
explicit NewParagraphAfterLongop(LongOperation* inOp);
99
virtual ~NewParagraphAfterLongop();
102
virtual void PerformAfterLongOperation(RLMachine& machine) override;
105
#endif // SRC_LONG_OPERATIONS_PAUSE_LONG_OPERATION_H_