~ubuntu-branches/ubuntu/wily/apvlv/wily

« back to all changes in this revision

Viewing changes to src/ApvlvCmds.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-01 22:18:49 UTC
  • mfrom: (10.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110601221849-niibd5p5i7avemy4
Tags: 0.1.1-1.1
* Non-maintainer upload.
* Add support for poppler >= 0.15. Patch by Pino Toscano. (Closes: #627609)

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#include <iostream>
39
39
#include <vector>
40
40
#include <map>
 
41
 
41
42
using namespace std;
42
43
 
43
44
namespace apvlv
44
 
{
 
45
  {
45
46
  typedef enum
46
47
  {
47
48
    CT_CMD,
57
58
  typedef map < ApvlvCmdKeyv, ApvlvCmd * >ApvlvCmdMap;
58
59
 
59
60
  class ApvlvCmd
60
 
  {
61
 
  public:
62
 
    ApvlvCmd ();
63
 
 
64
 
    ~ApvlvCmd ();
65
 
 
66
 
    void process ();
67
 
 
68
 
    void push (const char *s, cmdType type = CT_CMD);
69
 
 
70
 
    bool append (GdkEventKey * key);
71
 
 
72
 
    const char *append (const char *s);
73
 
 
74
 
    bool cmp (ApvlvCmd & cmd);
75
 
 
76
 
    void type (cmdType type);
77
 
 
78
 
    cmdType type ();
79
 
 
80
 
    void bemap (bool bemap);
81
 
 
82
 
    bool bemap ();
83
 
 
84
 
    void canmap (bool canmap);
85
 
 
86
 
    bool canmap ();
87
 
 
88
 
    void hascount (bool hascount);
89
 
 
90
 
    bool hascount ();
91
 
 
92
 
    const char *c_str ();
93
 
 
94
 
    ApvlvCmdKeyv *keyvalv_p ();
95
 
 
96
 
    ApvlvCmdKeyv keyvalv ();
97
 
 
98
 
    void precount (gint precount);
99
 
 
100
 
    gint precount ();
101
 
 
102
 
    gint keyval (guint id);
103
 
 
104
 
    void next (ApvlvCmd * cmd);
105
 
 
106
 
    ApvlvCmd *next ();
107
 
 
108
 
    void origin (ApvlvCmd * cmd);
109
 
 
110
 
    ApvlvCmd *origin ();
111
 
 
112
 
  private:
113
 
 
114
 
    // command type
 
61
    {
 
62
    public:
 
63
      ApvlvCmd ();
 
64
 
 
65
      ~ApvlvCmd ();
 
66
 
 
67
      void process ();
 
68
 
 
69
      void push (const char *s, cmdType type = CT_CMD);
 
70
 
 
71
      bool append (GdkEventKey * key);
 
72
 
 
73
      const char *append (const char *s);
 
74
 
 
75
      bool cmp (ApvlvCmd & cmd);
 
76
 
 
77
      void type (cmdType type);
 
78
 
 
79
      cmdType type ();
 
80
 
 
81
      void bemap (bool bemap);
 
82
 
 
83
      bool bemap ();
 
84
 
 
85
      void canmap (bool canmap);
 
86
 
 
87
      bool canmap ();
 
88
 
 
89
      void hascount (bool hascount);
 
90
 
 
91
      bool hascount ();
 
92
 
 
93
      const char *c_str ();
 
94
 
 
95
      ApvlvCmdKeyv *keyvalv_p ();
 
96
 
 
97
      ApvlvCmdKeyv keyvalv ();
 
98
 
 
99
      void precount (gint precount);
 
100
 
 
101
      gint precount ();
 
102
 
 
103
      gint keyval (guint id);
 
104
 
 
105
      void next (ApvlvCmd * cmd);
 
106
 
 
107
      ApvlvCmd *next ();
 
108
 
 
109
      void origin (ApvlvCmd * cmd);
 
110
 
 
111
      ApvlvCmd *origin ();
 
112
 
 
113
    private:
 
114
 
 
115
      // command type
115
116
      cmdType mType;
116
117
 
117
 
    // if cmd is be mapped
118
 
    bool mBeMap;
119
 
 
120
 
    // if cmd can be mapped
121
 
    bool mCanMap;
122
 
 
123
 
    // if has count
124
 
    bool mHasPreCount;
125
 
 
126
 
    // how to descripe this command in .apvlvrc
127
 
    // like <C-d><C-w>, <S-b>s, or :run, :vsp, ...
128
 
    string mStrCommand;
129
 
 
130
 
    // key's value list
131
 
    ApvlvCmdKeyv mKeyVals;
132
 
 
133
 
    // cmd's pre count
134
 
    gint mPreCount;
135
 
 
136
 
    // next command
137
 
    ApvlvCmd *mNext;
138
 
 
139
 
    // when a key is map to other, this is the origin cmd.
140
 
    // after a maped key was processed, return to this cmds
141
 
    ApvlvCmd *mOrigin;
142
 
  };
 
118
      // if cmd is be mapped
 
119
      bool mBeMap;
 
120
 
 
121
      // if cmd can be mapped
 
122
      bool mCanMap;
 
123
 
 
124
      // if has count
 
125
      bool mHasPreCount;
 
126
 
 
127
      // how to descripe this command in .apvlvrc
 
128
      // like <C-d><C-w>, <S-b>s, or :run, :vsp, ...
 
129
      string mStrCommand;
 
130
 
 
131
      // key's value list
 
132
      ApvlvCmdKeyv mKeyVals;
 
133
 
 
134
      // cmd's pre count
 
135
      gint mPreCount;
 
136
 
 
137
      // next command
 
138
      ApvlvCmd *mNext;
 
139
 
 
140
      // when a key is map to other, this is the origin cmd.
 
141
      // after a maped key was processed, return to this cmds
 
142
      ApvlvCmd *mOrigin;
 
143
    };
143
144
 
144
145
  class ApvlvCmds
145
 
  {
146
 
  public:
147
 
    ApvlvCmds ();
148
 
 
149
 
    ~ApvlvCmds ();
150
 
 
151
 
    void append (GdkEventKey * gev);
152
 
 
153
 
    bool buildmap (const char *os, const char *ms);
154
 
 
155
 
  private:
 
146
    {
 
147
    public:
 
148
      ApvlvCmds ();
 
149
 
 
150
      ~ApvlvCmds ();
 
151
 
 
152
      void append (GdkEventKey * gev);
 
153
 
 
154
      bool buildmap (const char *os, const char *ms);
 
155
 
 
156
    private:
156
157
 
157
158
      ApvlvCmd * process (ApvlvCmd * cmd);
158
159
 
159
 
    returnType ismap (ApvlvCmdKeyv * ack);
160
 
 
161
 
    ApvlvCmd *getmap (const char *os);
162
 
 
163
 
    ApvlvCmd *getmap (ApvlvCmd * cmd);
164
 
 
165
 
    static gboolean apvlv_cmds_timeout_cb (gpointer);
166
 
 
167
 
    ApvlvCmdMap mMaps;
168
 
 
169
 
    ApvlvCmd *mCmdHead;
170
 
 
171
 
    enum cmdState
172
 
    {
173
 
      GETTING_COUNT,
174
 
      GETTING_CMD,
175
 
      CMD_OK,
176
 
    } mState;
177
 
 
178
 
    gint mTimeoutTimer;
179
 
 
180
 
    string mCountString;
181
 
  };
 
160
      returnType ismap (ApvlvCmdKeyv * ack);
 
161
 
 
162
      ApvlvCmd *getmap (const char *os);
 
163
 
 
164
      ApvlvCmd *getmap (ApvlvCmd * cmd);
 
165
 
 
166
      static gboolean apvlv_cmds_timeout_cb (gpointer);
 
167
 
 
168
      ApvlvCmdMap mMaps;
 
169
 
 
170
      ApvlvCmd *mCmdHead;
 
171
 
 
172
      enum cmdState
 
173
      {
 
174
        GETTING_COUNT,
 
175
        GETTING_CMD,
 
176
        CMD_OK,
 
177
      } mState;
 
178
 
 
179
      gint mTimeoutTimer;
 
180
 
 
181
      string mCountString;
 
182
    };
182
183
 
183
184
  extern ApvlvCmds *gCmds;
184
185
}