Modifiche varie a viswin, browfile, printer
git-svn-id: svn://10.65.10.50/trunk@771 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									1b2466f0cd
								
							
						
					
					
						commit
						aadf264df4
					
				@ -65,6 +65,13 @@ BEGIN
 | 
			
		||||
  HELP "Dimensioni del carattere di stampa"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BOOLEAN MSK_1_ISGRAPHICS
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 4 8 "Stampa elementi grafici"
 | 
			
		||||
  HELP "Indicare se stampare elementi grafici (linee, box, logo) quando la stampante lo consente"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
LIST MSK_1_LINES 3
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 52 6 "Linee/Inch " 
 | 
			
		||||
@ -94,11 +101,10 @@ END
 | 
			
		||||
       
 | 
			
		||||
BOOLEAN MSK_1_ISGRAPHICS
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 4 8 "Stampa elementi grafici"
 | 
			
		||||
  PROMPT 4 8 "Salva configurazione"
 | 
			
		||||
  HELP "Indicare se stampare elementi grafici (linee, box, logo) quando la stampante lo consente"
 | 
			
		||||
END
 | 
			
		||||
       
 | 
			
		||||
       
 | 
			
		||||
GROUPBOX DLG_NULL 74 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 1 9 ""       
 | 
			
		||||
 | 
			
		||||
@ -35,11 +35,12 @@ public:
 | 
			
		||||
  TViswin* vis_win() const { return _viswin; }
 | 
			
		||||
 | 
			
		||||
  void     add_line(const char* l);            
 | 
			
		||||
  void     set_text(const char* file);  
 | 
			
		||||
  long     set_text(const char* file, const char* line = NULL);  
 | 
			
		||||
  // TBI posiziona su riga e colonna passate
 | 
			
		||||
  void     goto_pos(long r, long c);
 | 
			
		||||
  void     goto_top();
 | 
			
		||||
  void     goto_end();
 | 
			
		||||
  void     refresh();
 | 
			
		||||
  void     close(); 
 | 
			
		||||
  
 | 
			
		||||
  // link processor
 | 
			
		||||
 | 
			
		||||
@ -867,7 +867,8 @@ bool TPrinter::printrow(TPrintrow* rowtoprint)
 | 
			
		||||
  if (_currentpage < _frompage || _currentpage > _topage)
 | 
			
		||||
    return TRUE;
 | 
			
		||||
 | 
			
		||||
  TString rw (rowtoprint == NULL ? "" : (_printertype == screenvis || _printertype == winprinter ?
 | 
			
		||||
  TString rw (rowtoprint == NULL ? "" : (_printertype == screenvis || _printertype == winprinter || 
 | 
			
		||||
                                         _printertype == export ? 
 | 
			
		||||
                                         rowtoprint->row_codified () :
 | 
			
		||||
                                         rowtoprint->row ()));
 | 
			
		||||
  rw.rtrim ();
 | 
			
		||||
@ -912,7 +913,7 @@ bool TPrinter::printrow(TPrintrow* rowtoprint)
 | 
			
		||||
  {
 | 
			
		||||
    // add line to txt
 | 
			
		||||
    if (!_frozen)
 | 
			
		||||
      _txt.append (rw);
 | 
			
		||||
      _txt.append(rw);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -47,10 +47,11 @@ extern "C"
 | 
			
		||||
#define K_SHIFT_RIGHT (K_SHIFT + K_RIGHT)
 | 
			
		||||
#define K_ALT_RIGHT   (K_CTRL  + 'K')
 | 
			
		||||
#define K_ALT_LEFT    (K_CTRL  + 'L')
 | 
			
		||||
#define CTRL_C        ('C')
 | 
			
		||||
#define CTRL_E        ('E')
 | 
			
		||||
#define CTRL_S        ('S')
 | 
			
		||||
#define CTRL_R        ('R')
 | 
			
		||||
#define CTRL_C        (K_CTRL  + 'C')
 | 
			
		||||
#define CTRL_E        (K_CTRL  + 'E')
 | 
			
		||||
#define CTRL_S        (K_CTRL  + 'S')
 | 
			
		||||
#define CTRL_R        (K_CTRL  + 'R')
 | 
			
		||||
#define K_CTRLTAB     (K_CTRL  + K_TAB)
 | 
			
		||||
 | 
			
		||||
// vista la mania degli 883, eccoti un po' di concerti di Mozart
 | 
			
		||||
const long E_ADDLINE = 488L;
 | 
			
		||||
@ -91,12 +92,17 @@ void TViswin::exec_link()
 | 
			
		||||
        }
 | 
			
		||||
      }               
 | 
			
		||||
    } // _toplevel 
 | 
			
		||||
    if (_toplevel)
 | 
			
		||||
    {
 | 
			
		||||
      set_focus();
 | 
			
		||||
      _inside_linkexec = TRUE;
 | 
			
		||||
      check_link();
 | 
			
		||||
      _need_update = TRUE;
 | 
			
		||||
      force_update();
 | 
			
		||||
      do_events();
 | 
			
		||||
      check_link (&_point);
 | 
			
		||||
      _inside_linkexec = FALSE;  
 | 
			
		||||
    }
 | 
			
		||||
  } // linkID != -1
 | 
			
		||||
  else beep();
 | 
			
		||||
}
 | 
			
		||||
