~ubuntu-branches/ubuntu/raring/openmotif/raring-proposed

« back to all changes in this revision

Viewing changes to lib/Xm/LabelG.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bauer
  • Date: 2010-06-29 09:42:21 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100629094221-yee9gtet2dngu6cv
Tags: 2.3.3-1
* New upstream release
* Drop patch for autoconf-bug as this was fixed upstream
* Applied patch to fix implicit pointer conversion (Closes: #587461)
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
#include "XmI.h"
91
91
#include "XmosI.h"
92
92
#include "XmStringI.h"
 
93
#include <Xm/XpmP.h>
 
94
#include <string.h>
 
95
#include <Xm/XmP.h>
 
96
#ifdef FIX_1381
 
97
#include <Xm/ColorI.h>
 
98
#endif
93
99
 
94
100
#define Pix(w)      LabG_Pixmap(w)
95
101
#define Pix_insen(w)    LabG_PixmapInsensitive(w)
174
180
static char* GetLabelGadgetAccelerator(Widget);
175
181
static KeySym GetLabelGadgetMnemonic(Widget);
176
182
static void GetColors(Widget widget, XmAccessColorData color_data);
177
 
 
178
183
/********    End Static Function Declarations    ********/
179
184
 
180
185
void _XmLabelConvert(Widget w, XtPointer ignore, XmConvertCallbackStruct*);
1247
1252
    LabG_NormalGC(lw) = XtAllocateGC((Widget) mw, 0, valueMask, &values,
1248
1253
        dynamicMask, 0);
1249
1254
 
 
1255
#ifdef FIX_1381
 
1256
    /*generally gray insensitive foreground (instead stipple)*/
 
1257
    values.foreground = _XmAssignInsensitiveColor((Widget)lw);
 
1258
    values.background = LabG_Background(lw);
 
1259
#else
1250
1260
    valueMask |= GCFillStyle | GCStipple;
1251
1261
    values.foreground = LabG_Background(lw); 
1252
1262
    values.background = LabG_Foreground(lw);
1253
1263
    values.fill_style = FillOpaqueStippled;
1254
 
 
1255
1264
    values.stipple = _XmGetInsensitiveStippleBitmap((Widget) lw);
 
1265
#endif
1256
1266
 
1257
1267
    LabG_InsensitiveGC(lw) = XtAllocateGC((Widget) mw, 0, valueMask, &values,
1258
1268
        dynamicMask, 0);
 
1269
#ifdef FIX_1381
 
1270
    /*light shadow for insensitive text (instead stipple)*/
 
1271
    values.foreground = LabG_TopShadowColor(lw);
 
1272
    LabG_ShadowGC(lw)  = XtAllocateGC((Widget) mw, 0, valueMask, &values,
 
1273
        dynamicMask, 0);
 
1274
#endif
 
1275
 
1259
1276
}
1260
1277
 
1261
1278
 
2173
2190
 
2174
2191
    XtReleaseGC (XtParent(w), LabG_NormalGC(w));
2175
2192
    XtReleaseGC (XtParent(w), LabG_InsensitiveGC(w));
2176
 
 
 
2193
#ifdef FIX_1381
 
2194
        XtReleaseGC (XtParent(w), LabG_ShadowGC(w));
 
2195
#endif
2177
2196
    XtReleaseGC (XtParent(w), LabG_BackgroundGC(w));
2178
2197
    XtReleaseGC (XtParent(w), LabG_HighlightGC(w));
2179
2198
    XtReleaseGC (XtParent(w), LabG_TopShadowGC(w));
2251
2270
    _XmRedisplayLabG(wid, event, region, &background_box);
2252
2271
}
2253
2272
 
2254
 
 
2255
2273
void
2256
2274
_XmRedisplayLabG(Widget wid,
2257
2275
XEvent *event,
2358
2376
            Pixmap pix_use = Pix_insen (lw) ;
2359
2377
 
2360
2378
            if (pix_use == XmUNSPECIFIED_PIXMAP)
2361
 
                pix_use = Pix(lw);
2362
 
 
 
2379
#ifdef FIX_1381
 
2380
                Pix_insen(lw) = pix_use = _XmConvertToBW(wid, Pix(lw));
 
2381
#else
 
2382
                pix_use = Pix(lw);                              
 
2383
#endif
2363
2384
            if (pix_use != XmUNSPECIFIED_PIXMAP)
2364
2385
            {
2365
2386
                gc = LabG_InsensitiveGC(lw);
2382
2403
                            lw->rectangle.y + LabG_TextRect(lw).y + LabG_PixmapRect(lw).y,
2383
2404
                            1);
2384
2405
 
 
2406
#ifndef FIX_1381
2385
2407
                /* if no insensitive pixmap but a regular one, we need
2386
2408
                to do the stipple manually, since copyarea doesn't */
2387
 
                if (pix_use == Pix(lw))
2388
 
                {
 
2409
                                if (pix_use == Pix(lw))         {
2389
2410
                    /* need fill stipple, not opaque */
2390
2411
                    XSetFillStyle(XtDisplay(lw), gc, FillStippled);
2391
2412
                    XFillRectangle(XtDisplay(lw), XtWindow(lw),
2398
2419
                        LabG_PixmapRect(lw).height);
2399
2420
                    XSetFillStyle(XtDisplay(lw), gc, FillOpaqueStippled);
2400
2421
                }
 
2422
#endif
2401
2423
            }
2402
2424
        }
