2005-11-22 12:26:26 +00:00
|
|
|
/*
|
|
|
|
* callbacks.c - this file is part of Geany, a fast and lightweight IDE
|
|
|
|
*
|
2009-01-04 18:30:42 +00:00
|
|
|
* Copyright 2005-2009 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
|
|
|
* Copyright 2006-2009 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
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-10 19:54:44 +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:54:28 +00:00
|
|
|
* $Id$
|
2005-11-22 12:26:26 +00:00
|
|
|
*/
|
|
|
|
|
2007-02-24 11:41:56 +00:00
|
|
|
/*
|
|
|
|
* Callbacks used by Glade. These are mainly in response to menu item and button events in the
|
|
|
|
* main window. Callbacks not used by Glade should go elsewhere.
|
|
|
|
*/
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2005-12-29 20:01:18 +00:00
|
|
|
#include "geany.h"
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
#include <stdlib.h>
|
2006-04-27 18:06:35 +00:00
|
|
|
#include <unistd.h>
|
2005-12-29 20:01:18 +00:00
|
|
|
#include <string.h>
|
2005-11-22 12:26:26 +00:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
2007-06-12 16:45:24 +00:00
|
|
|
#include <glib/gstdio.h>
|
2006-08-19 12:56:30 +00:00
|
|
|
#include <time.h>
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
#include "callbacks.h"
|
|
|
|
#include "support.h"
|
|
|
|
|
|
|
|
#include "keyfile.h"
|
|
|
|
#include "document.h"
|
2008-06-02 15:31:59 +00:00
|
|
|
#include "documentprivate.h"
|
2007-08-15 15:37:21 +00:00
|
|
|
#include "filetypes.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
#include "sciwrappers.h"
|
2007-05-28 16:07:30 +00:00
|
|
|
#include "editor.h"
|
2006-09-05 14:24:47 +00:00
|
|
|
#include "ui_utils.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
#include "utils.h"
|
|
|
|
#include "dialogs.h"
|
2006-05-22 00:25:19 +00:00
|
|
|
#include "about.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
#include "msgwindow.h"
|
|
|
|
#include "build.h"
|
|
|
|
#include "prefs.h"
|
|
|
|
#include "templates.h"
|
2009-09-28 11:16:59 +00:00
|
|
|
#include "sidebar.h"
|
2006-06-16 19:58:26 +00:00
|
|
|
#include "keybindings.h"
|
2006-06-19 18:31:17 +00:00
|
|
|
#include "encodings.h"
|
2006-07-13 14:30:44 +00:00
|
|
|
#include "search.h"
|
2006-10-21 11:34:18 +00:00
|
|
|
#include "main.h"
|
2006-11-08 11:42:05 +00:00
|
|
|
#include "symbols.h"
|
2006-12-13 00:46:14 +00:00
|
|
|
#include "tools.h"
|
2007-01-15 18:12:32 +00:00
|
|
|
#include "project.h"
|
2007-06-02 16:14:07 +00:00
|
|
|
#include "navqueue.h"
|
2007-11-17 14:04:27 +00:00
|
|
|
#include "printing.h"
|
2007-11-20 18:15:46 +00:00
|
|
|
#include "plugins.h"
|
2008-08-11 18:16:35 +00:00
|
|
|
#include "log.h"
|
2008-12-06 11:10:06 +00:00
|
|
|
#include "toolbar.h"
|
2009-10-28 18:06:16 +00:00
|
|
|
#include "pluginutils.h"
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-08-23 15:22:13 +00:00
|
|
|
|
2006-06-19 18:31:17 +00:00
|
|
|
#ifdef HAVE_VTE
|
2005-11-27 20:54:28 +00:00
|
|
|
# include "vte.h"
|
|
|
|
#endif
|
|
|
|
|
2006-09-07 15:51:24 +00:00
|
|
|
#ifdef HAVE_SOCKET
|
|
|
|
# include "socket.h"
|
|
|
|
#endif
|
|
|
|
|
2005-11-27 20:54:28 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* flag to indicate the explicit change of a toggle button of the toolbar menu and so the
|
|
|
|
* toggled callback should ignore the change since it is not triggered by the user */
|
2006-07-11 14:15:56 +00:00
|
|
|
static gboolean ignore_toolbar_toggle = FALSE;
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* flag to indicate that an insert callback was triggered from the file menu,
|
|
|
|
* so we need to store the current cursor position in editor_info.click_pos. */
|
2006-12-17 19:31:32 +00:00
|
|
|
static gboolean insert_callback_from_menu = FALSE;
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* represents the state at switching a notebook page(in the left treeviews widget), to not emit
|
|
|
|
* the selection-changed signal from tv.tree_openfiles */
|
|
|
|
/*static gboolean switch_tv_notebook_page = FALSE; */
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2005-12-01 22:59:02 +00:00
|
|
|
|
2008-02-20 11:24:23 +00:00
|
|
|
static gboolean check_no_unsaved(void)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2006-11-07 11:24:22 +00:00
|
|
|
guint i;
|
2006-10-01 16:14:45 +00:00
|
|
|
|
2008-05-29 17:00:54 +00:00
|
|
|
for (i = 0; i < documents_array->len; i++)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-15 22:47:33 +00:00
|
|
|
if (documents[i]->is_valid && documents[i]->changed)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2006-11-07 11:24:22 +00:00
|
|
|
return FALSE;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-27 13:17:29 +00:00
|
|
|
return TRUE; /* no unsaved edits */
|
2006-11-07 11:24:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* set editor_info.click_pos to the current cursor position if insert_callback_from_menu is TRUE
|
|
|
|
* to prevent invalid cursor positions which can cause segfaults */
|
2008-06-15 13:35:48 +00:00
|
|
|
static void verify_click_pos(GeanyDocument *doc)
|
2006-12-17 19:31:32 +00:00
|
|
|
{
|
|
|
|
if (insert_callback_from_menu)
|
|
|
|
{
|
2008-07-14 11:13:54 +00:00
|
|
|
editor_info.click_pos = sci_get_current_position(doc->editor->sci);
|
2006-12-17 19:31:32 +00:00
|
|
|
insert_callback_from_menu = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-03 15:45:23 +00:00
|
|
|
/* should only be called from on_exit_clicked */
|
|
|
|
static void quit_app(void)
|
|
|
|
{
|
|
|
|
configuration_save();
|
|
|
|
|
2008-01-25 13:14:38 +00:00
|
|
|
if (app->project != NULL)
|
2008-02-27 13:17:29 +00:00
|
|
|
project_close(FALSE); /* save project session files */
|
2008-01-25 13:14:38 +00:00
|
|
|
|
2008-04-24 14:33:12 +00:00
|
|
|
document_close_all();
|
2006-11-07 11:24:22 +00:00
|
|
|
|
2009-03-25 19:38:14 +00:00
|
|
|
main_status.quitting = TRUE;
|
|
|
|
|
2007-06-04 15:37:11 +00:00
|
|
|
main_quit();
|
2006-11-07 11:24:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* wrapper function to abort exit process if cancel button is pressed */
|
2006-11-07 11:24:22 +00:00
|
|
|
gboolean
|
|
|
|
on_exit_clicked (GtkWidget *widget, gpointer gdata)
|
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
main_status.quitting = TRUE;
|
2006-11-07 11:24:22 +00:00
|
|
|
|
|
|
|
if (! check_no_unsaved())
|
|
|
|
{
|
2008-04-24 14:33:12 +00:00
|
|
|
if (document_account_for_unsaved())
|
2006-11-13 16:47:26 +00:00
|
|
|
{
|
2006-11-07 11:24:22 +00:00
|
|
|
quit_app();
|
2006-11-13 16:47:26 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2006-11-07 11:24:22 +00:00
|
|
|
}
|
|
|
|
else
|
2007-08-23 11:34:06 +00:00
|
|
|
if (! prefs.confirm_exit ||
|
2007-07-04 17:08:53 +00:00
|
|
|
dialogs_show_question_full(NULL, GTK_STOCK_QUIT, GTK_STOCK_CANCEL, NULL,
|
2006-11-07 11:24:22 +00:00
|
|
|
_("Do you really want to quit?")))
|
2006-11-13 16:47:26 +00:00
|
|
|
{
|
|
|
|
quit_app();
|
|
|
|
return FALSE;
|
|
|
|
}
|
2006-11-07 11:24:22 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
main_status.quitting = FALSE;
|
2005-11-22 12:26:26 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GUI callbacks
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
on_new1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-09-03 16:09:53 +00:00
|
|
|
document_new_file(NULL, NULL, NULL);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_save1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-05-22 14:41:28 +00:00
|
|
|
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (doc != NULL && cur_page >= 0)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-15 22:47:33 +00:00
|
|
|
if (doc->file_name == NULL)
|
2005-11-22 12:26:26 +00:00
|
|
|
dialogs_show_save_as();
|
|
|
|
else
|
2008-06-15 13:35:48 +00:00
|
|
|
document_save_file(doc, FALSE);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_save_as1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
dialogs_show_save_as();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_save_all1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
gint i, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));
|
|
|
|
GeanyDocument *doc, *cur_doc = document_get_current();
|
2007-08-24 11:19:26 +00:00
|
|
|
|
|
|
|
for (i = 0; i < max; i++)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
doc = document_get_from_page(i);
|
2009-04-15 22:47:33 +00:00
|
|
|
if (! doc->changed)
|
|
|
|
continue;
|
|
|
|
if (doc->file_name == NULL)
|
2007-08-24 11:19:26 +00:00
|
|
|
{
|
2008-02-27 13:17:29 +00:00
|
|
|
/* display unnamed document */
|
2008-05-22 14:41:28 +00:00
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
2008-06-15 13:35:48 +00:00
|
|
|
document_get_notebook_page(doc));
|
2005-11-22 12:26:26 +00:00
|
|
|
dialogs_show_save_as();
|
2007-08-24 11:19:26 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
else
|
2008-06-15 13:35:48 +00:00
|
|
|
document_save_file(doc, FALSE);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
2009-09-28 11:16:59 +00:00
|
|
|
sidebar_update_tag_list(cur_doc, TRUE);
|
2008-06-15 13:35:48 +00:00
|
|
|
ui_set_window_title(cur_doc);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-13 17:33:51 +00:00
|
|
|
void
|
2005-11-22 12:26:26 +00:00
|
|
|
on_close_all1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-04-24 14:33:12 +00:00
|
|
|
document_close_all();
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_close1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-11-03 17:38:50 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
document_close(doc);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_quit1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
on_exit_clicked(NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-25 14:42:43 +00:00
|
|
|
void
|
|
|
|
on_file1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_widget_set_sensitive(ui_widgets.recent_files_menuitem,
|
|
|
|
g_queue_get_length(ui_prefs.recent_queue) > 0);
|
2007-11-17 14:04:27 +00:00
|
|
|
#if GTK_CHECK_VERSION(2, 10, 0)
|
2008-02-27 13:17:29 +00:00
|
|
|
/* hide Page setup when GTK printing is not used
|
|
|
|
* (on GTK < 2.10 the menu item is hidden completely) */
|
2007-11-17 14:04:27 +00:00
|
|
|
ui_widget_show_hide(ui_widgets.print_page_setup,
|
|
|
|
printing_prefs.use_gtk_printing || gtk_check_version(2, 10, 0) != NULL);
|
|
|
|
#endif
|
2007-05-25 14:42:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* edit actions, c&p & co, from menu bar and from popup menu */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_edit1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2009-10-28 18:06:16 +00:00
|
|
|
GtkWidget *item;
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-10-28 18:06:16 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
ui_update_menu_copy_items(doc);
|
|
|
|
ui_update_insert_include_item(doc, 1);
|
2009-10-28 18:06:16 +00:00
|
|
|
|
|
|
|
item = ui_lookup_widget(main_widgets.window, "plugin_preferences1");
|
|
|
|
#ifndef HAVE_PLUGINS
|
|
|
|
gtk_widget_hide(item);
|
|
|
|
#else
|
|
|
|
gtk_widget_set_sensitive(item, active_plugin_list != NULL);
|
|
|
|
#endif
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_undo1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2008-09-17 12:12:49 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
if (document_can_undo(doc))
|
2008-09-17 12:12:49 +00:00
|
|
|
{
|
2008-09-25 18:29:53 +00:00
|
|
|
sci_cancel(doc->editor->sci);
|
2008-06-15 13:35:48 +00:00
|
|
|
document_undo(doc);
|
2008-09-17 12:12:49 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_redo1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2008-09-17 12:12:49 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
if (document_can_redo(doc))
|
2008-09-17 12:12:49 +00:00
|
|
|
{
|
2008-09-25 18:29:53 +00:00
|
|
|
sci_cancel(doc->editor->sci);
|
2008-06-15 13:35:48 +00:00
|
|
|
document_redo(doc);
|
2008-09-17 12:12:49 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_cut1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2008-05-22 14:41:28 +00:00
|
|
|
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-06-25 19:57:07 +00:00
|
|
|
if (GTK_IS_EDITABLE(focusw))
|
|
|
|
gtk_editable_cut_clipboard(GTK_EDITABLE(focusw));
|
|
|
|
else
|
2009-04-15 22:47:33 +00:00
|
|
|
if (IS_SCINTILLA(focusw) && doc != NULL)
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_cut(doc->editor->sci);
|
2006-06-25 20:18:24 +00:00
|
|
|
else
|
|
|
|
if (GTK_IS_TEXT_VIEW(focusw))
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer = gtk_text_view_get_buffer(
|
|
|
|
GTK_TEXT_VIEW(focusw));
|
|
|
|
gtk_text_buffer_cut_clipboard(buffer, gtk_clipboard_get(GDK_NONE), TRUE);
|
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_copy1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2008-05-22 14:41:28 +00:00
|
|
|
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-06-25 19:57:07 +00:00
|
|
|
if (GTK_IS_EDITABLE(focusw))
|
|
|
|
gtk_editable_copy_clipboard(GTK_EDITABLE(focusw));
|
|
|
|
else
|
2009-04-15 22:47:33 +00:00
|
|
|
if (IS_SCINTILLA(focusw) && doc != NULL)
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_copy(doc->editor->sci);
|
2006-06-25 20:18:24 +00:00
|
|
|
else
|
|
|
|
if (GTK_IS_TEXT_VIEW(focusw))
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer = gtk_text_view_get_buffer(
|
|
|
|
GTK_TEXT_VIEW(focusw));
|
|
|
|
gtk_text_buffer_copy_clipboard(buffer, gtk_clipboard_get(GDK_NONE));
|
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_paste1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2008-05-22 14:41:28 +00:00
|
|
|
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-06-25 19:57:07 +00:00
|
|
|
if (GTK_IS_EDITABLE(focusw))
|
|
|
|
gtk_editable_paste_clipboard(GTK_EDITABLE(focusw));
|
|
|
|
else
|
2009-04-15 22:47:33 +00:00
|
|
|
if (IS_SCINTILLA(focusw) && doc != NULL)
|
2006-12-21 16:41:36 +00:00
|
|
|
{
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_paste(doc->editor->sci);
|
2006-12-21 16:41:36 +00:00
|
|
|
}
|
2006-06-25 20:18:24 +00:00
|
|
|
else
|
|
|
|
if (GTK_IS_TEXT_VIEW(focusw))
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer = gtk_text_view_get_buffer(
|
|
|
|
GTK_TEXT_VIEW(focusw));
|
|
|
|
gtk_text_buffer_paste_clipboard(buffer, gtk_clipboard_get(GDK_NONE), NULL,
|
|
|
|
TRUE);
|
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_delete1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2008-05-22 14:41:28 +00:00
|
|
|
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2006-06-25 19:57:07 +00:00
|
|
|
if (GTK_IS_EDITABLE(focusw))
|
|
|
|
gtk_editable_delete_selection(GTK_EDITABLE(focusw));
|
|
|
|
else
|
2009-04-15 22:47:33 +00:00
|
|
|
if (IS_SCINTILLA(focusw) && doc != NULL && sci_has_selection(doc->editor->sci))
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_clear(doc->editor->sci);
|
2006-06-25 20:18:24 +00:00
|
|
|
else
|
|
|
|
if (GTK_IS_TEXT_VIEW(focusw))
|
|
|
|
{
|
|
|
|
GtkTextBuffer *buffer = gtk_text_view_get_buffer(
|
|
|
|
GTK_TEXT_VIEW(focusw));
|
|
|
|
gtk_text_buffer_delete_selection(buffer, TRUE, TRUE);
|
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_preferences1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-03-23 16:47:27 +00:00
|
|
|
prefs_show_dialog();
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* about menu item */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_info1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2006-05-21 17:51:22 +00:00
|
|
|
about_dialog_show();
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* open file */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_open1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
dialogs_show_open_file();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* quit toolbar button */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_quit_clicked (GtkAction *action,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
on_exit_clicked(NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* reload file */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_reload_clicked (GtkAction *action,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
2006-08-18 17:24:44 +00:00
|
|
|
{
|
|
|
|
on_reload_as_activate(NULL, GINT_TO_POINTER(-1));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* also used for reloading when user_data is -1 */
|
2006-08-18 17:24:44 +00:00
|
|
|
void
|
|
|
|
on_reload_as_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2007-07-17 08:10:29 +00:00
|
|
|
gchar *base_name;
|
2006-08-18 17:24:44 +00:00
|
|
|
gint i = GPOINTER_TO_INT(user_data);
|
|
|
|
gchar *charset = NULL;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
g_return_if_fail(doc->file_name != NULL);
|
|
|
|
|
2006-08-18 17:24:44 +00:00
|
|
|
if (i >= 0)
|
|
|
|
{
|
2009-04-15 22:47:33 +00:00
|
|
|
if (i >= GEANY_ENCODINGS_MAX || encodings[i].charset == NULL)
|
2009-04-05 21:07:40 +00:00
|
|
|
return;
|
2006-08-18 17:24:44 +00:00
|
|
|
charset = encodings[i].charset;
|
|
|
|
}
|
2009-09-21 20:48:50 +00:00
|
|
|
else
|
|
|
|
charset = doc->encoding;
|
2006-06-29 14:00:09 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
base_name = g_path_get_basename(doc->file_name);
|
2007-07-04 17:08:53 +00:00
|
|
|
if (dialogs_show_question_full(NULL, _("_Reload"), GTK_STOCK_CANCEL,
|
2006-08-18 17:24:44 +00:00
|
|
|
_("Any unsaved changes will be lost."),
|
2007-07-17 08:10:29 +00:00
|
|
|
_("Are you sure you want to reload '%s'?"), base_name))
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
document_reload_file(doc, charset);
|
2006-08-18 17:24:44 +00:00
|
|
|
if (charset != NULL)
|
2008-06-15 13:35:48 +00:00
|
|
|
ui_update_statusbar(doc, -1);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
2007-07-17 08:10:29 +00:00
|
|
|
g_free(base_name);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_images_and_text2_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-17 15:30:01 +00:00
|
|
|
if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem))
|
|
|
|
return;
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2008-05-22 14:41:28 +00:00
|
|
|
gtk_toolbar_set_style(GTK_TOOLBAR(main_widgets.toolbar), GTK_TOOLBAR_BOTH);
|
2008-05-16 12:08:39 +00:00
|
|
|
toolbar_prefs.icon_style = GTK_TOOLBAR_BOTH;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_images_only2_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-17 15:30:01 +00:00
|
|
|
if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem))
|
|
|
|
return;
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2008-05-22 14:41:28 +00:00
|
|
|
gtk_toolbar_set_style(GTK_TOOLBAR(main_widgets.toolbar), GTK_TOOLBAR_ICONS);
|
2008-05-16 12:08:39 +00:00
|
|
|
toolbar_prefs.icon_style = GTK_TOOLBAR_ICONS;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_text_only2_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-17 15:30:01 +00:00
|
|
|
if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem))
|
|
|
|
return;
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2008-05-22 14:41:28 +00:00
|
|
|
gtk_toolbar_set_style(GTK_TOOLBAR(main_widgets.toolbar), GTK_TOOLBAR_TEXT);
|
2008-05-16 12:08:39 +00:00
|
|
|
toolbar_prefs.icon_style = GTK_TOOLBAR_TEXT;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_change_font1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
dialogs_show_open_font();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* new file */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_new_clicked (GtkAction *action,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-09-03 16:09:53 +00:00
|
|
|
document_new_file(NULL, NULL, NULL);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* open file */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_open_clicked (GtkAction *action,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
dialogs_show_open_file();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* save file */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_save_clicked (GtkAction *action,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
on_save1_activate(NULL, user_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* store text, clear search flags so we can use Search->Find Next/Previous */
|
2008-12-06 11:10:06 +00:00
|
|
|
static void setup_find_next(const gchar *text)
|
2006-08-01 11:33:42 +00:00
|
|
|
{
|
2008-12-06 11:10:06 +00:00
|
|
|
setptr(search_data.text, g_strdup(text));
|
2006-08-11 21:12:49 +00:00
|
|
|
search_data.flags = 0;
|
|
|
|
search_data.backwards = FALSE;
|
2007-07-11 17:44:43 +00:00
|
|
|
search_data.search_bar = TRUE;
|
2006-08-01 11:33:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* search text */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbar_search_entry_changed(GtkAction *action, const gchar *text, gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2007-07-09 17:33:31 +00:00
|
|
|
gboolean result;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-12-06 11:10:06 +00:00
|
|
|
setup_find_next(text);
|
2009-02-27 14:06:51 +00:00
|
|
|
result = document_search_bar_find(doc, search_data.text, 0, GPOINTER_TO_INT(user_data));
|
2009-02-27 14:05:50 +00:00
|
|
|
if (search_data.search_bar)
|
|
|
|
ui_set_search_entry_background(toolbar_get_widget_child_by_name("SearchEntry"), result);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* search text */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_search_clicked (GtkAction *action,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2007-07-09 17:33:31 +00:00
|
|
|
gboolean result;
|
2008-12-06 11:10:06 +00:00
|
|
|
GtkWidget *entry = toolbar_get_widget_child_by_name("SearchEntry");
|
|
|
|
|
|
|
|
if (entry != NULL)
|
|
|
|
{
|
|
|
|
const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-12-06 11:10:06 +00:00
|
|
|
setup_find_next(text);
|
|
|
|
result = document_search_bar_find(doc, search_data.text, 0, FALSE);
|
2009-02-27 14:05:50 +00:00
|
|
|
if (search_data.search_bar)
|
|
|
|
ui_set_search_entry_background(entry, result);
|
2008-12-06 11:10:06 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_toolbar_large_icons1_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-17 15:30:01 +00:00
|
|
|
if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem))
|
|
|
|
return;
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2008-05-16 12:08:39 +00:00
|
|
|
toolbar_prefs.icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
2009-03-29 16:15:35 +00:00
|
|
|
gtk_toolbar_set_icon_size(GTK_TOOLBAR(main_widgets.toolbar), toolbar_prefs.icon_size);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_toolbar_small_icons1_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-17 15:30:01 +00:00
|
|
|
if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem))
|
|
|
|
return;
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2008-05-16 12:08:39 +00:00
|
|
|
toolbar_prefs.icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
2009-03-29 16:15:35 +00:00
|
|
|
gtk_toolbar_set_icon_size(GTK_TOOLBAR(main_widgets.toolbar), toolbar_prefs.icon_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_very_small_icons1_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2009-03-29 16:15:35 +00:00
|
|
|
{
|
2009-04-17 15:30:01 +00:00
|
|
|
if (ignore_toolbar_toggle || ! gtk_check_menu_item_get_active(menuitem))
|
|
|
|
return;
|
2009-03-29 16:15:35 +00:00
|
|
|
|
|
|
|
toolbar_prefs.icon_size = GTK_ICON_SIZE_MENU;
|
|
|
|
gtk_toolbar_set_icon_size(GTK_TOOLBAR(main_widgets.toolbar), toolbar_prefs.icon_size);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* hides toolbar from toolbar popup menu */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_hide_toolbar1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-12-18 21:21:53 +00:00
|
|
|
GtkWidget *tool_item = ui_lookup_widget(GTK_WIDGET(main_widgets.window), "menu_show_toolbar1");
|
2005-11-22 12:26:26 +00:00
|
|
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tool_item), FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* zoom in from menu bar and popup menu */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_zoom_in1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-05 21:07:40 +00:00
|
|
|
static gint done = 1;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
if (done++ % 3 == 0)
|
|
|
|
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin,
|
2008-07-14 11:13:54 +00:00
|
|
|
(sci_get_zoom(doc->editor->sci) / 2));
|
2009-04-15 22:47:33 +00:00
|
|
|
sci_zoom_in(doc->editor->sci);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* zoom out from menu bar and popup menu */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_zoom_out1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
|
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
if (sci_get_zoom(doc->editor->sci) == 0)
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
|
2009-04-15 22:47:33 +00:00
|
|
|
sci_zoom_out(doc->editor->sci);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_normal_size1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
|
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
sci_zoom_off(doc->editor->sci);
|
|
|
|
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* close tab */
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_close_clicked (GtkAction *action,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-11-03 17:38:50 +00:00
|
|
|
on_close1_activate(NULL, NULL);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-09 20:31:38 +00:00
|
|
|
void
|
|
|
|
on_toolbutton_close_all_clicked (GtkAction *action,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
on_close_all1_activate(NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_toolbutton_preferences_clicked (GtkAction *action,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
on_preferences1_activate(NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-24 18:12:39 +00:00
|
|
|
static gboolean delayed_check_disk_status(gpointer data)
|
|
|
|
{
|
|
|
|
document_check_disk_status(data, FALSE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-03 12:54:13 +00:00
|
|
|
/* Changes window-title after switching tabs and lots of other things.
|
|
|
|
* note: using 'after' makes Scintilla redraw before the UI, appearing more responsive */
|
2006-05-26 12:22:39 +00:00
|
|
|
void
|
|
|
|
on_notebook1_switch_page_after (GtkNotebook *notebook,
|
|
|
|
GtkNotebookPage *page,
|
|
|
|
guint page_num,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc;
|
2006-05-26 12:22:39 +00:00
|
|
|
|
2009-04-05 21:07:40 +00:00
|
|
|
if (G_UNLIKELY(main_status.opening_session_files) || G_UNLIKELY(main_status.closing_all))
|
2008-04-02 13:48:39 +00:00
|
|
|
return;
|
2006-05-26 12:22:39 +00:00
|
|
|
|
2006-08-08 13:01:50 +00:00
|
|
|
if (page_num == (guint) -1 && page != NULL)
|
2008-06-15 13:35:48 +00:00
|
|
|
doc = document_find_by_sci(SCINTILLA(page));
|
2006-05-26 12:22:39 +00:00
|
|
|
else
|
2008-06-15 13:35:48 +00:00
|
|
|
doc = document_get_from_page(page_num);
|
2006-05-26 12:22:39 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (doc != NULL)
|
2006-05-26 12:22:39 +00:00
|
|
|
{
|
2009-09-28 11:16:59 +00:00
|
|
|
sidebar_select_openfiles_item(doc);
|
2008-06-15 13:35:48 +00:00
|
|
|
document_set_text_changed(doc, doc->changed); /* also sets window title and status bar */
|
|
|
|
ui_update_popup_reundo_items(doc);
|
|
|
|
ui_document_show_hide(doc); /* update the document menu */
|
|
|
|
build_menu_update(doc);
|
2009-09-28 11:16:59 +00:00
|
|
|
sidebar_update_tag_list(doc, FALSE);
|
2007-03-14 12:03:15 +00:00
|
|
|
|
2009-03-24 18:12:39 +00:00
|
|
|
/* We delay the check to avoid weird fast, unintended switching of notebook pages when
|
|
|
|
* the 'file has changed' dialog is shown while the switch event is not yet completely
|
|
|
|
* finished. So, we check after the switch has been performed to be safe. */
|
|
|
|
g_idle_add(delayed_check_disk_status, doc);
|
2006-06-29 23:51:32 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_VTE
|
2009-02-01 18:03:19 +00:00
|
|
|
vte_cwd((doc->real_path != NULL) ? doc->real_path : doc->file_name, FALSE);
|
2006-06-29 23:51:32 +00:00
|
|
|
#endif
|
2007-08-23 15:22:13 +00:00
|
|
|
|
2008-11-21 17:33:35 +00:00
|
|
|
g_signal_emit_by_name(geany_object, "document-activate", doc);
|
2006-08-19 15:07:11 +00:00
|
|
|
}
|
2006-05-26 12:22:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_tv_notebook_switch_page (GtkNotebook *notebook,
|
|
|
|
GtkNotebookPage *page,
|
|
|
|
guint page_num,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-02-27 13:17:29 +00:00
|
|
|
/* suppress selection changed signal when switching to the open files list */
|
2008-05-22 14:41:28 +00:00
|
|
|
ignore_callback = TRUE;
|
2007-10-16 08:54:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_tv_notebook_switch_page_after (GtkNotebook *notebook,
|
|
|
|
GtkNotebookPage *page,
|
|
|
|
guint page_num,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-05-22 14:41:28 +00:00
|
|
|
ignore_callback = FALSE;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_crlf_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-15 22:47:33 +00:00
|
|
|
GeanyDocument *doc;
|
2009-04-17 15:30:01 +00:00
|
|
|
if (ignore_callback || ! gtk_check_menu_item_get_active(menuitem))
|
2009-04-05 21:07:40 +00:00
|
|
|
return;
|
2009-04-15 22:47:33 +00:00
|
|
|
doc = document_get_current();
|
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_convert_eols(doc->editor->sci, SC_EOL_CRLF);
|
|
|
|
sci_set_eol_mode(doc->editor->sci, SC_EOL_CRLF);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_lf_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-15 22:47:33 +00:00
|
|
|
GeanyDocument *doc;
|
2009-04-17 15:30:01 +00:00
|
|
|
if (ignore_callback || ! gtk_check_menu_item_get_active(menuitem))
|
2009-04-05 21:07:40 +00:00
|
|
|
return;
|
2009-04-17 15:30:01 +00:00
|
|
|
doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_convert_eols(doc->editor->sci, SC_EOL_LF);
|
|
|
|
sci_set_eol_mode(doc->editor->sci, SC_EOL_LF);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_cr_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2009-04-15 22:47:33 +00:00
|
|
|
GeanyDocument *doc;
|
2009-04-17 15:30:01 +00:00
|
|
|
if (ignore_callback || ! gtk_check_menu_item_get_active(menuitem))
|
2009-04-05 21:07:40 +00:00
|
|
|
return;
|
2009-04-15 22:47:33 +00:00
|
|
|
doc = document_get_current();
|
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_convert_eols(doc->editor->sci, SC_EOL_CR);
|
|
|
|
sci_set_eol_mode(doc->editor->sci, SC_EOL_CR);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_replace_tabs_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
editor_replace_tabs(doc->editor);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
toolbar_popup_menu (GtkWidget *widget,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
if (event->button == 3)
|
|
|
|
{
|
2007-03-09 13:52:26 +00:00
|
|
|
GtkWidget *w;
|
2006-07-11 14:15:56 +00:00
|
|
|
|
|
|
|
ignore_toolbar_toggle = TRUE;
|
|
|
|
|
2008-05-16 12:08:39 +00:00
|
|
|
switch (toolbar_prefs.icon_style)
|
2006-07-11 14:15:56 +00:00
|
|
|
{
|
2008-12-18 21:21:53 +00:00
|
|
|
case 0: w = ui_lookup_widget(ui_widgets.toolbar_menu, "images_only2"); break;
|
|
|
|
case 1: w = ui_lookup_widget(ui_widgets.toolbar_menu, "text_only2"); break;
|
|
|
|
default: w = ui_lookup_widget(ui_widgets.toolbar_menu, "images_and_text2"); break;
|
2006-07-11 14:15:56 +00:00
|
|
|
}
|
2007-03-09 13:52:26 +00:00
|
|
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), TRUE);
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2008-05-16 12:08:39 +00:00
|
|
|
switch (toolbar_prefs.icon_size)
|
2006-07-11 14:15:56 +00:00
|
|
|
{
|
|
|
|
case GTK_ICON_SIZE_LARGE_TOOLBAR:
|
2008-12-18 21:21:53 +00:00
|
|
|
w = ui_lookup_widget(ui_widgets.toolbar_menu, "large_icons1"); break;
|
2009-03-29 16:15:35 +00:00
|
|
|
case GTK_ICON_SIZE_SMALL_TOOLBAR:
|
|
|
|
w = ui_lookup_widget(ui_widgets.toolbar_menu, "small_icons1"); break;
|
|
|
|
default: w = ui_lookup_widget(ui_widgets.toolbar_menu, "very_small_icons1"); break;
|
2006-07-11 14:15:56 +00:00
|
|
|
}
|
2007-03-09 13:52:26 +00:00
|
|
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), TRUE);
|
2006-07-11 14:15:56 +00:00
|
|
|
|
|
|
|
ignore_toolbar_toggle = FALSE;
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
gtk_menu_popup(GTK_MENU(ui_widgets.toolbar_menu), NULL, NULL, NULL, NULL, event->button, event->time);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-12 16:01:23 +00:00
|
|
|
void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
|
|
|
ScintillaObject *sci;
|
2007-09-07 19:01:55 +00:00
|
|
|
gchar *text;
|
2007-09-12 16:01:23 +00:00
|
|
|
gboolean keep_sel = TRUE;
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2006-09-12 08:32:52 +00:00
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci = doc->editor->sci;
|
2008-09-17 18:02:55 +00:00
|
|
|
if (! sci_has_selection(sci))
|
2007-09-12 16:01:23 +00:00
|
|
|
{
|
2008-03-12 13:37:39 +00:00
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_SELECT, GEANY_KEYS_SELECT_WORD);
|
2007-09-12 16:01:23 +00:00
|
|
|
keep_sel = FALSE;
|
|
|
|
}
|
2008-06-15 13:35:48 +00:00
|
|
|
else
|
2007-09-07 19:01:55 +00:00
|
|
|
{
|
2008-03-06 15:47:43 +00:00
|
|
|
gchar *result = NULL;
|
2008-03-13 15:18:42 +00:00
|
|
|
gint cmd = SCI_LOWERCASE;
|
2007-09-12 16:01:23 +00:00
|
|
|
gint text_len = sci_get_selected_text_length(sci);
|
2008-03-06 15:47:43 +00:00
|
|
|
gboolean rectsel = scintilla_send_message(sci, SCI_SELECTIONISRECTANGLE, 0, 0);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-09-12 16:01:23 +00:00
|
|
|
text = g_malloc(text_len + 1);
|
|
|
|
sci_get_selected_text(sci, text);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2007-09-07 19:01:55 +00:00
|
|
|
if (utils_str_has_upper(text))
|
2008-03-06 15:47:43 +00:00
|
|
|
{
|
|
|
|
if (rectsel)
|
|
|
|
cmd = SCI_LOWERCASE;
|
|
|
|
else
|
|
|
|
result = g_utf8_strdown(text, -1);
|
|
|
|
|
|
|
|
}
|
2007-09-07 19:01:55 +00:00
|
|
|
else
|
2008-03-06 15:47:43 +00:00
|
|
|
{
|
|
|
|
if (rectsel)
|
|
|
|
cmd = SCI_UPPERCASE;
|
|
|
|
else
|
|
|
|
result = g_utf8_strup(text, -1);
|
|
|
|
|
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-03-06 15:47:43 +00:00
|
|
|
if (result != NULL)
|
|
|
|
{
|
|
|
|
sci_replace_sel(sci, result);
|
|
|
|
g_free(result);
|
|
|
|
if (keep_sel)
|
|
|
|
sci_set_selection_start(sci, sci_get_current_position(sci) - text_len + 1);
|
|
|
|
}
|
|
|
|
else
|
2008-12-05 12:34:20 +00:00
|
|
|
sci_send_command(sci, cmd);
|
2006-09-12 08:32:52 +00:00
|
|
|
|
2007-09-07 19:01:55 +00:00
|
|
|
g_free(text);
|
2007-09-12 16:01:23 +00:00
|
|
|
|
2007-09-07 19:01:55 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_show_toolbar1_toggled (GtkCheckMenuItem *checkmenuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-05-22 14:41:28 +00:00
|
|
|
if (ignore_callback) return;
|
2006-07-21 11:41:33 +00:00
|
|
|
|
2008-05-16 12:08:39 +00:00
|
|
|
toolbar_prefs.visible = (toolbar_prefs.visible) ? FALSE : TRUE;;
|
2008-05-22 14:41:28 +00:00
|
|
|
ui_widget_show_hide(GTK_WIDGET(main_widgets.toolbar), toolbar_prefs.visible);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_fullscreen1_toggled (GtkCheckMenuItem *checkmenuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2009-04-30 17:17:13 +00:00
|
|
|
if (ignore_callback)
|
|
|
|
return;
|
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
ui_prefs.fullscreen = (ui_prefs.fullscreen) ? FALSE : TRUE;
|
2006-09-05 14:24:47 +00:00
|
|
|
ui_set_fullscreen();
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_show_messages_window1_toggled (GtkCheckMenuItem *checkmenuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-05-22 14:41:28 +00:00
|
|
|
if (ignore_callback) return;
|
2006-07-21 11:41:33 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
ui_prefs.msgwindow_visible = (ui_prefs.msgwindow_visible) ? FALSE : TRUE;
|
2008-12-18 21:21:53 +00:00
|
|
|
ui_widget_show_hide(ui_lookup_widget(main_widgets.window, "scrolledwindow1"), ui_prefs.msgwindow_visible);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_markers_margin1_toggled (GtkCheckMenuItem *checkmenuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-12-07 19:12:08 +00:00
|
|
|
if (ignore_callback)
|
|
|
|
return;
|
|
|
|
|
|
|
|
editor_prefs.show_markers_margin = ! editor_prefs.show_markers_margin;
|
|
|
|
ui_toggle_editor_features(GEANY_EDITOR_SHOW_MARKERS_MARGIN);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2006-02-14 22:07:55 +00:00
|
|
|
on_show_line_numbers1_toggled (GtkCheckMenuItem *checkmenuitem,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-12-07 19:12:08 +00:00
|
|
|
if (ignore_callback)
|
|
|
|
return;
|
|
|
|
|
|
|
|
editor_prefs.show_linenumber_margin = ! editor_prefs.show_linenumber_margin;
|
|
|
|
ui_toggle_editor_features(GEANY_EDITOR_SHOW_LINE_NUMBERS);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_show_white_space1_toggled (GtkCheckMenuItem *checkmenuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
if (ignore_callback)
|
|
|
|
return;
|
|
|
|
|
|
|
|
editor_prefs.show_white_space = ! editor_prefs.show_white_space;
|
|
|
|
ui_toggle_editor_features(GEANY_EDITOR_SHOW_WHITE_SPACE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_show_line_endings1_toggled (GtkCheckMenuItem *checkmenuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
if (ignore_callback)
|
|
|
|
return;
|
|
|
|
|
|
|
|
editor_prefs.show_line_endings = ! editor_prefs.show_line_endings;
|
|
|
|
ui_toggle_editor_features(GEANY_EDITOR_SHOW_LINE_ENDINGS);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_show_indentation_guides1_toggled (GtkCheckMenuItem *checkmenuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
if (ignore_callback)
|
|
|
|
return;
|
|
|
|
|
|
|
|
editor_prefs.show_indent_guide = ! editor_prefs.show_indent_guide;
|
|
|
|
ui_toggle_editor_features(GEANY_EDITOR_SHOW_INDENTATION_GUIDES);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2008-05-09 14:17:25 +00:00
|
|
|
on_line_wrapping1_toggled (GtkCheckMenuItem *checkmenuitem,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-05-22 14:41:28 +00:00
|
|
|
if (! ignore_callback)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
editor_set_line_wrapping(doc->editor, ! doc->editor->line_wrapping);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-20 22:55:53 +00:00
|
|
|
void
|
|
|
|
on_set_file_readonly1_toggled (GtkCheckMenuItem *checkmenuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-05-22 14:41:28 +00:00
|
|
|
if (! ignore_callback)
|
2006-02-20 22:55:53 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
doc->readonly = ! doc->readonly;
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_set_readonly(doc->editor->sci, doc->readonly);
|
2008-06-15 13:35:48 +00:00
|
|
|
ui_update_tab_status(doc);
|
|
|
|
ui_update_statusbar(doc, -1);
|
2006-02-20 22:55:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
2007-06-12 15:16:17 +00:00
|
|
|
on_use_auto_indentation1_toggled (GtkCheckMenuItem *checkmenuitem,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-05-22 14:41:28 +00:00
|
|
|
if (! ignore_callback)
|
2006-02-14 22:07:55 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
doc->editor->auto_indent = ! doc->editor->auto_indent;
|
2006-02-14 22:07:55 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-17 16:42:03 +00:00
|
|
|
static void find_usage(gboolean in_session)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
gint flags;
|
2006-11-01 15:26:41 +00:00
|
|
|
gchar *search_text;
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2006-07-23 20:26:57 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2006-11-01 15:26:41 +00:00
|
|
|
|
2008-09-17 18:02:55 +00:00
|
|
|
if (sci_has_selection(doc->editor->sci))
|
2008-02-27 13:17:29 +00:00
|
|
|
{ /* take selected text if there is a selection */
|
2008-07-14 11:13:54 +00:00
|
|
|
search_text = g_malloc(sci_get_selected_text_length(doc->editor->sci) + 1);
|
|
|
|
sci_get_selected_text(doc->editor->sci, search_text);
|
2006-08-05 12:11:55 +00:00
|
|
|
flags = SCFIND_MATCHCASE;
|
2006-07-23 20:26:57 +00:00
|
|
|
}
|
|
|
|
else
|
2006-08-05 12:11:55 +00:00
|
|
|
{
|
2006-09-04 15:57:46 +00:00
|
|
|
search_text = g_strdup(editor_info.current_word);
|
2006-08-05 12:11:55 +00:00
|
|
|
flags = SCFIND_MATCHCASE | SCFIND_WHOLEWORD;
|
|
|
|
}
|
2006-07-23 20:26:57 +00:00
|
|
|
|
2008-07-17 16:42:03 +00:00
|
|
|
search_find_usage(search_text, flags, in_session);
|
2006-07-23 20:26:57 +00:00
|
|
|
g_free(search_text);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-17 16:42:03 +00:00
|
|
|
void
|
|
|
|
on_find_document_usage1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
find_usage(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_find_usage1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
find_usage(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_goto_tag_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-09-25 12:39:41 +00:00
|
|
|
gboolean definition = (menuitem ==
|
2008-12-18 21:21:53 +00:00
|
|
|
GTK_MENU_ITEM(ui_lookup_widget(main_widgets.editor_menu, "goto_tag_definition1")));
|
2008-05-16 14:17:54 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2007-06-02 16:14:07 +00:00
|
|
|
|
2009-09-16 12:13:50 +00:00
|
|
|
/* update cursor pos for navigating back afterwards */
|
|
|
|
if (!sci_has_selection(doc->editor->sci))
|
|
|
|
sci_set_current_position(doc->editor->sci, editor_info.click_pos, FALSE);
|
|
|
|
|
|
|
|
/* use the keybinding callback as it checks for selections as well as current word */
|
|
|
|
if (definition)
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_GOTO, GEANY_KEYS_GOTO_TAGDEFINITION);
|
|
|
|
else
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_GOTO, GEANY_KEYS_GOTO_TAGDECLARATION);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_count_words1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-07-27 11:28:17 +00:00
|
|
|
tools_word_count();
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_show_color_chooser1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2006-12-20 15:57:28 +00:00
|
|
|
gchar colour[9];
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
|
|
|
gint pos;
|
2006-07-27 20:57:13 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2006-07-27 23:17:31 +00:00
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
pos = sci_get_current_position(doc->editor->sci);
|
2008-09-25 18:28:37 +00:00
|
|
|
editor_find_current_word(doc->editor, pos, colour, sizeof colour, GEANY_WORDCHARS"#");
|
2007-07-27 11:28:17 +00:00
|
|
|
tools_color_chooser(colour);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_compile_clicked (GtkAction *action,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-03-12 13:37:39 +00:00
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_BUILD, GEANY_KEYS_BUILD_COMPILE);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_find1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2006-08-11 21:12:49 +00:00
|
|
|
search_show_find_dialog();
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-22 13:30:16 +00:00
|
|
|
static void find_again(gboolean change_direction)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2008-02-22 13:30:16 +00:00
|
|
|
|
2006-08-11 21:12:49 +00:00
|
|
|
if (search_data.text)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-02-22 13:30:16 +00:00
|
|
|
gboolean forward = ! search_data.backwards;
|
2008-06-15 13:35:48 +00:00
|
|
|
gint result = document_find_text(doc, search_data.text, search_data.flags,
|
2008-02-22 13:30:16 +00:00
|
|
|
change_direction ? forward : !forward, FALSE, NULL);
|
|
|
|
|
|
|
|
if (result > -1)
|
2008-07-08 13:53:08 +00:00
|
|
|
editor_display_current_line(doc->editor, 0.3F);
|
2007-07-20 12:06:51 +00:00
|
|
|
|
2009-02-27 14:05:50 +00:00
|
|
|
if (search_data.search_bar)
|
|
|
|
ui_set_search_entry_background(
|
|
|
|
toolbar_get_widget_child_by_name("SearchEntry"), (result > -1));
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-18 17:43:22 +00:00
|
|
|
void
|
2008-02-22 13:30:16 +00:00
|
|
|
on_find_next1_activate (GtkMenuItem *menuitem,
|
2006-07-18 17:43:22 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-02-22 13:30:16 +00:00
|
|
|
find_again(FALSE);
|
|
|
|
}
|
2006-07-18 17:43:22 +00:00
|
|
|
|
|
|
|
|
2008-02-22 13:30:16 +00:00
|
|
|
void
|
|
|
|
on_find_previous1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2006-08-11 21:12:49 +00:00
|
|
|
if (search_data.flags & SCFIND_REGEXP)
|
2008-02-27 13:17:29 +00:00
|
|
|
/* Can't reverse search order for a regex (find next ignores search backwards) */
|
|
|
|
utils_beep();
|
2006-07-18 17:43:22 +00:00
|
|
|
else
|
2008-02-22 13:30:16 +00:00
|
|
|
find_again(TRUE);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-23 17:51:30 +00:00
|
|
|
void
|
|
|
|
on_find_nextsel1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
search_find_selection(document_get_current(), FALSE);
|
2007-01-23 17:51:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_find_prevsel1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
search_find_selection(document_get_current(), TRUE);
|
2007-01-23 17:51:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
2006-08-11 21:12:49 +00:00
|
|
|
on_replace1_activate (GtkMenuItem *menuitem,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2006-08-11 21:12:49 +00:00
|
|
|
search_show_replace_dialog();
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-07-13 14:30:44 +00:00
|
|
|
void
|
|
|
|
on_find_in_files1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-12-02 10:52:19 +00:00
|
|
|
search_show_find_in_files_dialog(NULL);
|
2006-07-13 14:30:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_go_to_line_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-10-23 20:55:06 +00:00
|
|
|
static gdouble val = 1;
|
|
|
|
|
|
|
|
if (dialogs_show_input_numeric(_("Go to Line"), _("Enter the line you want to go to:"),
|
|
|
|
&val, 1, 100000000, 1))
|
|
|
|
{
|
|
|
|
GeanyDocument *doc = document_get_current();
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
if (! editor_goto_line(doc->editor, (gint) val - 1))
|
|
|
|
utils_beep();
|
2008-10-23 20:55:06 +00:00
|
|
|
}
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_goto_entry_activate(GtkAction *action, const gchar *text, gpointer user_data)
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
2008-12-06 11:10:06 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
if (! editor_goto_line(doc->editor, atoi(text) - 1))
|
|
|
|
utils_beep();
|
2009-09-27 11:06:04 +00:00
|
|
|
else
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_FOCUS, GEANY_KEYS_FOCUS_EDITOR);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-26 18:29:24 +00:00
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_goto_clicked (GtkAction *action,
|
2006-02-26 18:29:24 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-12-06 11:10:06 +00:00
|
|
|
GtkWidget *entry = toolbar_get_widget_child_by_name("GotoEntry");
|
2006-02-26 18:29:24 +00:00
|
|
|
|
2008-12-06 11:10:06 +00:00
|
|
|
if (entry != NULL)
|
|
|
|
{
|
|
|
|
const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
|
2006-02-26 18:29:24 +00:00
|
|
|
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_goto_entry_activate(NULL, text, NULL);
|
|
|
|
}
|
2006-02-26 18:29:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_help1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-06-10 20:09:22 +00:00
|
|
|
gint skip;
|
|
|
|
gchar *uri;
|
|
|
|
|
2006-07-26 17:02:16 +00:00
|
|
|
#ifdef G_OS_WIN32
|
2007-06-10 20:09:22 +00:00
|
|
|
skip = 8;
|
2007-09-11 18:18:09 +00:00
|
|
|
uri = g_strconcat("file:///", app->docdir, "/Manual.html", NULL);
|
2008-02-27 13:17:29 +00:00
|
|
|
g_strdelimit(uri, "\\", '/'); /* replace '\\' by '/' */
|
2005-11-22 12:26:26 +00:00
|
|
|
#else
|
2007-06-10 20:09:22 +00:00
|
|
|
skip = 7;
|
|
|
|
uri = g_strconcat("file://", app->docdir, "index.html", NULL);
|
2005-12-18 22:38:57 +00:00
|
|
|
#endif
|
2006-03-16 03:15:23 +00:00
|
|
|
|
2007-06-10 20:09:22 +00:00
|
|
|
if (! g_file_test(uri + skip, G_FILE_TEST_IS_REGULAR))
|
2008-02-27 13:17:29 +00:00
|
|
|
{ /* fall back to online documentation if it is not found on the hard disk */
|
2006-03-16 03:15:23 +00:00
|
|
|
g_free(uri);
|
2008-03-21 13:42:31 +00:00
|
|
|
uri = g_strconcat(GEANY_HOMEPAGE, "manual/", VERSION, "/index.html", NULL);
|
2006-03-16 03:15:23 +00:00
|
|
|
}
|
|
|
|
|
2009-01-28 19:30:18 +00:00
|
|
|
utils_open_browser(uri);
|
2005-12-18 22:38:57 +00:00
|
|
|
g_free(uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_help_shortcuts1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-03-23 16:34:54 +00:00
|
|
|
keybindings_show_shortcuts();
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_website1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2009-01-28 19:30:18 +00:00
|
|
|
utils_open_browser(GEANY_HOMEPAGE);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_comments_function_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2005-11-22 12:26:26 +00:00
|
|
|
gchar *text;
|
2006-06-16 17:11:09 +00:00
|
|
|
const gchar *cur_tag = NULL;
|
2005-11-22 12:26:26 +00:00
|
|
|
gint line = -1, pos = 0;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (doc == NULL || doc->file_type == NULL)
|
2006-06-07 16:50:41 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
ui_set_statusbar(FALSE,
|
|
|
|
_("Please set the filetype for the current file before using this function."));
|
2006-06-07 16:50:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-07-08 16:30:37 +00:00
|
|
|
/* symbols_get_current_function returns -1 on failure, so sci_get_position_from_line
|
2008-02-27 13:17:29 +00:00
|
|
|
* returns the current position, so it should be safe */
|
2008-07-08 16:30:37 +00:00
|
|
|
line = symbols_get_current_function(doc, &cur_tag);
|
2008-07-14 11:13:54 +00:00
|
|
|
pos = sci_get_position_from_line(doc->editor->sci, line - 1);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
text = templates_get_template_function(doc->file_type->id, cur_tag);
|
2006-05-10 19:54:44 +00:00
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_insert_text(doc->editor->sci, pos, text);
|
2005-11-22 12:26:26 +00:00
|
|
|
g_free(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_comments_multiline_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2005-11-22 12:26:26 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (doc == NULL || doc->file_type == NULL)
|
2006-06-07 16:50:41 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
ui_set_statusbar(FALSE,
|
|
|
|
_("Please set the filetype for the current file before using this function."));
|
2006-06-07 16:50:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
verify_click_pos(doc); /* make sure that the click_pos is valid */
|
2007-01-06 15:03:53 +00:00
|
|
|
|
2008-09-25 18:28:37 +00:00
|
|
|
editor_insert_multiline_comment(doc->editor);
|
2007-01-06 15:03:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_comments_gpl_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2007-01-06 15:03:53 +00:00
|
|
|
gchar *text;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2008-06-15 13:35:48 +00:00
|
|
|
|
|
|
|
text = templates_get_template_licence(FILETYPE_ID(doc->file_type), GEANY_TEMPLATE_GPL);
|
2006-05-10 19:54:44 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
verify_click_pos(doc); /* make sure that the click_pos is valid */
|
2006-12-17 19:31:32 +00:00
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
|
2005-11-22 12:26:26 +00:00
|
|
|
g_free(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2007-01-06 15:03:53 +00:00
|
|
|
on_comments_bsd_activate (GtkMenuItem *menuitem,
|
2005-11-22 12:26:26 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-01-06 15:38:44 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2005-11-22 12:26:26 +00:00
|
|
|
gchar *text;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2008-06-15 13:35:48 +00:00
|
|
|
|
|
|
|
text = templates_get_template_licence(FILETYPE_ID(doc->file_type), GEANY_TEMPLATE_BSD);
|
2006-05-10 19:54:44 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
verify_click_pos(doc); /* make sure that the click_pos is valid */
|
2006-12-17 19:31:32 +00:00
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
|
2005-11-22 12:26:26 +00:00
|
|
|
g_free(text);
|
2007-01-06 15:38:44 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_comments_changelog_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2005-11-22 12:26:26 +00:00
|
|
|
gchar *text;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2008-06-15 13:35:48 +00:00
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
text = templates_get_template_changelog();
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_insert_text(doc->editor->sci, 0, text);
|
2008-02-27 13:17:29 +00:00
|
|
|
/* sets the cursor to the right position to type the changelog text,
|
|
|
|
* the template has 21 chars + length of name and email */
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_goto_pos(doc->editor->sci, 21 + strlen(template_prefs.developer) + strlen(template_prefs.mail), TRUE);
|
2005-11-22 12:26:26 +00:00
|
|
|
|
|
|
|
g_free(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_comments_fileheader_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2005-11-22 12:26:26 +00:00
|
|
|
gchar *text;
|
2007-07-04 11:32:33 +00:00
|
|
|
gchar *fname;
|
2008-05-16 14:17:54 +00:00
|
|
|
GeanyFiletype *ft;
|
2006-05-22 15:28:48 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2007-07-04 11:32:33 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
ft = doc->file_type;
|
|
|
|
fname = doc->file_name;
|
2007-07-04 11:32:33 +00:00
|
|
|
text = templates_get_template_fileheader(FILETYPE_ID(ft), fname);
|
2006-05-10 19:54:44 +00:00
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_insert_text(doc->editor->sci, 0, text);
|
|
|
|
sci_goto_pos(doc->editor->sci, 0, FALSE);
|
2005-11-22 12:26:26 +00:00
|
|
|
g_free(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-21 13:09:09 +00:00
|
|
|
static void
|
|
|
|
on_custom_date_input_response(const gchar *input)
|
2006-08-19 12:56:30 +00:00
|
|
|
{
|
2007-12-21 13:09:09 +00:00
|
|
|
setptr(ui_prefs.custom_date_format, g_strdup(input));
|
2006-08-19 12:56:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_insert_date_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-08-18 14:26:36 +00:00
|
|
|
gchar *format = NULL;
|
2008-11-21 17:40:04 +00:00
|
|
|
gchar *time_str;
|
2006-08-19 12:56:30 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2006-08-19 12:56:30 +00:00
|
|
|
|
2009-08-18 14:26:36 +00:00
|
|
|
/* set default value */
|
|
|
|
if (utils_str_equal("", ui_prefs.custom_date_format))
|
|
|
|
{
|
|
|
|
g_free(ui_prefs.custom_date_format);
|
|
|
|
ui_prefs.custom_date_format = g_strdup("%d.%m.%Y");
|
|
|
|
}
|
|
|
|
|
2006-12-07 16:09:45 +00:00
|
|
|
if (utils_str_equal(_("dd.mm.yyyy"), (gchar*) user_data))
|
2006-08-19 12:56:30 +00:00
|
|
|
format = "%d.%m.%Y";
|
2006-12-07 16:09:45 +00:00
|
|
|
else if (utils_str_equal(_("mm.dd.yyyy"), (gchar*) user_data))
|
2006-08-19 12:56:30 +00:00
|
|
|
format = "%m.%d.%Y";
|
2006-12-07 16:09:45 +00:00
|
|
|
else if (utils_str_equal(_("yyyy/mm/dd"), (gchar*) user_data))
|
2006-08-19 12:56:30 +00:00
|
|
|
format = "%Y/%m/%d";
|
2006-12-07 16:09:45 +00:00
|
|
|
else if (utils_str_equal(_("dd.mm.yyyy hh:mm:ss"), (gchar*) user_data))
|
2006-08-19 12:56:30 +00:00
|
|
|
format = "%d.%m.%Y %H:%M:%S";
|
2006-12-07 16:09:45 +00:00
|
|
|
else if (utils_str_equal(_("mm.dd.yyyy hh:mm:ss"), (gchar*) user_data))
|
2006-08-19 12:56:30 +00:00
|
|
|
format = "%m.%d.%Y %H:%M:%S";
|
2006-12-07 16:09:45 +00:00
|
|
|
else if (utils_str_equal(_("yyyy/mm/dd hh:mm:ss"), (gchar*) user_data))
|
2006-08-19 12:56:30 +00:00
|
|
|
format = "%Y/%m/%d %H:%M:%S";
|
2007-10-13 09:35:34 +00:00
|
|
|
else if (utils_str_equal(_("_Use Custom Date Format"), (gchar*) user_data))
|
2007-08-23 11:34:06 +00:00
|
|
|
format = ui_prefs.custom_date_format;
|
2006-08-19 12:56:30 +00:00
|
|
|
else
|
|
|
|
{
|
2006-12-12 12:12:20 +00:00
|
|
|
dialogs_show_input(_("Custom Date Format"),
|
2007-09-09 16:13:30 +00:00
|
|
|
_("Enter here a custom date and time format. You can use any conversion specifiers which can be used with the ANSI C strftime function."),
|
2007-12-21 13:09:09 +00:00
|
|
|
ui_prefs.custom_date_format, FALSE, &on_custom_date_input_response);
|
2006-08-19 12:56:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-11-21 17:40:04 +00:00
|
|
|
time_str = utils_get_date_time(format, NULL);
|
2009-04-15 22:47:33 +00:00
|
|
|
if (time_str != NULL)
|
2006-08-19 12:56:30 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
verify_click_pos(doc); /* make sure that the click_pos is valid */
|
2006-12-17 19:31:32 +00:00
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_insert_text(doc->editor->sci, editor_info.click_pos, time_str);
|
|
|
|
sci_goto_pos(doc->editor->sci, editor_info.click_pos + strlen(time_str), FALSE);
|
2008-11-21 17:40:04 +00:00
|
|
|
g_free(time_str);
|
2006-08-19 12:56:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
utils_beep();
|
2007-10-24 10:52:48 +00:00
|
|
|
ui_set_statusbar(TRUE,
|
2006-08-19 12:56:30 +00:00
|
|
|
_("Date format string could not be converted (possibly too long)."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-22 12:26:26 +00:00
|
|
|
void
|
|
|
|
on_insert_include_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2006-12-17 19:31:32 +00:00
|
|
|
gint pos = -1;
|
2005-11-22 12:26:26 +00:00
|
|
|
gchar *text;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
g_return_if_fail(user_data != NULL);
|
2006-12-17 19:31:32 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
verify_click_pos(doc); /* make sure that the click_pos is valid */
|
2006-12-17 19:31:32 +00:00
|
|
|
|
2006-12-07 16:09:45 +00:00
|
|
|
if (utils_str_equal(user_data, "blank"))
|
2005-11-22 12:26:26 +00:00
|
|
|
{
|
|
|
|
text = g_strdup("#include \"\"\n");
|
2006-09-04 15:57:46 +00:00
|
|
|
pos = editor_info.click_pos + 10;
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
text = g_strconcat("#include <", user_data, ">\n", NULL);
|
|
|
|
}
|
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
|
2005-11-22 12:26:26 +00:00
|
|
|
g_free(text);
|
2009-04-15 22:47:33 +00:00
|
|
|
if (pos >= 0)
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_goto_pos(doc->editor->sci, pos, FALSE);
|
2005-11-22 12:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-14 22:07:55 +00:00
|
|
|
void
|
|
|
|
on_file_properties_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
dialogs_show_file_properties(doc);
|
2006-02-14 22:07:55 +00:00
|
|
|
}
|
|
|
|
|
2006-02-20 22:55:53 +00:00
|
|
|
|
2006-02-26 18:29:24 +00:00
|
|
|
void
|
|
|
|
on_menu_fold_all1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
editor_fold_all(doc->editor);
|
2006-02-26 18:29:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_unfold_all1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
editor_unfold_all(doc->editor);
|
2006-02-26 18:29:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-04-27 18:06:35 +00:00
|
|
|
void
|
2008-12-06 11:10:06 +00:00
|
|
|
on_toolbutton_run_clicked (GtkAction *action,
|
2006-04-27 18:06:35 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-03-12 13:37:39 +00:00
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_BUILD, GEANY_KEYS_BUILD_RUN);
|
2006-04-27 18:06:35 +00:00
|
|
|
}
|
|
|
|
|
2006-05-23 19:31:09 +00:00
|
|
|
|
2006-06-13 20:03:44 +00:00
|
|
|
void
|
|
|
|
on_menu_remove_indicators1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2007-02-17 18:06:08 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
editor_indicator_clear(doc->editor, GEANY_INDICATOR_ERROR);
|
2006-06-13 20:03:44 +00:00
|
|
|
}
|
|
|
|
|
2006-06-19 18:31:17 +00:00
|
|
|
|
2006-06-29 17:14:52 +00:00
|
|
|
void
|
|
|
|
on_print1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
printing_print_doc(doc);
|
2006-06-29 17:14:52 +00:00
|
|
|
}
|
2006-06-30 13:42:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_select_all1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2006-06-30 13:42:53 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
sci_select_all(doc->editor->sci);
|
2006-06-30 13:42:53 +00:00
|
|
|
}
|
|
|
|
|
2006-07-11 14:15:56 +00:00
|
|
|
|
2006-07-21 11:41:33 +00:00
|
|
|
void
|
|
|
|
on_menu_show_sidebar1_toggled (GtkCheckMenuItem *checkmenuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2009-04-27 19:30:29 +00:00
|
|
|
if (ignore_callback)
|
|
|
|
return;
|
2006-07-21 11:41:33 +00:00
|
|
|
|
2007-08-23 11:34:06 +00:00
|
|
|
ui_prefs.sidebar_visible = ! ui_prefs.sidebar_visible;
|
2007-05-06 14:49:51 +00:00
|
|
|
|
2008-05-16 12:08:39 +00:00
|
|
|
if ((! interface_prefs.sidebar_openfiles_visible && ! interface_prefs.sidebar_symbol_visible))
|
2006-07-22 11:09:48 +00:00
|
|
|
{
|
2008-05-16 12:08:39 +00:00
|
|
|
interface_prefs.sidebar_openfiles_visible = TRUE;
|
|
|
|
interface_prefs.sidebar_symbol_visible = TRUE;
|
2006-07-22 11:09:48 +00:00
|
|
|
}
|
2007-05-06 14:49:51 +00:00
|
|
|
|
2008-01-23 14:12:08 +00:00
|
|
|
ui_sidebar_show_hide();
|
2006-07-21 11:41:33 +00:00
|
|
|
}
|
2006-07-24 20:23:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_write_unicode_bom1_toggled (GtkCheckMenuItem *checkmenuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-05-22 14:41:28 +00:00
|
|
|
if (! ignore_callback)
|
2006-07-24 20:23:56 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2006-07-24 20:23:56 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
if (doc->readonly)
|
2006-10-23 20:56:11 +00:00
|
|
|
{
|
|
|
|
utils_beep();
|
|
|
|
return;
|
|
|
|
}
|
2006-07-24 20:23:56 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
document_undo_add(doc, UNDO_BOM, GINT_TO_POINTER(doc->has_bom));
|
2006-10-10 16:02:41 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
doc->has_bom = ! doc->has_bom;
|
2006-07-24 20:23:56 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
ui_update_statusbar(doc, -1);
|
2006-07-24 20:23:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-01 10:35:32 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_comment_line1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
editor_do_comment(doc->editor, -1, FALSE, FALSE);
|
2006-08-01 10:35:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_uncomment_line1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
editor_do_uncomment(doc->editor, -1, FALSE);
|
2006-08-01 10:35:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-12 08:32:52 +00:00
|
|
|
void
|
|
|
|
on_menu_toggle_line_commentation1_activate
|
|
|
|
(GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
editor_do_comment_toggle(doc->editor);
|
2006-09-12 08:32:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-08-01 10:35:32 +00:00
|
|
|
void
|
|
|
|
on_menu_increase_indent1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2006-08-01 10:35:32 +00:00
|
|
|
|
2009-05-18 15:17:48 +00:00
|
|
|
editor_indent(doc->editor, TRUE);
|
2006-08-01 10:35:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_decrease_indent1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2006-08-01 10:35:32 +00:00
|
|
|
|
2009-05-18 15:17:48 +00:00
|
|
|
editor_indent(doc->editor, FALSE);
|
2006-08-01 10:35:32 +00:00
|
|
|
}
|
|
|
|
|
2006-12-08 15:50:10 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_next_message1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
if (! ui_tree_view_find_next(GTK_TREE_VIEW(msgwindow.tree_msg),
|
|
|
|
msgwin_goto_messages_file_line))
|
2007-10-24 10:52:48 +00:00
|
|
|
ui_set_statusbar(FALSE, _("No more message items."));
|
2006-12-08 15:50:10 +00:00
|
|
|
}
|
2006-12-13 00:46:14 +00:00
|
|
|
|
|
|
|
|
2008-06-25 17:38:31 +00:00
|
|
|
void
|
|
|
|
on_previous_message1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
if (! ui_tree_view_find_previous(GTK_TREE_VIEW(msgwindow.tree_msg),
|
|
|
|
msgwin_goto_messages_file_line))
|
|
|
|
ui_set_statusbar(FALSE, _("No more message items."));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-17 19:31:32 +00:00
|
|
|
void
|
|
|
|
on_menu_comments_multiline_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
insert_callback_from_menu = TRUE;
|
|
|
|
on_comments_multiline_activate(menuitem, user_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_comments_gpl_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
insert_callback_from_menu = TRUE;
|
|
|
|
on_comments_gpl_activate(menuitem, user_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-06 15:03:53 +00:00
|
|
|
void
|
|
|
|
on_menu_comments_bsd_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
insert_callback_from_menu = TRUE;
|
|
|
|
on_comments_bsd_activate(menuitem, user_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-17 19:31:32 +00:00
|
|
|
void
|
|
|
|
on_menu_insert_include_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
insert_callback_from_menu = TRUE;
|
|
|
|
on_insert_include_activate(menuitem, user_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_insert_date_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
insert_callback_from_menu = TRUE;
|
|
|
|
on_insert_date_activate(menuitem, user_data);
|
|
|
|
}
|
2007-01-06 15:03:53 +00:00
|
|
|
|
|
|
|
|
2007-01-15 18:12:32 +00:00
|
|
|
void
|
|
|
|
on_project_new1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
project_new();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_project_open1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
project_open();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_project_close1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-11-18 18:24:23 +00:00
|
|
|
project_close(TRUE);
|
2007-01-15 18:12:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_project_properties1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
project_properties();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_project1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2007-01-18 22:20:30 +00:00
|
|
|
static GtkWidget *item_close = NULL;
|
|
|
|
static GtkWidget *item_properties = NULL;
|
2007-01-15 18:12:32 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (item_close == NULL)
|
2007-01-15 18:12:32 +00:00
|
|
|
{
|
2008-12-18 21:21:53 +00:00
|
|
|
item_close = ui_lookup_widget(main_widgets.window, "project_close1");
|
|
|
|
item_properties = ui_lookup_widget(main_widgets.window, "project_properties1");
|
2007-01-15 18:12:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(item_close, (app->project != NULL));
|
|
|
|
gtk_widget_set_sensitive(item_properties, (app->project != NULL));
|
2009-07-20 23:09:03 +00:00
|
|
|
gtk_widget_set_sensitive(ui_widgets.recent_projects_menuitem,
|
|
|
|
g_queue_get_length(ui_prefs.recent_projects_queue) > 0);
|
2007-01-15 18:12:32 +00:00
|
|
|
}
|
|
|
|
|
2007-01-24 19:20:12 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_open_selected_file1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2008-01-14 17:30:59 +00:00
|
|
|
gchar *sel = NULL;
|
2009-06-08 19:16:23 +00:00
|
|
|
const gchar *wc;
|
|
|
|
|
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
wc = GEANY_WORDCHARS "./-" "\\";
|
|
|
|
#else
|
|
|
|
wc = GEANY_WORDCHARS "./-";
|
|
|
|
#endif
|
2007-01-24 19:20:12 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2007-01-24 19:20:12 +00:00
|
|
|
|
2009-06-08 19:16:23 +00:00
|
|
|
sel = editor_get_default_selection(doc->editor, TRUE, wc);
|
2007-01-24 19:20:12 +00:00
|
|
|
|
2008-01-14 17:30:59 +00:00
|
|
|
if (sel != NULL)
|
2007-01-24 19:20:12 +00:00
|
|
|
{
|
2009-08-18 13:47:29 +00:00
|
|
|
gchar *locale_filename, *filename = NULL;
|
2007-01-24 19:20:12 +00:00
|
|
|
|
2008-01-14 17:30:59 +00:00
|
|
|
if (g_path_is_absolute(sel))
|
|
|
|
filename = g_strdup(sel);
|
|
|
|
else
|
2008-02-27 13:17:29 +00:00
|
|
|
{ /* relative filename, add the path of the current file */
|
2007-01-24 19:20:12 +00:00
|
|
|
gchar *path;
|
|
|
|
|
2009-08-18 13:47:29 +00:00
|
|
|
path = utils_get_current_file_dir_utf8();
|
|
|
|
if (!path)
|
|
|
|
path = g_get_current_dir();
|
|
|
|
|
2008-01-14 17:30:59 +00:00
|
|
|
filename = g_build_path(G_DIR_SEPARATOR_S, path, sel, NULL);
|
2007-01-24 19:20:12 +00:00
|
|
|
|
2008-01-14 17:30:59 +00:00
|
|
|
if (! g_file_test(filename, G_FILE_TEST_EXISTS) &&
|
|
|
|
app->project != NULL && NZV(app->project->base_path))
|
|
|
|
{
|
2008-02-27 13:17:29 +00:00
|
|
|
/* try the project's base path */
|
2008-01-14 17:30:59 +00:00
|
|
|
setptr(path, project_get_base_path());
|
|
|
|
setptr(filename, g_build_path(G_DIR_SEPARATOR_S, path, sel, NULL));
|
|
|
|
}
|
2007-01-24 19:20:12 +00:00
|
|
|
g_free(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
locale_filename = utils_get_locale_from_utf8(filename);
|
2007-09-11 15:21:11 +00:00
|
|
|
document_open_file(locale_filename, FALSE, NULL, NULL);
|
2007-01-24 19:20:12 +00:00
|
|
|
|
|
|
|
g_free(filename);
|
|
|
|
g_free(locale_filename);
|
2008-01-14 17:30:59 +00:00
|
|
|
g_free(sel);
|
2007-01-24 19:20:12 +00:00
|
|
|
}
|
|
|
|
}
|
2007-02-17 18:06:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_remove_markers1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2007-02-17 18:06:08 +00:00
|
|
|
|
2008-07-14 11:13:54 +00:00
|
|
|
sci_marker_delete_all(doc->editor->sci, 0); /* delete the yellow tag marker */
|
|
|
|
sci_marker_delete_all(doc->editor->sci, 1); /* delete user markers */
|
2008-11-16 17:54:28 +00:00
|
|
|
editor_indicator_clear(doc->editor, GEANY_INDICATOR_SEARCH);
|
2007-02-17 18:06:08 +00:00
|
|
|
}
|
|
|
|
|
2007-04-15 18:09:59 +00:00
|
|
|
|
2007-04-18 15:21:33 +00:00
|
|
|
void
|
|
|
|
on_load_tags1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
symbols_show_load_tags_dialog();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-15 18:09:59 +00:00
|
|
|
void
|
|
|
|
on_context_action1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
gchar *word, *command;
|
|
|
|
GError *error = NULL;
|
2008-06-15 13:35:48 +00:00
|
|
|
GeanyDocument *doc = document_get_current();
|
2007-04-15 18:09:59 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2007-04-15 18:09:59 +00:00
|
|
|
|
2008-09-17 18:02:55 +00:00
|
|
|
if (sci_has_selection(doc->editor->sci))
|
2008-02-27 13:17:29 +00:00
|
|
|
{ /* take selected text if there is a selection */
|
2008-07-14 11:13:54 +00:00
|
|
|
word = g_malloc(sci_get_selected_text_length(doc->editor->sci) + 1);
|
|
|
|
sci_get_selected_text(doc->editor->sci, word);
|
2007-04-15 18:09:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
word = g_strdup(editor_info.current_word);
|
|
|
|
}
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* use the filetype specific command if available, fallback to global command otherwise */
|
2008-06-15 13:35:48 +00:00
|
|
|
if (doc->file_type != NULL &&
|
2008-06-18 13:36:33 +00:00
|
|
|
NZV(doc->file_type->context_action_cmd))
|
2007-04-15 18:09:59 +00:00
|
|
|
{
|
2008-06-15 13:35:48 +00:00
|
|
|
command = g_strdup(doc->file_type->context_action_cmd);
|
2007-04-15 18:09:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-05-16 12:08:39 +00:00
|
|
|
command = g_strdup(tool_prefs.context_action_cmd);
|
2007-04-15 18:09:59 +00:00
|
|
|
}
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* substitute the wildcard %s and run the command if it is non empty */
|
2009-04-05 21:07:40 +00:00
|
|
|
if (NZV(command))
|
2007-04-15 18:09:59 +00:00
|
|
|
{
|
2009-07-23 16:01:45 +00:00
|
|
|
utils_str_replace_all(&command, "%s", word);
|
2007-04-15 18:09:59 +00:00
|
|
|
|
|
|
|
if (! g_spawn_command_line_async(command, &error))
|
|
|
|
{
|
2007-10-24 10:52:48 +00:00
|
|
|
ui_set_statusbar(TRUE, "Context action command failed: %s", error->message);
|
2007-04-15 18:09:59 +00:00
|
|
|
g_error_free(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_free(word);
|
|
|
|
g_free(command);
|
|
|
|
}
|
|
|
|
|
2007-05-06 14:49:51 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_toggle_all_additional_widgets1_activate
|
|
|
|
(GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
static gint hide_all = -1;
|
2008-02-27 13:17:29 +00:00
|
|
|
GtkCheckMenuItem *msgw = GTK_CHECK_MENU_ITEM(
|
2008-12-18 21:21:53 +00:00
|
|
|
ui_lookup_widget(main_widgets.window, "menu_show_messages_window1"));
|
2008-02-27 13:17:29 +00:00
|
|
|
GtkCheckMenuItem *toolbari = GTK_CHECK_MENU_ITEM(
|
2008-12-18 21:21:53 +00:00
|
|
|
ui_lookup_widget(main_widgets.window, "menu_show_toolbar1"));
|
2007-05-06 14:49:51 +00:00
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* get the initial state (necessary if Geany was closed with hide_all = TRUE) */
|
2009-04-05 21:07:40 +00:00
|
|
|
if (G_UNLIKELY(hide_all == -1))
|
2007-05-06 14:49:51 +00:00
|
|
|
{
|
|
|
|
if (! gtk_check_menu_item_get_active(msgw) &&
|
2008-05-16 12:08:39 +00:00
|
|
|
! interface_prefs.show_notebook_tabs &&
|
2007-05-06 14:49:51 +00:00
|
|
|
! gtk_check_menu_item_get_active(toolbari))
|
|
|
|
{
|
|
|
|
hide_all = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hide_all = FALSE;
|
|
|
|
}
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
hide_all = ! hide_all; /* toggle */
|
2007-05-06 14:49:51 +00:00
|
|
|
|
|
|
|
if (hide_all)
|
|
|
|
{
|
|
|
|
if (gtk_check_menu_item_get_active(msgw))
|
|
|
|
gtk_check_menu_item_set_active(msgw, ! gtk_check_menu_item_get_active(msgw));
|
|
|
|
|
2008-05-16 12:08:39 +00:00
|
|
|
interface_prefs.show_notebook_tabs = FALSE;
|
2008-05-22 14:41:28 +00:00
|
|
|
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);
|
2007-05-06 14:49:51 +00:00
|
|
|
|
|
|
|
ui_statusbar_showhide(FALSE);
|
|
|
|
|
|
|
|
if (gtk_check_menu_item_get_active(toolbari))
|
|
|
|
gtk_check_menu_item_set_active(toolbari, ! gtk_check_menu_item_get_active(toolbari));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
if (! gtk_check_menu_item_get_active(msgw))
|
|
|
|
gtk_check_menu_item_set_active(msgw, ! gtk_check_menu_item_get_active(msgw));
|
|
|
|
|
2008-05-16 12:08:39 +00:00
|
|
|
interface_prefs.show_notebook_tabs = TRUE;
|
2008-05-22 14:41:28 +00:00
|
|
|
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);
|
2007-05-06 14:49:51 +00:00
|
|
|
|
|
|
|
ui_statusbar_showhide(TRUE);
|
|
|
|
|
|
|
|
if (! gtk_check_menu_item_get_active(toolbari))
|
|
|
|
gtk_check_menu_item_set_active(toolbari, ! gtk_check_menu_item_get_active(toolbari));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-25 14:42:43 +00:00
|
|
|
|
2007-06-02 16:14:07 +00:00
|
|
|
void
|
|
|
|
on_forward_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
navqueue_go_forward();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_back_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
navqueue_go_back();
|
|
|
|
}
|
|
|
|
|
2007-06-11 08:58:37 +00:00
|
|
|
|
|
|
|
gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
|
|
|
|
{
|
2007-08-23 11:34:06 +00:00
|
|
|
if (prefs.auto_focus && ! GTK_WIDGET_HAS_FOCUS(widget))
|
2007-06-11 08:58:37 +00:00
|
|
|
gtk_widget_grab_focus(widget);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2007-10-17 12:27:07 +00:00
|
|
|
|
2009-04-17 15:30:01 +00:00
|
|
|
static void set_indent_type(GtkCheckMenuItem *menuitem, GeanyIndentType type)
|
2007-10-17 12:27:07 +00:00
|
|
|
{
|
2009-04-15 22:47:33 +00:00
|
|
|
GeanyDocument *doc;
|
2007-10-17 12:27:07 +00:00
|
|
|
|
2009-04-17 15:30:01 +00:00
|
|
|
if (ignore_callback || ! gtk_check_menu_item_get_active(menuitem))
|
2008-06-16 18:31:59 +00:00
|
|
|
return;
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
doc = document_get_current();
|
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
2008-08-04 14:07:49 +00:00
|
|
|
editor_set_indent_type(doc->editor, type);
|
2008-06-15 13:35:48 +00:00
|
|
|
ui_update_statusbar(doc, -1);
|
2007-10-17 12:27:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-08-04 14:07:49 +00:00
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_tabs1_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2008-08-04 14:07:49 +00:00
|
|
|
{
|
2009-04-17 15:30:01 +00:00
|
|
|
set_indent_type(menuitem, GEANY_INDENT_TYPE_TABS);
|
2008-08-04 14:07:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-17 12:27:07 +00:00
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_spaces1_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2007-10-17 12:27:07 +00:00
|
|
|
{
|
2009-04-17 15:30:01 +00:00
|
|
|
set_indent_type(menuitem, GEANY_INDENT_TYPE_SPACES);
|
2008-08-04 14:07:49 +00:00
|
|
|
}
|
2007-10-17 12:27:07 +00:00
|
|
|
|
2008-06-16 18:31:59 +00:00
|
|
|
|
2008-08-04 14:07:49 +00:00
|
|
|
void
|
2009-04-17 15:30:01 +00:00
|
|
|
on_tabs_and_spaces1_activate (GtkCheckMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
2008-08-04 14:07:49 +00:00
|
|
|
{
|
2009-04-17 15:30:01 +00:00
|
|
|
set_indent_type(menuitem, GEANY_INDENT_TYPE_BOTH);
|
2007-10-17 12:27:07 +00:00
|
|
|
}
|
|
|
|
|
2007-11-06 13:24:39 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_strip_trailing_spaces1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-09-25 18:28:37 +00:00
|
|
|
GeanyDocument *doc;
|
2007-11-06 13:24:39 +00:00
|
|
|
|
2008-09-25 18:28:37 +00:00
|
|
|
if (ignore_callback)
|
2008-06-16 18:31:59 +00:00
|
|
|
return;
|
|
|
|
|
2008-09-25 18:28:37 +00:00
|
|
|
doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2008-09-25 18:28:37 +00:00
|
|
|
|
|
|
|
editor_strip_trailing_spaces(doc->editor);
|
2007-11-06 13:24:39 +00:00
|
|
|
}
|
|
|
|
|
2007-11-17 14:04:27 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_page_setup1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
#if GTK_CHECK_VERSION(2, 10, 0)
|
|
|
|
printing_page_setup_gtk();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-11-20 18:15:46 +00:00
|
|
|
|
2008-04-16 11:34:34 +00:00
|
|
|
gboolean
|
|
|
|
on_escape_key_press_event (GtkWidget *widget,
|
|
|
|
GdkEventKey *event,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2009-04-21 20:51:53 +00:00
|
|
|
guint state = event->state & gtk_accelerator_get_default_mod_mask();
|
2008-12-07 19:11:13 +00:00
|
|
|
|
2008-04-16 11:34:34 +00:00
|
|
|
/* make pressing escape in the sidebar and toolbar focus the editor */
|
2008-12-07 19:11:13 +00:00
|
|
|
if (event->keyval == GDK_Escape && state == 0)
|
2008-04-16 11:34:34 +00:00
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_FOCUS, GEANY_KEYS_FOCUS_EDITOR);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-05-09 12:13:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_line_breaking1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-05-16 14:17:54 +00:00
|
|
|
GeanyDocument *doc;
|
2008-05-09 12:13:29 +00:00
|
|
|
|
2008-05-22 14:41:28 +00:00
|
|
|
if (ignore_callback)
|
2008-05-09 12:13:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
doc = document_get_current();
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
2008-05-09 12:13:29 +00:00
|
|
|
|
2008-07-08 16:30:37 +00:00
|
|
|
doc->editor->line_breaking = !doc->editor->line_breaking;
|
2008-05-09 12:13:29 +00:00
|
|
|
}
|
2008-06-19 14:34:53 +00:00
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2008-06-19 14:34:53 +00:00
|
|
|
void
|
|
|
|
on_replace_spaces_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GeanyDocument *doc = document_get_current();
|
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
g_return_if_fail(doc != NULL);
|
|
|
|
|
|
|
|
editor_replace_spaces(doc->editor);
|
2008-06-19 14:34:53 +00:00
|
|
|
}
|
|
|
|
|
2008-06-25 17:38:31 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_search1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-12-18 21:21:53 +00:00
|
|
|
GtkWidget *next_message = ui_lookup_widget(main_widgets.window, "next_message1");
|
|
|
|
GtkWidget *previous_message = ui_lookup_widget(main_widgets.window, "previous_message1");
|
2008-06-25 17:38:31 +00:00
|
|
|
gboolean have_messages;
|
|
|
|
|
|
|
|
/* enable commands if the messages window has any items */
|
|
|
|
have_messages = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(msgwindow.store_msg),
|
|
|
|
NULL) > 0;
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(next_message, have_messages);
|
|
|
|
gtk_widget_set_sensitive(previous_message, have_messages);
|
|
|
|
}
|
|
|
|
|
2008-06-27 17:30:14 +00:00
|
|
|
|
|
|
|
/* simple implementation (vs. close all which doesn't close documents if cancelled) */
|
|
|
|
void
|
|
|
|
on_close_other_documents1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
guint i;
|
2009-04-05 21:07:40 +00:00
|
|
|
GeanyDocument *doc, *cur_doc = document_get_current();
|
2008-06-27 17:30:14 +00:00
|
|
|
|
|
|
|
for (i = 0; i < documents_array->len; i++)
|
|
|
|
{
|
2009-04-05 21:07:40 +00:00
|
|
|
doc = documents[i];
|
2008-06-27 17:30:14 +00:00
|
|
|
|
2009-04-15 22:47:33 +00:00
|
|
|
if (doc == cur_doc || ! doc->is_valid)
|
2008-06-27 17:30:14 +00:00
|
|
|
continue;
|
|
|
|
|
2008-07-01 14:20:16 +00:00
|
|
|
if (! document_close(doc))
|
2008-06-27 17:30:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-30 16:29:12 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_menu_reload_configuration1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2008-07-23 11:46:02 +00:00
|
|
|
main_reload_configuration();
|
2008-06-30 16:29:12 +00:00
|
|
|
}
|
|
|
|
|
2008-08-07 11:49:06 +00:00
|
|
|
|
2008-08-11 18:16:35 +00:00
|
|
|
void
|
|
|
|
on_debug_messages1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
log_show_debug_messages_dialog();
|
|
|
|
}
|
|
|
|
|
2009-02-25 23:28:01 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_send_selection_to_vte1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_VTE
|
|
|
|
if (vte_info.load_vte)
|
|
|
|
vte_send_selection_to_vte();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-09-16 14:13:38 +00:00
|
|
|
|
2009-04-30 17:17:13 +00:00
|
|
|
gboolean on_window_state_event (GtkWidget *widget,
|
|
|
|
GdkEventWindowState *event,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
|
|
|
|
{
|
|
|
|
static GtkWidget *menuitem = NULL;
|
|
|
|
|
|
|
|
if (menuitem == NULL)
|
|
|
|
menuitem = ui_lookup_widget(widget, "menu_fullscreen1");
|
|
|
|
|
|
|
|
ignore_callback = TRUE;
|
|
|
|
|
|
|
|
ui_prefs.fullscreen = (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) ? TRUE : FALSE;
|
|
|
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), ui_prefs.fullscreen);
|
|
|
|
|
|
|
|
ignore_callback = FALSE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-06-25 17:29:37 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_customize_toolbar1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
toolbar_configure();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_button_customize_toolbar_clicked (GtkButton *button,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
toolbar_configure();
|
|
|
|
}
|
|
|
|
|
2009-10-27 13:40:34 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_cut_current_line_s_1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_CLIPBOARD, GEANY_KEYS_CLIPBOARD_CUTLINE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_copy_current_line_s_1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_CLIPBOARD, GEANY_KEYS_CLIPBOARD_COPYLINE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_delete_current_line_s_1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_DELETELINE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_duplicate_line_or_selection1_activate
|
|
|
|
(GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_DUPLICATELINE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_select_current_line_s_1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_SELECT, GEANY_KEYS_SELECT_LINE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_select_current_paragraph1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_SELECT, GEANY_KEYS_SELECT_PARAGRAPH);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_insert_alternative_white_space1_activate
|
|
|
|
(GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_INSERT, GEANY_KEYS_INSERT_ALTWHITESPACE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_go_to_next_marker1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_GOTO, GEANY_KEYS_GOTO_NEXTMARKER);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_go_to_previous_marker1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_GOTO, GEANY_KEYS_GOTO_PREVIOUSMARKER);
|
|
|
|
}
|
|
|
|
|
2009-10-28 11:33:11 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_reflow_lines_block1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_FORMAT, GEANY_KEYS_FORMAT_REFLOWPARAGRAPH);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_transpose_current_line1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_TRANSPOSELINE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
on_smart_line_indent1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
keybindings_send_command(GEANY_KEY_GROUP_FORMAT, GEANY_KEYS_FORMAT_AUTOINDENT);
|
|
|
|
}
|
|
|
|
|
2009-10-28 18:06:16 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
on_plugin_preferences1_activate (GtkMenuItem *menuitem,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_PLUGINS
|
|
|
|
plugin_show_configure(NULL);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|