Patch level : 10.0 1088

Files correlati     :  xvaga
Ricompilazione Demo : [ ]
Commento            :
Corretta gestione finestre


git-svn-id: svn://10.65.10.50/trunk@16866 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-07-11 11:16:52 +00:00
parent a1af297434
commit 32a6d81cfb
17 changed files with 308 additions and 269 deletions

View File

@ -123,17 +123,20 @@ short TBook_window::pages() const
return _ctrl == NULL_WIN ? 0 : xvt_notebk_get_num_tabs(_ctrl);
}
static BOOLEAN hell_riser(WINDOW child, long data)
{
if (data > 0)
xvt_vobj_raise(child);
xvt_win_enum_wins(child, hell_riser, data+1, 0);
return TRUE;
}
void TBook_window::force_page(short page)
{
// Per le applicazioni figlie pare necessaria questa forzatura della visibilta'
for (int p = pages()-1; p >= 0; p--)
{
WINDOW pw = xvt_notebk_get_page(_ctrl, p);
const bool show = p == page;
if (show)
xvt_notebk_set_front_page(_ctrl, page);
xvt_vobj_set_visible(pw, show);
}
xvt_notebk_set_front_page(_ctrl, page);
WINDOW w = xvt_notebk_get_page(_ctrl, page);
xvt_win_enum_wins(w, hell_riser, 0, 0);
}
void TBook_window::handler(WINDOW win, EVENT* ep)

View File

@ -1,5 +1,6 @@
#include <applicat.h>
#include <colors.h>
#include <codeb.h>
#include <dongle.h>
#include <extcdecl.h>
#include <isam.h>
@ -21,23 +22,38 @@
class TInfo_mask : public TArray_sheet
{
protected:
virtual bool get_cell_colors(int row, int col, COLOR& fore, COLOR& back) const;
public:
void add_row(const char* prompt, const char* value);
void add_row(const char* prompt, unsigned long value);
void add_row(const char* prompt, const char* value, int err = 0);
void add_row(const char* prompt, unsigned long value, int err = 0);
TInfo_mask();
};
void TInfo_mask::add_row(const char* prompt, const char* value)
bool TInfo_mask::get_cell_colors(int r, int c, COLOR& fore, COLOR& back) const
{
const int err = ((TArray_sheet*)this)->row(r).get_int(2);
if (err > 0)
{
fore = NORMAL_COLOR;
back = err == 1 ? REQUIRED_BACK_COLOR : FOCUS_BACK_COLOR;
}
return TArray_sheet::get_cell_colors(r, c, fore, back);
}
void TInfo_mask::add_row(const char* prompt, const char* value, int err)
{
TToken_string* r = new TToken_string;
r->add(prompt);
r->add(value);
r->add(err);
add(r);
}
void TInfo_mask::add_row(const char* prompt, unsigned long value)
void TInfo_mask::add_row(const char* prompt, unsigned long value, int err)
{
TString8 str; str.format("%lu", value);
TString16 str; str.format("%lu", value);
add_row(prompt, str);
}
@ -95,13 +111,17 @@ TInfo_mask::TInfo_mask()
TFilename temp;
temp.tempdir();
TString strdb;
DB_version(strdb.get_buffer(), strdb.size());
add_row(TR("Versione"), versione);
add_row(TR("Protezione"), prot);
add_row(TR("N. di serie"), ser_no);
add_row(TR("N. di serie"), ser_no, ser_no < 0);
add_row(TR("Assistenza"), dongle().year_assist());
add_row(TR("Installazione"), tipo);
add_row(TR("Sistema"), stros);
add_row(TR("Libreria"), strwx);
add_row(TR("Libreria GUI"), strwx);
add_row(TR("Libreria DB"), strdb);
add_row(TR("Utente"), user());
add_row(TR("Studio"), firm2dir(-1));
add_row(TR("Ditta"), campoini.get("Firm", "Main"));
@ -113,15 +133,17 @@ TInfo_mask::TInfo_mask()
}
add_row(TR("Programma"), arg);
add_row(TR("Config locale"), campoini.name());
add_row(TR("Config utente"), userini.name());
add_row(TR("File temporanei"), temp);
add_row(TR("Spazio su disco"), xvt_fsys_get_disk_free_space(firm2dir(-1), 'M'));
TString printer(userini.get("Name", "Printer"));
add_row(TR("Config locale"), campoini.name(), campoini.name().find(' ') >= 0);
add_row(TR("Config utente"), userini.name(), userini.name().find(' ') >= 0);
add_row(TR("File temporanei"), temp, temp.find(' ') >= 0);
const long mbfree = xvt_fsys_get_disk_free_space(firm2dir(-1), 'M');
add_row(TR("Spazio su disco"), mbfree, mbfree < 512);
TString printer(userini.get("Name", "Printer"));
if (printer.blank())
printer = "Nessuna";
add_row(TR("Stampante"), printer);
add_row(TR("Stampante"), printer, printer.len() < 32);
}

View File

@ -1168,3 +1168,9 @@ int DB_memowrite( const int handle, const char* fieldname, const char* data )
return ret;
}
long DB_version(char* str, int maxstr)
{
if (str != NULL && maxstr >= 16)
sprintf(str, "Codebase %d.%03d", S4VERSION/1000, S4VERSION%1000);
return S4VERSION;
}

View File

@ -66,6 +66,7 @@ extern "C" {
int DB_rec_locked(int handle,long nrec);
long DB_getconf();
long DB_changed(int handle); /* returns true if the index of the key is changed */
long DB_version(char* str, int maxstr);
#ifdef __cplusplus
};
#endif

View File

