~ubuntu-branches/ubuntu/saucy/apvlv/saucy

« back to all changes in this revision

Viewing changes to src/ApvlvView.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:
37
37
#include "ApvlvDoc.hpp"
38
38
#include "ApvlvWindow.hpp"
39
39
 
 
40
#include <gtk/gtk.h>
 
41
 
40
42
#include <iostream>
41
 
 
42
 
#include <gtk/gtk.h>
43
 
 
44
43
#include <list>
45
44
 
46
45
namespace apvlv
47
 
{
 
46
  {
48
47
  typedef enum
49
48
  {
50
49
    SEARCH = '/',
56
55
  class ApvlvWindow;
57
56
 
58
57
  class ApvlvView
59
 
  {
60
 
  public:
61
 
    ApvlvView (const char *);
62
 
 
63
 
     ~ApvlvView ();
64
 
 
65
 
    void show ();
66
 
 
67
 
    GtkWidget *widget ();
68
 
 
69
 
    ApvlvWindow *currentWindow ();
70
 
 
71
 
    void delcurrentWindow ();
72
 
 
73
 
    bool newtab (const char *filename);
74
 
 
75
 
    bool newtab (ApvlvCore * core);
76
 
 
77
 
    void promptcommand (char ch);
78
 
 
79
 
    void promptcommand (const char *str);
80
 
 
81
 
    void errormessage (const char *str, ...);
82
 
 
83
 
    void infomessage (const char *str, ...);
84
 
 
85
 
    bool run (const char *str);
86
 
 
87
 
    bool loadfile (string file);
88
 
 
89
 
    bool loadfile (const char *filename);
90
 
 
91
 
    bool loaddir (const char *path);
92
 
 
93
 
    ApvlvCore *hasloaded (const char *filename, int type);
94
 
 
95
 
    void regloaded (ApvlvCore *);
96
 
 
97
 
    void open ();
98
 
 
99
 
    void opendir ();
100
 
 
101
 
    void close ();
102
 
 
103
 
    void quit ();
104
 
 
105
 
    void fullscreen ();
106
 
 
107
 
    returnType process (int hastimes, int times, guint keyval);
108
 
 
109
 
    returnType subprocess (int times, guint keyval);
110
 
 
111
 
    void cmd_show (int ct);
112
 
 
113
 
    void cmd_hide ();
114
 
 
115
 
    void cmd_auto (const char *);
116
 
 
117
 
    void settitle (const char *);
118
 
 
119
 
    ApvlvCore *crtadoc ();
120
 
 
121
 
  private:
122
 
    void refresh ();
123
 
 
124
 
    bool destroy;
125
 
 
126
 
    GCompletion *filecompleteinit (const char *s);
127
 
 
128
 
    bool runcmd (const char *cmd);
129
 
 
130
 
    int new_tabcontext (ApvlvCore * core, bool insertAfterCurr);
131
 
 
132
 
    void delete_tabcontext (int tabPos);
133
 
 
134
 
    void switch_tabcontext (int tabPos);
135
 
 
136
 
    // Caclulate number of pixels that the document should be.
137
 
    //  This figure accounts for decorations like (mCmdBar and mHaveTabs).
138
 
    // Returns a nonnegative number.
139
 
    int adjheight ();
140
 
 
141
 
    void switchtab (int tabPos);
142
 
 
143
 
    // Update the tab's context and update tab label.
144
 
    void windowadded ();
145
 
 
146
 
    void updatetabname ();
147
 
 
148
 
    int mCmdType;
149
 
 
150
 
    guint mProCmd;
151
 
 
152
 
    GtkWidget *mMainWindow;
153
 
 
154
 
    ApvlvMenu *mMenu;
155
 
 
156
 
    GtkWidget *mViewBox;
157
 
 
158
 
    GtkWidget *mTabContainer;
159
 
    GtkWidget *mCommandBar;
160
 
 
161
 
    struct TabEntry
162
58
    {
163
 
      ApvlvWindow *root;
164
 
      ApvlvWindow *curr;
165
 
 
166
 
      int numwindows;
167
 
        TabEntry (ApvlvWindow * _r, ApvlvWindow * _c, int _n):root (_r),
168
 
        curr (_c), numwindows (_n)
169
 
      {
170
 
      }
171
 
    };
172
 
    // possibly use GArray instead
 
59
    public:
 
60
      ApvlvView (const char *);
 
61
 
 
62
      ~ApvlvView ();
 
63
 
 
64
      void show ();
 
65
 
 
66
      GtkWidget *widget ();
 
67
 
 
68
      ApvlvWindow *currentWindow ();
 
69
 
 
70
      void delcurrentWindow ();
 
71
 
 
72
      bool newtab (const char *filename);
 
73
 
 
74
      bool newtab (ApvlvCore * core);
 
75
 
 
76
      void promptcommand (char ch);
 
77
 
 
78
      void promptcommand (const char *str);
 
79
 
 
80
      void errormessage (const char *str, ...);
 
81
 
 
82
      void infomessage (const char *str, ...);
 
83
 
 
84
      bool run (const char *str);
 
85
 
 
86
      bool loadfile (string file);
 
87
 
 
88
      bool loadfile (const char *filename);
 
89
 
 
90
      bool loaddir (const char *path);
 
91
 
 
92
      ApvlvCore *hasloaded (const char *filename, int type);
 
93
 
 
94
      void regloaded (ApvlvCore *);
 
95
 
 
96
      void open ();
 
97
 
 
98
      void opendir ();
 
99
 
 
100
      void close ();
 
101
 
 
102
      void quit ();
 
103
 
 
104
      void fullscreen ();
 
105
 
 
106
      returnType process (int hastimes, int times, guint keyval);
 
107
 
 
108
      returnType subprocess (int times, guint keyval);
 
109
 
 
110
      void cmd_show (int ct);
 
111
 
 
112
      void cmd_hide ();
 
113
 
 
114
      void cmd_auto (const char *);
 
115
 
 
116
      void settitle (const char *);
 
117
 
 
118
      ApvlvCore *crtadoc ();
 
119
 
 
120
    private:
 
121
      void refresh ();
 
122
 
 
123
      bool destroy;
 
124
 
 
125
      GCompletion *filecompleteinit (const char *s);
 
126
 
 
127
      bool runcmd (const char *cmd);
 
128
 
 
129
      int new_tabcontext (ApvlvCore * core, bool insertAfterCurr);
 
130
 
 
131
      void delete_tabcontext (int tabPos);
 
132
 
 
133
      void switch_tabcontext (int tabPos);
 
134
 
 
135
      // Caclulate number of pixels that the document should be.
 
136
      //  This figure accounts for decorations like (mCmdBar and mHaveTabs).
 
137
      // Returns a nonnegative number.
 
138
      int adjheight ();
 
139
 
 
140
      void switchtab (int tabPos);
 
141
 
 
142
      // Update the tab's context and update tab label.
 
143
      void windowadded ();
 
144
 
 
145
      void updatetabname ();
 
146
 
 
147
      int mCmdType;
 
148
 
 
149
      guint mProCmd;
 
150
 
 
151
      GtkWidget *mMainWindow;
 
152
 
 
153
      ApvlvMenu *mMenu;
 
154
 
 
155
      GtkWidget *mViewBox;
 
156
 
 
157
      GtkWidget *mTabContainer;
 
158
      GtkWidget *mCommandBar;
 
159
 
 
160
      struct TabEntry
 
161
        {
 
162
          ApvlvWindow *root;
 
163
          ApvlvWindow *curr;
 
164
 
 
165
          int numwindows;
 
166
          TabEntry (ApvlvWindow * _r, ApvlvWindow * _c, int _n):root (_r),
 
167
              curr (_c), numwindows (_n)
 
168
          {
 
169
          }
 
170
        };
 
171
      // possibly use GArray instead
173
172
      std::vector < TabEntry > mTabList;
174
 
    int mCurrTabPos;
175
 
 
176
 
    gboolean mHasFull;
177
 
    int mWidth, mHeight;
178
 
 
179
 
    static void apvlv_view_delete_cb (GtkWidget * wid, GtkAllocation * al,
180
 
                                      ApvlvView * view);
181
 
    static void apvlv_view_resized_cb (GtkWidget * wid, GtkAllocation * al,
182
 
                                       ApvlvView * view);
183
 
    static gint apvlv_view_keypress_cb (GtkWidget * wid, GdkEvent * ev,
184
 
                                        ApvlvView * view);
185
 
 
186
 
    static gint apvlv_view_commandbar_cb (GtkWidget * wid, GdkEvent * ev,
187
 
                                          ApvlvView * view);
188
 
 
189
 
    static void apvlv_notebook_switch_cb (GtkWidget * wid,
190
 
                                          GtkNotebookPage * page, guint num,
191
 
                                          ApvlvView * view);
192
 
 
193
 
    ApvlvWindow *mRootWindow;
 
173
      int mCurrTabPos;
 
174
 
 
175
      gboolean mHasFull;
 
176
      int mWidth, mHeight;
 
177
 
 
178
      static void apvlv_view_delete_cb (GtkWidget * wid, GtkAllocation * al,
 
179
                                        ApvlvView * view);
 
180
      static void apvlv_view_resized_cb (GtkWidget * wid, GtkAllocation * al,
 
181
                                         ApvlvView * view);
 
182
      static gint apvlv_view_keypress_cb (GtkWidget * wid, GdkEvent * ev,
 
183
                                          ApvlvView * view);
 
184
 
 
185
      static gint apvlv_view_commandbar_cb (GtkWidget * wid, GdkEvent * ev,
 
186
                                            ApvlvView * view);
 
187
 
 
188
      static void apvlv_notebook_switch_cb (GtkWidget * wid,
 
189
                                            GtkNotebookPage * page, guint num,
 
190
                                            ApvlvView * view);
 
191
 
 
192
      ApvlvWindow *mRootWindow;
194
193
 
195
194
      std::vector < ApvlvCore * >mDocs;
196
195
 
197
196
      std::vector < string > mCmdHistroy;
198
 
    int mCurrHistroy;
199
 
    bool mInHistroy;
 
197
      int mCurrHistroy;
 
198
      bool mInHistroy;
200
199
 
201
 
    static const int APVLV_MENU_HEIGHT, APVLV_CMD_BAR_HEIGHT,
 
200
      static const int APVLV_MENU_HEIGHT, APVLV_CMD_BAR_HEIGHT,
202
201
      APVLV_TABS_HEIGHT;
203
 
  };
 
202
    };
204
203
 
205
204
  extern ApvlvView *gView;
206
205
}