Cambiato XVT_OS in XVT , XVT4.00

git-svn-id: svn://10.65.10.50/trunk@1177 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1995-03-27 14:46:49 +00:00
parent dfa98abb64
commit b71a13da62
9 changed files with 137 additions and 114 deletions

View File

@ -3,13 +3,15 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef FOXPRO #ifdef FOXPRO
#undef XVT_OS #undef XVT
#include <windows.h> #include <windows.h>
#include <pro_ext.h> #include <pro_ext.h>
#endif #endif
#ifdef XVT_OS #ifdef XVT
#include <xvt.h> #ifndef XVT_INCL_XVT
#include <xvt.h>
#endif
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#include <windows.h> #include <windows.h>
#include <keys.h> #include <keys.h>
@ -17,7 +19,7 @@
#include <xvtility.h> #include <xvtility.h>
#endif #endif
#include <applicat.h> #include <applicat.h>
#endif /* XVT_OS */ #endif /* XVT */
#include <checks.h> #include <checks.h>

View File

@ -1,4 +1,3 @@
#include <direct.h>
#include <stdlib.h> #include <stdlib.h>
#include <xvt.h> #include <xvt.h>

View File

@ -1,4 +1,4 @@
S1=$(LOCAL)/xvtch/include/xvt.h S1=$(LOCAL)/xvtdsc2/ch_x86_sco/ptk/include/xvt.h
S2=$(DEVHOME)/mathlib/gmsys1.h $(DEVHOME)/mathlib/gfd.h $(DEVHOME)/mathlib/gmfequs.h $(DEVHOME)/mathlib/gmfuncts.h S2=$(DEVHOME)/mathlib/gmsys1.h $(DEVHOME)/mathlib/gfd.h $(DEVHOME)/mathlib/gmfequs.h $(DEVHOME)/mathlib/gmfuncts.h
S2=$(DEVHOME)/mathlib/gm.h S2=$(DEVHOME)/mathlib/gm.h
I1=$(IP)stdtypes.h I1=$(IP)stdtypes.h

View File

@ -1,4 +1,4 @@
// $Id: mailbox.cpp,v 1.12 1995-03-16 13:43:55 alex Exp $ // $Id: mailbox.cpp,v 1.13 1995-03-27 14:45:05 alex Exp $
#include <stdlib.h> #include <stdlib.h>
#include <fstream.h> #include <fstream.h>
@ -25,7 +25,7 @@ TMessage::TMessage(const char* to, const char* sub,
_to = rec; _to = rec;
_subject = sub; _subject = sub;
_text = text; _text = text;
_from = (from == NULL || *from == '\0') ? main_app().name() : TString(from); _from = (from == NULL || *from == '\0') ? main_app().name() : from;
_flags = 0x00; _number = -1; _flags = 0x00; _number = -1;
} }

View File