2403
2425
    }
2415
2437
 
2416
2438
            tmp[_XmOSKeySymToCharacter(LabG_Mnemonic(lw), NULL, tmp)] = '\0';
2417
2439
            underline = XmStringCreate(tmp, LabG_MnemonicCharset(lw));
2418
 
 
 
2440
#ifdef FIX_1381
 
2441
                        if (XtIsSensitive(wid) )
 
2442
                        {
 
2443
                                /*Draw normal text*/
 
2444
                                XmStringDrawUnderline(XtDisplay(lw), XtWindow(lw),
 
2445
                                                LabG_Font(lw), LabG__label(lw),
 
2446
                                                LabG_NormalGC(lw),
 
2447
                                                lw->rectangle.x + LabG_TextRect(lw).x + LabG_StringRect(lw).x,
 
2448
                                                lw->rectangle.y + LabG_TextRect(lw).y + LabG_StringRect(lw).y,
 
2449
                                                LabG_StringRect(lw).width, LabG_Alignment(lw),
 
2450
                                                LayoutG(lw), NULL, underline);
 
2451
                        }
 
2452
                        else
 
2453
                        {
 
2454
                                /*Draw shadow for insensitive text*/
 
2455
                                XmStringDrawUnderline(XtDisplay(lw), XtWindow(lw),
 
2456
                                                LabG_Font(lw), LabG__label(lw),
 
2457
                                                LabG_ShadowGC(lw),
 
2458
                                                lw->rectangle.x+1 + LabG_TextRect(lw).x + LabG_StringRect(lw).x,
 
2459
                                                lw->rectangle.y+1 + LabG_TextRect(lw).y + LabG_StringRect(lw).y,
 
2460
                                                LabG_StringRect(lw).width, LabG_Alignment(lw),
 
2461
                                                LayoutG(lw), NULL, underline);
 
2462
                                /*Draw insensitive text*/
 
2463
                                XmStringDrawUnderline(XtDisplay(lw), XtWindow(lw),
 
2464
                                                LabG_Font(lw), LabG__label(lw),
 
2465
                                                LabG_InsensitiveGC(lw),
 
2466
                                                lw->rectangle.x + LabG_TextRect(lw).x + LabG_StringRect(lw).x,
 
2467
                                                lw->rectangle.y + LabG_TextRect(lw).y + LabG_StringRect(lw).y,
 
2468
                                                LabG_StringRect(lw).width, LabG_Alignment(lw),
 
2469
                                                LayoutG(lw), NULL, underline);
 
2470
                        }
 
2471
#else
2419
2472
            XmStringDrawUnderline(XtDisplay(lw), XtWindow(lw),
2420
2473
                LabG_Font(lw), LabG__label(lw),
2421
2474
                (XtIsSensitive(wid) ?
2424
2477
                lw->rectangle.y + LabG_TextRect(lw).y + LabG_StringRect(lw).y,
2425
2478
                LabG_StringRect(lw).width, LabG_Alignment(lw),
2426
2479
                LayoutG(lw), NULL, underline);
 
2480
 
 
2481
#endif
2427
2482
            XmStringFree(underline);
2428
2483
        }
2429
2484
        else
 
2485
#ifdef FIX_1381
 
2486
                {
 
2487
                        if (XtIsSensitive(wid) )
 
2488
                        {
 
2489
                                /*Draw normal text*/
 
2490
                                XmStringDraw (XtDisplay(lw), XtWindow(lw),
 
2491
                                                LabG_Font(lw), LabG__label(lw),
 
2492
                                                LabG_NormalGC(lw),
 
2493
                                                lw->rectangle.x + LabG_TextRect(lw).x + LabG_StringRect(lw).x,
 
2494
                                                lw->rectangle.y + LabG_TextRect(lw).y + LabG_StringRect(lw).y,
 
2495
                                                LabG_StringRect(lw).width,
 
2496
                                                LabG_Alignment(lw), LayoutG(lw), NULL);
 
2497
                        }
 
2498
                        else
 
2499
                        {
 
2500
                                /*Draw shadow for insensitive text*/
 
2501
                                XmStringDraw (XtDisplay(lw), XtWindow(lw),
 
2502
                                                LabG_Font(lw), LabG__label(lw),
 
2503
                                                LabG_ShadowGC(lw),
 
2504
                                                lw->rectangle.x + LabG_TextRect(lw).x+1 + LabG_StringRect(lw).x,
 
2505
                                                lw->rectangle.y + LabG_TextRect(lw).y+1 + LabG_StringRect(lw).y,
 
2506
                                                LabG_StringRect(lw).width,
 
2507
                                                LabG_Alignment(lw), LayoutG(lw), NULL);
 
2508
                                /*Draw insensitive text*/
 
2509
                                XmStringDraw (XtDisplay(lw), XtWindow(lw),
 
2510
                                                LabG_Font(lw), LabG__label(lw),
 
2511
                                                LabG_InsensitiveGC(lw),
 
2512
                                                lw->rectangle.x + LabG_TextRect(lw).x + LabG_StringRect(lw).x,
 
2513
                                                lw->rectangle.y + LabG_TextRect(lw).y + LabG_StringRect(lw).y,
 
2514
                                                LabG_StringRect(lw).width,
 
2515
                                                LabG_Alignment(lw), LayoutG(lw), NULL);
 
2516
                        }
 
2517
                }
 
