#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <Scintilla.h>
#include <SciLexer.h>
#include <ScintillaWidget.h>
#include <gcocoadialog.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
Defines | |
#define | PLAT_GTK 1 |
#define | SS(editor, m, w, l) scintilla_send_message(SCINTILLA(editor), m, w, l) |
Functions | |
void | create_ui () |
GtkWidget * | new_scintilla_window (sptr_t) |
void | remove_scintilla_window (GtkWidget *) |
void | new_scintilla_buffer (GtkWidget *, int, int) |
void | remove_scintilla_buffer (sptr_t) |
void | split_window (GtkWidget *, int) |
int | unsplit_window (GtkWidget *) |
void | set_menubar (GtkWidget *) |
void | set_statusbar_text (const char *, int) |
void | pm_toggle_focus () |
void | find_toggle_focus () |
void | ce_toggle_focus () |
int | l_init (int, char **, int) |
void | l_close () |
int | l_load_script (const char *) |
void | l_add_scintilla_window (GtkWidget *) |
void | l_remove_scintilla_window (GtkWidget *) |
void | l_goto_scintilla_window (GtkWidget *, int, int) |
void | l_set_view_global (GtkWidget *) |
int | l_add_scintilla_buffer (sptr_t) |
void | l_remove_scintilla_buffer (sptr_t) |
void | l_goto_scintilla_buffer (GtkWidget *, int, int) |
void | l_set_buffer_global (GtkWidget *) |
int | l_handle_event (const char *,...) |
void | l_handle_scnnotification (struct SCNotification *) |
void | l_ta_popup_context_menu (GdkEventButton *) |
int | l_pm_pathtableref (GtkTreeStore *, GtkTreePath *) |
void | l_pm_popup_context_menu (GdkEventButton *) |
Variables | |
GtkWidget * | window |
GtkWidget * | focused_editor |
GtkWidget * | command_entry |
GtkWidget * | pm_container |
GtkWidget * | pm_entry |
GtkWidget * | pm_view |
GtkWidget * | findbox |
GtkWidget * | find_entry |
GtkWidget * | replace_entry |
GtkWidget * | fnext_button |
GtkWidget * | fprev_button |
GtkWidget * | r_button |
GtkWidget * | ra_button |
GtkWidget * | match_case_opt |
GtkWidget * | whole_word_opt |
GtkWidget * | lua_opt |
GtkWidget * | in_files_opt |
char * | textadept_home |
#define PLAT_GTK 1 |
#define SS | ( | editor, | |||
m, | |||||
w, | |||||
l | ) | scintilla_send_message(SCINTILLA(editor), m, w, l) |
void ce_toggle_focus | ( | ) |
Toggles focus between a Scintilla window and the Command Entry. When the entry is visible, the statusbars are temporarily hidden.
void create_ui | ( | ) |
Creates the user interface. The UI consists of:
void find_toggle_focus | ( | ) |
Toggles the focus between the Find/Replace frame and the current Scintilla window.
int l_add_scintilla_buffer | ( | sptr_t | doc | ) |
Adds a Scintilla document to the global 'buffers' table with a metatable.
doc | The Scintilla document to add. |
void l_add_scintilla_window | ( | GtkWidget * | editor | ) |
Adds a Scintilla window to the global 'views' table with a metatable.
editor | The Scintilla window to add. |
void l_close | ( | ) |
Closes the Lua State. Unsplits all Scintilla windows recursively, removes all Scintilla documents, and deletes the last Scintilla window before closing the state.
void l_goto_scintilla_buffer | ( | GtkWidget * | editor, | |
int | n, | |||
int | absolute | |||
) |
Changes a Scintilla window's document to one in the global 'buffers' table. Before doing so, it saves the scroll and caret positions in the current Scintilla document. Then when the new document is shown, its scroll and caret positions are restored.
editor | The Scintilla window to change the document of. | |
n | The index of the document in 'buffers' to focus. | |
absolute | Flag indicating whether or not the index specified in 'views' is absolute. If FALSE, focuses the document relative to the currently focused document for the given index. Throws an error if the buffer does not exist. |
void l_goto_scintilla_window | ( | GtkWidget * | editor, | |
int | n, | |||
int | absolute | |||
) |
Changes focus a Scintilla window in the global 'views' table.
editor | The currently focused Scintilla window. | |
n | The index of the window in the 'views' table to focus. | |
absolute | Flag indicating whether or not the index specified in 'views' is absolute. If FALSE, focuses the window relative to the currently focused window for the given index. Throws an error if the view does not exist. |
int l_handle_event | ( | const char * | s, | |
... | ||||
) |
Handles a Textadept event.
s | String event name. | |
... | Optional arguments to pass to the handler. The variable argument list should contain Lua types followed by the data of that type to pass. The list is terminated by a -1. |
void l_handle_scnnotification | ( | struct SCNotification * | n | ) |
Handles a Scintilla notification.
n | The Scintilla notification struct. |
int l_init | ( | int | argc, | |
char ** | argv, | |||
int | reinit | |||
) |
Inits or re-inits the Lua State. Populates the state with global variables and functions, then runs the 'core/init.lua' script.
argc | The number of command line parameters. | |
argv | The array of command line parameters. | |
reinit | Flag indicating whether or not to reinitialize the Lua State. |
int l_load_script | ( | const char * | script_file | ) |
Loads and runs a given Lua script.
script_file | The path of the Lua script relative to textadept_home. |
int l_pm_pathtableref | ( | GtkTreeStore * | store, | |
GtkTreePath * | path | |||
) |
Creates a Lua table of parent nodes for the given Project Manager treeview path and returns a reference to it. The first table item is the PM Entry text, the next items are parents of the given node in descending order, and the last item is the given node itself. The reference can be retrieved using lua_rawgeti.
store | The GtkTreeStore of the PM view. | |
path | The GtkTreePath of the node. If NULL, only the PM Entry text is contained in the resulting table. |
void l_pm_popup_context_menu | ( | GdkEventButton * | event | ) |
Requests a popup context menu for a selected Project Manager item.
event | The mouse button event. |
void l_remove_scintilla_buffer | ( | sptr_t | doc | ) |
Removes a Scintilla document from the global 'buffers' table. If any views currently show the document to be removed, change the documents they show first.
doc | The Scintilla buffer to remove. |
void l_remove_scintilla_window | ( | GtkWidget * | editor | ) |
Removes a Scintilla window from the global 'views' table.
editor | The Scintilla window to remove. |
void l_set_buffer_global | ( | GtkWidget * | editor | ) |
Sets the global 'buffer' variable to be the document in the specified Scintilla object.
editor | The Scintilla widget housing the buffer to be 'buffer'. |
void l_set_view_global | ( | GtkWidget * | editor | ) |
Sets the global 'view' variable to be the specified Scintilla window.
editor | The Scintilla window to set 'view' to. |
void l_ta_popup_context_menu | ( | GdkEventButton * | event | ) |
Requests and pops up a context menu for the Scintilla view.
event | The mouse button event. |
void new_scintilla_buffer | ( | GtkWidget * | editor, | |
int | create, | |||
int | addref | |||
) |
Creates a new Scintilla buffer for a newly created Scintilla window. The buffer's default properties are set via 'set_default_buffer_properties', but the default style is set here. Generates a 'buffer_new' event.
editor | The Scintilla window to associate the buffer with. | |
create | Flag indicating whether or not to create a buffer. If FALSE, the Scintilla window already has a buffer associated with it (typically because new_scintilla_window was passed a non-NULL buffer_id). | |
addref | Flag indicating whether or not to add a reference to the buffer in the Scintilla window when create is FALSE. This is necessary for creating Scintilla windows in split views. If a buffer appears in two separate Scintilla windows, that buffer should have multiple references so when one Scintilla window closes, the buffer is not deleted because its reference count is not zero. |
GtkWidget* new_scintilla_window | ( | sptr_t | buffer_id | ) |
Creates a new Scintilla window. The Scintilla window is the GTK widget that displays a Scintilla buffer. The window's default properties are set via 'set_default_editor_properties'. Generates a 'view_new' event.
buffer_id | A Scintilla buffer ID to load into the new window. If NULL, creates a new Scintilla buffer and loads it into the new window. |
void pm_toggle_focus | ( | ) |
Toggles the focus between the Project Manager and the current Scintilla window.
void remove_scintilla_buffer | ( | sptr_t | doc | ) |
Removes the Scintilla buffer from the current Scintilla window.
doc | The Scintilla buffer ID to remove. |
void remove_scintilla_window | ( | GtkWidget * | editor | ) |
Removes a Scintilla window.
editor | The Scintilla window to remove. |
void set_menubar | ( | GtkWidget * | new_menubar | ) |
Sets a user-defined GTK menubar and displays it.
new_menubar | The GTK menubar. |
void set_statusbar_text | ( | const char * | text, | |
int | docbar | |||
) |
Sets the notification statusbar text.
text | The text to display. | |
docbar | Flag indicating whether or not the statusbar text is for the docstatusbar. |
void split_window | ( | GtkWidget * | editor, | |
int | vertical | |||
) |
Splits a Scintilla window into two windows separated by a GTK pane. The buffer in the original pane is also shown in the new pane.
editor | The Scintilla window to split. | |
vertical | Flag indicating whether to split the window vertically or horozontally. |
int unsplit_window | ( | GtkWidget * | editor | ) |
Unsplits the pane a given Scintilla window is in and keeps that window. If the pane to discard contains other Scintilla windows, they are removed recursively.
editor | The Scintilla window to keep when unsplitting. |
GtkWidget * command_entry |
GtkWidget * find_entry |
GtkWidget * findbox |
GtkWidget * fnext_button |
GtkWidget * focused_editor |
GtkWidget * fprev_button |
GtkWidget * in_files_opt |
GtkWidget * lua_opt |
GtkWidget * match_case_opt |
GtkWidget * pm_container |
GtkWidget * pm_entry |
GtkWidget * pm_view |
GtkWidget * r_button |
GtkWidget * ra_button |
GtkWidget * replace_entry |
char* textadept_home |
GtkWidget * whole_word_opt |
GtkWidget* window |