Patch level : 10.0

Files correlati     : ba0.exe
Ricompilazione Demo : [ ]
Commento            :
Modernizzata maschera di cambio studio


git-svn-id: svn://10.65.10.50/trunk@19744 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-12-10 11:20:55 +00:00
parent 90f8bd92ac
commit b2813bcc28
2 changed files with 119 additions and 45 deletions

View File

@ -9,6 +9,7 @@
#include <relation.h>
#include <progind.h>
#include <sheet.h>
#include <toolfld.h>
#include <treectrl.h>
#include <utility.h>
#include <urldefid.h>
@ -1630,51 +1631,88 @@ HIDDEN int dir_sort(const TObject** d1, const TObject** d2)
return xvt_str_compare_ignoring_case(s1, s2);
}
HIDDEN bool study_handler(TMask_field& f, KEY k)
class TStudy_mask : public TAutomask
{
bool ok = true;
if (f.to_check(k))
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TStudy_mask();
};
bool TStudy_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
TFilename path(f.get());
path.add("com");
path.add("dir.gen");
if (!path.exist() || path.find(' ') >= 0)
ok = f.error_box("%s %s", (const char*)f.get(), TR("non e' uno studio valido!"));
} else
if (k == K_F9)
{
TFilename str = firm2dir(-1);
for (int i = str.len()-2; i > 0; i--)
case DLG_FINDREC:
if (e == fe_button)
send_key(K_F9, DLG_USER, &o);
break;
case DLG_USER:
if (e == fe_modify || e == fe_close)
{
if (str[i] == '\\' || str[i] == '/')
{
str.cut(i);
break;
}
TFilename path(o.get());
path.add("com");
path.add("dir.gen");
if (!path.exist() || path.find(' ') >= 0)
return error_box("%s %s", (const char*)o.get(), TR("non e' uno studio valido!"));
}
str.add("*");
SLIST dirs = xvt_fsys_list_files(DIR_TYPE, str.get_buffer(), true);
TFilename dirgen;
TArray_sheet sht(-1, -1, 78, 16, TR("Scelta studio"), HR("Studio@76"));
for (SLIST_ELT e = xvt_slist_get_first(dirs); e; e = xvt_slist_get_next(dirs, e))
{
const char* f = xvt_slist_get(dirs, e, NULL);
dirgen = f;
if (dirgen.find(' ') < 0)
if (e == fe_button)
{
TFilename str = firm2dir(-1);
for (int i = str.len()-2; i > 0; i--)
{
dirgen.add("com/dir.gen");
if (dirgen.exist())
sht.add(f);
if (str[i] == '\\' || str[i] == '/')
{
str.cut(i);
break;
}
}
}
xvt_slist_destroy(dirs);
str.add("*");
SLIST dirs = xvt_fsys_list_files(DIR_TYPE, str, true);
sht.rows_array().TArray::sort(dir_sort);
if (sht.run() == K_ENTER)
f.set(sht.row(-1)); // -1 = selected row
TFilename dirgen;
TArray_sheet sht(-1, -1, 78, 20, TR("Scelta studio"), HR("Studio@72|Ditte"));
for (SLIST_ELT e = xvt_slist_get_first(dirs); e; e = xvt_slist_get_next(dirs, e))
{
const char* f = xvt_slist_get(dirs, e, NULL);
dirgen = f;
if (dirgen.find(' ') < 0) // Scarta gli studi contenenti spazi
{
dirgen.add("com/dir.gen");
if (dirgen.exist())
{
TToken_string row = f;
str = f; str.add("?????A");
SLIST firms = xvt_fsys_list_files(DIR_TYPE, str, true);
row.add(xvt_slist_count(firms));
xvt_slist_destroy(firms);
sht.add(row);
}
}
}
xvt_slist_destroy(dirs);
sht.rows_array().TArray::sort(dir_sort);
if (sht.run() == K_ENTER)
o.set(sht.row(-1)); // -1 = selected row
}
break;
default:
break;
}
return ok;
return true;
}
TStudy_mask::TStudy_mask() : TAutomask(TR("Scelta studio"), 1, 60, 3)
{
add_button_tool(DLG_OK, "", TOOL_OK);
add_button_tool(DLG_FINDREC, TR("Ricerca"), TOOL_FINDREC);
add_button_tool(DLG_NULL, "", 0);
add_button_tool(DLG_HELP, TR("Help"), TOOL_HELP);
add_button_tool(DLG_NULL, "", 0);
add_button_tool(DLG_CANCEL, "", TOOL_CANCEL);
add_string(DLG_USER, 0, "", 1, 1, 260, "B", 56);
set_handlers();
}
bool TMenu_application::choose_study()
@ -1682,12 +1720,7 @@ bool TMenu_application::choose_study()
// Disbilita le voci di personalizzazione
enable_options_menu(false);
TMask m(TR("Scelta studio"), 1, 62, 4);
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
m.add_string(DLG_USER, 0, PR("Studio "), 1, 1, 50, "B");
m.set_handler(DLG_USER, study_handler);
m.set(DLG_USER, prefix().get_studio());
TStudy_mask m;
bool ok = m.run() == K_ENTER;
if (ok)
{

View File

@ -10,6 +10,7 @@
#include <prefix.h>
#include <utility.h>
#include <xvtility.h>
#include <colors.h>
enum { DLG_TREE = 101, DLG_LOOK = 102, DLG_MAIN = 103 };
@ -293,8 +294,48 @@ void TBook_window::erode_antipa()
void TBook_window::set_logo(const char* logo)
{
_logo.load(logo);
if (_logo.ok() && can_be_transparent(_logo))
_logo.convert_transparent_color(NORMAL_BACK_COLOR);
if (is_power_station())
{
const short w = _logo.width();
const short h = _logo.height();
const short h2 = h/4;
XVT_IMAGE big = xvt_image_create(XVT_IMAGE_RGB, w, h+h2, 0);
for (short y = 0; y < h; y++)
{
for (short x = 0; x < w; x++)
{
const COLOR rgb = _logo.get_pixel(x, y);
xvt_image_set_pixel(big, x, y, rgb);
}
}
for (short y = 0; y < h2; y++)
{
const double weight = 0.5+double(y)/double(2*h2);
const short sy = h-y*h/h2-1;
for (short x = 0; x < w; x++)
{
const short sx = x-2*y;
COLOR col = MASK_LIGHT_COLOR;
if (sx >= 0)
{
COLOR rgb = xvt_image_get_pixel(big, sx, sy);
const int r = XVT_COLOR_GET_RED(rgb);
const int g = XVT_COLOR_GET_GREEN(rgb);
const int b = XVT_COLOR_GET_BLUE(rgb);
if (r != g || g != b)
col = blend_colors(col, rgb, weight);
}
xvt_image_set_pixel(big, x, y+h, col);
}
}
_logo.set(big);
}
else
{
if (_logo.ok() && can_be_transparent(_logo))
_logo.convert_transparent_color(NORMAL_BACK_COLOR);
}
}
TBook_window::TBook_window(int x, int y, int dx, int dy,