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); RCT rctree; field(DLG_TREE).get_rect(rctree);
maxx = client.right - rctree.right - 12; 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 ratiox = double(maxx) / image.width();
const double ratioy = double(maxy) / image.height(); const double ratioy = double(maxy) / image.height();

View File

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

View File

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

View File

@ -449,7 +449,9 @@ void TMenulist_window::draw_item(int i)
const TMenuitem& item = (const TMenuitem&)_sorted[i]; const TMenuitem& item = (const TMenuitem&)_sorted[i];
if (i == _selected && item.enabled()) if (i == _selected && item.enabled())
{
set_color(item.color(), FOCUS_BACK_COLOR); set_color(item.color(), FOCUS_BACK_COLOR);
}
else else
{ {
COLOR bc = item.enabled() ? REQUIRED_BACK_COLOR : DISABLED_BACK_COLOR; 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); static bool tutti_handler(TMask_field& f, KEY k);
int get_module_number(const char* module) const; int get_module_number(const char* module) const;
bool has_module(int modnumber) const; bool has_module(int modnumber) const;
bool is_zip_file(const TFilename& n) const;
protected: protected:
static bool path_handler(TMask_field& fld, KEY key); static bool path_handler(TMask_field& fld, KEY key);
@ -565,11 +566,13 @@ int TInstaller_mask::needs_reboot(const TFilename& file) const
return underscore; 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 // 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 bool TInstaller_mask::move_file(const TFilename& src, const TFilename& dst) const
{ {
TFilename dest = dst; TFilename dest = dst;
@ -595,39 +598,20 @@ bool TInstaller_mask::move_file(const TFilename& src, const TFilename& dst) cons
make_dir(subdir); make_dir(subdir);
} }
} }
const long filesize = fsize(src);
bool space_ok = FALSE; const bool is_zip = is_zip_file(src);
while (!space_ok) const long filesize = fsize(src) * (is_zip ? 4 : 1);
{
space_ok = xvt_fsys_test_disk_free_space(dest, filesize) != 0; if (xvt_fsys_test_disk_free_space(dest, filesize) == 0)
if (!space_ok) return error_box(TR("Lo spazio sull'unita' di destinazione e' insufficiente"));
{
TString msg; bool write_ok = false;
msg << TR("Lo spazio sull'unita' di destinazione e' insufficiente"); if (is_zip)
if (xvt_fsys_is_removable_drive(dest)) write_ok = aga_unzip(src, dest.path());
{
msg << TR(":\nInserire un nuovo disco e ritentare?");
if (!yesno_box(msg))
return FALSE;
}
else else
return error_box(msg);
}
}
bool write_ok = TRUE;
bool user_retry = FALSE;
do
{
write_ok = ::fcopy(src, dest); write_ok = ::fcopy(src, dest);
if (write_ok) if (write_ok)
::remove(src); ::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) if (write_ok)
{ {
@ -640,19 +624,18 @@ bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool
{ {
bool ok = TRUE; bool ok = TRUE;
TFilename src, dst; src.tempdir(); TFilename tempdir; tempdir.tempdir();
const TFilename tempdir(src);
const TString& destdir = get(F_CURPATH); const TString& destdir = get(F_CURPATH);
TString_array list; TString_array list;
ini.build_list(module, list); ini.build_list(module, list);
FOR_EACH_ARRAY_ROW(list, f, file) FOR_EACH_ARRAY_ROW(list, f, file)
{ {
src = tempdir; TFilename src = tempdir;
src.add(file->get(0)); src.add(file->get(0));
if (update) if (update)
{ {
dst = destdir; TFilename dst = destdir;
dst.add(file->get(0)); dst.add(file->get(0));
const bool move_ok = move_file(src, dst); const bool move_ok = move_file(src, dst);
if (!move_ok) if (!move_ok)

View File

@ -8,6 +8,7 @@
#include "../cg/cgpagame.h" #include "../cg/cgpagame.h"
#define ALIAS 1 #define ALIAS 1
#define PERC_DECIMALS 2
class TCond_pag_app : public TRelation_application 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 if (ts.get_int(0) != atoi(news)) // modificata scadenza
mod = m_scad = TRUE; mod = m_scad = TRUE;
real p0(ts.get(1)); real p0(ts.get(1)); p0.round(PERC_DECIMALS);
real p1(newp); real p1(newp); p1.round(PERC_DECIMALS);
p0.round(2);
p1.round(2);
if (p0 != p1) // modificata percentuale if (p0 != p1) // modificata percentuale
mod = m_perc = TRUE; mod = m_perc = TRUE;
@ -475,7 +474,6 @@ bool TCond_pag_app::sheet_action(TSheet_field&, int r, KEY k)
// ridefinisci lo sheet sulla base delle nuove rate // ridefinisci lo sheet sulla base delle nuove rate
pag->set_sheet(*shf); pag->set_sheet(*shf);
shf->force_update(); shf->force_update();
// rws->destroy();
(*rws) = shf->rows_array(); (*rws) = shf->rows_array();
} }