geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

build.h
Go to the documentation of this file.
1/*
2 * build.h - this file is part of Geany, a fast and lightweight IDE
3 *
4 * Copyright 2005 The Geany contributors
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 2 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 along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21/** @file build.h Interface to the Build menu functionality. */
22
23#ifndef GEANY_BUILD_H
24#define GEANY_BUILD_H 1
25
26#include "document.h"
27#include "filetypes.h"
28
29#include "gtkcompat.h"
30
31G_BEGIN_DECLS
32
33/** Groups of Build menu items. */
34typedef enum
35{
36 GEANY_GBG_FT, /**< filetype items */
37 GEANY_GBG_NON_FT, /**< non filetype items.*/
38 GEANY_GBG_EXEC, /**< execute items */
39 GEANY_GBG_COUNT /**< count of groups. */
41
42/** Build menu item sources in increasing priority */
43typedef enum
44{
45 GEANY_BCS_DEF, /**< Default values. */
46 GEANY_BCS_FT, /**< System filetype values. */
47 GEANY_BCS_HOME_FT, /**< Filetypes in ~/.config/geany/filedefs */
48 GEANY_BCS_PREF, /**< Preferences file ~/.config/geany/geany.conf */
49 GEANY_BCS_PROJ_FT, /**< Project file filetype command */
50 GEANY_BCS_PROJ, /**< Project file if open. */
51 GEANY_BCS_COUNT /**< Count of sources. */
53
54/** The entries of a command for a menu item */
56{
57 GEANY_BC_LABEL, /**< The menu item label, _ marks mnemonic */
58 GEANY_BC_COMMAND, /**< The command to run. */
59 GEANY_BC_WORKING_DIR, /**< The directory to run in */
60 GEANY_BC_CMDENTRIES_COUNT /**< Count of entries */
62
63void build_activate_menu_item(const GeanyBuildGroup grp, const guint cmd);
64
65const gchar *build_get_current_menu_item(const GeanyBuildGroup grp, const guint cmd,
67
68void build_remove_menu_item(const GeanyBuildSource src, const GeanyBuildGroup grp, const gint cmd);
69
71 const guint cmd, const GeanyBuildCmdEntries field, const gchar *value);
72
74
75
76#ifdef GEANY_PRIVATE
77
78/* include the fixed widgets in an array indexed by groups */
79#define GBG_FIXED GEANY_GBG_COUNT
80
81enum GeanyBuildFixedMenuItems
82{
83 GBF_NEXT_ERROR,
84 GBF_PREV_ERROR,
85 GBF_COMMANDS,
86 GBF_SEP_1,
87 GBF_SEP_2,
88 GBF_SEP_3,
89 GBF_SEP_4,
90 GBF_COUNT
91};
92
93typedef struct GeanyBuildInfo
94{
96 guint cmd;
97 GPid pid; /* process id of the spawned process */
98 gchar *dir;
99 guint file_type_id;
100 gchar *custom_target;
101 gint message_count;
102} GeanyBuildInfo;
103
104extern GeanyBuildInfo build_info;
105
106/* * The command for a menu item. */
107typedef struct GeanyBuildCommand
108{
109 /* * Pointers to g_string values of the command entries.
110 * Must be freed if the pointer is changed. */
111 gchar *label; /* *< Menu item label */
112 gchar *command; /* *< Command to run */
113 gchar *working_dir; /* *< working directory */
114 gboolean exists; /* *< If the entries have valid values. */
115 gboolean changed; /* *< Save on exit if @c changed, remove if not @c exist. */
116 gboolean old; /* *< Converted from old format. */
117} GeanyBuildCommand;
118
119typedef struct BuildMenuItems
120{
121 GtkWidget *menu;
122 GtkWidget **menu_item[GEANY_GBG_COUNT + 1]; /* +1 for fixed items */
123} BuildMenuItems;
124
125/* a structure defining the destinations for a set of groups of commands & regex */
126typedef struct BuildDestination
127{
128 GeanyBuildCommand **dst[GEANY_GBG_COUNT];
129 gchar **fileregexstr;
130 gchar **nonfileregexstr;
131} BuildDestination;
132
133/* opaque pointers returned from build functions and passed back to them */
134typedef struct BuildTableFields *BuildTableData;
135
136
137void build_init(void);
138
139void build_finalize(void);
140
141/* menu configuration dialog functions */
142GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, BuildTableData *data, GeanyFiletype *ft);
143
144void build_read_project(GeanyFiletype *ft, BuildTableData build_properties);
145
146void build_free_fields(BuildTableData data);
147
148/* build response decode assistance function */
149gboolean build_parse_make_dir(const gchar *string, gchar **prefix);
150
151/* build menu functions */
152
154
155void build_toolbutton_build_clicked(GtkAction *action, gpointer user_data);
156
157GeanyBuildCommand *build_get_menu_item(const GeanyBuildSource src, const GeanyBuildGroup grp, const guint cmd);
158
159BuildMenuItems *build_get_menu_items(gint filetype_idx);
160
161/* load and store menu configuration */
162void build_load_menu(GKeyFile *config, GeanyBuildSource dst, gpointer ptr);
163
164void build_save_menu(GKeyFile *config, gpointer ptr, GeanyBuildSource src);
165
167
168gchar **build_get_regex(GeanyBuildGroup grp, GeanyFiletype *ft, guint *from);
169
170gboolean build_keybinding(guint key_id);
171
172#endif /* GEANY_PRIVATE */
173
174G_END_DECLS
175
176#endif /* GEANY_BUILD_H */
void build_free_fields(BuildTableData table_data)
Definition: build.c:2076
void build_toolbutton_build_clicked(GtkAction *action, gpointer unused)
Definition: build.c:1705
GeanyBuildInfo build_info
Definition: build.c:67
void build_init(void)
Definition: build.c:2690
gboolean build_parse_make_dir(const gchar *string, gchar **prefix)
Definition: build.c:1051
void build_save_menu(GKeyFile *config, gpointer ptr, GeanyBuildSource src)
Definition: build.c:2576
const gchar * working_dir
Definition: build.c:2678
BuildMenuItems * build_get_menu_items(gint filetype_idx)
Definition: build.c:2265
void build_menu_update(GeanyDocument *doc)
Definition: build.c:1457
void build_load_menu(GKeyFile *config, GeanyBuildSource src, gpointer p)
Definition: build.c:2356
GeanyBuildCommand ** ptr
Definition: build.c:2679
GeanyBuildCommand * build_get_menu_item(GeanyBuildSource src, GeanyBuildGroup grp, guint cmd)
Definition: build.c:578
void build_finalize(void)
Definition: build.c:177
void build_set_group_count(GeanyBuildGroup grp, gint count)
Definition: build.c:2636
GtkWidget * build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, BuildTableData *table_data, GeanyFiletype *ft)
Definition: build.c:1946
const gchar * command
Definition: build.c:2677
void build_read_project(GeanyFiletype *ft, BuildTableData build_properties)
Definition: build.c:2196
gchar ** build_get_regex(GeanyBuildGroup grp, GeanyFiletype *ft, guint *from)
Definition: build.c:438
const gchar * label
Definition: build.c:2676
gboolean build_keybinding(guint key_id)
Definition: build.c:2773
GeanyBuildGroup
Groups of Build menu items.
Definition: build.h:35
@ GEANY_GBG_NON_FT
non filetype items.
Definition: build.h:37
@ GEANY_GBG_FT
filetype items
Definition: build.h:36
@ GEANY_GBG_EXEC
execute items
Definition: build.h:38
@ GEANY_GBG_COUNT
count of groups.
Definition: build.h:39
guint build_get_group_count(const GeanyBuildGroup grp)
Get the count of commands for the group.
Definition: build.c:2660
void build_activate_menu_item(const GeanyBuildGroup grp, const guint cmd)
Activate the menu item.
Definition: build.c:693
GeanyBuildCmdEntries
The entries of a command for a menu item.
Definition: build.h:56
@ GEANY_BC_COMMAND
The command to run.
Definition: build.h:58
@ GEANY_BC_LABEL
The menu item label, _ marks mnemonic.
Definition: build.h:57
@ GEANY_BC_WORKING_DIR
The directory to run in.
Definition: build.h:59
@ GEANY_BC_CMDENTRIES_COUNT
Count of entries.
Definition: build.h:60
GeanyBuildSource
Build menu item sources in increasing priority.
Definition: build.h:44
@ GEANY_BCS_FT
System filetype values.
Definition: build.h:46
@ GEANY_BCS_HOME_FT
Filetypes in ~/.config/geany/filedefs.
Definition: build.h:47
@ GEANY_BCS_DEF
Default values.
Definition: build.h:45
@ GEANY_BCS_PREF
Preferences file ~/.config/geany/geany.conf.
Definition: build.h:48
@ GEANY_BCS_COUNT
Count of sources.
Definition: build.h:51
@ GEANY_BCS_PROJ_FT
Project file filetype command.
Definition: build.h:49
@ GEANY_BCS_PROJ
Project file if open.
Definition: build.h:50
void build_remove_menu_item(const GeanyBuildSource src, const GeanyBuildGroup grp, const gint cmd)
Remove the specified Build menu item.
Definition: build.c:546
const gchar * build_get_current_menu_item(const GeanyBuildGroup grp, const guint cmd, const GeanyBuildCmdEntries field)
Get the string for the menu item field.
Definition: build.c:607
void build_set_menu_item(const GeanyBuildSource src, const GeanyBuildGroup grp, const guint cmd, const GeanyBuildCmdEntries field, const gchar *value)
Set the string for the menu item field.
Definition: build.c:648
Document related actions: new, save, open, etc.
#define field(x)
Filetype detection, file extensions and filetype menu items.
unsigned int count
Structure for representing an open tab with all its properties.
Definition: document.h:81
Represents a filetype.
Definition: filetypes.h:144