@ -1,5 +1,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <strstream.h>
#include <xvt.h>
#if XVT_OS==XVT_OS_SCOUNIX #if XVT_OS==XVT_OS_SCOUNIX
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
@ -8,9 +12,6 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#include <strstream.h>
#include <xvt.h>
#define STYLE_NUM 4 #define STYLE_NUM 4
#include <applicat.h> #include <applicat.h>
@ -704,7 +705,10 @@ HIDDEN bool set_windows_print_device (TMask_field& f, KEY key)
TPrinter::TPrinter() TPrinter::TPrinter()
: _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE), : _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
_lines_per_inch (6), _ch_size (12), _ncopies(1), _print_rcd(NULL) _lines_per_inch (6), _ch_size (12), _ncopies(1)
#if XVT_OS == XVT_OS_WIN
, _print_rcd(NULL)
#endif
{ {
_footerhandler = _headerhandler = NULL; _footerhandler = _headerhandler = NULL;
@ -1268,7 +1272,9 @@ void TPrinter::set()
} }
((TList_field &)(mask.field (MSK_1_CODES))).replace_items(pn1, pn2); ((TList_field &)(mask.field (MSK_1_CODES))).replace_items(pn1, pn2);
#if XVT_OS == XVT_OS_WIN
mask.xvt_win_set_handler (MSK_1_PRINTERS, printers_on_key); mask.xvt_win_set_handler (MSK_1_PRINTERS, printers_on_key);
#endif
if (_printertype == fileprinter) if (_printertype == fileprinter)
mask.set (MSK_1_TYPE, "1"); mask.set (MSK_1_TYPE, "1");
else if (_printertype == screenvis) else if (_printertype == screenvis)
@ -1276,15 +1282,15 @@ void TPrinter::set()
else else
mask.set (MSK_1_TYPE, "0"); mask.set (MSK_1_TYPE, "0");
mask.set(MSK_1_PRINTERS, _curprn)); mask.set(MSK_1_PRINTERS, _curprn);
mask.set(MSK_1_CODES, _curcode)); mask.set(MSK_1_CODES, _curcode);
KEY k; KEY k;
if ((k = mask.run()) == K_ESC) if ((k = mask.run()) == K_ESC)
return; return;
if (k == K_INS) // premuto REGISTRA if (k == K_INS) // premuto REGISTRA
mask.save(); mask.save();
// get user choices // get user choices
@ -1293,44 +1299,44 @@ void TPrinter::set()
PrinterDef& def = (PrinterDef &) get_description (_curprn); PrinterDef& def = (PrinterDef &) get_description (_curprn);
switch (atoi(mask.get (MSK_1_TYPE))) switch (atoi(mask.get (MSK_1_TYPE)))
{
case 0: // stampante
_printertype = normprinter;
_curcode = atoi (mask.get (MSK_1_CODES));
switch (atoi (def._printertype))
{ {
case 0: case 0: // stampante
_printertype = normprinter; _printertype = normprinter;
_curcode = atoi (mask.get (MSK_1_CODES));
switch (atoi (def._printertype))
{
case 0:
_printertype = normprinter;
break;
case 1:
_printertype = localprinter;
break;
case 2:
_printertype = spoolprinter;
break;
}
break; break;
case 1: case 1: // file
_printertype = localprinter; _printertype = fileprinter;
_printerfile = mask.get (MSK_1_FILENAME);
_curcode = atoi (mask.get (MSK_1_CODES));
break; break;
case 2: case 2: // video
_printertype = spoolprinter;
_printertype = screenvis;
_curcode = 0;
break; break;
} }
break;
case 1: // file
_printertype = fileprinter;
_printerfile = mask.get (MSK_1_FILENAME);
_curcode = atoi (mask.get (MSK_1_CODES));
break;
case 2: // video
_printertype = screenvis;
_curcode = 0;
break;
}
#else #else
_get_windows_printer_names(pn2); _get_windows_printer_names(pn2);
char old_default[80]; char old_default[80];
GetProfileString ("windows", "device", ",,,", old_default, sizeof(old_default)); GetProfileString ("windows", "device", ",,,", old_default, sizeof(old_default));
for (i = 0; i < pn2.items (); i++) for (i = 0; i < pn2.items (); i++)
pn1.add(i); pn1.add(i);
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items(pn1, pn2); ((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items(pn1, pn2);
mask.set(MSK_1_PRINTERS, pn1.get(_curprn)); mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
@ -1343,11 +1349,11 @@ for (i = 0; i < pn2.items (); i++)
mask.set(MSK_1_LINES, _lines_per_inch); mask.set(MSK_1_LINES, _lines_per_inch);
if (_printertype == fileprinter) if (_printertype == fileprinter)
mask.set (MSK_1_TYPE, "1"); mask.set (MSK_1_TYPE, "1");
else if (_printertype == screenvis) else if (_printertype == screenvis)
mask.set (MSK_1_TYPE, "2"); mask.set (MSK_1_TYPE, "2");
else else
mask.set (MSK_1_TYPE, "0"); mask.set (MSK_1_TYPE, "0");
mask.set_handler (MSK_1_PRINTERS, set_windows_print_device); mask.set_handler (MSK_1_PRINTERS, set_windows_print_device);
@ -1355,79 +1361,79 @@ for (i = 0; i < pn2.items (); i++)
int oldprn = _curprn; int oldprn = _curprn;
while ((k = mask.run ()) != K_ESC && k != K_ENTER && k != K_INS) while ((k = mask.run ()) != K_ESC && k != K_ENTER && k != K_INS)
{
if (k == DLG_SETPRINT)
{ {
// l'handler setta default di windows a quella nel listbox e ribecca l'rcd if (k == DLG_SETPRINT)
if (xvt_dm_post_page_setup(get_printrcd()))
{ {
// see if user has changed printer // l'handler setta default di windows a quella nel listbox e ribecca l'rcd
// determine index of currently selected printer if (xvt_dm_post_page_setup(get_printrcd()))
// ACTHUNG! Deep hacking of XVT internals! NON PORTABLE! {
// see if user has changed printer
const char* name = (const char *)(_print_rcd + 4); // determine index of currently selected printer
_curprn = pn2.get_pos(name); // ACTHUNG! Deep hacking of XVT internals! NON PORTABLE!
CHECKS(_curprn >= 0, "Can't find printer ", name);
mask.set(MSK_1_PRINTERS, pn1.get(_curprn)); const char* name = (const char *)(_print_rcd + 4);
_curprn = pn2.get_pos(name);
CHECKS(_curprn >= 0, "Can't find printer ", name);
mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
set_win_formlen(); // Update dimensions set_win_formlen(); // Update dimensions
}
else
beep ();
} }
else
beep ();
} }
}
_curprn = atoi(mask.get(MSK_1_PRINTERS)); _curprn = atoi(mask.get(MSK_1_PRINTERS));
if (k == K_INS) if (k == K_INS)
{ {
// tutto resta com'e' // tutto resta com'e'
mask.save (); mask.save ();
TConfig cnf (CONFIG_GENERAL, "Print"); TConfig cnf (CONFIG_GENERAL, "Print");
cnf.set("Size", mask.get(MSK_1_SIZE), "12"); cnf.set("Size", mask.get(MSK_1_SIZE), "12");
cnf.set("Lines", mask.get(MSK_1_LINES), "6"); cnf.set("Lines", mask.get(MSK_1_LINES), "6");
} }
if (k == K_ESC || k == K_ENTER) if (k == K_ESC || k == K_ENTER)
{ {
// riaggiusta stampante default windows come prima // riaggiusta stampante default windows come prima
// curprn e rcd sono quelle di prima // curprn e rcd sono quelle di prima
main_app().enable_menu_item(M_FILE_PG_SETUP); main_app().enable_menu_item(M_FILE_PG_SETUP);
WriteProfileString("windows","device", old_default); WriteProfileString("windows","device", old_default);
} }
if (k == K_ESC) if (k == K_ESC)
{ {
_curprn = oldprn; _curprn = oldprn;
set_printrcd(); set_printrcd();
set_win_formlen(); set_win_formlen();
return; return;
} }
_ncopies = atoi (mask.get (MSK_1_NPAGES)); _ncopies = atoi (mask.get (MSK_1_NPAGES));
switch (atoi (mask.get (MSK_1_TYPE))) switch (atoi (mask.get (MSK_1_TYPE)))
{ {
case 0: // stampante case 0: // stampante
_printertype = winprinter; _printertype = winprinter;
break; break;
case 1: // file case 1: // file
_printertype = fileprinter; _printertype = fileprinter;
_printerfile = mask.get (MSK_1_FILENAME); _printerfile = mask.get (MSK_1_FILENAME);
_curcode = atoi (mask.get (MSK_1_CODES)); _curcode = atoi (mask.get (MSK_1_CODES));
break; break;
case 2: // video case 2: // video
_printertype = screenvis; _printertype = screenvis;
_curcode = 0; _curcode = 0;
break; break;
} }
_isgraphics = mask.get_bool (MSK_1_ISGRAPHICS); _isgraphics = mask.get_bool (MSK_1_ISGRAPHICS);
_ch_size = mask.get_int (MSK_1_SIZE); _ch_size = mask.get_int (MSK_1_SIZE);
_lines_per_inch = mask.get_int (MSK_1_LINES); _lines_per_inch = mask.get_int (MSK_1_LINES);
set_win_formlen (); set_win_formlen ();
#endif #endif
main_app().enable_menu_item (M_FILE_PG_SETUP); main_app().enable_menu_item (M_FILE_PG_SETUP);
} }

