home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / wps / utils / pc2 / source / pc2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-31  |  19.2 KB  |  352 lines

  1. /***********************************************************************\
  2.  *                                PC2.c                                *
  3.  *                 Copyright (C) by Stangl Roman, 1993                 *
  4.  * This Code may be freely distributed, provided the Copyright isn't   *
  5.  * removed, under the conditions indicated in the documentation.       *
  6.  *                                                                     *
  7.  * PC2.h        Program Commander/2 header file.                       *
  8.  *                                                                     *
  9. \***********************************************************************/
  10.  
  11. #ifndef IPFC                            /* Don't include if we compile HLP files */
  12. #define         INCL_WIN                /* Environment include files */
  13. #define         INCL_GPI
  14. #define         INCL_DOS
  15. #define         INCL_DOSERRORS
  16. #include        <os2.h>
  17.  
  18. #include        <stdio.h>               /* C Set/2 include files */
  19. #include        <stdlib.h>
  20. #include        <string.h>
  21. #include        <ctype.h>
  22. #include        <memory.h>
  23. #endif
  24.  
  25. /*--------------------------------------------------------------------------------------*\
  26.  *                                                                                      *
  27.  * +-----+-----+-----+                                                                  *
  28.  * | www |    www========== Some windows, only two seen by the user on the display.     *
  29.  * | www |     |     |                                                                  *
  30.  * +-----+-----www---+===== Virtual Desktop (9fold-size of physical Desktop).           *
  31.  * |     | www wwww  |                                                                  *
  32.  * |  +----www | ww  |                                                                  *
  33.  * +--|ww  www-+-----+                                                                  *
  34.  * |  |ww   |============== Physical Desktop somewhere within virtual Desktop. The      *
  35.  * |  +-----+  |     |      physical Desktop is the part of the virtual Desktop which   *
  36.  * +-----+-----+-----+      the user visually can see, therefor large parts of the      *
  37.  *                          virtual Desktop can't be ssen by the user. He must use      *
  38.  * his pointing device, the slide the physical Desktop around the virtual Desktop, by   *
  39.  * moving the pointer over the surrounding rows and columns of the physical screen.     *
  40.  *                                                                                      *
  41. \*------------------------------------------------------------------------------------- */
  42.                                         /* Status bits defined for bitmapped ulMoveFlag */
  43. #define         MOVEXR          0x1     /* Set if we move all windows right (our physical
  44.                                            Desktop will move left on the virtual Desktop) */
  45. #define         MOVEXL          0x2     /* Set if we move all windows left */
  46. #define         MOVEYU          0x4     /* Set if we move all windows up (our physical
  47.                                            Desktop will move down on the virtual Desktop */
  48. #define         MOVEYD          0x8     /* Set if we move all windows down */
  49. #define         MOVED4CLICK     0x10    /* Set if we are to move all windows, but the
  50.                                            CLICK2MOVE flag is set, and therefor we require
  51.                                            a click before we really move */
  52.                                         /* Status bits defined for bitmapped ulStatusFlag */
  53. #define         SLIDINGFOCUS    0x1     /* Set if the user requested a sliding focus */
  54. #define         VIRTUALDESKTOP  0x2     /* Set if the user requested a virtual Desktop */
  55. #define         MOVEDESKTOP     0x4     /* Set if the user also wants the WPS to move */
  56. #define         CLICK2MOVE      0x8     /* Set if the user wants to click before Desktop
  57.                                            moves */
  58. #define         OVERVIEW        0x10    /* Set if the user wants an overview window */
  59.  
  60. #define         EF_SIZE60       60
  61. #define         EF_SIZE255      255
  62.  
  63.                                         /* Define an additional session type of WPS object
  64.                                            representing any object */
  65. #define         SSF_TYPE_WPSOBJECT      21
  66.  
  67. typedef struct  _SESSIONDATA            SESSIONDATA;
  68. typedef struct  _MENUDATA               MENUDATA;
  69. typedef struct  _COMMANDLINEPARAMS      COMMANDLINEPARAMS;
  70. typedef struct  _HOOKPARAMETERS         HOOKPARAMETERS;
  71. typedef void    (EXPENTRY PFFUNCPTR1)(HOOKPARAMETERS *HookParameters);
  72. typedef void    (EXPENTRY PFFUNCPTR2)(HOOKPARAMETERS *HookParameters);
  73. typedef BOOL    (EXPENTRY PFFUNCPTR3)(HAB hab, PQMSG pqmsg, ULONG option);
  74.  
  75. #define         ENTRYSUBMENU    0
  76. #define         ENTRYMENUITEM   1
  77. #define         ENTRYEMPTY      2
  78.  
  79. struct _SESSIONDATA                     /* Control structure to start a new session */
  80. {
  81. ULONG           id;                     /* Session ID for menu ressources */
  82. UCHAR           PgmTitle[EF_SIZE60+1];  /* Session title */
  83. UCHAR           PgmName[EF_SIZE255+1];  /* Session path and filename */
  84.                                         /* Session working directory */
  85. UCHAR           PgmDirectory[EF_SIZE255+1];
  86.                                         /* Session parameter */
  87. UCHAR           PgmInputs[EF_SIZE255+1];
  88. UCHAR           PgmDosSettings[2049];   /* DOS Settings for DOS sessions */
  89. USHORT          SessionType;            /* Session type */
  90. USHORT          PgmControl;             /* Session control */
  91. USHORT          FgBg;                   /* Start session in foreground/background */
  92. SHORT           InitXPos;               /* X position */
  93. SHORT           InitYPos;               /* Y position */
  94. SHORT           InitXSize;              /* X size */
  95. SHORT           InitYSize;              /* Y size */
  96. };
  97.  
  98. struct _MENUDATA                        /* Control structure to build popup menu */
  99. {
  100. USHORT          Item;                   /* MENUITEM or SUBMENU */
  101. HWND            hwndItem;               /* Window handle within Popup-Menu */
  102. ULONG           id;                     /* Session ID for menu ressources */
  103. PSZ             PgmTitle;               /* Session title */
  104. PSZ             PgmName;                /* Session path and filename */
  105. PSZ             PgmDirectory;           /* Session working directory */
  106. PSZ             PgmInputs;              /* Session parameter */
  107. PSZ             PgmDosSettings;         /* Session settings for DOS applications */
  108. USHORT          SessionType;            /* Session type */
  109. USHORT          PgmControl;             /* Session control */
  110. USHORT          FgBg;                   /* Start session in foreground/background */
  111. SHORT           InitXPos;               /* X position */
  112. SHORT           InitYPos;               /* Y position */
  113. SHORT           InitXSize;              /* X size */
  114. SHORT           InitYSize;              /* Y size */
  115. MENUDATA        *Back;                  /* Pointer to previous menu */
  116. MENUDATA        *Submenu;               /* Pointer to a submenu */
  117. MENUDATA        *Next;                  /* Pointer to next menu */
  118. };
  119.  
  120. struct  _COMMANDLINEPARAMS
  121. {
  122. UCHAR           ucPBefore[EF_SIZE60+1]; /* Parameters before user requested parameter */
  123. UCHAR           ucPUser[128];           /* User requested parameter */
  124. UCHAR           ucPAfter[EF_SIZE60+1];  /* Parameters after user requested parameter */
  125. };
  126.  
  127. struct  _HOOKPARAMETERS
  128. {
  129. HAB             habWindow;              /* Anchor block handle of PC/2 */
  130. HWND            hwndWPS;                /* WPS window handle where mouse clicks on WPS
  131.                                            can be found */
  132. HWND            hwndDesktop;            /* PM window handle where mouse clicks on Desktop
  133.                                            can be found */
  134. HWND            hwndPC2;                /* PC/2's window handle to send/post messages to */
  135. UCHAR           ucDesktopName[20];      /* Name of Desktop, f.e. OS/2 2.0 Desktop */
  136. ULONG           ulScrollPercentage;     /* Percentage of physical Desktop used to scroll
  137.                                            through virtual Desktop (25, 50, 75, 100 %) */
  138. ULONG           ulStatusFlag;           /* Bitmapped status flag */
  139. ULONG           ulClickFlag;            /* WM_BUTTON1CLICK for a single click, and
  140.                                            WM_BUTTON1DBLCLK for a double click */
  141. POINTL          DesktopSize;            /* Size of the physical Desktop screen */
  142. POINTL          VirtualDesktopPos;      /* Position of the physical Desktop within the virtual */
  143. POINTL          VirtualDesktopMin;      /* Lower left position of whole virtual Desktop */
  144. POINTL          VirtualDesktopMax;      /* Upper right position of whole virtual Desktop */
  145. LONG            SlidingXFactor;         /* Sliding offset in pixel for horizontal movements */
  146. LONG            SlidingYFactor;         /* Sliding offset in pixel for vertical movements */
  147. };
  148.  
  149. #define ID_PC2MAINWINDOW        256
  150. #define ID_PC2POPUPMENU         257
  151.  
  152. #define PC2_CLASSNAME           "PC2"
  153.  
  154. #define ID_PC2SETUP             300     /* Defines for PopUp Menu, that is popped up after
  155.                                            the user presses mouse button 1 on DESKTOP */
  156. #define ID_CONFIGDIALOG         301     /* User pressed Configure Menu */
  157. #define ID_ABOUTDIALOG          302     /* User pressed About PC/2 */
  158. #define ID_EXIT                 303     /* User pressed F3 to exit PC/2 */
  159. #define ID_SHUTDOWN             304     /* User pressed ShutDown OS/2 */
  160. #define ID_DESKTOPDIALOG        305     /* User pressed Configure Desktop */
  161.  
  162. #define PIID_PROGRAMDIALOG      500     /* Program installation dialog */
  163. #define PIGRP_PROGRAM           501     /* Program data group */
  164. #define PIEF_PROGRAMTITLE       502
  165. #define PIEF_PATHFILENAME       503
  166. #define PIEF_DIRECTORY          504
  167. #define PIEF_PARAMETERS         505
  168. #define PIEF_DOSSETTINGS        506
  169. #define PIPB_WINFILEDLG         507
  170.  
  171. #define PIGRP_TYPE              510     /* Program type group */
  172. #define PIRB_SHELL              511
  173. #define PIRB_OS2FULLSCREEN      512
  174. #define PIRB_OS2WINDOW          513
  175. #define PIRB_PM                 514
  176. #define PIRB_DOSFULLSCREEN      515
  177. #define PIRB_DOSWINDOW          516
  178. #define PIRB_WPSOBJECT          517
  179.  
  180. #define PIGRP_STYLE             520     /* Program style group */
  181. #define PIRB_DEFAULTSTYLE       521
  182. #define PIRB_MAXIMIZED          522
  183. #define PIRB_MINIMIZED          523
  184. #define PIRB_SIZEPOSITION       524
  185. #define PIRB_INVISIBLE          525
  186. #define PIRB_NOAUTOCLOSE        526
  187. #define PIRB_BACKGROUND         527
  188.  
  189. #define PIGRP_SIZEPOSITION      530     /* User defined size & position */
  190. #define PIEF_X                  531
  191. #define PIEF_Y                  532
  192. #define PIEF_XSIZE              533
  193. #define PIEF_YSIZE              534
  194.  
  195. #define PIID_HELP_1             550     /* Help pages */
  196. #define PIID_HELP_2             551
  197. #define PIID_HELP_3             552
  198. #define PIID_HELP_4             553
  199. #define PIID_HELP_5             554
  200.  
  201. #define ADID_ABOUTDIALOG        600     /* About program dialog */
  202.  
  203. #define DDID_DESKTOPDIALOG      650     /* Desktop configuration dialog */
  204. #define DDGRP_SLIDINGFOCUS      651
  205. #define DDCB_SLIDINGFOCUS       652
  206. #define DDGRP_VIRUTALDESKTOP    660
  207. #define DDCB_VIRTUALDESKTOP     661
  208. #define DDCB_MOVEDESKTOP        662
  209. #define DDCB_CLICK2MOVE         663
  210. #define DDCB_OVERVIEW           664
  211. #define DDEF_DESKTOPNAME        665
  212. #define DDLB_SCROLLPERCENTAGE   666
  213.  
  214. #define CDID_CONFIGDIALOG       700     /* Configuration menu dialog */
  215. #define CDGRP_PROGRAM           701     /* Submenu/Program installation group */
  216. #define CDLB_MENUPROGRAM        702
  217. #define CDID_LEVELUP            703
  218. #define CDID_LEVELDOWN          704
  219. #define CDID_ADDMENU            705
  220. #define CDID_ADDPROGRAM         706
  221. #define CDID_CHANGEENTRY        707
  222. #define CDID_REMOVEENTRY        708
  223. #define CDID_RESORT             709
  224.  
  225. #define CDID_HELP_1             710     /* Help pages */
  226. #define CDID_HELP_2             711
  227.  
  228. #define RDID_RESORTDIALOG       750     /* Resort menuentries dialog */
  229. #define RDPB_MOVE               751     /* Move pushbutton */
  230. #define RDGRP_SOURCEMENU        755     /* Move from menu */
  231. #define RDLB_SOURCEMENU         756
  232. #define RDGRP_DESTINATIONMENU   760     /* Move into menu */
  233. #define RDLB_DESTINATIONMENU    761
  234.  
  235. #define MIID_MENUDIALOG         800     /* Menu installation dialog */
  236. #define MIGRP_PROGRAM           801     /* Menu data group */
  237. #define MIEF_MENUTITLE          802
  238.  
  239. #define MIID_HELP_1             810     /* Help page */
  240.  
  241. #define SDID_SHUTDOWNDIALOG     900     /* OS/2 ShutDown dialog */
  242. #define SDID_SHUTDOWNMESSAGE    901     /* Message diaplayed a ShutDown */
  243.  
  244. #define SUID_STARTUPDIALOG      950     /* Request parameters from user before launching
  245.                                            an application */
  246. #define SUTF_STARTUPINFO        951     /* Info to the user what to do */
  247. #define SUTF_STARTUPPARAMETERS  952     /* Info to the user of current parameters */
  248. #define SUEF_STARTUPPARAMETERS  953     /* Entryfield for user data */
  249.  
  250. #define ID_POPUPMENU            1000    /* ID used by first user entered entry in the 
  251.                                            popup menu. It is incremented by 1 by tracing
  252.                                            through the linked list for each entry (submenu
  253.                                            or menuitem). */
  254. #define USERITEMFIRST           ID_POPUPMENU
  255. #define USERITEMLAST            ID_POPUPMENU+200
  256.  
  257. #define ID_HELP                 2000    /* ID used for HELP panels */
  258. #define MAIN_HELP_TABLE         2001
  259. #define MAIN_HELP_SUBTABLE      2002
  260. #define ID_GENERALHELP          2003
  261. #define ID_CONCEPTSHELP         2004
  262. #define ID_USINGHELP            2005
  263. #define ID_ERRORHELP            2006
  264. #define ID_ERRORHELP_1          2007
  265. #define ID_INSTALLATIONHELP     2008
  266.  
  267.                                         /* New messages for the configuration menu dialog */
  268.                                         /* Load the current level into configuration listbox */
  269. #define WM_LOADPOPUPMENU        WM_USER+1
  270.                                         /* Initialize the input queue hook */
  271. #define WM_LOADHOOK             WM_USER+2
  272.                                         /* Save Popup-Menu to Profile */
  273. #define WM_SAVEPOPUPMENU        WM_USER+3
  274.                                         /* Load Popup-Menu from Profile */
  275. #define WM_SETPOPUPMENU         WM_USER+4
  276.                                         /* Display Popup-Menu on Desktop */
  277. #define WM_POPUPMENU            WM_USER+5
  278.  
  279.                                         /* Insert an item to the linked list */
  280. #define MM_INSERTITEMMENUITEM   WM_USER+6
  281.                                         /* Change the first item of a Submenu to an item */
  282. #define MM_INSERTITEMSUBMENU    WM_USER+7
  283.                                         /* Move an item of a Submenu to another position */
  284. #define MM_MOVEMENUITEM         WM_USER+8
  285.                                         /* ShutDown message to ShutDown dialog */
  286. #define WM_SHUTDOWN             WM_USER+9
  287.                                         /* Program Type configuration of Program Installation
  288.                                            dialog */
  289. #define WM_SETUPPROGRAMTYPE     WM_USER+10
  290.                                         /* Program Priority configuration of Program Installation
  291.                                            dialog */
  292. #define WM_SETUPPROGRAMPRIORITY WM_USER+11
  293.                                         /* Program Size & Position configuration of Program
  294.                                            Installation dialog */
  295. #define WM_SETUPSIZEPOSITION    WM_USER+12
  296.                                         /* Query and set desktop window handle */
  297. #define WM_SETDESKTOPHANDLE     WM_USER+13
  298.                                         /* Sent by PC2HOOK.DLL if windows need to be moved */
  299. #define WM_DESKTOPMOVE          WM_USER+14
  300.  
  301.                                         /* Procedures */
  302. extern int      main(int argc, char *argv[], char *envp[]);
  303. extern BOOL     WinStartUp(HAB *pHab, HMQ *pHmq);
  304. extern BOOL     WinStartHelp(HAB hab, UCHAR *pHelpfile, HWND *pHwndHelp);
  305. extern BOOL     WinCloseDown(HWND *pHwndHelp, HAB *pHab, HMQ *pHmq);
  306. extern void     StartSession(SESSIONDATA *SessionData);
  307. extern BOOL     LoadMenuData2SessionData(BOOL Empty, MENUDATA *pMenuData, SESSIONDATA *pSessionData);
  308. extern BOOL     LoadSessionData2MenuData(MENUDATA *pMenuData, SESSIONDATA *pSessionData);
  309. extern MENUDATA *AllocateMenuData(void);
  310. extern void     LoadMenu(MENUDATA *pMenuData);
  311. extern void     SaveMenu(MENUDATA *pMenuData);
  312. extern MRESULT  SetPopupMenu(ULONG msg, MPARAM mp1, MPARAM mp2);
  313. extern MENUDATA *SearchItem(MENUDATA *pMD, ULONG *id);
  314. extern void     InstallFilename2Dialog(HWND hwndDlg, UCHAR *pucFullFileName, BOOL bObject);
  315. extern void     DisableDialogItem(HWND hwndDlg, USHORT usDialogIDs[], USHORT usItemCount, ULONG ulStyle);
  316. extern void     INIAccess(UCHAR *pucFilenameINI, BOOL bRead);
  317.  
  318.                                         /* Window procedures */
  319. extern MRESULT  EXPENTRY PC2_MainWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  320. extern MRESULT  EXPENTRY PI_DialogProcedure(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2);
  321. extern MRESULT  EXPENTRY PI_SubclassedDialogProcedure(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  322. extern MRESULT  EXPENTRY AD_DialogProcedure(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2);
  323. extern MRESULT  EXPENTRY MI_DialogProcedure(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2);
  324. extern MRESULT  EXPENTRY CD_DialogProcedure(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2);
  325. extern MRESULT  EXPENTRY SD_DialogProcedure(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2);
  326. extern MRESULT  EXPENTRY SU_DialogProcedure(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2);
  327. extern MRESULT  EXPENTRY RD_DialogProcedure(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2);
  328. extern MRESULT  EXPENTRY DD_DialogProcedure(HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2);
  329.  
  330. extern HAB              hab;            /* Handle of PM anchor block */
  331. extern HMQ              hmq;            /* Handle of message queue */
  332. extern HWND             hwndFrame;
  333. extern HWND             hwndClient;
  334. extern HWND             hwndPopupMenu;  /* Handel of popup menu window */
  335. extern HWND             hwndHelp;
  336. extern SESSIONDATA      SessionData;
  337. extern HOOKPARAMETERS   HookParameters; /* Parameters passed to PC2HOOK.DLL */
  338. extern MENUDATA         *pPopupMenu;    /* First entry of linked list of menus */
  339. extern MENUDATA         *pMenuData;     /* First entry of current level of linked list */
  340. extern USHORT           DialogResult;   /* Result of last dialog */
  341. extern USHORT           MenuDataId;     /* Id of the items in the Popup-Menu and linked list */
  342. extern FILE             *Pc2Profile;    /* Profile filename */
  343.                                         /* Path of PC2.INI */
  344. extern UCHAR            *pucFilenameINI;
  345. extern SWP              swpScreen;      /* The screen dimensions */
  346.                                         /* Pointer to DLL-Functions */
  347. extern PFFUNCPTR1       *pPC2DLL_SetParameters;
  348. extern PFFUNCPTR2       *pPC2DLL_QueryParameters;
  349. extern PFFUNCPTR3       *pPC2DLL_Hook;
  350.  
  351.  
  352.