~ubuntu-branches/ubuntu/maverick/ncbi-tools6/maverick

« back to all changes in this revision

Viewing changes to vibrant/vibwndws.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-03-27 12:00:15 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050327120015-embhesp32nj73p9r
Tags: 6.1.20041020-3
* Fix FTBFS under GCC 4.0 caused by inconsistent use of "static" on
  functions.  (Closes: #295110.)
* Add a watch file, now that we can.  (Upstream's layout needs version=3.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
*
30
30
* Version Creation Date:   7/1/91
31
31
*
32
 
* $Revision: 6.43 $
 
32
* $Revision: 6.66 $
33
33
*
34
34
* File Description:
35
35
*       Vibrant main, event loop, and window functions
37
37
* Modifications:
38
38
* --------------------------------------------------------------------------
39
39
* $Log: vibwndws.c,v $
 
40
* Revision 6.66  2004/07/19 13:37:24  bollin
 
41
* adjusted FixVisibilityIssues function to handle nesting of groups
 
42
*
 
43
* Revision 6.65  2004/07/16 18:47:29  bollin
 
44
* added FixVisibilityIssues function to handle LessTif problems with not correctly hiding
 
45
* widgets before the parent widget is managed.
 
46
* Also replaced obsolete XmFontListCreate function to get rid of run-time warning.
 
47
*
 
48
* Revision 6.64  2004/06/02 15:53:17  bollin
 
49
* fixed Nlm_ProcessKeyPress for MOTIF to handle arrow keys
 
50
*
 
51
* Revision 6.63  2004/06/02 14:54:33  bollin
 
52
* fixed Nlm_ProcessKeyPress to also handle arrow keys
 
53
*
 
54
* Revision 6.62  2004/04/14 19:14:06  sinyakov
 
55
* WIN_MSWIN: support X-Windows-like -bg color command line option
 
56
*
 
57
* Choi: Added support for either the left or right monitor being the primary
 
58
* monitor in a dual monitor setup.  Added function Nlm_UsePrimaryMonitor.
 
59
*
 
60
* Choi: modified Nlm_SetupWindows to use the virtual screen
 
61
* size to support dual monitor setups.  this effectively limits our target
 
62
* platform to WINVER >= 0x0500 (Windows2000 or later) which all indexers
 
63
* have.  modified Nlm_HasDualScreen to use system metrics call for
 
64
* windows2000 or later platforms.
 
65
*
 
66
* Revision 6.61  2004/02/03 23:34:58  sinyakov
 
67
* Nlm_WindowGainFocus(): call Nlm_GetNext() before calling Nlm_DoGainFocus()
 
68
*
 
69
* Revision 6.60  2004/01/20 23:35:38  sinyakov
 
70
* [WIN_MSWIN] implemented menu accelerators
 
71
*
 
72
* Revision 6.59  2004/01/05 18:42:40  kans
 
73
* record screen mode at time of window creation
 
74
*
 
75
* Revision 6.58  2004/01/05 17:08:09  kans
 
76
* added functions to control use of dual screens
 
77
*
 
78
* Revision 6.57  2003/12/03 17:45:21  kans
 
79
* For OS_MAC, always include Profiler.h
 
80
*
 
81
* Revision 6.56  2003/11/17 17:03:30  kans
 
82
* changed C++ style comments to C comments
 
83
*
 
84
* Revision 6.55  2003/11/03 21:57:48  sinyakov
 
85
* WIN_MSWIN: added ability to put a message into message processing loop
 
86
* to call a callback function within the main GUI thread
 
87
* callback function address is passed in WPARAM,
 
88
* callback function parameter is passed in LPARAM
 
89
* this functionality is used by Win32 implementation of smartnet.c module
 
90
*
 
91
* Revision 6.54  2003/04/09 18:16:53  kans
 
92
* motif version of Nlm_ProcessKeyPress sets ctrlKey and shftKey, clears cmmdKey and optKey, leaves dblClick alone
 
93
*
 
94
* Revision 6.53  2003/01/27 17:43:03  kans
 
95
* do not set silent if xx_argc > 1
 
96
*
 
97
* Revision 6.52  2003/01/24 20:55:42  rsmith
 
98
* ConvertFilename now extern not static, renamed Nlm_* and only defined in vibutils.c
 
99
*
 
100
* Revision 6.51  2002/11/06 21:32:50  ucko
 
101
* Accept "--help" as a synonym for the less intuitive "-"
 
102
*
 
103
* Revision 6.50  2002/07/09 15:20:19  lavr
 
104
* Call CONNECT_Init(0) in initialization sequence
 
105
*
 
106
* Revision 6.49  2002/06/13 16:15:13  kans
 
107
* fix includes for OS_UNIX_DARWIN with WIN_MAC (EN) - still bug in vibutils.c file dialog
 
108
*
 
109
* Revision 6.48  2002/05/07 16:50:14  bazhin
 
110
* Changes in Nlm_SetWindowConfigureCallback().
 
111
*
 
112
* Revision 6.47  2002/04/30 18:25:12  bazhin
 
113
* Added function "Nlm_SetWindowConfigureCallback(WindoW w)", which
 
114
* allows to catch events, when window just moved without resizing.
 
115
* Fixed some "gcc -Wall -ansi" warnings.
 
116
*
 
117
* Revision 6.46  2002/03/28 13:30:28  kans
 
118
* check for OS_UNIX_DARWIN before including MoreCarbonAccessors.h, Profiler.h (EN)
 
119
*
 
120
* Revision 6.45  2002/03/18 16:55:19  kans
 
121
* ProfilerInit stackDepth parameter to 50
 
122
*
 
123
* Revision 6.44  2002/03/18 16:33:53  kans
 
124
* ProfilerInit numFunctions parameter to 1000
 
125
*
40
126
* Revision 6.43  2001/11/26 21:25:04  juran
41
127
* Define type AERefCon as SInt32 for AE handler prototypes.
42
128
* It may need to be UInt32 for pre-3.4 Universal Interfaces under Carbon, or something.
579
665
#include <vibprocs.h>
580
666
#include <vibincld.h>
581
667
 
 
668
#include <connect/ncbi_core_c.h>
 
669
 
582
670
#ifdef WIN_MAC
583
671
#include <Appearance.h>
584
672
#include <Navigation.h>
 
673
#if __profile__
585
674
#include <Profiler.h>
586
 
# include "MoreCarbonAccessors.h"
 
675
#endif
 
676
#include "MoreCarbonAccessors.h"
587
677
#endif
588
678
 
589
679
#if defined(WIN_MOTIF) && defined(_DEBUG) && !defined(__hpux)
601
691
#endif
602
692
#endif
603
693
 
 
694
#ifdef WIN_MAC
 
695
/* imported from vibutils.c, not in the header files. rsmith */
 
696
extern void Nlm_ConvertFilename ( FSSpec *fss, Nlm_CharPtr filename );
 
697
#endif
604
698
 
605
699
#ifdef WIN_MAC
606
700
#ifndef Nlm_WindowTool
647
741
#endif
648
742
#endif
649
743
 
 
744
typedef enum {
 
745
  USE_FULL_SCREEN = 1,
 
746
  USE_LEFT_SCREEN,
 
747
  USE_RIGHT_SCREEN,
 
748
  USE_PRIMARY_MONITOR
 
749
} Nlm_ScreenMode;
 
750
 
 
751
static Nlm_ScreenMode Nlm_screenMode = USE_FULL_SCREEN;
 
752
 
650
753
typedef  struct  Nlm_shelldata {
651
754
  struct Nlm_shelldata PNTR next;
652
755
  Nlm_ShellTool             shell;
677
780
  Nlm_WndFreeProc  cleanup;
678
781
  Nlm_WndActnProc  timer;
679
782
  Nlm_WindoW       modalOwner; /* esl++ to support nested modal dialogs */
 
783
  Nlm_ScreenMode   screenMode;
680
784
#ifdef WIN_MOTIF
681
785
  Visual      *visual;
682
786
  Nlm_Boolean cMap_fixed;
684
788
#ifdef WIN_MSWIN
685
789
  Nlm_Uint4        style;
686
790
  Nlm_Uint4        ex_style;
 
791
  Nlm_Handle       haccel;
687
792
#endif
688
793
} Nlm_WindowData;
689
794
 
715
820
AEEventHandlerUPP HandleAEAnswerPtr;
716
821
#endif
717
822
typedef SInt32 AERefCon;
718
 
//typedef UInt32 AERefCon;
 
823
/* typedef UInt32 AERefCon; */
719
824
#endif
720
825
 
721
826
#ifdef WIN_MSWIN
804
909
static Nlm_Char      windowclass [32];
805
910
static int           discard_count = 0;
806
911
static Nlm_Boolean   handlechar;
 
912
BOOLEAN Nlm_hasBackColor = FALSE;
 
913
COLORREF Nlm_crBackColor = 0;
 
914
HBRUSH Nlm_hbrWindowBackground = NULL;
807
915
#endif
808
916
 
809
917
#ifdef WIN_MOTIF
889
997
    wdptr->cleanup = cln;
890
998
    wdptr->timer = tmr;
891
999
    wdptr->modalOwner = NULL; /* esl++ */
 
1000
    wdptr->screenMode = Nlm_screenMode; /* jk */
892
1001
#ifdef WIN_MOTIF
893
1002
    wdptr->visual = NULL;
894
1003
    wdptr->cMap_fixed = FALSE;
1161
1270
  return rsult;
1162
1271
}
1163
1272
 
 
1273
static void Nlm_SetScreenMode (Nlm_WindoW w, Nlm_ScreenMode screenMode)
 
1274
 
 
1275
{
 
1276
  Nlm_WindowData  wdata;
 
1277
 
 
1278
  if (w != NULL) {
 
1279
    Nlm_GetWindowData (w, &wdata);
 
1280
    wdata.screenMode = screenMode;
 
1281
    Nlm_SetWindowData (w, &wdata);
 
1282
  }
 
1283
}
 
1284
 
 
1285
static Nlm_ScreenMode Nlm_GetScreenMode (Nlm_WindoW w)
 
1286
 
 
1287
{
 
1288
  Nlm_ScreenMode  rsult;
 
1289
  Nlm_WindowData  wdata;
 
1290
 
 
1291
  rsult = USE_FULL_SCREEN;
 
1292
  if (w != NULL) {
 
1293
    Nlm_GetWindowData (w, &wdata);
 
1294
    rsult = wdata.screenMode;
 
1295
  }
 
1296
  return rsult;
 
1297
}
 
1298
 
1164
1299
extern Nlm_WindoW Nlm_GetParentWindow (Nlm_GraphiC a)
1165
1300
 
1166
1301
{
1511
1646
        unsigned long  plane_m[1];
1512
1647
        unsigned long  pixels[256];
1513
1648
        int defaultdepth;
1514
 
        Boolean testvisual;
1515
1649
 
1516
1650
        defaultdepth = DefaultDepth(Nlm_currentXDisplay,
1517
1651
                  DefaultScreen(Nlm_currentXDisplay));
2110
2244
 
2111
2245
  if (wptr != NULL) {
2112
2246
    GetPortVisibleRegion(GetWindowPort(wptr), Nlm_updateRgn);
2113
 
    //HLock ((Handle) Nlm_updateRgn);
 
2247
    /* HLock ((Handle) Nlm_updateRgn); */
2114
2248
    GetRegionBounds(Nlm_updateRgn, &bounds);
2115
2249
    Nlm_RectToolToRecT (&bounds, &Nlm_updateRect);
2116
 
    //HUnlock ((Handle) Nlm_updateRgn);
 
2250
    /* HUnlock ((Handle) Nlm_updateRgn); */
2117
2251
  }
2118
2252
}
2119
2253
#endif
2755
2889
  Nlm_GetWindowData(w, &wdata);
2756
2890
  wdata.style    = style;
2757
2891
  wdata.ex_style = ex_style;
 
2892
  wdata.haccel   = 0;
2758
2893
  Nlm_SetWindowData(w, &wdata);
2759
2894
  }}
