1 /*   netentcf.c
2  * ===========================================================================
3  *
4  *                            PUBLIC DOMAIN NOTICE
5  *               National Center for Biotechnology Information
6  *
7  *  This software/database is a "United States Government Work" under the
8  *  terms of the United States Copyright Act.  It was written as part of
9  *  the author's official duties as a United States Government employee and
10  *  thus cannot be copyrighted.  This software/database is freely available
11  *  to the public for use. The National Library of Medicine and the U.S.
12  *  Government have not placed any restriction on its use or reproduction.
13  *
14  *  Although all reasonable efforts have been taken to ensure the accuracy
15  *  and reliability of the software and data, the NLM and the U.S.
16  *  Government do not and cannot warrant the performance or results that
17  *  may be obtained by using this software or data. The NLM and the U.S.
18  *  Government disclaim all warranties, express or implied, including
19  *  warranties of performance, merchantability or fitness for any particular
20  *  purpose.
21  *
22  *  Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * RCS $Id: netentcf.c,v 6.1 1998/12/08 16:52:42 kans Exp $
27  *
28  * Author:  Kans
29  *
30  * Version Creation Date:   9/10/96
31  *
32  * File Description:
33  *       Network Entrez configuration
34  *
35  * Modifications:
36  * --------------------------------------------------------------------------
37  * Date     Name        Description of modification
38  * -------  ----------  -----------------------------------------------------
39  */
40 
41 #include <vibrant.h>
42 #include <netcnfg.h>
43 
StandaloneFormMessage(ForM f,Int2 mssg)44 static void     StandaloneFormMessage (ForM f, Int2 mssg)
45 {
46   BaseFormPtr     bfp;
47 
48   bfp = (BaseFormPtr) GetObjectExtra (f);
49   if (bfp != NULL) {
50     switch (mssg) {
51       case VIB_MSG_QUIT:
52         QuitProgram ();
53         break;
54       default:
55         break;
56     }
57   }
58 }
59 
60 #ifdef WIN_MAC
61 static IteM     cutItem = NULL;
62 static IteM     copyItem = NULL;
63 static IteM     pasteItem = NULL;
64 static IteM     deleteItem = NULL;
65 
SetupMacMenus(void)66 static void     SetupMacMenus (void)
67 {
68   MenU            m;
69 
70   m = AppleMenu (NULL);
71   DeskAccGroup (m);
72 
73   m = PulldownMenu (NULL, "File");
74   FormCommandItem (m, "Quit/Q", NULL, VIB_MSG_QUIT);
75 
76   m = PulldownMenu (NULL, "Edit");
77   cutItem = FormCommandItem (m, CUT_MENU_ITEM, NULL, VIB_MSG_CUT);
78   copyItem = FormCommandItem (m, COPY_MENU_ITEM, NULL, VIB_MSG_COPY);
79   pasteItem = FormCommandItem (m, PASTE_MENU_ITEM, NULL, VIB_MSG_PASTE);
80   deleteItem = FormCommandItem (m, CLEAR_MENU_ITEM, NULL, VIB_MSG_DELETE);
81 }
82 
StandaloneFormActivated(WindoW w)83 static void     StandaloneFormActivated (WindoW w)
84 {
85   currentFormDataPtr = (VoidPtr) GetObjectExtra (w);
86   RepeatProcOnHandles (Enable,
87                    (HANDLE) cutItem, (HANDLE) copyItem,
88                    (HANDLE) pasteItem, (HANDLE) deleteItem, NULL);
89 }
90 
MacDeactProc(WindoW w)91 static void     MacDeactProc (WindoW w)
92 {
93   currentFormDataPtr = NULL;
94   RepeatProcOnHandles (Disable,
95                    (HANDLE) cutItem, (HANDLE) copyItem,
96                    (HANDLE) pasteItem, (HANDLE) deleteItem, NULL);
97 }
98 
99 #else
100 #define StandaloneFormActivated NULL
101 #endif
102 
ConfigAccepted(void)103 static void     ConfigAccepted (void)
104 {
105   QuitProgram ();
106 }
107 
ConfigCancelled(void)108 static void     ConfigCancelled (void)
109 {
110   QuitProgram ();
111 }
112 
Main(void)113 Int2 Main (void)
114 {
115   ProcessUpdatesFirst (FALSE);
116 
117 #ifdef WIN_MAC
118   SetDeactivate (NULL, MacDeactProc);
119   SetupMacMenus ();
120 #endif
121 
122   ShowNetConfigForm (StandaloneFormActivated, StandaloneFormMessage,
123                      ConfigAccepted, ConfigCancelled, NULL, FALSE);
124   ProcessEvents ();
125   return 0;
126 }
127