/* 3.44 ###############################################################
   
			SMAC FILE USED BY XCORAL EDITOR
   
   File: xcoralrc.lf
   Path: /home/fournigault/c/X11/xcoral-2.33/SmacLib/xcoralrc.lf
   Description: 
   Created: Sun Aug  7 14:52:32 MET 1994
   Author: Thierry Emery
   Modified: Fri Feb 17 15:38:00 MET 1995
   Last maintained by: Lionel Fournigault
   
   RCS $Revision$ $State$
   
   
   ####################################################################
   
   Note: initialization file for Xcoral
   
   ####################################################################
   
   Copyright (c) : Thierry Emery
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   
   #################################################################### */


/* --------------------------------------------------------------------
   Load standard libraries
   -------------------------------------------------------------------- */
{
  /* general SMAC programmer and XCORAL user utilities */
  load_file("utilities.sc");
  
  /* C and C++ mode, auto indent, reindent, indent region etc */
  load_file("mode.sc" );

  /* provide class method and function profile */
  load_file("head.sc");
  
  /* extract logical pathname from automount pathname */
  load_file("hack-filename.sc");

  /* command shell utilities, grep make user interface */
  load_file("cmd.sc" );
  
  /* for us frenchies */
  load_file("french.sc");

  /* SMAC functions writer and/or user help */
  load_file("describe.sc");
  
  /* extensions of C and C++ modes */
  load_file("mode-ext.sc");
  
  /* mouse customization */
  load_file("mouse.sc");
  
  /* C C++ comments facilities */
  load_file("comments.sc");
  
  /* file title and custom organization title */
  load_file("title.sc");
  
  /* save file utilities */
  load_file("save.sc");
  
  /* global set key utilities */
  load_file("keydef-ext.sc");
  
  /* word completion */
  load_file("complete-word.sc");
  
  /* window-utilities */
  load_file("window-utilities.sc");
  
  /* compare two windows */
  load_file("compare-win.sc");

  /* latex indent */
  load_file("latex.sc");

  /* color region buffer */
  load_file("color.sc");

  /* edit directory */
  load_file("edir.sc");

  /* rcs interface */
  load_file("rcs.sc");
  
  /* Version control */
  load_file("version.sc");
  
  /* Latex utilities */
  load_file("latex-macros.sc");
  
  /* Misc utilities */
  load_file("misc-commands.sc");
 
 /* html utilities */
  load_file("html.sc");

  /* java mode */
  load_file("java.sc");

  /* hanoi demo */
  load_file("hanoi.sc");

  /* shell mode */
  load_file("shell-script.sc");
}

