~ubuntu-branches/ubuntu/vivid/rlvm/vivid-proposed

« back to all changes in this revision

Viewing changes to src/long_operations/pause_long_operation.h

  • Committer: Package Import Robot
  • Author(s): Ying-Chun Liu (PaulLiu)
  • Date: 2014-10-22 03:24:19 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20141022032419-yqxls9ky4n1w811n
Tags: 0.14-1
* New upstream release
* Bump Standards-Version to 3.9.6: nothing needs to be changed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: C++; tab-width:2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 
2
// vi:tw=80:et:ts=2:sts=2
 
3
//
 
4
// -----------------------------------------------------------------------
 
5
//
 
6
// This file is part of RLVM, a RealLive virtual machine clone.
 
7
//
 
8
// -----------------------------------------------------------------------
 
9
//
 
10
// Copyright (C) 2007 Elliot Glaysher
 
11
//
 
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.
 
16
//
 
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.
 
21
//
 
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.
 
25
//
 
26
// -----------------------------------------------------------------------
 
27
 
 
28
#ifndef SRC_LONG_OPERATIONS_PAUSE_LONG_OPERATION_H_
 
29
#define SRC_LONG_OPERATIONS_PAUSE_LONG_OPERATION_H_
 
30
 
 
31
#include "machine/long_operation.h"
 
32
#include "systems/base/event_listener.h"
 
33
 
 
34
// Main pause function. Exported for TextoutLongOperation to abuse.
 
35
class PauseLongOperation : public LongOperation {
 
36
 public:
 
37
  explicit PauseLongOperation(RLMachine& machine);
 
38
  virtual ~PauseLongOperation();
 
39
 
 
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;
 
45
 
 
46
  // Overridden from LongOperation:
 
47
  virtual bool operator()(RLMachine& machine);
 
48
 
 
49
 private:
 
50
  // Has this pause timed out?
 
51
  bool AutomodeTimerFired();
 
52
 
 
53
  RLMachine& machine_;
 
54
 
 
55
  bool is_done_;
 
56
 
 
57
  // Used in automode:
 
58
  // How long after start_time_ to automatically break out of this
 
59
  // Longoperation if auto mode is enabled
 
60
  unsigned int automode_time_;
 
61
 
 
62
  // How long it's been since the last time we've added time to |total_time_|.
 
63
  unsigned int time_at_last_pass_;
 
64
 
 
65
  // When this hits |automode_time_|, we fire.
 
66
  unsigned int total_time_;
 
67
};
 
68
 
 
69
// -----------------------------------------------------------------------
 
70
// NewPageAfterLongop
 
71
// -----------------------------------------------------------------------
 
72
class NewPageAfterLongop : public PerformAfterLongOperationDecorator {
 
73
 public:
 
74
  explicit NewPageAfterLongop(LongOperation* inOp);
 
75
  virtual ~NewPageAfterLongop();
 
76
 
 
77
 private:
 
78
  virtual void PerformAfterLongOperation(RLMachine& machine) override;
 
79
};
 
80
 
 
81
// -----------------------------------------------------------------------
 
82
// NewPageOnAllAfterLongop
 
83
// -----------------------------------------------------------------------
 
84
class NewPageOnAllAfterLongop : public PerformAfterLongOperationDecorator {
 
85
 public:
 
86
  explicit NewPageOnAllAfterLongop(LongOperation* inOp);
 
87
  virtual ~NewPageOnAllAfterLongop();
 
88
 
 
89
 private:
 
90
  virtual void PerformAfterLongOperation(RLMachine& machine) override;
 
91
};
 
92
 
 
93
// -----------------------------------------------------------------------
 
94
// NewParagraphAfterLongop
 
95
// -----------------------------------------------------------------------
 
96
class NewParagraphAfterLongop : public PerformAfterLongOperationDecorator {
 
97
 public:
 
98
  explicit NewParagraphAfterLongop(LongOperation* inOp);
 
99
  virtual ~NewParagraphAfterLongop();
 
100
 
 
101
 private:
 
102
  virtual void PerformAfterLongOperation(RLMachine& machine) override;
 
103
};
 
104
 
 
105
#endif  // SRC_LONG_OPERATIONS_PAUSE_LONG_OPERATION_H_