Patch level : 10.0
Files correlati : tutti Ricompilazione Demo : [ ] Commento : Coretta gestione Copia/Incolla in finestre di ricerca git-svn-id: svn://10.65.10.50/trunk@17473 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0238fb2229
commit
73eb9c8753
@ -135,8 +135,7 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
// Setta la caption della task window
|
||||
TString cap;
|
||||
cap << _application->get_module_name() << " - " << dongle().reseller();
|
||||
TTemp_window tw(win);
|
||||
tw.set_caption(cap);
|
||||
xvt_vobj_set_title(win, cap);
|
||||
|
||||
// Carica colori e font
|
||||
customize_controls(TRUE);
|
||||
@ -144,7 +143,7 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
xvtil_create_statbar();
|
||||
xvtil_statbar_set("");
|
||||
|
||||
do_events(); // strateggicca non scancellare
|
||||
do_events(); // strateggica non scancellare
|
||||
}
|
||||
break;
|
||||
case E_UPDATE:
|
||||
@ -218,6 +217,19 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
||||
dispatch_e_char(w, K_F1);
|
||||
}
|
||||
break;
|
||||
case M_EDIT_CUT:
|
||||
case M_EDIT_COPY:
|
||||
case M_EDIT_PASTE:
|
||||
{
|
||||
// I comandi della clipborad vanno ridiretti alla finestra col focus
|
||||
WINDOW w = xvt_scr_get_focus_vobj();
|
||||
if (w != NULL_WIN && w != win) // Evito ciclo infinito
|
||||
{
|
||||
dispatch_event(w, *ep, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// fall down to normal processing
|
||||
default:
|
||||
if (ep->v.cmd.tag > MAX_MENU_TAG)
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
COLOR def = XVT_MAKE_COLOR(red, green, blue);
|
||||
|
||||
/*
|
||||
#ifndef DBG
|
||||
// Se nel colore non compare l'indice cerca di calcolarlo
|
||||
const unsigned char color_index = (unsigned char)(def >> 12);
|
||||
@ -27,7 +28,8 @@ COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
*/
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
@ -61,9 +63,10 @@ COLOR grayed_color(COLOR col)
|
||||
return XVT_MAKE_COLOR(k, k, k);
|
||||
}
|
||||
|
||||
/*
|
||||
unsigned int color_distance(COLOR col1, COLOR col2)
|
||||
{
|
||||
if ((col1 & 0x00FFFFFF) == (col2 & 0x00FFFFFF))
|
||||
if (same_color(col1, col2))
|
||||
return 0;
|
||||
|
||||
const int r1 = XVT_COLOR_GET_RED(col1);
|
||||
@ -77,6 +80,7 @@ unsigned int color_distance(COLOR col1, COLOR col2)
|
||||
const int b = abs(b1-b2);
|
||||
return (r > g && r > b) ? r : (g > b ? g : b);
|
||||
}
|
||||
*/
|
||||
|
||||
class TColor_row_mask : public TMask
|
||||
{
|
||||
|
@ -13,7 +13,8 @@ COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue);
|
||||
COLOR choose_color(COLOR col = COLOR_BLACK, WINDOW win = NULL_WIN);
|
||||
COLOR blend_colors(COLOR col1, COLOR col2, double perc = 0.5);
|
||||
COLOR grayed_color(COLOR col);
|
||||
unsigned int color_distance(COLOR col1, COLOR col2);
|
||||
inline bool same_color(COLOR col1, COLOR col2) { return (col1 & 0x00FFFFFF) == (col2 & 0x00FFFFFF); }
|
||||
// unsigned int color_distance(COLOR col1, COLOR col2);
|
||||
|
||||
extern COLOR MASK_BACK_COLOR;
|
||||
extern COLOR MASK_LIGHT_COLOR;
|
||||
|
@ -722,18 +722,11 @@ TConfig::TConfig(int which_config, const char* paragraph)
|
||||
break;
|
||||
case CONFIG_GUI:
|
||||
{
|
||||
const TFilename ini = CGetCampoIni();
|
||||
TFilename gui = ini.path(); gui.add("gui.ini");
|
||||
bool ok = gui.exist();
|
||||
if (!ok)
|
||||
TFilename gui = "gui.ini";
|
||||
if (gui.custom_path())
|
||||
{
|
||||
gui = "gui.ini";
|
||||
ok = gui.custom_path();
|
||||
}
|
||||
if (ok) // I colori sono qui, scavalca utente
|
||||
{
|
||||
_file = gui;
|
||||
break;
|
||||
_file = gui; // I colori sono qui ...
|
||||
break; // ... scavalca utente
|
||||
}
|
||||
}
|
||||
case CONFIG_USER:
|
||||
|
@ -35,23 +35,22 @@ XVT_IMAGE TImage::set(
|
||||
// Certified 100%
|
||||
// @doc EXTERNAL
|
||||
|
||||
bool TImage::build_filename(TFilename & file)
|
||||
bool TImage::build_filename(TFilename& file)
|
||||
{
|
||||
const char * const exts[] = {"gif", "png", "bmp", "jpg", NULL};
|
||||
bool ok = false;
|
||||
|
||||
if (file.ext()[0] != '\0')
|
||||
ok = file.custom_path();
|
||||
if (!ok)
|
||||
{
|
||||
const char* const exts[] = { "png", "gif", "jpg", "jpeg", "bmp", "tif", "tiff", NULL};
|
||||
for (int i = 0; !ok && exts[i]; i++)
|
||||
{
|
||||
file.ext(exts[i]);
|
||||
ok = file.custom_path();
|
||||
if (!ok)
|
||||
{
|
||||
TFilename res(file);
|
||||
|
||||
TFilename res(file.name());
|
||||
res.insert("res/");
|
||||
ok = res.exist();
|
||||
if (ok)
|
||||
@ -182,29 +181,7 @@ void TImage::draw(WINDOW w, const RCT& dst) const
|
||||
// Certified 100%
|
||||
void TImage::draw(WINDOW w, const RCT& dst, const RCT& src) const
|
||||
{
|
||||
xvt_dwin_draw_image(w, _image, (RCT*)&dst, (RCT*)&src);
|
||||
}
|
||||
|
||||
// Certified 99%
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Fa corrispondere la palette della finestra a quella dell'immagine
|
||||
void TImage::set_palette(
|
||||
WINDOW w) const // @parm Finestra a cui settare la palette
|
||||
{
|
||||
XVT_PALETTE wp = xvt_vobj_get_palet(w);
|
||||
if (wp != NULL)
|
||||
{
|
||||
XVT_PALETTE p = xvt_palet_create(XVT_PALETTE_USER, 0L);
|
||||
const int ncolors = xvt_palet_get_ncolors(wp);
|
||||
COLOR* color = new COLOR[ncolors];
|
||||
xvt_palet_get_colors(wp, color, ncolors);
|
||||
xvt_palet_add_colors(p, color, ncolors);
|
||||
delete color;
|
||||
xvt_palet_add_colors_from_image(p, _image);
|
||||
xvt_vobj_set_palet(w, p);
|
||||
xvt_palet_destroy(wp);
|
||||
}
|
||||
xvt_dwin_draw_image(w, _image, &dst, &src);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
@ -233,7 +210,7 @@ void TImage::convert_to_default_colors()
|
||||
// @comm Legge nell'immagine i colori CYAN e DARK_CYAN e li setta a seconda del colore
|
||||
// della finestra per fare in modo di rendere trasparenti tali colori.
|
||||
{
|
||||
if (MASK_BACK_COLOR != COLOR_DKCYAN)
|
||||
if (!same_color(MASK_BACK_COLOR, COLOR_DKCYAN))
|
||||
{
|
||||
|
||||
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
||||
@ -276,14 +253,14 @@ void TImage::convert_transparent_color(COLOR transparent)
|
||||
if (_image == NULL)
|
||||
return; // Null image
|
||||
|
||||
const COLOR trans = get_pixel(0,0) & 0x00FFFFFF;
|
||||
if (trans == (transparent & 0x00FFFFFF))
|
||||
const COLOR trans = get_pixel(0,0);
|
||||
if (same_color(trans, transparent))
|
||||
return; // Nothing to do
|
||||
|
||||
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
||||
{
|
||||
for (int index = xvt_image_get_ncolors(_image)-1; index >=0; index--)
|
||||
if (trans == (xvt_image_get_clut(_image, index) & 0x00FFFFFF))
|
||||
if (same_color(trans, xvt_image_get_clut(_image, index)))
|
||||
{
|
||||
xvt_image_set_clut(_image, index, transparent);
|
||||
// break; don't break: replace all colors equal to upper left in the palette
|
||||
@ -295,7 +272,7 @@ void TImage::convert_transparent_color(COLOR transparent)
|
||||
for (short y = 0; y < dy; y++) for (short x = 0; x < dx; x++)
|
||||
{
|
||||
const COLOR c = get_pixel(x, y);
|
||||
if ((c & 0x00FFFFFF) == trans)
|
||||
if (same_color(c, trans))
|
||||
set_pixel(x, y, transparent);
|
||||
}
|
||||
}
|
||||
@ -327,14 +304,14 @@ void TImage::fade_to_gray(bool use_btn_colors)
|
||||
if (_image == NULL)
|
||||
return; // Null image
|
||||
|
||||
const COLOR trans = get_pixel(0,0) & 0x00FFFFFF;
|
||||
const COLOR trans = get_pixel(0,0);
|
||||
btncolor2btngray(trans, use_btn_colors); // Reset color conversion
|
||||
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
||||
{
|
||||
for (int index = xvt_image_get_ncolors(_image)-1; index >=0; index--)
|
||||
{
|
||||
COLOR pixie = xvt_image_get_clut(_image, index) & 0x00FFFFFF;
|
||||
if (pixie != trans)
|
||||
const COLOR pixie = xvt_image_get_clut(_image, index);
|
||||
if (!same_color(pixie, trans))
|
||||
xvt_image_set_clut(_image, index, btncolor2btngray(pixie, use_btn_colors));
|
||||
}
|
||||
}
|
||||
@ -343,8 +320,8 @@ void TImage::fade_to_gray(bool use_btn_colors)
|
||||
short dx, dy; xvt_image_get_dimensions(_image, &dx, &dy);
|
||||
for (short y = 0; y < dy; y++) for (short x = 0; x < dx; x++)
|
||||
{
|
||||
COLOR pixie = get_pixel(x, y) & 0x00FFFFFF;
|
||||
if (pixie != trans)
|
||||
const COLOR pixie = get_pixel(x, y);
|
||||
if (!same_color(pixie, trans))
|
||||
set_pixel(x, y, btncolor2btngray(pixie, use_btn_colors));
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,6 @@ class TImage : public TObject
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Fa corrispondere la palette della finestra a quella dell'immagine
|
||||
void set_palette(WINDOW w) const;
|
||||
// @cmember Permette di settare la posizione della figura
|
||||
void set_pos(int x, int y);
|
||||
|
||||
|
@ -3430,18 +3430,18 @@ void TEdit_field::set_background()
|
||||
status |= 2;
|
||||
switch (status)
|
||||
{
|
||||
case 1:
|
||||
if (color_distance(NORMAL_BACK_COLOR, REQUIRED_BACK_COLOR) != 0)
|
||||
c = REQUIRED_BACK_COLOR;
|
||||
break;
|
||||
case 2:
|
||||
c = blend_colors(DISABLED_BACK_COLOR, NORMAL_BACK_COLOR, 0.5);
|
||||
break;
|
||||
case 3:
|
||||
c = blend_colors(DISABLED_BACK_COLOR, REQUIRED_BACK_COLOR, 0.5);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
if (!same_color(NORMAL_BACK_COLOR, REQUIRED_BACK_COLOR))
|
||||
c = REQUIRED_BACK_COLOR;
|
||||
break;
|
||||
case 2:
|
||||
c = blend_colors(DISABLED_BACK_COLOR, NORMAL_BACK_COLOR, 0.5);
|
||||
break;
|
||||
case 3:
|
||||
c = blend_colors(DISABLED_BACK_COLOR, REQUIRED_BACK_COLOR, 0.5);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
((TField_control*)_ctl)->set_back_color(c);
|
||||
|
@ -302,7 +302,7 @@ static void set_num_attr(TXmlItem& item, const char* attr, long num, short def =
|
||||
|
||||
static void set_col_attr(TXmlItem& item, const char* attr, COLOR col, COLOR def = COLOR_BLACK)
|
||||
{
|
||||
if (color_distance(col, def) != 0)
|
||||
if (!same_color(col, def))
|
||||
{
|
||||
TString8 str;
|
||||
str.format("#%06X", col & 0xFFFFFF);
|
||||
|
@ -1299,7 +1299,7 @@ void TSheet::on_idle()
|
||||
{
|
||||
if (_select_row >= 0)
|
||||
{
|
||||
const short focus_id = low_get_focus_id(win());
|
||||
const short focus_id = low_get_focus_id(curr_win());
|
||||
_sheet->select(_select_row);
|
||||
if (focus_id == _sheet->id())
|
||||
_sheet->set_focus_rec(-1);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <xvt.h>
|
||||
#include <statbar.h>
|
||||
|
||||
#include <date.h>
|
||||
#include <diction.h>
|
||||
#include <dongle.h>
|
||||
#include <utility.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -591,15 +591,16 @@ long daytime()
|
||||
|
||||
bool is_power_station()
|
||||
{
|
||||
const char* ranger[] = { "ANTARES", "ARCHIMEDE", "BATMOBILE", "KIRK",
|
||||
"MOBILE", "PICARD", "SPOCK", "SULU", "UHURA", NULL };
|
||||
const TString& hostname = get_hostname();
|
||||
for (int i = 0; ranger[i]; i++)
|
||||
bool ok = false;
|
||||
if (dongle().hardware() != _dongle_network)
|
||||
{
|
||||
if (hostname.compare(ranger[i], -1, true) == 0)
|
||||
return true;
|
||||
const char* const ranger[] = { "ANTARES", "ARCHIMEDE", "BATMOBILE", "KIRK",
|
||||
"MOBILE", "PICARD", "SPOCK", "SULU", "UHURA", NULL };
|
||||
const TString& hostname = get_hostname();
|
||||
for (int i = 0; ranger[i] && !ok; i++)
|
||||
ok = hostname.compare(ranger[i], -1, true) == 0;
|
||||
}
|
||||
return false;
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool expand_sys_vars(TString& str)
|
||||
|
@ -2371,8 +2371,6 @@ void TViswin::close_print ()
|
||||
}
|
||||
|
||||
const TImage* i = (TImage*)_images.objptr(0);
|
||||
if (i != NULL) i->set_palette(win());
|
||||
|
||||
set_scroll_max (MAXLEN - 1, _txt.lines () <= _textrows ? _txt.lines () : _txt.lines () - _textrows);
|
||||
|
||||
force_update ();
|
||||
|
@ -142,14 +142,10 @@ HIDDEN bool remove_menu_item(MENU_ITEM* menu, MENU_TAG id, bool ismbar)
|
||||
|
||||
HIDDEN void set_menu_item(MENU_ITEM& m, TToken_string& tt)
|
||||
{
|
||||
MENU_TAG tag = tt.get_int(0);
|
||||
TString flag = tt.items() <= 2 ? "": tt.get(2);
|
||||
char* text = NULL;
|
||||
if (strlen(tt.get(1)) > 0)
|
||||
{
|
||||
text = (char*)xvt_mem_alloc(strlen(tt.get(1)) + 1);
|
||||
strcpy(text, tt.get(1));
|
||||
}
|
||||
MENU_TAG tag = tt.get_int(0);
|
||||
const char* txt = tt.get();
|
||||
char* text = (txt && *txt) ? xvt_str_duplicate(txt) : NULL;
|
||||
const TString4 flag = tt.get();
|
||||
|
||||
m.tag = tag;
|
||||
m.text = text;
|
||||
|
Loading…
x
Reference in New Issue
Block a user