Aggiunto semi-smart-menu a ba0
Proposta directory temporanea per i files di carico/scarico git-svn-id: svn://10.65.10.50/trunk@353 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									0b55fb6316
								
							
						
					
					
						commit
						b35804cf0e
					
				
							
								
								
									
										42
									
								
								ba/ba0.cpp
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								ba/ba0.cpp
									
									
									
									
									
								
							@ -106,6 +106,9 @@ class TMenu_application : public TApplication
 | 
			
		||||
 | 
			
		||||
  int _level, _max;
 | 
			
		||||
 | 
			
		||||
  static int _last_button;
 | 
			
		||||
  static bool _find_button;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  void test_temp() const;
 | 
			
		||||
  void load_menu();
 | 
			
		||||
@ -121,8 +124,8 @@ public:
 | 
			
		||||
  TMenu_application(const char* name) : _name(name) {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static short last_button = 0;
 | 
			
		||||
static bool find_button = FALSE;
 | 
			
		||||
int TMenu_application::_last_button = 0;
 | 
			
		||||
bool TMenu_application::_find_button = FALSE;
 | 
			
		||||
 | 
			
		||||
inline TMenu_application& app() 
 | 
			
		||||
{ return (TMenu_application&)main_app(); }
 | 
			
		||||
@ -171,7 +174,7 @@ int TMenu_application::find_menu(const char* s) const
 | 
			
		||||
      TString80 v(l.get()); v.upper();
 | 
			
		||||
      if (v.find(str) >= 0)
 | 
			
		||||
      {
 | 
			
		||||
        found = m;
 | 
			
		||||
        found = i;
 | 
			
		||||
        if (isalpha(l.get_char())) break;
 | 
			
		||||
      }  
 | 
			
		||||
    }  
 | 
			
		||||
@ -183,8 +186,8 @@ bool TMenu_application::menu_item_handler(TMask_field&f, KEY k)
 | 
			
		||||
{
 | 
			
		||||
  if (k == K_SPACE)
 | 
			
		||||
  {
 | 
			
		||||
    last_button = f.dlg();
 | 
			
		||||
    find_button = FALSE;
 | 
			
		||||
    _last_button = f.dlg();
 | 
			
		||||
    _find_button = FALSE;
 | 
			
		||||
    f.mask().stop_run(K_AUTO_ENTER);
 | 
			
		||||
  }     
 | 
			
		||||
  return TRUE;
 | 
			
		||||
@ -198,10 +201,10 @@ bool TMenu_application::menu_find_handler(TMask_field&f, KEY k)
 | 
			
		||||
    const TString& v = f.get();
 | 
			
		||||
    if (v.not_empty())
 | 
			
		||||
    {
 | 
			
		||||
      last_button = app().find_menu(v);
 | 
			
		||||
      if (last_button >= 0)
 | 
			
		||||
      _last_button = app().find_menu(v);
 | 
			
		||||
      if (_last_button >= 0)
 | 
			
		||||
      {
 | 
			
		||||
        find_button = TRUE;
 | 
			
		||||
        _find_button = TRUE;
 | 
			
		||||
        f.mask().stop_run(K_AUTO_ENTER);
 | 
			
		||||
      }  
 | 
			
		||||
    }    
 | 
			
		||||
@ -250,6 +253,11 @@ int TMenu_application::do_level()
 | 
			
		||||
  if (first)
 | 
			
		||||
    menu.add_button(DLG_QUIT, 0, "Fine", -12, -1, bwidth, 2);
 | 
			
		||||
  
 | 
			
		||||
  if (_find_button && _last_button > first) 
 | 
			
		||||
    menu.first_focus(100+_last_button-first);
 | 
			
		||||
  
 | 
			
		||||
  _last_button = _find_button = 0;  
 | 
			
		||||
 | 
			
		||||
  const int k = menu.run();
 | 
			
		||||
  int m = 0;
 | 
			
		||||
  switch (k)
 | 
			
		||||
@ -260,10 +268,10 @@ int TMenu_application::do_level()
 | 
			
		||||
    menu.reset();
 | 
			
		||||
    m = -2; break;
 | 
			
		||||
  default:
 | 
			
		||||
    if (find_button)
 | 
			
		||||
    if (_find_button)
 | 
			
		||||
      m = -1;
 | 
			
		||||
    else  
 | 
			
		||||
      m = first+last_button-100; 
 | 
			
		||||
      m = first+_last_button-100; 
 | 
			
		||||
    break;
 | 
			
		||||
  }
 | 
			
		||||
  return m;
 | 
			
		||||
