1
/* The GIMP -- an image manipulation program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
#include "libgimpwidgets/gimpwidgets.h"
25
#include "actions-types.h"
27
#include "widgets/gimpactiongroup.h"
28
#include "widgets/gimptexteditor.h"
29
#include "widgets/gimphelp-ids.h"
31
#include "text-editor-actions.h"
32
#include "text-editor-commands.h"
34
#include "gimp-intl.h"
37
static GimpActionEntry text_editor_actions[] =
39
{ "text-editor-toolbar", GIMP_STOCK_EDIT,
40
"Text Editor Toolbar", NULL, NULL, NULL,
41
GIMP_HELP_TEXT_EDITOR_DIALOG },
43
{ "text-editor-load", GTK_STOCK_OPEN,
45
N_("Load text from file"),
46
G_CALLBACK (text_editor_load_cmd_callback),
49
{ "text-editor-clear", GTK_STOCK_CLEAR,
52
G_CALLBACK (text_editor_clear_cmd_callback),
56
static GimpRadioActionEntry text_editor_direction_actions[] =
58
{ "text-editor-direction-ltr", GIMP_STOCK_TEXT_DIR_LTR,
60
N_("From left to right"),
61
GIMP_TEXT_DIRECTION_LTR,
64
{ "text-editor-direction-rtl", GIMP_STOCK_TEXT_DIR_RTL,
66
N_("From right to left"),
67
GIMP_TEXT_DIRECTION_RTL,
73
text_editor_actions_setup (GimpActionGroup *group)
75
gimp_action_group_add_actions (group,
77
G_N_ELEMENTS (text_editor_actions));
79
gimp_action_group_add_radio_actions (group,
80
text_editor_direction_actions,
81
G_N_ELEMENTS (text_editor_direction_actions),
82
GIMP_TEXT_DIRECTION_LTR,
83
G_CALLBACK (text_editor_direction_cmd_callback));
87
text_editor_actions_update (GimpActionGroup *group,
90
GimpTextEditor *editor = GIMP_TEXT_EDITOR (data);
92
#define SET_ACTIVE(action,condition) \
93
gimp_action_group_set_action_active (group, action, (condition) != 0)
95
switch (editor->base_dir)
97
case GIMP_TEXT_DIRECTION_LTR:
98
SET_ACTIVE ("text-editor-direction-ltr", TRUE);
101
case GIMP_TEXT_DIRECTION_RTL:
102
SET_ACTIVE ("text-editor-direction-rtl", TRUE);