Commit 97c40278 authored by claes's avatar claes

Font choise for motif

parent 57f99b60
/* /*
* Proview $Id: ge_motif.cpp,v 1.3 2007-01-11 11:40:30 claes Exp $ * Proview $Id: ge_motif.cpp,v 1.4 2007-05-07 15:45:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -950,6 +950,23 @@ void GeMotif::activate_textsize_5( Widget w, Ge *gectx, XmAnyCallbackStruct *dat ...@@ -950,6 +950,23 @@ void GeMotif::activate_textsize_5( Widget w, Ge *gectx, XmAnyCallbackStruct *dat
gectx->activate_textsize( 5); gectx->activate_textsize( 5);
} }
void GeMotif::activate_textfont_1( Widget w, Ge *gectx, XmAnyCallbackStruct *data)
{
gectx->activate_textfont( glow_eFont_Helvetica);
}
void GeMotif::activate_textfont_2( Widget w, Ge *gectx, XmAnyCallbackStruct *data)
{
gectx->activate_textfont( glow_eFont_Times);
}
void GeMotif::activate_textfont_3( Widget w, Ge *gectx, XmAnyCallbackStruct *data)
{
gectx->activate_textfont( glow_eFont_NewCenturySchoolbook);
}
void GeMotif::activate_textfont_4( Widget w, Ge *gectx, XmAnyCallbackStruct *data)
{
gectx->activate_textfont( glow_eFont_Courier);
}
void GeMotif::activate_textbold( Widget w, Ge *gectx, XmToggleButtonCallbackStruct *data) void GeMotif::activate_textbold( Widget w, Ge *gectx, XmToggleButtonCallbackStruct *data)
{ {
gectx->activate_textbold( data->set); gectx->activate_textbold( data->set);
...@@ -1412,6 +1429,10 @@ GeMotif::GeMotif( void *x_parent_ctx, ...@@ -1412,6 +1429,10 @@ GeMotif::GeMotif( void *x_parent_ctx,
{"ge_activate_textsize_3",(caddr_t)GeMotif::activate_textsize_3 }, {"ge_activate_textsize_3",(caddr_t)GeMotif::activate_textsize_3 },
{"ge_activate_textsize_4",(caddr_t)GeMotif::activate_textsize_4 }, {"ge_activate_textsize_4",(caddr_t)GeMotif::activate_textsize_4 },
{"ge_activate_textsize_5",(caddr_t)GeMotif::activate_textsize_5 }, {"ge_activate_textsize_5",(caddr_t)GeMotif::activate_textsize_5 },
{"ge_activate_textfont_1",(caddr_t)GeMotif::activate_textfont_1 },
{"ge_activate_textfont_2",(caddr_t)GeMotif::activate_textfont_2 },
{"ge_activate_textfont_3",(caddr_t)GeMotif::activate_textfont_3 },
{"ge_activate_textfont_4",(caddr_t)GeMotif::activate_textfont_4 },
{"ge_activate_textbold",(caddr_t)GeMotif::activate_textbold }, {"ge_activate_textbold",(caddr_t)GeMotif::activate_textbold },
{"ge_activate_gridsize_1",(caddr_t)GeMotif::activate_gridsize_1 }, {"ge_activate_gridsize_1",(caddr_t)GeMotif::activate_gridsize_1 },
{"ge_activate_gridsize_2",(caddr_t)GeMotif::activate_gridsize_2 }, {"ge_activate_gridsize_2",(caddr_t)GeMotif::activate_gridsize_2 },
......
/* /*
* Proview $Id: ge_motif.h,v 1.1 2007-01-04 08:22:16 claes Exp $ * Proview $Id: ge_motif.h,v 1.2 2007-05-07 15:45:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -208,6 +208,10 @@ class GeMotif : public Ge { ...@@ -208,6 +208,10 @@ class GeMotif : public Ge {
static void activate_textsize_3( Widget w, Ge *gectx, XmAnyCallbackStruct *data); static void activate_textsize_3( Widget w, Ge *gectx, XmAnyCallbackStruct *data);
static void activate_textsize_4( Widget w, Ge *gectx, XmAnyCallbackStruct *data); static void activate_textsize_4( Widget w, Ge *gectx, XmAnyCallbackStruct *data);
static void activate_textsize_5( Widget w, Ge *gectx, XmAnyCallbackStruct *data); static void activate_textsize_5( Widget w, Ge *gectx, XmAnyCallbackStruct *data);
static void activate_textfont_1( Widget w, Ge *gectx, XmAnyCallbackStruct *data);
static void activate_textfont_2( Widget w, Ge *gectx, XmAnyCallbackStruct *data);
static void activate_textfont_3( Widget w, Ge *gectx, XmAnyCallbackStruct *data);
static void activate_textfont_4( Widget w, Ge *gectx, XmAnyCallbackStruct *data);
static void activate_textbold( Widget w, Ge *gectx, XmToggleButtonCallbackStruct *data); static void activate_textbold( Widget w, Ge *gectx, XmToggleButtonCallbackStruct *data);
static void activate_zoom_in( Widget w, Ge *gectx, XmAnyCallbackStruct *data); static void activate_zoom_in( Widget w, Ge *gectx, XmAnyCallbackStruct *data);
static void activate_zoom_out( Widget w, Ge *gectx, XmAnyCallbackStruct *data); static void activate_zoom_out( Widget w, Ge *gectx, XmAnyCallbackStruct *data);
......
/* /*
* Proview $Id: glow_draw_xlib.cpp,v 1.3 2007-05-07 14:35:03 claes Exp $ * Proview $Id: glow_draw_xlib.cpp,v 1.4 2007-05-07 15:45:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -275,7 +275,7 @@ static int glow_create_cursor( GlowDrawXLib *draw_ctx) ...@@ -275,7 +275,7 @@ static int glow_create_cursor( GlowDrawXLib *draw_ctx)
static int draw_free_gc( GlowDrawXLib *draw_ctx) static int draw_free_gc( GlowDrawXLib *draw_ctx)
{ {
int i, j; int i, j, k;
for ( i = 1; i < glow_eDrawCursor__ ; i++) for ( i = 1; i < glow_eDrawCursor__ ; i++)
XFreeCursor( draw_ctx->display, draw_ctx->cursors[i]); XFreeCursor( draw_ctx->display, draw_ctx->cursors[i]);
...@@ -2067,6 +2067,7 @@ int GlowDrawXLib::get_text_extent( char *text, int len, ...@@ -2067,6 +2067,7 @@ int GlowDrawXLib::get_text_extent( char *text, int len,
int text_direction, text_ascent, text_descent; int text_direction, text_ascent, text_descent;
XCharStruct char_struct; XCharStruct char_struct;
int font_type = get_font_type( gc_type); int font_type = get_font_type( gc_type);
load_font( font_idx, font_type, idx);
XTextExtents( font_struct[font_idx][font_type][idx], text, len, XTextExtents( font_struct[font_idx][font_type][idx], text, len,
&text_direction, &text_ascent, &text_descent, &char_struct); &text_direction, &text_ascent, &text_descent, &char_struct);
...@@ -2488,10 +2489,10 @@ int GlowDrawXLib::draw_points( GlowWind *wind, glow_sPointX *points, int point_n ...@@ -2488,10 +2489,10 @@ int GlowDrawXLib::draw_points( GlowWind *wind, glow_sPointX *points, int point_n
void GlowDrawXLib::load_font( glow_eFont font_idx, int font_type, int idx) void GlowDrawXLib::load_font( glow_eFont font_idx, int font_type, int idx)
{ {
if ( !font[font_idx][font_type][idx]) { if ( !font[font_idx][font_type][idx]) {
Font font = XLoadFont( draw_ctx->display, font_names[font_idx][font_type][idx]); Font fnt = XLoadFont( display, font_names[font_idx][font_type][idx]);
draw_ctx->font[font_idx][font_type][idx] = font; font[font_idx][font_type][idx] = fnt;
draw_ctx->font_struct[font_idx][font_type][idx] = font_struct[font_idx][font_type][idx] =
XQueryFont( draw_ctx->display, font); XQueryFont( display, fnt);
} }
} }
...@@ -2704,7 +2705,7 @@ int GlowDrawXLib::print( char *filename, double x0, double x1, int end) ...@@ -2704,7 +2705,7 @@ int GlowDrawXLib::print( char *filename, double x0, double x1, int end)
if ( new_file) { if ( new_file) {
ps->fp << ps->fp <<
"%!PS-Adobe-2.0 EPSF-1.2" << endl << "%!PS-Adobe-2.0 EPSF-1.2" << endl <<
"%%Creator: Proview $Id: glow_draw_xlib.cpp,v 1.3 2007-05-07 14:35:03 claes Exp $ Glow" << endl << "%%Creator: Proview $Id: glow_draw_xlib.cpp,v 1.4 2007-05-07 15:45:18 claes Exp $ Glow" << endl <<
"%%EndComments" << endl << endl; "%%EndComments" << endl << endl;
} }
else else
......
/* /*
* Proview $Id: glow_draw_xlib.h,v 1.3 2007-05-07 14:35:03 claes Exp $ * Proview $Id: glow_draw_xlib.h,v 1.4 2007-05-07 15:45:18 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -100,7 +100,7 @@ class GlowDrawXLib : public GlowDraw { ...@@ -100,7 +100,7 @@ class GlowDrawXLib : public GlowDraw {
GC gc_inverse; GC gc_inverse;
GC gcs[glow_eDrawType__][DRAW_TYPE_SIZE]; GC gcs[glow_eDrawType__][DRAW_TYPE_SIZE];
XFontStruct *font_struct[glow_eFont__][glow_eDrawFont__][DRAW_FONT_SIZE]; XFontStruct *font_struct[glow_eFont__][glow_eDrawFont__][DRAW_FONT_SIZE];
Font font[glow_eFont][glow_eDrawFont__][DRAW_FONT_SIZE]; Font font[glow_eFont__][glow_eDrawFont__][DRAW_FONT_SIZE];
int cursors[glow_eDrawCursor__]; int cursors[glow_eDrawCursor__];
int ef; int ef;
// int (*event_handler)(glow_eEvent event, int x, int y, int w, int h); // int (*event_handler)(glow_eEvent event, int x, int y, int w, int h);
...@@ -174,7 +174,7 @@ class GlowDrawXLib : public GlowDraw { ...@@ -174,7 +174,7 @@ class GlowDrawXLib : public GlowDraw {
virtual void set_cursor( GlowWind *w, glow_eDrawCursor cursor); virtual void set_cursor( GlowWind *w, glow_eDrawCursor cursor);
virtual int get_text_extent( char *text, int len, virtual int get_text_extent( char *text, int len,
glow_eDrawType gc_type, int idx, int font_idx, glow_eDrawType gc_type, int idx, glow_eFont font_idx,
int *width, int *height, int *descent); int *width, int *height, int *descent);
virtual void copy_area( GlowWind *w, int x, int y); virtual void copy_area( GlowWind *w, int x, int y);
virtual void clear_area( GlowWind *w, int ll_x, int ur_x, int ll_y, int ur_y); virtual void clear_area( GlowWind *w, int ll_x, int ur_x, int ll_y, int ur_y);
......
! !
! Proview $Id: ge.uil,v 1.1 2007-01-04 08:39:37 claes Exp $ ! Proview $Id: ge.uil,v 1.2 2007-05-07 15:45:18 claes Exp $
! Copyright (C) 2005 SSAB Oxelsund AB. ! Copyright (C) 2005 SSAB Oxelsund AB.
! !
! This program is free software; you can redistribute it and/or ! This program is free software; you can redistribute it and/or
...@@ -498,11 +498,15 @@ procedure ...@@ -498,11 +498,15 @@ procedure
ge_activate_linetype6(integer); ge_activate_linetype6(integer);
ge_activate_linetype7(integer); ge_activate_linetype7(integer);
ge_activate_textsize_0(integer); ge_activate_textsize_0(integer);
ge_activate_textsize_1(integer); ge_activate_textsize_1(integer);
ge_activate_textsize_2(integer); ge_activate_textsize_2(integer);
ge_activate_textsize_3(integer); ge_activate_textsize_3(integer);
ge_activate_textsize_4(integer); ge_activate_textsize_4(integer);
ge_activate_textsize_5(integer); ge_activate_textsize_5(integer);
ge_activate_textfont_1(integer);
ge_activate_textfont_2(integer);
ge_activate_textfont_3(integer);
ge_activate_textfont_4(integer);
ge_activate_textbold(integer); ge_activate_textbold(integer);
ge_activate_gridsize_1(integer); ge_activate_gridsize_1(integer);
ge_activate_gridsize_2(integer); ge_activate_gridsize_2(integer);
...@@ -1358,6 +1362,77 @@ object functions_entry : XmCascadeButton ...@@ -1358,6 +1362,77 @@ object functions_entry : XmCascadeButton
}; };
}; };
}; };
XmCascadeButton
{
arguments
{
XmNlabelString = compound_string("Font");
XmNmnemonic = keysym('f');
XmNfontList = menu_font;
};
controls
{
XmPulldownMenu
{
arguments
{
XmNradioBehavior = true;
XmNradioAlwaysOne = true;
};
controls
{
XmToggleButton
{
arguments
{
XmNlabelString = compound_string("Helvetica");
XmNfontList = menu_font;
};
callbacks
{
XmNvalueChangedCallback = procedure ge_activate_textfont_1(ge_ctx);
};
};
XmToggleButton
{
arguments
{
XmNlabelString = compound_string("Times");
XmNfontList = menu_font;
};
callbacks
{
XmNvalueChangedCallback = procedure ge_activate_textfont_2(ge_ctx);
};
};
XmToggleButton
{
arguments
{
XmNlabelString = compound_string("New Century Schoolbook");
XmNfontList = menu_font;
};
callbacks
{
XmNvalueChangedCallback = procedure ge_activate_textfont_3(ge_ctx);
};
};
XmToggleButton
{
arguments
{
XmNlabelString = compound_string("Courier");
XmNfontList = menu_font;
};
callbacks
{
XmNvalueChangedCallback = procedure ge_activate_textfont_4(ge_ctx);
};
};
};
};
};
};
XmPushButton XmPushButton
{ {
arguments arguments
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment