ab57d73bc0
Files correlati : Ricompilazione Demo : [ ] Commento :aggiunti sorgenti di programmi personalizzati sul main_trunk git-svn-id: svn://10.65.10.50/trunk@15931 c028cbd2-c16b-5b4b-a496-9718f37d4682
97 lines
1.9 KiB
C++
Executable File
97 lines
1.9 KiB
C++
Executable File
#include <applicat.h>
|
|
#include <automask.h>
|
|
#include <relation.h>
|
|
|
|
#include <multirel.h>
|
|
#include "../mg/anamag.h"
|
|
|
|
#include "ps0430200a.h"
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TUser_mask maschera
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TUser_mask : public TAutomask
|
|
{
|
|
protected:
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
public:
|
|
bool get_user_ini(TFilename& name) const;
|
|
TUser_mask() : TAutomask("ps0430200a") {}
|
|
};
|
|
|
|
bool TUser_mask::get_user_ini(TFilename& name) const
|
|
{
|
|
name = prefix().get_studio();
|
|
name.add("config");
|
|
name.add(get(F_USER));
|
|
name.ext("ini");
|
|
return name.exist();
|
|
}
|
|
|
|
bool TUser_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
{
|
|
switch (o.dlg())
|
|
{
|
|
case F_USER:
|
|
if (e == fe_modify)
|
|
{
|
|
const char* const defpar = "or";
|
|
TFilename inipath; get_user_ini(inipath);
|
|
TConfig userconf(inipath, defpar);
|
|
|
|
for (int i = o.mask().fields()-1; i >= 0; i--)
|
|
{
|
|
TMask_field& f = o.mask().fld(i);
|
|
const TFieldref* fr = f.field();
|
|
|
|
if (fr != NULL)
|
|
{
|
|
f.set(fr->read(userconf, defpar));
|
|
f.check();
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
class TUser_set_app : public TSkeleton_application
|
|
{
|
|
protected:
|
|
virtual const char * extra_modules() const {return "ba";}
|
|
virtual void main_loop();
|
|
};
|
|
|
|
void TUser_set_app::main_loop()
|
|
{
|
|
TUser_mask mask;
|
|
|
|
while (mask.run() == K_ENTER)
|
|
{
|
|
const char* const defpar = "or";
|
|
TFilename inipath; mask.get_user_ini(inipath);
|
|
TConfig userconf(inipath, defpar);
|
|
|
|
for (int i = mask.fields()-1; i >= 0; i--)
|
|
{
|
|
const TMask_field& f = mask.fld(i);
|
|
const TFieldref* fr = f.field();
|
|
if (fr != NULL)
|
|
fr->write(userconf, defpar, f.get());
|
|
}
|
|
mask.reset();
|
|
}
|
|
}
|
|
|
|
int ps0430200(int argc, char* argv[])
|
|
{
|
|
TUser_set_app a;
|
|
a.run(argc, argv, TR("Configurazione campi per utente"));
|
|
return 0;
|
|
}
|