@ -111,7 +117,16 @@ void TViswin::display_link (long y, long x1, long x2, const char *d)
 | 
			
		||||
#if XVT_OS == XVT_OS_WIN
 | 
			
		||||
    xvt_statbar_set(d);
 | 
			
		||||
#endif
 | 
			
		||||
    xvt_enable_control (_link_button, TRUE);
 | 
			
		||||
    if (_link_button != -1) xvt_enable_control (_link_button, TRUE);
 | 
			
		||||
 | 
			
		||||
    if (!_toplevel && !_inside_linkexec)
 | 
			
		||||
    {
 | 
			
		||||
      // chiama l'handler per maschere con FALSE come terzo parametro
 | 
			
		||||
      MASK_LINKHANDLER pl = _brwfld->_lh;
 | 
			
		||||
      if (pl != NULL)
 | 
			
		||||
        pl(_brwfld->mask(), _linkID,
 | 
			
		||||
           _multiple ? (const char*)_multiple_link : (const char*)_linktxt, FALSE); 
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -126,7 +141,7 @@ void TViswin::erase_link (long y, long x1, long x2)
 | 
			
		||||
    xvt_statbar_set ("");
 | 
			
		||||
    xvt_statbar_refresh ();
 | 
			
		||||
#endif
 | 
			
		||||
    xvt_enable_control (_link_button, FALSE);
 | 
			
		||||
    if (_link_button != -1) xvt_enable_control (_link_button, FALSE);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -241,15 +256,6 @@ bool TViswin::check_link (TPoint * p)
 | 
			
		||||
    strcpy (descr, pdescr);
 | 
			
		||||
    display_link (y, x1, x2, descr);
 | 
			
		||||
    
 | 
			
		||||
    if (!_toplevel)
 | 
			
		||||
    {
 | 
			
		||||
      // chiama l'handler per maschere con FALSE come terzo parametro
 | 
			
		||||
      MASK_LINKHANDLER pl = _brwfld->_lh;
 | 
			
		||||
      if (pl != NULL)
 | 
			
		||||
        pl(_brwfld->mask(), _linkID,
 | 
			
		||||
           _multiple ? (const char*)_multiple_link : (const char*)_linktxt, FALSE); 
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  }
 | 
			
		||||
  return FALSE;
 | 
			
		||||
@ -1518,12 +1524,25 @@ bool TViswin::on_key (KEY key)
 | 
			
		||||
    if (_toplevel)
 | 
			
		||||
      exec_link();
 | 
			
		||||
    break;
 | 
			
		||||
  case K_CTRLTAB:
 | 
			
		||||
    if (!_toplevel)
 | 
			
		||||
      _brwfld->mask().send_key(K_TAB,0);
 | 
			
		||||
    break;
 | 
			
		||||
  case K_TAB: 
 | 
			
		||||
    if (!is_running())
 | 
			
		||||
    {   
 | 
			
		||||
      _need_update = TRUE;
 | 
			
		||||
      update();
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
      if (_curbut == (_buttons - 1))
 | 
			
		||||
        _curbut = 0;
 | 
			
		||||
      else
 | 
			
		||||
        _curbut++;
 | 
			
		||||
    }
 | 
			
		||||
    break;  
 | 
			
		||||
    
 | 
			
		||||
  case K_BTAB:
 | 
			
		||||
    if (_curbut == 0)
 | 
			
		||||
      _curbut = _buttons - 1;
 | 
			
		||||
@ -1536,7 +1555,7 @@ bool TViswin::on_key (KEY key)
 | 
			
		||||
    {
 | 
			
		||||
      exec_link();
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    else if (_toplevel)
 | 
			
		||||
      dispatch_e_char (_button[_curbut], K_SPACE);
 | 
			
		||||
    break;
 | 
			
		||||
  case K_LHOME:
 | 
			
		||||
@ -1854,6 +1873,50 @@ void TViswin::close_print ()
 | 
			
		||||
  force_update ();
 | 
			
		||||
}                       
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void TViswin::goto_end()
 | 
			
		||||
{
 | 
			
		||||
  goto_pos(0l, _txt.lines () - _textrows);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TViswin::goto_top()
 | 
			
		||||
{                     
 | 
			
		||||
  goto_pos(0l,0l);;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TViswin::goto_pos(long r, long c)
 | 
			
		||||
{         
 | 
			
		||||
  if (r >= _txt.lines() || c >= 256)
 | 
			
		||||
    return;           
 | 
			
		||||
  check_link();            
 | 
			
		||||
  erase_point();
 | 
			
		||||
  if (_isselection) erase_selection();
 | 
			
		||||
  _point.x = c;
 | 
			
		||||
  _point.y = r;
 | 
			
		||||
  update_thumb (c,r);
 | 
			
		||||
  check_link(&_point);
 | 
			
		||||
  if (_isselection) display_selection();
 | 
			
		||||
  display_point();
 | 
			
		||||
  refresh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TViswin::refresh()
 | 
			
		||||
{ 
 | 
			
		||||
  _need_update = TRUE;
 | 
			
		||||
  force_update();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int TViswin::search(const char* txt, long from, bool down)
 | 
			
		||||
{
 | 
			
		||||
  return -1l;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int TViswin::replace(long line, const char* txt, int pos, int len)
 | 
			
		||||
{           
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TViswin ::TViswin (const char *fname,
 | 
			
		||||
                   const char *title,
 | 
			
		||||
                   bool editbutton,
 | 
			
		||||
@ -1870,7 +1933,7 @@ TViswin ::TViswin (const char *fname,
 | 
			
		||||
                   _link_displayed (FALSE), _point_displayed (FALSE), _selecting (FALSE),
 | 
			
		||||
                   _scrolling (FALSE), _selflag (FALSE), _need_update (TRUE), _need_scroll (none),
 | 
			
		||||
                   _multiple (FALSE), _rulers(rulers),
 | 
			
		||||
                   _frozen (FALSE), _brwfld(brwfld)
 | 
			
		||||
                   _frozen (FALSE), _brwfld(brwfld), _link_button(-1)
 | 
			
		||||
{
 | 
			
		||||
  if (title == NULL)
 | 
			
		||||
    title = (fname ? fname : "Anteprima di stampa");
 | 
			
		||||
@ -1969,16 +2032,18 @@ TViswin ::TViswin (const char *fname,
 | 
			
		||||
  _bg = _toplevel ? main_app().printer().getbgdesc() : _brwfld->get_bg_desc(); 
 | 
			
		||||
  _isbackground = _bg->items () > 0;
 | 
			
		||||
  _formlen = _toplevel ? main_app().printer().formlen() : maxalt;
 | 
			
		||||
  _linkID = -1;
 | 
			
		||||
  _inside_linkexec = FALSE;
 | 
			
		||||
 | 
			
		||||
  for (i = 0; i < _links->items (); i++)
 | 
			
		||||
  {
 | 
			
		||||
    TToken_string & t = (TToken_string &) (*_links)[i];
 | 
			
		||||
    char f = *(t.get (1));
 | 
			
		||||
    char b = *(t.get (2));
 | 
			
		||||
    t.restart ();
 | 
			
		||||
    t.restart();
 | 
			
		||||
    _txt.set_hotspots(f, b);
 | 
			
		||||
  }
 | 
			
		||||
  _hotspots = &(_txt.hotspots ());
 | 
			
		||||
  _hotspots = &(_txt.hotspots());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TViswin ::~TViswin ()
 | 
			
		||||
@ -2029,11 +2094,18 @@ void TBrowsefile_field::create(WINDOW parent)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void  TBrowsefile_field::set_text(const char* file)
 | 
			
		||||
long TBrowsefile_field::set_text(const char* file, const char* line)
 | 
			
		||||
  // se line != NULL ritorna il numero dell'ultima riga del file che
 | 
			
		||||
  // comincia (trimmata) come passato; se non la trova ritorna -1
 | 
			
		||||
{       
 | 
			
		||||
  FILE* instr = fopen(file,"r");
 | 
			
		||||
  if (instr == NULL) 
 | 
			
		||||
    error_box("File non trovato: %s", file); 
 | 
			
		||||
    fatal_box("File non trovato: %s", file);  
 | 
			
		||||
  
 | 
			
		||||
  TString256 tmpp;
 | 
			
		||||
  long ret   = -1l; 
 | 
			
		||||
  long lines = 0l;   
 | 
			
		||||
  
 | 
			
		||||
  while (!feof(instr))
 | 
			
		||||
  {
 | 
			
		||||
    if (fgets(__tmp_string, sizeof (__tmp_string), instr) == NULL) 
 | 
			
		||||
@ -2041,8 +2113,18 @@ void  TBrowsefile_field::set_text(const char* file)
 | 
			
		||||
    if (__tmp_string[strlen(__tmp_string)-1] == '\n') 
 | 
			
		||||
      __tmp_string[strlen(__tmp_string)-1] = '\0';
 | 
			
		||||
    add_line(__tmp_string);
 | 
			
		||||
    if (line != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      tmpp = __tmp_string; 
 | 
			
		||||
      if (tmpp.find(line) != -1)
 | 
			
		||||
        ret = lines;
 | 
			
		||||
    }                   
 | 
			
		||||
    lines++;
 | 
			
		||||
  }                         
 | 
			
		||||
  fclose(instr);         
 | 
			
		||||
  
 | 
			
		||||
  _viswin->close_print(); 
 | 
			
		||||
  return ret;
 | 
			
		||||
}                                  
 | 
			
		||||
 | 
			
		||||
int TBrowsefile_field::find_link(const char* descr)
 | 
			
		||||
@ -2070,6 +2152,7 @@ int TBrowsefile_field::enable_link(const char *descr, char fg, char bg)
 | 
			
		||||
    b[0] = bg;
 | 
			
		||||
    tt->add(b);
 | 
			
		||||
    lnk = _links.add(tt);
 | 
			
		||||
    _viswin->_txt.set_hotspots(fg, bg);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return lnk;
 | 
			
		||||
@ -2108,14 +2191,20 @@ void  TBrowsefile_field::close()
 | 
			
		||||
 | 
			
		||||
void  TBrowsefile_field::goto_pos(long r, long c)
 | 
			
		||||
{
 | 
			
		||||
  _viswin->goto_pos(r,c);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void  TBrowsefile_field::goto_top()           
 | 
			
		||||
{ 
 | 
			
		||||
  dispatch_e_char(_viswin->win(), K_END);  
 | 
			
		||||
  _viswin->goto_top();  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void  TBrowsefile_field::goto_end()           
 | 
			
		||||
{ 
 | 
			
		||||
  dispatch_e_char(_viswin->win(), K_HOME); 
 | 
			
		||||
  _viswin->goto_end(); 
 | 
			
		||||
}                       
 | 
			
		||||
 | 
			
		||||
void  TBrowsefile_field::refresh()
 | 
			
		||||
{
 | 
			
		||||
  _viswin->refresh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -83,6 +83,7 @@ class TViswin : public TScroll_window
 | 
			
		||||
  bool     _frozen;
 | 
			
		||||
  bool     _toplevel;             
 | 
			
		||||
  bool     _rulers;
 | 
			
		||||
  bool     _inside_linkexec;
 | 
			
		||||
  
 | 
			
		||||
  // viene istanziato soltanto se e' usata come controllo BROWSEFILE                          
 | 
			
		||||
  TBrowsefile_field* _brwfld;
 | 
			
		||||
@ -139,8 +140,16 @@ public:
 | 
			
		||||
  void abort_print();
 | 
			
		||||
  long lines() { return _txt.lines(); }
 | 
			
		||||
 | 
			
		||||
  void goto_end();
 | 
			
		||||
  void goto_top();
 | 
			
		||||
  void goto_pos(long,long);
 | 
			
		||||
  void refresh();
 | 
			
		||||
 | 
			
		||||
  void add_line(const char* l);                                       
 | 
			
		||||
  
 | 
			
		||||
  int  search (const char* txt, long from = 0, bool down = FALSE);
 | 
			
		||||
  int  replace(long line, const char* txt, int pos = 0, int len = -1);
 | 
			
		||||
  
 | 
			
		||||
  TViswin (const char* fname  = NULL, 
 | 
			
		||||
           const char* title  = NULL, 
 | 
			
		||||
           bool editbutton    = TRUE, 
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user