~ubuntu-branches/ubuntu/quantal/openmotif/quantal

« back to all changes in this revision

Viewing changes to demos/programs/FontSel/fontsel.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bauer
  • Date: 2010-06-23 12:12:31 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100623121231-u89gxdp51sg9wjj2
Tags: 2.3.0-1
* New Maintainer (Closes: #379258) 
* Acknowledge NMU changes
* New upstream release (Closes: #494375)
* Get rid of security patches as they are already part of new upstream
  release (00-xpmvuln.openmotif.patch, 342092-CVE-2005-3964.patch)
* Bump Standards to 3.8.4
* Added {misc:Depends} to make the package lintian cleaner
* Fix weak-library-dev-dependency by adding ${binary:Version}) for the
  -dev Package of openmotif
* Let package depend on autotools-dev to use newer autotools-helper-files
* Work around an autoconf-bug (Gentoo-Bug #1475)
* Added Client-side anti-aliased fonts support via XFT
* Added UTF-8 and UTF8_STRING atom support
* Ability to show text and pixmaps in Label, LabelGadget and all
  derived widgets
* Support of PNG/JPEG image formats in the same way as XPM is supported
* Increase FILE_OFFSET_BITS to 64 to show files >2GB in file-selector
  Idea taken from Magne Oestlyngen (Closes: #288537)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 1994, Integrated Computer Solutions, Inc.
 
3
 *
 
4
 * All Rights Reserved.
 
5
 *
 
6
 * Author: Rick Umali
 
7
 *
 
8
 * fontsel.c
 
9
 *
 
10
 */
 
11
 
 
12
/**************************************************************
 
13
 *              INCLUDE FILES
 
14
 **************************************************************/
 
15
#include <stdio.h>
 
16
#include <stdlib.h>
 
17
#include <string.h>
 
18
 
 
19
#include "fontsel.h"
 
20
 
 
21
#include <Xm/Xm.h>
 
22
#include <Xm/ToggleB.h>
 
23
#include <Xm/FontS.h>
 
24
 
 
25
/**************************************************************
 
26
 *              GLOBALS
 
27
 **************************************************************/
 
28
Widget G_font = NULL;
 
29
 
 
30
/**************************************************************
 
31
 *              FORWARD DECLARATIONS
 
32
 **************************************************************/
 
33
Widget CreateDemoForm(Widget);
 
34
 
 
35
/**************************************************************
 
36
 *              DEFINES
 
37
 **************************************************************/
 
38
 
 
39
/**************************************************************
 
40
 *              FALLBACKS
 
41
 **************************************************************/
 
42
static String fallbacks[] = {
 
43
    /*
 
44
     * General fallback resources.
 
45
     */
 
46
    "*fontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-*-*",
 
47
    "*hype_label*fontList: -*-helvetica-bold-r-*-*-*-140-*-*-*-*-*-*",
 
48
    "*hype_label.marginWidth: 10",
 
49
    "*hype_label.marginHeight: 10",
 
50
    "*show_font_tog.labelString: Show Font on Widget",
 
51
    "*explain_showfont.labelString: Explain...",
 
52
    "*cur_font_pb.labelString: Show Current Font...",
 
53
    "*explain_curfont.labelString: Explain...",
 
54
    "*other_pb.labelString: Other Resources...",
 
55
    "*quit_pb.labelString: Quit",
 
56
    "*resform*rgbFileLabel.labelString: XmNrgbFile",
 
57
    
 
58
    NULL,
 
59
};
 
60
/**************************************************************
 
61
 *              PUBLIC (GLOBAL) CODE
 
62
 **************************************************************/
 
63
 
 
64
/*
 
65
 * Function Name: InitializeDemoForm
 
66
 * Description:   
 
67
 * Arguments:     form - 
 
68
 * Returns:       nothing
 
69
 *
 
70
 */
 
71
void 
 
72
InitializeDemoForm(Widget form)
 
73
{
 
74
    Widget w;
 
75
 
 
76
    w = XtNameToWidget(form, "*show_font_tog");
 
77
    if (w == NULL) {
 
78
        fprintf(stderr, "InitializeDemoForm: cannot find show_font_tog\n");
 
79
        exit(1);
 
80
    }
 
81
 
 
82
    XmToggleButtonSetState(w, False, False);
 
83
 
 
84
    /* Set the global variable */
 
85
    G_font = XtNameToWidget(form, "*fontsel");
 
86
    if (G_font == NULL) {
 
87
        fprintf(stderr, "InitializeDemoForm: cannot find fontsel\n");
 
88
        exit(1);
 
89
    }
 
90
}
 
91
 
 
92
/*
 
93
 * Function Name: main
 
94
 * Description:   
 
95
 * Arguments:     the usual suspects
 
96
 * Returns:       nothing
 
97
 *
 
98
 */
 
99
int
 
100
main(argc, argv)
 
101
int argc;
 
102
char **argv;
 
103
{
 
104
    Arg args[5];
 
105
    Cardinal argcnt;
 
106
    Widget top, demowindow;
 
107
    XtAppContext app;
 
108
 
 
109
    argcnt = 0;
 
110
    XtSetArg(args[argcnt], XmNtitle, "Font Selector Demo"); argcnt++;
 
111
    XtSetArg(args[argcnt], XmNiconName, "Font Selector Demo"); argcnt++;
 
112
    XtSetArg(args[argcnt], XmNallowShellResize, True); argcnt++;
 
113
    top = XtAppInitialize(&app, "ColorSelector", NULL, 0,
 
114
                          &argc, argv, fallbacks, args, argcnt);
 
115
 
 
116
    demowindow = CreateDemoForm(top);
 
117
    XtManageChild(demowindow);
 
118
 
 
119
    InitializeDemoForm(demowindow);
 
120
 
 
121
    XtRealizeWidget(top);
 
122
 
 
123
    XtAppMainLoop(app);
 
124
}
 
125