aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/textadept.h
blob: f017ad82618d28696901b1d72d9552c146650721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.

#ifndef TEXTADEPT_H
#define TEXTADEPT_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>

#define PLAT_GTK 1
#include <Scintilla.h>
#include <SciLexer.h>
#include <ScintillaWidget.h>

extern "C" {
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
}

#ifdef WIN32
#include "Windows.h"
#define strcasecmp _stricmp
#endif

#ifdef MAC
#include <Carbon/Carbon.h>
using namespace Scintilla;
#endif

// globals
extern GtkWidget *window, *focused_editor, *command_entry, *pm_container,
                 *pm_entry, *pm_view, *findbox, *find_entry, *replace_entry,
                 *fnext_button, *fprev_button, *r_button, *ra_button,
                 *match_case_opt, *whole_word_opt, *lua_opt, *in_files_opt;
extern GtkTreeStore *pm_store;
extern lua_State *lua;
#if !(WIN32 || MAC)
static const char *textadept_home = "/usr/share/textadept/";
#else
extern char *textadept_home;
#endif

static long SS(ScintillaObject *sci, unsigned int msg, unsigned long wParam=0,
               long lParam=0) {
  return scintilla_send_message(sci, msg, wParam, lParam);
}

// textadept.c
void create_ui();
GtkWidget *new_scintilla_window(sptr_t default_id);
void remove_scintilla_window(GtkWidget *editor);
void new_scintilla_buffer(ScintillaObject *sci, bool create, bool addref);
void remove_scintilla_buffer(sptr_t doc);
void split_window(GtkWidget *editor, bool vertical);
bool unsplit_window(GtkWidget *editor);
void set_menubar(GtkWidget *menubar);
void set_statusbar_text(const char *text, bool docbar);
void ce_toggle_focus();

GtkWidget *pm_create_ui();
void pm_toggle_focus();
void pm_open_parent(GtkTreeIter *iter, GtkTreePath *path);
void pm_close_parent(GtkTreeIter *iter, GtkTreePath *path);
void pm_activate_selection();
void pm_popup_context_menu(GdkEventButton *event);
void pm_process_selected_menu_item(GtkWidget *menu_item, int menu_id);

GtkWidget *find_create_ui();
void find_toggle_focus();

// lua_interface.c
bool l_init(int argc, char **argv, bool reinit);
void l_close();
bool l_load_script(const char *script_file);
void l_add_scintilla_window(GtkWidget *editor);
void l_remove_scintilla_window(GtkWidget *editor);
void l_goto_scintilla_window(GtkWidget *editor, int n, bool absolute);
void l_set_view_global(GtkWidget *editor);
int  l_add_scintilla_buffer(sptr_t doc);
void l_remove_scintilla_buffer(sptr_t doc);
void l_goto_scintilla_buffer(GtkWidget *editor, int n, bool absolute);
void l_set_buffer_global(ScintillaObject *sci);

void l_handle_error(lua_State *lua, const char *errmsg);
bool l_handle_event(const char *e, const char *arg=NULL);
bool l_handle_keypress(int keyval, bool shift, bool control, bool alt);
void l_handle_scnnotification(SCNotification *n);
void l_ta_command(const char *command);
void l_ta_popup_context_menu(GdkEventButton *event);

bool l_cec_get_completions_for(const char *entry_text);
void l_cec_populate(GtkListStore *store);

bool l_pm_get_contents_for(const char *entry_text, bool expanding);
void l_pm_populate(GtkTreeIter *initial_iter);
void l_pm_get_full_path(GtkTreePath *path);
void l_pm_perform_action();
void l_pm_popup_context_menu(GdkEventButton *event, GCallback callback);
void l_pm_perform_menu_action(int menu_id);

void l_find(const char *ftext, bool next);
void l_find_replace(const char *rtext);
void l_find_replace_all(const char *ftext, const char *rtext);

#endif