Patch level :10.0 patch 24

Files correlati     : tutte le dll
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@16464 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-04-04 16:04:47 +00:00
parent 0216f2cbf9
commit 5efc19c8a1
10 changed files with 392 additions and 1119 deletions

View File

@ -52,6 +52,8 @@ bool aga_unzip(const char* zipfile, const char* destdir)
const unsigned int files = aga_getziplist(zipfile, aFiles);
wxProgressDialog pi("Unzip", "", files, NULL, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT);
pi.SetSize(480, 120);
pi.Center();
for (unsigned int f = 0; f < files; f++)
{
@ -121,6 +123,8 @@ static bool AddFilesToZip(const wxString& strBase, wxArrayString& aFiles, const
const size_t nFiles = aFiles.GetCount();
wxProgressDialog pi("Zip", "", nFiles, NULL, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT);
pi.SetSize(480, 120);
pi.Center();
for (size_t i = 0; i < nFiles; i++)
{

View File

@ -603,21 +603,36 @@ static BOOL CALLBACK EnumCampoWindowsProc(HWND hwnd, LPARAM lParam)
unsigned int OsWin32_FindMenuContainer()
{
TFindWindowInfo w;
w._file = "__CAMPO_MENU__";
w._file = "__CAMPO_HOST_WINDOW__";
::EnumWindows(EnumCampoWindowsProc, LPARAM(&w));
return (unsigned int)w._hwnd;
}
static BOOL CALLBACK CountChildrenProc(HWND hwnd, LPARAM lParam)
{
LONG* n = (LONG*)lParam;
(*n)++;
return TRUE;
}
long OsWin32_GetChildrenCount(unsigned int parent)
{
LONG n = 0;
::EnumChildWindows((HWND)parent, CountChildrenProc, (LPARAM)&n);
return n;
}
static BOOL CALLBACK CloseChildrenProc(HWND hwnd, LPARAM lParam)
{
::PostMessage(hwnd, WM_CLOSE, 0, 0);
return TRUE;
return CountChildrenProc(hwnd, lParam);
}
long OsWin32_CloseChildren(unsigned int parent)
{
::EnumChildWindows((HWND)parent, CloseChildrenProc, parent);
return 1;
LONG n = 0;
::EnumChildWindows((HWND)parent, CloseChildrenProc, (LPARAM)&n);
return n;
}
///////////////////////////////////////////////////////////
@ -998,3 +1013,9 @@ bool OsWin32_IsWindowsServer()
return ::GetSystemMetrics(SM_REMOTESESSION) != 0;
}
void OsWin32_NumberFormat(char* str, int size)
{
char buf[80];
::GetNumberFormat(LOCALE_USER_DEFAULT, 0, str, NULL, buf, sizeof(buf));
wxStrncpy(str, buf, size);
}

View File

@ -17,7 +17,9 @@ void* OsWin32_GetPrinterInfo(int& size, const char* printer);
void OsWin32_PlaceProcessInWindow(unsigned int instance, const char* name, unsigned int parent);
unsigned int OsWin32_FindMenuContainer();
long OsWin32_GetChildrenCount(unsigned int parent);
long OsWin32_CloseChildren(unsigned int parent);
void OsWin32_NumberFormat(char* str, int size);
void OsWin32_UpdateWindow(unsigned int handle);

View File

@ -1,6 +1,6 @@
/* STATBAR.H for dynamic custom control for XVT/Design 2.01
$Revision: 1.3 $ $Author: guy $ $Date: 2008-01-31 14:15:52 $
$Revision: 1.4 $ $Author: guy $ $Date: 2008-04-04 16:04:47 $
This code was written by Christopher Williamson,
May be distributed in object form only when embedded in a
@ -40,6 +40,18 @@ XVTDLL WINDOW statbar_create
XVTDLL BOOLEAN statbar_destroy(WINDOW win);
/* toolbar supports different types of controls */
enum TOOL_TYPE { TOOL_SEPARATOR = -1, TOOL_BUTTON, TOOL_TOGLBUTN, TOOL_RADIOBUTN };
/* the following CIS functions are external and may be called by the app */
XVTDLL BOOLEAN xvt_toolbar_add_control(WINDOW win, int cid, TOOL_TYPE type, const char *title,
int ico, int cust_width, int idx);
XVTDLL WINDOW xvt_toolbar_create(int cid, int left, int top, int right, int bottom,
long style, WINDOW parent_win);
XVTDLL void xvt_toolbar_enable_control(WINDOW win, int cid, BOOLEAN on);
XVTDLL void xvt_toolbar_realize(WINDOW win);
XVTDLL void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on);
#if defined(_cplusplus) || defined(__cplusplus)
} /* extern "C" */
#endif

View File

