From 330f90f7ead0946ac3d3e10c8bb7e912081fe83c Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 28 Jan 1998 09:09:57 +0000 Subject: [PATCH] printer.cpp Riaggiorna la lista delle stampanti dopo aver premuto il tasto Imposta: MI6251 progind.cpp Corrette dimensioni barra di attesa in 3D relation.cpp Tolto il limite di 80 caratteri sulla descrizione dei files scanner.h Tolto #include scanner.cpp Modificato il metodo TScanner::rectangle git-svn-id: svn://10.65.10.50/trunk@6044 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/printer.cpp | 34 +++++++++++++++------------------- include/progind.cpp | 4 ++-- include/relation.cpp | 6 +++--- include/scanner.cpp | 25 ++++++++++++++++--------- include/scanner.h | 6 +----- include/sheet.cpp | 2 +- 6 files changed, 38 insertions(+), 39 deletions(-) diff --git a/include/printer.cpp b/include/printer.cpp index f9b1f31c4..32b8f74cf 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -79,7 +79,6 @@ class TPrint_intersector : public TString_array char f_horizontal() const { return _fink[9]; } char f_vertical() const { return _fink[10]; } - public: // aggiunge un elemento grafico @@ -95,8 +94,6 @@ class TPrint_intersector : public TString_array virtual ~TPrint_intersector() {} }; - - char TPrint_intersector::check_intersection(int x, int y, char ch) { char a = ' ', b = ' ', c = ' ', d = ' '; @@ -229,13 +226,11 @@ PrintWhat; #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 -void TPrinter::_get_windows_printer_names (TToken_string & t) +void TPrinter::_get_windows_printer_names (TToken_string& t) { - char *buf = new char[4096]; // ammazzao' - - GetProfileString ("devices", NULL, "", buf, 4096); - - for (int i = 0; i < 4095; i++) + char* buf = t.get_buffer(2048); // ammazzao' + GetProfileString ("devices", NULL, "", buf, t.size()); + for (int i = 0; i < t.size(); i++) { if (buf[i] == '\0') { @@ -243,8 +238,6 @@ void TPrinter::_get_windows_printer_names (TToken_string & t) else break; } } - t = buf; - delete buf; } BOOLEAN XVT_CALLCONV1 TPrinter::start_winprint (long data) @@ -1880,7 +1873,7 @@ bool TPrinter::set() TMask mask("bagn001a"); - TToken_string pn1(50), pn2(100); + TToken_string pn1(50); int i; mask.set(MSK_FILENAME, _printerfile); @@ -1890,9 +1883,7 @@ bool TPrinter::set() mask.enable(DLG_OK, can_save); // mask.enable(DLG_SAVEREC, can_save); -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 - - pn2 = getprinternames(); + TToken_string& pn2 = getprinternames(); char old_default[80]; GetProfileString ("windows", "device", ",,,", old_default, sizeof(old_default)); @@ -1938,9 +1929,16 @@ bool TPrinter::set() if (k == DLG_SETPRINT) { // l'handler setta default di windows a quella nel listbox e ribecca l'rcd -#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32 if (xvt_dm_post_page_setup(get_printrcd())) - { + { + // Ricarica la lista delle stampanti (L'utente puo' aggiungerne!) + _get_windows_printer_names(pn2); + pn1.cut(0); + int i = 0; + FOR_EACH_TOKEN(pn2, tok) + pn1.add(i++); + plst.replace_items(pn1, pn2); // Genera printer list + // see if user has changed printer // determine index of currently selected printer // ACTHUNG! Deep hacking of XVT internals! NON PORTABLE! @@ -1958,7 +1956,6 @@ bool TPrinter::set() } else beep (); -#endif } } @@ -2002,7 +1999,6 @@ bool TPrinter::set() _lines_per_inch = mask.get_int (MSK_LINES); _isgraphics = mask.get_bool (MSK_ISGRAPHICS); set_win_formlen (); -#endif if (k == K_INS) save_configuration(); diff --git a/include/progind.cpp b/include/progind.cpp index 8a53f5779..da46d2ec8 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -133,8 +133,8 @@ void TIndwin::update_bar() // Rettangolo scavato xi_draw_3d_rect(w, &r, TRUE, 2, BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR); - b.left += 2; b.right -= 1; - b.top += 2; b.bottom -= 1; + b.left += 2; b.right -= 2; + b.top += 2; b.bottom -= 2; // Rettangolo in rilievo b.right = b.left + int((b.right-b.left)*prc); xi_draw_3d_rect(w, &b, FALSE, 2, diff --git a/include/relation.cpp b/include/relation.cpp index 9e1da4f0a..6e7c94958 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include #include @@ -1999,6 +1998,7 @@ void TRelation_description::read_rel() TTrec trec; trec.get(which_file); TToken_string ttmp(64); + TString dfld(256); for (int f = 0; f < trec.fields(); f++) { @@ -2006,7 +2006,7 @@ void TRelation_description::read_rel() const TString16 name(ttmp.get(0)); if (!name.blank()) { - TString80 dfld(conf.get(name, NULL, -1, "Missing description")); + dfld = conf.get(name, NULL, -1, "Missing description"); if (!dfld.blank() && dfld[0] != '#') { ttmp.add(dfld,4); @@ -2260,7 +2260,7 @@ const char* TRelation_description::get_field_description(const char* field) { TString_array& fld = (TString_array&)_fields[_cur_file]; - for (int i = 0; i < fld.items(); i++) + for (int i = fld.items()-1; i >= 0; i--) { TToken_string& tt = fld.row(i); if (strcmp(tt.get(0),field) == 0) diff --git a/include/scanner.cpp b/include/scanner.cpp index 8c77bde2a..951a1f805 100755 --- a/include/scanner.cpp +++ b/include/scanner.cpp @@ -22,7 +22,7 @@ TScanner::TScanner(const char* filename) _token(128), _key(2), _buffer(1024*16) { setbuf((char*)(const char*)_buffer, _buffer.size()); - open(filename); + open(filename, ios::in | ios::nocreate, filebuf::sh_read); if (bad()) fatal_box("Impossibile aprire %s", filename); } @@ -90,12 +90,12 @@ const TString& TScanner::string() return _token; } -void TScanner::rectangle(RCT& rect) +void TScanner::rectangle(short& left, short& top, short& right, short& bottom) { - rect.left = integer(); - rect.top = integer(); - rect.right = integer(); - rect.bottom = integer(); + left = integer(); + top = integer(); + right = integer(); + bottom = integer(); } int TScanner::integer() @@ -138,13 +138,20 @@ void TScanner::push(const char* s) _pushed = TRUE; } +// Certified 100% +// @doc EXTERNAL +// @mfunc Va al paragrafo

