Patch level : 2.0 588

Files correlati     :ba0.exe ba1.exe
Ricompilazione Demo : [ ]
Commento            :

GF20104
NOn abilita i menu personalizzati come cgaddon.men,
se presenti nella sola cartella custom


git-svn-id: svn://10.65.10.50/trunk@11461 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-10-03 08:12:08 +00:00
parent 62aab6380c
commit 7f83e9ba89
6 changed files with 62 additions and 53 deletions

View File

@ -154,7 +154,7 @@ void TPicture_mask::update()
RCT rctree; field(DLG_TREE).get_rect(rctree);
maxx = client.right - rctree.right - 12;
maxy = client.bottom - 4 * ROWY;
maxy = client.bottom - 8 * ROWY;
const double ratiox = double(maxx) / image.width();
const double ratioy = double(maxy) / image.height();

View File

@ -3,6 +3,7 @@
#include <currency.h>
#include <dongle.h>
#include <execp.h>
#include <isam.h>
#include <mask.h>
#include <prefix.h>
#include <utility.h>
@ -137,7 +138,8 @@ void TMenuitem::create(const char* t)
{
if (_action.find('.') < 0)
_action << ".men";
if (fexist(_action))
TFilename n = _action; n.custom_path();
if (n.exist())
menu().read(_action, _action);
else
_action.cut(0);
@ -235,9 +237,9 @@ bool TMenuitem::perform_program() const
if (_firm && main_app().get_firm() == 0)
#ifdef _DEMO_
ok = main_app().set_firm(1);
ok = menu().set_firm(1);
#else
ok = main_app().set_firm();
ok = menu().set_firm();
#endif
if (ok)
@ -457,6 +459,29 @@ bool TMenu::read(const char* name)
return ok;
}
bool TMenu::set_firm(long firm) const
{
if (firm <= 0)
{
TLocalisamfile ditte(LF_NDITTE);
for (int err = ditte.first(); err == NOERR; err = ditte.next())
{
const long codditta = ditte.get_long("CODDITTA");
if (prefix().exist(codditta))
{
if (firm == 0)
firm = codditta;
else
{
firm = -1;
break;
}
}
}
}
return main_app().set_firm(firm);
}
bool TMenu::jumpto(TSubmenu* next)
{
if (next && next->disabled())
@ -467,10 +492,10 @@ bool TMenu::jumpto(TSubmenu* next)
if (next->query_firm())
{
#ifdef _DEMO_
if (!main_app().set_firm(1))
if (!set_firm(1))
next = NULL;
#else
if (!main_app().set_firm())
if (!set_firm())
next = NULL;
#endif
}

View File

@ -132,6 +132,7 @@ public:
TSubmenu& current() const { return *_current; }
TSubmenu* find(const char* name) const { return (TSubmenu*)objptr(name); }
bool set_firm(long firm = -1) const;
bool jumpto(TSubmenu *next);
bool jumpto_root();

View File

@ -449,7 +449,9 @@ void TMenulist_window::draw_item(int i)
const TMenuitem& item = (const TMenuitem&)_sorted[i];
if (i == _selected && item.enabled())
{
set_color(item.color(), FOCUS_BACK_COLOR);
}
else
{
COLOR bc = item.enabled() ? REQUIRED_BACK_COLOR : DISABLED_BACK_COLOR;

View File

@ -95,6 +95,7 @@ protected: // TSheet
static bool tutti_handler(TMask_field& f, KEY k);
int get_module_number(const char* module) const;
bool has_module(int modnumber) const;
bool is_zip_file(const TFilename& n) const;
protected:
static bool path_handler(TMask_field& fld, KEY key);
@ -119,8 +120,8 @@ protected:
bool do_process(TToken_string& commands) const;
bool pre_process(TInstall_ini& ini, const char* module) const;
bool post_process(TInstall_ini& ini, const char* module) const;
bool get_internet_path(TFilename &ininame );
void parse_internet_path(TString & http_server, TFilename &http_path );
bool get_internet_path(TFilename& ininame);
void parse_internet_path(TString& http_server, TFilename& http_path);
public:
bool installed() { return _installed;}
@ -235,7 +236,7 @@ int TInstaller_mask::precheck_modules(bool only_newer)
}
int TInstaller_mask::get_module_number(const char * module) const
int TInstaller_mask::get_module_number(const char* module) const
{
int aut = -1;
if (module && * module)
@ -565,11 +566,13 @@ int TInstaller_mask::needs_reboot(const TFilename& file) const
return underscore;
}
bool TInstaller_mask::is_zip_file(const TFilename& n) const
{
const char* ext = n.ext();
return xvt_str_compare_ignoring_case(ext, "zip") == 0;
}
// sposta il file dal direttorio temporaneo a quello passato come destinazione
// from: direttorio di partenza
// file: nome del file con path completo da spostare (può includere sottodirettori)
// todir: direttorio destinazione (si assume che esista già)
bool TInstaller_mask::move_file(const TFilename& src, const TFilename& dst) const
{
TFilename dest = dst;
@ -595,39 +598,20 @@ bool TInstaller_mask::move_file(const TFilename& src, const TFilename& dst) cons
make_dir(subdir);
}
}
const long filesize = fsize(src);
bool space_ok = FALSE;
while (!space_ok)
{
const bool is_zip = is_zip_file(src);
const long filesize = fsize(src) * (is_zip ? 4 : 1);
space_ok = xvt_fsys_test_disk_free_space(dest, filesize) != 0;
if (!space_ok)
{
TString msg;
msg << TR("Lo spazio sull'unita' di destinazione e' insufficiente");
if (xvt_fsys_is_removable_drive(dest))
{
msg << TR(":\nInserire un nuovo disco e ritentare?");
if (!yesno_box(msg))
return FALSE;
}
else
return error_box(msg);
}
}
if (xvt_fsys_test_disk_free_space(dest, filesize) == 0)
return error_box(TR("Lo spazio sull'unita' di destinazione e' insufficiente"));
bool write_ok = TRUE;
bool user_retry = FALSE;
do
{
bool write_ok = false;
if (is_zip)
write_ok = aga_unzip(src, dest.path());
else
write_ok = ::fcopy(src, dest);
if (write_ok)
::remove(src);
else
user_retry = yesno_box(FR("Errore di copia del file %s.\nSi desidera ritentare?"),
(const char*)src);
} while (!write_ok && user_retry);
if (write_ok)
::remove(src);
if (write_ok)
{
@ -640,19 +624,18 @@ bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool
{
bool ok = TRUE;
TFilename src, dst; src.tempdir();
const TFilename tempdir(src);
TFilename tempdir; tempdir.tempdir();
const TString& destdir = get(F_CURPATH);
TString_array list;
ini.build_list(module, list);
FOR_EACH_ARRAY_ROW(list, f, file)
{
src = tempdir;
TFilename src = tempdir;
src.add(file->get(0));
if (update)
{
dst = destdir;
TFilename dst = destdir;
dst.add(file->get(0));
const bool move_ok = move_file(src, dst);
if (!move_ok)

View File

@ -8,6 +8,7 @@
#include "../cg/cgpagame.h"
#define ALIAS 1
#define PERC_DECIMALS 2
class TCond_pag_app : public TRelation_application
{
@ -410,10 +411,8 @@ bool TCond_pag_app::sheet_action(TSheet_field&, int r, KEY k)
if (ts.get_int(0) != atoi(news)) // modificata scadenza
mod = m_scad = TRUE;
real p0(ts.get(1));
real p1(newp);
p0.round(2);
p1.round(2);
real p0(ts.get(1)); p0.round(PERC_DECIMALS);
real p1(newp); p1.round(PERC_DECIMALS);
if (p0 != p1) // modificata percentuale
mod = m_perc = TRUE;
@ -473,10 +472,9 @@ bool TCond_pag_app::sheet_action(TSheet_field&, int r, KEY k)
else if (mod && need_recalc)
{
// ridefinisci lo sheet sulla base delle nuove rate
pag->set_sheet(*shf);
shf->force_update();
// rws->destroy();
(*rws) = shf->rows_array();
pag->set_sheet(*shf);
shf->force_update();
(*rws) = shf->rows_array();
}
msk->set(F_NUM_RATE, pag->n_rate());