2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2004-04-19 22:54:24 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2004-04-19 22:54:24 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-04-19 22:54:24 +08:00
|
|
|
* (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
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2004-04-19 22:54:24 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-11-02 05:28:18 +08:00
|
|
|
#include <gegl.h>
|
2004-04-19 22:54:24 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
#include "actions-types.h"
|
|
|
|
|
|
|
|
#include "widgets/gimpactiongroup.h"
|
|
|
|
#include "widgets/gimperrorconsole.h"
|
|
|
|
#include "widgets/gimphelp-ids.h"
|
|
|
|
|
|
|
|
#include "error-console-actions.h"
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "error-console-commands.h"
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
2006-04-10 16:06:18 +08:00
|
|
|
static const GimpActionEntry error_console_actions[] =
|
2004-04-19 22:54:24 +08:00
|
|
|
{
|
2017-03-05 23:01:59 +08:00
|
|
|
{ "error-console-popup", GIMP_ICON_DIALOG_WARNING,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("error-console-action", "Error Console Menu"), NULL, NULL, NULL,
|
2004-05-02 16:56:07 +08:00
|
|
|
GIMP_HELP_ERRORS_DIALOG },
|
2004-04-23 00:16:43 +08:00
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
{ "error-console-clear", GIMP_ICON_EDIT_CLEAR,
|
2014-05-12 04:49:22 +08:00
|
|
|
NC_("error-console-action", "_Clear"), NULL,
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("error-console-action", "Clear error console"),
|
2004-04-19 22:54:24 +08:00
|
|
|
G_CALLBACK (error_console_clear_cmd_callback),
|
2006-06-07 21:47:55 +08:00
|
|
|
GIMP_HELP_ERRORS_CLEAR },
|
|
|
|
|
|
|
|
{ "error-console-select-all", NULL,
|
2008-12-03 23:27:42 +08:00
|
|
|
NC_("error-console-action", "Select _All"), "",
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("error-console-action", "Select all error messages"),
|
2006-06-07 21:47:55 +08:00
|
|
|
G_CALLBACK (error_console_select_all_cmd_callback),
|
2017-10-28 20:57:57 +08:00
|
|
|
GIMP_HELP_ERRORS_SELECT_ALL },
|
|
|
|
|
|
|
|
{ "error-console-highlight", NULL,
|
|
|
|
NC_("error-console-action", "_Highlight"), NULL, NULL, NULL,
|
|
|
|
GIMP_HELP_ERRORS_HIGHLIGHT }
|
2004-10-25 06:26:11 +08:00
|
|
|
};
|
2004-04-19 22:54:24 +08:00
|
|
|
|
2006-04-10 16:06:18 +08:00
|
|
|
static const GimpEnumActionEntry error_console_save_actions[] =
|
2004-10-25 06:26:11 +08:00
|
|
|
{
|
2017-03-05 23:01:59 +08:00
|
|
|
{ "error-console-save-all", GIMP_ICON_DOCUMENT_SAVE_AS,
|
2014-05-12 04:49:22 +08:00
|
|
|
NC_("error-console-action", "_Save Error Log to File..."), NULL,
|
2008-12-30 19:23:30 +08:00
|
|
|
NC_("error-console-action", "Write all error messages to a file"),
|
2004-11-19 00:04:41 +08:00
|
|
|
FALSE, FALSE,
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_ERRORS_SAVE },
|
|
|
|
|
2017-03-05 23:01:59 +08:00
|
|
|
{ "error-console-save-selection", GIMP_ICON_DOCUMENT_SAVE_AS,
|
2014-05-12 04:49:22 +08:00
|
|
|
NC_("error-console-action", "Save S_election to File..."), NULL,
|
2008-12-04 18:32:20 +08:00
|
|
|
NC_("error-console-action", "Write the selected error messages to a file"),
|
2004-11-19 00:04:41 +08:00
|
|
|
TRUE, FALSE,
|
2004-04-19 22:54:24 +08:00
|
|
|
GIMP_HELP_ERRORS_SAVE }
|
|
|
|
};
|
|
|
|
|
2017-10-28 20:57:57 +08:00
|
|
|
static const GimpToggleActionEntry error_console_highlight_actions[] =
|
|
|
|
{
|
|
|
|
{ "error-console-highlight-error", NULL,
|
|
|
|
NC_("error-console-action", "_Errors"), NULL,
|
|
|
|
NC_("error-console-action", "Highlight error console on errors"),
|
|
|
|
G_CALLBACK (error_console_highlight_error_cmd_callback),
|
|
|
|
FALSE,
|
|
|
|
GIMP_HELP_ERRORS_HIGHLIGHT },
|
|
|
|
|
|
|
|
{ "error-console-highlight-warning", NULL,
|
|
|
|
NC_("error-console-action", "_Warnings"), NULL,
|
|
|
|
NC_("error-console-action", "Highlight error console on warnings"),
|
|
|
|
G_CALLBACK (error_console_highlight_warning_cmd_callback),
|
|
|
|
FALSE,
|
|
|
|
GIMP_HELP_ERRORS_HIGHLIGHT },
|
|
|
|
|
|
|
|
{ "error-console-highlight-info", NULL,
|
|
|
|
NC_("error-console-action", "_Messages"), NULL,
|
|
|
|
NC_("error-console-action", "Highlight error console on messages"),
|
|
|
|
G_CALLBACK (error_console_highlight_info_cmd_callback),
|
|
|
|
FALSE,
|
|
|
|
GIMP_HELP_ERRORS_HIGHLIGHT }
|
|
|
|
};
|
|
|
|
|
2004-04-19 22:54:24 +08:00
|
|
|
|
|
|
|
void
|
2004-04-27 21:55:26 +08:00
|
|
|
error_console_actions_setup (GimpActionGroup *group)
|
2004-04-19 22:54:24 +08:00
|
|
|
{
|
2008-12-03 23:27:42 +08:00
|
|
|
gimp_action_group_add_actions (group, "error-console-action",
|
2004-04-19 22:54:24 +08:00
|
|
|
error_console_actions,
|
2004-04-27 21:55:26 +08:00
|
|
|
G_N_ELEMENTS (error_console_actions));
|
2004-10-25 06:26:11 +08:00
|
|
|
|
2008-12-03 23:27:42 +08:00
|
|
|
gimp_action_group_add_enum_actions (group, "error-console-action",
|
2004-10-25 06:26:11 +08:00
|
|
|
error_console_save_actions,
|
|
|
|
G_N_ELEMENTS (error_console_save_actions),
|
|
|
|
G_CALLBACK (error_console_save_cmd_callback));
|
2017-10-28 20:57:57 +08:00
|
|
|
|
|
|
|
gimp_action_group_add_toggle_actions (group, "error-console-action",
|
|
|
|
error_console_highlight_actions,
|
|
|
|
G_N_ELEMENTS (error_console_highlight_actions));
|
2004-04-19 22:54:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
error_console_actions_update (GimpActionGroup *group,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2004-10-18 19:29:58 +08:00
|
|
|
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
|
2004-04-19 22:54:24 +08:00
|
|
|
gboolean selection;
|
|
|
|
|
|
|
|
selection = gtk_text_buffer_get_selection_bounds (console->text_buffer,
|
|
|
|
NULL, NULL);
|
|
|
|
|
2017-10-28 20:57:57 +08:00
|
|
|
#define SET_ACTIVE(action,condition) \
|
|
|
|
gimp_action_group_set_action_active (group, action, (condition) != 0)
|
2004-04-19 22:54:24 +08:00
|
|
|
#define SET_SENSITIVE(action,condition) \
|
|
|
|
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
|
|
|
|
|
|
|
SET_SENSITIVE ("error-console-clear", TRUE);
|
2006-06-07 21:47:55 +08:00
|
|
|
SET_SENSITIVE ("error-console-select-all", TRUE);
|
2004-04-19 22:54:24 +08:00
|
|
|
SET_SENSITIVE ("error-console-save-all", TRUE);
|
|
|
|
SET_SENSITIVE ("error-console-save-selection", selection);
|
2017-10-28 20:57:57 +08:00
|
|
|
SET_SENSITIVE ("error-console-highlight", TRUE);
|
|
|
|
|
|
|
|
SET_SENSITIVE ("error-console-highlight-error", TRUE);
|
|
|
|
SET_ACTIVE ("error-console-highlight-error",
|
2017-11-13 23:07:03 +08:00
|
|
|
console->highlight[GIMP_MESSAGE_ERROR]);
|
2017-10-28 20:57:57 +08:00
|
|
|
|
|
|
|
SET_SENSITIVE ("error-console-highlight-warning", TRUE);
|
|
|
|
SET_ACTIVE ("error-console-highlight-warning",
|
2017-11-13 23:07:03 +08:00
|
|
|
console->highlight[GIMP_MESSAGE_WARNING]);
|
2017-10-28 20:57:57 +08:00
|
|
|
|
|
|
|
SET_SENSITIVE ("error-console-highlight-info", TRUE);
|
|
|
|
SET_ACTIVE ("error-console-highlight-info",
|
2017-11-13 23:07:03 +08:00
|
|
|
console->highlight[GIMP_MESSAGE_INFO]);
|
2004-04-19 22:54:24 +08:00
|
|
|
|
2017-10-28 20:57:57 +08:00
|
|
|
#undef SET_ACTIVE
|
2004-04-19 22:54:24 +08:00
|
|
|
#undef SET_SENSITIVE
|
|
|
|
}
|