+// @rdesc Ritorna TRUE se il paragrafo esiste bool TScanner::paragraph(const char* name) { - TString p; - p << '[' << name << ']'; + TString p = name; + if (p[0] != '[') + { + p.insert("[", 0); + p << ']'; + } seekg(0L); - while (line().not_empty()) if (token() == p) return TRUE; diff --git a/include/scanner.h b/include/scanner.h index 21be169c5..ca21f207c 100755 --- a/include/scanner.h +++ b/include/scanner.h @@ -9,10 +9,6 @@ #include #endif -#ifndef INCL_XVTH -#include -#endif - // @doc EXTERNAL // @class TScanner | Classe per le lettura e la traduzione dei file @@ -57,7 +53,7 @@ public: const TString& equal() { return line('='); } // @cmember Legge le coordinate di un rettangolo - void rectangle(RCT& rect); + void rectangle(short& left, short& top, short& right, short& bottom); // @cmember Ritorna un intero letto dal file int integer(); // @cmember Ritorna un double letto dal file diff --git a/include/sheet.cpp b/include/sheet.cpp index f817cc378..dbac42b1a 100755 --- a/include/sheet.cpp +++ b/include/sheet.cpp @@ -743,7 +743,7 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev) if (_disabled[rec]) { - xiev->v.cell_request.color = DISABLED_COLOR; +// xiev->v.cell_request.color = DISABLED_COLOR; // Uniforme coi TField_control xiev->v.cell_request.back_color = DISABLED_BACK_COLOR; } else