2760
2895
#endif
3005
3140
  Nlm_Update ();
3006
3141
}
3007
3142
 
 
3143
NLM_EXTERN void Nlm_UseFullScreen (void)
 
3144
 
 
3145
{
 
3146
  Nlm_screenMode = USE_FULL_SCREEN;
 
3147
}
 
3148
 
 
3149
NLM_EXTERN void Nlm_UseLeftScreen (void)
 
3150
 
 
3151
{
 
3152
  Nlm_screenMode = USE_LEFT_SCREEN;
 
3153
}
 
3154
 
 
3155
NLM_EXTERN void Nlm_UseRightScreen (void)
 
3156
 
 
3157
{
 
3158
  Nlm_screenMode = USE_RIGHT_SCREEN;
 
3159
}
 
3160
 
 
3161
NLM_EXTERN void Nlm_UsePrimaryMonitor (void)
 
3162
 
 
3163
{
 
3164
  Nlm_screenMode = USE_PRIMARY_MONITOR;
 
3165
}
 
3166
 
 
3167
NLM_EXTERN Nlm_Boolean Nlm_HasDualScreen (void)
 
3168
 
 
3169
{
 
3170
#if(WINVER >= 0x0500)
 
3171
  int num_monitors  = (Nlm_Int2)GetSystemMetrics (SM_CMONITORS);
 
3172
  if (num_monitors == 2) {
 
3173
    return TRUE;
 
3174
  }
 
3175
  return FALSE;
 
3176
#else
 
3177
  if (screenBitBounds.right > 2000 && screenBitBounds.bottom < 800) {
 
3178
    return TRUE;
 
3179
  } else if (screenBitBounds.right > 2500 && screenBitBounds.bottom < 1100) {
 
3180
    return TRUE;
 
3181
  }
 
3182
  return FALSE;
 
3183
#endif
 
3184
}
 
3185
 
3008
3186
/* esl: extraWidth parameter added */
3009
3187
static void Nlm_ResizeWindow (Nlm_GraphiC w, Nlm_Int2 dragHeight,
3010
3188
                              Nlm_Int2 scrollWidth, Nlm_Int2 minWidth,
3020
3198
  Nlm_RecT        r;
3021
3199
  Nlm_Int4        rleft;
3022
3200
  Nlm_Int4        rtop;
 
3201
  Nlm_ScreenMode  screenMode;
3023
3202
  Nlm_Int4        toppix;
3024
3203
  Nlm_WindowTool  wptr;
3025
3204
#ifdef WIN_MOTIF
3062
3241
      height = r.bottom + extraHeight;
3063
3242
    if (r.left < 0)
3064
3243
      {
3065
 
        free = screenBitBounds.right - width;
3066
 
        rleft = (Nlm_Int4)r.left;
3067
 
        leftpix = free * (-rleft) / 100;
3068
 
        r.left = (Nlm_Int2)leftpix;
 
3244
#if(WINVER >= 0x0500)
 
3245
        if (Nlm_HasDualScreen ()) {
 
3246
          screenMode = Nlm_GetScreenMode ((Nlm_WindoW) w);
 
3247
          if (screenMode == USE_PRIMARY_MONITOR) {
 
3248
            free = (screenBitBounds.right - screenBitBounds.left) / 2 - width;
 
3249
            rleft = (Nlm_Int4)r.left;
 
3250
            leftpix = free * (-rleft) / 100;
 
3251
            r.left = (Nlm_Int2)leftpix;
 
3252
          } else if (screenMode == USE_LEFT_SCREEN) {
 
3253
            free = (screenBitBounds.right - screenBitBounds.left) / 2 - width;
 
3254
            rleft = (Nlm_Int4)r.left;
 
3255
            leftpix = free * (-rleft) / 100;
 
3256
            r.left = (Nlm_Int2)leftpix + screenBitBounds.left;
 
3257
          } else if (screenMode == USE_RIGHT_SCREEN) {
 
3258
            free = (screenBitBounds.right - screenBitBounds.left) / 2 - width;
 
3259
            rleft = (Nlm_Int4)r.left;
 
3260
            leftpix = free * (-rleft) / 100;
 
3261
            r.left = (Nlm_Int2)leftpix + screenBitBounds.left;
 
3262
            r.left += (screenBitBounds.right - screenBitBounds.left) / 2;
 
3263
          } else {
 
3264
            free = (screenBitBounds.right - screenBitBounds.left) - width;
 
3265
            rleft = (Nlm_Int4)r.left;
 
3266
            leftpix = free * (-rleft) / 100;
 
3267
            r.left = (Nlm_Int2)leftpix + screenBitBounds.left;
 
3268
          }
 
3269
        } else {
 
3270
          free = screenBitBounds.right - width;
 
3271
          rleft = (Nlm_Int4)r.left;
 
3272
          leftpix = free * (-rleft) / 100;
 
3273
          r.left = (Nlm_Int2)leftpix;
 
3274
        }
 
3275
#else
 
3276
        if (Nlm_HasDualScreen ()) {
 
3277
          screenMode = Nlm_GetScreenMode ((Nlm_WindoW) w);
 
3278
          if (screenMode == USE_LEFT_SCREEN) {
 
3279
            free = screenBitBounds.right / 2 - width;
 
3280
            rleft = (Nlm_Int4)r.left;
 
3281
            leftpix = free * (-rleft) / 100;
 
3282
            r.left = (Nlm_Int2)leftpix;
 
3283
          } else if (screenMode == USE_RIGHT_SCREEN) {
 
3284
            free = screenBitBounds.right / 2 - width;
 
3285
            rleft = (Nlm_Int4)r.left;
 
3286
            leftpix = free * (-rleft) / 100;
 
3287
            r.left = (Nlm_Int2)leftpix;
 
3288
            r.left += screenBitBounds.right / 2;
 
3289
          } else {
 
3290
            free = screenBitBounds.right - width;
 
3291
            rleft = (Nlm_Int4)r.left;
 
3292
            leftpix = free * (-rleft) / 100;
 
3293
            r.left = (Nlm_Int2)leftpix;
 
3294
          }
 
3295
        } else {
 
3296
          free = screenBitBounds.right - width;
 
3297
          rleft = (Nlm_Int4)r.left;
 
3298
          leftpix = free * (-rleft) / 100;
 
3299
          r.left = (Nlm_Int2)leftpix;
 
3300
        }
 
3301
#endif
3069
3302
      }
3070
3303
    if (r.top < 0)
3071
3304
      {
3332
3565
  }
3333
3566
}
3334
3567
 
 
3568
#if defined(LESSTIF_VERSION)
 
3569
 
 
3570
static void FixVisibilityIssues (Nlm_GraphiC g)
 
3571
{
 
3572
  Nlm_GraphiC child;
 
3573
 
 
3574
  for (child = Nlm_GetChild (g);  child != NULL; child = Nlm_GetNext (child))
 
3575
  {
 
3576
    if (!Nlm_GetVisible (child))
 
3577
    {
 
3578
      Nlm_Show (child);
 
3579
      FixVisibilityIssues (child);
 
3580
      Nlm_Hide (child);
 
3581
    }
 
3582
    else
 
3583
    {
 
3584
      FixVisibilityIssues (child);
 
3585
    }
 
3586
  }
 
3587
}
 
3588
#endif
 
3589
 
3335
3590
extern void Nlm_RealizeWindow (Nlm_WindoW w)
3336
3591
 
