~ubuntu-branches/ubuntu/breezy/gimp/breezy

« back to all changes in this revision

Viewing changes to app/widgets/gimpfontselect.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-10-04 19:04:46 UTC
  • Revision ID: james.westby@ubuntu.com-20051004190446-ukh32kwk56s4sjhu
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an image manipulation program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * gimpfontselect.c
 
5
 * Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
 */
 
21
 
 
22
#include "config.h"
 
23
 
 
24
#include <gtk/gtk.h>
 
25
 
 
26
#include "libgimpwidgets/gimpwidgets.h"
 
27
 
 
28
#include "widgets-types.h"
 
29
 
 
30
#include "core/gimp.h"
 
31
#include "core/gimpcontext.h"
 
32
 
 
33
#include "text/gimpfont.h"
 
34
 
 
35
#include "pdb/procedural_db.h"
 
36
 
 
37
#include "gimpcontainerbox.h"
 
38
#include "gimpfontselect.h"
 
39
#include "gimpfontview.h"
 
40
 
 
41
 
 
42
static void       gimp_font_select_class_init   (GimpFontSelectClass *klass);
 
43
 
 
44
static GObject  * gimp_font_select_constructor  (GType          type,
 
45
                                                 guint          n_params,
 
46
                                                 GObjectConstructParam *params);
 
47
 
 
48
static Argument * gimp_font_select_run_callback (GimpPdbDialog *dialog,
 
49
                                                 GimpObject    *object,
 
50
                                                 gboolean       closing,
 
51
                                                 gint          *n_return_vals);
 
52
 
 
53
 
 
54
static GimpPdbDialogClass *parent_class = NULL;
 
55
 
 
56
 
 
57
GType
 
58
gimp_font_select_get_type (void)
 
59
{
 
60
  static GType dialog_type = 0;
 
61
 
 
62
  if (! dialog_type)
 
63
    {
 
64
      static const GTypeInfo dialog_info =
 
65
      {
 
66
        sizeof (GimpFontSelectClass),
 
67
        (GBaseInitFunc) NULL,
 
68
        (GBaseFinalizeFunc) NULL,
 
69
        (GClassInitFunc) gimp_font_select_class_init,
 
70
        NULL,           /* class_finalize */
 
71
        NULL,           /* class_data     */
 
72
        sizeof (GimpFontSelect),
 
73
        0,              /* n_preallocs    */
 
74
        NULL            /* instance_init  */
 
75
      };
 
76
 
 
77
      dialog_type = g_type_register_static (GIMP_TYPE_PDB_DIALOG,
 
78
                                            "GimpFontSelect",
 
79
                                            &dialog_info, 0);
 
80
    }
 
81
 
 
82
  return dialog_type;
 
83
}
 
84
 
 
85
static void
 
86
gimp_font_select_class_init (GimpFontSelectClass *klass)
 
87
{
 
88
  GObjectClass       *object_class = G_OBJECT_CLASS (klass);
 
89
  GimpPdbDialogClass *pdb_class    = GIMP_PDB_DIALOG_CLASS (klass);
 
90
 
 
91
  parent_class = g_type_class_peek_parent (klass);
 
92
 
 
93
  object_class->constructor = gimp_font_select_constructor;
 
94
 
 
95
  pdb_class->run_callback   = gimp_font_select_run_callback;
 
96
}
 
97
 
 
98
static GObject *
 
99
gimp_font_select_constructor (GType                  type,
 
100
                              guint                  n_params,
 
101
                              GObjectConstructParam *params)
 
102
{
 
103
  GObject       *object;
 
104
  GimpPdbDialog *dialog;
 
105
 
 
106
  object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
 
107
 
 
108
  dialog = GIMP_PDB_DIALOG (object);
 
109
 
 
110
  dialog->view = gimp_font_view_new (GIMP_VIEW_TYPE_LIST,
 
111
                                     dialog->context->gimp->fonts,
 
112
                                     dialog->context,
 
113
                                     GIMP_VIEW_SIZE_MEDIUM, 1,
 
114
                                     dialog->menu_factory);
 
115
 
 
116
  gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (GIMP_CONTAINER_EDITOR (dialog->view)->view),
 
117
                                       6 * (GIMP_VIEW_SIZE_MEDIUM + 2),
 
118
                                       6 * (GIMP_VIEW_SIZE_MEDIUM + 2));
 
119
 
 
120
  gtk_container_set_border_width (GTK_CONTAINER (dialog->view), 12);
 
121
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->view);
 
122
  gtk_widget_show (dialog->view);
 
123
 
 
124
  return object;
 
125
}
 
126
 
 
127
static Argument *
 
128
gimp_font_select_run_callback (GimpPdbDialog *dialog,
 
129
                               GimpObject    *object,
 
130
                               gboolean       closing,
 
131
                               gint          *n_return_vals)
 
132
{
 
133
  return procedural_db_run_proc (dialog->caller_context->gimp,
 
134
                                 dialog->caller_context,
 
135
                                 NULL,
 
136
                                 dialog->callback_name,
 
137
                                 n_return_vals,
 
138
                                 GIMP_PDB_STRING, object->name,
 
139
                                 GIMP_PDB_INT32,  closing,
 
140
                                 GIMP_PDB_END);
 
141
}