Kaydet (Commit) d9361d43 authored tarafından Nick Treleaven's avatar Nick Treleaven

Add keybinding for Make object, update Make descriptions

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@536 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 6ddd4496
2006-07-06 Nick Treleaven <nick.treleaven@btinternet.com>
* src/keybindings.c, src/keybindings.h, src/dialogs.c:
Add keybinding for Make object, update Make descriptions.
2006-07-05 Nick Treleaven <nick.treleaven@btinternet.com>
* src/sciwrappers.c: Make sci_goto_line_scroll work better with
......
......@@ -492,6 +492,11 @@ void dialogs_show_color(void)
}
#define GEANY_ADD_WIDGET_ACCEL(gkey, menuitem) \
if (keys[(gkey)]->key != 0) \
gtk_widget_add_accelerator(menuitem, "activate", accel_group, \
keys[(gkey)]->key, keys[(gkey)]->mods, GTK_ACCEL_VISIBLE)
GtkWidget *dialogs_create_build_menu_gen(gint idx)
{
GtkWidget *menu, *item = NULL, *image, *separator;
......@@ -508,9 +513,7 @@ GtkWidget *dialogs_create_build_menu_gen(gint idx)
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
gtk_tooltips_set_tip(tooltips, item, _("Compiles the current file"), NULL);
if (keys[GEANY_KEYS_BUILD_COMPILE]->key)
gtk_widget_add_accelerator(item, "activate", accel_group, keys[GEANY_KEYS_BUILD_COMPILE]->key,
keys[GEANY_KEYS_BUILD_COMPILE]->mods, GTK_ACCEL_VISIBLE);
GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_COMPILE, item);
image = gtk_image_new_from_stock("gtk-convert", GTK_ICON_SIZE_MENU);
gtk_widget_show(image);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image);
......@@ -525,9 +528,7 @@ GtkWidget *dialogs_create_build_menu_gen(gint idx)
gtk_container_add(GTK_CONTAINER(menu), item);
gtk_tooltips_set_tip(tooltips, item,
_("Builds the current file (generate an executable file)"), NULL);
if (keys[GEANY_KEYS_BUILD_LINK]->key)
gtk_widget_add_accelerator(item, "activate", accel_group, keys[GEANY_KEYS_BUILD_LINK]->key,
keys[GEANY_KEYS_BUILD_LINK]->mods, GTK_ACCEL_VISIBLE);
GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_LINK, item);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_build_activate), NULL);
ft->menu_items->item_link = item;
}
......@@ -545,17 +546,13 @@ GtkWidget *dialogs_create_build_menu_gen(gint idx)
gtk_container_add(GTK_CONTAINER(menu), item);
gtk_tooltips_set_tip(tooltips, item, _("Builds the current file with the "
"make tool and the default target"), NULL);
if (keys[GEANY_KEYS_BUILD_MAKE]->key)
gtk_widget_add_accelerator(item, "activate", accel_group, keys[GEANY_KEYS_BUILD_MAKE]->key,
keys[GEANY_KEYS_BUILD_MAKE]->mods, GTK_ACCEL_VISIBLE);
GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_MAKE, item);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_make_activate), GINT_TO_POINTER(0));
// build the code with make
item = gtk_image_menu_item_new_with_mnemonic(_("Make custom _target"));
gtk_widget_show(item);
if (keys[GEANY_KEYS_BUILD_MAKEOWNTARGET]->key)
gtk_widget_add_accelerator(item, "activate", accel_group, keys[GEANY_KEYS_BUILD_MAKEOWNTARGET]->key,
keys[GEANY_KEYS_BUILD_MAKEOWNTARGET]->mods, GTK_ACCEL_VISIBLE);
GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_MAKEOWNTARGET, item);
gtk_container_add(GTK_CONTAINER(menu), item);
gtk_tooltips_set_tip(tooltips, item, _("Builds the current file with the "
"make tool and the specified target"), NULL);
......@@ -564,6 +561,7 @@ GtkWidget *dialogs_create_build_menu_gen(gint idx)
// build the code with make object
item = gtk_image_menu_item_new_with_mnemonic(_("Make _object"));
gtk_widget_show(item);
GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_MAKEOBJECT, item);
gtk_container_add(GTK_CONTAINER(menu), item);
gtk_tooltips_set_tip(tooltips, item, _("Compiles the current file using the "
"make tool"), NULL);
......@@ -579,9 +577,7 @@ GtkWidget *dialogs_create_build_menu_gen(gint idx)
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
gtk_tooltips_set_tip(tooltips, item, _("Run or view the current file"), NULL);
if (keys[GEANY_KEYS_BUILD_RUN]->key)
gtk_widget_add_accelerator(item, "activate", accel_group, keys[GEANY_KEYS_BUILD_RUN]->key,
keys[GEANY_KEYS_BUILD_RUN]->mods, GTK_ACCEL_VISIBLE);
GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_RUN, item);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_execute_activate), NULL);
ft->menu_items->item_exec = item;
}
......@@ -597,9 +593,7 @@ GtkWidget *dialogs_create_build_menu_gen(gint idx)
item = gtk_image_menu_item_new_with_mnemonic(_("_Set Includes and Arguments"));
gtk_widget_show(item);
if (keys[GEANY_KEYS_BUILD_OPTIONS]->key)
gtk_widget_add_accelerator(item, "activate", accel_group, keys[GEANY_KEYS_BUILD_OPTIONS]->key,
keys[GEANY_KEYS_BUILD_OPTIONS]->mods, GTK_ACCEL_VISIBLE);
GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_OPTIONS, item);
gtk_container_add(GTK_CONTAINER (menu), item);
gtk_tooltips_set_tip(tooltips, item,
_("Sets the includes and library paths for the compiler and "
......
......@@ -71,6 +71,7 @@ static void cb_func_build_compile(void);
static void cb_func_build_link(void);
static void cb_func_build_make(void);
static void cb_func_build_makeowntarget(void);
static void cb_func_build_makeobject(void);
static void cb_func_build_run(void);
static void cb_func_build_run2(void);
static void cb_func_build_options(void);
......@@ -160,9 +161,12 @@ void keybindings_init(void)
keys[GEANY_KEYS_BUILD_LINK] = fill(cb_func_build_link,
GDK_F9, 0, "build_link", _("Build"));
keys[GEANY_KEYS_BUILD_MAKE] = fill(cb_func_build_make,
GDK_F9, GDK_SHIFT_MASK, "build_make", _("Build with \"make\""));
GDK_F9, GDK_SHIFT_MASK, "build_make", _("Make all"));
keys[GEANY_KEYS_BUILD_MAKEOWNTARGET] = fill(cb_func_build_makeowntarget,
GDK_F9, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "build_makeowntarget", _("Build with \"make\" (custom target)"));
GDK_F9, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "build_makeowntarget",
_("Make custom target"));
keys[GEANY_KEYS_BUILD_MAKEOBJECT] = fill(cb_func_build_makeobject,
0, 0, "build_makeobject", _("Make object"));
keys[GEANY_KEYS_BUILD_RUN] = fill(cb_func_build_run,
GDK_F5, 0, "build_run", _("Run"));
keys[GEANY_KEYS_BUILD_RUN2] = fill(cb_func_build_run2,
......@@ -520,6 +524,14 @@ static void cb_func_build_makeowntarget(void)
on_build_make_activate(NULL, GINT_TO_POINTER(1));
}
static void cb_func_build_makeobject(void)
{
gint idx = document_get_cur_idx();
if (idx == -1 || ! doc_list[idx].is_valid) return;
if (doc_list[idx].file_name != NULL)
on_build_make_activate(NULL, GINT_TO_POINTER(2));
}
static void cb_func_build_run(void)
{
gint idx = document_get_cur_idx();
......
......@@ -70,6 +70,7 @@ enum
GEANY_KEYS_BUILD_LINK,
GEANY_KEYS_BUILD_MAKE,
GEANY_KEYS_BUILD_MAKEOWNTARGET,
GEANY_KEYS_BUILD_MAKEOBJECT,
GEANY_KEYS_BUILD_RUN,
GEANY_KEYS_BUILD_RUN2,
GEANY_KEYS_BUILD_OPTIONS,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment