src/textadept.h File Reference

#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 Documentation

#define PLAT_GTK   1
#define SS ( editor,
m,
w,
 )     scintilla_send_message(SCINTILLA(editor), m, w, l)

Function Documentation

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:

  • A menubar initially hidden and empty. It should be populated by script and then shown.
  • A side pane. It contains a treeview for hierarchical data sets, such as a file structure for project management.
  • A frame for Scintilla windows.
  • A find text frame initially hidden.
  • A command entry initially hidden. This entry accepts and runs Lua code in the current Lua state.
  • Two status bars: one for notifications, the other for document status.
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.

Parameters:
doc The Scintilla document to add.
Returns:
integer index of the new buffer in textadept.buffers.
void l_add_scintilla_window ( GtkWidget *  editor  ) 

Adds a Scintilla window to the global 'views' table with a metatable.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.
Returns:
int reference to the created table in LUA_REGISTRYINDEX.
void l_pm_popup_context_menu ( GdkEventButton *  event  ) 

Requests a popup context menu for a selected Project Manager item.

Parameters:
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.

Parameters:
doc The Scintilla buffer to remove.
void l_remove_scintilla_window ( GtkWidget *  editor  ) 

Removes a Scintilla window from the global 'views' table.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.
See also:
l_add_scintilla_buffer
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.

Parameters:
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.
Returns:
the Scintilla window.
See also:
l_add_scintilla_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.

Parameters:
doc The Scintilla buffer ID to remove.
See also:
l_remove_scintilla_buffer
void remove_scintilla_window ( GtkWidget *  editor  ) 

Removes a Scintilla window.

Parameters:
editor The Scintilla window to remove.
See also:
l_remove_scintilla_window
void set_menubar ( GtkWidget *  new_menubar  ) 

Sets a user-defined GTK menubar and displays it.

Parameters:
new_menubar The GTK menubar.
See also:
l_ta_mt_newindex
void set_statusbar_text ( const char *  text,
int  docbar 
)

Sets the notification statusbar text.

Parameters:
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.

Parameters:
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.

Parameters:
editor The Scintilla window to keep when unsplitting.
See also:
remove_scintilla_windows_in_pane
remove_scintilla_window

Variable Documentation

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
GtkWidget * whole_word_opt
GtkWidget* window

Generated by  doxygen 1.6.2