View File

@ -218,11 +218,12 @@ TPrintwin::TPrintwin(TTextfile& txt)
{ {
TPrinter& p = main_app().printer(); TPrinter& p = main_app().printer();
#if XVT_OS != XVT_OS_SCOUNIX
_printrcd = p.get_printrcd(); _printrcd = p.get_printrcd();
WINDOW prwin = xvt_print_create_win(_printrcd, (char*)(const char*)main_app().title()); WINDOW prwin = xvt_print_create_win(_printrcd, (char*)(const char*)main_app().title());
set_win(prwin); set_win(prwin);
#endif
_char_size = p.get_char_size(); _char_size = p.get_char_size();
set_font(XVT_FFN_FIXED, XVT_FS_NONE, _char_size); set_font(XVT_FFN_FIXED, XVT_FS_NONE, _char_size);
@ -231,19 +232,21 @@ TPrintwin::TPrintwin(TTextfile& txt)
#endif #endif
_inited = TRUE; _inited = TRUE;
_formlen = p.formlen();
_formwidth = p.formwidth();
#if XVT_OS != XVT_OS_SCOUNIX
if (prwin != NULL_WIN) if (prwin != NULL_WIN)
{ {
xvt_dwin_get_font_metrics(prwin, &_lead, &_ascent, &_descent); xvt_dwin_get_font_metrics(prwin, &_lead, &_ascent, &_descent);
_bg = &p.getbgdesc(); _bg = &p.getbgdesc();
_chary = p.get_dots_per_line(); _chary = p.get_dots_per_line();
_formlen = p.formlen();
_formwidth = p.formwidth();
_hofs = p.get_horz_offset(); _hofs = p.get_horz_offset();
_vofs = p.get_vert_offset(); _vofs = p.get_vert_offset();
} }
else _aborted = TRUE; else _aborted = TRUE;
#endif
} }

View File

@ -1,13 +1,19 @@
#ifndef __STDTYPES_H #ifndef __STDTYPES_H
#define __STDTYPES_H #define __STDTYPES_H
#ifdef XVT
#ifndef XVT_INCL_XVTENV
#include <xvt_env.h>
#endif
#endif
// @M // @M
#define pure =0 #define pure =0
#define FALSE 0 #define FALSE 0
#define TRUE 1 #define TRUE 1
#if XVT_OS == XVT_OS_WIN #if XVT_OS==XVT_OS_WIN
#define HIDDEN static near #define HIDDEN static near
#else #else
#define HIDDEN static #define HIDDEN static

View File

@ -1,10 +1,15 @@
#include <ctype.h> #include <ctype.h>
#include <direct.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <xvt.h> #include <xvt.h>
#if XVT_OS == XVT_OS_WIN
#include <direct.h>
#else
#include <sys/types.h>
#include <sys/stat.h>
#endif
#define __UTILITY_CPP #define __UTILITY_CPP
#include <utility.h> #include <utility.h>

View File

@ -671,8 +671,8 @@ XVT_FNTID xvt_default_font()
CHARY = tm.tmHeight; CHARY = tm.tmHeight;
BASEY = tm.tmAscent; BASEY = tm.tmAscent;
if (CHARY > ROWY-2) CHARY = ROWY-2; if (CHARY > ROWY-2) CHARY = ROWY-2;
}
#endif #endif
}
return DEF_FONT; return DEF_FONT;
} }
@ -681,6 +681,7 @@ void xvt_set_font(WINDOW win, const char* family, int style, int dim)
{ {
CHECK(win != NULL_WIN, "Can't set the font in a NULL window"); CHECK(win != NULL_WIN, "Can't set the font in a NULL window");
#if XVT_OS != XVT_OS_SCOUNIX
XVT_FNTID font = xvt_dwin_get_font(TASK_WIN); XVT_FNTID font = xvt_dwin_get_font(TASK_WIN);
if (family && *family) xvt_font_set_family(font, (char*)family); if (family && *family) xvt_font_set_family(font, (char*)family);
if (dim != 0) xvt_font_set_size(font, dim); if (dim != 0) xvt_font_set_size(font, dim);
@ -691,6 +692,7 @@ void xvt_set_font(WINDOW win, const char* family, int style, int dim)
xvt_dwin_set_font(win, font); xvt_dwin_set_font(win, font);
xvt_font_destroy(font); xvt_font_destroy(font);
#endif
} }