1 /* 2 * geanyprj - Alternative project support for geany light IDE. 3 * 4 * Copyright 2008 Yura Siamashka <yurand2@gmail.com> 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __GEANYPRJ_H__ 21 #define __GEANYPRJ_H__ 22 23 #include <geanyplugin.h> 24 25 #ifdef __GNUC__ 26 # ifdef DEBUG 27 # define debug(format, ...) printf((format), __VA_ARGS__) 28 # else 29 # define debug(...) 30 # endif 31 #else 32 # ifdef DEBUG 33 # define debug printf 34 # else 35 # define debug 36 # endif 37 #endif 38 39 #define MAX_NAME_LEN 50 40 #define PROJECT_TYPE 1 41 42 enum 43 { 44 NEW_PROJECT_TYPE_ALL, 45 NEW_PROJECT_TYPE_CPP, 46 NEW_PROJECT_TYPE_C, 47 NEW_PROJECT_TYPE_PYTHON, 48 NEW_PROJECT_TYPE_NONE, 49 NEW_PROJECT_TYPE_SIZE 50 }; 51 52 struct GeanyPrj 53 { 54 gchar *path; /**< path to disk file */ 55 56 gchar *name; 57 gchar *description; 58 gchar *base_path; 59 gchar *run_cmd; 60 61 gboolean regenerate; 62 gint type; 63 64 GHashTable *tags; /**< project tags */ 65 }; 66 67 extern GeanyData *geany_data; 68 69 extern const gchar *project_type_string[NEW_PROJECT_TYPE_SIZE]; 70 extern gboolean (*project_type_filter[NEW_PROJECT_TYPE_SIZE]) (const gchar *); 71 72 73 /* project.c */ 74 struct GeanyPrj *geany_project_new(void); 75 struct GeanyPrj *geany_project_load(const gchar *path); 76 void geany_project_free(struct GeanyPrj *prj); 77 void geany_project_regenerate_file_list(struct GeanyPrj *prj); 78 gboolean geany_project_add_file(struct GeanyPrj *prj, const gchar *path); 79 gboolean geany_project_remove_file(struct GeanyPrj *prj, const gchar *path); 80 void geany_project_save(struct GeanyPrj *prj); 81 void geany_project_set_path(struct GeanyPrj *prj, const gchar *path); 82 void geany_project_set_name(struct GeanyPrj *prj, const gchar *name); 83 void geany_project_set_type_int(struct GeanyPrj *prj, gint val); 84 void geany_project_set_type_string(struct GeanyPrj *prj, const gchar *val); 85 void geany_project_set_regenerate(struct GeanyPrj *prj, gboolean val); 86 void geany_project_set_description(struct GeanyPrj *prj, const gchar *description); 87 void geany_project_set_base_path(struct GeanyPrj *prj, const gchar *base_path); 88 void geany_project_set_run_cmd(struct GeanyPrj *prj, const gchar *run_cmd); 89 void geany_project_set_tags_from_list(struct GeanyPrj *prj, GSList *files); 90 91 92 /* sidebar.c */ 93 void create_sidebar(void); 94 void destroy_sidebar(void); 95 void sidebar_refresh(void); 96 97 98 /* xproject.c */ 99 void xproject_init(void); 100 void xproject_open(const gchar *path); 101 gboolean xproject_add_file(const gchar *path); 102 gboolean xproject_remove_file(const gchar *path); 103 void xproject_update_tag(const gchar *filename); 104 void xproject_cleanup(void); 105 void xproject_close(gboolean cache); 106 107 108 /* menu.h */ 109 void tools_menu_init(void); 110 void tools_menu_uninit(void); 111 void on_new_project(GtkMenuItem *menuitem, gpointer user_data); 112 void on_preferences(GtkMenuItem *menuitem, gpointer user_data); 113 void on_delete_project(GtkMenuItem *menuitem, gpointer user_data); 114 void on_add_file(GtkMenuItem *menuitem, gpointer user_data); 115 void on_find_in_project(GtkMenuItem *menuitem, gpointer user_data); 116 117 118 /* utils.c */ 119 gchar *find_file_path(const gchar *dir, const gchar *filename); 120 gchar *normpath(const gchar *filename); 121 gchar *get_full_path(const gchar *location, const gchar *path); 122 gchar *get_relative_path(const gchar *location, const gchar *path); 123 gint config_length(GKeyFile *config, const gchar *section, const gchar *name); 124 void save_config(GKeyFile *config, const gchar *path); 125 GSList *get_file_list(const gchar *path, guint *length, gboolean(*func)(const gchar *), GError **error); 126 127 128 extern struct GeanyPrj *g_current_project; 129 130 #endif 131