3337
3592
{
3338
3593
  if (w != NULL) {
3339
3594
    Nlm_DoShow ((Nlm_GraphiC) w, FALSE, TRUE);
3340
3595
  }
 
3596
 
 
3597
#if defined(LESSTIF_VERSION)
 
3598
  FixVisibilityIssues ((Nlm_GraphiC) w);
 
3599
#endif
3341
3600
}
3342
3601
 
3343
3602
extern void Nlm_IconifyWindow(Nlm_WindoW w)
3887
4146
    
3888
4147
    if (TrackBox (wptr, ptool, windowLoc)) {
3889
4148
      Rect bounds;
3890
 
      // WindowPeek::dataHandle is not supported under Carbon.
 
4149
      /* WindowPeek::dataHandle is not supported under Carbon. */
3891
4150
#if OPAQUE_TOOLBOX_STRUCTS
3892
4151
      ZoomWindowIdeal(wptr, part, &idealSize);
3893
4152
#else
4166
4425
  return TRUE;
4167
4426
}
4168
4427
 
4169
 
// 2001-03-22:  Joshua Juran
4170
 
// SystemClick() is not supported in Carbon.  It's unnecessary.
 
4428
/* 2001-03-22:  Joshua Juran
 
4429
 * SystemClick() is not supported in Carbon.  It's unnecessary.
 
4430
 */
4171
4431
#if TARGET_API_MAC_CARBON
4172
4432
# define SystemClick(event, window)
4173
4433
#endif
4654
4914
{
4655
4915
  Nlm_GraphiC  p;
4656
4916
  Nlm_GraphiC  q;
 
4917
  Nlm_GraphiC  n;
4657
4918
 
4658
4919
  q = NULL;
4659
4920
  p = Nlm_GetChild (w);
4660
4921
  while (p != NULL && q == NULL) {
 
4922
    n = Nlm_GetNext (p);
4661
4923
    q = Nlm_DoGainFocus (p, ch, savePort);
4662
 
    p = Nlm_GetNext (p);
 
4924
    p = n;
4663
4925
  }
4664
4926
  return q;
4665
4927
}
5179
5441
  return noErr;
5180
5442
}
5181
5443
 
 
5444
#if 0
5182
5445
/* AppleEvent handlers modified from Roger Sayle's RasMol code */
5183
5446
static void ConvertFilename ( FSSpec *fss, Nlm_CharPtr filename )
5184
5447
 
5213
5476
    *dst++ = fss->name [i];
5214
5477
  *dst = '\0';
5215
5478
}
 
5479
#endif
5216
5480
 
5217
5481
static pascal OSErr HandleAEOpenDoc (const AppleEvent *event, AppleEvent *reply, AERefCon ref)
5218
5482
 
5248
5512
                        &dtype, (Ptr) &fss, sizeof (fss),
5249
5513
                        &size);
