Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-annotation-properties-dialog.c File Reference
#include <config.h>
#include <glib/gi18n.h>
#include "ev-annotation-properties-dialog.h"
+ Include dependency graph for ev-annotation-properties-dialog.c:

Go to the source code of this file.

Data Structures

struct  _EvAnnotationPropertiesDialog
 
struct  _EvAnnotationPropertiesDialogClass
 

Enumerations

enum  { PROP_0, PROP_ANNOT_TYPE }
 

Functions

static void ev_annotation_properties_dialog_dispose (GObject *object)
 
static void ev_annotation_properties_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 
static void ev_annotation_properties_dialog_constructed (GObject *object)
 
static void ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog)
 
static void ev_annotation_properties_dialog_class_init (EvAnnotationPropertiesDialogClass *klass)
 
GtkWidget * ev_annotation_properties_dialog_new (EvAnnotationType annot_type)
 
GtkWidget * ev_annotation_properties_dialog_new_with_annotation (EvAnnotation *annot)
 
const gchar * ev_annotation_properties_dialog_get_author (EvAnnotationPropertiesDialog *dialog)
 
void ev_annotation_properties_dialog_get_rgba (EvAnnotationPropertiesDialog *dialog, GdkRGBA *rgba)
 
gdouble ev_annotation_properties_dialog_get_opacity (EvAnnotationPropertiesDialog *dialog)
 
gboolean ev_annotation_properties_dialog_get_popup_is_open (EvAnnotationPropertiesDialog *dialog)
 
EvAnnotationTextIcon ev_annotation_properties_dialog_get_text_icon (EvAnnotationPropertiesDialog *dialog)
 
EvAnnotationTextMarkupType ev_annotation_properties_dialog_get_text_markup_type (EvAnnotationPropertiesDialog *dialog)
 

Enumeration Type Documentation

anonymous enum
Enumerator
PROP_0 
PROP_ANNOT_TYPE 

Definition at line 27 of file ev-annotation-properties-dialog.c.

27  {
28  PROP_0,
30 };

Function Documentation

static void ev_annotation_properties_dialog_class_init ( EvAnnotationPropertiesDialogClass klass)
static

Definition at line 219 of file ev-annotation-properties-dialog.c.

220 {
221  GObjectClass *object_class = G_OBJECT_CLASS (klass);
222 
223  object_class->dispose = ev_annotation_properties_dialog_dispose;
224  object_class->constructed = ev_annotation_properties_dialog_constructed;
225  object_class->set_property = ev_annotation_properties_dialog_set_property;
226 
227  g_object_class_install_property (object_class,
229  g_param_spec_enum ("annot-type",
230  "AnnotType",
231  "The type of annotation",
232  EV_TYPE_ANNOTATION_TYPE,
234  G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
235  G_PARAM_STATIC_STRINGS));
236 }
static void ev_annotation_properties_dialog_constructed ( GObject *  object)
static

Definition at line 89 of file ev-annotation-properties-dialog.c.

90 {
92  GtkWidget *grid = dialog->grid;
93  GtkWidget *label;
94 
95  switch (dialog->annot_type) {
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);
101 
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);
117 
118  break;
120  /* TODO */
121  break;
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);
127 
128  dialog->text_markup_type = gtk_combo_box_text_new ();
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"));
133  gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->text_markup_type), 0);
134  gtk_grid_attach (GTK_GRID (grid), dialog->text_markup_type, 1, 5, 1, 1);
135  gtk_widget_set_hexpand (dialog->text_markup_type, TRUE);
136  gtk_widget_show (dialog->text_markup_type);
137  break;
138  default:
139  break;
140  }
141 }

+ Here is the caller graph for this function:

static void ev_annotation_properties_dialog_dispose ( GObject *  object)
static

Definition at line 59 of file ev-annotation-properties-dialog.c.

60 {
62 
63  if (dialog->annot) {
64  g_object_unref (dialog->annot);
65  dialog->annot = NULL;
66  }
67 
68  G_OBJECT_CLASS (ev_annotation_properties_dialog_parent_class)->dispose (object);
69 }

+ Here is the caller graph for this function:

const gchar* ev_annotation_properties_dialog_get_author ( EvAnnotationPropertiesDialog dialog)

Definition at line 288 of file ev-annotation-properties-dialog.c.

289 {
290  return gtk_entry_get_text (GTK_ENTRY (dialog->author));
291 }

+ Here is the caller graph for this function:

gdouble ev_annotation_properties_dialog_get_opacity ( EvAnnotationPropertiesDialog dialog)

Definition at line 301 of file ev-annotation-properties-dialog.c.