@ -5,11 +5,14 @@
#include <prefix.h>
#include <recarray.h>
static bool is_outlook_menu()
static bool is_outlook_menu_chain()
{
const int dw = xvt_vobj_get_attr(NULL_WIN, ATTR_SCREEN_WIDTH);
RCT rct; xvt_vobj_get_outer_rect(TASK_WIN, &rct);
return rct.left > 0 && rct.right < dw-1;
const TFixed_string app(__argv[0]);
if (app.match("*ba[0,1]*", true))
return false;
TConfig ini(CONFIG_GUI, "Colors");
return ini.get_int("TreeView") == 3;
}
// @doc EXTERNAL
@ -72,13 +75,13 @@ long TExternal_app::run(
xvt_fsys_set_dir(&d);
}
}
// Vecchio titolo della finestra principale
TString256 old_title;
const bool close_all = !async && _path.starts_with("ba1 -0") && prefix_valid();
TString256 old_title; // Vecchio titolo della finestra principale
bool close_all = false; // Chiudi tutti i file in caso di manutenzione
if (!async)
{
close_all = _path.starts_with("ba1 -0") && prefix_valid();
if (close_all) //se lancia la gestione archivi forza la chiusura dei files e pure dei tracciati!
prefix().set("");
else
@ -87,7 +90,8 @@ long TExternal_app::run(
if (dongle().local())
dongle().logout();
if (iconize && utente && is_outlook_menu())
// Programma normale (non menu) che chiama "collega"
if (utente && iconize && is_outlook_menu_chain())
{
xvt_vobj_get_title(TASK_WIN, old_title.get_buffer(), old_title.size());
xvt_vobj_set_title(TASK_WIN, __MAGIC_CAPTION__);
@ -98,9 +102,7 @@ long TExternal_app::run(
_exitcode = xvt_sys_execute(path, !async, iconize);
if (old_title.full()) // Rimetto le cose a posto
{
xvt_vobj_set_title(TASK_WIN, old_title);
}
// restore cwd
xvt_fsys_set_dir(&oldir);

View File

@ -1247,6 +1247,16 @@ void TMask::insert_bar(WINDOW page)
else // TopBar
{
CHECK(_toolbar == NULL_WIN, "One single top bar, please!");
if (rows() < 18) // Ridimensiono maschera piccola (non massimizzata)
{
const short bar_height = max(rct_bar.bottom - rct_bar.top, TOOL_SIZE + TOOL_TEXT * 12);
RCT rct_new; xvt_vobj_get_client_rect(parent, &rct_new);
rct_new.bottom += bar_height;
xvt_rect_offset(&rct_new, rct_win.left, rct_win.top-bar_height/2);
xvt_vobj_move(parent, &rct_new);
}
_toolbar = page;
xvt_pane_add(parent, _toolbar, "_TopBar_", 62, 0);
}

View File

@ -521,7 +521,7 @@ bool TSQL_recordset::move_to(TRecnotype n)
if (n < _first_row || n >= _first_row+_page.items())
{
TString sql; parsed_text(sql);
if (sql.find("LIMIT ") < 0)
if (sql.starts_with("SELECT ") && sql.find("LIMIT ") < 0)
{
const int semicolon = sql.rfind(';');
if (semicolon >= 0)

View File

@ -1083,8 +1083,7 @@ void TTree_window::update()
{
if (_header.full())
{
set_brush(MASK_BACK_COLOR);
bar(0, 0, columns(), _header.items());
clear(MASK_BACK_COLOR);
short x = 3, y = 0;
FOR_EACH_TOKEN(_header, row)
stringat(x, y++, row);
@ -1099,6 +1098,9 @@ void TTree_window::handler(WINDOW win, EVENT* ep)
if (ep->v.ctl.ci.type == WC_TREE && _tree != NULL)
handle_tree_event(ep);
break;
case E_UPDATE:
update(); // TControl_host_window non lo fa
return;
default:
break;
}

View File

@ -1238,7 +1238,7 @@ void TViswin::txt_clear(COLOR color)
autoscroll(FALSE);
set_brush(color);
set_mode(M_COPY);
bar ((X_OFFSET-1), Y_OFFSET -1, columns()+1, rows()-BUTTONROW_SIZE);
bar ((X_OFFSET-1), Y_OFFSET -1, columns()+16, rows()-BUTTONROW_SIZE);
}
bool TViswin::can_be_closed() const
@ -2577,7 +2577,7 @@ TViswin::TViswin(const char *fname,
if (parent == NULL_WIN)
parent = TASK_WIN;
_toplevel = parent == TASK_WIN;
_toplevel = brwfld == NULL; // parent == TASK_WIN;
if (_toplevel)
{
@ -2617,19 +2617,21 @@ TViswin::TViswin(const char *fname,
for (i = 0; i < _modules.items(); i++)
((TImage*)_modules.objptr(i))->convert_transparent_color(MASK_BACK_COLOR);
long flags = WSF_HSCROLL | WSF_VSCROLL;
if (_toplevel)
flags |= WSF_SIZE /* | WSF_CLOSE */;
WIN_TYPE rt = _toplevel ? W_DOC : W_PLAIN;
create(x, y, maxlarg, maxalt, title, flags, rt, parent,
_toplevel ? VISWIN_BAR : 0);
attach_interface(win(), BACKGROUND);
{
const long flags = WSF_HSCROLL | WSF_VSCROLL | WSF_SIZE;
WIN_TYPE rt = W_DOC;
WINDOW myself = create(x, y, maxlarg, maxalt, title, flags, rt, parent,
_toplevel ? VISWIN_BAR : 0);
attach_interface(myself, BACKGROUND);
}
else
{
// La finestra e' gia' creata automaticamente dal TWindowed_field
}
set_opaque_text (TRUE);
set_font (XVT_FFN_FIXED, XVT_FS_NONE, PRINT_HEIGHT);
// set_font (printer().fontname(), XVT_FS_NONE, PRINT_HEIGHT);
set_font (PRINT_FONT, XVT_FS_NONE, PRINT_HEIGHT);
if (_toplevel)
{
@ -2701,7 +2703,8 @@ TViswin::TViswin(const char *fname,
TViswin ::~TViswin ()
{
// avoid deleting child window (already deleted by mask)
if (!_toplevel) set_win(NULL_WIN);
if (!_toplevel)
set_win(NULL_WIN);
}
///////////////////////////////////////////////////////////

View File

@ -397,13 +397,11 @@ word TWindow::class_id() const
long TWindow::window_handler(WINDOW win, EVENT* ep)
{
TWindow* w = (TWindow*)xvt_vobj_get_data(win);
CHECK(w != NULL, "Invalid window");
w->handler(win, ep);
if (w != NULL)
w->handler(win, ep);
return 0L;
}
// @doc EXTERNAL
// @mfunc Crea la finestra
@ -445,9 +443,10 @@ TWindow::~TWindow()
{
if (_win != NULL_WIN)
{
if (is_valid_window(_win))
xvt_vobj_destroy(_win);
_win = NULL_WIN;
const WINDOW del_win = _win; // Memorizzo l'handle da cancellare
_win = NULL_WIN; // Azzero preventivamente l'handle medesimo
if (is_valid_window(del_win))
xvt_vobj_destroy(del_win);
}
}

View File

@ -392,10 +392,8 @@ bool OsWin32_DrawBitmap(HBITMAP hBMP, wxDC& dc, const wxRect& dst, const wxRect&
free(bi);
}
else
{
HGDIOBJ hOldBitmap = ::SelectObject(hMemDC, hBMP);
//::SetStretchBltMode(hDC, nDepth > 8 ? COLORONCOLOR : HALFTONE);
::SetStretchBltMode(hDC, HALFTONE);
::StretchBlt(hDC, dst.x, dst.y, dst.width, dst.height,
hMemDC, src.x, src.y, src.width, src.height, SRCCOPY);

View File

@ -42,6 +42,7 @@
#define CAST_TWIN(win,w) TwxWindow& w = *wxStaticCast((wxWindow*)win, TwxWindow);
#define CAST_TDC(win,dc) TDC& dc = GetTDCMapper().GetTDC(win);
#define CAST_DC(win,dc) wxDC& dc = GetTDCMapper().GetDC(win);
#define CAST_FONT(font_id, font) TFontId& font = *wxStaticCast(font_id, TFontId);
wxWindow* _mouse_trapper = NULL;
RCT _startup_rect = { 0,0,0,0 };
@ -260,7 +261,7 @@ wxString _GetResourceName(const char* type, int rid)
const wxIcon& _GetIconResource(int rid)
{
wxIcon* icon = (wxIcon*)_nice_icons.Get(rid);
wxIcon* icon = wxDynamicCast(_nice_icons.Get(rid), wxIcon);
if (icon == NULL)
{
wxString strName = _GetResourceName("Icon", rid);
@ -270,7 +271,7 @@ const wxIcon& _GetIconResource(int rid)
}
else
{
icon = (wxIcon*)_nice_icons.Get(ICON_RSRC);
icon = wxDynamicCast(_nice_icons.Get(ICON_RSRC), wxIcon);
if (icon == NULL)
{
strName.Printf("%d", ICON_RSRC);
@ -285,7 +286,7 @@ const wxIcon& _GetIconResource(int rid)
const wxCursor* GetCursorResource(int rid)
{
static wxHashTable _nice_cursors;
wxCursor* cursor = (wxCursor*)_nice_cursors.Get(rid);
wxCursor* cursor = wxDynamicCast(_nice_cursors.Get(rid), wxCursor);
if (cursor == NULL)
{
switch (rid)
@ -489,8 +490,11 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
#ifdef WIN32
if (hwndParent != NULL)
{
HWND hwndChild = (HWND)_task_win->GetHandle();
::SetParent(hwndChild, hwndParent);
// HWND hwndChild = (HWND)_task_win->GetHandle();
// ::SetParent(hwndChild, hwndParent);
wxWindow* padre = new wxWindow;
padre->AssociateHandle(hwndParent);
_task_win->Reparent(padre);
}
#endif
@ -530,10 +534,11 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
for (int i= 0; i < 3; i++)
pMenubar->Append(Menus[i], Title[i]);
#endif
((wxFrame*)_task_win)->SetMenuBar(pMenubar);
wxFrame* pFrame = wxStaticCast(_task_win, wxFrame);
pFrame->SetMenuBar(pMenubar);
if (style & wxMAXIMIZE)
((wxFrame*)_task_win)->Maximize();
pFrame->Maximize();
_task_win->Show();
wxApp* a = wxTheApp;
@ -931,7 +936,7 @@ ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char* Btn2, const char* Btn
void xvt_dm_post_error(const char *fmt)
{
_MessageBox(fmt, wxOK | wxCENTRE | wxICON_ERROR);
_MessageBox(fmt, wxOK | wxCENTRE | wxICON_HAND);
}
void xvt_dm_post_fatal_exit(const char *fmt)
@ -976,7 +981,7 @@ FL_STATUS xvt_dm_post_file_open(FILE_SPEC *fsp, const char *msg)
FL_STATUS xvt_dm_post_file_save(FILE_SPEC *fsp, const char *msg)
{
const int flags = wxSAVE;
const int flags = wxSAVE | wxOVERWRITE_PROMPT;
return xvt_dm_post_file_ask(fsp, msg, flags);
}
@ -994,7 +999,7 @@ FL_STATUS xvt_dm_post_dir_sel(DIRECTORY *dir)
BOOLEAN xvt_dm_post_font_sel(WINDOW win, XVT_FNTID font_id, PRINT_RCD *precp, unsigned long reserved)
{
TFontId& font = *(TFontId*)font_id;
CAST_FONT(font_id, font);
wxFontData data;
data.SetInitialFont(font.Font(NULL, win));
data.EnableEffects(reserved != 0);
@ -1119,8 +1124,8 @@ public:
IMPLEMENT_DYNAMIC_CLASS(TXVT_IMAGE, wxImage);
#define CAST_IMAGE(xvtimg, imgptr) TXVT_IMAGE* imgptr = wxDynamicCast(xvtimg, TXVT_IMAGE);
#define CONST_IMAGE(xvtimg, imgptr) const TXVT_IMAGE* imgptr = wxDynamicCast(xvtimg, TXVT_IMAGE);
#define CAST_TIMAGE(xvtimg, img) TXVT_IMAGE* img = wxDynamicCast(xvtimg, TXVT_IMAGE);
#define CAST_IMAGE(xvtimg, img) const wxImage* img = wxDynamicCast(xvtimg, wxImage);
#ifdef WIN32
@ -1172,6 +1177,8 @@ TXVT_IMAGE::~TXVT_IMAGE()
// Font Handling
///////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC_CLASS(TFontId, wxObject);
void TFontId::Copy(const TFontId& rFont)
{
m_strFace = rFont.m_strFace;
@ -1318,7 +1325,6 @@ void TFontId::Copy(const wxFont& rFont)
m_win = NULL_WIN;
}
///////////////////////////////////////////////////////////
// Drawable windows
///////////////////////////////////////////////////////////
@ -1450,7 +1456,7 @@ void xvt_dwin_draw_image_on_pdf(WINDOW win, const char* name, RCT* dest)
void xvt_dwin_draw_image(WINDOW win, XVT_IMAGE img, RCT* dest, RCT* source)
{
CAST_IMAGE(img, image);
CAST_TIMAGE(img, image);
if (image != NULL)
{
if (xvt_dwin_is_update_needed(win, dest))
@ -1752,9 +1758,8 @@ void xvt_dwin_set_draw_mode(WINDOW win, DRAW_MODE mode)
void xvt_dwin_set_font(WINDOW win, XVT_FNTID font_id)
{
XVT_ASSERT(font_id != NULL);
CAST_TDC(win, dc);
const TFontId& font = *(const TFontId*)font_id;
CAST_FONT(font_id, font);
if (dc._font != font)
{
dc._font = font;
@ -1835,9 +1840,9 @@ XVT_ERRSEV xvt_errmsg_get_sev_id(XVT_ERRMSG err)
void xvt_font_copy(XVT_FNTID dest_font_id, XVT_FNTID src_font_id, XVT_FONT_ATTR_MASK mask)
{
XVT_ASSERT(dest_font_id && src_font_id && mask == XVT_FA_ALL);
TFontId* dst = (TFontId*)dest_font_id;
TFontId* src = (TFontId*)src_font_id;
*dst = *src;
CAST_FONT(dest_font_id, dst);
CAST_FONT(src_font_id, src);
dst = src;
}
XVT_FNTID xvt_font_create(void)
@ -1850,8 +1855,8 @@ void xvt_font_deserialize(XVT_FNTID font_id, const char* buf)
{
// 01\\Courier\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/Courier
TFontId& font = *(TFontId*)font_id;
const char* s = strchr(buf, '/');
CAST_FONT(font_id, font)
const char* s = strchr(buf, '/');
if (s == NULL)
return;
const int nSize = atoi(s+1);
@ -1894,13 +1899,17 @@ void xvt_font_deserialize(XVT_FNTID font_id, const char* buf)
void xvt_font_destroy(XVT_FNTID font_id)
{
delete (TFontId*)font_id;
if (font_id != NULL)
{
TFontId* fp = wxStaticCast(font_id, TFontId);
delete fp;
}
}
BOOLEAN xvt_font_get_family(XVT_FNTID font_id, char* buf, long max_buf)
{
const TFontId& font = *(TFontId*)font_id;
strncpy(buf, font.FaceName(), max_buf);
CAST_FONT(font_id, font);
strncpy(buf, font.FaceName(), max_buf);
buf[max_buf-1] = '\0';
return TRUE;
}
@ -1910,7 +1919,7 @@ BOOLEAN xvt_font_get_family_mapped(XVT_FNTID font_id, char* buf, long max_buf)
void xvt_font_get_metrics(XVT_FNTID font_id, int *leadingp, int *ascentp, int *descentp)
{
const TFontId& font = *(TFontId*)font_id;
CAST_FONT(font_id, font);
WINDOW win = font.Win();
if (win == NULL_WIN)
win = TASK_WIN;
@ -1934,29 +1943,31 @@ BOOLEAN xvt_font_get_native_desc(XVT_FNTID font_id, char *buf, long max_buf)
long xvt_font_get_size(XVT_FNTID font_id)
{
return ((TFontId*)font_id)->PointSize();
CAST_FONT(font_id, font);
return font.PointSize();
}
XVT_FONT_STYLE_MASK xvt_font_get_style(XVT_FNTID font_id)
{
return ((TFontId*)font_id)->Mask();
CAST_FONT(font_id, font);
return font.Mask();
}
WINDOW xvt_font_get_win(XVT_FNTID font_id)
{
return ((TFontId*)font_id)->Win();
CAST_FONT(font_id, font);
return font.Win();
}
BOOLEAN xvt_font_is_mapped(XVT_FNTID font_id)
{
bool yes = ((TFontId*)font_id)->Win() != NULL_WIN;
return yes;
return xvt_font_get_win(font_id) != NULL_WIN;
}
void xvt_font_map(XVT_FNTID font_id, WINDOW win)
{
TFontId* pFont = (TFontId*)font_id;
pFont->SetWin(win);
CAST_FONT(font_id, font);
font.SetWin(win);
}
void xvt_font_map_using_default(XVT_FNTID font_id)
@ -1966,19 +1977,19 @@ void xvt_font_map_using_default(XVT_FNTID font_id)
void xvt_font_set_family(XVT_FNTID font_id, const char* family)
{
TFontId& font = *(TFontId*)font_id;
CAST_FONT(font_id, font);
font.SetFaceName(family);
}
void xvt_font_set_size(XVT_FNTID font_id, long size)
{
TFontId& font = *(TFontId*)font_id;
CAST_FONT(font_id, font);
font.SetPointSize(size);
}
void xvt_font_set_style(XVT_FNTID font_id, XVT_FONT_STYLE_MASK mask)
{
TFontId& font = *(TFontId*)font_id;
CAST_FONT(font_id, font);
font.SetMask(mask);
}
@ -1986,7 +1997,7 @@ long xvt_font_serialize(XVT_FNTID font_id, char *buf, long max_buf)
{
// 01\\Courier\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/Courier
TFontId& font = *(TFontId*)font_id;
CAST_FONT(font_id, font);
const char* name = font.FaceName();
const int size = font.PointSize();
const int italic = (font.Mask() & XVT_FS_ITALIC) != 0;
@ -2003,7 +2014,7 @@ long xvt_font_serialize(XVT_FNTID font_id, char *buf, long max_buf)
void xvt_font_unmap(XVT_FNTID font_id)
{
TFontId& font = *(TFontId*)font_id;
CAST_FONT(font_id, font);
font.SetWin(NULL_WIN);
}
@ -2388,71 +2399,56 @@ XVT_IMAGE xvt_image_create(XVT_IMAGE_FORMAT format, short width, short height, l
void xvt_image_destroy(XVT_IMAGE img)
{
CAST_IMAGE(img, image);
CAST_TIMAGE(img, image);
if (image != NULL)
delete image;
}
COLOR xvt_image_get_clut(XVT_IMAGE img, short index)
{
CONST_IMAGE(img, image);
if (image)
CAST_IMAGE(img, image);
if (image && image->Ok() && image->HasPalette())
{
const wxImage& bmp = image->Image();
if (bmp.HasPalette())
{
const wxPalette& pal = bmp.GetPalette();
unsigned char r, g, b;
pal.GetRGB(index, &r, &g, &b);
return XVT_MAKE_COLOR(r, g, b);
}
const wxPalette& pal = image->GetPalette();
unsigned char r, g, b;
pal.GetRGB(index, &r, &g, &b);
return XVT_MAKE_COLOR(r, g, b);
}
return COLOR_BLACK;
return COLOR_INVALID;
}
void xvt_image_get_dimensions(XVT_IMAGE image, short *width, short *height)
void xvt_image_get_dimensions(XVT_IMAGE image, short* width, short* height)
{
*width = *height = 0;
CONST_IMAGE(image, img);
if (img != NULL)
CAST_IMAGE(image, img);
if (img != NULL && img->Ok())
{
const wxImage& bmp = img->Image();
if (bmp.Ok())
{
*width = bmp.GetWidth();
*height = bmp.GetHeight();
}
*width = img->GetWidth();
*height = img->GetHeight();
}
}
XVT_IMAGE_FORMAT xvt_image_get_format(XVT_IMAGE image)
{
CONST_IMAGE(image, i);
if (i != NULL)
{
const wxImage& img = i->Image();
return img.HasPalette() ? XVT_IMAGE_CL8 : XVT_IMAGE_RGB;
}
CAST_IMAGE(image, img);
if (img != NULL && img->Ok())
return img->HasPalette() ? XVT_IMAGE_CL8 : XVT_IMAGE_RGB;
return XVT_IMAGE_NONE;
}
short xvt_image_get_ncolors(XVT_IMAGE image)
{
int n = 0;
CONST_IMAGE(image, i);
if (i != NULL)
CAST_IMAGE(image, i);
if (i != NULL && i->Ok() && i->HasPalette())
{
const wxImage& bmp = i->Image();
if (bmp.HasPalette())
const wxPalette& pal = i->GetPalette();
unsigned char r, g, b;
for (n = 16; n < 256; n++)
{
const wxPalette& pal = bmp.GetPalette();
unsigned char r, g, b;
for (n = 16; n < 256; n++)
{
if (!pal.GetRGB(n, &r, &g, &b))
break;
}
if (!pal.GetRGB(n, &r, &g, &b))
break;
}
}
return n;
@ -2460,16 +2456,15 @@ short xvt_image_get_ncolors(XVT_IMAGE image)
COLOR xvt_image_get_pixel(XVT_IMAGE image, short x, short y)
{
CONST_IMAGE(image, i);
if (i != NULL)
CAST_IMAGE(image, i);
if (i != NULL && i->Ok())
{
const wxImage& bmp = i->Image();
int r = bmp.GetRed(x, y);
int g = bmp.GetGreen(x, y);
int b = bmp.GetBlue(x, y);
int r = i->GetRed(x, y);
int g = i->GetGreen(x, y);
int b = i->GetBlue(x, y);
return XVT_MAKE_COLOR(r, g, b);
}
return -1;
return COLOR_INVALID;
}
XVT_IMAGE xvt_image_read(const char* filenamep)
@ -2489,8 +2484,8 @@ XVT_IMAGE xvt_image_read(const char* filenamep)
if (::wxFileExists(name))
{
i = new TXVT_IMAGE;
i->Image().LoadFile(name);
if (!i->Image().Ok())
i->LoadFile(name);
if (!i->Ok())
{
delete i;
i = NULL;
@ -2506,29 +2501,26 @@ XVT_IMAGE xvt_image_read_bmp(const char *filenamep)
void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color)
{
CAST_IMAGE(image, i);
if (i != NULL)
CAST_TIMAGE(image, i);
if (i != NULL && i->Ok() && i->HasPalette())
{
wxImage& bmp = i->Image();
if (bmp.HasPalette())
{
const wxPalette& pal = bmp.GetPalette();
CAST_COLOR (color, c);
unsigned char ri, gi, bi;
pal.GetRGB(index, &ri, &gi, &bi);
wxImage& bmp = i->Image(); // Set dirty!
const wxPalette& pal = bmp.GetPalette();
CAST_COLOR (color, c);
unsigned char ri, gi, bi;
pal.GetRGB(index, &ri, &gi, &bi);
const int w = bmp.GetWidth();
const int h = bmp.GetHeight();
for (int y = 0; y < h; y++) for (int x = 0; x < w; x++)
{
unsigned char r = bmp.GetRed(x, y);
if (r != ri) continue;
unsigned char g = bmp.GetGreen(x, y);
if (g != gi) continue;
unsigned char b = bmp.GetBlue(x, y);
if (b != bi) continue;
bmp.SetRGB(x, y, c.Red(), c.Green(), c.Blue());
}
const int w = bmp.GetWidth();
const int h = bmp.GetHeight();
for (int y = 0; y < h; y++) for (int x = 0; x < w; x++)
{
unsigned char r = bmp.GetRed(x, y);
if (r != ri) continue;
unsigned char g = bmp.GetGreen(x, y);
if (g != gi) continue;
unsigned char b = bmp.GetBlue(x, y);
if (b != bi) continue;
bmp.SetRGB(x, y, c.Red(), c.Green(), c.Blue());
}
}
}
@ -2540,25 +2532,24 @@ void xvt_image_set_ncolors(XVT_IMAGE image, short ncolors)
void xvt_image_set_pixel(XVT_IMAGE image, short x, short y, COLOR color)
{
CAST_IMAGE(image, i);
if (i != NULL)
CAST_TIMAGE(image, i);
if (i != NULL && i->Ok())
{
wxImage& bmp = i->Image();
CAST_COLOR (color, c);
bmp.SetRGB(x, y, c.Red(), c.Green(), c.Blue());
CAST_COLOR(color, c);
i->Image().SetRGB(x, y, c.Red(), c.Green(), c.Blue());
}
}
void xvt_image_transfer(XVT_IMAGE dstimage, XVT_IMAGE srcimage, RCT *dstrctp, RCT *srcrctp)
{
CAST_IMAGE(dstimage, dst);
CAST_IMAGE(srcimage, src);
CAST_TIMAGE(dstimage, dst);
CAST_TIMAGE(srcimage, src);
if (dst != NULL && src != NULL)
{
const wxRect rctDst = NormalizeRCT(dstrctp);
const wxRect rctSrc = NormalizeRCT(srcrctp);
wxMemoryDC dc;
wxBitmap bmp(dst->Image());
wxBitmap bmp(*dst);
dc.SelectObject(bmp);
DrawImageOnDC(dc, src, rctDst, rctSrc);
dst->Image() = bmp.ConvertToImage();
@ -3381,7 +3372,7 @@ int xvt_str_compare_ignoring_case (const char* s1, const char* s2)
char* xvt_str_duplicate(const char* str)
{
return str ? _strdup(str) : NULL; // bleah!
return str ? wxStrdup(str) : NULL; // bleah!
}
char* xvt_str_number_format(char* str, int size)
@ -3432,14 +3423,14 @@ void xvt_str_make_upper(char* str)
{
wxString s(str);
s.MakeUpper();
strcpy(str, s);
wxStrcpy(str, s);
}
void xvt_str_make_lower(char* str)
{
wxString s(str);
s.MakeLower();
strcpy(str, s);
wxStrcpy(str, s);
}
double xvt_str_fuzzy_compare (const char* s1, const char* s2)
@ -3458,6 +3449,7 @@ BOOLEAN xvt_chr_is_digit(int c)
{
return (c <= 255) && wxIsdigit(c);
}
BOOLEAN xvt_chr_is_alpha(int c)
{
return (c <= 255) && wxIsalpha(c);
@ -3506,7 +3498,7 @@ void xvt_sys_beep(int severity)
BOOLEAN xvt_sys_get_host_name(char* name, int maxlen)
{
wxString str = wxGetHostName();
strncpy(name, str, maxlen);
wxStrncpy(name, str, maxlen);
name[maxlen-1] = '\0';
return *name > '\0';
}
@ -3514,7 +3506,7 @@ BOOLEAN xvt_sys_get_host_name(char* name, int maxlen)
BOOLEAN xvt_sys_get_user_name(char* name, int maxlen)
{
wxString str = wxGetUserId();
strncpy(name, str, maxlen);
wxStrncpy(name, str, maxlen);
name[maxlen-1] = '\0';
return *name > '\0';
}
@ -3537,7 +3529,7 @@ wxThread::ExitCode TIconizeTaskThread::Entry()
::wxMilliSleep(500);
if (__bChildRunning) // Il programma e' ancora attivo
{
wxFrame* frame = (wxFrame*)_task_win;
wxFrame* frame = wxStaticCast(_task_win, wxFrame);
frame->Iconize();
}
return 0;
@ -3562,7 +3554,7 @@ long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask)
if (sync)
{
wxFrame* frame = (wxFrame*)_task_win;
wxFrame* frame = wxStaticCast(_task_win, wxFrame);
if (iconizetask)
{
wxEnableTopLevelWindows(FALSE);
@ -3702,7 +3694,7 @@ BOOLEAN xvt_sys_find_editor(const char* file, char* editor)
#endif
ok = !e.IsEmpty();
if (ok && editor != NULL)
strcpy(editor, e);
wxStrcpy(editor, e);
return ok;
}
@ -3727,7 +3719,6 @@ unsigned int xvt_sys_load_icon(const char* file)
}
#else
icon = new wxIcon;
// icon = new wxIcon(wxICON(file)); //verificare
#endif
}
@ -3735,7 +3726,7 @@ unsigned int xvt_sys_load_icon(const char* file)
{
for (id = 60001; ; id++)
{
wxIcon* ico = (wxIcon*)_nice_icons.Get(id);
wxIcon* ico = wxDynamicCast(_nice_icons.Get(id), wxIcon);
if (ico == NULL)
{
_nice_icons.Put(id, icon);
@ -3931,20 +3922,16 @@ void xvt_timer_destroy(long id)
void xvt_vobj_destroy(WINDOW win)
{
if (win != NULL_WIN)
wxWindow* w = wxDynamicCast(_nice_windows.Get(win), wxWindow);
if (w != NULL)
{
if (win != PRINTER_WIN && win != TASK_WIN)
{
xvt_win_set_caret_visible(win, FALSE);
wxASSERT(win == (WINDOW)w);
xvt_win_set_caret_visible(win, FALSE);
w->Destroy(); // same as delete w
_nice_windows.Delete(win); // Elimina "di nuovo" dalla lista delle finestre attive
wxWindow* w = (wxWindow*)_nice_windows.Get(win);
if (w != NULL)
{
wxASSERT((wxWindow*)win == w);
w->Destroy(); // formerly delete w;
_nice_windows.Delete(win); // Elimina dalla lista delle finestre attive
}
}
GetTDCMapper().DestroyTDC(win); // Elimina dalla lista dei display context
}
}
@ -4121,8 +4108,8 @@ RCT* xvt_vobj_get_client_rect(WINDOW win, RCT *rctp)
long xvt_vobj_get_data(WINDOW win)
{
CAST_TWIN(win, w);
return w._app_data;
const TwxWindow* w = wxDynamicCast(_nice_windows.Get(win), TwxWindow);
return w != NULL ? w->_app_data : 0L;
}
RCT* xvt_vobj_get_outer_rect(WINDOW win, RCT *rctp)
@ -4383,9 +4370,12 @@ BOOLEAN xvt_win_enum_wins(WINDOW parent_win, XVT_ENUM_CHILDREN func, long data,
{
for (wxWindowList::iterator i = list.begin(); i != list.end(); ++i)
{
WINDOW win = (WINDOW)&(wxWindow&)*i;
if (!func(win, data))
break;
wxWindow* tw = wxDynamicCast(*i, wxWindow);
if (tw != NULL)
{
if (!func((WINDOW)tw, data))
break;
}
}
}
return ok;
@ -4408,16 +4398,15 @@ long xvt_win_get_children_count(WINDOW parent_win)
void xvt_win_post_event(WINDOW win, EVENT* event_p)
{
// Per ora funziona solo con la task window
XVT_ASSERT(win == (WINDOW)_task_win && event_p != NULL);
// Per ora e' garantito che funzioni solo con la task window
CAST_WIN(win, w);
switch (event_p->type)
{
case E_COMMAND:
{
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, event_p->v.cmd.tag);
e.SetEventObject(_task_win);
wxPostEvent(_task_win, e);
e.SetEventObject(&w);
wxPostEvent(&w, e);
}
break;
default:
@ -4431,7 +4420,7 @@ void xvt_win_release_pointer(void)
if (_mouse_trapper != NULL)
{
// cap SHOULD be equal to _mouse_trapper :-)
wxWindow* cap = _mouse_trapper->GetCapture();
wxWindow* cap = wxWindow::GetCapture();
if (cap != NULL)
cap->ReleaseMouse();
_mouse_trapper = NULL;
@ -4482,11 +4471,11 @@ static wxStatusBar* WIN2StatBar(WINDOW win)
wxStatusBar* pStatusBar = NULL;
if (win == NULL_WIN || win == TASK_WIN)
{
wxFrame* w = (wxFrame*)_task_win;
wxFrame* w = wxStaticCast(_task_win, wxFrame);
pStatusBar = w->GetStatusBar();
}
else
pStatusBar = (wxStatusBar*)win;
pStatusBar = wxDynamicCast((wxObject*)win, wxStatusBar);
return pStatusBar;
}
@ -4510,34 +4499,33 @@ const char* statbar_set_default_title(WINDOW win, const char *text)
return statbar_set_title(win, text);
}
XVT_FNTID statbar_set_fontid(WINDOW win, XVT_FNTID fontid)
XVT_FNTID statbar_set_fontid(WINDOW win, XVT_FNTID font_id)
{
wxStatusBar* pStatBar = WIN2StatBar(win);
if (pStatBar != NULL && fontid != NULL)
if (pStatBar != NULL && font_id != NULL)
{
const TFontId& font = *(const TFontId*)fontid;
CAST_FONT(font_id, font);
pStatBar->SetFont(font.Font(NULL, win));
}
return fontid;
return font_id;
}
XVT_FNTID statbar_get_fontid(WINDOW win, XVT_FNTID fontid)
XVT_FNTID statbar_get_fontid(WINDOW win, XVT_FNTID font_id)
{
wxStatusBar* pStatBar = WIN2StatBar(win);
if (pStatBar != NULL && fontid != NULL)
if (pStatBar != NULL && font_id != NULL)
{
TFontId& font = *(TFontId*)fontid;
CAST_FONT(font_id, font);
font.Copy(pStatBar->GetFont());
}
return fontid;
return font_id;
}
WINDOW statbar_create(int cid, int left, int top, int right, int bottom,
int prop_count, char **prop_list, WINDOW parent_win,
int parent_rid, long parent_flags, char *parent_class)
{
XVT_ASSERT(parent_win == TASK_WIN);
wxFrame& w = *(wxFrame*)_task_win;
wxFrame& w = *wxStaticCast((wxObject*)parent_win, wxFrame);
const int nStyle = 0; // not wxST_SIZEGRIP
wxStatusBar* pStatusBar = w.CreateStatusBar(2, nStyle);
@ -4555,7 +4543,7 @@ BOOLEAN statbar_destroy(WINDOW win)
wxStatusBar* pStatusBar = WIN2StatBar(win);
if (pStatusBar != NULL)
{
wxFrame& w = *(wxFrame*)_task_win;
wxFrame& w = *wxStaticCast(_task_win, wxFrame);
if (w.GetStatusBar() == pStatusBar)
w.SetStatusBar(NULL);
pStatusBar->Destroy();

View File

@ -163,7 +163,6 @@ XVTDLL BOOLEAN xvt_fsys_convert_str_to_dir(const char *path, DIRECTORY *dirp);
XVTDLL BOOLEAN xvt_fsys_convert_fspec_to_str(const FILE_SPEC *fs, char *path, int sz_path);
XVTDLL BOOLEAN xvt_fsys_convert_str_to_fspec(const char *mbs, FILE_SPEC *fs);
XVTDLL BOOLEAN xvt_fsys_get_dir(DIRECTORY *dirp);
XVTDLL void xvt_fsys_get_default_dir(DIRECTORY *dirp);
XVTDLL SLIST xvt_fsys_list_files(const char *type, const char *pat, BOOLEAN dirs);
@ -354,7 +353,6 @@ XVTDLL BOOLEAN xvt_chr_is_digit(int c);
XVTDLL BOOLEAN xvt_chr_is_alpha(int c);
XVTDLL BOOLEAN xvt_chr_is_alnum(int c);
// System calls by XVAGA
XVTDLL void xvt_sys_beep(int severity);
XVTDLL long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask);

View File

@ -499,18 +499,13 @@ long TwxNoteBook::Flags2Style(long flags) const
TwxNoteBook::TwxNoteBook(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, long flags)
: wxAuiNotebook(parent, id, pos, size, Flags2Style(flags)), m_bSuspended(false)
{ _nice_windows.Put((WINDOW)this, this); }
{
_nice_windows.Put((WINDOW)this, this); // Serve per poter fare la xvt_vobj_destroy
}
TwxNoteBook::~TwxNoteBook()
{
// Il wxAuiNotebook non gradisce le pagine doppie, per cui ... le ammazzo io.
m_bSuspended = true;
for (int i = GetPageCount()-1; i > 0; i--)
{
wxWindow* page = GetPage(i); // Pagina corrente a partire dall'ultima
if (GetPageIndex(page) < i) // C'e' anche prima ...
RemovePage(i); // ... allora la rimuovo (senza delete!)
}
_nice_windows.Delete((WINDOW)this);
}
@ -522,7 +517,10 @@ short xvt_notebk_add_page(WINDOW notebk, WINDOW page, const char* title, XVT_IMA
CAST_NOTEBOOK(notebk, nb);
wxString strTitle = title;
if (strTitle.IsEmpty() && page != NULL_WIN)
strTitle = ((wxWindow*)page)->GetLabel();
{
wxWindow* pg = wxStaticCast((wxObject*)page, wxWindow);
strTitle = pg->GetLabel();
}
idx = nb.AddTab((wxWindow*)page, strTitle, image, tab_no);
}
return idx;

View File

@ -414,7 +414,7 @@ BOOLEAN xvt_app_escape(int esc_code, PRINT_RCD* rcd, long* ph, long* pw, long* p
TPRINT_RCD* prcd = (TPRINT_RCD*)rcd;
#ifdef WIN32
RCD2data(prcd, data);
RCD2data(prcd, data);
data.SetOrientation(*ph > *pw ? 1 : 2);
data.ConvertToNative();
@ -614,7 +614,6 @@ WINDOW xvt_print_create_win(PRINT_RCD* precp, const char* title)
po.InitDC(rcd, title);
}
return PRINTER_WIN;
}
void xvt_print_destroy(PRINT_RCD* precp)
@ -649,7 +648,6 @@ BOOLEAN xvt_print_is_pdf(PRINT_RCD* precp)
}
BOOLEAN xvt_print_is_valid(const PRINT_RCD* precp)
{
BOOLEAN ok = precp != NULL && precp->pr == NULL;
if (ok)
@ -672,7 +670,6 @@ int xvt_print_get_name(const PRINT_RCD* precp, char* name, int sz_s)
if (!xvt_print_is_valid(precp))
return 0;
#ifdef WIN32
wxString n = ((const char*)precp) + 4;
if (n.Length() >= 30)
@ -1129,7 +1126,7 @@ BOOLEAN xvt_str_md5(const char* instr, char* outstr)
BOOLEAN ok = instr && *instr && outstr;
if (ok)
{
strcpy(outstr, wxMD5Checksum::GetMD5((unsigned char*)instr, strlen(instr)));
wxStrcpy(outstr, wxMD5Checksum::GetMD5((unsigned char*)instr, strlen(instr)));
ok = *outstr != '\0';
}
return ok;
@ -1141,7 +1138,7 @@ BOOLEAN xvt_fsys_file_md5(const char* path, char* outstr)
BOOLEAN ok = path && *path && outstr;
if (ok)
{
strcpy(outstr, wxMD5Checksum::GetMD5(wxString(path)));
wxStrcpy(outstr, wxMD5Checksum::GetMD5(wxString(path)));
ok = *outstr != '\0';
}
return ok;

View File

@ -726,22 +726,28 @@ void TwxWindow::OnMouseWheel(wxMouseEvent& evt)
void TwxWindow::OnPaint(wxPaintEvent& WXUNUSED(evt))
{
EVENT e; memset(&e, 0, sizeof(EVENT));
e.type = E_UPDATE;
const wxRect rctDamaged = GetUpdateRegion().GetBox();
if (!rctDamaged.IsEmpty())
{
EVENT e; memset(&e, 0, sizeof(EVENT));
e.type = E_UPDATE;
RCT& rct = e.v.update.rct;
RCT& rct = e.v.update.rct;
wxRect rctDamaged = GetUpdateRegion().GetBox();
rct.left = rctDamaged.x;
rct.top = rctDamaged.y;
rct.right = rctDamaged.GetRight()+1;
rct.bottom = rctDamaged.GetBottom()+1;
//wxRect rctDamaged = GetUpdateRegion().GetBox();
rct.left = rctDamaged.x;
rct.top = rctDamaged.y;
rct.right = rctDamaged.GetRight()+1;
rct.bottom = rctDamaged.GetBottom()+1;
TDC& tdc = GetTDCMapper().GetTDC((WINDOW)this);
tdc.GetDC(true); // Forza la creazione di un wxPaintDC
DoXvtEvent(e);
tdc.KillDC(); // Distrugge il wxPaintDC
GetTDCMapper().DestroyDC(NULL_WIN); // Distrugge davvero tutti i wxClientDC residui (risolve molte "porcate" del video)
TDC& tdc = GetTDCMapper().GetTDC((WINDOW)this);
tdc.GetDC(true); // Forza la creazione di un wxPaintDC
DoXvtEvent(e);
tdc.KillDC(); // Distrugge il wxPaintDC
GetTDCMapper().DestroyDC(NULL_WIN); // Distrugge davvero tutti i wxClientDC residui (risolve molte "porcate" del video)
}
else
int keku = 1;
}
static SCROLL_CONTROL ConvertScrollToXVT(wxEventType et)
@ -770,7 +776,7 @@ void TwxWindow::OnScroll(wxScrollEvent& evt)
SCROLL_CONTROL sc = ConvertScrollToXVT(evt.GetEventType());
if (sc != SC_NONE)
{
wxWindow* ctl = (wxWindow*)evt.GetEventObject();
wxScrollBar* ctl = wxStaticCast(evt.GetEventObject(), wxScrollBar);
const wxSize sz = ctl->GetSize();
EVENT e; memset(&e, 0, sizeof(EVENT));
@ -859,7 +865,8 @@ void TwxWindow::SetMenuTree(const MENU_ITEM* tree)
if (m_menu)
xvt_res_free_menu_tree(m_menu);
m_menu = xvt_menu_duplicate_tree(tree);
((TTaskWin*)_task_win)->PushMenuTree(tree, this);
TTaskWin* tw = wxStaticCast(_task_win, TTaskWin);
tw->PushMenuTree(tree, this);
}
}
@ -917,26 +924,31 @@ BOOLEAN TwxWindow::AddPane(wxWindow* wnd, const char* caption, int nDock, int nF
}
TwxWindow::TwxWindow()
: m_menu(NULL), _type(W_DOC), _eh(NULL), _app_data(0L),
_timer(NULL), m_pManager(NULL)
: m_menu(NULL), _type(W_DOC), _eh(NULL), _app_data(0L),
_timer(NULL), m_pManager(NULL)
{ }
TwxWindow::TwxWindow(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style)
: TwxWindowBase(parent, id, title, pos, size, style),
m_menu(NULL), _eh(NULL), _timer(NULL), m_pManager(NULL)
m_menu(NULL), _eh(NULL), _app_data(0L), _timer(NULL), m_pManager(NULL)
{
_nice_windows.Put((WINDOW)this, this);
}
TwxWindow::~TwxWindow()
{
if (HasCapture())
ReleaseMouse();
EVENT e; memset(&e, 0, sizeof(EVENT));
e.type = E_DESTROY;
DoXvtEvent(e);
// Rendo praticamente impossibile risalire a questo oggetto d'ora in poi
_eh = NULL;
_app_data = 0L;
_nice_windows.Delete((WINDOW)this);
if (HasCapture())
{
ReleaseMouse();
xvt_win_release_pointer(); // Paranoid?
}
if (_timer != NULL)
delete _timer;
@ -949,10 +961,9 @@ TwxWindow::~TwxWindow()
if (m_menu)
{
xvt_res_free_menu_tree(m_menu);
m_menu = NULL;
((TTaskWin*)_task_win)->PopMenuTree();
}
_nice_windows.Delete((WINDOW)this);
}
///////////////////////////////////////////////////////////
@ -991,7 +1002,11 @@ void TTaskWin::OnMenu(wxCommandEvent& evt)
if (m_MenuOwner == NULL || m_MenuOwner == this)
_task_win_handler((WINDOW)this, &e);
else
((TwxWindow*)m_MenuOwner)->_eh((WINDOW)m_MenuOwner, &e);
{
TwxWindow* w = wxDynamicCast(m_MenuOwner, TwxWindow);
if (w != NULL)
w->_eh((WINDOW)m_MenuOwner, &e);
}
}
void TTaskWin::OnPaint(wxPaintEvent& WXUNUSED(evt))
@ -1170,11 +1185,7 @@ TwxTaskBarIcon::TwxTaskBarIcon(wxWindow* owned, short icon, wxString strTip)
}
if (strTip.IsEmpty())
{
const wxWindow* pWin = wxDynamicCast(_owned, wxWindow);
if (pWin != NULL)
strTip = pWin->GetLabel();
}
strTip = _owned->GetLabel();
SetIcon(*pIcon, strTip);
}

View File

@ -1,12 +1,13 @@
#ifndef __XVTWIN_H
#define __XVTWIN_H
class TFontId
class TFontId : public wxObject
{
wxString m_strFace;
int m_nSize;
XVT_FONT_STYLE_MASK m_wMask;
WINDOW m_win;
DECLARE_DYNAMIC_CLASS(TFontId);
protected:
void Copy(const TFontId& pFont);
@ -124,7 +125,7 @@ public:
TwxWindowBase() { }
TwxWindowBase(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint & pos, const wxSize & size, long style);
virtual ~TwxWindowBase() { }
DECLARE_DYNAMIC_CLASS(TwxWindowBase)
};