Re: C.K. - Bible database

new topic     » goto parent     » topic index » view thread      » older message » newer message

This is a multi-part message in MIME format.
--------------070900000804050003070202

Jonas Temple wrote:

>
>
>C.K.,
>
>Just downloaded the EDB Bible and tried to run the viewer.  It's looking 
>for center.ew.
>
>Jonas
>  
>
Yes, it is, which is a very common include file, no? :)

Ah, well! Here it is...


--------------070900000804050003070202
Content-Type: text/plain;
 name="center.ew"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="center.ew"

------------------------------
-- center.ew -----------------
------------------------------
-- these constants are used in 'getWorkArea'
constant
   xSystemParameters = 
                 registerw32Function(user32, "SystemParametersInfoA", 
                 {C_UINT, C_UINT, C_POINTER, C_UINT}, C_LONG),
   SPI_GETWORKAREA = 48
------------------------------
-- FUNCTION: getWorkArea()
-- Returns: sequence containing the coordinates of the work area, 
--           expressed in virtual screen coordinates {x1,y1, x2,y2}
------------------------------
global function getWorkArea()
   atom mset, workarea
   sequence wa_out

   -- get pointer for RECT structure to receive coordinates
   mset = new_memset()
   workarea = acquire_mem( mset, SIZEOF_RECT )

   -- call C function from user32.dll
   if not w32Func( xSystemParameters, {SPI_GETWORKAREA, 0, workarea, 0} 
) then
     warnErr( "getWorkspace:SystemParametersInfo failed" )
   end if

   -- set return sequence 
   wa_out = { fetch( workarea, rectLeft ), fetch( workarea, rectTop ),
              fetch( workarea, rectRight ), fetch( workarea, rectBottom 
) }

   -- free pointer
   free( mset )

   return wa_out
end function

------------------------------
-- FUNCTION: centerWindow
--   uses 'getWorkArea' to center window on destop,
--     regardless of taskbar location & size
-- Parameters:
--    id: ID of Window/Pixmap
------------------------------
global procedure centerWindow( integer id )
   sequence wa, wa_size, id_size
   integer winx, winy

   wa = getWorkArea()
   wa_size = { wa[3]-wa[1], wa[4]-wa[2] }
   id_size = getCtlSize( id )

   winx = wa[1] + floor( (wa_size[1] - id_size[1])/2 )
   winy = wa[2] + floor( (wa_size[2] - id_size[2])/2 )
   setRect( id, winx, winy, id_size[1], id_size[2], True )
end procedure
------------------------------
-- end of center.ew ----------
------------------------------

--------------070900000804050003070202--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu