home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osr1.exe / src / avssessn.cpp < prev    next >
C/C++ Source or Header  |  1997-03-21  |  10KB  |  265 lines

  1. /* @(#)Z 1.6 os2/src/avsshell/avssessn.cpp, oddataxfer, od96os2, odos29712d 97/03/21 17:39:50 (96/09/30 13:45:24) */
  2. //====START_GENERATED_PROLOG======================================
  3. //
  4. //
  5. //   COMPONENT_NAME: oddataxfer
  6. //
  7. //   CLASSES: none
  8. //
  9. //   ORIGINS: 82,27
  10. //
  11. //
  12. //   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13. //   All Rights Reserved
  14. //   Licensed Materials - Property of IBM
  15. //   US Government Users Restricted Rights - Use, duplication or
  16. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17. //       
  18. //   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19. //   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20. //   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21. //   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22. //   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23. //   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24. //   OR PERFORMANCE OF THIS SOFTWARE.
  25. //
  26. //====END_GENERATED_PROLOG========================================
  27. //
  28.  
  29. //
  30. // Copyright (C) Apple Computer, Inc., 1994
  31. //
  32. //
  33. //******************************************************************
  34.  
  35.  
  36. #define INCL_DOSMODULEMGR
  37. #define INCL_WINWINDOWMGR
  38. #define INCL_WIN
  39. #define INCL_WINSWITCHLIST
  40. #define INCL_WINERRORS
  41. #include <os2.h>
  42.  
  43. #ifndef SOM_Module_shsessn_Source
  44. #define SOM_Module_shsessn_Source
  45. #endif
  46. #define AVSShellSession_Class_Source
  47. #define VARIABLE_MACROS
  48. #ifndef ODExtension_Class_Source
  49. #define ODExtension_Class_Source
  50. #endif
  51.  
  52. #include <avsshell.h>
  53. #include <dsres.h>
  54.  
  55. // Can not find Status file anymore and hwndStatusLine is not used in code.
  56. // #ifndef SOM_ODStatusLineExtension_xih
  57. // #include "Status.xih"
  58. // #endif
  59. #ifndef SOM_Module_OpenDoc_StdTypes_defined
  60. #include <StdTypes.xh>
  61. #endif
  62. #ifndef SOM_Module_OpenDoc_StandardExtensions_defined
  63. #include <StdExts.xh>
  64. #endif
  65. #ifndef SOM_Module_OpenDoc_StdProps_defined
  66. #include <StdProps.xh>
  67. #endif
  68.  
  69. #include "avssessn.xih"
  70.  
  71. // pick up defines
  72. // #include "dsres.h"
  73. //#ifndef SOM_ODSession_xih
  74. //#include <ODSessn.xih>
  75. //#endif
  76.  
  77. #ifdef _UNICODE_
  78. //************************************
  79. //*   set up for UNICODE             *
  80. //*   8/28/95     jss                *
  81. //************************************
  82. #include <unidef.h>
  83. #include <avuni.h>
  84. #endif
  85.  
  86. // pointer to window proc subclassed for status line support
  87. PFNWP                    OldShellWndProc;
  88. // subclass of window proc to support status line
  89. extern "C" {
  90.  MRESULT EXPENTRY NewShellWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  91. }
  92.  
  93. SOM_Scope void  SOMLINK AVSShellSessionSetShellPointer(AVSShellSession *somSelf,
  94.                                                   Environment *ev,
  95.                                                  AvsShell* shell)
  96. {
  97.     AVSShellSessionData *somThis = AVSShellSessionGetData(somSelf);
  98.     AVSShellSessionMethodDebug("AVSShellSession","AVSShellSessionSetShellPointer");
  99.  
  100.     _theShell = shell;
  101. }
  102.  
  103. SOM_Scope void  SOMLINK AVSShellSessionsomInit(AVSShellSession *somSelf)
  104. {
  105.     /* AVSShellSessionData *somThis = AVSShellSessionGetData(somSelf); */
  106.     AVSShellSessionMethodDebug("AVSShellSession","AVSShellSessionsomInit");
  107.  
  108.     AVSShellSession_parent_ODSession_somInit(somSelf);
  109. }
  110.  
  111. SOM_Scope void  SOMLINK AVSShellSessionsomUninit(AVSShellSession *somSelf)
  112. {
  113.     /* AVSShellSessionData *somThis = AVSShellSessionGetData(somSelf); */
  114.     AVSShellSessionMethodDebug("AVSShellSession","AVSShellSessionsomUninit");
  115.  
  116.     AVSShellSession_parent_ODSession_somUninit(somSelf);
  117. }
  118.  
  119. SOM_Scope void  SOMLINK AVSShellSessionInitSession(AVSShellSession *somSelf,
  120.                                               Environment *ev)
  121. {
  122.     /* AVSShellSessionData *somThis = AVSShellSessionGetData(somSelf); */
  123.     AVSShellSessionMethodDebug("AVSShellSession","AVSShellSessionInitSession");
  124.  
  125.     AVSShellSession_parent_ODSession_InitSession(somSelf, ev);
  126. }
  127.  
  128. // No one use this.
  129. // HWND  hwndStatusLine; // handle to Status line window Ben Garrett 02/10/95
  130.  
  131. SOM_Scope ODPlatformWindow  SOMLINK AVSShellSessionCreatePlatformWindow(AVSShellSession *somSelf,
  132.                                                                    Environment *ev,
  133.                                                                    ODPlatformWindowCreateOptions flags)
  134. {
  135.     AVSShellSessionData *somThis = AVSShellSessionGetData(somSelf);
  136.     AVSShellSessionMethodDebug("AVSShellSession","AVSShellSessionCreatePlatformWindow");
  137.  
  138.    #if 0
  139.        return (AVSShellSession_parent_ODSession_CreatePlatformWindow(somSelf,
  140.                                                                ev));
  141.    #else
  142.        HWND hwndClient;
  143.        char achErrorBuf[80];
  144.        ERRORID err = 0;
  145.        ULONG myflag = FCF_TITLEBAR|
  146.                       FCF_SIZEBORDER|
  147.                       FCF_SHELLPOSITION|
  148.                       FCF_SYSMENU|
  149.                       FCF_MINMAX|
  150.                       FCF_TASKLIST|
  151.                       FCF_ICON
  152.                       ;
  153.  
  154.        err = WinGetLastError(WinQueryAnchorBlock(HWND_DESKTOP));
  155.  
  156.  
  157. #ifdef _UNICODE_
  158. //************************************
  159. //*   set up for UNICODE             *
  160. //*   8/28/95     jss                *
  161. //************************************
  162.  
  163.        char      szMsg1[CCHMAXPATH];
  164.        char      szMsg2[CCHMAXPATH];
  165.  
  166.        WinLoadString( WinQueryAnchorBlock(HWND_DESKTOP), NULLHANDLE,
  167.                       AV_OPENDOCSHELL, sizeof(szMsg1), szMsg1);
  168.  
  169.        WinLoadString( WinQueryAnchorBlock(HWND_DESKTOP), NULLHANDLE,
  170.                       AV_UNTITLEDDOC, sizeof(szMsg2), szMsg2);
  171.  
  172.        ODPlatformWindow platformWindow = WinCreateStdWindow(
  173.                                                   HWND_DESKTOP,
  174.                                                   WS_VISIBLE,
  175.                                                   &myflag,
  176.                                                   (PSZ)szMsg1,
  177.                                                   (PSZ)szMsg2,
  178.                                                   WS_VISIBLE,
  179.                                                   (HMODULE)0,
  180.                                                   0,
  181.                                                   &hwndClient);
  182. #else
  183.        ODPlatformWindow platformWindow =  WinCreateStdWindow(
  184.                                                   HWND_DESKTOP,
  185.                                                   WS_VISIBLE,
  186.                                                   &myflag,
  187.                                                   (PSZ)"OpenDocShell",
  188.                                                   (PSZ)"OpenDoc Link Manager Log",
  189.                                                   WS_VISIBLE,
  190.                                                   (HMODULE)0,
  191.                                                   ROOT_DRAFTS_RESID,
  192.                                                   &hwndClient);
  193. #endif
  194.  
  195.        err = WinGetLastError(WinQueryAnchorBlock(HWND_DESKTOP));
  196.        WinSetWindowPtr(hwndClient, 0, _theShell);
  197.  
  198. // *********************************************************
  199. //  create status line, 02/07/95 Ben Garrett
  200. // *********************************************************
  201.  
  202.   // The following controls are created to display the AS states
  203.   // for debugging purpose only!!!!
  204.  
  205.     HWND hwndDocList = WinCreateWindow(hwndClient,
  206.                                        WC_LISTBOX,
  207.                                        "",
  208.                                        WS_VISIBLE | LS_HORZSCROLL,
  209.                                        20, 10, 370, 440,
  210.                                        hwndClient,
  211.                                        HWND_TOP,
  212.                                        300,
  213.                                        NULL,
  214.                                        NULL);
  215.  
  216.     HWND hwndLinkList = WinCreateWindow(hwndClient,
  217.                                         WC_LISTBOX,
  218.                                         "",
  219.                                         WS_VISIBLE | LS_HORZSCROLL,
  220.                                         400, 10, 370, 440,
  221.                                         hwndClient,
  222.                                         HWND_TOP,
  223.                                         301,
  224.                                         NULL,
  225.                                         NULL);
  226.  
  227.  
  228.     HWND hwndTxt1 = WinCreateWindow(hwndClient,
  229.                                     WC_STATIC,
  230.                                     "Document activity log:",
  231.                                     WS_VISIBLE | SS_TEXT,
  232.                                     20, 450, 370, 20,
  233.                                     hwndClient,
  234.                                     HWND_TOP,
  235.                                     302,
  236.                                     NULL,
  237.                                     NULL);
  238.  
  239.     HWND hwndTxt2 = WinCreateWindow(hwndClient,
  240.                                     WC_STATIC,
  241.                                     "Link source activity log:",
  242.                                     WS_VISIBLE | SS_TEXT,
  243.                                     400, 450, 370, 20,
  244.                                     hwndClient,
  245.                                     HWND_TOP,
  246.                                     303,
  247.                                     NULL,
  248.                                     NULL);
  249.  
  250.     _theShell->SetDocListHWND(hwndDocList);
  251.     _theShell->SetLinkListHWND(hwndLinkList);
  252.  
  253. // *********************************************************
  254.  
  255.        SWP swp;
  256.        WinQueryTaskSizePos(WinQueryAnchorBlock(HWND_DESKTOP),
  257.                            0, &swp);
  258.        WinSetWindowPos((HWND)platformWindow, HWND_TOP,
  259.                        swp.x, swp.y, swp.cx, swp.cy,
  260.                        SWP_SIZE | SWP_MOVE);
  261.  
  262.        return platformWindow;
  263.    #endif
  264. }
  265.