2
* This file is part of the apvlv package
4
* Copyright (C) 2008 Alf.
6
* Contact: Alf <naihe2010@gmail.com>
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License
10
* as published by the Free Software Foundation; either version 2.0 of
11
* the License, or (at your option) any later version.
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
18
* You should have received a copy of the GNU General Public
19
* License along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
/* @CPPFILE ApvlvView.hpp
25
* Author: Alf <naihe2010@gmail.com>
27
/* @date Created: 2008/09/30 00:00:00 Alf */
29
#ifndef _APVLV_VIEW_H_
30
#define _APVLV_VIEW_H_
33
# include "config.hpp"
36
#include "ApvlvDoc.hpp"
37
#include "ApvlvWindow.hpp"
60
ApvlvView (const char *);
68
ApvlvWindow *currentWindow ();
70
void delcurrentWindow ();
72
void newtab (const char *filename);
74
void newtab (ApvlvCore *core);
76
void promptcommand (char ch);
78
void promptcommand (const char *str);
80
void run (const char *str);
82
bool loadfile (string file);
84
bool loadfile (const char *filename);
86
bool loaddir (const char *path);
88
ApvlvCore * hasloaded (const char *filename, int type);
90
void regloaded (ApvlvCore *);
102
returnType process (int times, guint keyval);
104
returnType subprocess (int times, guint keyval);
110
void cmd_auto (const char *);
113
ApvlvDoc *crtadoc ();
119
GCompletion *filecompleteinit (const char *s);
121
void runcmd (const char *cmd);
123
int new_tabcontext (ApvlvCore *core, bool insertAfterCurr);
125
void delete_tabcontext (int tabPos);
127
void switch_tabcontext (int tabPos);
129
// Caclulate number of pixels that the document should be.
130
// This figure accounts for decorations like (mCmdBar and mHaveTabs).
131
// Returns a nonnegative number.
134
void switchtab (int tabPos);
136
// Update the tab's context and update tab label.
139
void updatetabname ();
140
bool mHasCmd, mHasTabs;
144
GtkWidget *mCommandBar;
145
GtkWidget *mMainWindow;
147
GtkWidget *mTabContainer;
154
TabEntry (ApvlvWindow *_r, ApvlvWindow *_c, int _n)
155
: root(_r), curr(_c), numwindows(_n)
158
// possibly use GArray instead
159
std::vector<TabEntry> mTabList;
165
static void apvlv_view_delete_cb (GtkWidget * wid, GtkAllocation * al,
167
static void apvlv_view_resized_cb (GtkWidget * wid, GtkAllocation * al,
169
static gint apvlv_view_keypress_cb (GtkWidget * wid, GdkEvent * ev, ApvlvView * view);
171
static gint apvlv_view_commandbar_cb (GtkWidget * wid, GdkEvent * ev, ApvlvView * view);
173
static void apvlv_notebook_switch_cb (GtkWidget * wid, GtkNotebookPage *page, guint num, ApvlvView *view);
175
ApvlvWindow *mRootWindow;
179
static const int APVLV_CMD_BAR_HEIGHT, APVLV_TABS_HEIGHT;
182
extern ApvlvView *gView;