Changeset 218


Ignore:
Timestamp:
Aug 5, 2007, 6:49:01 AM (13 years ago)
Author:
Eugene Romanenko
Message:

make UClip package optional (closes #115)

Location:
trunk/Lucide
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/SOURCE/gui/clipbrd.cpp

    r181 r218  
    4343#include <malloc.h>
    4444#include <stdio.h>
     45#include <stdlib.h>
    4546#include "cpconv.h"
    4647
    4748#include "UClip.h"
     49
     50
     51static BOOL APIENTRY (*pUWinOpenClipbrd)(HAB)                      = NULL;
     52static BOOL APIENTRY (*pUWinEmptyClipbrd)(HAB)                     = NULL;
     53static BOOL APIENTRY (*pUWinSetClipbrdData)(HAB,ULONG,ULONG,ULONG) = NULL;
     54static BOOL APIENTRY (*pUWinCloseClipbrd)(HAB)                     = NULL;
     55
     56static bool loadUClip();
     57
     58static HMODULE ucHandle = NULLHANDLE;
     59static bool uclipLoaded = loadUClip();
     60
     61
     62static void freeUClip()
     63{
     64    if ( ucHandle != NULLHANDLE ) {
     65        DosFreeModule( ucHandle );
     66    }
     67}
     68
     69static bool loadUClip()
     70{
     71    bool res = false;
     72    do
     73    {
     74      if ( DosLoadModule( NULL, 0, "UCLIP", &ucHandle ) != 0 )
     75        break;
     76      if (DosQueryProcAddr(ucHandle,0,"UWinOpenClipbrd",(PFN *)&pUWinOpenClipbrd)!= 0)
     77        break;
     78      if (DosQueryProcAddr(ucHandle,0,"UWinEmptyClipbrd",(PFN *)&pUWinEmptyClipbrd)!= 0)
     79        break;
     80      if (DosQueryProcAddr(ucHandle,0,"UWinSetClipbrdData",(PFN *)&pUWinSetClipbrdData)!= 0)
     81        break;
     82      if (DosQueryProcAddr(ucHandle,0,"UWinCloseClipbrd",(PFN *)&pUWinCloseClipbrd)!= 0)
     83        break;
     84
     85      res = true;
     86    } while (0);
     87
     88    atexit( freeUClip );
     89
     90    return res;
     91}
    4892
    4993
     
    73117    size_t olen = 0;
    74118
    75     if ( UWinOpenClipbrd( hab ) )
     119    if ( uclipLoaded ? pUWinOpenClipbrd( hab ) : WinOpenClipbrd( hab ) )
    76120    {
    77         UWinEmptyClipbrd( hab );
     121        if ( uclipLoaded ) {
     122            pUWinEmptyClipbrd( hab );
     123        } else {
     124            WinEmptyClipbrd( hab );
     125        }
    78126
    79127        size_t cSubs = 0;
     
    94142            memcpy( memuni, shmemuni, olen );
    95143
    96             UWinSetClipbrdData( hab, (ULONG)shmemuni, UCLIP_CF_UNICODETEXT, CFI_POINTER );
     144            if ( uclipLoaded ) {
     145                pUWinSetClipbrdData( hab,(ULONG)shmemuni,UCLIP_CF_UNICODETEXT,CFI_POINTER );
     146            } else {
     147                DosFreeMem( shmemuni );
     148            }
    97149
    98150            int liglen = uniLigaturesLength( (UniChar *)memuni );
     
    118170                UniUconvFromUcs( objtosys, &tmpuni, &unilen, &tmpsys, &olen, &cSubs );
    119171
    120                 UWinSetClipbrdData( hab, (ULONG)shmemsys, UCLIP_CF_TEXT, CFI_POINTER );
     172                if ( uclipLoaded ) {
     173                    pUWinSetClipbrdData( hab, (ULONG)shmemsys, UCLIP_CF_TEXT, CFI_POINTER );
     174                } else {
     175                    WinSetClipbrdData( hab, (ULONG)shmemsys, CF_TEXT, CFI_POINTER );
     176                }
    121177            }
    122178            delete memuni;
    123179        }
    124180
    125         UWinCloseClipbrd( hab );
     181        if ( uclipLoaded ) {
     182            pUWinCloseClipbrd( hab );
     183        } else {
     184            WinCloseClipbrd( hab );
     185        }
    126186    }
    127187
  • trunk/Lucide/SOURCE/gui/makefile

    r214 r218  
    7878lib libconv
    7979lib libuls
    80 lib UClip
    8180export LucideMain
    8281| tmpmake.lnk >NUL
  • trunk/Lucide/changelog

    r216 r218  
    44    it will check file data to determine a suitable plugin (closed
    55    ticket #43).
     6  - UClip package is optional now.
    67  - Updated NLS-files: German, ...
    78
Note: See TracChangeset for help on using the changeset viewer.