@ -1,18 +1,19 @@
#include "wxinc.h"
#include "wx/clipbrd.h"
#include "wx/calctrl.h"
#include "wx/colordlg.h"
#include "wx/confbase.h"
#include "wx/dialup.h"
#include "wx/fileconf.h"
#include "wx/fontdlg.h"
#include "wx/fs_zip.h"
#include "wx/image.h"
#include "wx/filefn.h"
#include <wx/clipbrd.h>
#include <wx/calctrl.h>
#include <wx/colordlg.h>
#include <wx/confbase.h>
#include <wx/dialup.h>
#include <wx/fileconf.h>
#include <wx/filename.h>
#include <wx/fontdlg.h>
#include <wx/image.h>
#include <wx/filefn.h>
#include <wx/snglinst.h>
#include <wx/tokenzr.h>
#include <wx/statline.h>
#include <wx/thread.h>
#include <wx/tokenzr.h>
#include "xvt.h"
#include "statbar.h"
@ -35,17 +36,17 @@
#include <wx/hash.h>
#endif
#define XVT_ASSERT(test) _AssertBox((test), __LINE__, __FILE__ )
#define XVT_ASSERT(test) _AssertBox((test), __FUNCTION__, __FILE__ , __LINE__)
#define CAST_WIN(win,w) wxWindow& w = *(wxWindow*)win; wxASSERT(win != NULL_WIN && w.IsKindOf(CLASSINFO(wxWindow)));
#define CAST_TWIN(win,w) XVT_ASSERT(win != NULL_WIN); TwxWindow& w = *(TwxWindow*)win; XVT_ASSERT(_task_win != &w);
#define CAST_TDC(win,dc) XVT_ASSERT(win != NULL_WIN); TDC& dc = GetTDCMapper().GetTDC(win);
#define CAST_DC(win,dc) XVT_ASSERT(win != NULL_WIN); wxDC& dc = GetTDCMapper().GetDC(win);
wxWindow* _mouse_trapper = NULL;
RCT _startup_rect = { 0,0,0,0 };
wxString _startup_dir;
wxString _strDefaultStatbarText;
wxString _appl_name;
wxWindow* _mouse_trapper = NULL;
RCT _startup_rect = { 0,0,0,0 };
wxString _startup_dir;
wxString _strDefaultStatbarText;
wxString _appl_name;
static wxHashTable _nice_icons;
static XVT_ERRMSG_HANDLER _error_handler = NULL;
@ -53,7 +54,113 @@ static XVT_ERRMSG_HANDLER _error_handler = NULL;
const wxString& _GetAppTitle()
{ return _appl_name; }
void _AssertBox(bool test, int line, const char * file)
class TMessageBox : public wxDialog
{
protected:
void OnButton(wxCommandEvent& evt);
void AddButton(wxSizer* sz, int id, int ico);
DECLARE_EVENT_TABLE()
public:
TMessageBox(const wxString& msg, int nStyle);
};
BEGIN_EVENT_TABLE(TMessageBox, wxDialog)
EVT_BUTTON(wxID_ANY, TMessageBox::OnButton)
END_EVENT_TABLE()
void TMessageBox::OnButton(wxCommandEvent& evt)
{
int ec = wxCANCEL;
switch (evt.GetId())
{
case wxID_YES: ec = wxYES; break;
case wxID_OK : ec = wxOK; break;
case wxID_NO : ec = wxNO; break;
default : ec = wxCANCEL; break;
}
EndModal(ec);
}
void TMessageBox::AddButton(wxSizer* sz, int id, int WXUNUSED(ico))
{
sz->Add(new wxButton(this, id, wxEmptyString, wxDefaultPosition,
wxSize(80, 32)), 0, wxALL, 4);
}
TMessageBox::TMessageBox(const wxString& msg, int nStyle)
: wxDialog(NULL, wxID_ANY, _GetAppTitle(), wxDefaultPosition, wxDefaultSize,
wxCAPTION | wxRAISED_BORDER)
{
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(sizer);
wxBoxSizer* sz1 = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(sz1);
int nIco = 162;
if (nStyle & wxICON_ERROR) nIco = 201;
if (nStyle & wxICON_QUESTION) nIco = 202;
if (nStyle & wxICON_EXCLAMATION) nIco = 203;
const int nBorder = 8;
sz1->Add(new wxStaticBitmap(this, nIco, _GetToolResource(nIco, 64)), 0, wxALL, nBorder);
wxStaticText* ss = new wxStaticText(this, wxID_ANY, wxEmptyString);
ss->Wrap(160);
ss->SetLabel(msg);
sz1->Add(ss, 0, wxALL | wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, nBorder);
sizer->Add(new wxStaticLine(this), 0, wxALL | wxEXPAND, nBorder);
wxBoxSizer* sz2 = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(sz2, 0, wxALIGN_CENTER);
if (nStyle & wxYES_NO)
{
SetAffirmativeId(wxID_YES);
if (nStyle & wxNO_DEFAULT)
{
AddButton(sz2, wxID_NO, 102);
AddButton(sz2, wxID_YES, 101);
}
else
{
AddButton(sz2, wxID_YES, 101);
AddButton(sz2, wxID_NO, 102);
}
}
if (nStyle & wxOK)
{
SetAffirmativeId(wxID_OK);
AddButton(sz2, wxID_OK, 101);
}
if (nStyle & wxCANCEL)
{
SetEscapeId(wxID_CANCEL);
AddButton(sz2, wxID_CANCEL, 102);
}
sizer->SetSizeHints(this);
if (nStyle & wxCENTRE)
Centre();
}
int _MessageBox(const wxString& msg, int nStyle)
{
xvt_dm_post_speech(msg, 1, TRUE);
// int ret = ::wxMessageBox(msg, _GetAppTitle(), nStyle);
TMessageBox dlg(msg, nStyle);
const int ret = dlg.ShowModal();
switch(ret)
{
case wxOK : xvt_dm_post_speech("ok", 7, TRUE); break;
case wxYES: xvt_dm_post_speech("si", 7, TRUE); break;
case wxNO : xvt_dm_post_speech("no", 7, TRUE); break;
default : xvt_dm_post_speech("annulla", 7, TRUE); break;
}
return ret;
}
void _AssertBox(bool test, const char* func, const char* file, int line)
{
if (!test)
{
@ -61,31 +168,35 @@ void _AssertBox(bool test, int line, const char * file)
if (display)
{
wxString strMessage;
strMessage.Printf("Sorry, the application passed some invalid parameters on line %d file %s.", line, file);
::wxMessageBox(strMessage, _GetAppTitle(), wxOK|wxICON_ERROR);
strMessage.Printf("Sorry, the application passed some invalid parameters to\nfunction %s in file %s at line %d .",
func, file, line);
_MessageBox(strMessage, wxOK|wxICON_ERROR);
}
}
}
void xvt_sys_sorry_box(const char* file, int line)
void xvt_sys_sorry_box(const char* func, const char* file, int line)
{
static wxHashTable sorry;
if (sorry.Get(line) == NULL)
static wxHashTable sorry(wxKEY_STRING);
if (sorry.Get(func) == NULL)
{
sorry.Put(line, &sorry); // Dummy
const wxString strMessage = wxString::Format("Function in file %s at line %d not implemented", file, line);
::wxMessageBox(strMessage, _GetAppTitle(), wxOK|wxICON_WARNING);
sorry.Put(func, &sorry); // Dummy
wxString strMessage;
strMessage.Printf("Function %s in file %s at line %d\nis not implemented yet: be patient...",
func, file, line);
_MessageBox(strMessage, wxOK | wxICON_WARNING);
}
}
void xvt_sys_deprecated_box(const char* file, int line)
{
static wxHashTable deprecated;
if (deprecated.Get(line) == NULL)
wxString strKey; strKey << file << ':' << line;
if (deprecated.Get(strKey) == NULL)
{
deprecated.Put(line, &deprecated); // Dummy
deprecated.Put(strKey, &deprecated); // Dummy
const wxString strMessage = wxString::Format("Function in file %s at line %d is deprecated:\nYou can blame Guy for this, if you're bold enough!", file, line);
::wxMessageBox(strMessage, _GetAppTitle(), wxOK|wxICON_WARNING);
_MessageBox(strMessage, wxOK | wxICON_WARNING);
}
}
@ -110,7 +221,7 @@ wxString GetResourceIni()
return strName;
}
wxString GetResourceName(const char* type, int rid)
wxString _GetResourceName(const char* type, int rid)
{
wxString strName; strName.Printf("%ss", type);
wxString strKey; strKey.Printf("%d", rid);
@ -144,22 +255,25 @@ wxString GetResourceName(const char* type, int rid)
return strName;
}
const wxIcon* _GetIconResource(int rid)
const wxIcon& _GetIconResource(int rid)
{
wxIcon* icon = (wxIcon*)_nice_icons.Get(rid);
if (icon == NULL)
{
wxString strName = ::GetResourceName("Icon", rid);
wxString strName = _GetResourceName("Icon", rid);
if (::wxFileExists(strName))
{
icon = new wxIcon(strName, wxBITMAP_TYPE_ICO);
_nice_icons.Put(rid, icon);
}
else
{
icon = (wxIcon*)_nice_icons.Get(ICON_RSRC);
if (icon == NULL)
icon = new wxIcon; // Icona nulla di salvezza
}
}
XVT_ASSERT(icon != NULL);
return icon;
return *icon;
}
const wxCursor* GetCursorResource(int rid)
@ -174,7 +288,7 @@ const wxCursor* GetCursorResource(int rid)
case CURSOR_IBEAM: cursor = new wxCursor(wxCURSOR_IBEAM); break;
default:
{
const wxString strName = ::GetResourceName("Cursor", rid);
const wxString strName = _GetResourceName("Cursor", rid);
if (::wxFileExists(strName))
{
if (strName.Find(".ico") > 0)
@ -304,15 +418,29 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
wxPoint pos = wxDefaultPosition;
wxSize size = wxDefaultSize;
long style = wxDEFAULT_FRAME_STYLE;
bool can_change_firm = true;
#ifdef WIN32
HWND hwndParent = (HWND)OsWin32_FindMenuContainer();
if (hwndParent != NULL)
{
style &= ~wxRESIZE_BORDER;
RECT rct; ::GetClientRect(hwndParent, &rct);
can_change_firm = false;
RECT rct; ::GetWindowRect(hwndParent, &rct);
if (rct.right - rct.left >= 720)
xvt_rect_set(&_startup_rect, rct.left, rct.top, rct.right, rct.bottom);
{
style = wxSYSTEM_MENU;
DWORD dwFlags = ::GetWindowLong(hwndParent, GWL_STYLE);
if (dwFlags & WS_CAPTION)
{
xvt_rect_set(&_startup_rect, rct.left, rct.top, rct.right, rct.bottom);
hwndParent = NULL;
}
else
{
xvt_rect_set(&_startup_rect, 0, 0, rct.right-rct.left, rct.bottom-rct.top);
}
}
}
#endif
@ -327,13 +455,11 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
{
#ifdef WIN32
style |= wxMAXIMIZE;
const wxRect rect = wxGetClientDisplayRect();
#else
style &= ~wxMAXIMIZE;
const wxRect rect = wxGetClientDisplayRect();
pos = rect.GetPosition();
size = rect.GetSize();;
size = rect.GetSize();
#endif
}
@ -345,7 +471,6 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
if (hwndParent != NULL)
{
HWND hwndChild = (HWND)_task_win->GetHandle();
//::SetWindowPos(hwndChild, HWND_TOPMOST, pos.x, pos.y, size.x, size.y, SWP_NOMOVE|SWP_NOSIZE);
::SetParent(hwndChild, hwndParent);
}
#endif
@ -355,7 +480,7 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
Title[0] = "&File";
Menus[0] = new wxMenu;
if (hwndParent == NULL)
if (can_change_firm)
{
Menus[0]->Append(M_FILE_NEW, "Scelta &Ditta...");
Menus[0]->AppendSeparator();
@ -376,7 +501,7 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
Menus[2]->Append(M_HELP_SEARCH, "&Cerca argomento");
Menus[2]->Append(M_HELP_HELPONHELP, "&Uso della guida");
Menus[2]->AppendSeparator();
Menus[2]->Append(M_FILE_ABOUT+1, "&Informazioni");
Menus[2]->Append(M_FILE_ABOUT, "&Informazioni");
#ifdef WIN32
wxMenuBar* pMenubar = new wxMenuBar(3, Menus, Title);
@ -781,23 +906,13 @@ ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char* Btn2, const char* Btn
else
nFlags |= wxCANCEL;
xvt_dm_post_speech(fmt, 3, TRUE);
const int answer = ::wxMessageBox(fmt, _GetAppTitle(), nFlags);
switch(answer)
{
case wxYES: xvt_dm_post_speech("si", 7, TRUE); break;
case wxNO : xvt_dm_post_speech("no", 7, TRUE); break;
default : xvt_dm_post_speech("annulla", 7, TRUE); break;
}
const int answer = _MessageBox(fmt, nFlags);
return answer == wxYES ? RESP_DEFAULT : (answer == wxNO ? RESP_2 : RESP_3);
}
void xvt_dm_post_error(const char *fmt)
{
xvt_dm_post_speech(fmt, 1, TRUE);
wxMessageBox(fmt, _GetAppTitle(), wxOK | wxCENTRE | wxICON_ERROR);
xvt_dm_post_speech("OK", 7, TRUE);
_MessageBox(fmt, wxOK | wxCENTRE | wxICON_ERROR);
}
void xvt_dm_post_fatal_exit(const char *fmt)
@ -882,31 +997,28 @@ BOOLEAN xvt_dm_post_font_sel(WINDOW win, XVT_FNTID font_id, PRINT_RCD *precp, un
void xvt_dm_post_message(const char *fmt)
{
xvt_dm_post_speech(fmt, 2, TRUE);
::wxMessageBox(fmt, _GetAppTitle(), wxOK | wxCENTRE | wxICON_INFORMATION);
xvt_dm_post_speech("OK", 7, TRUE);
_MessageBox(fmt, wxOK | wxCENTRE | wxICON_INFORMATION);
}
void xvt_dm_post_note(const char *fmt)
{
xvt_dm_post_speech(fmt, 2, TRUE);
::wxMessageBox(fmt, _GetAppTitle(), wxOK | wxCENTRE | wxICON_EXCLAMATION);
xvt_dm_post_speech("OK", 7, TRUE);
_MessageBox(fmt, wxOK | wxCENTRE | wxICON_EXCLAMATION);
}
char* xvt_dm_post_string_prompt(const char* message, char* response, int response_len)
{
XVT_ASSERT(message && response && response_len > 0);
SORRY_BOX();
*response = '\0';
return NULL;
wxTextEntryDialog dlg(NULL, message, _GetAppTitle(), response);
if (dlg.ShowModal() == wxID_OK)
wxStrncpy(response, dlg.GetValue(), response_len);
else
*response = '\0';
return response;
}
void xvt_dm_post_warning(const char *fmt)
{
xvt_dm_post_speech(fmt, 1, TRUE);
::wxMessageBox(fmt, _GetAppTitle(), wxOK | wxCENTRE | wxICON_EXCLAMATION);
xvt_dm_post_speech("OK", 7, TRUE);
_MessageBox(fmt, wxOK | wxCENTRE | wxICON_EXCLAMATION);
}
///////////////////////////////////////////////////////////
@ -1246,15 +1358,11 @@ void xvt_dwin_draw_gradient_linear(WINDOW win, const RCT* r, COLOR col1, COLOR c
}
}
void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid)
{
const wxIcon* ico = _GetIconResource(rid);
if (ico != NULL)
{
CAST_DC(win, dc);
dc.DrawIcon(*ico, x, y);
}
CAST_DC(win, dc);
const wxIcon& ico = _GetIconResource(rid);
dc.DrawIcon(ico, x, y);
}
static wxRect ComputeRect(const wxRect& rct, int h, int v, int k)
@ -1505,19 +1613,19 @@ long xvt_dwin_get_font_size_mapped(WINDOW win)
int xvt_dwin_get_text_width(WINDOW win, const char *s, int len)
{
int width = 0, height;
int width = 0;
if (s && *s && len != 0)
{
CAST_DC(win, dc);
wxString str = s;
if (len >= 0)
str.Truncate(len);
if (str.StartsWith("ABCDEFGH") || str.StartsWith("MMMMMMMM"))
{
const wxString emme('G', str.Length()); // Questa lettera cambia con le mode
str = emme;
}
if (len > 0)
str.Truncate(len);
int height;
dc.GetTextExtent(str, &width, &height);
}
@ -1526,16 +1634,17 @@ int xvt_dwin_get_text_width(WINDOW win, const char *s, int len)
void xvt_dwin_invalidate_rect(WINDOW win, RCT* rctp)
{
CAST_WIN(win, w);
if (rctp)
{
const wxRect rct = NormalizeRCT(rctp);
w.Refresh(FALSE, &rct);
}
else
{
w.Refresh(FALSE);
}
if (win != NULL_WIN)
{
CAST_WIN(win, w);
if (rctp)
{
const wxRect rct = NormalizeRCT(rctp);
w.Refresh(FALSE, &rct);
}
else
w.Refresh(FALSE);
}
}
BOOLEAN xvt_dwin_is_update_needed(WINDOW win, RCT* rctp)
@ -2743,7 +2852,7 @@ void xvt_res_free_menu_tree(MENU_ITEM* tree)
XVT_IMAGE xvt_res_get_image(int rid)
{
const wxString strFileName = ::GetResourceName("Image", rid);
const wxString strFileName = _GetResourceName("Image", rid);
const bool ok = !strFileName.IsEmpty();
XVT_ASSERT(ok);
return ok ? xvt_image_read(strFileName) : NULL;
@ -2846,7 +2955,7 @@ MENU_ITEM* xvt_res_get_menu(int rid)
char* xvt_res_get_str(int rid, char *s, int sz_s)
{
XVT_ASSERT(s != NULL && sz_s > 0);
const wxString str = ::GetResourceName("String", rid);
const wxString str = _GetResourceName("String", rid);
strncpy(s, str, sz_s);
s[sz_s-1] = '\0';
return s;
@ -3027,7 +3136,6 @@ WINDOW xvt_scr_get_focus_vobj(void)
SLIST xvt_scr_list_wins()
{
SLIST list = xvt_slist_create();
_nice_windows.BeginFind();
for (wxHashTable::Node* node = _nice_windows.Next(); node; node = _nice_windows.Next())
{
@ -3038,7 +3146,6 @@ SLIST xvt_scr_list_wins()
xvt_slist_add_at_elt(list, NULL, title, (long)pWin);
}
}
return list;
}
@ -3166,6 +3273,27 @@ char* xvt_str_duplicate(const char* str)
return str ? _strdup(str) : NULL; // bleah!
}
char* xvt_str_number_format(char* str, int size)
{
#ifdef WIN32
OsWin32_NumberFormat(str, size);
#else
wxString txt;
for (const char* s = str; *s; s++)
{
if (isdigit(*s))
txt << *s;
else
{
if (*s == '.')
txt << ',';
}
}
wxStrncpy(str, txt, size);
#endif
return str;
}
BOOLEAN xvt_str_match(const char* mbs, const char *pat, BOOLEAN case_sensitive)
{
/*
@ -3208,6 +3336,13 @@ double xvt_str_fuzzy_compare (const char* s1, const char* s2)
return fstrcmp(s1, s2);
}
double xvt_str_fuzzy_compare_ignoring_case (const char* s1, const char* s2)
{
wxString str1(s1); str1.MakeUpper();
wxString str2(s2); str1.MakeUpper();
return fstrcmp(str1, str2);
}
BOOLEAN xvt_chr_is_digit(int c)
{
return (c <= 255) && wxIsdigit(c);
@ -3316,26 +3451,23 @@ long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask)
if (sync)
{
wxFrame* frame = (wxFrame*)_task_win;
if (iconizetask)
{
wxEnableTopLevelWindows(FALSE);
// ((wxFrame*)_task_win)->Iconize();
TIconizeTaskThread* it;
it = new TIconizeTaskThread();
__bChildRunning = true;
TIconizeTaskThread* it = new TIconizeTaskThread(); // No need to delete
__bChildRunning = true;
exitcode = wxExecute(cmd, wxEXEC_SYNC);
__bChildRunning = false;
wxFrame* frame = (wxFrame*)_task_win;
if (frame->IsIconized())
frame->Restore();
wxEnableTopLevelWindows(TRUE);
frame->Raise();
}
else
exitcode = wxExecute(cmd, wxEXEC_SYNC);
exitcode = wxExecute(cmd, wxEXEC_SYNC); // Valutare wxEXEC_NODISABLE
frame->Raise();
}
else
exitcode = wxExecute(cmd, wxEXEC_ASYNC);
@ -3471,7 +3603,7 @@ unsigned int xvt_sys_load_icon(const char* file)
wxString str = file;
str.MakeLower();
if (str.Find(".ico") > 0)
if (str.EndsWith(".ico"))
icon = new wxIcon(file, wxBITMAP_TYPE_ICO);
else
{
@ -3676,17 +3808,21 @@ void xvt_timer_destroy(long id)
void xvt_vobj_destroy(WINDOW win)
{
if (win != PRINTER_WIN && win != TASK_WIN)
{
xvt_win_set_caret_visible(win, FALSE);
if (win != NULL_WIN)
{
if (win != PRINTER_WIN && win != TASK_WIN)
{
xvt_win_set_caret_visible(win, FALSE);
if (_nice_windows.Get(win) != NULL)
{
CAST_TWIN(win, w);
w.Close(true);
}
}
GetTDCMapper().DestroyTDC(win);
wxWindow* w = (wxWindow*)_nice_windows.Get(win);
if (w != NULL)
{
delete w;
_nice_windows.Delete(win);
}
}
GetTDCMapper().DestroyTDC(win);
}
}
long xvt_vobj_get_attr(WINDOW win, long data)
@ -3903,10 +4039,16 @@ WIN_TYPE xvt_vobj_get_type(WINDOW win)
CAST_TWIN(win, w);
return w._type;
}
BOOLEAN xvt_vobj_is_focusable(WINDOW win)
{
return win != NULL_WIN && win != PRINTER_WIN;
BOOLEAN ok = win != NULL_WIN && win != PRINTER_WIN;
if (ok)
{
CAST_WIN(win, w);
ok = w.IsEnabled() && w.IsShownOnScreen();
}
return ok;
}
void xvt_vobj_maximize(WINDOW win)
@ -4015,7 +4157,7 @@ WINDOW xvt_win_create(WIN_TYPE wtype, const RCT* rct_p, const char* title, int m
const wxRect rct = NormalizeRCT(rct_p);
const wxString caption = title;
long style = wxCLIP_CHILDREN | wxCLIP_SIBLINGS;
long style = wxCLIP_CHILDREN | wxCLIP_SIBLINGS | wxWANTS_CHARS;
if (win_flags & WSF_VSCROLL)
style |= wxVSCROLL;
if (win_flags & WSF_HSCROLL)
@ -4098,6 +4240,38 @@ long xvt_win_dispatch_event(WINDOW win, EVENT* event_p)
return w._eh(win, event_p);
}
BOOLEAN xvt_win_enum_wins(WINDOW parent_win, XVT_ENUM_CHILDREN func, long data, unsigned long /*reserved*/)
{
CAST_WIN(parent_win, w)
wxWindowList& list = w.GetChildren();
const BOOLEAN ok = list.GetCount() > 0;
if (ok && func != NULL)
{
for (wxWindowList::iterator i = list.begin(); i != list.end(); ++i)
{
WINDOW win = (WINDOW)&(wxWindow&)*i;
if (!func(win, data))
break;
}
}
return ok;
}
long xvt_win_get_children_count(WINDOW parent_win)
{
long nCount = 0;
if (parent_win != NULL_WIN)
{
CAST_WIN(parent_win, w)
#ifdef WIN32
nCount = OsWin32_GetChildrenCount((unsigned int)w.GetHandle());
#else
nCount = w.GetChildren().GetCount();
#endif
}
return nCount;
}
void xvt_win_post_event(WINDOW win, EVENT* event_p)
{
// Per ora funziona solo con la task window
@ -4255,44 +4429,3 @@ BOOLEAN statbar_destroy(WINDOW win)
return pStatusBar != NULL;
}
void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down)
{
wxBitmapButton* pb = (wxBitmapButton*)win;
XVT_ASSERT(pb != NULL);
if (up != NULL)
{
XVT_ASSERT(pb->IsKindOf(CLASSINFO(wxBitmapButton)));
wxImage& img = ((TXVT_IMAGE*)up)->Image();
const int r = img.GetRed(0,0);
const int g = img.GetGreen(0,0);
const int b = img.GetBlue(0,0);
img.SetMask();
img.SetMaskColour(r, g, b);
wxBitmap bmpUp(img);
if (bmpUp.Ok())
{
pb->SetBitmapLabel(bmpUp);
const wxImage imgGay = img.ConvertToGreyscale();
wxBitmap bmpGay(imgGay);
pb->SetBitmapDisabled(bmpGay);
}
if (down != NULL)
{
wxImage& img = ((TXVT_IMAGE*)down)->Image();
img.SetMask();
img.SetMaskColour(r, g, b);
wxBitmap bmpDown(img);
if (bmpDown.Ok())
pb->SetBitmapSelected(bmpDown);
}
else
{
if (bmpUp.Ok())
pb->SetBitmapSelected(bmpUp);
}
}
}

View File

@ -1,9 +1,8 @@
#include "../xvaga/wxinc.h"
#include <wx/filename.h>
#include <wx/snglinst.h>
#include <wx/sysopt.h>
extern int xvt_main(int argc, char** argv);
@ -45,6 +44,9 @@ bool TMainApp::OnInit()
m_Locale.Init(wxLocale::GetSystemLanguage()); // wxLANGUAGE_ITALIAN
if (GetComCtl32Version() >= 600 && ::wxDisplayDepth() >= 32)
wxSystemOptions::SetOption(wxT("msw.remap"), 2);
wxTimerEvent evt(TIMER_ID);
AddPendingEvent(evt);
return true;

View File

@ -229,19 +229,15 @@ XVTDLL void xvt_menu_set_tree(WINDOW win, MENU_ITEM* tree);
XVTDLL void xvt_menu_update(WINDOW win);
XVTDLL MENU_ITEM* xvt_menu_duplicate_tree(const MENU_ITEM* m);
XVTDLL void xvt_notebk_add_page(WINDOW notebk, short tab_no, short page_no,
const char* title, long page_data);
XVTDLL void xvt_notebk_add_tab(WINDOW notebk, short tab_no, const char* title, XVT_IMAGE image);
XVTDLL WINDOW xvt_notebk_create_face(WINDOW notebk, short tab_no, short page_no,
EVENT_MASK mask, EVENT_HANDLER face_eh, long app_data);
XVTDLL WINDOW xvt_notebk_create_face_def(WINDOW notebk, short tab_no, short page_no,
WIN_DEF* win_def_p, EVENT_MASK mask,
EVENT_HANDLER face_eh, long app_data);
XVTDLL WINDOW xvt_notebk_get_face(WINDOW notebk, short tab_no, short page_no);
XVTDLL short xvt_notebk_add_page(WINDOW notebk, WINDOW page, const char* title, XVT_IMAGE img, short page_no);
XVTDLL WINDOW xvt_notebk_get_page(WINDOW notebk, short page_no);
XVTDLL short xvt_notebk_get_num_tabs(WINDOW notebk);
XVTDLL void xvt_notebk_set_front_page(WINDOW notebk, short tab_no, short page_no);
XVTDLL void xvt_notebk_set_tab_title(WINDOW notebk, short tab_no, const char* title);
XVTDLL void xvt_notebk_set_front_page(WINDOW notebk, short page_no);
XVTDLL void xvt_notebk_set_tab_title(WINDOW notebk, short page_no, const char* title);
XVTDLL void xvt_notebk_set_page_title(WINDOW notebk, short page_no, const char* title);
XVTDLL char* xvt_notebk_get_tab_title(WINDOW notebk, short page_no, char* title, int sz_title);
XVTDLL void xvt_notebk_rem_page(WINDOW notebk, short page_no);
XVTDLL void xvt_notebk_rem_tab(WINDOW notebk, short tab_no);
// Added by Guy
typedef const char* TRANSLATE_CALLBACK(const char* ita);
@ -321,10 +317,11 @@ XVTDLL int xvt_str_compare_ignoring_case (const char* s1, const char* s2);
XVTDLL char* xvt_str_duplicate(const char* str);
XVTDLL BOOLEAN xvt_str_match(const char* str, const char* pat, BOOLEAN case_sensitive);
XVTDLL double xvt_str_fuzzy_compare (const char* s1, const char* s2);
XVTDLL double xvt_str_fuzzy_compare_ignoring_case(const char* s1, const char* s2);
XVTDLL void xvt_str_make_upper(char* str);
XVTDLL void xvt_str_make_lower(char* str);
XVTDLL BOOLEAN xvt_str_md5(const char* instr, char* outstr32);
XVTDLL char* xvt_str_number_format(char* str, int size);
XVTDLL XVT_TREEVIEW_NODE xvt_treeview_add_child_node(WINDOW win,
XVT_TREEVIEW_NODE parent, XVT_TREEVIEW_NODE_TYPE type,
@ -377,7 +374,7 @@ XVTDLL unsigned int xvt_sys_load_icon(const char* file);
XVTDLL void xvt_sys_sleep(unsigned long msec);
XVTDLL BOOLEAN xvt_sys_test_network_version();
XVTDLL void xvt_sys_searchenv(const char *filename, const char *varname, char *pathname);
XVTDLL void xvt_sys_sorry_box(const char * file, int line);
XVTDLL void xvt_sys_sorry_box(const char* func, const char* file, int line);
XVTDLL void xvt_sys_deprecated_box(const char * file, int line);
XVTDLL long xvt_timer_create(WINDOW win, long interval);
XVTDLL void xvt_timer_destroy(long id);
@ -390,6 +387,7 @@ XVTDLL XVT_PALETTE xvt_vobj_get_palet(WINDOW win);
XVTDLL WINDOW xvt_vobj_get_parent(WINDOW win);
XVTDLL char* xvt_vobj_get_title(WINDOW win, char *title, int sz_title);
XVTDLL WIN_TYPE xvt_vobj_get_type(WINDOW win);
XVTDLL BOOLEAN xvt_vobj_is_focusable(WINDOW win);
XVTDLL void xvt_vobj_maximize(WINDOW win); // Added by XVAGA
XVTDLL void xvt_vobj_minimize(WINDOW win); // Added by XVAGA
XVTDLL void xvt_vobj_move(WINDOW win, const RCT* rctp);
@ -403,6 +401,8 @@ XVTDLL void xvt_vobj_set_visible(WINDOW win, BOOLEAN show);
XVTDLL void xvt_vobj_translate_points(WINDOW from_win, WINDOW to_win, PNT *pntp, int npnts);
XVTDLL WINDOW xvt_win_create(WIN_TYPE wtype, const RCT* rct_p, const char* title, int menu_rid, WINDOW parent_win, long win_flags, EVENT_MASK mask, EVENT_HANDLER eh, long app_data);
XVTDLL long xvt_win_dispatch_event(WINDOW win, EVENT* event_p);
XVTDLL BOOLEAN xvt_win_enum_wins(WINDOW parent_win, XVT_ENUM_CHILDREN func, long data, unsigned long reserved);
XVTDLL long xvt_win_get_children_count(WINDOW parent_win);
XVTDLL void xvt_win_post_event(WINDOW win, EVENT* event_p); // Added by XVAGA
XVTDLL void xvt_win_release_pointer(void);
XVTDLL void xvt_win_set_caret_size(WINDOW win, int width, int height);
@ -413,7 +413,10 @@ XVTDLL void xvt_win_set_handler(WINDOW win, EVENT_HANDLER eh);
XVTDLL void xvt_win_trap_pointer(WINDOW win);
// Added by XVAGA
XVTDLL BOOLEAN xvt_win_add_pane(WINDOW win, WINDOW pane, const char* name, int dock, int flags);
XVTDLL BOOLEAN xvt_pane_add(WINDOW parent, WINDOW pane, const char* name, int dock, int flags);
XVTDLL BOOLEAN xvt_pane_change_flags(WINDOW pane, int set, int reset);
XVTDLL BOOLEAN xvt_pane_detach(WINDOW pane);
XVTDLL BOOLEAN xvt_pane_set_title(WINDOW pane, const char* title);
typedef int ODBC_CALLBACK(void*,int,char**, char**);
XVTDLL XVT_ODBC xvt_odbc_get_connection(const char* dsn, const char* usr, const char* pwd, const char* dir);
@ -430,7 +433,7 @@ XVTDLL int xvt_net_get_status();
}
#endif
#define SORRY_BOX() xvt_sys_sorry_box(__FILE__, __LINE__)
#define SORRY_BOX() xvt_sys_sorry_box(__FUNCTION__, __FILE__, __LINE__)
#ifndef NDEBUG
#define DEPRECATED_BOX() xvt_sys_deprecated_box(__FILE__, __LINE__)
@ -438,4 +441,4 @@ XVTDLL int xvt_net_get_status();
#define DEPRECATED_BOX()
#endif
#endif
#endif

View File

@ -483,8 +483,8 @@ XVT_HELP_TID tid;
typedef unsigned long EVENT_MASK;
typedef long (* EVENT_HANDLER) (WINDOW win, EVENT *ep);
typedef BOOLEAN (* XVT_ERRMSG_HANDLER) (XVT_ERRMSG err, DATA_PTR context);
typedef BOOLEAN (* XVT_ENUM_CHILDREN)(WINDOW child, long data);
typedef enum { /* std. clipboard format */
CB_TEXT, /* ASCII text */

File diff suppressed because it is too large Load Diff

View File

@ -214,7 +214,9 @@ public:
#define TIMER_ID 1
const wxString& _GetAppTitle();
const wxIcon* _GetIconResource(int rid);
wxString _GetResourceName(const char* type, int rid);
const wxIcon& _GetIconResource(int rid);
const wxBitmap& _GetToolResource(int rid, int size);
#define CAST_COLOR(xc, wc) wxColour wc((xc>>16)&0xFF, (xc>>8)&0xFF, xc&0xFF)
#define MAKE_XVT_COLOR(wc) MAKE_COLOR(wc.Red(), wc.Green(), wc.Blue())