/* --------------------------------------------------------------------
   define fonts
   -------------------------------------------------------------------- */
{
  set_mode_font("default",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("C-mode",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("C++mode",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("Java",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("Latex",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("Html",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("Ada",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("Perl",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("Fortran",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("shell",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("Shell",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font("Edir",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
  set_mode_font ("french",
		  "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1");
}

/* ---------------------------------------------------------------------
   define colors
   Generics colors for all modes with background set to ivory
   --------------------------------------------------------------------- */
{
  gen_comment_color = "limegreen";
  gen_include_color = "goldenrod";
  gen_define_color = "forestgreen";
  gen_keyword_color = "goldenrod";
  gen_string_color = "steelblue";
  
  gen_varfunc_color = "tomato";
  gen_decl_color = "forestgreen";
  gen_class_color = "tomato";
  gen_del_new_color = "red";
  gen_return_color = "lightsteelblue";
  gen_link_color = "tan";
  gen_makefile_color = "plum";

  /* C,C++ colors */
  cpp_comment_color = gen_comment_color;
  cpp_keyword_color = gen_keyword_color;
  cpp_define_color = gen_define_color;
  cpp_string_color = gen_string_color;
 
  /* Java colors */
  java_comment_color = gen_comment_color;
  java_category_color = gen_del_new_color;
  java_result_color = gen_return_color;
  java_class_color = gen_class_color;
  java_modifier_color = gen_keyword_color;
  java_keyword_color = gen_keyword_color;
  java_import_color = gen_define_color;
  java_string_color = gen_string_color;
  java_package_color = gen_include_color;

  /* latex colors */
  latex_comment_color = gen_comment_color;
  latex_keyword_color = gen_keyword_color;
  latex_defun_color = gen_decl_color;
  latex_define_color = gen_define_color;
  latex_decl_color = gen_decl_color;
  latex_label_color = gen_keyword_color;
  latex_include_color = gen_include_color;
  latex_italic_color = gen_decl_color;
  latex_bold_color = gen_varfunc_color;
  latex_ref_color = gen_comment_color;

  /* html colors */
  html_title_color = gen_comment_color;
  html_ibtt_color = gen_keyword_color;
  html_pre_color = gen_define_color;
  html_img_color = gen_decl_color;
  html_ref_color = gen_varfunc_color;
  html_list_color = gen_define_color;
  html_forms_color = gen_include_color;
  html_hds_color = gen_keyword_color;
  hltml_string_color = gen_string_color;
  
  /* Edir colors */
  edir_directory_color = gen_comment_color;
  edir_link_color = gen_link_color;
  edir_c_file_color = gen_decl_color;
  edir_tex_file_color = gen_decl_color;
  edir_sc_file_color = gen_decl_color;
  edir_h_file_color = gen_keyword_color;
  edir_makefile_color = gen_string_color;
  edir_readme_color = gen_del_new_color;

  /* Perl colors */
  perl_comment_color = gen_comment_color;
  perl_string_color = gen_string_color;
  perl_label_color = gen_define_color;
  perl_include_color = gen_include_color;
  perl_decl_color = gen_decl_color;
  perl_defun_color = gen_class_color;
  perl_keyword_color = gen_keyword_color;
  
  /* Fortran90 colors */
  f90_comment_color = gen_comment_color;
  f90_string_color  = gen_string_color;
  f90_unit_color    = gen_class_color;
  f90_include_color = gen_include_color;
  f90_type_color    = gen_decl_color;
  f90_decl_color    = gen_decl_color;
  f90_keyword_color = gen_keyword_color;
  
  /* Shell colors */
  shell_comment_color = gen_comment_color;
  shell_string_color = gen_string_color;
  shell_include_color = gen_include_color;
  shell_define_color = gen_define_color;
  shell_var_color = gen_varfunc_color;
  shell_keyword_color = gen_keyword_color;
}

/* ---------------------------------------------------------------------
   define indentation variables (mode C, C++ and Java)
   --------------------------------------------------------------------- */
{
  c_indent_in_comment = 3;
  c_indent_in_string = 0;
  c_indent_in_parenthesis = 1;
  c_indent_in_bracket = 1;
  c_indent_in_brace = 2;
  c_indent_in_statement = 2;
  c_arg_decl_indent = 4;
}

/* ---------------------------------------------------------------------
   define suffixes
   --------------------------------------------------------------------- */
{
  set_mode_suffixes("C++mode",".c .cc .cpp .h .hh .sc .xcoralrc");
  set_mode_suffixes("Java",".java .sc .xcoralrc");
  set_mode_suffixes("C-mode",".c .h .sc .xcoralrc");
  set_mode_suffixes("Latex",".tex .latex .sty");
  set_mode_suffixes("Html",".html");
  set_mode_suffixes("Perl",".pl");
  set_mode_suffixes("Fortran",".f .f90");
  set_mode_suffixes("Ada",".a");
  
  set_mode_suffixes("french",".txt .texte");
}

/* ---------------------------------------------------------------------
   define modes on which global_key_def operates
   --------------------------------------------------------------------- */
{
  globalize_mode("default");
  globalize_mode("C-mode");
  globalize_mode("C++mode");
  globalize_mode("Java");
  globalize_mode("Latex");
  globalize_mode("Html");
  globalize_mode("Perl");
  globalize_mode("Ada");
  globalize_mode("Fortran");
  globalize_mode("shell");
  globalize_mode("french");
  globalize_mode("Shell");
}

/* ---------------------------------------------------------------------
   Util Smac functions.
   --------------------------------------------------------------------- */
{
  global_key_def("^xt", "transpose_chars");
  global_key_def("^xy", "transpose_forms");
  global_key_def("^[\\", "delete_line_blanks");
  global_key_def("^[ ",  "just_one_blank");
  global_key_def("^[k",  "delete_to_beginning_of_line");
  global_key_def("^xc",  "center_line");
  global_key_def("^[m", "recenter");
  
  global_key_def("^x#", "sharp_comment");
  global_key_def("^x+", "plus_comment");
  global_key_def("^x=", "equal_comment");
  global_key_def("^x-", "minus_comment");
  global_key_def("^x%", "percent_comment");
  global_key_def("^xz", "update_title_and_save_file");
  global_key_def("^xs", "update_title_backup_and_save_file");
  global_key_def("^[/", "complete_word");
  global_key_def("^xC", "CompareAgain");
  global_key_def("^xg", "go_next");
  global_key_def("^xa", "color_buffer");
  
  global_key_def("^xe", "edir");
  key_def("Edir", "^xe", "edir");

  key_def("Shell", "^[b", "backward_c_form");
  key_def("Shell", "^[f", "forward_c_form");
  key_def("Shell", "^[d", "delete_next_c_form");
  key_def("Shell", "^[\b", "delete_previous_c_form");
  key_def("Shell", "^[\177", "delete_previous_c_form"); /* esc delete */
  key_def("Shell", "^x^c", "quit_shell");

  key_def("Latex","^[x", "latex_back_indent");
}

/* ----------------------------------------------------------------------------
   French accents in Latex mode.
   ---------------------------------------------------------------------------- */
{
    key_def("Latex", "'", "french_accent");
    key_def("Latex", "`", "french_accent");
    key_def("Latex", "^^", "french_accent");
    key_def("Latex", "\"", "french_accent");
}

/* ----------------------------------------------------------------------------
   User commands: call by Users commands item in Misc Menu or toolbar
   ---------------------------------------------------------------------------- */
user_commands()
{
/****
    char *str;
    int win = current_window();

    clear_list();
    add_list_item("User smac function 1");
    add_list_item("User smac function 2");
    add_list_item("User smac function 3");

    str = select_from_list("User commands");
    redisplay();
    select_window(win);
    
    if(str==0 || strlen(str) < 2) {
	return;
    }
    
    if (strcmp(str,"User smac function 1")==0) {
	user_smac_function_1();
	return;
    }
    ...
****/
}