@ -303,6 +311,8 @@ bool TMenu_application::create()
 | 
			
		||||
bool TMenu_application::menu(MENU_TAG)
 | 
			
		||||
{
 | 
			
		||||
  int refarray[256];
 | 
			
		||||
  memset(refarray, 0, sizeof(refarray)); 
 | 
			
		||||
  
 | 
			
		||||
  int i = 0;
 | 
			
		||||
 | 
			
		||||
  _level = 0;
 | 
			
		||||
@ -334,10 +344,16 @@ bool TMenu_application::menu(MENU_TAG)
 | 
			
		||||
    else 
 | 
			
		||||
    {
 | 
			
		||||
      if (m < -1) break;
 | 
			
		||||
      if (find_button)
 | 
			
		||||
        _level = last_button;
 | 
			
		||||
      if (_find_button)
 | 
			
		||||
      {
 | 
			
		||||
        TToken_string& row = (TToken_string&)_menu[_last_button];
 | 
			
		||||
        _level = row.get_int(0);
 | 
			
		||||
      }  
 | 
			
		||||
      else  
 | 
			
		||||
        _level = (--i >= 0) ? refarray[i] : 0;
 | 
			
		||||
      {
 | 
			
		||||
        _level = (i > 0) ? refarray[--i] : 0;
 | 
			
		||||
        if (_level == 0) i = 0;
 | 
			
		||||
      }  
 | 
			
		||||
    }  
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,15 +1,14 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
#include <applicat.h>
 | 
			
		||||
#include <xvtility.h>
 | 
			
		||||
#include <utility.h>
 | 
			
		||||
#include <prefix.h>
 | 
			
		||||
#include <mask.h>
 | 
			
		||||
#include <isam.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <sheet.h>
 | 
			
		||||
#include <msksheet.h>
 | 
			
		||||
#include <urldefid.h>
 | 
			
		||||
#include <validate.h>
 | 
			
		||||
#include <xvtility.h>
 | 
			
		||||
 | 
			
		||||
#include "ba1.h"
 | 
			
		||||
#include "ba1100.h"
 | 
			
		||||
 | 
			
		||||
@ -33,6 +32,7 @@ protected:
 | 
			
		||||
  void update_dir();
 | 
			
		||||
  void convert_dir();
 | 
			
		||||
  virtual void print();
 | 
			
		||||
  const char* dumpfilename(const FileDes& dep) const;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  BA1100_application() : _browse(NULL), _rec(NULL), _mask(NULL) {}
 | 
			
		||||
@ -166,6 +166,23 @@ void BA1100_application::insert_riga (long riga_sel, TToken_string& riga)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char* BA1100_application::dumpfilename(const FileDes& dep) const
 | 
			
		||||
{
 | 
			
		||||
  TFilename n; n.tempdir();
 | 
			
		||||
#if XVT_OS == XVT_OS_SCOUNIX  
 | 
			
		||||
  n << '/';
 | 
			
		||||
#else  
 | 
			
		||||
  n << '\\';
 | 
			
		||||
#endif  
 | 
			
		||||
  n << dep.SysName;
 | 
			
		||||
  n.strip("$%");
 | 
			
		||||
  n.ext("txt");
 | 
			
		||||
  n.lower();
 | 
			
		||||
  
 | 
			
		||||
  strcpy(__tmp_string, n);
 | 
			
		||||
  return __tmp_string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BA1100_application::edit_riga (long riga_sel, TToken_string& riga)
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
@ -258,9 +275,7 @@ void BA1100_application::edit_riga (long riga_sel, TToken_string& riga)
 | 
			
		||||
      {
 | 
			
		||||
        TMask m("ba1100b");
 | 
			
		||||
        
 | 
			
		||||
        TFilename nout(dep.SysName);
 | 
			
		||||
        nout.strip("$%");
 | 
			
		||||
        nout.ext("txt");
 | 
			
		||||
        TFilename nout(dumpfilename(dep));
 | 
			
		||||
        m.set(FLD_OUTFILE, nout);
 | 
			
		||||
 | 
			
		||||
        if (m.run() == K_ENTER)
 | 
			
		||||
@ -281,18 +296,15 @@ void BA1100_application::edit_riga (long riga_sel, TToken_string& riga)
 | 
			
		||||
        if (tasto == K_F8)
 | 
			
		||||
        {
 | 
			
		||||
          TMask m("ba1100c");
 | 
			
		||||
          TFilename ninp(dep.SysName);
 | 
			
		||||
 | 
			
		||||
          ninp.strip("$%");
 | 
			
		||||
          ninp.ext("txt");
 | 
			
		||||
          TFilename ninp(dumpfilename(dep));
 | 
			
		||||
          m.set(FLD_INFILE, ninp);
 | 
			
		||||
          if (m.run() == K_ENTER)
 | 
			
		||||
          {
 | 
			
		||||
            char fs = *esc(m.get(FLD_FS));
 | 
			
		||||
            char fd = *esc(m.get(FLD_FD));
 | 
			
		||||
            char rs = *esc(m.get(FLD_RS));
 | 
			
		||||
 | 
			
		||||
            f.load(m.get(FLD_INFILE), fs, fd, rs);
 | 
			
		||||
            ninp = m.get(FLD_INFILE);
 | 
			
		||||
            f.load(ninp, fs, fd, rs);
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
}
 | 
			
		||||
@ -312,7 +324,7 @@ void BA1100_application::delete_riga ()
 | 
			
		||||
  int logicnum = (int)_browse->items();
 | 
			
		||||
 | 
			
		||||
  _browse->dir()->get(logicnum);
 | 
			
		||||
  if (yesnocancel_box("Vuoi davvero eliminare l' archivio %s", _browse->dir()->name()) != K_YES) return;
 | 
			
		||||
  if (yesnocancel_box("Confermare l'eliminzione dell'archivio %s", _browse->dir()->name()) != K_YES) return;
 | 
			
		||||
  _browse->dir()->get(LF_DIR);
 | 
			
		||||
  _browse->dir()->eod()--;
 | 
			
		||||
  _browse->set_items(_browse->dir()->eod());
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,10 @@
 | 
			
		||||
#ifndef __BA1100_H
 | 
			
		||||
#define __BA1100_H  
 | 
			
		||||
 | 
			
		||||
#ifndef __SHEET_H                 
 | 
			
		||||
#include <sheet.h>                 
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "ba1100a.h"
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
@ -115,20 +115,28 @@ HIDDEN bool len_handler(TMask_field& f, KEY key)
 | 
			
		||||
 | 
			
		||||
  switch (typef)
 | 
			
		||||
  {
 | 
			
		||||
  case _alfafld: return len <= 254;
 | 
			
		||||
               case _intfld: return len <= 5;
 | 
			
		||||
               case _longfld: return len <= 10;
 | 
			
		||||
               case _realfld:  return len <= 18;
 | 
			
		||||
               case _wordfld:  return len <= 5;
 | 
			
		||||
               case _intzerofld:  return len <= 5;
 | 
			
		||||
               case _longzerofld:  return len <= 10;
 | 
			
		||||
               default: return TRUE;
 | 
			
		||||
  case _alfafld: 
 | 
			
		||||
    return len <= 254;
 | 
			
		||||
  case _intfld: 
 | 
			
		||||
    return len <= 5;
 | 
			
		||||
  case _longfld: 
 | 
			
		||||
    return len <= 10;
 | 
			
		||||
  case _realfld:  
 | 
			
		||||
    return len <= 18;
 | 
			
		||||
  case _wordfld:  
 | 
			
		||||
    return len <= 5;
 | 
			
		||||
  case _intzerofld:  
 | 
			
		||||
    return len <= 5;
 | 
			
		||||
  case _longzerofld:  
 | 
			
		||||
    return len <= 10;
 | 
			
		||||
  default: 
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  }
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TRec_sheet::fld_notify(int r, KEY k)
 | 
			
		||||
 | 
			
		||||
bool TRec_sheet::fld_notify(int r, KEY k)
 | 
			
		||||
{
 | 
			
		||||
  const TSheet_field& f = (const TSheet_field&) _mask->field(F_FIELDS);
 | 
			
		||||
 | 
			
		||||
@ -141,8 +149,8 @@ bool TRec_sheet::fld_notify(int r, KEY k)
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TRec_sheet::key_notify(int r, KEY k)
 | 
			
		||||
 | 
			
		||||
bool TRec_sheet::key_notify(int r, KEY k)
 | 
			
		||||
{
 | 
			
		||||
  const TSheet_field& f = (const TSheet_field&) _mask->field(F_KEYS);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user