Glimmer Customization Information

# Glimmer

-

### Customization Information

Glimmer 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 Glimmer to fit your specific needs.

- Language Definitions
- Color Classes
- Font Classes
- Python Language Bindings

### Language Definition Information

    Glimmer uses the gnome-xml (libxml) parser to parse its language definitions, so all standard xml rules apply.
    A line may be commented out by placing a '#' in the first column
    The definition starts with the <glimmer-definition> tag and ends with </glimmer-definition> tag.
    Glimmer uses the GNU regex library.

#### [Section 1: General Settings]

    <settings>
     <language>C++</language>
     <compiler>g++ -g %2 -o %3 2>&1</compiler>
     <debugger>%term% -e gdb %3</debugger>
     <execution>./%3</execution>
     <auto-indent>1</auto-indent>
     <use-spaces>0</use-spaces>
     <tab-stop>4</tab-stop>
    </settings>

    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.

#### [Section 2: Supported Mime Types and Extensions]

    <mime-types>
     <extension>cpp</extension>
     <extension>cxx</extension>
     <mime-type>text/x-cpp</mime-type>
    </mime-types>

    This is simply a list of supported extensions and mime types.

#### [Section 3: Highlighting between 2 regex's]

    <syntax-items>
     <syntax-item>
      <name>string</name>
      <start-regex>&quot;</start-regex>
      <end-regex>&quot;</end-regex>
      <style>string</style>
     </syntax-item>
    </syntax-items>

#### [Section 4: Highlighting words and characters]

    <pattern-items>
     <pattern-item>
      <name>label</name>
      <regex>^[a-zA-Z_]*\:</regex>
      <style>function</style>
     </pattern-item>
    </pattern-items>

#### [Section 5: Highlighting words and characters between 2 specified regex's]

    <embedded-items>
     <embedded-item>
      <name>keywords</name>
      <start-regex>&lt;</start-regex>
      <end-regex>&gt;</end-regex>
      <regex>\b\(bgcolor\|size\|target\|href\)\b</regex>
      <style>keyword</style>
     </embedded-item>
    </embedded-items>

#### [Section 6: Color classes]

- string
- char
- char_string
- keyword
- comment
- preprocessor
- data_type
- function
- macro
- variable
- symbol
- operator
- punctuation
- decimal
- hexidecimal
- octal
- white
- black
- gray
- blue
- dark_blue
- red
- dark_red
- green
- dark_green
- cyan
- magenta
- yellow
- orange
- default (this changes with the default color)

    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.

#### [Section 7: Font classes]

- Default = 'd'
- Italic = 'i'
- Bold = 'b'
- Bold+Italic = 'bi'
- Strikeout = 's'
- Underline = 'u'

    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 in the Highlight Colors dialog within Glimmer.

### Python Binding Information

    [ Python Module : glimmer ]

    [1.  Introduction]

    This file documenents the macro language for Glimmer. We use PYTHON
    as the macro language.

    You can execute a single macro command by typing it in the 'Command' entry
    of the Glimmer toolbar. You can run macros from the Command entry,
    or from the 'Scripts' menu.

    When Glimmer starts, it executes the macros from the
    '~$/.Glimmer/autoexec.py' file in the user's home directory.
    This is useful to customize Glimmer 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();
    bool get_tab_stops()
    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)

    // Add an object to the paned area specified by pos (0 = Left, going clockwise)
    // Multiple entries in a pane will appear in a GtkNotebook
    void add_paned_object(GtkWidget *widget, char *name, int pos)

    void remove_paned_object(char *name)

    // Get a reference to this mug
    GtkObject *get_paned_object(char *name)

    // Provided because pygtk doesn't wrap gtk_object_[un]ref
    GtkObject *ref_paned_object(char *name)
    GtkObject *unref_paned_object(char *name)

    [2.2 Menu Customization]

    void add_item_to_menu(char *path, char *label, char* hint, char *keybinding, int position, PyObject *function)

    int add_sub_to_menu(char *path, char *label, int position)

    void add_widget_to_menu(char *path, GtkWidget *widget)

    void add_item_to_popup_menu(char * label, int position, PyObject *function)

    int add_sub_to_popup_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, void *callback)

    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 *outside, char *inside, char *color, char *cclass)

    // Register a callback for an event
    void register_signal_hook(char *signal, void *function)

    Signals valid in language definitions:
      table-add
      table-remove
      table-destroy
      focus-in
      focus-out
      enter-pressed
      tab-pressed
      key-pressed (NOTE: this callback takes 6 integer arguments, unlike the other callbacks which take no arguments)
      compile
      stop-compile
      debug
      stop-debug
      execute
      stop-execute

    Signals valid anywhere:
      open-file
      revert-file
      save-file
      save-as-file
      close-file
      change-file
      move-left
      move-right

Glimmer is Copyright 1999-2001 by Chris Phelps