2005-11-22 12:26:26 +00:00
|
|
|
/*
|
|
|
|
* filetypes.h - this file is part of Geany, a fast and lightweight IDE
|
|
|
|
*
|
2006-01-10 17:30:53 +00:00
|
|
|
* Copyright 2006 Enrico Troeger <enrico.troeger@uvena.de>
|
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
|
|
|
#ifndef PLAT_GTK
|
|
|
|
# define PLAT_GTK 1 // needed for ScintillaWidget.h
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "Scintilla.h"
|
|
|
|
#include "ScintillaWidget.h"
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2006-08-15 17:57:41 +00:00
|
|
|
GEANY_FILETYPES_C = 0,
|
|
|
|
GEANY_FILETYPES_CPP,
|
|
|
|
GEANY_FILETYPES_D,
|
|
|
|
GEANY_FILETYPES_JAVA,
|
|
|
|
GEANY_FILETYPES_PASCAL,
|
|
|
|
GEANY_FILETYPES_ASM,
|
|
|
|
GEANY_FILETYPES_FORTRAN,
|
|
|
|
GEANY_FILETYPES_CAML,
|
|
|
|
GEANY_FILETYPES_PERL,
|
|
|
|
GEANY_FILETYPES_PHP,
|
|
|
|
GEANY_FILETYPES_PYTHON,
|
|
|
|
GEANY_FILETYPES_RUBY,
|
|
|
|
GEANY_FILETYPES_TCL,
|
2006-08-27 17:39:34 +00:00
|
|
|
GEANY_FILETYPES_FERITE,
|
2006-08-15 17:57:41 +00:00
|
|
|
GEANY_FILETYPES_SH,
|
|
|
|
GEANY_FILETYPES_MAKE,
|
|
|
|
GEANY_FILETYPES_XML,
|
|
|
|
GEANY_FILETYPES_DOCBOOK,
|
|
|
|
GEANY_FILETYPES_HTML,
|
|
|
|
GEANY_FILETYPES_CSS,
|
|
|
|
GEANY_FILETYPES_SQL,
|
|
|
|
GEANY_FILETYPES_LATEX,
|
|
|
|
GEANY_FILETYPES_OMS,
|
2006-08-27 17:39:34 +00:00
|
|
|
GEANY_FILETYPES_DIFF,
|
2006-08-15 17:57:41 +00:00
|
|
|
GEANY_FILETYPES_CONF,
|
2006-10-01 16:14:45 +00:00
|
|
|
GEANY_FILETYPES_ALL, // must be last filetype
|
2006-08-15 17:57:41 +00:00
|
|
|
GEANY_MAX_FILE_TYPES
|
2005-11-22 12:26:26 +00:00
|
|
|
};
|
|
|
|
|
2006-07-25 10:13:35 +00:00
|
|
|
|
2006-04-27 18:06:35 +00:00
|
|
|
struct build_menu_items
|
|
|
|
{
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *item_compile;
|
|
|
|
GtkWidget *item_link;
|
|
|
|
GtkWidget *item_exec;
|
2006-10-17 12:52:32 +00:00
|
|
|
GtkWidget *item_make_all;
|
|
|
|
GtkWidget *item_make_custom;
|
2006-10-04 19:14:57 +00:00
|
|
|
GtkWidget *item_make_object;
|
2006-04-27 18:06:35 +00:00
|
|
|
gboolean can_compile;
|
|
|
|
gboolean can_link;
|
|
|
|
gboolean can_exec;
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
typedef struct filetype
|
|
|
|
{
|
2006-04-27 18:06:35 +00:00
|
|
|
guint 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
|
|
|
|
gboolean has_tags; // indicates whether there is a tag parser for it or not
|
|
|
|
gchar *title; // will be shown in the file open dialog
|
|
|
|
gchar *extension;
|
|
|
|
gchar **pattern;
|
|
|
|
gchar *comment_open;
|
|
|
|
gchar *comment_close;
|
|
|
|
gboolean comment_use_indent;
|
|
|
|
struct build_programs *programs;
|
|
|
|
struct build_menu_items *menu_items;
|
|
|
|
void (*style_func_ptr) (ScintillaObject*);
|
2005-11-22 12:26:26 +00:00
|
|
|
} filetype;
|
|
|
|
|
|
|
|
filetype *filetypes[GEANY_MAX_FILE_TYPES];
|
|
|
|
|
|
|
|
|
2006-08-05 12:25:49 +00:00
|
|
|
// If uid is valid, return corresponding filetype, otherwise NULL.
|
|
|
|
filetype *filetypes_get_from_uid(gint uid);
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
/* inits the filetype array and fill it with the known filetypes
|
|
|
|
* and create the filetype menu*/
|
2006-10-06 23:23:05 +00:00
|
|
|
void filetypes_init_types();
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
/* simple filetype selection based on the filename extension */
|
2006-10-06 23:23:05 +00:00
|
|
|
filetype *filetypes_get_from_filename(gint idx);
|
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
|
|
|
|
|
|
|
gchar *filetypes_get_template(filetype *ft);
|
|
|
|
|
2006-05-15 19:49:30 +00:00
|
|
|
void filetypes_get_config(GKeyFile *config, GKeyFile *configh, gint ft);
|
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);
|
|
|
|
|
2006-10-27 11:30:23 +00:00
|
|
|
gchar *filetypes_get_conf_extension(gint filetype_idx);
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
#endif
|