23 #include <glib/gi18n.h>
64 g_object_unref (dialog->
annot);
68 G_OBJECT_CLASS (ev_annotation_properties_dialog_parent_class)->dispose (
object);
84 G_OBJECT_WARN_INVALID_PROPERTY_ID (
object, prop_id, pspec);
92 GtkWidget *grid = dialog->
grid;
97 label = gtk_label_new (
_(
"Icon:"));
98 gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
99 gtk_grid_attach (GTK_GRID (grid), label, 0, 4, 1, 1);
100 gtk_widget_show (label);
102 dialog->
icon = gtk_combo_box_text_new ();
103 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
icon),
_(
"Note"));
104 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
icon),
_(
"Comment"));
105 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
icon),
_(
"Key"));
106 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
icon),
_(
"Help"));
107 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
icon),
_(
"New Paragraph"));
108 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
icon),
_(
"Paragraph"));
109 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
icon),
_(
"Insert"));
110 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
icon),
_(
"Cross"));
111 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
icon),
_(
"Circle"));
112 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
icon),
_(
"Unknown"));
113 gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->
icon), 0);
114 gtk_grid_attach (GTK_GRID (grid), dialog->
icon, 1, 4, 1, 1);
115 gtk_widget_set_hexpand (dialog->
icon,
TRUE);
116 gtk_widget_show (dialog->
icon);
123 label = gtk_label_new (
_(
"Markup type:"));
124 gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
125 gtk_grid_attach (GTK_GRID (grid), label, 0, 5, 1, 1);
126 gtk_widget_show (label);
129 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
text_markup_type),
_(
"Highlight"));
130 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
text_markup_type),
_(
"Strike out"));
131 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
text_markup_type),
_(
"Underline"));
132 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->
text_markup_type),
_(
"Squiggly"));
146 GtkDialog *dialog = GTK_DIALOG (annot_dialog);
147 GtkWidget *content_area;
150 const GdkRGBA yellow = { 1., 1., 0., 1. };
152 gtk_window_set_title (GTK_WINDOW (annot_dialog),
_(
"Annotation Properties"));
153 gtk_window_set_destroy_with_parent (GTK_WINDOW (annot_dialog),
TRUE);
154 gtk_container_set_border_width (GTK_CONTAINER (annot_dialog), 5);
155 gtk_dialog_add_buttons (dialog,
156 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
157 GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
159 gtk_dialog_set_default_response (dialog, GTK_RESPONSE_APPLY);
161 content_area = gtk_dialog_get_content_area (dialog);
162 gtk_box_set_spacing (GTK_BOX (content_area), 12);
164 grid = gtk_grid_new ();
165 annot_dialog->
grid = grid;
166 gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
167 gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
168 gtk_box_pack_start (GTK_BOX (content_area), grid,
FALSE,
FALSE, 0);
169 gtk_widget_show (grid);
171 label = gtk_label_new (
_(
"Author:"));
172 gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
173 gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
174 gtk_widget_show (label);
176 annot_dialog->
author = gtk_entry_new ();
177 gtk_entry_set_text (GTK_ENTRY (annot_dialog->
author), g_get_real_name ());
178 gtk_grid_attach (GTK_GRID (grid), annot_dialog->
author, 1, 0, 1, 1);
179 gtk_widget_set_hexpand (annot_dialog->
author,
TRUE);
180 gtk_widget_show (annot_dialog->
author);
182 label = gtk_label_new (
_(
"Color:"));
183 gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
184 gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
185 gtk_widget_show (label);
187 annot_dialog->
color = gtk_color_button_new_with_rgba (&yellow);
188 gtk_grid_attach (GTK_GRID (grid), annot_dialog->
color, 1, 1, 1, 1);
189 gtk_widget_set_hexpand (annot_dialog->
color,
TRUE);
190 gtk_widget_show (annot_dialog->
color);
192 label = gtk_label_new (
_(
"Opacity:"));
193 gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
194 gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
195 gtk_widget_show (label);
197 annot_dialog->
opacity = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
199 gtk_range_set_value (GTK_RANGE (annot_dialog->
opacity), 100);
200 gtk_grid_attach (GTK_GRID (grid), annot_dialog->
opacity, 1, 2, 1, 1);
201 gtk_widget_set_hexpand (annot_dialog->
opacity,
TRUE);
202 gtk_widget_show (annot_dialog->
opacity);
204 label = gtk_label_new (
_(
"Initial window state:"));
205 gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
206 gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
207 gtk_widget_show (label);
209 annot_dialog->
popup_state = gtk_combo_box_text_new ();
210 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (annot_dialog->
popup_state),
_(
"Open"));
211 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (annot_dialog->
popup_state),
_(
"Close"));
212 gtk_combo_box_set_active (GTK_COMBO_BOX (annot_dialog->
popup_state), 1);
213 gtk_grid_attach (GTK_GRID (grid), annot_dialog->
popup_state, 1, 3, 1, 1);
221 GObjectClass *object_class = G_OBJECT_CLASS (klass);
227 g_object_class_install_property (object_class,
229 g_param_spec_enum (
"annot-type",
231 "The type of annotation",
232 EV_TYPE_ANNOTATION_TYPE,
234 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
235 G_PARAM_STATIC_STRINGS));
242 "annot-type", annot_type,
256 dialog->
annot = g_object_ref (annot);
260 gtk_entry_set_text (GTK_ENTRY (dialog->
author), label);
263 gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog->
color), &rgba);
266 gtk_range_set_value (GTK_RANGE (dialog->
opacity), opacity * 100);
269 gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->
popup_state),
275 gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->
icon),
284 return GTK_WIDGET (dialog);
290 return gtk_entry_get_text (GTK_ENTRY (dialog->
author));
297 gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog->
color), rgba);
303 return gtk_range_get_value (GTK_RANGE (dialog->
opacity)) / 100;
309 return gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->
popup_state)) == 0;
315 return gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->
icon));