1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
/* run the display for an arrow in a workspace
*/
/*
Copyright (C) 1991-2003 The National Gallery
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(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 along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
/*
#define DEBUG
*/
#include "ip.h"
static GraphicviewClass *parent_class = NULL;
static void
fontnameview_link( View *view, Model *model, View *parent )
{
Fontnameview *fontnameview = FONTNAMEVIEW( view );
VIEW_CLASS( parent_class )->link( view, model, parent );
if( GRAPHICVIEW( view )->sview )
gtk_size_group_add_widget( GRAPHICVIEW( view )->sview->group,
fontnameview->label );
}
static void
fontnameview_refresh( vObject *vobject )
{
Fontnameview *fontnameview = FONTNAMEVIEW( vobject );
Fontname *fontname = FONTNAME( VOBJECT( vobject )->iobject );
#ifdef DEBUG
printf( "fontnameview_refresh: " );
row_name_print( HEAPMODEL( fontname )->row );
printf( "\n" );
#endif /*DEBUG*/
if( vobject->iobject->caption )
set_glabel( fontnameview->label, _( "%s:" ),
vobject->iobject->caption );
if( fontname->value )
fontbutton_set_font_name( fontnameview->fontbutton,
fontname->value );
VOBJECT_CLASS( parent_class )->refresh( vobject );
}
static void
fontnameview_class_init( FontnameviewClass *class )
{
vObjectClass *vobject_class = (vObjectClass *) class;
ViewClass *view_class = (ViewClass *) class;
parent_class = g_type_class_peek_parent( class );
/* Create signals.
*/
/* Init methods.
*/
vobject_class->refresh = fontnameview_refresh;
view_class->link = fontnameview_link;
}
static void
fontnameview_changed_cb( Fontbutton *fontbutton, Fontnameview *fontnameview )
{
Fontname *fontname = FONTNAME( VOBJECT( fontnameview )->iobject );
const char *font_name = fontbutton_get_font_name( fontbutton );
if( strcmp( font_name, fontname->value ) != 0 ) {
IM_SETSTR( fontname->value, font_name );
classmodel_update( CLASSMODEL( fontname ) );
symbol_recalculate_all();
}
}
static void
fontnameview_init( Fontnameview *fontnameview )
{
GtkWidget *hbox;
#ifdef DEBUG
printf( "fontnameview_init\n" );
#endif /*DEBUG*/
hbox = gtk_hbox_new( FALSE, 12 );
gtk_box_pack_start( GTK_BOX( fontnameview ), hbox, TRUE, FALSE, 0 );
fontnameview->label = gtk_label_new( "" );
gtk_misc_set_alignment( GTK_MISC( fontnameview->label ), 0, 0.5 );
gtk_misc_set_padding( GTK_MISC( fontnameview->label ), 2, 7 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( fontnameview->label ),
FALSE, FALSE, 2 );
fontnameview->fontbutton = fontbutton_new();
gtk_box_pack_start( GTK_BOX( hbox ),
GTK_WIDGET( fontnameview->fontbutton ), TRUE, TRUE, 0 );
g_signal_connect( fontnameview->fontbutton, "changed",
G_CALLBACK( fontnameview_changed_cb ), fontnameview );
gtk_widget_show_all( GTK_WIDGET( hbox ) );
}
GtkType
fontnameview_get_type( void )
{
static GtkType fontnameview_type = 0;
if( !fontnameview_type ) {
static const GtkTypeInfo info = {
"Fontnameview",
sizeof( Fontnameview ),
sizeof( FontnameviewClass ),
(GtkClassInitFunc) fontnameview_class_init,
(GtkObjectInitFunc) fontnameview_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
fontnameview_type = gtk_type_unique( TYPE_GRAPHICVIEW, &info );
}
return( fontnameview_type );
}
View *
fontnameview_new( void )
{
Fontnameview *fontnameview = gtk_type_new( TYPE_FONTNAMEVIEW );
return( VIEW( fontnameview ) );
}
|