2518
#else
2430
2519
            XmStringDraw (XtDisplay(lw), XtWindow(lw),
2431
2520
                LabG_Font(lw), LabG__label(lw),
2432
2521
                (XtIsSensitive(wid) ?
2435
2524
            lw->rectangle.y + LabG_TextRect(lw).y + LabG_StringRect(lw).y,
2436
2525
            LabG_StringRect(lw).width,
2437
2526
            LabG_Alignment(lw), LayoutG(lw), NULL);
 
2527
#endif
 
2528
 
 
2529
#ifndef FIX_1381
2438
2530
#ifdef USE_XFT
2439
2531
        if (!XtIsSensitive(wid)) {
2440
2532
          XSetFillStyle(XtDisplay(lw), LabG_InsensitiveGC(lw), FillStippled);
2448
2540
          XSetFillStyle(XtDisplay(lw), LabG_InsensitiveGC(lw), FillOpaqueStippled);
2449
2541
        }
2450
2542
#endif
 
2543
#endif
2451
2544
    }
2452
2545
 
2453
2546
    if (LabG__acceleratorText(lw) != NULL)
2464
2557
            LabG_MarginLeft(lw) + LabG_TextRect(lw).width +
2465
2558
            LabG_MarginRight(lw)))
2466
2559
        {
 
2560
#ifdef FIX_1381
 
2561
                        if (XtIsSensitive(wid) )
 
2562
                        {
 
2563
                                /*Draw normal text*/
 
2564
                                XmStringDraw (XtDisplay(lw), XtWindow(lw),
 
2565
                                                LabG_Font(lw), LabG__acceleratorText(lw),
 
2566
                                                LabG_NormalGC(lw),
 
2567
                                                lw->rectangle.x + LabG_AccTextRect(lw).x,
 
2568
                                                lw->rectangle.y + LabG_AccTextRect(lw).y,
 
2569
                                                LabG_AccTextRect(lw).width, XmALIGNMENT_END,
 
2570
                                                LayoutG(lw), NULL);
 
2571
                        }
 
2572
                        else
 
2573
                        {
 
2574
                                /*Draw shadow for insensitive text*/
 
2575
                                XmStringDraw (XtDisplay(lw), XtWindow(lw),
 
2576
                                                LabG_Font(lw), LabG__acceleratorText(lw),
 
2577
                                                LabG_ShadowGC(lw) ,
 
2578
                                                lw->rectangle.x + LabG_AccTextRect(lw).x+1,
 
2579
                                                lw->rectangle.y + LabG_AccTextRect(lw).y+1,
 
2580
                                                LabG_AccTextRect(lw).width, XmALIGNMENT_END,
 
2581
                                                LayoutG(lw), NULL);
 
2582
                                /*Draw insensitive text*/
 
2583
                                XmStringDraw (XtDisplay(lw), XtWindow(lw),
 
2584
                                                LabG_Font(lw), LabG__acceleratorText(lw),
 
2585
                                                LabG_InsensitiveGC(lw),
 
2586
                                                lw->rectangle.x + LabG_AccTextRect(lw).x,
 
2587
                                                lw->rectangle.y + LabG_AccTextRect(lw).y,
 
2588
                                                LabG_AccTextRect(lw).width, XmALIGNMENT_END,
 
2589
                                                LayoutG(lw), NULL);
 
2590
                        }
 
2591
#else
2467
2592
            XmStringDraw (XtDisplay(lw), XtWindow(lw),
2468
2593
                LabG_Font(lw), LabG__acceleratorText(lw),
2469
2594
                (XtIsSensitive(wid) ?
2472
2597
                lw->rectangle.y + LabG_AccTextRect(lw).y,
2473
2598
                LabG_AccTextRect(lw).width, XmALIGNMENT_END,
2474
2599
                LayoutG(lw), NULL);
 
2600
#endif
2475
2601
        }
2476
2602
    }
2477
2603