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:
parent
a1af297434
commit
32a6d81cfb
@ -123,17 +123,20 @@ short TBook_window::pages() const
|
|||||||
return _ctrl == NULL_WIN ? 0 : xvt_notebk_get_num_tabs(_ctrl);
|
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)
|
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_notebk_set_front_page(_ctrl, page);
|
||||||
xvt_vobj_set_visible(pw, show);
|
|
||||||
}
|
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)
|
void TBook_window::handler(WINDOW win, EVENT* ep)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
|
#include <codeb.h>
|
||||||
#include <dongle.h>
|
#include <dongle.h>
|
||||||
#include <extcdecl.h>
|
#include <extcdecl.h>
|
||||||
#include <isam.h>
|
#include <isam.h>
|
||||||
@ -21,23 +22,38 @@
|
|||||||
|
|
||||||
class TInfo_mask : public TArray_sheet
|
class TInfo_mask : public TArray_sheet
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
virtual bool get_cell_colors(int row, int col, COLOR& fore, COLOR& back) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void add_row(const char* prompt, const char* value);
|
void add_row(const char* prompt, const char* value, int err = 0);
|
||||||
void add_row(const char* prompt, unsigned long value);
|
void add_row(const char* prompt, unsigned long value, int err = 0);
|
||||||
TInfo_mask();
|
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;
|
TToken_string* r = new TToken_string;
|
||||||
r->add(prompt);
|
r->add(prompt);
|
||||||
r->add(value);
|
r->add(value);
|
||||||
|
r->add(err);
|
||||||
add(r);
|
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);
|
add_row(prompt, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,13 +111,17 @@ TInfo_mask::TInfo_mask()
|
|||||||
TFilename temp;
|
TFilename temp;
|
||||||
temp.tempdir();
|
temp.tempdir();
|
||||||
|
|
||||||
|
TString strdb;
|
||||||
|
DB_version(strdb.get_buffer(), strdb.size());
|
||||||
|
|
||||||
add_row(TR("Versione"), versione);
|
add_row(TR("Versione"), versione);
|
||||||
add_row(TR("Protezione"), prot);
|
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("Assistenza"), dongle().year_assist());
|
||||||
add_row(TR("Installazione"), tipo);
|
add_row(TR("Installazione"), tipo);
|
||||||
add_row(TR("Sistema"), stros);
|
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("Utente"), user());
|
||||||
add_row(TR("Studio"), firm2dir(-1));
|
add_row(TR("Studio"), firm2dir(-1));
|
||||||
add_row(TR("Ditta"), campoini.get("Firm", "Main"));
|
add_row(TR("Ditta"), campoini.get("Firm", "Main"));
|
||||||
@ -113,15 +133,17 @@ TInfo_mask::TInfo_mask()
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_row(TR("Programma"), arg);
|
add_row(TR("Programma"), arg);
|
||||||
add_row(TR("Config locale"), campoini.name());
|
add_row(TR("Config locale"), campoini.name(), campoini.name().find(' ') >= 0);
|
||||||
add_row(TR("Config utente"), userini.name());
|
add_row(TR("Config utente"), userini.name(), userini.name().find(' ') >= 0);
|
||||||
add_row(TR("File temporanei"), temp);
|
add_row(TR("File temporanei"), temp, temp.find(' ') >= 0);
|
||||||
add_row(TR("Spazio su disco"), xvt_fsys_get_disk_free_space(firm2dir(-1), 'M'));
|
|
||||||
TString printer(userini.get("Name", "Printer"));
|
|
||||||
|
|
||||||
|
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())
|
if (printer.blank())
|
||||||
printer = "Nessuna";
|
printer = "Nessuna";
|
||||||
add_row(TR("Stampante"), printer);
|
add_row(TR("Stampante"), printer, printer.len() < 32);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,3 +1168,9 @@ int DB_memowrite( const int handle, const char* fieldname, const char* data )
|
|||||||
return ret;
|
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;
|
||||||
|
}
|
||||||
|
@ -66,6 +66,7 @@ extern "C" {
|
|||||||
int DB_rec_locked(int handle,long nrec);
|
int DB_rec_locked(int handle,long nrec);
|
||||||
long DB_getconf();
|
long DB_getconf();
|
||||||
long DB_changed(int handle); /* returns true if the index of the key is changed */
|
long DB_changed(int handle); /* returns true if the index of the key is changed */
|
||||||
|
long DB_version(char* str, int maxstr);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,11 +5,14 @@
|
|||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
#include <recarray.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);
|
const TFixed_string app(__argv[0]);
|
||||||
RCT rct; xvt_vobj_get_outer_rect(TASK_WIN, &rct);
|
if (app.match("*ba[0,1]*", true))
|
||||||
return rct.left > 0 && rct.right < dw-1;
|
return false;
|
||||||
|
|
||||||
|
TConfig ini(CONFIG_GUI, "Colors");
|
||||||
|
return ini.get_int("TreeView") == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
@ -73,12 +76,12 @@ long TExternal_app::run(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vecchio titolo della finestra principale
|
TString256 old_title; // Vecchio titolo della finestra principale
|
||||||
TString256 old_title;
|
bool close_all = false; // Chiudi tutti i file in caso di manutenzione
|
||||||
|
|
||||||
const bool close_all = !async && _path.starts_with("ba1 -0") && prefix_valid();
|
|
||||||
if (!async)
|
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!
|
if (close_all) //se lancia la gestione archivi forza la chiusura dei files e pure dei tracciati!
|
||||||
prefix().set("");
|
prefix().set("");
|
||||||
else
|
else
|
||||||
@ -87,7 +90,8 @@ long TExternal_app::run(
|
|||||||
if (dongle().local())
|
if (dongle().local())
|
||||||
dongle().logout();
|
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_get_title(TASK_WIN, old_title.get_buffer(), old_title.size());
|
||||||
xvt_vobj_set_title(TASK_WIN, __MAGIC_CAPTION__);
|
xvt_vobj_set_title(TASK_WIN, __MAGIC_CAPTION__);
|
||||||
@ -98,9 +102,7 @@ long TExternal_app::run(
|
|||||||
_exitcode = xvt_sys_execute(path, !async, iconize);
|
_exitcode = xvt_sys_execute(path, !async, iconize);
|
||||||
|
|
||||||
if (old_title.full()) // Rimetto le cose a posto
|
if (old_title.full()) // Rimetto le cose a posto
|
||||||
{
|
|
||||||
xvt_vobj_set_title(TASK_WIN, old_title);
|
xvt_vobj_set_title(TASK_WIN, old_title);
|
||||||
}
|
|
||||||
|
|
||||||
// restore cwd
|
// restore cwd
|
||||||
xvt_fsys_set_dir(&oldir);
|
xvt_fsys_set_dir(&oldir);
|
||||||
|
@ -1247,6 +1247,16 @@ void TMask::insert_bar(WINDOW page)
|
|||||||
else // TopBar
|
else // TopBar
|
||||||
{
|
{
|
||||||
CHECK(_toolbar == NULL_WIN, "One single top bar, please!");
|
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;
|
_toolbar = page;
|
||||||
xvt_pane_add(parent, _toolbar, "_TopBar_", 62, 0);
|
xvt_pane_add(parent, _toolbar, "_TopBar_", 62, 0);
|
||||||
}
|
}
|
||||||
|
@ -521,7 +521,7 @@ bool TSQL_recordset::move_to(TRecnotype n)
|
|||||||
if (n < _first_row || n >= _first_row+_page.items())
|
if (n < _first_row || n >= _first_row+_page.items())
|
||||||
{
|
{
|
||||||
TString sql; parsed_text(sql);
|
TString sql; parsed_text(sql);
|
||||||
if (sql.find("LIMIT ") < 0)
|
if (sql.starts_with("SELECT ") && sql.find("LIMIT ") < 0)
|
||||||
{
|
{
|
||||||
const int semicolon = sql.rfind(';');
|
const int semicolon = sql.rfind(';');
|
||||||
if (semicolon >= 0)
|
if (semicolon >= 0)
|
||||||
|
@ -1083,8 +1083,7 @@ void TTree_window::update()
|
|||||||
{
|
{
|
||||||
if (_header.full())
|
if (_header.full())
|
||||||
{
|
{
|
||||||
set_brush(MASK_BACK_COLOR);
|
clear(MASK_BACK_COLOR);
|
||||||
bar(0, 0, columns(), _header.items());
|
|
||||||
short x = 3, y = 0;
|
short x = 3, y = 0;
|
||||||
FOR_EACH_TOKEN(_header, row)
|
FOR_EACH_TOKEN(_header, row)
|
||||||
stringat(x, y++, 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)
|
if (ep->v.ctl.ci.type == WC_TREE && _tree != NULL)
|
||||||
handle_tree_event(ep);
|
handle_tree_event(ep);
|
||||||
break;
|
break;
|
||||||
|
case E_UPDATE:
|
||||||
|
update(); // TControl_host_window non lo fa
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1238,7 +1238,7 @@ void TViswin::txt_clear(COLOR color)
|
|||||||
autoscroll(FALSE);
|
autoscroll(FALSE);
|
||||||
set_brush(color);
|
set_brush(color);
|
||||||
set_mode(M_COPY);
|
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
|
bool TViswin::can_be_closed() const
|
||||||
@ -2577,7 +2577,7 @@ TViswin::TViswin(const char *fname,
|
|||||||
if (parent == NULL_WIN)
|
if (parent == NULL_WIN)
|
||||||
parent = TASK_WIN;
|
parent = TASK_WIN;
|
||||||
|
|
||||||
_toplevel = parent == TASK_WIN;
|
_toplevel = brwfld == NULL; // parent == TASK_WIN;
|
||||||
|
|
||||||
if (_toplevel)
|
if (_toplevel)
|
||||||
{
|
{
|
||||||
@ -2617,19 +2617,21 @@ TViswin::TViswin(const char *fname,
|
|||||||
for (i = 0; i < _modules.items(); i++)
|
for (i = 0; i < _modules.items(); i++)
|
||||||
((TImage*)_modules.objptr(i))->convert_transparent_color(MASK_BACK_COLOR);
|
((TImage*)_modules.objptr(i))->convert_transparent_color(MASK_BACK_COLOR);
|
||||||
|
|
||||||
long flags = WSF_HSCROLL | WSF_VSCROLL;
|
|
||||||
if (_toplevel)
|
if (_toplevel)
|
||||||
flags |= WSF_SIZE /* | WSF_CLOSE */;
|
{
|
||||||
|
const long flags = WSF_HSCROLL | WSF_VSCROLL | WSF_SIZE;
|
||||||
WIN_TYPE rt = _toplevel ? W_DOC : W_PLAIN;
|
WIN_TYPE rt = W_DOC;
|
||||||
create(x, y, maxlarg, maxalt, title, flags, rt, parent,
|
WINDOW myself = create(x, y, maxlarg, maxalt, title, flags, rt, parent,
|
||||||
_toplevel ? VISWIN_BAR : 0);
|
_toplevel ? VISWIN_BAR : 0);
|
||||||
|
attach_interface(myself, BACKGROUND);
|
||||||
attach_interface(win(), BACKGROUND);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// La finestra e' gia' creata automaticamente dal TWindowed_field
|
||||||
|
}
|
||||||
|
|
||||||
set_opaque_text (TRUE);
|
set_opaque_text (TRUE);
|
||||||
set_font (XVT_FFN_FIXED, XVT_FS_NONE, PRINT_HEIGHT);
|
set_font (PRINT_FONT, XVT_FS_NONE, PRINT_HEIGHT);
|
||||||
// set_font (printer().fontname(), XVT_FS_NONE, PRINT_HEIGHT);
|
|
||||||
|
|
||||||
if (_toplevel)
|
if (_toplevel)
|
||||||
{
|
{
|
||||||
@ -2701,7 +2703,8 @@ TViswin::TViswin(const char *fname,
|
|||||||
TViswin ::~TViswin ()
|
TViswin ::~TViswin ()
|
||||||
{
|
{
|
||||||
// avoid deleting child window (already deleted by mask)
|
// avoid deleting child window (already deleted by mask)
|
||||||
if (!_toplevel) set_win(NULL_WIN);
|
if (!_toplevel)
|
||||||
|
set_win(NULL_WIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@ -397,13 +397,11 @@ word TWindow::class_id() const
|
|||||||
long TWindow::window_handler(WINDOW win, EVENT* ep)
|
long TWindow::window_handler(WINDOW win, EVENT* ep)
|
||||||
{
|
{
|
||||||
TWindow* w = (TWindow*)xvt_vobj_get_data(win);
|
TWindow* w = (TWindow*)xvt_vobj_get_data(win);
|
||||||
CHECK(w != NULL, "Invalid window");
|
if (w != NULL)
|
||||||
w->handler(win, ep);
|
w->handler(win, ep);
|
||||||
|
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @mfunc Crea la finestra
|
// @mfunc Crea la finestra
|
||||||
@ -445,9 +443,10 @@ TWindow::~TWindow()
|
|||||||
{
|
{
|
||||||
if (_win != NULL_WIN)
|
if (_win != NULL_WIN)
|
||||||
{
|
{
|
||||||
if (is_valid_window(_win))
|
const WINDOW del_win = _win; // Memorizzo l'handle da cancellare
|
||||||
xvt_vobj_destroy(_win);
|
_win = NULL_WIN; // Azzero preventivamente l'handle medesimo
|
||||||
_win = NULL_WIN;
|
if (is_valid_window(del_win))
|
||||||
|
xvt_vobj_destroy(del_win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,10 +392,8 @@ bool OsWin32_DrawBitmap(HBITMAP hBMP, wxDC& dc, const wxRect& dst, const wxRect&
|
|||||||
free(bi);
|
free(bi);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
{
|
{
|
||||||
HGDIOBJ hOldBitmap = ::SelectObject(hMemDC, hBMP);
|
HGDIOBJ hOldBitmap = ::SelectObject(hMemDC, hBMP);
|
||||||
//::SetStretchBltMode(hDC, nDepth > 8 ? COLORONCOLOR : HALFTONE);
|
|
||||||
::SetStretchBltMode(hDC, HALFTONE);
|
::SetStretchBltMode(hDC, HALFTONE);
|
||||||
::StretchBlt(hDC, dst.x, dst.y, dst.width, dst.height,
|
::StretchBlt(hDC, dst.x, dst.y, dst.width, dst.height,
|
||||||
hMemDC, src.x, src.y, src.width, src.height, SRCCOPY);
|
hMemDC, src.x, src.y, src.width, src.height, SRCCOPY);
|
||||||
|
254
xvaga/xvaga.cpp
254
xvaga/xvaga.cpp
@ -42,6 +42,7 @@
|
|||||||
#define CAST_TWIN(win,w) TwxWindow& w = *wxStaticCast((wxWindow*)win, TwxWindow);
|
#define CAST_TWIN(win,w) TwxWindow& w = *wxStaticCast((wxWindow*)win, TwxWindow);
|
||||||
#define CAST_TDC(win,dc) TDC& dc = GetTDCMapper().GetTDC(win);
|
#define CAST_TDC(win,dc) TDC& dc = GetTDCMapper().GetTDC(win);
|
||||||
#define CAST_DC(win,dc) wxDC& dc = GetTDCMapper().GetDC(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;
|
wxWindow* _mouse_trapper = NULL;
|
||||||
RCT _startup_rect = { 0,0,0,0 };
|
RCT _startup_rect = { 0,0,0,0 };
|
||||||
@ -260,7 +261,7 @@ wxString _GetResourceName(const char* type, int rid)
|
|||||||
|
|
||||||
const wxIcon& _GetIconResource(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)
|
if (icon == NULL)
|
||||||
{
|
{
|
||||||
wxString strName = _GetResourceName("Icon", rid);
|
wxString strName = _GetResourceName("Icon", rid);
|
||||||
@ -270,7 +271,7 @@ const wxIcon& _GetIconResource(int rid)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
icon = (wxIcon*)_nice_icons.Get(ICON_RSRC);
|
icon = wxDynamicCast(_nice_icons.Get(ICON_RSRC), wxIcon);
|
||||||
if (icon == NULL)
|
if (icon == NULL)
|
||||||
{
|
{
|
||||||
strName.Printf("%d", ICON_RSRC);
|
strName.Printf("%d", ICON_RSRC);
|
||||||
@ -285,7 +286,7 @@ const wxIcon& _GetIconResource(int rid)
|
|||||||
const wxCursor* GetCursorResource(int rid)
|
const wxCursor* GetCursorResource(int rid)
|
||||||
{
|
{
|
||||||
static wxHashTable _nice_cursors;
|
static wxHashTable _nice_cursors;
|
||||||
wxCursor* cursor = (wxCursor*)_nice_cursors.Get(rid);
|
wxCursor* cursor = wxDynamicCast(_nice_cursors.Get(rid), wxCursor);
|
||||||
if (cursor == NULL)
|
if (cursor == NULL)
|
||||||
{
|
{
|
||||||
switch (rid)
|
switch (rid)
|
||||||
@ -489,8 +490,11 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (hwndParent != NULL)
|
if (hwndParent != NULL)
|
||||||
{
|
{
|
||||||
HWND hwndChild = (HWND)_task_win->GetHandle();
|
// HWND hwndChild = (HWND)_task_win->GetHandle();
|
||||||
::SetParent(hwndChild, hwndParent);
|
// ::SetParent(hwndChild, hwndParent);
|
||||||
|
wxWindow* padre = new wxWindow;
|
||||||
|
padre->AssociateHandle(hwndParent);
|
||||||
|
_task_win->Reparent(padre);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -530,10 +534,11 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
|
|||||||
for (int i= 0; i < 3; i++)
|
for (int i= 0; i < 3; i++)
|
||||||
pMenubar->Append(Menus[i], Title[i]);
|
pMenubar->Append(Menus[i], Title[i]);
|
||||||
#endif
|
#endif
|
||||||
((wxFrame*)_task_win)->SetMenuBar(pMenubar);
|
wxFrame* pFrame = wxStaticCast(_task_win, wxFrame);
|
||||||
|
pFrame->SetMenuBar(pMenubar);
|
||||||
if (style & wxMAXIMIZE)
|
if (style & wxMAXIMIZE)
|
||||||
((wxFrame*)_task_win)->Maximize();
|
pFrame->Maximize();
|
||||||
|
|
||||||
_task_win->Show();
|
_task_win->Show();
|
||||||
|
|
||||||
wxApp* a = wxTheApp;
|
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)
|
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)
|
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)
|
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);
|
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)
|
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;
|
wxFontData data;
|
||||||
data.SetInitialFont(font.Font(NULL, win));
|
data.SetInitialFont(font.Font(NULL, win));
|
||||||
data.EnableEffects(reserved != 0);
|
data.EnableEffects(reserved != 0);
|
||||||
@ -1119,8 +1124,8 @@ public:
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(TXVT_IMAGE, wxImage);
|
IMPLEMENT_DYNAMIC_CLASS(TXVT_IMAGE, wxImage);
|
||||||
|
|
||||||
#define CAST_IMAGE(xvtimg, imgptr) TXVT_IMAGE* imgptr = wxDynamicCast(xvtimg, TXVT_IMAGE);
|
#define CAST_TIMAGE(xvtimg, img) TXVT_IMAGE* img = wxDynamicCast(xvtimg, TXVT_IMAGE);
|
||||||
#define CONST_IMAGE(xvtimg, imgptr) const TXVT_IMAGE* imgptr = wxDynamicCast(xvtimg, TXVT_IMAGE);
|
#define CAST_IMAGE(xvtimg, img) const wxImage* img = wxDynamicCast(xvtimg, wxImage);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
@ -1172,6 +1177,8 @@ TXVT_IMAGE::~TXVT_IMAGE()
|
|||||||
// Font Handling
|
// Font Handling
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(TFontId, wxObject);
|
||||||
|
|
||||||
void TFontId::Copy(const TFontId& rFont)
|
void TFontId::Copy(const TFontId& rFont)
|
||||||
{
|
{
|
||||||
m_strFace = rFont.m_strFace;
|
m_strFace = rFont.m_strFace;
|
||||||
@ -1318,7 +1325,6 @@ void TFontId::Copy(const wxFont& rFont)
|
|||||||
m_win = NULL_WIN;
|
m_win = NULL_WIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Drawable windows
|
// 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)
|
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 (image != NULL)
|
||||||
{
|
{
|
||||||
if (xvt_dwin_is_update_needed(win, dest))
|
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)
|
void xvt_dwin_set_font(WINDOW win, XVT_FNTID font_id)
|
||||||
{
|
{
|
||||||
XVT_ASSERT(font_id != NULL);
|
|
||||||
CAST_TDC(win, dc);
|
CAST_TDC(win, dc);
|
||||||
const TFontId& font = *(const TFontId*)font_id;
|
CAST_FONT(font_id, font);
|
||||||
if (dc._font != font)
|
if (dc._font != font)
|
||||||
{
|
{
|
||||||
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)
|
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);
|
XVT_ASSERT(dest_font_id && src_font_id && mask == XVT_FA_ALL);
|
||||||
TFontId* dst = (TFontId*)dest_font_id;
|
CAST_FONT(dest_font_id, dst);
|
||||||
TFontId* src = (TFontId*)src_font_id;
|
CAST_FONT(src_font_id, src);
|
||||||
*dst = *src;
|
dst = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
XVT_FNTID xvt_font_create(void)
|
XVT_FNTID xvt_font_create(void)
|
||||||
@ -1850,7 +1855,7 @@ 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
|
// 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* s = strchr(buf, '/');
|
const char* s = strchr(buf, '/');
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return;
|
return;
|
||||||
@ -1894,12 +1899,16 @@ void xvt_font_deserialize(XVT_FNTID font_id, const char* buf)
|
|||||||
|
|
||||||
void xvt_font_destroy(XVT_FNTID font_id)
|
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)
|
BOOLEAN xvt_font_get_family(XVT_FNTID font_id, char* buf, long max_buf)
|
||||||
{
|
{
|
||||||
const TFontId& font = *(TFontId*)font_id;
|
CAST_FONT(font_id, font);
|
||||||
strncpy(buf, font.FaceName(), max_buf);
|
strncpy(buf, font.FaceName(), max_buf);
|
||||||
buf[max_buf-1] = '\0';
|
buf[max_buf-1] = '\0';
|
||||||
return TRUE;
|
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)
|
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();
|
WINDOW win = font.Win();
|
||||||
if (win == NULL_WIN)
|
if (win == NULL_WIN)
|
||||||
win = TASK_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)
|
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)
|
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)
|
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)
|
BOOLEAN xvt_font_is_mapped(XVT_FNTID font_id)
|
||||||
{
|
{
|
||||||
bool yes = ((TFontId*)font_id)->Win() != NULL_WIN;
|
return xvt_font_get_win(font_id) != NULL_WIN;
|
||||||
return yes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_font_map(XVT_FNTID font_id, WINDOW win)
|
void xvt_font_map(XVT_FNTID font_id, WINDOW win)
|
||||||
{
|
{
|
||||||
TFontId* pFont = (TFontId*)font_id;
|
CAST_FONT(font_id, font);
|
||||||
pFont->SetWin(win);
|
font.SetWin(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_font_map_using_default(XVT_FNTID font_id)
|
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)
|
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);
|
font.SetFaceName(family);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_font_set_size(XVT_FNTID font_id, long size)
|
void xvt_font_set_size(XVT_FNTID font_id, long size)
|
||||||
{
|
{
|
||||||
TFontId& font = *(TFontId*)font_id;
|
CAST_FONT(font_id, font);
|
||||||
font.SetPointSize(size);
|
font.SetPointSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_font_set_style(XVT_FNTID font_id, XVT_FONT_STYLE_MASK mask)
|
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);
|
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
|
// 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 char* name = font.FaceName();
|
||||||
const int size = font.PointSize();
|
const int size = font.PointSize();
|
||||||
const int italic = (font.Mask() & XVT_FS_ITALIC) != 0;
|
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)
|
void xvt_font_unmap(XVT_FNTID font_id)
|
||||||
{
|
{
|
||||||
TFontId& font = *(TFontId*)font_id;
|
CAST_FONT(font_id, font);
|
||||||
font.SetWin(NULL_WIN);
|
font.SetWin(NULL_WIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2388,65 +2399,51 @@ XVT_IMAGE xvt_image_create(XVT_IMAGE_FORMAT format, short width, short height, l
|
|||||||
|
|
||||||
void xvt_image_destroy(XVT_IMAGE img)
|
void xvt_image_destroy(XVT_IMAGE img)
|
||||||
{
|
{
|
||||||
CAST_IMAGE(img, image);
|
CAST_TIMAGE(img, image);
|
||||||
if (image != NULL)
|
if (image != NULL)
|
||||||
delete image;
|
delete image;
|
||||||
}
|
}
|
||||||
|
|
||||||
COLOR xvt_image_get_clut(XVT_IMAGE img, short index)
|
COLOR xvt_image_get_clut(XVT_IMAGE img, short index)
|
||||||
{
|
{
|
||||||
CONST_IMAGE(img, image);
|
CAST_IMAGE(img, image);
|
||||||
if (image)
|
if (image && image->Ok() && image->HasPalette())
|
||||||
{
|
{
|
||||||
const wxImage& bmp = image->Image();
|
const wxPalette& pal = image->GetPalette();
|
||||||
if (bmp.HasPalette())
|
|
||||||
{
|
|
||||||
const wxPalette& pal = bmp.GetPalette();
|
|
||||||
unsigned char r, g, b;
|
unsigned char r, g, b;
|
||||||
pal.GetRGB(index, &r, &g, &b);
|
pal.GetRGB(index, &r, &g, &b);
|
||||||
return XVT_MAKE_COLOR(r, g, b);
|
return XVT_MAKE_COLOR(r, g, b);
|
||||||
}
|
}
|
||||||
}
|
return COLOR_INVALID;
|
||||||
return COLOR_BLACK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
*width = *height = 0;
|
||||||
|
|
||||||
CONST_IMAGE(image, img);
|
CAST_IMAGE(image, img);
|
||||||
if (img != NULL)
|
if (img != NULL && img->Ok())
|
||||||
{
|
{
|
||||||
const wxImage& bmp = img->Image();
|
*width = img->GetWidth();
|
||||||
if (bmp.Ok())
|
*height = img->GetHeight();
|
||||||
{
|
|
||||||
*width = bmp.GetWidth();
|
|
||||||
*height = bmp.GetHeight();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XVT_IMAGE_FORMAT xvt_image_get_format(XVT_IMAGE image)
|
XVT_IMAGE_FORMAT xvt_image_get_format(XVT_IMAGE image)
|
||||||
{
|
{
|
||||||
CONST_IMAGE(image, i);
|
CAST_IMAGE(image, img);
|
||||||
if (i != NULL)
|
if (img != NULL && img->Ok())
|
||||||
{
|
return img->HasPalette() ? XVT_IMAGE_CL8 : XVT_IMAGE_RGB;
|
||||||
const wxImage& img = i->Image();
|
|
||||||
return img.HasPalette() ? XVT_IMAGE_CL8 : XVT_IMAGE_RGB;
|
|
||||||
}
|
|
||||||
return XVT_IMAGE_NONE;
|
return XVT_IMAGE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
short xvt_image_get_ncolors(XVT_IMAGE image)
|
short xvt_image_get_ncolors(XVT_IMAGE image)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
CONST_IMAGE(image, i);
|
CAST_IMAGE(image, i);
|
||||||
if (i != NULL)
|
if (i != NULL && i->Ok() && i->HasPalette())
|
||||||
{
|
{
|
||||||
const wxImage& bmp = i->Image();
|
const wxPalette& pal = i->GetPalette();
|
||||||
if (bmp.HasPalette())
|
|
||||||
{
|
|
||||||
const wxPalette& pal = bmp.GetPalette();
|
|
||||||
unsigned char r, g, b;
|
unsigned char r, g, b;
|
||||||
for (n = 16; n < 256; n++)
|
for (n = 16; n < 256; n++)
|
||||||
{
|
{
|
||||||
@ -2454,22 +2451,20 @@ short xvt_image_get_ncolors(XVT_IMAGE image)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
COLOR xvt_image_get_pixel(XVT_IMAGE image, short x, short y)
|
COLOR xvt_image_get_pixel(XVT_IMAGE image, short x, short y)
|
||||||
{
|
{
|
||||||
CONST_IMAGE(image, i);
|
CAST_IMAGE(image, i);
|
||||||
if (i != NULL)
|
if (i != NULL && i->Ok())
|
||||||
{
|
{
|
||||||
const wxImage& bmp = i->Image();
|
int r = i->GetRed(x, y);
|
||||||
int r = bmp.GetRed(x, y);
|
int g = i->GetGreen(x, y);
|
||||||
int g = bmp.GetGreen(x, y);
|
int b = i->GetBlue(x, y);
|
||||||
int b = bmp.GetBlue(x, y);
|
|
||||||
return XVT_MAKE_COLOR(r, g, b);
|
return XVT_MAKE_COLOR(r, g, b);
|
||||||
}
|
}
|
||||||
return -1;
|
return COLOR_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
XVT_IMAGE xvt_image_read(const char* filenamep)
|
XVT_IMAGE xvt_image_read(const char* filenamep)
|
||||||
@ -2489,8 +2484,8 @@ XVT_IMAGE xvt_image_read(const char* filenamep)
|
|||||||
if (::wxFileExists(name))
|
if (::wxFileExists(name))
|
||||||
{
|
{
|
||||||
i = new TXVT_IMAGE;
|
i = new TXVT_IMAGE;
|
||||||
i->Image().LoadFile(name);
|
i->LoadFile(name);
|
||||||
if (!i->Image().Ok())
|
if (!i->Ok())
|
||||||
{
|
{
|
||||||
delete i;
|
delete i;
|
||||||
i = NULL;
|
i = NULL;
|
||||||
@ -2506,12 +2501,10 @@ XVT_IMAGE xvt_image_read_bmp(const char *filenamep)
|
|||||||
|
|
||||||
void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color)
|
void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color)
|
||||||
{
|
{
|
||||||
CAST_IMAGE(image, i);
|
CAST_TIMAGE(image, i);
|
||||||
if (i != NULL)
|
if (i != NULL && i->Ok() && i->HasPalette())
|
||||||
{
|
|
||||||
wxImage& bmp = i->Image();
|
|
||||||
if (bmp.HasPalette())
|
|
||||||
{
|
{
|
||||||
|
wxImage& bmp = i->Image(); // Set dirty!
|
||||||
const wxPalette& pal = bmp.GetPalette();
|
const wxPalette& pal = bmp.GetPalette();
|
||||||
CAST_COLOR (color, c);
|
CAST_COLOR (color, c);
|
||||||
unsigned char ri, gi, bi;
|
unsigned char ri, gi, bi;
|
||||||
@ -2531,7 +2524,6 @@ void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void xvt_image_set_ncolors(XVT_IMAGE image, short ncolors)
|
void xvt_image_set_ncolors(XVT_IMAGE image, short ncolors)
|
||||||
{
|
{
|
||||||
@ -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)
|
void xvt_image_set_pixel(XVT_IMAGE image, short x, short y, COLOR color)
|
||||||
{
|
{
|
||||||
CAST_IMAGE(image, i);
|
CAST_TIMAGE(image, i);
|
||||||
if (i != NULL)
|
if (i != NULL && i->Ok())
|
||||||
{
|
{
|
||||||
wxImage& bmp = i->Image();
|
|
||||||
CAST_COLOR(color, c);
|
CAST_COLOR(color, c);
|
||||||
bmp.SetRGB(x, y, c.Red(), c.Green(), c.Blue());
|
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)
|
void xvt_image_transfer(XVT_IMAGE dstimage, XVT_IMAGE srcimage, RCT *dstrctp, RCT *srcrctp)
|
||||||
{
|
{
|
||||||
CAST_IMAGE(dstimage, dst);
|
CAST_TIMAGE(dstimage, dst);
|
||||||
CAST_IMAGE(srcimage, src);
|
CAST_TIMAGE(srcimage, src);
|
||||||
if (dst != NULL && src != NULL)
|
if (dst != NULL && src != NULL)
|
||||||
{
|
{
|
||||||
const wxRect rctDst = NormalizeRCT(dstrctp);
|
const wxRect rctDst = NormalizeRCT(dstrctp);
|
||||||
const wxRect rctSrc = NormalizeRCT(srcrctp);
|
const wxRect rctSrc = NormalizeRCT(srcrctp);
|
||||||
wxMemoryDC dc;
|
wxMemoryDC dc;
|
||||||
wxBitmap bmp(dst->Image());
|
wxBitmap bmp(*dst);
|
||||||
dc.SelectObject(bmp);
|
dc.SelectObject(bmp);
|
||||||
DrawImageOnDC(dc, src, rctDst, rctSrc);
|
DrawImageOnDC(dc, src, rctDst, rctSrc);
|
||||||
dst->Image() = bmp.ConvertToImage();
|
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)
|
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)
|
char* xvt_str_number_format(char* str, int size)
|
||||||
@ -3432,14 +3423,14 @@ void xvt_str_make_upper(char* str)
|
|||||||
{
|
{
|
||||||
wxString s(str);
|
wxString s(str);
|
||||||
s.MakeUpper();
|
s.MakeUpper();
|
||||||
strcpy(str, s);
|
wxStrcpy(str, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_str_make_lower(char* str)
|
void xvt_str_make_lower(char* str)
|
||||||
{
|
{
|
||||||
wxString s(str);
|
wxString s(str);
|
||||||
s.MakeLower();
|
s.MakeLower();
|
||||||
strcpy(str, s);
|
wxStrcpy(str, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
double xvt_str_fuzzy_compare (const char* s1, const char* s2)
|
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);
|
return (c <= 255) && wxIsdigit(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN xvt_chr_is_alpha(int c)
|
BOOLEAN xvt_chr_is_alpha(int c)
|
||||||
{
|
{
|
||||||
return (c <= 255) && wxIsalpha(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)
|
BOOLEAN xvt_sys_get_host_name(char* name, int maxlen)
|
||||||
{
|
{
|
||||||
wxString str = wxGetHostName();
|
wxString str = wxGetHostName();
|
||||||
strncpy(name, str, maxlen);
|
wxStrncpy(name, str, maxlen);
|
||||||
name[maxlen-1] = '\0';
|
name[maxlen-1] = '\0';
|
||||||
return *name > '\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)
|
BOOLEAN xvt_sys_get_user_name(char* name, int maxlen)
|
||||||
{
|
{
|
||||||
wxString str = wxGetUserId();
|
wxString str = wxGetUserId();
|
||||||
strncpy(name, str, maxlen);
|
wxStrncpy(name, str, maxlen);
|
||||||
name[maxlen-1] = '\0';
|
name[maxlen-1] = '\0';
|
||||||
return *name > '\0';
|
return *name > '\0';
|
||||||
}
|
}
|
||||||
@ -3537,7 +3529,7 @@ wxThread::ExitCode TIconizeTaskThread::Entry()
|
|||||||
::wxMilliSleep(500);
|
::wxMilliSleep(500);
|
||||||
if (__bChildRunning) // Il programma e' ancora attivo
|
if (__bChildRunning) // Il programma e' ancora attivo
|
||||||
{
|
{
|
||||||
wxFrame* frame = (wxFrame*)_task_win;
|
wxFrame* frame = wxStaticCast(_task_win, wxFrame);
|
||||||
frame->Iconize();
|
frame->Iconize();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -3562,7 +3554,7 @@ long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask)
|
|||||||
|
|
||||||
if (sync)
|
if (sync)
|
||||||
{
|
{
|
||||||
wxFrame* frame = (wxFrame*)_task_win;
|
wxFrame* frame = wxStaticCast(_task_win, wxFrame);
|
||||||
if (iconizetask)
|
if (iconizetask)
|
||||||
{
|
{
|
||||||
wxEnableTopLevelWindows(FALSE);
|
wxEnableTopLevelWindows(FALSE);
|
||||||
@ -3702,7 +3694,7 @@ BOOLEAN xvt_sys_find_editor(const char* file, char* editor)
|
|||||||
#endif
|
#endif
|
||||||
ok = !e.IsEmpty();
|
ok = !e.IsEmpty();
|
||||||
if (ok && editor != NULL)
|
if (ok && editor != NULL)
|
||||||
strcpy(editor, e);
|
wxStrcpy(editor, e);
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -3727,7 +3719,6 @@ unsigned int xvt_sys_load_icon(const char* file)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
icon = new wxIcon;
|
icon = new wxIcon;
|
||||||
// icon = new wxIcon(wxICON(file)); //verificare
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3735,7 +3726,7 @@ unsigned int xvt_sys_load_icon(const char* file)
|
|||||||
{
|
{
|
||||||
for (id = 60001; ; id++)
|
for (id = 60001; ; id++)
|
||||||
{
|
{
|
||||||
wxIcon* ico = (wxIcon*)_nice_icons.Get(id);
|
wxIcon* ico = wxDynamicCast(_nice_icons.Get(id), wxIcon);
|
||||||
if (ico == NULL)
|
if (ico == NULL)
|
||||||
{
|
{
|
||||||
_nice_icons.Put(id, icon);
|
_nice_icons.Put(id, icon);
|
||||||
@ -3931,20 +3922,16 @@ void xvt_timer_destroy(long id)
|
|||||||
|
|
||||||
void xvt_vobj_destroy(WINDOW win)
|
void xvt_vobj_destroy(WINDOW win)
|
||||||
{
|
{
|
||||||
if (win != NULL_WIN)
|
wxWindow* w = wxDynamicCast(_nice_windows.Get(win), wxWindow);
|
||||||
{
|
|
||||||
if (win != PRINTER_WIN && win != TASK_WIN)
|
|
||||||
{
|
|
||||||
xvt_win_set_caret_visible(win, FALSE);
|
|
||||||
|
|
||||||
wxWindow* w = (wxWindow*)_nice_windows.Get(win);
|
|
||||||
if (w != NULL)
|
if (w != NULL)
|
||||||
{
|
{
|
||||||
wxASSERT((wxWindow*)win == w);
|
wxASSERT(win == (WINDOW)w);
|
||||||
w->Destroy(); // formerly delete w;
|
|
||||||
_nice_windows.Delete(win); // Elimina dalla lista delle finestre attive
|
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
|
||||||
|
|
||||||
GetTDCMapper().DestroyTDC(win); // Elimina dalla lista dei display context
|
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)
|
long xvt_vobj_get_data(WINDOW win)
|
||||||
{
|
{
|
||||||
CAST_TWIN(win, w);
|
const TwxWindow* w = wxDynamicCast(_nice_windows.Get(win), TwxWindow);
|
||||||
return w._app_data;
|
return w != NULL ? w->_app_data : 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT* xvt_vobj_get_outer_rect(WINDOW win, RCT *rctp)
|
RCT* xvt_vobj_get_outer_rect(WINDOW win, RCT *rctp)
|
||||||
@ -4383,11 +4370,14 @@ BOOLEAN xvt_win_enum_wins(WINDOW parent_win, XVT_ENUM_CHILDREN func, long data,
|
|||||||
{
|
{
|
||||||
for (wxWindowList::iterator i = list.begin(); i != list.end(); ++i)
|
for (wxWindowList::iterator i = list.begin(); i != list.end(); ++i)
|
||||||
{
|
{
|
||||||
WINDOW win = (WINDOW)&(wxWindow&)*i;
|
wxWindow* tw = wxDynamicCast(*i, wxWindow);
|
||||||
if (!func(win, data))
|
if (tw != NULL)
|
||||||
|
{
|
||||||
|
if (!func((WINDOW)tw, data))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ok;
|
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)
|
void xvt_win_post_event(WINDOW win, EVENT* event_p)
|
||||||
{
|
{
|
||||||
// Per ora funziona solo con la task window
|
// Per ora e' garantito che funzioni solo con la task window
|
||||||
XVT_ASSERT(win == (WINDOW)_task_win && event_p != NULL);
|
CAST_WIN(win, w);
|
||||||
|
|
||||||
switch (event_p->type)
|
switch (event_p->type)
|
||||||
{
|
{
|
||||||
case E_COMMAND:
|
case E_COMMAND:
|
||||||
{
|
{
|
||||||
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, event_p->v.cmd.tag);
|
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, event_p->v.cmd.tag);
|
||||||
e.SetEventObject(_task_win);
|
e.SetEventObject(&w);
|
||||||
wxPostEvent(_task_win, e);
|
wxPostEvent(&w, e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -4431,7 +4420,7 @@ void xvt_win_release_pointer(void)
|
|||||||
if (_mouse_trapper != NULL)
|
if (_mouse_trapper != NULL)
|
||||||
{
|
{
|
||||||
// cap SHOULD be equal to _mouse_trapper :-)
|
// cap SHOULD be equal to _mouse_trapper :-)
|
||||||
wxWindow* cap = _mouse_trapper->GetCapture();
|
wxWindow* cap = wxWindow::GetCapture();
|
||||||
if (cap != NULL)
|
if (cap != NULL)
|
||||||
cap->ReleaseMouse();
|
cap->ReleaseMouse();
|
||||||
_mouse_trapper = NULL;
|
_mouse_trapper = NULL;
|
||||||
@ -4482,11 +4471,11 @@ static wxStatusBar* WIN2StatBar(WINDOW win)
|
|||||||
wxStatusBar* pStatusBar = NULL;
|
wxStatusBar* pStatusBar = NULL;
|
||||||
if (win == NULL_WIN || win == TASK_WIN)
|
if (win == NULL_WIN || win == TASK_WIN)
|
||||||
{
|
{
|
||||||
wxFrame* w = (wxFrame*)_task_win;
|
wxFrame* w = wxStaticCast(_task_win, wxFrame);
|
||||||
pStatusBar = w->GetStatusBar();
|
pStatusBar = w->GetStatusBar();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pStatusBar = (wxStatusBar*)win;
|
pStatusBar = wxDynamicCast((wxObject*)win, wxStatusBar);
|
||||||
return pStatusBar;
|
return pStatusBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4510,34 +4499,33 @@ const char* statbar_set_default_title(WINDOW win, const char *text)
|
|||||||
return statbar_set_title(win, 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);
|
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));
|
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);
|
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());
|
font.Copy(pStatBar->GetFont());
|
||||||
}
|
}
|
||||||
return fontid;
|
return font_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
WINDOW statbar_create(int cid, int left, int top, int right, int bottom,
|
WINDOW statbar_create(int cid, int left, int top, int right, int bottom,
|
||||||
int prop_count, char **prop_list, WINDOW parent_win,
|
int prop_count, char **prop_list, WINDOW parent_win,
|
||||||
int parent_rid, long parent_flags, char *parent_class)
|
int parent_rid, long parent_flags, char *parent_class)
|
||||||
{
|
{
|
||||||
XVT_ASSERT(parent_win == TASK_WIN);
|
wxFrame& w = *wxStaticCast((wxObject*)parent_win, wxFrame);
|
||||||
wxFrame& w = *(wxFrame*)_task_win;
|
|
||||||
|
|
||||||
const int nStyle = 0; // not wxST_SIZEGRIP
|
const int nStyle = 0; // not wxST_SIZEGRIP
|
||||||
wxStatusBar* pStatusBar = w.CreateStatusBar(2, nStyle);
|
wxStatusBar* pStatusBar = w.CreateStatusBar(2, nStyle);
|
||||||
@ -4555,7 +4543,7 @@ BOOLEAN statbar_destroy(WINDOW win)
|
|||||||
wxStatusBar* pStatusBar = WIN2StatBar(win);
|
wxStatusBar* pStatusBar = WIN2StatBar(win);
|
||||||
if (pStatusBar != NULL)
|
if (pStatusBar != NULL)
|
||||||
{
|
{
|
||||||
wxFrame& w = *(wxFrame*)_task_win;
|
wxFrame& w = *wxStaticCast(_task_win, wxFrame);
|
||||||
if (w.GetStatusBar() == pStatusBar)
|
if (w.GetStatusBar() == pStatusBar)
|
||||||
w.SetStatusBar(NULL);
|
w.SetStatusBar(NULL);
|
||||||
pStatusBar->Destroy();
|
pStatusBar->Destroy();
|
||||||
|
@ -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_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_convert_str_to_fspec(const char *mbs, FILE_SPEC *fs);
|
||||||
|
|
||||||
|
|
||||||
XVTDLL BOOLEAN xvt_fsys_get_dir(DIRECTORY *dirp);
|
XVTDLL BOOLEAN xvt_fsys_get_dir(DIRECTORY *dirp);
|
||||||
XVTDLL void xvt_fsys_get_default_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);
|
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_alpha(int c);
|
||||||
XVTDLL BOOLEAN xvt_chr_is_alnum(int c);
|
XVTDLL BOOLEAN xvt_chr_is_alnum(int c);
|
||||||
|
|
||||||
|
|
||||||
// System calls by XVAGA
|
// System calls by XVAGA
|
||||||
XVTDLL void xvt_sys_beep(int severity);
|
XVTDLL void xvt_sys_beep(int severity);
|
||||||
XVTDLL long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask);
|
XVTDLL long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask);
|
||||||
|
@ -499,18 +499,13 @@ long TwxNoteBook::Flags2Style(long flags) const
|
|||||||
TwxNoteBook::TwxNoteBook(wxWindow *parent, wxWindowID id,
|
TwxNoteBook::TwxNoteBook(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size, long flags)
|
const wxPoint& pos, const wxSize& size, long flags)
|
||||||
: wxAuiNotebook(parent, id, pos, size, Flags2Style(flags)), m_bSuspended(false)
|
: 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()
|
TwxNoteBook::~TwxNoteBook()
|
||||||
{
|
{
|
||||||
// Il wxAuiNotebook non gradisce le pagine doppie, per cui ... le ammazzo io.
|
|
||||||
m_bSuspended = true;
|
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);
|
_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);
|
CAST_NOTEBOOK(notebk, nb);
|
||||||
wxString strTitle = title;
|
wxString strTitle = title;
|
||||||
if (strTitle.IsEmpty() && page != NULL_WIN)
|
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);
|
idx = nb.AddTab((wxWindow*)page, strTitle, image, tab_no);
|
||||||
}
|
}
|
||||||
return idx;
|
return idx;
|
||||||
|
@ -614,7 +614,6 @@ WINDOW xvt_print_create_win(PRINT_RCD* precp, const char* title)
|
|||||||
po.InitDC(rcd, title);
|
po.InitDC(rcd, title);
|
||||||
}
|
}
|
||||||
return PRINTER_WIN;
|
return PRINTER_WIN;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_print_destroy(PRINT_RCD* precp)
|
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 xvt_print_is_valid(const PRINT_RCD* precp)
|
||||||
|
|
||||||
{
|
{
|
||||||
BOOLEAN ok = precp != NULL && precp->pr == NULL;
|
BOOLEAN ok = precp != NULL && precp->pr == NULL;
|
||||||
if (ok)
|
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))
|
if (!xvt_print_is_valid(precp))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
wxString n = ((const char*)precp) + 4;
|
wxString n = ((const char*)precp) + 4;
|
||||||
if (n.Length() >= 30)
|
if (n.Length() >= 30)
|
||||||
@ -1129,7 +1126,7 @@ BOOLEAN xvt_str_md5(const char* instr, char* outstr)
|
|||||||
BOOLEAN ok = instr && *instr && outstr;
|
BOOLEAN ok = instr && *instr && outstr;
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
strcpy(outstr, wxMD5Checksum::GetMD5((unsigned char*)instr, strlen(instr)));
|
wxStrcpy(outstr, wxMD5Checksum::GetMD5((unsigned char*)instr, strlen(instr)));
|
||||||
ok = *outstr != '\0';
|
ok = *outstr != '\0';
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
@ -1141,7 +1138,7 @@ BOOLEAN xvt_fsys_file_md5(const char* path, char* outstr)
|
|||||||
BOOLEAN ok = path && *path && outstr;
|
BOOLEAN ok = path && *path && outstr;
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
strcpy(outstr, wxMD5Checksum::GetMD5(wxString(path)));
|
wxStrcpy(outstr, wxMD5Checksum::GetMD5(wxString(path)));
|
||||||
ok = *outstr != '\0';
|
ok = *outstr != '\0';
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -725,13 +725,16 @@ void TwxWindow::OnMouseWheel(wxMouseEvent& evt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TwxWindow::OnPaint(wxPaintEvent& WXUNUSED(evt))
|
void TwxWindow::OnPaint(wxPaintEvent& WXUNUSED(evt))
|
||||||
|
{
|
||||||
|
const wxRect rctDamaged = GetUpdateRegion().GetBox();
|
||||||
|
if (!rctDamaged.IsEmpty())
|
||||||
{
|
{
|
||||||
EVENT e; memset(&e, 0, sizeof(EVENT));
|
EVENT e; memset(&e, 0, sizeof(EVENT));
|
||||||
e.type = E_UPDATE;
|
e.type = E_UPDATE;
|
||||||
|
|
||||||
RCT& rct = e.v.update.rct;
|
RCT& rct = e.v.update.rct;
|
||||||
|
|
||||||
wxRect rctDamaged = GetUpdateRegion().GetBox();
|
//wxRect rctDamaged = GetUpdateRegion().GetBox();
|
||||||
rct.left = rctDamaged.x;
|
rct.left = rctDamaged.x;
|
||||||
rct.top = rctDamaged.y;
|
rct.top = rctDamaged.y;
|
||||||
rct.right = rctDamaged.GetRight()+1;
|
rct.right = rctDamaged.GetRight()+1;
|
||||||
@ -743,6 +746,9 @@ void TwxWindow::OnPaint(wxPaintEvent& WXUNUSED(evt))
|
|||||||
tdc.KillDC(); // Distrugge il wxPaintDC
|
tdc.KillDC(); // Distrugge il wxPaintDC
|
||||||
GetTDCMapper().DestroyDC(NULL_WIN); // Distrugge davvero tutti i wxClientDC residui (risolve molte "porcate" del video)
|
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)
|
static SCROLL_CONTROL ConvertScrollToXVT(wxEventType et)
|
||||||
{
|
{
|
||||||
@ -770,7 +776,7 @@ void TwxWindow::OnScroll(wxScrollEvent& evt)
|
|||||||
SCROLL_CONTROL sc = ConvertScrollToXVT(evt.GetEventType());
|
SCROLL_CONTROL sc = ConvertScrollToXVT(evt.GetEventType());
|
||||||
if (sc != SC_NONE)
|
if (sc != SC_NONE)
|
||||||
{
|
{
|
||||||
wxWindow* ctl = (wxWindow*)evt.GetEventObject();
|
wxScrollBar* ctl = wxStaticCast(evt.GetEventObject(), wxScrollBar);
|
||||||
const wxSize sz = ctl->GetSize();
|
const wxSize sz = ctl->GetSize();
|
||||||
|
|
||||||
EVENT e; memset(&e, 0, sizeof(EVENT));
|
EVENT e; memset(&e, 0, sizeof(EVENT));
|
||||||
@ -859,7 +865,8 @@ void TwxWindow::SetMenuTree(const MENU_ITEM* tree)
|
|||||||
if (m_menu)
|
if (m_menu)
|
||||||
xvt_res_free_menu_tree(m_menu);
|
xvt_res_free_menu_tree(m_menu);
|
||||||
m_menu = xvt_menu_duplicate_tree(tree);
|
m_menu = xvt_menu_duplicate_tree(tree);
|
||||||
((TTaskWin*)_task_win)->PushMenuTree(tree, this);
|
TTaskWin* tw = wxStaticCast(_task_win, TTaskWin);
|
||||||
|
tw->PushMenuTree(tree, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -924,18 +931,23 @@ TwxWindow::TwxWindow()
|
|||||||
TwxWindow::TwxWindow(wxWindow *parent, wxWindowID id, const wxString& title,
|
TwxWindow::TwxWindow(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||||
const wxPoint& pos, const wxSize& size, long style)
|
const wxPoint& pos, const wxSize& size, long style)
|
||||||
: TwxWindowBase(parent, id, title, pos, size, 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);
|
_nice_windows.Put((WINDOW)this, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
TwxWindow::~TwxWindow()
|
TwxWindow::~TwxWindow()
|
||||||
{
|
{
|
||||||
|
// Rendo praticamente impossibile risalire a questo oggetto d'ora in poi
|
||||||
|
_eh = NULL;
|
||||||
|
_app_data = 0L;
|
||||||
|
_nice_windows.Delete((WINDOW)this);
|
||||||
|
|
||||||
if (HasCapture())
|
if (HasCapture())
|
||||||
|
{
|
||||||
ReleaseMouse();
|
ReleaseMouse();
|
||||||
EVENT e; memset(&e, 0, sizeof(EVENT));
|
xvt_win_release_pointer(); // Paranoid?
|
||||||
e.type = E_DESTROY;
|
}
|
||||||
DoXvtEvent(e);
|
|
||||||
|
|
||||||
if (_timer != NULL)
|
if (_timer != NULL)
|
||||||
delete _timer;
|
delete _timer;
|
||||||
@ -949,10 +961,9 @@ TwxWindow::~TwxWindow()
|
|||||||
if (m_menu)
|
if (m_menu)
|
||||||
{
|
{
|
||||||
xvt_res_free_menu_tree(m_menu);
|
xvt_res_free_menu_tree(m_menu);
|
||||||
|
m_menu = NULL;
|
||||||
((TTaskWin*)_task_win)->PopMenuTree();
|
((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)
|
if (m_MenuOwner == NULL || m_MenuOwner == this)
|
||||||
_task_win_handler((WINDOW)this, &e);
|
_task_win_handler((WINDOW)this, &e);
|
||||||
else
|
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))
|
void TTaskWin::OnPaint(wxPaintEvent& WXUNUSED(evt))
|
||||||
@ -1170,11 +1185,7 @@ TwxTaskBarIcon::TwxTaskBarIcon(wxWindow* owned, short icon, wxString strTip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strTip.IsEmpty())
|
if (strTip.IsEmpty())
|
||||||
{
|
strTip = _owned->GetLabel();
|
||||||
const wxWindow* pWin = wxDynamicCast(_owned, wxWindow);
|
|
||||||
if (pWin != NULL)
|
|
||||||
strTip = pWin->GetLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
SetIcon(*pIcon, strTip);
|
SetIcon(*pIcon, strTip);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#ifndef __XVTWIN_H
|
#ifndef __XVTWIN_H
|
||||||
#define __XVTWIN_H
|
#define __XVTWIN_H
|
||||||
|
|
||||||
class TFontId
|
class TFontId : public wxObject
|
||||||
{
|
{
|
||||||
wxString m_strFace;
|
wxString m_strFace;
|
||||||
int m_nSize;
|
int m_nSize;
|
||||||
XVT_FONT_STYLE_MASK m_wMask;
|
XVT_FONT_STYLE_MASK m_wMask;
|
||||||
WINDOW m_win;
|
WINDOW m_win;
|
||||||
|
DECLARE_DYNAMIC_CLASS(TFontId);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Copy(const TFontId& pFont);
|
void Copy(const TFontId& pFont);
|
||||||
@ -124,7 +125,7 @@ public:
|
|||||||
TwxWindowBase() { }
|
TwxWindowBase() { }
|
||||||
TwxWindowBase(wxWindow *parent, wxWindowID id, const wxString &title,
|
TwxWindowBase(wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
const wxPoint & pos, const wxSize & size, long style);
|
const wxPoint & pos, const wxSize & size, long style);
|
||||||
|
virtual ~TwxWindowBase() { }
|
||||||
DECLARE_DYNAMIC_CLASS(TwxWindowBase)
|
DECLARE_DYNAMIC_CLASS(TwxWindowBase)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user