os_dep.h Aggiunto test della presenza di easydoc

os_win16.cpp  Aggiunto test della presenza di easydoc
os_win32.cpp  Aggiunto test della presenza di easydoc
prefix.*      Tolti riferimenti a variabili inutili di campo
printer.*     Aggiunti cast per evitare i warning


git-svn-id: svn://10.65.10.50/trunk@6352 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-03-13 10:35:51 +00:00
parent e9ba8ee47e
commit d0cdc7d983
7 changed files with 103 additions and 68 deletions

View File

@ -45,4 +45,6 @@ bool os_open_spool_row(const char* device);
bool os_spool_row(const char* str);
bool os_close_spool_row();
bool os_get_image_editor_path(TFilename& name);
#endif

View File

@ -374,11 +374,20 @@ bool os_test_disk_free_space(const char* path, unsigned long filesize)
void os_exec_help_command(MENU_TAG tag, const char* key)
{
TFilename hlp("prassi.hlp");
TString mod(key);
mod.cut(2); mod.lower();
if (mod != "ba") hlp.insert(mod, 0);
TString mod(key);
if (mod.not_empty())
{
mod.cut(2); mod.lower();
if (mod != "ba")
hlp.insert(mod, 0);
}
else
{
if (tag == M_HELP_ONCONTEXT)
tag = M_HELP_CONTENTS;
}
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
switch(tag)
{
case M_HELP_CONTENTS: WinHelp(hwnd, hlp, HELP_CONTENTS, 0); break;
@ -484,7 +493,7 @@ bool os_spawn_by_menu()
int os_get_printer_names(TToken_string& t)
{
char* buf = t.get_buffer(2048); // ammazzao'
char* buf = t.get_buffer(4096); // ammazzao'
GetProfileString ("devices", NULL, "", buf, t.size());
for (int i = 0; i < t.size(); i++)
{
@ -518,6 +527,25 @@ bool os_get_default_printer(TString& name)
return ok;
}
bool os_get_image_editor_path(TFilename& name)
{
// where is EasyDoc installed?
GetPrivateProfileString("Easydoc", "Path", "\\EASYDOC",
name.get_buffer(), name.size(),
"EasyDoc.ini");
// You're unlucky there is no EasyDoc
if (name.empty())
return FALSE;
// paste EasyDoc path
name.add("easydoc.exe");
// is EasyDoc present?
bool ok = name.exist();
return ok;
}
os_type os_get_type()
{
const WORD winver = LOWORD(GetVersion());

View File

@ -181,7 +181,7 @@ bool os_test_disk_free_space(const char* path, unsigned long filesize)
return nRequired.QuadPart <= nAvailable.QuadPart;
*/
// May fail for disk > 2GB
// On Win95 may fail for disks > 2GB
DWORD nSecPerClust, nBytePerSec, nFreeClust;
GetDiskFreeSpace(path, &nSecPerClust, &nBytePerSec, &nFreeClust, NULL);
__int64 nFree = nFreeClust;
@ -194,8 +194,17 @@ void os_exec_help_command(MENU_TAG tag, const char* key)
{
TFilename hlp("prassi.hlp");
TString mod(key);
mod.cut(2); mod.lower();
if (mod != "ba") hlp.insert(mod, 0);
if (mod.not_empty())
{
mod.cut(2); mod.lower();
if (mod != "ba")
hlp.insert(mod, 0);
}
else
{
if (tag == M_HELP_ONCONTEXT)
tag = M_HELP_CONTENTS;
}
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
switch(tag)
{
@ -249,13 +258,6 @@ int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchil
if (sync)
{
TTemp_window tw(TASK_WIN);
if (iconizetask)
{
tw.iconize();
tw.deactivate();
}
ATOM aBa0Atom = NULL;
if (iconizetask && showchild && main_app().name() == "ba0100")
{
@ -265,6 +267,14 @@ int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchil
}
WaitForInputIdle(hProcess, INFINITE);
TTemp_window tw(TASK_WIN);
if (iconizetask)
{
tw.iconize();
tw.deactivate();
}
if (WaitForSingleObject(hProcess, INFINITE) != 0xFFFFFFFF)
{
unsigned long exit_code;
@ -281,6 +291,7 @@ int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchil
{
tw.maximize();
tw.activate();
do_events();
}
}
else
@ -288,19 +299,27 @@ int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchil
CloseHandle(pi.hThread);
CloseHandle(hProcess);
}
else
{
exitcode = GetLastError();
error_box("Impossibile eseguire '%s': %d", (const char*)path, exitcode);
}
return exitcode;
}
int os_get_printer_names(TToken_string& t)
{
char* buf = t.get_buffer(2048); // ammazzao'
GetProfileString ("devices", NULL, "", buf, t.size());
char* buf = t.get_buffer(4096); // ammazzao'
GetProfileString("devices", NULL, "", buf, t.size());
for (int i = 0; i < t.size(); i++)
{
if (buf[i] == '\0')
{
if (buf[i+1] != '\0') buf[i] = t.separator();
else break;
if (buf[i+1] != '\0')
buf[i] = t.separator();
else
break;
}
}
return t.items();
@ -329,6 +348,9 @@ bool os_get_default_printer(TString& name)
bool os_spawn_by_menu()
{
#ifdef DBG
bool ok = TRUE;
#else
TString str = main_app().name();
bool ok = str == "ba0100";
if (!ok)
@ -336,6 +358,27 @@ bool os_spawn_by_menu()
str.insert("ba0100->", 0);
ok = GlobalFindAtom(str) != NULL;
}
#endif
return ok;
}
bool os_get_image_editor_path(TFilename& name)
{
// where is EasyDoc installed?
GetPrivateProfileString("Easydoc", "Path", "\\EASYDOC",
name.get_buffer(), name.size(),
"EasyDoc.ini");
// You're unlucky there is no EasyDoc
if (name.empty())
return FALSE;
// paste EasyDoc path
name.add("easydoc.exe");
// is EasyDoc present?
bool ok = name.exist();
return ok;
}

View File

@ -1,8 +1,6 @@
#define __PREFIX_CPP
#include <prefix.h>
#include <codeb.h>
#include <extcdecl.h>
#include <prefix.h>
#include <progind.h>
#include <scanner.h>
#include <tabutil.h>
@ -73,22 +71,12 @@ HIDDEN const char* const glockname = "xx";
TPrefix::TPrefix() : _filelevel(0), _items(0)
{
_prefix = ".";
_dirfl = dirfl;
_recfl = recfl;
_fdir = fdir;
_rdir = rdir;
CGetPref();
const TFilename dir(cprefix);
const long primaditta = atol(dir.name());
if (primaditta > 0 && !exist(primaditta))
{
// ofstream out_pr(prefname());
// out_pr << "com" << endl;
set("com", TRUE);
}
}
@ -126,9 +114,9 @@ HIDDEN int closeall(bool changestudy, TBit_array& excl, TBit_array& toclose)
HIDDEN void openall(bool changestudy, TBit_array& excl, int oldmax, TBit_array& toopen)
{
if (!openf) return ;
if (!openf)
return ;
TDir d;
d.get(1);
const int max = (int) d.eod();
@ -240,21 +228,11 @@ void TPrefix::set(
if (strcmp(name, "DEF") == 0)
{
CGetPref();
// _prefix = cprefix;
// const int l = strlen(__ptprf);
// if (l > 0) _prefix.ltrim(l);
_splitpath(cprefix, NULL, NULL, _prefix.get_buffer(), NULL);
}
else
{
_prefix = name;
/*
if (*__ptprf && *name)
strcpy(cprefix, __ptprf);
else
strcpy(cprefix, "");
strcat(cprefix, name);
*/
if (*name)
_makepath(cprefix, NULL, __ptprf, name, NULL);
else
@ -306,10 +284,6 @@ bool TPrefix::test(const char* s) const
return error_box("Impossibile trovare il file '%s'", (const char*)s1);
}
if ((_dirfl[0] > 1) || (_dirfl[1] > 1) ||
(_recfl[0] > 1) || (_recfl[1] > 1))
return error_box("Impossibile cambiare ditta (dir.gen o trc.gen in uso)");
return TRUE;
}

View File

@ -1,12 +1,8 @@
#ifndef __PREFIX_H
#define __PREFIX_H
#ifndef __EXTCTYPE_H
#include <extctype.h>
#endif
#ifndef __FILES_H
#include <files.h>
#ifndef __RECTYPES_H
#include <rectypes.h>
#endif
#ifndef __STRINGS_H
@ -20,26 +16,18 @@
// @base public | TObject
class TPrefix : public TObject
// @author:(INTERNAL) Sandro-Guido
// @author:(INTERNAL) Alex
{
// @access:(INTERNAL) Private Member
// @cmember:(INTERNAL) Contenuto del file "prefix.txt"
TString _prefix;
// @cmember:(INTERNAL) Array di flag di apertura dei file (dir.gen)
int* _dirfl;
// @cmember:(INTERNAL) Array di flag di apertura dei file (trc.gen)
int* _recfl;
// @cmember:(INTERNAL) Livello degli archivi
long _filelevel;
// @cmember:(INTERNAL) Numero di files esitenti
int _items;
// @cmember:(INTERNAL) Puntatore alla lista dei file (dir.gen)
SecDef* _fdir;
// @cmember:(INTERNAL) Puntatore alla lista dei record (trc.gen)
SecDef* _rdir;
// @access Protected Member
protected:
// @cmember Verifica l'effettiva esistenza della directory <p s> sotto

View File

@ -1084,7 +1084,7 @@ TPrinter::TPrinter()
CHECK(_curprn >= 0, "Can't find printer ");
if (_curprn >= pn2.items())
if (_curprn >= word(pn2.items()))
{
TString pdev(_defPrinter); // Nome stampante corrente
int comma = pdev.find(',');

View File

@ -260,7 +260,7 @@ class TPrinter : public TObject
// @cmember:(INTERNAL) Descrizione delle stampanti
TArray _printers;
// @cmember:(INTERNAL) Indice corrente della stampante
int _curprn;
word _curprn;
// @cmember:(INTERNAL) Codice corrente della stampante
int _curcode;
// @cmember:(INTERNAL) Lunghezza della pagina logica
@ -619,7 +619,7 @@ public:
void merge_export_file(const char* file, bool header = TRUE);
// @cmember Ritorna il numero di righe disponibili poer la stampa
word rows() const
{ return _formlen-_headersize-_footersize; }
{ return word(_formlen-_headersize-_footersize); }
// @cmember Ritorna il numero di righe che rimangono a disposizione per la stampa
word rows_left() const;
// @cmember Setta il record per la descrizione dello stato dell stampante
@ -672,7 +672,7 @@ public:
// @cmember Ritorna il nome della stampante
const char* printername() const
{ return (const char*)get_description (_curprn)._devicename; }
{ return (const char*)get_description(_curprn)._devicename; }
// @cmember Setta la dimensione dei caratteri da stampare
void set_char_size(int size)