5250
5514
    if ( !stat ) {   
5251
 
      ConvertFilename (&fss, filename);
 
5515
      Nlm_ConvertFilename (&fss, filename);
5252
5516
 
5253
5517
      if (registeredDropProc != NULL) {
5254
5518
        registeredDropProc (filename);
5309
5573
                        &dtype, (Ptr) &fss, sizeof (fss),
5310
5574
                        &size);
5311
5575
    if ( !stat ) {   
5312
 
      ConvertFilename (&fss, filename);
 
5576
      Nlm_ConvertFilename (&fss, filename);
5313
5577
      if (registeredResultProc != NULL) {
5314
5578
        registeredResultProc (filename);
5315
5579
        Nlm_FileRemove (filename); /* ? */
5373
5637
      mess = (Nlm_currentEvent.message & osEvtMessageMask) >> 24;
5374
5638
      if (mess == suspendResumeMessage) {
5375
5639
        if (Nlm_currentEvent.message & resumeFlag) {
5376
 
          // Resume
 
5640
          /* Resume */
5377
5641
#if !TARGET_API_MAC_CARBON
5378
5642
          if (Nlm_currentEvent.message & convertClipboardFlag) {
5379
 
            // 2001-05-14:  JDJ
5380
 
            // We always convert the clipboard.
5381
 
            // If it turns out that pasting is noticeably slow, I'll change it.
 
5643
            /* 2001-05-14:  JDJ
 
5644
             * We always convert the clipboard.
 
5645
             * If it turns out that pasting is noticeably slow, I'll change it.
 
5646
             */
5382
5647
          }
5383
5648
#endif
5384
5649
        } else {
5385
 
          // Suspend
 
5650
          /* Suspend
 
5651
           */
5386
5652
        }
5387
5653
      } else if (mess == mouseMovedMessage) {
5388
5654
        if (mouseMovedAction != NULL) {
5400
5666
        Nlm_DoDeactivate ((Nlm_GraphiC) Nlm_theWindow, FALSE);
5401
5667
      }
5402
5668
      break;
5403
 
// 2001-03-22:  Joshua Juran
5404
 
// Carbon doesn't support DIBadMount() and will not send diskEvt in the first place.
 
5669
/* 2001-03-22:  Joshua Juran
 
5670
 * Carbon doesn't support DIBadMount() and will not send diskEvt in the first place.
 
5671
 */
5405
5672
#if !TARGET_API_MAC_CARBON
5406
5673
    case diskEvt:
5407
5674
      if (HiWord (Nlm_currentEvent.message) != 0) {
5743
6010
    case WM_CTLCOLORLISTBOX:
5744
6011
    case WM_CTLCOLOREDIT:
5745
6012
      {
5746
 
              SetBkColor((HDC)wParam, RGB(255, 255, 255));
5747
 
              mainwndrsult = (long)GetStockObject( WHITE_BRUSH );
 
6013
              if(Nlm_hasBackColor)
 
6014
              {
 
6015
                SetBkColor((HDC)wParam, Nlm_crBackColor);
 
6016
                mainwndrsult = (long)Nlm_hbrWindowBackground;
 
6017
              }
 
6018
              else
 
6019
              {
 
6020
                SetBkColor((HDC)wParam, RGB(255, 255, 255));
 
6021
                mainwndrsult = (long)GetStockObject( WHITE_BRUSH );
 
6022
              }
 
6023
              break;
 
6024
      }
 
6025
    case WM_CTLCOLORDLG:
 
6026
    case WM_CTLCOLORBTN:
 
6027
      {
 
6028
              if(Nlm_hasBackColor)
 
6029
              {
 
6030
                SetBkColor((HDC)wParam, Nlm_crBackColor);
 
6031
                mainwndrsult = (long)Nlm_hbrWindowBackground;
 
6032
              }
 
6033
              else
 
6034
                mainwndrsult = DefWindowProc (hwnd, message, wParam, lParam);
5748
6035
              break;
5749
6036
      }
5750
6037
#else
5831
6118
  wc.hInstance = Nlm_currentHInst;
5832
6119
  wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
5833
6120
  wc.hCursor = NULL;
5834
 
  wc.hbrBackground = CreateSolidBrush( GetSysColor(COLOR_ACTIVEBORDER) );
 
6121
  wc.hbrBackground = Nlm_hasBackColor ?
 
6122
                       CreateSolidBrush( Nlm_crBackColor ) :
 
6123
                       CreateSolidBrush( GetSysColor(COLOR_ACTIVEBORDER) );
5835
6124
  wc.lpszMenuName = NULL;
5836
6125
  sprintf (windowclass, "Nlm_WindowClass%ld", (long) (int) Nlm_currentHInst);
5837
6126
  wc.lpszClassName = windowclass;
5840
6129
}
5841
6130
 
5842
6131
 
 
6132
#include "vibrgb.h"
 
6133
 
 
6134
 
 
6135
static Nlm_RGBName* Nlm_FindRGBName(const Nlm_Char* name)
 
6136
 
 
6137
{
 
6138
  Nlm_RGBName* p;
 
6139
  for(p = RGBNames; p->name; ++p) {
 
6140
    if (StringICmp(p->name, name) == 0)
 
6141
      return p;
 
6142
  }
 
6143
 
 
6144
  return NULL;
 
6145
}
 
6146
 
 
6147
 
 
6148
static void Nlm_ParseXArguments(int* argc, char** argv)
 
6149
 
 
6150
{
 
6151
  int i, j;
 
6152
 
 
6153
  if (argc == 0 || argv == NULL)
 
6154
    return;
 
6155
 
 
6156
  for(i = 0, j = 0; i < *argc; ) {
 
6157
    if (StringCmp(argv[i], "-bg") == 0 && argv[i+1] != NULL) {
 
6158
      Nlm_RGBName* p = Nlm_FindRGBName(argv[i+1]);
 
6159
      if (p != NULL) {
 
6160
        /* Set user-defined background color */
 
6161
        Nlm_hasBackColor = TRUE;
 
6162
        Nlm_crBackColor = RGB(p->red, p->green, p->blue);
 
6163
        Nlm_hbrWindowBackground = CreateSolidBrush( Nlm_crBackColor );
 
6164
        i += 2;
 
6165
        continue;
 
6166
      }
 
6167
    }
 
6168
    argv[j++] = argv[i++];
 
6169
  }
 
6170
  *argc = j;
 
6171
}
 
6172
 
 
6173
 
5843
6174
static Nlm_Boolean Nlm_SetupWindows (void)
5844
6175
 
5845
6176
{
5849
6180
  Nlm_RecT   r;
5850
6181
  Nlm_Int2   width;
5851
6182
 
 
6183
  int        xx_argc = (int)Nlm_GetArgc();
 
6184
  char     **xx_argv =      Nlm_GetArgv();
 
6185
 
 
6186
  /*
 
6187
    Using SM_CXVIRTUALSCREEN to accomodate dual monitors effectively limits target platform 
 
6188
    to Windows2000 or later (i.e. Win95/98/ME are NOT supported).
 
6189
    In order to use these identifiers, must define WINVER=0x0500.
 
6190
  */
 
6191
#if(WINVER >= 0x0500)
 
6192
  int x = (Nlm_Int2)GetSystemMetrics (SM_XVIRTUALSCREEN);
 
6193
  int y = (Nlm_Int2)GetSystemMetrics (SM_YVIRTUALSCREEN);
 
6194
  width  = (Nlm_Int2)GetSystemMetrics (SM_CXVIRTUALSCREEN);
 
6195
  height = (Nlm_Int2)GetSystemMetrics (SM_CYVIRTUALSCREEN);
 
6196
  Nlm_LoadRect (&screenBitBounds, x, y, x+width, y+height);
 
6197
  Nlm_LoadPt (&pt, x, y);
 
6198
#else
5852
6199
  width  = (Nlm_Int2)GetSystemMetrics (SM_CXSCREEN);
5853
6200
  height = (Nlm_Int2)GetSystemMetrics (SM_CYSCREEN);
5854
6201
  Nlm_LoadRect (&screenBitBounds, 0, 0, width, height);
5855
6202
  Nlm_LoadPt (&pt, 0, 0);
 
6203
#endif
5856
6204
  r = screenBitBounds;
5857
6205
  Nlm_screenRect = screenBitBounds;
5858
6206
  Nlm_desktopWindow = (Nlm_WindoW) Nlm_HandNew (sizeof (Nlm_WindowRec));
5867
6215
  Nlm_currentWindowTool = (Nlm_WindowTool) 0;
5868
6216
  quitProgram = FALSE;
5869
6217
  
 
6218
  Nlm_ParseXArguments(&xx_argc, xx_argv);
 
6219
  Nlm_SetupArguments(xx_argc, xx_argv);
 
6220
 
5870
6221
  Nlm_SetUpDrawingTools ();
5871
6222
 
5872
6223
  Nlm_hScrollBarHeight = (Nlm_Int2)GetSystemMetrics (SM_CYHSCROLL);
5995
6346
  Nlm_Int4   width;
5996
6347
  int        xx_argc = (int)Nlm_GetArgc();
5997
6348
  char     **xx_argv =      Nlm_GetArgv();
 
6349
  XmFontListEntry font_entry;
5998
6350
 
5999
6351
  Nlm_desktopWindow = NULL;
6000
6352
  Nlm_systemWindow = NULL;
6117
6469
  
6118
6470
  font = Nlm_XLoadStandardFont();
6119
6471
 
6120
 
  Nlm_XfontList = XmFontListCreate(font, "dummy");
 
6472
  font_entry = XmFontListEntryCreate  ("dummy", XmFONT_IS_FONT, font);
 
6473
  Nlm_XfontList = XmFontListAppendEntry(NULL, font_entry);
6121
6474
 
6122
6475
  Nlm_fileDialogShell = NULL;
6123
6476
 
6278
6631
{
6279
6632
/* p_churchill removed conditional compilation for Think C and MPW 12/99
6280
6633
 */
6281
 
#ifdef OS_MAC
 
6634
/* #ifdef OS_MAC */
 
6635
#ifdef WIN_MAC
6282
6636
  KeyMap  keys;
6283
6637
 
6284
6638
  GetKeys (keys);
6351
6705
#endif
6352
6706
}
6353
6707
 
 
6708
extern Nlm_Int2 Nlm_Main(void) __attribute__((weak));
 
6709
 
6354
6710
#ifdef WIN_MAC
 
6711
#ifdef OS_UNIX_DARWIN
 
6712
int main (int argc, char *argv[]) 
 
6713
{
 
6714
  long gval;
 
6715
  OSErr  err;
 
6716
 
 
6717
  Nlm_SetupArguments (argc, argv);
 
6718
# else /* ! OS_UNIX_DARWIN */
6355
6719
void main ()
6356
6720
{
6357
6721
  long gval;
6358
6722
  OSErr  err;
 
6723
# endif
6359
6724
 
6360
6725
#if __profile__
6361
 
  ProfilerInit (collectDetailed, bestTimeBase, 100, 20);
 
6726
  ProfilerInit (collectDetailed, bestTimeBase, 1000, 50);
6362
6727
  ProfilerSetStatus (FALSE);
6363
6728
#endif
6364
6729
 
6365
6730
#if TARGET_API_MAC_CARBON >= 1
6366
 
  // carbon changes the API: pass the number of master pointers to allocate
6367
 
  //MoreMasters (1280);
6368
 
  // 2001-03-22:  Joshua Juran
6369
 
  // CarbonDater report says to use MoreMasterPointers() instead of MoreMasters().
6370
 
  // Universal Interfaces 3.3.2 declares MoreMasters(void) under Carbon.
 
6731
  /*
 
6732
   carbon changes the API: pass the number of master pointers to allocate
 
6733
   MoreMasters (1280);
 
6734
   2001-03-22:  Joshua Juran
 
6735
   CarbonDater report says to use MoreMasterPointers() instead of MoreMasters().
 
6736
   Universal Interfaces 3.3.2 declares MoreMasters(void) under Carbon.
 
6737
  */
6371
6738
  MoreMasterPointers(1280);
6372
6739
  FlushEvents (everyEvent, 0);
6373
 
  // the rest of the toolbox is done for us can't init them...
 
6740
  /* the rest of the toolbox is done for us can't init them...
 
6741
   */
6374
6742
#else
6375
6743
  MaxApplZone ();
6376
6744
  if (1) {
6438
6806
  Nlm_RegisterWindows ();
6439
6807
  Nlm_RegisterTexts ();
6440
6808
  Nlm_RegisterSlates ();
 
6809
#ifndef OS_UNIX_DARWIN
6441
6810
  Nlm_SetupArguments(0, NULL);
 
6811
#endif
6442
6812
  Nlm_GetReady ();
6443
6813
 
6444
 
  // There is no need to initialize the TE private scrap because
6445
 
  // we never assume it's current.
 
6814
  /* Initialize connection library's logger, registry and lock */
 
6815
  CONNECT_Init(0);
 
6816
 
 
6817
  /* There is no need to initialize the TE private scrap because
 
6818
   * we never assume it's current.
 
6819
   */
6446
6820
 
6447
6821
  Nlm_Main ();
6448
6822
 
6495
6869
#endif
6496
6870
 
6497
6871
  Nlm_currentHInst = hInstance;
 
6872
  ParseSetupArguments(Nlm_currentHInst, StringSave(lpszCmdLine));
6498
6873
 
6499
6874
  Nlm_InitVibrantHooks ();
6500
6875
 
6524
6899
  }
6525
6900
 
6526
6901
 
6527
 
  ParseSetupArguments(Nlm_currentHInst, StringSave(lpszCmdLine));
6528
6902
  Nlm_GetReady ();
6529
6903
 
 
6904
  /* Initialize connection library's logger, registry and lock */
 
6905
  CONNECT_Init(0);
 
6906
 
6530
6907
  Nlm_Main ();
6531
6908
 
6532
6909
  Nlm_CleanUpWindows ();
6547
6924
 
6548
6925
  sprintf (str, "Nlm_WindowClass%ld", (long) (int) Nlm_currentHInst);
6549
6926
  if (GetClassInfo (Nlm_currentHInst, str, &wc)) {
6550
 
    DeleteObject (wc.hbrBackground);
 
6927
    /* WNDCLASS description says application should not destroy background brush */
 
6928
    /* DeleteObject (wc.hbrBackground); */
6551
6929
  }
6552
6930
  UnregisterClass (str, Nlm_currentHInst);
6553
6931
  sprintf (str, "Nlm_SlateClass%ld", (long) (int) Nlm_currentHInst);
6621
6999
  Nlm_RegisterSlates ();
6622
7000
 
6623
7001
  Nlm_GetReady ();
6624
 
  retval = Nlm_Main ();
 
7002
 
 
7003
  /* Initialize connection library's logger, registry and lock */
 
7004
  CONNECT_Init(0);
 
7005
 
 
7006
  if (Nlm_Main) {
 
7007
    retval = Nlm_Main();
 
7008
  } else {
 
7009
    ErrPost(0, 0, "Neither main nor Nlm_Main defined by program.");
 
7010
    retval = -1;
 
7011
  }
6625
7012
 
6626
7013
  Nlm_CleanUpWindows ();
6627
7014
  Nlm_CleanUpDrawingTools ();
6764
7151
    Nlm_currentWindowTool = GetWindowFromPort(tempPort);
6765
7152
    Nlm_SetUpdateRegion (GetWindowFromPort(tempPort));
6766
7153
    SetPenState (&state);
6767
 
    // 2001-03-22:  Joshua Juran
6768
 
    // Carbon does not support application-supplied storage for windows.
 
7154
    /* 2001-03-22:  Joshua Juran
 
7155
       Carbon does not support application-supplied storage for windows. */
6769
7156
    DisposeWindow(wptr);
6770
7157
#endif
6771
7158
#ifdef WIN_MSWIN
6773
7160
      DeleteObject( wdata.cMap );
6774
7161
      wdata.cMap = NULL;
6775
7162
    }
 
7163
    if ( wdata.haccel != NULL ){
 
7164
      DestroyAcceleratorTable(wdata.haccel);
 
7165
      wdata.haccel = NULL;
 
7166
    }
6776
7167
    Nlm_currentHDC = tempPort;
6777
7168
    RemoveProp (wptr, (LPSTR) "Nlm_VibrantProp");
6778
7169
    DestroyWindow (wptr);
6888
7279
static void Nlm_ProcessKeyPress (LPMSG lpMsg)
6889
7280
 
6890
7281
{
6891
 
  Nlm_Char  ch;
 
7282
  Nlm_Char  ch, sp_ch;
 
7283
  
 
7284
  if (keyAction == NULL) return;
6892
7285
 
6893
 
  if (lpMsg->message == WM_CHAR) {
6894
 
    ch = (Nlm_Char) lpMsg->wParam;
6895
 
    if (keyAction != NULL) {
6896
 
      keyAction (ch);
 
7286
  ch = (Nlm_Char) lpMsg->wParam;
 
7287
  if (lpMsg->message == WM_CHAR) 
 
7288
  {
 
7289
    keyAction (ch);
 
7290
  }
 
7291
  else if (lpMsg->message == WM_KEYDOWN)
 
7292
  {
 
7293
    sp_ch = Nlm_KeydownToChar (ch);
 
7294
    if (sp_ch != 0)
 
7295
    {
 
7296
          keyAction (sp_ch);    
6897
7297
    }
6898
7298
  }
6899
7299
}
6903
7303
static void Nlm_ProcessKeyPress (XEvent *event)
6904
7304
 
6905
7305
{
6906
 
  Nlm_Char buffer[2];
6907
 
 
6908
 
  if (event->type == KeyPress  &&  keyAction != NULL  &&
6909
 
      XLookupString(&event->xkey, buffer, sizeof(buffer), NULL, NULL) == 1)
6910
 
    keyAction( *buffer );
 
7306
  Nlm_Char ch;
 
7307
 
 
7308
  if (event->type == KeyPress  &&  keyAction != NULL)
 
7309
  {
 
7310
    ch = Nlm_GetInputChar (&event->xkey);
 
7311
    Nlm_ctrlKey  = ((event->xkey.state & ControlMask) != 0);
 
7312
    Nlm_shftKey  = ((event->xkey.state & ShiftMask  ) != 0);
 
7313
    Nlm_cmmdKey = FALSE;
 
7314
    Nlm_optKey = FALSE;
 
7315
    keyAction( ch );
 
7316
  }
 
7317
}
 
7318
#endif
 
7319
 
 
7320
#ifdef WIN_MSWIN
 
7321
 
 
7322
typedef void (LIBCALLBACK *CallbackProc)(void* data);
 
7323
static UINT idWMVibrantCallback = 0;
 
7324
 
 
7325
static void Nlm_InitVibrantCallback ()
 
7326
 
 
7327
{
 
7328
    idWMVibrantCallback = RegisterWindowMessage("VibrantCallback");
 
7329
}
 
7330
 
 
7331
 
 
7332
static Nlm_Boolean Nlm_ProcessVibrantCallback (LPMSG lpMsg)
 
7333
 
 
7334
{
 
7335
    if(idWMVibrantCallback && idWMVibrantCallback == lpMsg->message)
 
7336
    {
 
7337
        CallbackProc proc = (CallbackProc)lpMsg->wParam;
 
7338
        proc((void*)(lpMsg->lParam));
 
7339
        return TRUE;
 
7340
    }
 
7341
    else
 
7342
        return FALSE;
 
7343
}
 
7344
#endif
 
7345
 
 
7346
#ifdef WIN_MSWIN
 
7347
 
 
7348
extern Nlm_Handle Nlm_GetWindowHAccel (Nlm_WindoW w)
 
7349
 
 
7350
{
 
7351
  Nlm_Handle      rsult;
 
7352
  Nlm_WindowData  wdata;
 
7353
 
 
7354
  rsult = (Nlm_Handle) 0;
 
7355
  if (w != NULL) {
 
7356
    Nlm_GetWindowData (w, &wdata);
 
7357
    rsult = wdata.haccel;
 
7358
  }
 
7359
  return rsult;
 
7360
}
 
7361
 
 
7362
 
 
7363
extern void Nlm_SetWindowHAccel (Nlm_WindoW w, Nlm_Handle h)
 
7364
 
 
7365
{
 
7366
  Nlm_WindowData  wdata;
 
7367
 
 
7368
  if (w != NULL) {
 
7369
    Nlm_GetWindowData (w, &wdata);
 
7370
    wdata.haccel = h;
 
7371
    Nlm_SetWindowData (w, &wdata);
 
7372
  }
 
7373
}
 
7374
 
 
7375
 
 
7376
static Nlm_Boolean Nlm_ProcessAccelerator (LPMSG lpMsg)
 
7377
 
 
7378
{
 
7379
    if(lpMsg->hwnd != NULL &&
 
7380
       (lpMsg->message == WM_KEYDOWN ||
 
7381
        lpMsg->message == WM_KEYUP ||
 
7382
        lpMsg->message == WM_SYSKEYDOWN ||
 
7383
        lpMsg->message == WM_SYSKEYUP ||
 
7384
        lpMsg->message == WM_CHAR))
 
7385
    {
 
7386
        Nlm_WindoW w = (Nlm_WindoW) GetProp (lpMsg->hwnd, (LPSTR) "Nlm_VibrantProp");
 
7387
        if(w != NULL)
 
7388
        {
 
7389
            Nlm_WindoW p = Nlm_GetParentWindow((Nlm_GraphiC)w);
 
7390
            if(p != NULL)
 
7391
            {
 
7392
                Nlm_WindowData wdata;
 
7393
                Nlm_GetWindowData(p, &wdata);
 
7394
                if(wdata.haccel != NULL)
 
7395
                {
 
7396
                    int ret = TranslateAccelerator(wdata.handle, wdata.haccel, lpMsg);
 
7397
                    return ret != 0;
 
7398
                }
 
7399
            }
 
7400
        }
 
7401
    }
 
7402
 
 
7403
    return FALSE;
6911
7404
}
6912
7405
#endif
6913
7406
 
6926
7419
    if (GetMessage (&Nlm_currentMssg, NULL, 0, 0)) {
6927
7420
      TranslateMessage (&Nlm_currentMssg);
6928
7421
      Nlm_ProcessKeyPress (&Nlm_currentMssg);
 
7422
      Nlm_ProcessVibrantCallback(&Nlm_currentMssg);
6929
7423
      DispatchMessage (&Nlm_currentMssg);
6930
7424
    }
6931
7425
  }
6999
7493
    if (GetMessage (&Nlm_currentMssg, NULL, 0, 0)) {
7000
7494
      TranslateMessage (&Nlm_currentMssg);
7001
7495
      Nlm_ProcessKeyPress (&Nlm_currentMssg);
 
7496
      Nlm_ProcessVibrantCallback(&Nlm_currentMssg);
7002
7497
      DispatchMessage (&Nlm_currentMssg);
7003
7498
    }
7004
7499
  }
7038
7533
    if (GetMessage (&Nlm_currentMssg, NULL, 0, 0)) {
7039
7534
      TranslateMessage (&Nlm_currentMssg);
7040
7535
      Nlm_ProcessKeyPress (&Nlm_currentMssg);
 
7536
      Nlm_ProcessVibrantCallback(&Nlm_currentMssg);
7041
7537
      DispatchMessage (&Nlm_currentMssg);
7042
7538
    }
7043
7539
  }
7073
7569
  }
7074
7570
#endif
7075
7571
#ifdef WIN_MSWIN
 
7572
  Nlm_InitVibrantCallback ();
7076
7573
  if (registeredDropProc != NULL) {
7077
7574
    DragAcceptFiles(Nlm_currentHWnd, TRUE);
7078
7575
  }
7085
7582
      }
7086
7583
    }
7087
7584
    if (GetMessage (&Nlm_currentMssg, NULL, 0, 0)) {
7088
 
      TranslateMessage (&Nlm_currentMssg);
7089
 
      Nlm_ProcessKeyPress (&Nlm_currentMssg);
7090
 
      DispatchMessage (&Nlm_currentMssg);
 
7585
      if(!Nlm_ProcessAccelerator(&Nlm_currentMssg)) {
 
7586
        TranslateMessage (&Nlm_currentMssg);
 
7587
        Nlm_ProcessKeyPress (&Nlm_currentMssg);
 
7588
        Nlm_ProcessVibrantCallback(&Nlm_currentMssg);
 
7589
        DispatchMessage (&Nlm_currentMssg);
 
7590
      }
7091
7591
      Nlm_RemoveDyingWindows ();
7092
7592
    }
7093
7593
  }
7180
7680
extern void Nlm_UnloadSegment (Nlm_VoidProc routineAddr)
7181
7681
 
7182
7682
{
7183
 
#ifdef WIN_MAC
 
7683
#if defined(WIN_MAC) && !defined(OS_UNIX_DARWIN)
7184
7684
  if (routineAddr != NULL) {
7185
7685
    UnloadSeg ((void *) routineAddr);
7186
7686
  }
7503
8003
 
7504
8004
  /* Print the usage info */
7505
8005
#ifdef WIN_MOTIF
7506
 
  if (xx_argc == 2  &&  xx_argv[1][1] == '\0')
 
8006
  if (xx_argc == 2
 
8007
      &&  (xx_argv[1][1] == '\0'  ||  !strcmp(xx_argv[1], "--help")))
7507
8008
    {
7508
8009
      printf("\n%s   arguments:\n\n", progname);
7509
8010
      curarg = ap;
7579
8080
      resolved[j] = TRUE;
7580
8081
    }       
7581
8082
 
 
8083
/*
7582
8084
  silent = (Nlm_Boolean)(silent  ||  xx_argc > 1);
 
8085
*/
7583
8086
 
7584
8087
  if ( silent )
7585
8088
    {
8033
8536
  systemProcs->linkIn = Nlm_LinkIn;
8034
8537
}
8035
8538
 
 
8539
#ifdef WIN_MOTIF
 
8540
/**********************************************************/
 
8541
static void WindowStructFocusCallbackEx(Widget wd, XtPointer client_data,
 
8542
                                        XEvent *event, Boolean *contin)
 
8543
{
 
8544
    Nlm_WindowData wdata;
 
8545
    Nlm_RectTool   rtool;
 
8546
    Nlm_WindoW     w;
 
8547
    Nlm_RecT       r;
 
8548
    Window         xw;
 
8549
    Window         root;
 
8550
    Window         parent;
 
8551
    Window         child;
 
8552
    Window         *children = NULL;
 
8553
    unsigned int   nchildren;
 
8554
    int            x;
 
8555
    int            y;
 
8556
 
 
8557
    if(event->type != ConfigureNotify)
 
8558
    {
 
8559
        WindowStructFocusCallback(wd, client_data, event, contin);
 
8560
        return;
 
8561
    }
 
8562
 
 
8563
    XSetErrorHandler(ignoreXerror_handler);
 
8564
    for(xw = XtWindow(wd); xw; xw = parent)
 
8565
    {
 
8566
        if(!XQueryTree(Nlm_currentXDisplay, xw, &root, &parent, &children,
 
8567
                       &nchildren) || root == parent)
 
8568
            break;
 
8569
        XFree((char *) children);
 
8570
        children = NULL;
 
8571
    }
 
8572
    XSetErrorHandler(defaultXerror_handler);
 
8573
    if(children != NULL)
 
8574
        XFree((char *) children);
 
8575
 
 
8576
    if(root != parent)
 
8577
        return;
 
8578
 
 
8579
    w = (Nlm_WindoW) client_data;
 
8580
 
 
8581
    XTranslateCoordinates(Nlm_currentXDisplay, xw, root, (Position) 0,
 
8582
                          (Position) 0, &x, &y, &child);
 
8583
 
 
8584
    rtool.x = x;
 
8585
    rtool.y = y;
 
8586
    rtool.width = event->xconfigure.width;
 
8587
    rtool.height = event->xconfigure.height;
 
8588
    if(Nlm_GetWindowMenuBar(w) != NULL)
 
8589
        rtool.height -= Nlm_internalMenuBarHeight;
 
8590
 
 
8591
    Nlm_RectToolToRecT(&rtool, &r);
 
8592
    Nlm_SetRect((Nlm_GraphiC) w, &r);
 
8593
    Nlm_GetWindowData(w, &wdata);
 
8594
 
 
8595
    if(wdata.resize != NULL && Nlm_WindowHasBeenShown(w) &&
 
8596
       Nlm_GetVisible((Nlm_GraphiC) w))
 
8597
    {
 
8598
        wdata.resize(w);
 
8599
    }
 
8600
}
 
8601
 
 
8602
#endif
 
8603
 
 
8604
/**********************************************************/
 
8605
extern void Nlm_SetWindowConfigureCallback(Nlm_WindoW w)
 
8606
{
 
8607
#ifdef WIN_MOTIF
 
8608
    Widget wd;
 
8609
 
 
8610
    if(w == NULL)
 
8611
        return;
 
8612
 
 
8613
    wd = (Widget) Nlm_GetWindowShell(w);
 
8614
    XtRemoveEventHandler(wd, (StructureNotifyMask | FocusChangeMask), FALSE,
 
8615
                         WindowStructFocusCallback, (XtPointer) w);
 
8616
    XtAddEventHandler(wd, (StructureNotifyMask | FocusChangeMask), FALSE,
 
8617
                      WindowStructFocusCallbackEx, (XtPointer) w);
 
8618
#endif
 
8619
    return;
 
8620
}