302 {
303  return gtk_range_get_value (GTK_RANGE (dialog->opacity)) / 100;
304 }

+ Here is the caller graph for this function:

gboolean ev_annotation_properties_dialog_get_popup_is_open ( EvAnnotationPropertiesDialog dialog)

Definition at line 307 of file ev-annotation-properties-dialog.c.

308 {
309  return gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->popup_state)) == 0;
310 }

+ Here is the caller graph for this function:

void ev_annotation_properties_dialog_get_rgba ( EvAnnotationPropertiesDialog dialog,
GdkRGBA *  rgba 
)

Definition at line 294 of file ev-annotation-properties-dialog.c.

296 {
297  gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog->color), rgba);
298 }

+ Here is the caller graph for this function:

EvAnnotationTextIcon ev_annotation_properties_dialog_get_text_icon ( EvAnnotationPropertiesDialog dialog)

Definition at line 313 of file ev-annotation-properties-dialog.c.

314 {
315  return gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->icon));
316 }

+ Here is the caller graph for this function:

EvAnnotationTextMarkupType ev_annotation_properties_dialog_get_text_markup_type ( EvAnnotationPropertiesDialog dialog)

Definition at line 319 of file ev-annotation-properties-dialog.c.

320 {
321  return gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->text_markup_type));
322 }

+ Here is the caller graph for this function:

static void ev_annotation_properties_dialog_init ( EvAnnotationPropertiesDialog annot_dialog)
static

Definition at line 144 of file ev-annotation-properties-dialog.c.

145 {
146  GtkDialog *dialog = GTK_DIALOG (annot_dialog);
147  GtkWidget *content_area;
148  GtkWidget *label;
149  GtkWidget *grid;
150  const GdkRGBA yellow = { 1., 1., 0., 1. };
151 
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,
158  NULL);
159  gtk_dialog_set_default_response (dialog, GTK_RESPONSE_APPLY);
160 
161  content_area = gtk_dialog_get_content_area (dialog);
162  gtk_box_set_spacing (GTK_BOX (content_area), 12);
163 
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);
170 
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);
175 
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);
181 
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);
186 
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);
191 
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);
196 
197  annot_dialog->opacity = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
198  0, 100, 5);
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);
203 
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);
208 
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);
214  gtk_widget_set_hexpand (annot_dialog->popup_state, TRUE);
215  gtk_widget_show (annot_dialog->popup_state);
216 }
GtkWidget* ev_annotation_properties_dialog_new ( EvAnnotationType  annot_type)

Definition at line 239 of file ev-annotation-properties-dialog.c.

240 {
241  return GTK_WIDGET (g_object_new (EV_TYPE_ANNOTATION_PROPERTIES_DIALOG,
242  "annot-type", annot_type,
243  NULL));
244 }

+ Here is the caller graph for this function:

GtkWidget* ev_annotation_properties_dialog_new_with_annotation ( EvAnnotation annot)

Definition at line 247 of file ev-annotation-properties-dialog.c.

248 {
250  const gchar *label;
251  gdouble opacity;
252  gboolean is_open;
253  GdkRGBA rgba;
254 
256  dialog->annot = g_object_ref (annot);
257 
259  if (label)
260  gtk_entry_set_text (GTK_ENTRY (dialog->author), label);
261 
262  ev_annotation_get_rgba (annot, &rgba);
263  gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog->color), &rgba);
264 
266  gtk_range_set_value (GTK_RANGE (dialog->opacity), opacity * 100);
267 
269  gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->popup_state),
270  is_open ? 0 : 1);
271 
272  if (EV_IS_ANNOTATION_TEXT (annot)) {
273  EvAnnotationText *annot_text = EV_ANNOTATION_TEXT (annot);
274 
275  gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->icon),
276  ev_annotation_text_get_icon (annot_text));
277  } else if (EV_IS_ANNOTATION_TEXT_MARKUP (annot)) {
278  EvAnnotationTextMarkup *annot_markup = EV_ANNOTATION_TEXT_MARKUP (annot);
279 
280  gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->text_markup_type),
282  }
283 
284  return GTK_WIDGET (dialog);
285 }

+ Here is the caller graph for this function:

static void ev_annotation_properties_dialog_set_property ( GObject *  object,
guint  prop_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

Definition at line 72 of file ev-annotation-properties-dialog.c.

76 {
78 
79  switch (prop_id) {
80  case PROP_ANNOT_TYPE:
81  dialog->annot_type = g_value_get_enum (value);
82  break;
83  default:
84  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
85  }
86 }

+ Here is the caller graph for this function: