LATTE is one of the most customizable applications in the entire GNOME collection. The reason for this is it's use of Python or Guile as a scripting language. This file is here to help you customize LATTE to fit your specific needs.
A line may be commented out by placing a '#' in the first column LATTE uses the GNU regex library.
<settings> // beginning tag language=C/C++ // Description of the language compiler=gcc -g %2 -o %3 2>&1 // the command to use for compiling (by default) debugger=xterm -e gdb %3 // command for debugging execution=./%3 // command for execution auto_indent=1 // is auto indenting on? use_spaces=0 // should spaces be used instead of tabs? tab_stop=4 // how wide (in spaces) are tabs? </settings> // end tag Constants for compiler, debugger and execution: %term% = the default terminal command, as set in the general preferences.
%make% = the default make command, as set in the general preferences.
%1 = Path to the current file, as set in the directory entry, or if the directory entry is empty, it will be the path to the current file.
%2 = The name of the file without path, but with extension. (if it has one)
%3 = The name of the file without path or extension.
<extensions> <item name="c source file" ext="c"> <item name="include file" ext="h"> <item name="c++ source file" ext="cpp"> </extensions> This is simply a list of supported extensions.
<syntax> <item name="string" start="\"" end="\"" color="string" class="d"> </syntax> or... <python> import cc cc.add_syntax_entry("string", "\"", "\(\"\|\n\)", "string", "d") </python> or... <guile> (add-syntax-entry "string" "\"" "\\(\"\\|\\n\\)" "string" "d") </guile> Note: cc is the python module for LATTE. Arg1: the name of the highlight class. Arg2: the regex of the start of the highlight. Arg3: the regex of the end of the highlight. Arg4: the color class (see section 6) Arg5: the font class (see section 7)
<pattern> <item name="labels" words="^[a-zA-Z_]*\:" color="function" class="b"> </pattern> or... <python> import cc cc.add_pattern_entry("labels", "^[a-zA-Z_]*\:", "function", "b") </python> or... <guile> (add-pattern-entry "labels" "^[a-zA-Z_]*\\:" "function" "b") </guile> Note: cc is the python module for LATTE. Arg1: the name of the highlight class. Arg2: the regex of the 'words' to highlight. Arg3: the color class (see section 6) Arg4: the font class (see section 7) Note: notice that guile often times uses 2 '\' characters instead of 1. This is due to it's string parsing routines. Just deal with it :-)
<embedded> <item name="keywords1" start="<" words="\b\(bgcolor\|size\|target\|href\)\b" end=">" color="data_type" class="i"> </embedded> <python> import cc cc.add_embedded_entry("keywords1", "<", r'\b\(bgcolor\|size\|target\|href\)\b', ">", "data_type", "i") </python> or... <guile> (add-embedded-entry("keywords1" "<" "\b\(bgcolor\|size\|target\|href\)\b" ">" "data_type" "i") </guile> Note: cc is the python module for LATTE. Arg1: the name of the highlight class. Arg2: the regex of the start of the area to check. Arg3: the regex of the 'words' to highlight. Arg4: the regex of the end of the area to check. Arg5: the color class (see section 6) Arg6: the font class (see section 7) Note: notice that r' ' is used in the Python section. This is because Python will evaluate \b as a character with a standard string.
When possible, it is a good practice to use the color classes rather than the explicit colors in case the user wants to change the background to something incompatible with a particular text color. The last one, 'default' is special because is will change whenever the default text color changes. This is for those of you who like to make your keywords bold, but the same color as normal text. See the Python and Guile Binding documentation for more information on other code that can be executed in language definitions.
You can mix and match these just about however you want (within logical reason...'d' and 'i' will still get you the default font). However, it is best to only use them with explicit colors (red, blue, etc) and let the user (which may or may not be you) choose the proper font style int he Highlight Colors dialog within LATTE.
[ Python Module : cc ] [1. Introduction] This file documenents the macro language for LATTE. We use PYTHON as the macro language. You can execute a single macro command by typing it in the 'Command' entry of the LATTE toolbar. You can run macros from the Command entry, or from the 'Scripts' menu. When LATTE starts, it executes the macros from the './LATTE/autoexec.py' file in the user's home directory. This is useful to customize LATTE menu entries. [2. Macro commands] int get_file_number() int change(int file_no) int get_files() char *get_default_term_command(); char *get_default_make_command(); int get_file_length(int file_no) int get_file_tab_width(int file_no) int get_file_use_spaces(int file_no) char *get_full_filename(int file_no) char *get_filename(int file_no) char *get_path(int file_no) char *get_file(int file_no) char *get_file_compile_string(int file_no); char *get_file_debug_string(int file_no); char *get_file_execute_string(int file_no); void set_file_done_compiling(int file_no); void set_file_done_debugging(int file_no); void set_file_done_executing(int file_no); int has_selection() int selection_start() int selection_end() void move(int relative_movement) void move_to(int index) int current_position(void) int buffer_size(void) void insert_in(int file_no, int pos, char* text) void insert(char* text) void move_to_line (int index) void move_lines (int relative_movement) int current_line() int line_start() int line_end() int freeze() int thaw() int line_by_pos(int pos) void move_to_col(int index) char* get_text(int begin,int end) char get_current_char() char get_next_char() void delete_text(int start, int end) void delete_text_in(int file_no, int start, int end) void forward_delete (int n) void backward_delete (int index) void undo() void undo_last(int file_no) void redo() void redo_last(int file_no) void cut() void cut_text(int file_no) void copy() void copy_text(int file_no) void paste() void paste_text(int file_no) void clear() void clear_text(int file_no) void clear_entry() void select_area(int from, int to) void select_text(int file_no, int from, int to) void select_current() void select_all() void select_all_text(int file_no) void highlight_syntax(int file_no) void new_window() void new_file(char *filename) void open_file(char *filename) void close_file(int file_no) void save_all_files() void close_all_files() int find(char *text) int find_in(int file_no, char *text) int find_regex(char *text) int find_regex_in(int file_no, char *text) int replace(char *search_text, char *replacer) int replace_in(int file_no, char *search_text, char *replacer) int replace_all(char *search_text, char *replacer) int replace_all_in(int file_no, char *search_text, char *replacer) [2.1 PyGtk specific fuctions] // Add a widget to the dock of the main window void add_dock_item(GtkWidget *w, char *name, int band_number, int placement, int band_position, int offset) // Get a pointer to the main window GtkObject *get_gnome_app() // Get a pointer to GdsFile::script_box GtkObject *get_file_box(int file_no) // Get a pointer to GdsFile::text GtkObject *get_text_widget(int file_no) [2.2 Scripts/Insert/Build/Popup Menus] void add_item_to_scripts_menu(char * label, int position, PyObject *function) int add_sub_to_scripts_menu(char *label, int position) void add_item_to_insert_menu(char * label, int position, PyObject *function) int add_sub_to_insert_menu(char *label, int position) void add_item_to_popup_menu(char * label, int position, PyObject *function) int add_sub_to_popup_menu(char *label, int position) void add_item_to_build_menu(char * label, int position, PyObject *function) int add_sub_to_build_menu(char *label, int position) Note: The return value of the add_sub functions is a pointer index to the sub menu. You can then pass this number as the second argument of the add_item functions to add an item to a particular submenu. [2.3 Custom Toolbar] void add_custom_toolbar_entry(char *label, int position, char *pixmap, int type) int append_custom_toolbar_page(char *label) Note: The return value of append_custom is an index that you can pass as arg2 of add_custom_toolbar_entry. Else, use -1. [2.4 Items available *only* in language definitions] void add_syntax_entry(char *name, char *start, char *end, char *color, char *cclass) void add_pattern_entry(char *name, char *words, char *color, char *cclass) void add_embedded_entry(char *name, char *start, char *words, char *end, char *color, char *cclass) // Register a callback for an event void register_signal_hook(char *signal, void *function) Valid signals: file-add file-remove focus-in focus-out enter-pressed tab-pressed table-destroy compile stop-compile debug stop-debug execute stop-execute
[1. Introduction] This file documenents the macro language for LATTE. We use Guile as the macro language. You can execute a single macro command by typing it in the 'Command' entry of the LATTE toolbar. You can run macros from the Command entry, or from the 'Scripts' menu. When LATTE starts, it executes the macros from the './LATTE/autoexec.scm' file in the user's home directory. This is useful to customize LATTE menu entries. [2. Macro commands] int cc-get-file-number() int cc-change(int file-no) int cc-get-files() char *cc-get-default-term-command(); char *cc-get-default-make-command(); int cc-get-file-length(int file-no) int cc-get-file-tab-width(int file-no) int cc-get-file-use-spaces(int file-no) char *cc-get-full-filename(int file-no) char *cc-get-filename(int file-no) char *cc-get-path(int file-no) char *cc-get-file(int file-no) char *cc-get-file-compile-string(int file_no); char *cc-get-file-debug-string(int file_no); char *cc-get-file-execute-string(int file_no); void cc-set-file-done-compiling(int file_no); void cc-set-file-done-debugging(int file_no); void cc-set-file-done-executing(int file_no); int cc-has-selection() int cc-selection-start() int cc-selection-end() void cc-move(int relative-movement) void cc-move-to(int index) int cc-current-position(void) int cc-buffer-size(void) void cc-insert-in(int file-no, int pos, char* text) void cc-insert(char* text) void cc-move-to-line (int index) void cc-move-lines (int relative-movement) int cc-current-line() int cc-line-start() int cc-line-end() int cc-freeze() int cc-thaw() int cc-line-by-pos(int pos) void cc-move-to-col(int index) char* cc-get-text(int begin,int end) char cc-get-current-char() char cc-get-next-char() void cc-delete-text(int start, int end) void cc-delete-text-in(int file-no, int start, int end) void cc-forward-delete (int n) void cc-backward-delete (int index) void cc-undo() void cc-undo-last(int file-no) void cc-redo() void cc-redo-last(int file-no) void cc-cut() void cc-cut-text(int file-no) void cc-copy() void cc-copy-text(int file-no) void cc-paste() void cc-paste-text(int file-no) void cc-clear() void cc-clear-text(int file-no) void cc-clear-entry() void cc-select-area(int from, int to) void cc-select-text(int file-no, int from, int to) void cc-select-current() void cc-select-all() void cc-select-all-text(int file-no) void cc-highlight-syntax(int file-no) void cc-new-window() void cc-new-file(char *filename) void cc-open-file(char *filename) void cc-close-file(int file-no) void cc-save-all-files() void cc-close-all-files() int cc-find(char *text) int cc-find-in(int file-no, char *text) int cc-find-regex(char *text) int cc-find-regex-in(int file-no, char *text) int cc-replace(char *search-text, char *replacer) int cc-replace-in(int file-no, char *search-text, char *replacer) int cc-replace-all(char *search-text, char *replacer) int cc-replace-all-in(int file-no, char *search-text, char *replacer) [2.1 When gtk-guile is installed] void add_dock_item(GtkWidget *w, char *name, int band_number, int placement, int band_position, int offset) GtkObject *get_gnome_app() GtkObject *get_file_box(int file_no) GtkObject *get_text_widget(int file_no) [2.2 Scripts/Insert/Build/Popup Menus] void cc-add-item-to-scripts-menu(char *label, int position, PyObject *function) int cc-add-sub-to-scripts-menu(char *label, int position) void cc-add-item-to-insert-menu(char *label, int position, PyObject *function) int cc-add-sub-to-insert-menu(char *label, int position) void cc-add-item-to-popup-menu(char *label, int position, PyObject *function) int cc-add-sub-to-popup-menu(char *label, int position) void cc-add-item-to-build-menu(char *label, int position, PyObject *function) int cc-add-sub-to-build-menu(char *label, int position) Note: The return value of the add-sub functions is a pointer index to the sub menu. You can then pass this number as the second argument of the add-item functions to add an item to a particular submenu. [2.3 Custom Toolbar] bool cc-add-custom-toolbar-entry(char *label, int position, char *pixmap, int type) int cc-append-custom-toolbar-page(char *label) Note: The return value of append_custom is an index that you can pass as arg2 of add_custom_toolbar_entry. Else, use -1. [2.4 Items available *only* in language definitions] void cc-add-syntax-entry(char *name, char *start, char *end, char *color, char *cclass) void cc-add-pattern-entry(char *name, char *words, char *color, char *cclass) void cc-add-embedded-entry(char *name, char *start, char *words, char *end, char *color, char *cclass) void cc-register-signal-hook(char *signal, void *function) Valid signals: file-add file-remove focus-in focus-out enter-pressed tab-pressed table-destroy compile stop-compile debug stop-debug execute stop-execute