Build commands & project dialog improvements
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/build-system@3992 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
906416ac34
commit
9d348018c7
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2009-07-19 Lex Trotman <elextr(at)gmail(dot)com>
|
||||||
|
|
||||||
|
* src/build.c, src/build.h
|
||||||
|
Added set_build_non_ft_wd_to_proj() for use by project dialog.
|
||||||
|
Improved interpretation of run_in_base_dir from old [build-settings]
|
||||||
|
Added spacing to build commands dialog
|
||||||
|
* src/project.c
|
||||||
|
Removed run in base path option from project dialog and added button to
|
||||||
|
set working directories to d the same.
|
||||||
|
|
||||||
|
|
||||||
2009-07-18 Lex Trotman <elextr(at)gmail(dot)com>
|
2009-07-18 Lex Trotman <elextr(at)gmail(dot)com>
|
||||||
|
|
||||||
* src/build.c
|
* src/build.c
|
||||||
|
112
src/build.c
112
src/build.c
@ -1629,6 +1629,9 @@ static gchar *colheads[] = {
|
|||||||
#define DC_CLEAR 4
|
#define DC_CLEAR 4
|
||||||
#define DC_N_COL 5
|
#define DC_N_COL 5
|
||||||
|
|
||||||
|
static const int entry_x_padding = 3;
|
||||||
|
static const int entry_y_padding = 0;
|
||||||
|
|
||||||
static RowWidgets *build_add_dialog_row(GeanyDocument *doc, GtkTable *table, gint row,
|
static RowWidgets *build_add_dialog_row(GeanyDocument *doc, GtkTable *table, gint row,
|
||||||
GeanyBuildSource dst, gint grp, gint cmd, gboolean dir)
|
GeanyBuildSource dst, gint grp, gint cmd, gboolean dir)
|
||||||
{
|
{
|
||||||
@ -1641,7 +1644,8 @@ static RowWidgets *build_add_dialog_row(GeanyDocument *doc, GtkTable *table, gin
|
|||||||
gint column = 0;
|
gint column = 0;
|
||||||
|
|
||||||
label = gtk_label_new(g_strdup_printf("%d:", cmd+1));
|
label = gtk_label_new(g_strdup_printf("%d:", cmd+1));
|
||||||
gtk_table_attach(table, label, column, column+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, label, column, column+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
roww = g_new0(RowWidgets, 1);
|
roww = g_new0(RowWidgets, 1);
|
||||||
roww->src = BCS_COUNT;
|
roww->src = BCS_COUNT;
|
||||||
roww->grp = grp;
|
roww->grp = grp;
|
||||||
@ -1652,14 +1656,15 @@ static RowWidgets *build_add_dialog_row(GeanyDocument *doc, GtkTable *table, gin
|
|||||||
column+=1;
|
column+=1;
|
||||||
roww->entries[i] = gtk_entry_new();
|
roww->entries[i] = gtk_entry_new();
|
||||||
gtk_table_attach(table, roww->entries[i], column, column+1, row, row+1, GTK_FILL,
|
gtk_table_attach(table, roww->entries[i], column, column+1, row, row+1, GTK_FILL,
|
||||||
GTK_FILL | GTK_EXPAND, 0, 0);
|
GTK_FILL | GTK_EXPAND, entry_x_padding, entry_y_padding);
|
||||||
}
|
}
|
||||||
column++;
|
column++;
|
||||||
clearicon = gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_SMALL_TOOLBAR);
|
clearicon = gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU);
|
||||||
clear = gtk_button_new();
|
clear = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(clear), clearicon);
|
gtk_button_set_image(GTK_BUTTON(clear), clearicon);
|
||||||
g_signal_connect((gpointer)clear, "clicked", G_CALLBACK(on_clear_dialog_row), (gpointer)roww);
|
g_signal_connect((gpointer)clear, "clicked", G_CALLBACK(on_clear_dialog_row), (gpointer)roww);
|
||||||
gtk_table_attach(table, clear, column, column+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, clear, column, column+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
roww->cmdsrc = bc = get_build_cmd(doc, grp, cmd, &src);
|
roww->cmdsrc = bc = get_build_cmd(doc, grp, cmd, &src);
|
||||||
if (bc!=NULL)roww->src = src;
|
if (bc!=NULL)roww->src = src;
|
||||||
|
|
||||||
@ -1678,7 +1683,6 @@ static RowWidgets *build_add_dialog_row(GeanyDocument *doc, GtkTable *table, gin
|
|||||||
return roww;
|
return roww;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef struct TableFields {
|
typedef struct TableFields {
|
||||||
RowWidgets **rows;
|
RowWidgets **rows;
|
||||||
GtkWidget *fileregex, *nonfileregex;
|
GtkWidget *fileregex, *nonfileregex;
|
||||||
@ -1703,10 +1707,11 @@ GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, TableD
|
|||||||
{
|
{
|
||||||
label = gtk_label_new(gettext(*ch));
|
label = gtk_label_new(gettext(*ch));
|
||||||
gtk_table_attach(table, label, col, col+1, 0, 1,
|
gtk_table_attach(table, label, col, col+1, 0, 1,
|
||||||
GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
GTK_FILL, GTK_FILL | GTK_EXPAND, entry_x_padding, entry_y_padding);
|
||||||
}
|
}
|
||||||
sep = gtk_hseparator_new();
|
sep = gtk_hseparator_new();
|
||||||
gtk_table_attach(table, sep, 0, DC_N_COL, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, sep, 0, DC_N_COL, 1, 2, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
if (ft!=NULL){
|
if (ft!=NULL){
|
||||||
txt = g_strdup_printf(_("%s commands"), ft->title);
|
txt = g_strdup_printf(_("%s commands"), ft->title);
|
||||||
} else
|
} else
|
||||||
@ -1714,11 +1719,13 @@ GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, TableD
|
|||||||
label = gtk_label_new(txt);
|
label = gtk_label_new(txt);
|
||||||
g_free(txt);
|
g_free(txt);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
||||||
gtk_table_attach(table, label, 0, DC_N_COL, 2, 3, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, label, 0, DC_N_COL, 2, 3, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
for (row=3, cmdindex=0, cmd=0; cmd<build_groups_count[GBG_FT]; ++row, ++cmdindex, ++cmd)
|
for (row=3, cmdindex=0, cmd=0; cmd<build_groups_count[GBG_FT]; ++row, ++cmdindex, ++cmd)
|
||||||
fields->rows[cmdindex] = build_add_dialog_row(doc, table, row, dst, GBG_FT, cmd, FALSE);
|
fields->rows[cmdindex] = build_add_dialog_row(doc, table, row, dst, GBG_FT, cmd, FALSE);
|
||||||
label = gtk_label_new(_("Error Regular Expression"));
|
label = gtk_label_new(_("Error Regular Expression"));
|
||||||
gtk_table_attach(table, label, 0, DC_ENTRIES+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, label, 0, DC_ENTRIES+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
fields->fileregex = gtk_entry_new();
|
fields->fileregex = gtk_entry_new();
|
||||||
fields->fileregexstring = get_build_regex(GBG_FT, NULL, &src);
|
fields->fileregexstring = get_build_regex(GBG_FT, NULL, &src);
|
||||||
sensitivity = ft==NULL?FALSE:TRUE;
|
sensitivity = ft==NULL?FALSE:TRUE;
|
||||||
@ -1728,26 +1735,30 @@ GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, TableD
|
|||||||
if (src>dst) sensitivity = FALSE;
|
if (src>dst) sensitivity = FALSE;
|
||||||
}
|
}
|
||||||
gtk_table_attach(table, fields->fileregex, DC_ENTRIES+1, DC_CLEAR, row, row+1, GTK_FILL,
|
gtk_table_attach(table, fields->fileregex, DC_ENTRIES+1, DC_CLEAR, row, row+1, GTK_FILL,
|
||||||
GTK_FILL | GTK_EXPAND, 0, 0);
|
GTK_FILL | GTK_EXPAND, entry_x_padding, entry_y_padding);
|
||||||
clearicon = gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_SMALL_TOOLBAR);
|
clearicon = gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU);
|
||||||
clear = gtk_button_new();
|
clear = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(clear), clearicon);
|
gtk_button_set_image(GTK_BUTTON(clear), clearicon);
|
||||||
g_signal_connect_swapped((gpointer)clear, "clicked", G_CALLBACK(on_clear_dialog_regex_row),
|
g_signal_connect_swapped((gpointer)clear, "clicked", G_CALLBACK(on_clear_dialog_regex_row),
|
||||||
(gpointer)(fields->fileregex));
|
(gpointer)(fields->fileregex));
|
||||||
gtk_table_attach(table, clear, DC_CLEAR, DC_CLEAR+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, clear, DC_CLEAR, DC_CLEAR+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
gtk_widget_set_sensitive(fields->fileregex, sensitivity);
|
gtk_widget_set_sensitive(fields->fileregex, sensitivity);
|
||||||
gtk_widget_set_sensitive(clear, sensitivity);
|
gtk_widget_set_sensitive(clear, sensitivity);
|
||||||
++row;
|
++row;
|
||||||
sep = gtk_hseparator_new();
|
sep = gtk_hseparator_new();
|
||||||
gtk_table_attach(table, sep, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, sep, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
++row;
|
++row;
|
||||||
label = gtk_label_new(_("Non Filetype Commands"));
|
label = gtk_label_new(_("Non Filetype Commands"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
||||||
gtk_table_attach(table, label, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, label, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
for (++row, cmd=0; cmd<build_groups_count[GBG_NON_FT]; ++row,++cmdindex, ++cmd)
|
for (++row, cmd=0; cmd<build_groups_count[GBG_NON_FT]; ++row,++cmdindex, ++cmd)
|
||||||
fields->rows[cmdindex] = build_add_dialog_row(doc, table, row, dst, GBG_NON_FT, cmd, TRUE);
|
fields->rows[cmdindex] = build_add_dialog_row(doc, table, row, dst, GBG_NON_FT, cmd, TRUE);
|
||||||
label = gtk_label_new(_("Error Regular Expression"));
|
label = gtk_label_new(_("Error Regular Expression"));
|
||||||
gtk_table_attach(table, label, 0, DC_ENTRIES+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, label, 0, DC_ENTRIES+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
fields->nonfileregex = gtk_entry_new();
|
fields->nonfileregex = gtk_entry_new();
|
||||||
fields->nonfileregexstring = get_build_regex(GBG_NON_FT, NULL, &src);
|
fields->nonfileregexstring = get_build_regex(GBG_NON_FT, NULL, &src);
|
||||||
sensitivity = TRUE;
|
sensitivity = TRUE;
|
||||||
@ -1757,51 +1768,48 @@ GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, TableD
|
|||||||
sensitivity = src>dst?FALSE:TRUE;
|
sensitivity = src>dst?FALSE:TRUE;
|
||||||
}
|
}
|
||||||
gtk_table_attach(table, fields->nonfileregex, DC_ENTRIES+1, DC_CLEAR, row, row+1, GTK_FILL,
|
gtk_table_attach(table, fields->nonfileregex, DC_ENTRIES+1, DC_CLEAR, row, row+1, GTK_FILL,
|
||||||
GTK_FILL | GTK_EXPAND, 0, 0);
|
GTK_FILL | GTK_EXPAND, entry_x_padding, entry_y_padding);
|
||||||
clearicon = gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_SMALL_TOOLBAR);
|
clearicon = gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU);
|
||||||
clear = gtk_button_new();
|
clear = gtk_button_new();
|
||||||
gtk_button_set_image(GTK_BUTTON(clear), clearicon);
|
gtk_button_set_image(GTK_BUTTON(clear), clearicon);
|
||||||
g_signal_connect_swapped((gpointer)clear, "clicked", G_CALLBACK(on_clear_dialog_regex_row),
|
g_signal_connect_swapped((gpointer)clear, "clicked", G_CALLBACK(on_clear_dialog_regex_row),
|
||||||
(gpointer)(fields->nonfileregex));
|
(gpointer)(fields->nonfileregex));
|
||||||
gtk_table_attach(table, clear, DC_CLEAR, DC_CLEAR+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, clear, DC_CLEAR, DC_CLEAR+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
gtk_widget_set_sensitive(fields->nonfileregex, sensitivity);
|
gtk_widget_set_sensitive(fields->nonfileregex, sensitivity);
|
||||||
gtk_widget_set_sensitive(clear, sensitivity);
|
gtk_widget_set_sensitive(clear, sensitivity);
|
||||||
++row;
|
++row;
|
||||||
sep = gtk_hseparator_new();
|
sep = gtk_hseparator_new();
|
||||||
gtk_table_attach(table, sep, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, sep, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
++row;
|
++row;
|
||||||
label = gtk_label_new(_("Execute Commands"));
|
label = gtk_label_new(_("Execute Commands"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
||||||
gtk_table_attach(table, label, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, label, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
for (++row, cmd=0; cmd<build_groups_count[GBG_EXEC]; ++row,++cmdindex, ++cmd)
|
for (++row, cmd=0; cmd<build_groups_count[GBG_EXEC]; ++row,++cmdindex, ++cmd)
|
||||||
fields->rows[cmdindex] = build_add_dialog_row(doc, table, row, dst, GBG_EXEC, cmd, TRUE);
|
fields->rows[cmdindex] = build_add_dialog_row(doc, table, row, dst, GBG_EXEC, cmd, TRUE);
|
||||||
sep = gtk_hseparator_new();
|
sep = gtk_hseparator_new();
|
||||||
gtk_table_attach(table, sep, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, sep, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
++row;
|
++row;
|
||||||
sep = gtk_hseparator_new();
|
sep = gtk_hseparator_new();
|
||||||
gtk_table_attach(table, sep, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, sep, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
++row;
|
++row;
|
||||||
label = gtk_label_new(_(
|
label = gtk_label_new(_(
|
||||||
"Notes:\n"
|
"Notes:\n"
|
||||||
" %d, %e, %f, %p are substituted in Commands and Working dir, see manual for details\n"
|
" %d, %e, %f, %p are substituted in Commands and Working dir, see manual for details\n"
|
||||||
" Non-filetype menu Item 2 opens a dialog and appends the reponse to the command"));
|
" Non-filetype menu Item 2 opens a dialog and appends the reponse to the command"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
||||||
gtk_table_attach(table, label, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
|
gtk_table_attach(table, label, 0, DC_N_COL, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND,
|
||||||
|
entry_x_padding, entry_y_padding);
|
||||||
/* printf("%d extra rows in dialog\n", row-build_items_count); */
|
/* printf("%d extra rows in dialog\n", row-build_items_count); */
|
||||||
++row;
|
++row;
|
||||||
*table_data = fields;
|
*table_data = fields;
|
||||||
return GTK_WIDGET(table);
|
return GTK_WIDGET(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* string compare where null pointers match null or 0 length strings */
|
|
||||||
static int stcmp(const gchar *a, const gchar *b)
|
|
||||||
{
|
|
||||||
if (a==NULL && b==NULL) return 0;
|
|
||||||
if (a==NULL && b!=NULL) return strlen(b);
|
|
||||||
if (a!=NULL && b==NULL) return strlen(a);
|
|
||||||
return strcmp(a, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
void free_build_fields(TableData table_data)
|
void free_build_fields(TableData table_data)
|
||||||
{
|
{
|
||||||
gint cmdindex;
|
gint cmdindex;
|
||||||
@ -1811,6 +1819,15 @@ void free_build_fields(TableData table_data)
|
|||||||
g_free(table_data);
|
g_free(table_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* string compare where null pointers match null or 0 length strings */
|
||||||
|
static int stcmp(const gchar *a, const gchar *b)
|
||||||
|
{
|
||||||
|
if (a==NULL && b==NULL) return 0;
|
||||||
|
if (a==NULL && b!=NULL) return strlen(b);
|
||||||
|
if (a!=NULL && b==NULL) return strlen(a);
|
||||||
|
return strcmp(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean read_row(BuildDestination *dst, TableData table_data, gint drow, gint grp, gint cmd)
|
static gboolean read_row(BuildDestination *dst, TableData table_data, gint drow, gint grp, gint cmd)
|
||||||
{
|
{
|
||||||
gchar *entries[BC_CMDENTRIES_COUNT];
|
gchar *entries[BC_CMDENTRIES_COUNT];
|
||||||
@ -1923,7 +1940,7 @@ gboolean read_build_commands(BuildDestination *dst, TableData table_data, gint r
|
|||||||
|
|
||||||
static void show_build_commands_dialog()
|
static void show_build_commands_dialog()
|
||||||
{
|
{
|
||||||
GtkWidget *dialog, *table;
|
GtkWidget *dialog, *table, *vbox;
|
||||||
GeanyDocument *doc = document_get_current();
|
GeanyDocument *doc = document_get_current();
|
||||||
GeanyFiletype *ft = NULL;
|
GeanyFiletype *ft = NULL;
|
||||||
gchar *title = _("Set Build Commands");
|
gchar *title = _("Set Build Commands");
|
||||||
@ -1938,7 +1955,8 @@ static void show_build_commands_dialog()
|
|||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
|
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
|
||||||
table = build_commands_table(doc, BCS_PREF, &table_data, ft);
|
table = build_commands_table(doc, BCS_PREF, &table_data, ft);
|
||||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), table, TRUE, TRUE, 0);
|
vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
|
||||||
|
gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
|
||||||
gtk_widget_show_all(dialog);
|
gtk_widget_show_all(dialog);
|
||||||
/* run modally to prevent user changing idx filetype */
|
/* run modally to prevent user changing idx filetype */
|
||||||
response = gtk_dialog_run(GTK_DIALOG(dialog));
|
response = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||||
@ -1973,6 +1991,16 @@ BuildMenuItems *build_get_menu_items(gint filetype_idx)
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set non_ft working directory entries to %p for project */
|
||||||
|
void set_build_non_ft_wd_to_proj(TableData table_data)
|
||||||
|
{
|
||||||
|
gint i, start, end;
|
||||||
|
start = build_groups_count[GBG_FT];
|
||||||
|
end = start + build_groups_count[GBG_NON_FT];
|
||||||
|
for (i = start; i<end; ++i)
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(table_data->rows[i]->entries[BC_WORKING_DIR]), "%p");
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------
|
/*----------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Load and store configuration
|
* Load and store configuration
|
||||||
@ -2107,11 +2135,12 @@ void load_build_menu(GKeyFile *config, GeanyBuildSource src, gpointer p)
|
|||||||
|
|
||||||
/* set GeanyBuildCommand if it doesn't already exist and there is a command */
|
/* set GeanyBuildCommand if it doesn't already exist and there is a command */
|
||||||
#define ASSIGNIF(type, id, string, value) \
|
#define ASSIGNIF(type, id, string, value) \
|
||||||
if (value!=NULL && !type[GBO_TO_CMD(id)].exists && (value)!=NULL && strlen(value)>0) { \
|
if (value!=NULL && !type[GBO_TO_CMD(id)].exists && strlen(value)>0) { \
|
||||||
type[GBO_TO_CMD(id)].exists = TRUE; \
|
type[GBO_TO_CMD(id)].exists = TRUE; \
|
||||||
type[GBO_TO_CMD(id)].entries[BC_LABEL] = g_strdup(_(string)); \
|
type[GBO_TO_CMD(id)].entries[BC_LABEL] = g_strdup(_(string)); \
|
||||||
type[GBO_TO_CMD(id)].entries[BC_COMMAND] = (value); \
|
type[GBO_TO_CMD(id)].entries[BC_COMMAND] = (value); \
|
||||||
type[GBO_TO_CMD(id)].entries[BC_WORKING_DIR] = NULL; \
|
type[GBO_TO_CMD(id)].entries[BC_WORKING_DIR] = NULL; \
|
||||||
|
type[GBO_TO_CMD(id)].old = TRUE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(src)
|
switch(src)
|
||||||
@ -2133,8 +2162,12 @@ void load_build_menu(GKeyFile *config, GeanyBuildSource src, gpointer p)
|
|||||||
if (non_ft_proj==NULL)non_ft_proj = g_new0(GeanyBuildCommand, build_groups_count[GBG_NON_FT]);
|
if (non_ft_proj==NULL)non_ft_proj = g_new0(GeanyBuildCommand, build_groups_count[GBG_NON_FT]);
|
||||||
bvalue = g_key_file_get_boolean(config, "project", "make_in_base_path", NULL);
|
bvalue = g_key_file_get_boolean(config, "project", "make_in_base_path", NULL);
|
||||||
value = bvalue?"%p":"%d";
|
value = bvalue?"%p":"%d";
|
||||||
for (cmd=0; cmd<build_groups_count[GBG_NON_FT]; ++cmd)
|
if (non_ft_pref[GBO_TO_CMD(GBO_MAKE_ALL)].old)
|
||||||
non_ft_proj[cmd].entries[BC_WORKING_DIR] = g_strdup(value);
|
setptr(non_ft_pref[GBO_TO_CMD(GBO_MAKE_ALL)].entries[BC_WORKING_DIR], value );
|
||||||
|
if (non_ft_pref[GBO_TO_CMD(GBO_MAKE_CUSTOM)].old)
|
||||||
|
setptr(non_ft_pref[GBO_TO_CMD(GBO_MAKE_CUSTOM)].entries[BC_WORKING_DIR], value );
|
||||||
|
if (non_ft_pref[GBO_TO_CMD(GBO_MAKE_OBJECT)].old)
|
||||||
|
setptr(non_ft_pref[GBO_TO_CMD(GBO_MAKE_OBJECT)].entries[BC_WORKING_DIR], value );
|
||||||
value = g_key_file_get_string(config, "project", "run_cmd", NULL);
|
value = g_key_file_get_string(config, "project", "run_cmd", NULL);
|
||||||
if (value !=NULL)
|
if (value !=NULL)
|
||||||
{
|
{
|
||||||
@ -2284,6 +2317,11 @@ void set_build_grp_count(GeanyBuildGroup grp, gint count)
|
|||||||
build_items_count = sum;
|
build_items_count = sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gint get_build_group_count(GeanyBuildGroup grp)
|
||||||
|
{
|
||||||
|
return build_groups_count[grp];
|
||||||
|
}
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
gchar *entries[BC_CMDENTRIES_COUNT];
|
gchar *entries[BC_CMDENTRIES_COUNT];
|
||||||
GeanyBuildCommand **ptr;
|
GeanyBuildCommand **ptr;
|
||||||
|
@ -104,6 +104,7 @@ typedef struct GeanyBuildCommand
|
|||||||
gchar *entries[BC_CMDENTRIES_COUNT];
|
gchar *entries[BC_CMDENTRIES_COUNT];
|
||||||
gboolean exists;
|
gboolean exists;
|
||||||
gboolean changed;
|
gboolean changed;
|
||||||
|
gboolean old;
|
||||||
} GeanyBuildCommand;
|
} GeanyBuildCommand;
|
||||||
|
|
||||||
extern GeanyBuildCommand *non_ft_proj, *exec_proj; /* project command array pointers */
|
extern GeanyBuildCommand *non_ft_proj, *exec_proj; /* project command array pointers */
|
||||||
@ -137,6 +138,8 @@ gboolean read_build_commands( BuildDestination *dst, TableData data, gint respon
|
|||||||
|
|
||||||
void free_build_data( TableData data );
|
void free_build_data( TableData data );
|
||||||
|
|
||||||
|
void set_build_non_ft_wd_to_proj(TableData table_data);
|
||||||
|
|
||||||
/* build response decode assistance function */
|
/* build response decode assistance function */
|
||||||
gboolean build_parse_make_dir(const gchar *string, gchar **prefix);
|
gboolean build_parse_make_dir(const gchar *string, gchar **prefix);
|
||||||
|
|
||||||
@ -156,6 +159,8 @@ void save_build_menu( GKeyFile *config, gpointer ptr, GeanyBuildSource src );
|
|||||||
|
|
||||||
void set_build_grp_count(GeanyBuildGroup grp, gint count);
|
void set_build_grp_count(GeanyBuildGroup grp, gint count);
|
||||||
|
|
||||||
|
gint get_build_group_count(GeanyBuildGroup grp);
|
||||||
|
|
||||||
gchar **get_build_regex(GeanyBuildGroup grp, GeanyFiletype *ft, gint *from);
|
gchar **get_build_regex(GeanyBuildGroup grp, GeanyFiletype *ft, gint *from);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -386,10 +386,15 @@ void project_close(gboolean open_default)
|
|||||||
update_ui();
|
update_ui();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void on_set_use_base_path_clicked( GtkWidget *unused1, gpointer user_data )
|
||||||
|
{
|
||||||
|
TableData td = (TableData)user_data;
|
||||||
|
set_build_non_ft_wd_to_proj(td);
|
||||||
|
}
|
||||||
|
|
||||||
static void create_properties_dialog(PropertyDialogElements *e)
|
static void create_properties_dialog(PropertyDialogElements *e)
|
||||||
{
|
{
|
||||||
GtkWidget *table, *notebook;
|
GtkWidget *table, *notebook, *build_table;
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *bbox;
|
GtkWidget *bbox;
|
||||||
@ -416,7 +421,7 @@ static void create_properties_dialog(PropertyDialogElements *e)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
|
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
|
||||||
e->name = gtk_entry_new();
|
e->name = gtk_entry_new();
|
||||||
ui_entry_add_clear_icon(e->name);
|
ui_entry_add_clear_icon(e->name);
|
||||||
@ -429,7 +434,7 @@ static void create_properties_dialog(PropertyDialogElements *e)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
|
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
|
||||||
e->file_name = gtk_entry_new();
|
e->file_name = gtk_entry_new();
|
||||||
ui_entry_add_clear_icon(e->file_name);
|
ui_entry_add_clear_icon(e->file_name);
|
||||||
@ -442,7 +447,7 @@ static void create_properties_dialog(PropertyDialogElements *e)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3,
|
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3,
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
|
||||||
e->description = gtk_text_view_new();
|
e->description = gtk_text_view_new();
|
||||||
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(e->description), GTK_WRAP_WORD);
|
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(e->description), GTK_WRAP_WORD);
|
||||||
@ -459,7 +464,7 @@ static void create_properties_dialog(PropertyDialogElements *e)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4,
|
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4,
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
|
||||||
e->base_path = gtk_entry_new();
|
e->base_path = gtk_entry_new();
|
||||||
ui_entry_add_clear_icon(e->base_path);
|
ui_entry_add_clear_icon(e->base_path);
|
||||||
@ -473,33 +478,27 @@ static void create_properties_dialog(PropertyDialogElements *e)
|
|||||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
|
|
||||||
e->make_in_base_path = gtk_check_button_new_with_label(_("Make in base path"));
|
if (doc!=NULL) ft=doc->file_type;
|
||||||
gtk_table_attach(GTK_TABLE(table), e->make_in_base_path, 0, 3, 4, 5,
|
build_table = build_commands_table( doc, BCS_PROJ, &(e->build_properties), ft );
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
label = gtk_label_new(_("Build"));
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
notebook = ui_lookup_widget(e->dialog, "project_notebook");
|
||||||
|
gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), build_table, label, 2);
|
||||||
|
|
||||||
label = gtk_label_new(_("Run command:"));
|
label = gtk_label_new(_("Set the non-filetype working directories on build tab to use base path:"));
|
||||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6,
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
|
|
||||||
|
|
||||||
e->run_cmd = gtk_entry_new();
|
button = gtk_button_new_with_label(_("Set"));
|
||||||
ui_entry_add_clear_icon(e->run_cmd);
|
ui_widget_set_tooltip_text(button,
|
||||||
ui_widget_set_tooltip_text(e->run_cmd,
|
_("Set the working directories (on the Build tab) "
|
||||||
_("Command-line to run in the project base directory. "
|
"for the non-filetype build commands to use the base path"));
|
||||||
"Options can be appended to the command. "
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
"Leave blank to use the default run command."));
|
g_signal_connect(button, "clicked", G_CALLBACK(on_set_use_base_path_clicked), e->build_properties);
|
||||||
button = gtk_button_new();
|
|
||||||
g_signal_connect(button, "clicked", G_CALLBACK(on_file_open_button_clicked), e);
|
|
||||||
image = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON);
|
|
||||||
gtk_container_add(GTK_CONTAINER(button), image);
|
|
||||||
bbox = gtk_hbox_new(FALSE, 6);
|
bbox = gtk_hbox_new(FALSE, 6);
|
||||||
gtk_box_pack_start_defaults(GTK_BOX(bbox), e->run_cmd);
|
gtk_box_pack_start(GTK_BOX(bbox), label, TRUE, TRUE, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
|
||||||
gtk_table_attach(GTK_TABLE(table), bbox, 1, 2, 5, 6,
|
gtk_table_attach(GTK_TABLE(table), bbox, 0, 2, 4, 5,
|
||||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
label = gtk_label_new(_("File patterns:"));
|
label = gtk_label_new(_("File patterns:"));
|
||||||
@ -507,7 +506,7 @@ static void create_properties_dialog(PropertyDialogElements *e)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 6, 7,
|
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 6, 7,
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
|
||||||
e->patterns = gtk_text_view_new();
|
e->patterns = gtk_text_view_new();
|
||||||
swin = gtk_scrolled_window_new(NULL, NULL);
|
swin = gtk_scrolled_window_new(NULL, NULL);
|
||||||
@ -520,14 +519,9 @@ static void create_properties_dialog(PropertyDialogElements *e)
|
|||||||
(GtkAttachOptions) (0), 0, 0);
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
notebook = ui_lookup_widget(e->dialog, "project_notebook");
|
|
||||||
label = gtk_label_new(_("Project"));
|
label = gtk_label_new(_("Project"));
|
||||||
gtk_widget_show(table); /* needed to switch current page */
|
gtk_widget_show(table); /* needed to switch current page */
|
||||||
gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), table, label, 0);
|
gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), table, label, 0);
|
||||||
if (doc!=NULL) ft=doc->file_type;
|
|
||||||
table = build_commands_table( doc, BCS_PROJ, &(e->build_properties), ft );
|
|
||||||
label = gtk_label_new(_("Build"));
|
|
||||||
gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), table, label, 2);
|
|
||||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,11 +572,6 @@ void project_properties(void)
|
|||||||
|
|
||||||
gtk_entry_set_text(GTK_ENTRY(e->file_name), p->file_name);
|
gtk_entry_set_text(GTK_ENTRY(e->file_name), p->file_name);
|
||||||
gtk_entry_set_text(GTK_ENTRY(e->base_path), p->base_path);
|
gtk_entry_set_text(GTK_ENTRY(e->base_path), p->base_path);
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e->make_in_base_path),
|
|
||||||
p->make_in_base_path);
|
|
||||||
if (p->run_cmd != NULL)
|
|
||||||
gtk_entry_set_text(GTK_ENTRY(e->run_cmd), p->run_cmd);
|
|
||||||
|
|
||||||
gtk_widget_show_all(e->dialog);
|
gtk_widget_show_all(e->dialog);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
@ -741,10 +730,6 @@ static gboolean update_config(const PropertyDialogElements *e)
|
|||||||
GeanyBuildCommand *oldvalue;
|
GeanyBuildCommand *oldvalue;
|
||||||
GeanyFiletype *ft=NULL;
|
GeanyFiletype *ft=NULL;
|
||||||
|
|
||||||
p->make_in_base_path = gtk_toggle_button_get_active(
|
|
||||||
GTK_TOGGLE_BUTTON(e->make_in_base_path));
|
|
||||||
setptr(p->run_cmd, g_strdup(gtk_entry_get_text(GTK_ENTRY(e->run_cmd))));
|
|
||||||
|
|
||||||
/* get and set the project description */
|
/* get and set the project description */
|
||||||
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->description));
|
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->description));
|
||||||
gtk_text_buffer_get_start_iter(buffer, &start);
|
gtk_text_buffer_get_start_iter(buffer, &start);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user