confapp.cpp Migliorata leggibilita' ed indentazione
config.cpp Sostituiti fexist con TFilename::exist controls.* Migliorato supporto per il resizing dei campi date.* Promossi da byte a int i parametri di weekday e monthname git-svn-id: svn://10.65.10.50/trunk@6576 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									b7af469197
								
							
						
					
					
						commit
						f99c477005
					
				@ -111,17 +111,17 @@ void TConfig_application::load_config()
 | 
			
		||||
 | 
			
		||||
void TConfig_application::do_config(int m)
 | 
			
		||||
{
 | 
			
		||||
  TString _parag(name()); 
 | 
			
		||||
  _parag = name(); 
 | 
			
		||||
  if (m < _paragraphs.items())
 | 
			
		||||
    _parag = (TString&)_paragraphs[m];
 | 
			
		||||
  else _parag.cut(2); 
 | 
			
		||||
  else 
 | 
			
		||||
    _parag.cut(2); 
 | 
			
		||||
 | 
			
		||||
  load_config();
 | 
			
		||||
  for (;;)
 | 
			
		||||
  {
 | 
			
		||||
    
 | 
			
		||||
    const TFilename maskname(_cnf->get("EdMask"));
 | 
			
		||||
    if (!maskname.empty())
 | 
			
		||||
    if (maskname.not_empty() && maskname.exist())
 | 
			
		||||
    {
 | 
			
		||||
      if (_m) delete _m;
 | 
			
		||||
      _m= new TMask(maskname);
 | 
			
		||||
@ -162,8 +162,6 @@ void TConfig_application::on_firm_change()
 | 
			
		||||
  load_mask();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void TConfig_application::set_config(int which) 
 | 
			
		||||
{
 | 
			
		||||
  _which_config= which;
 | 
			
		||||
 | 
			
		||||
@ -622,14 +622,14 @@ TConfig::TConfig(int which_config, const char* paragraph)
 | 
			
		||||
  case CONFIG_STAMPE:
 | 
			
		||||
    _file = firm2dir(-1);       // Directory dati
 | 
			
		||||
    _file.add("config");        // Directory config
 | 
			
		||||
    if (!fexist(_file))         // Creala se necessario
 | 
			
		||||
    if (!_file.exist())         // Creala se necessario
 | 
			
		||||
      make_dir(_file);
 | 
			
		||||
 | 
			
		||||
    switch (which_config)
 | 
			
		||||
    {
 | 
			
		||||
    case CONFIG_STUDIO:
 | 
			
		||||
      _file.add("prassis.ini");
 | 
			
		||||
      if (!fexist(_file))
 | 
			
		||||
      if (!_file.exist())
 | 
			
		||||
        fcopy("prassis.ini", _file);
 | 
			
		||||
      break;
 | 
			
		||||
    case CONFIG_STAMPE:
 | 
			
		||||
 | 
			
		||||
@ -49,7 +49,7 @@ extern "C"
 | 
			
		||||
HIDDEN bool _button_blocked = FALSE;
 | 
			
		||||
HIDDEN int  _last_mouse_button = 0;
 | 
			
		||||
 | 
			
		||||
short get_focus_id(WINDOW win)
 | 
			
		||||
short low_get_focus_id(WINDOW win)
 | 
			
		||||
{
 | 
			
		||||
  XI_OBJ * itf = xi_get_itf(win);
 | 
			
		||||
  XI_OBJ * obj = xi_get_focus(itf);
 | 
			
		||||
@ -62,6 +62,16 @@ short get_focus_id(WINDOW win)
 | 
			
		||||
  return obj->cid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Doesn't work: DON'T USE!
 | 
			
		||||
void low_set_focus_id(WINDOW win, short cid)
 | 
			
		||||
{
 | 
			
		||||
  XI_OBJ * itf = xi_get_itf(win);
 | 
			
		||||
  if (cid > 0)
 | 
			
		||||
  {
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    itf->v.itf->focus_obj = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// #define CAMPI_SCAVATI FALSE
 | 
			
		||||
HIDDEN int X_FU_MULTIPLE = 0;
 | 
			
		||||
@ -173,7 +183,7 @@ XVT_FNTID xvt_default_font(bool bold)
 | 
			
		||||
    
 | 
			
		||||
    int leading, ascent, descent;
 | 
			
		||||
    xvt_dwin_get_font_metrics(TASK_WIN, &leading, &ascent, &descent);
 | 
			
		||||
    CHARY = ascent + descent;
 | 
			
		||||
    CHARY = ascent + descent + 1;
 | 
			
		||||
    BASEY = ascent;
 | 
			
		||||
 | 
			
		||||
    if (CHARX > MAX_CHARX) 
 | 
			
		||||
@ -279,7 +289,11 @@ void customize_colors()
 | 
			
		||||
  xi_set_pref(XI_PREF_COLOR_CTRL,     MASK_BACK_COLOR);
 | 
			
		||||
  xi_set_pref(XI_PREF_COLOR_DARK,     MASK_DARK_COLOR);
 | 
			
		||||
  xi_set_pref(XI_PREF_COLOR_DISABLED, DISABLED_COLOR);
 | 
			
		||||
#ifdef XI_R4
 | 
			
		||||
  xi_set_pref(XI_PREF_COMBO_ICON,     ICO_COMBO);
 | 
			
		||||
#else
 | 
			
		||||
  xi_set_pref(XI_PREF_COMBO_ICON,     COMBO_ICON);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  BTN_BACK_COLOR = colors.get_color("ButtonBack", NULL, -1, BTN_BACK_COLOR);
 | 
			
		||||
  aga_set_pref(AGA_PREF_BTN_COLOR_CTRL, BTN_BACK_COLOR);
 | 
			
		||||
@ -533,10 +547,13 @@ HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
 | 
			
		||||
    }
 | 
			
		||||
    break;
 | 
			
		||||
  case a_select:
 | 
			
		||||
    if (xiev->v.xi_obj->type == XIT_LIST)
 | 
			
		||||
      ctl = (TControl*)xi_get_app_data(xiev->v.xi_obj);
 | 
			
		||||
    else
 | 
			
		||||
      ctl = (TControl*)xi_get_app_data(xiev->v.xi_obj->parent);
 | 
			
		||||
    switch(xiev->v.xi_obj->type)
 | 
			
		||||
    {
 | 
			
		||||
    case XIT_LIST: ctl = (TControl*)xi_get_app_data(xiev->v.xi_obj); break;
 | 
			
		||||
    case XIT_ROW :
 | 
			
		||||
    case XIT_CELL: ctl = (TControl*)xi_get_app_data(xiev->v.xi_obj->parent); break;
 | 
			
		||||
    default      : break;
 | 
			
		||||
    }
 | 
			
		||||
    break;  
 | 
			
		||||
  case a_xvt:
 | 
			
		||||
    switch (xiev->v.xvte.type)
 | 
			
		||||
@ -835,9 +852,9 @@ RCT& TControl::get_rect(RCT& r) const
 | 
			
		||||
  return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TControl::set_rect(const RCT&)
 | 
			
		||||
void TControl::set_rect(const RCT& r)
 | 
			
		||||
{
 | 
			
		||||
  CHECK(0, "Can't set_rect to generic TControl");
 | 
			
		||||
  xi_set_rect(_obj, (XinRect*)&r, FALSE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned long TControl::flags2attr(const char* flags) const
 | 
			
		||||
@ -1081,7 +1098,6 @@ void TText_control::set_caption(const char* text)
 | 
			
		||||
#endif   
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TGroupbox_control
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
@ -1224,14 +1240,6 @@ void TField_control::show_button(bool on)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TField_control::set_rect(const RCT& r)
 | 
			
		||||
{
 | 
			
		||||
  _obj->v.field->rct.top = r.top;
 | 
			
		||||
  _obj->v.field->rct.bottom = r.bottom;
 | 
			
		||||
  _obj->v.field->rct.right = r.right;
 | 
			
		||||
  _obj->v.field->rct.left = r.left;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TField_control::read_only() const
 | 
			
		||||
{
 | 
			
		||||
  return bool((xi_get_attrib(_obj) & XI_ATR_READONLY) != 0);
 | 
			
		||||
@ -1396,14 +1404,6 @@ bool TButton_control::toggle()
 | 
			
		||||
  return on;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TButton_control::set_rect(const RCT& r)
 | 
			
		||||
{
 | 
			
		||||
  _obj->v.btn->rct.top = r.top;
 | 
			
		||||
  _obj->v.btn->rct.bottom = r.bottom;
 | 
			
		||||
  _obj->v.btn->rct.left = r.left;
 | 
			
		||||
  _obj->v.btn->rct.right = r.right;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TButton_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
 | 
			
		||||
{
 | 
			
		||||
  bool ok = TRUE;
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,8 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
 | 
			
		||||
                        const char* caption, TWindow* mask, bool tags);
 | 
			
		||||
 | 
			
		||||
void attach_interface(WINDOW win, COLOR back);
 | 
			
		||||
short get_focus_id(WINDOW win);
 | 
			
		||||
short low_get_focus_id(WINDOW win);
 | 
			
		||||
void low_set_focus_id(WINDOW win, short cid);
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// Custom control
 | 
			
		||||
@ -155,9 +156,6 @@ public:
 | 
			
		||||
  // @cmember Forza il focus al controllo
 | 
			
		||||
  virtual void set_focus() const;
 | 
			
		||||
                          
 | 
			
		||||
  // @cmember Ridimensiona il rettangolo su video
 | 
			
		||||
  virtual void set_rect(const RCT& r);
 | 
			
		||||
                       
 | 
			
		||||
  bool read_only() const;                     
 | 
			
		||||
  void set_read_only(bool on = TRUE);
 | 
			
		||||
 | 
			
		||||
@ -191,8 +189,6 @@ protected:
 | 
			
		||||
  virtual bool event_handler(XI_OBJ* itf, XI_EVENT* ep);
 | 
			
		||||
 | 
			
		||||
public:             
 | 
			
		||||
  virtual void set_rect(const RCT& r);
 | 
			
		||||
                  
 | 
			
		||||
  bool checked() const;
 | 
			
		||||
  void check(bool on = TRUE);
 | 
			
		||||
  void uncheck() { check(FALSE); }
 | 
			
		||||
 | 
			
		||||
@ -610,11 +610,12 @@ const char* TFormatted_date::string() const
 | 
			
		||||
 | 
			
		||||
// @func Converte un numero da 1 a 12 nel corrispondente mese
 | 
			
		||||
const char* itom(
 | 
			
		||||
  byte m) // @parm Numero del mese da convertire in parole (da 1 a 12)
 | 
			
		||||
  int m) // @parm Numero del mese da convertire in parole (da 1 a 12)
 | 
			
		||||
 | 
			
		||||
  // @comm Se il parametro <p m> e' maggiore di 12 viene calcolato il nome del
 | 
			
		||||
  //       mese corrispondente a tale cifra (es. 15 = "Marzo")
 | 
			
		||||
{
 | 
			
		||||
  CHECKD(m >= 1 && m <= 12, "Bad month ", m);
 | 
			
		||||
  const char* nomi[12] =
 | 
			
		||||
  {
 | 
			
		||||
    "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno",
 | 
			
		||||
@ -628,12 +629,13 @@ const char* itom(
 | 
			
		||||
 | 
			
		||||
// @func Ritorna il nome del giorno (1-7)
 | 
			
		||||
const char* itow(
 | 
			
		||||
  byte d) // @parm Numero del giorna da convertire in parole (da 1 a 7)
 | 
			
		||||
  int d) // @parm Numero del giorna da convertire in parole (da 1 a 7)
 | 
			
		||||
 | 
			
		||||
  // @comm Come primo giorno della setimana e' preso il Lunedi.
 | 
			
		||||
  //       <nl>Se il parametro <p d> e' maggiore di 7 viene calcolato il nome del
 | 
			
		||||
  //       giorno corrispondente a tale cifra (es. 15 = "Lunedi")
 | 
			
		||||
{
 | 
			
		||||
  CHECKD(d >= 1 && d <= 7, "Bad week day ", d);
 | 
			
		||||
  const char* nomi[7] =
 | 
			
		||||
  { "Lunedi", "Martedi", "Mercoledi", "Giovedi", "Venerdi", "Sabato", "Domenica" };
 | 
			
		||||
  return nomi[(d-1) % 7];
 | 
			
		||||
 | 
			
		||||
@ -281,8 +281,8 @@ void swap(TDate& a, TDate& b) ;
 | 
			
		||||
const TDate& fnc_min(const TDate& a, const TDate& b) ;
 | 
			
		||||
const TDate& fnc_max(const TDate& a, const TDate& b) ;
 | 
			
		||||
 | 
			
		||||
const char* itom(byte month);
 | 
			
		||||
const char* itow(byte dayofweek);
 | 
			
		||||
const char* itom(int month);
 | 
			
		||||
const char* itow(int dayofweek);
 | 
			
		||||
 | 
			
		||||
const TDate botime(0,0,0), eotime(31,12,2050);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user