/****************************** Module Header ******************************* * * Module Name: saveold.e * * E wrapper routine to access the NEPMD library DLL. * Include of nepmdlib.e. * * Copyright (c) Netlabs EPM Distribution Project 2002 * * $Id$ * * =========================================================================== * * This file is part of the Netlabs EPM Distribution package and is free * software. You can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * Netlabs EPM Distribution. This library is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * ****************************************************************************/ /* @@NepmdSaveOld@PROTOTYPE NepmdSaveOld( [[[[hwndClient,]] Filename]]) @@NepmdSaveOld@CATEGORY@FILE @@NepmdSaveOld@SYNTAX This function saves a loaded file with the dates and times of the previous file on disk. It executes EPM's Save command for that. After the file on disk has the old datetimes assigned, the .fileinfo field is refreshed and then the info line (currently the title bar) is refreshed, too, to display the old file datetime again. @@NepmdSaveOld@PARM@hwndClient This optional parameter specifies the EPM window handle that should be processed. It defaults to the current EPM window. @@NepmdSaveOld@PARM@Filename This optional parameter specifies the filename of the read file. It defaults to the current filename. @@NepmdSaveOld@RETURNS *NepmdSaveOld* returns nothing. This procedure sets the implicit universal var *rc*. rc is set to an [inf:cp2 "Errors" OS/2 error code] or to zero for no error. @@NepmdSaveOld@TESTCASE You can test this function from the *EPM* commandline by executing: .sl - *NepmdSaveOld* [.IDPNL_EFUNC_NepmdSaveOld_PARM_Filename Filename] - or - *SaveOld* [.IDPNL_EFUNC_NepmdSaveOld_PARM_Filename Filename] - or - *NepmdSaveOld* - or - *SaveOld* Executing this command will save the current file with either the specified or the current filename and the previous datetimes. *Example:* .fo text SaveOld c:\testfile.txt .fo on @@ */ ; --------------------------------------------------------------------------- ; Allow editor command to call function ; --------------------------------------------------------------------------- compile if NEPMD_LIB_TEST defc NepmdSaveOld, SaveOld do i = 1 to 1 parse arg Args Args = strip( Args) if leftstr( Args, 1) = '"' then parse value Args with '"'Filename'"' else parse value Args with Filename endif Filename = strip( Filename) if (Filename = '') then Filename = .filename endif call NepmdSaveOld( getpminfo( EPMINFO_EDITCLIENT), Filename) if rc then 'SayError Error from NepmdSaveOld, rc = 'rc'.' else 'SayError NepmdSaveOld: "'Filename'" successfully saved with old' || ' date and time.' endif enddo compile endif ; --------------------------------------------------------------------------- ; Procedure: NepmdSaveOld ; --------------------------------------------------------------------------- ; E syntax: ; call NepmdSaveOld( [[hwndClient,] Filename]) ; --------------------------------------------------------------------------- ; C prototype: ; APIRET EXPENTRY NepmdSaveOld( HWND hwndClient, ; PSZ filename); ; --------------------------------------------------------------------------- defproc NepmdSaveOld do once = 1 to 1 hwndClient = arg( 1) if not hwndClient then hwndClient = getpminfo( EPMINFO_EDITCLIENT) endif Filename = arg( 2) if not Filename then Filename = .filename endif -- Prepare parameters for C routine FilenameZ = Filename\0 -- Call C routine LibFile = HelperNepmdGetLibFile() rc = dynalink32( LibFile, "NepmdSaveOld", atol( hwndClient) || address( FilenameZ), 2) if rc then leave endif -- Setting .fileinfo from C with EtkSetFileField doesn't work. Why? -- Refreshes .fileinfo field var and then refreshes info lines -- (currently the title bar). if isadefc( 'RefreshFileInfo') then 'RefreshFileInfo' endif enddo HelperNepmdCheckLibError( LibFile, rc) return