From b71a13da62dce3a5590c4f6c7a1caf6051dd778e Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 27 Mar 1995 14:46:49 +0000 Subject: [PATCH] Cambiato XVT_OS in XVT , XVT4.00 git-svn-id: svn://10.65.10.50/trunk@1177 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/checks.cpp | 10 ++- include/config.cpp | 1 - include/include.mak | 2 +- include/mailbox.cpp | 4 +- include/printer.cpp | 204 ++++++++++++++++++++++--------------------- include/printwin.cpp | 11 ++- include/stdtypes.h | 8 +- include/utility.cpp | 7 +- include/xvtility.cpp | 4 +- 9 files changed, 137 insertions(+), 114 deletions(-) diff --git a/include/checks.cpp b/include/checks.cpp index 20687841f..8d2450833 100755 --- a/include/checks.cpp +++ b/include/checks.cpp @@ -3,13 +3,15 @@ #include #ifdef FOXPRO -#undef XVT_OS +#undef XVT #include #include #endif -#ifdef XVT_OS -#include +#ifdef XVT +#ifndef XVT_INCL_XVT +#include +#endif #if XVT_OS == XVT_OS_WIN #include #include @@ -17,7 +19,7 @@ #include #endif #include -#endif /* XVT_OS */ +#endif /* XVT */ #include diff --git a/include/config.cpp b/include/config.cpp index 8e0ce977a..d03598c46 100755 --- a/include/config.cpp +++ b/include/config.cpp @@ -1,4 +1,3 @@ -#include #include #include diff --git a/include/include.mak b/include/include.mak index 280c5ecfd..a8212d893 100755 --- a/include/include.mak +++ b/include/include.mak @@ -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/gm.h I1=$(IP)stdtypes.h diff --git a/include/mailbox.cpp b/include/mailbox.cpp index 678d268d7..7ab607b00 100755 --- a/include/mailbox.cpp +++ b/include/mailbox.cpp @@ -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 #include @@ -25,7 +25,7 @@ TMessage::TMessage(const char* to, const char* sub, _to = rec; _subject = sub; _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; } diff --git a/include/printer.cpp b/include/printer.cpp index a5908afe8..88ddfd4cd 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -1,5 +1,9 @@ #include + +#include +#include + #if XVT_OS==XVT_OS_SCOUNIX #include #include @@ -8,9 +12,6 @@ #include #endif -#include -#include - #define STYLE_NUM 4 #include @@ -704,7 +705,10 @@ HIDDEN bool set_windows_print_device (TMask_field& f, KEY key) TPrinter::TPrinter() : _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; @@ -1268,7 +1272,9 @@ void TPrinter::set() } ((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); +#endif if (_printertype == fileprinter) mask.set (MSK_1_TYPE, "1"); else if (_printertype == screenvis) @@ -1276,15 +1282,15 @@ void TPrinter::set() else mask.set (MSK_1_TYPE, "0"); - mask.set(MSK_1_PRINTERS, _curprn)); - mask.set(MSK_1_CODES, _curcode)); + mask.set(MSK_1_PRINTERS, _curprn); + mask.set(MSK_1_CODES, _curcode); KEY k; if ((k = mask.run()) == K_ESC) - return; + return; if (k == K_INS) // premuto REGISTRA - mask.save(); + mask.save(); // get user choices @@ -1293,44 +1299,44 @@ void TPrinter::set() PrinterDef& def = (PrinterDef &) get_description (_curprn); 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; + _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; - case 1: - _printertype = localprinter; + case 1: // file + _printertype = fileprinter; + _printerfile = mask.get (MSK_1_FILENAME); + _curcode = atoi (mask.get (MSK_1_CODES)); break; - case 2: - _printertype = spoolprinter; + case 2: // video + + _printertype = screenvis; + _curcode = 0; 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 -_get_windows_printer_names(pn2); -char old_default[80]; -GetProfileString ("windows", "device", ",,,", old_default, sizeof(old_default)); + _get_windows_printer_names(pn2); + char old_default[80]; + GetProfileString ("windows", "device", ",,,", old_default, sizeof(old_default)); -for (i = 0; i < pn2.items (); i++) - pn1.add(i); + for (i = 0; i < pn2.items (); i++) + pn1.add(i); ((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items(pn1, pn2); 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); if (_printertype == fileprinter) - mask.set (MSK_1_TYPE, "1"); + mask.set (MSK_1_TYPE, "1"); else if (_printertype == screenvis) - mask.set (MSK_1_TYPE, "2"); + mask.set (MSK_1_TYPE, "2"); else - mask.set (MSK_1_TYPE, "0"); + mask.set (MSK_1_TYPE, "0"); mask.set_handler (MSK_1_PRINTERS, set_windows_print_device); @@ -1355,79 +1361,79 @@ for (i = 0; i < pn2.items (); i++) int oldprn = _curprn; 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 (xvt_dm_post_page_setup(get_printrcd())) + if (k == DLG_SETPRINT) { - // see if user has changed printer - // determine index of currently selected printer - // ACTHUNG! Deep hacking of XVT internals! NON PORTABLE! - - 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)); + // l'handler setta default di windows a quella nel listbox e ribecca l'rcd + if (xvt_dm_post_page_setup(get_printrcd())) + { + // see if user has changed printer + // determine index of currently selected printer + // ACTHUNG! Deep hacking of XVT internals! NON PORTABLE! + + 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) -{ - // tutto resta com'e' - mask.save (); - TConfig cnf (CONFIG_GENERAL, "Print"); - cnf.set("Size", mask.get(MSK_1_SIZE), "12"); - cnf.set("Lines", mask.get(MSK_1_LINES), "6"); -} -if (k == K_ESC || k == K_ENTER) -{ - // riaggiusta stampante default windows come prima - // curprn e rcd sono quelle di prima - main_app().enable_menu_item(M_FILE_PG_SETUP); - WriteProfileString("windows","device", old_default); -} -if (k == K_ESC) -{ - _curprn = oldprn; - set_printrcd(); - set_win_formlen(); - return; -} + if (k == K_INS) + { + // tutto resta com'e' + mask.save (); + TConfig cnf (CONFIG_GENERAL, "Print"); + cnf.set("Size", mask.get(MSK_1_SIZE), "12"); + cnf.set("Lines", mask.get(MSK_1_LINES), "6"); + } + if (k == K_ESC || k == K_ENTER) + { + // riaggiusta stampante default windows come prima + // curprn e rcd sono quelle di prima + main_app().enable_menu_item(M_FILE_PG_SETUP); + WriteProfileString("windows","device", old_default); + } + if (k == K_ESC) + { + _curprn = oldprn; + set_printrcd(); + set_win_formlen(); + return; + } -_ncopies = atoi (mask.get (MSK_1_NPAGES)); + _ncopies = atoi (mask.get (MSK_1_NPAGES)); -switch (atoi (mask.get (MSK_1_TYPE))) -{ - case 0: // stampante - _printertype = winprinter; - 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; -} + switch (atoi (mask.get (MSK_1_TYPE))) + { + case 0: // stampante + _printertype = winprinter; + 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; + } -_isgraphics = mask.get_bool (MSK_1_ISGRAPHICS); -_ch_size = mask.get_int (MSK_1_SIZE); -_lines_per_inch = mask.get_int (MSK_1_LINES); -set_win_formlen (); + _isgraphics = mask.get_bool (MSK_1_ISGRAPHICS); + _ch_size = mask.get_int (MSK_1_SIZE); + _lines_per_inch = mask.get_int (MSK_1_LINES); + set_win_formlen (); #endif -main_app().enable_menu_item (M_FILE_PG_SETUP); + main_app().enable_menu_item (M_FILE_PG_SETUP); } diff --git a/include/printwin.cpp b/include/printwin.cpp index ab0016820..4f5752d17 100755 --- a/include/printwin.cpp +++ b/include/printwin.cpp @@ -218,11 +218,12 @@ TPrintwin::TPrintwin(TTextfile& txt) { TPrinter& p = main_app().printer(); +#if XVT_OS != XVT_OS_SCOUNIX _printrcd = p.get_printrcd(); WINDOW prwin = xvt_print_create_win(_printrcd, (char*)(const char*)main_app().title()); set_win(prwin); - +#endif _char_size = p.get_char_size(); set_font(XVT_FFN_FIXED, XVT_FS_NONE, _char_size); @@ -231,19 +232,21 @@ TPrintwin::TPrintwin(TTextfile& txt) #endif _inited = TRUE; + _formlen = p.formlen(); + _formwidth = p.formwidth(); +#if XVT_OS != XVT_OS_SCOUNIX if (prwin != NULL_WIN) { xvt_dwin_get_font_metrics(prwin, &_lead, &_ascent, &_descent); _bg = &p.getbgdesc(); - _chary = p.get_dots_per_line(); - _formlen = p.formlen(); - _formwidth = p.formwidth(); + _chary = p.get_dots_per_line(); _hofs = p.get_horz_offset(); _vofs = p.get_vert_offset(); } else _aborted = TRUE; +#endif } diff --git a/include/stdtypes.h b/include/stdtypes.h index b3d0eec71..bf9bec293 100755 --- a/include/stdtypes.h +++ b/include/stdtypes.h @@ -1,13 +1,19 @@ #ifndef __STDTYPES_H #define __STDTYPES_H +#ifdef XVT +#ifndef XVT_INCL_XVTENV +#include +#endif +#endif + // @M #define pure =0 #define FALSE 0 #define TRUE 1 -#if XVT_OS == XVT_OS_WIN +#if XVT_OS==XVT_OS_WIN #define HIDDEN static near #else #define HIDDEN static diff --git a/include/utility.cpp b/include/utility.cpp index 0731c8179..5539fda2b 100755 --- a/include/utility.cpp +++ b/include/utility.cpp @@ -1,10 +1,15 @@ #include -#include #include #include #include #include +#if XVT_OS == XVT_OS_WIN +#include +#else +#include +#include +#endif #define __UTILITY_CPP #include diff --git a/include/xvtility.cpp b/include/xvtility.cpp index ad42310e4..70aa94bc3 100755 --- a/include/xvtility.cpp +++ b/include/xvtility.cpp @@ -671,8 +671,8 @@ XVT_FNTID xvt_default_font() CHARY = tm.tmHeight; BASEY = tm.tmAscent; if (CHARY > ROWY-2) CHARY = ROWY-2; - } #endif + } 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"); +#if XVT_OS != XVT_OS_SCOUNIX XVT_FNTID font = xvt_dwin_get_font(TASK_WIN); if (family && *family) xvt_font_set_family(font, (char*)family); 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_font_destroy(font); +#endif }