2005-11-22 12:26:26 +00:00
|
|
|
/*
|
|
|
|
* filetypes.h - this file is part of Geany, a fast and lightweight IDE
|
|
|
|
*
|
2007-01-14 17:36:42 +00:00
|
|
|
* Copyright 2005-2007 Enrico Tröger <enrico.troeger@uvena.de>
|
2007-01-13 20:16:09 +00:00
|
|
|
* Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.com>
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
|
|
|
* 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 of the License, 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
|
2006-05-16 19:04:04 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-11-22 12:26:26 +00:00
|
|
|
*
|
2005-11-27 20:46:36 +00:00
|
|
|
* $Id$
|
2005-11-22 12:26:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef GEANY_FILETYPES_H
|
|
|
|
#define GEANY_FILETYPES_H 1
|
|
|
|
|
2006-08-20 20:39:59 +00:00
|
|
|
#include "Scintilla.h"
|
|
|
|
#include "ScintillaWidget.h"
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-14 15:11:54 +00:00
|
|
|
// each group should be alpha-sorted, based on filetype::name (not enum name)
|
2007-01-03 16:21:44 +00:00
|
|
|
typedef enum
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-05-14 12:55:55 +00:00
|
|
|
// normally compiled languages
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_GROUP_COMPILED = 0,
|
|
|
|
GEANY_FILETYPES_ASM = GEANY_FILETYPES_GROUP_COMPILED,
|
|
|
|
GEANY_FILETYPES_C,
|
2006-08-15 17:57:41 +00:00
|
|
|
GEANY_FILETYPES_CPP,
|
2007-06-22 17:34:31 +00:00
|
|
|
GEANY_FILETYPES_CS,
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_CAML,
|
2006-08-15 17:57:41 +00:00
|
|
|
GEANY_FILETYPES_D,
|
|
|
|
GEANY_FILETYPES_FORTRAN,
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_BASIC, // FreeBasic
|
2007-05-14 12:55:55 +00:00
|
|
|
GEANY_FILETYPES_HASKELL,
|
2007-07-26 09:50:12 +00:00
|
|
|
GEANY_FILETYPES_HAXE,
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_JAVA,
|
|
|
|
GEANY_FILETYPES_PASCAL,
|
|
|
|
GEANY_FILETYPES_VHDL,
|
2007-05-14 12:55:55 +00:00
|
|
|
|
|
|
|
// script languages
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_GROUP_SCRIPT,
|
|
|
|
GEANY_FILETYPES_FERITE = GEANY_FILETYPES_GROUP_SCRIPT,
|
|
|
|
GEANY_FILETYPES_JS,
|
|
|
|
GEANY_FILETYPES_LUA,
|
|
|
|
GEANY_FILETYPES_MAKE,
|
|
|
|
GEANY_FILETYPES_OMS,
|
2006-08-15 17:57:41 +00:00
|
|
|
GEANY_FILETYPES_PERL,
|
|
|
|
GEANY_FILETYPES_PHP,
|
|
|
|
GEANY_FILETYPES_PYTHON,
|
|
|
|
GEANY_FILETYPES_RUBY,
|
|
|
|
GEANY_FILETYPES_SH,
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_TCL,
|
2007-05-14 12:55:55 +00:00
|
|
|
|
2007-07-09 12:46:16 +00:00
|
|
|
// markup langauges
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_GROUP_MARKUP,
|
|
|
|
GEANY_FILETYPES_CSS = GEANY_FILETYPES_GROUP_MARKUP,
|
2006-08-15 17:57:41 +00:00
|
|
|
GEANY_FILETYPES_DOCBOOK,
|
|
|
|
GEANY_FILETYPES_HTML,
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_XML,
|
2007-07-19 11:49:53 +00:00
|
|
|
|
2007-07-09 12:46:16 +00:00
|
|
|
// miscellaneous languages
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_GROUP_MISC,
|
|
|
|
GEANY_FILETYPES_CONF = GEANY_FILETYPES_GROUP_MISC,
|
2006-08-27 17:39:34 +00:00
|
|
|
GEANY_FILETYPES_DIFF,
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_LATEX,
|
2007-08-14 11:50:03 +00:00
|
|
|
GEANY_FILETYPES_REST,
|
2007-08-14 15:11:54 +00:00
|
|
|
GEANY_FILETYPES_SQL,
|
2007-05-14 12:55:55 +00:00
|
|
|
|
|
|
|
GEANY_FILETYPES_ALL, // must be last filetype, used for 'None' item.
|
2006-08-15 17:57:41 +00:00
|
|
|
GEANY_MAX_FILE_TYPES
|
2007-01-03 16:21:44 +00:00
|
|
|
} filetype_id;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-11-14 16:03:25 +00:00
|
|
|
// Safe wrapper to get the id field of a possibly NULL filetype pointer.
|
|
|
|
#define FILETYPE_ID(filetype_ptr) \
|
|
|
|
(((filetype_ptr) != NULL) ? (filetype_ptr)->id : GEANY_FILETYPES_ALL)
|
|
|
|
|
2006-07-25 10:13:35 +00:00
|
|
|
|
2006-11-30 15:42:52 +00:00
|
|
|
struct build_actions
|
2006-04-27 18:06:35 +00:00
|
|
|
{
|
2006-11-30 15:42:52 +00:00
|
|
|
gboolean can_compile:1;
|
|
|
|
gboolean can_link:1;
|
|
|
|
gboolean can_exec:1;
|
2006-04-27 18:06:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct build_programs
|
|
|
|
{
|
|
|
|
gchar *compiler;
|
|
|
|
gchar *linker;
|
|
|
|
gchar *run_cmd;
|
|
|
|
gchar *run_cmd2;
|
2006-10-01 16:14:45 +00:00
|
|
|
gboolean modified;
|
2006-04-27 18:06:35 +00:00
|
|
|
};
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-15 15:37:21 +00:00
|
|
|
struct filetype
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2007-01-03 16:21:44 +00:00
|
|
|
filetype_id id;
|
2006-07-25 10:13:35 +00:00
|
|
|
guint uid; // unique id as reference for saved filetype in config file
|
2006-08-03 22:17:10 +00:00
|
|
|
GtkWidget *item; // holds a pointer to the menu item for this filetypes
|
2006-06-24 14:36:35 +00:00
|
|
|
langType lang; // represents the langType of tagmanager(see the table
|
|
|
|
// in tagmanager/parsers.h), -1 represents all, -2 none
|
2006-04-27 18:06:35 +00:00
|
|
|
gchar *name; // will be used as name for tagmanager
|
|
|
|
gchar *title; // will be shown in the file open dialog
|
|
|
|
gchar *extension;
|
|
|
|
gchar **pattern;
|
2007-04-15 18:09:59 +00:00
|
|
|
gchar *context_action_cmd;
|
2006-04-27 18:06:35 +00:00
|
|
|
gchar *comment_open;
|
|
|
|
gchar *comment_close;
|
|
|
|
gboolean comment_use_indent;
|
2006-11-30 15:42:52 +00:00
|
|
|
struct build_programs *programs;
|
|
|
|
struct build_actions *actions;
|
2007-08-15 15:37:21 +00:00
|
|
|
};
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-07-19 11:49:53 +00:00
|
|
|
extern filetype *filetypes[GEANY_MAX_FILE_TYPES];
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
|
2006-08-05 12:25:49 +00:00
|
|
|
// If uid is valid, return corresponding filetype, otherwise NULL.
|
|
|
|
filetype *filetypes_get_from_uid(gint uid);
|
|
|
|
|
2007-04-25 15:01:14 +00:00
|
|
|
/* Calls filetypes_init_types() and creates the filetype menu. */
|
|
|
|
void filetypes_init();
|
|
|
|
|
|
|
|
/* Create the filetype array and fill it with the known filetypes. */
|
2006-10-06 23:23:05 +00:00
|
|
|
void filetypes_init_types();
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-04-18 12:12:51 +00:00
|
|
|
/* Detect the filetype for document idx, checking for a shebang, then filename extension. */
|
|
|
|
filetype *filetypes_detect_from_file(gint idx);
|
|
|
|
|
|
|
|
/* Detect filetype based on the filename extension.
|
|
|
|
* utf8_filename can include the full path. */
|
|
|
|
filetype *filetypes_detect_from_filename(const gchar *utf8_filename);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
/* frees the array and all related pointers */
|
2006-10-06 23:23:05 +00:00
|
|
|
void filetypes_free_types();
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-11-02 17:44:05 +00:00
|
|
|
void filetypes_load_config(gint ft_id);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-10-01 16:14:45 +00:00
|
|
|
void filetypes_save_commands();
|
|
|
|
|
2006-08-03 22:17:10 +00:00
|
|
|
void filetypes_select_radio_item(const filetype *ft);
|
|
|
|
|
2006-08-20 20:39:59 +00:00
|
|
|
GtkFileFilter *filetypes_create_file_filter(filetype *ft);
|
|
|
|
|
2007-03-01 22:38:31 +00:00
|
|
|
GtkFileFilter *filetypes_create_file_filter_all_source();
|
|
|
|
|
2006-10-27 11:30:23 +00:00
|
|
|
gchar *filetypes_get_conf_extension(gint filetype_idx);
|
|
|
|
|
2007-05-26 12:13:53 +00:00
|
|
|
gboolean filetype_has_tags(filetype *ft);
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
#endif
|