/* ########################################################################

		    SMAC FILE USED BY XCORAL EDITOR

   File: misc_commands.sc
   Path: /home/fournigault/c/X11/xcoral-2.404/SmacLib/misc_commands.sc
   Description: 
   Created: Fri Aug  4 11:00:05 MET 1995
   Author: Lionel Fournigault
   Modified: Fri Aug  4 11:00:06 MET 1995
   Last maintained by: Lionel Fournigault

   RCS $Revision$ $State$
   

   ########################################################################

   Note: 

   Requires: 

   Defines: 

   Suggested bindings: 

   Procedure: 

   ########################################################################

   Copyright (c) : Lionel Fournigault

   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.

   ######################################################################## */

misc_commands()
{
    char *str;
    int win = current_window();

    clear_list();
    add_list_item("title");
    add_list_item("shell_title");
    add_list_item("imake_title");
    add_list_item("smac_title");
    add_list_item("custom_title");
    add_list_item("custom_shell_title");
    add_list_item("custom_imake_title");
    add_list_item(" "); 
    add_list_item("update_title");
    add_list_item("update_title_and_save_file");
    add_list_item("update_title_backup_and_save_file");
    add_list_item(" "); 
    add_list_item("sharp_comment");
    add_list_item("plus_comment");
    add_list_item("equal_comment");
    add_list_item("minus_comment");
    add_list_item("percent_comment");
    add_list_item(" "); 
    add_list_item("change_return_to_newline");
    add_list_item("print_ascii");
    add_list_item("purge");

    str = select_from_list("Misc commands");
    redisplay();
    select_window(win);
    
    if(str==0 || strlen(str) < 2) {
	return;
    }
    
    if (strcmp(str,"title")==0) {
      str = gets("Enter title ");
      if (gets_string_cancelled(str))
	return;
      else
	title(str);
      return;
    }

    if (strcmp(str,"shell_title")==0) {
      str = gets("Enter shell_title ");
      if (gets_string_cancelled(str))
	return;
      else
	shell_title(str);
      return;
    }

    if (strcmp(str,"imake_title")==0) {
      str = gets("Enter imake_title ");
      if (gets_string_cancelled(str))
	return;
      else
	imake_title(str);
      return;
    }

    if (strcmp(str,"smac_title")==0) {
      smac_title();
      return;
    }

    if (strcmp(str,"custom_title")==0) {
      str = gets("Enter custom_title ");
      if (gets_string_cancelled(str))
	return;
      else
	custom_title(str);
      return;
    }

    if (strcmp(str,"custom_shell_title")==0) {
      str = gets("Enter custom_shell_title ");
      if (gets_string_cancelled(str))
	return;
      else
	custom_shell_title(str);
      return;
    }

    if (strcmp(str,"custom_imake_title")==0) {
      str = gets("Enter custom_imake_title ");
      if (gets_string_cancelled(str))
	return;
      else
	custom_imake_title(str);
      return;
    }

    if (strcmp(str,"update_title")==0) {
      update_title();
      return;
    }

    if (strcmp(str,"update_title_and_save_file")==0) {
      update_title_and_save_file();
      return;
    }

    if (strcmp(str,"update_title_backup_and_save_file")==0) {
      update_title_backup_and_save_file();
      return;
    }

    if (strcmp(str,"sharp_comment")==0) {
      sharp_comment();
      return;
    }

    if (strcmp(str,"equal_comment")==0) {
      equal_comment();
      return;
    }

    if (strcmp(str,"minus_comment")==0) {
      minus_comment();
      return;
    }

    if (strcmp(str,"plus_comment")==0) {
      plus_comment();
      return;
    }

    if (strcmp(str,"percent_comment")==0) {
      percent_comment();
      return;
    }

    if (strcmp(str,"change_return_to_newline")==0) {
      change_return_to_newline();
      return;
    }

    if (strcmp(str,"print_ascii")==0) {
      print_ascii();
      return;
    }

    if (strcmp(str,"commit")==0) {
      purge();
      return;
    }
}

programming_utilities()
{
    char *str;
    int num=0;
    int win = current_window();
    
    clear_list();
    
    add_list_item("C++ class");
    add_list_item("C++ method");
    add_list_item("C function");
    add_list_item("Java class");
    add_list_item("Java method");
    add_list_item("Include header");
    add_list_item("Title");
    add_list_item("Shell title");
    add_list_item("Imake title");
    add_list_item("Smac title");
/*
    add_list_item("custom_title");
    add_list_item("custom_shell_title");
    add_list_item("custom_imake_title");
*/    
    add_list_item(" "); 
    add_list_item("Update title");
    add_list_item("Update title and save file");
    add_list_item("Update title backup and save file");
    add_list_item(" "); 
    add_list_item("Sharp comment");
    add_list_item("Plus comment");
    add_list_item("Equal comment");
    add_list_item("Minus comment");
    add_list_item("Percent comment");
    add_list_item(" "); 
    add_list_item("Change return to newline");
    add_list_item("Print ascii");
    add_list_item("Purge");
    
    str = select_from_list("Programming util");

    redisplay();
    select_window(win);
    if(str==0 || strlen(str) < 2) {
	return;
    }
    
/*    num = extract_number(str); */
    
    if (strcmp(str,"C++ class")==0)
      cplus_class_header();
    else if (strcmp(str,"C++ method")==0)
      cplus_method_header();
    else if (strcmp(str,"C function")==0)
      function_header();
    else if (strcmp(str,"Java class")==0)
      java_class_header();
    else if (strcmp(str,"Java method")==0)
      java_method_header();
    else if (strcmp(str,"Include header")==0)
      include_header();
    else if (strcmp(str,"Title")==0) {
      str = gets("Enter title ");
      if (gets_string_cancelled(str))
	return;
      else
	title(str);
      return;
    }
    else if (strcmp(str,"Shell title")==0){
      str = gets("Enter shell_title ");
      if (gets_string_cancelled(str))
	return;
      else
	shell_title(str);
      return;
    }
    else if (strcmp(str,"Imake title")==0){
      str = gets("Enter imake_title ");
      if (gets_string_cancelled(str))
	return;
      else
	imake_title(str);
      return;
    }
    else if (strcmp(str,"Smac title")==0)
      smac_title();
    else if (strcmp(str,"Update title")==0)
      update_title();
    else if (strcmp(str,"Update title and save file")==0)
      update_title_and_save_file();
    else if (strcmp(str,"Update title backup and save file")==0)
      update_title_backup_and_save_file();
    else if (strcmp(str,"Sharp comment")==0)
      sharp_comment();
    else if (strcmp(str,"Plus comment")==0)
      plus_comment();
    else if (strcmp(str,"Equal comment")==0)
      equal_comment();
    else if (strcmp(str,"Minus comment")==0)
      minus_comment();
    else if (strcmp(str,"Percent comment")==0)
      percent_comment();
    else if (strcmp(str,"Change return to newline")==0)
      change_return_to_newline();
    else if (strcmp(str,"Print ascii")==0)
      print_ascii();
    else if (strcmp(str,"Purge")==0)
      purge();
}
