git-svn-id: svn://10.65.10.50/branches/R_10_00@23117 c028cbd2-c16b-5b4b-a496-9718f37d4682

This commit is contained in:
guy 2015-06-17 07:17:35 +00:00
parent 05df13cb7c
commit 794d88b1a3
16 changed files with 821 additions and 655 deletions

View File

@ -9,7 +9,6 @@
///////////////////////////////////////////////////////////
#include <wx/dir.h>
#include <wx/progdlg.h>
#include <wx/wfstream.h>
#include <wx/zipstrm.h>
@ -31,15 +30,11 @@ bool aga_unzip(const char* zipfile, const char* destdir)
wxArrayString aFiles;
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();
WINDOW pi = xvt_dm_progress_create(NULL_WIN, "Unzip", files, TRUE);
for (unsigned int f = 0; f < files; f++)
{
const wxString& strFileName = aFiles[f];
if (!pi.Update(f, strFileName))
break;
xvt_dm_progress_set_text(pi, strFileName);
if (wxEndsWithPathSeparator(strFileName) || strFileName.Find('.') < 0) // Is dir name
{
@ -72,7 +67,10 @@ bool aga_unzip(const char* zipfile, const char* destdir)
wxFileOutputStream fout(strOutFile);
fout.Write(fin);
}
if (!xvt_dm_progress_set_status(pi, f+1, files))
break;
}
xvt_dm_progress_destroy(pi);
return files > 0;
}
@ -106,19 +104,17 @@ static bool AddFilesToZip(const wxString& strBase, wxArrayString& aFiles, const
{
wxFFileOutputStream out(zipfile);
wxZipOutputStream zip(out);
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();
WINDOW pi = xvt_dm_progress_create(NULL_WIN, "Zip", nFiles, TRUE);
for (size_t i = 0; i < nFiles; i++)
{
const wxString& str = aFiles[i];
if (!pi.Update(i, str))
break;
xvt_dm_progress_set_text(pi, str);
AddFileToZip(strBase, str, zip);
if (!xvt_dm_progress_set_status(pi, i+1, nFiles))
break;
}
xvt_dm_progress_destroy(pi);
return true;
}
@ -141,7 +137,7 @@ bool aga_zip_filelist(const char* filelist, const char* zipfile)
ifstream fin(filelist);
while (!fin.eof())
{
char name[_MAX_PATH];
char name[_MAX_PATH] = { 0 };
fin.getline(name, sizeof(name));
if (*name)
aFiles.Add(name);
@ -155,20 +151,29 @@ bool aga_zip_filelist(const char* filelist, const char* zipfile)
// DDE
///////////////////////////////////////////////////////////
#ifdef __WXMSW__
#include <wx/dde.h>
#define wxAgaClient wxDDEClient
#define wxAgaConnection wxDDEConnection
#else
// Forse inutile: forse gia' fatto da wxWidgets
#include <wx/sckipc.h>
#define wxAgaClient wxTCPClient
#define wxAgaConnection wxTCPConnection
#endif
#include <wx/dde.h>
#define wxAgaClient wxDDEClient
static wxAgaClient* _net_client = NULL;
static unsigned long _net_conns = 0;
class wxAgaConnection : public wxDDEConnection
{
public:
bool ExecuteAsync(const wxChar *data, int size, wxIPCFormat format = wxIPC_TEXT);
};
bool wxAgaConnection::ExecuteAsync(const wxChar *data, int size, wxIPCFormat WXUNUSED(format))
{
DWORD result;
if (size < 0)
size = (wxStrlen(data) + 1) * sizeof(wxChar); // includes final NUL
bool ok = DdeClientTransaction((LPBYTE)data, size, (HCONV)m_hConv, NULL,
0, XTYP_EXECUTE, TIMEOUT_ASYNC, &result) != 0;
return ok;
}
unsigned long aga_dde_connect(const char* host, const char* service, const char* topic)
{
if (_net_client == NULL)
@ -184,13 +189,43 @@ unsigned long aga_dde_connect(const char* host, const char* service, const char*
return (unsigned long)conn;
}
bool aga_dde_poke(unsigned long connection, const char* item, const char* data)
{
return false;
}
int aga_dde_request(unsigned long connection, const char* item, char* data, int max_size)
{
int len = 0;
if (connection != 0)
{
wxAgaConnection* conn = (wxAgaConnection*)connection;
wxChar* buff = conn->Request(item, &len);
if (max_size > 0)
memcpy(data, buff, min(max_size, len));
}
return len;
}
bool aga_dde_execute(unsigned long connection, const char* msg)
{
bool ok = false;
if (connection != 0)
{
wxAgaConnection* conn = (wxAgaConnection*)connection;
ok = conn->Execute((char*)msg, -1);
ok = conn->Execute(msg, -1);
}
return ok;
}
bool aga_dde_execute_async(unsigned long connection, const char* msg)
{
bool ok = false;
if (connection != 0)
{
wxAgaConnection* conn = (wxAgaConnection*)connection;
ok = conn->ExecuteAsync(msg, -1);
}
return ok;
}

View File

@ -17,6 +17,9 @@ XVTDLL bool aga_zip_filelist(const char* filelist, const char* zipfile);
XVTDLL unsigned long aga_dde_connect(const char* host, const char* service, const char* topic);
XVTDLL bool aga_dde_execute(unsigned long connection, const char* command);
XVTDLL bool aga_dde_execute_async(unsigned long connection, const char* command);
XVTDLL bool aga_dde_poke(unsigned long connection, const char* item, const char* data);
XVTDLL int aga_dde_request(unsigned long connection, const char* item, char* data, int max_size);
XVTDLL bool aga_dde_terminate(unsigned long connection);
#endif

View File

@ -1,22 +1,9 @@
#ifndef __INCSTR_H
#define __INCRSTR_H
#ifdef WIN32
#if _MSC_VER > 1300
#include <fstream>
#include <iostream>
#include <strstream>
using namespace std;
#else
#include <fstream.h>
#include <strstrea.h>
#endif
#else // WIN32
#include <fstream>
#include <iostream>
#include <sstream>
#include <strstream>
using namespace std;
#endif //WIN32
#endif

View File

@ -6,7 +6,6 @@
#include "wx/msw/helpchm.h"
#include "oswin32.h"
#include "aclapi.h"
#include "xvt_menu.h"
#include "xvt_help.h"
@ -17,6 +16,10 @@
#include "xvt_type.h"
#include "xvtwin.h"
#include <aclapi.h>
#include <psapi.h>
#include <shlobj.h>
bool OsWin32_CheckPrinterInfo(const void* data, unsigned int size)
{
bool ok = data != NULL;
@ -577,8 +580,7 @@ static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
HINSTANCE inst = (HINSTANCE)::GetWindowLong(hwnd, GWL_HINSTANCE);
if (inst == w->_instance)
{
// Cerco di capire se e' la finetra principale dal fatto che
// abbia la caption ed i bottoni di chiusura
// Cerco di capire se e' la finetra principale dal fatto che abbia la caption ed i bottoni di chiusura
const DWORD dwWanted = WS_CAPTION | WS_SYSMENU;
const DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
if ((style & dwWanted) == dwWanted)
@ -608,6 +610,49 @@ static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
return TRUE;
}
WXHINSTANCE OsWin32_ProcessModule(const char* name)
{
WXHINSTANCE hModule = NULL;
DWORD* aProcesses = NULL;
DWORD nItems = 0, nFound = 0;
for (nItems = 256; ; nItems *= 2)
{
DWORD cbNeeded = 0;
free(aProcesses);
aProcesses = (DWORD*)calloc(nItems, sizeof(DWORD));
if (!EnumProcesses(aProcesses, nItems*sizeof(DWORD), &cbNeeded))
{
free(aProcesses);
return false;
}
nFound = cbNeeded / sizeof(DWORD);
if (nFound < nItems)
break;
}
for (DWORD i = 0; i < nFound && !hModule; i++) if (aProcesses[i])
{
HANDLE hProcess = ::OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, aProcesses[i] );
if (hProcess != NULL)
{
HMODULE hMod; DWORD cbNeeded;
if (::EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) )
{
TCHAR szProcessName[MAX_PATH] = { 0 };
::GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName)/sizeof(TCHAR) );
if (wxStricmp(szProcessName, name) == 0)
hModule = (WXHINSTANCE)hMod;
}
// Release the handle to the process.
CloseHandle( hProcess );
}
}
free(aProcesses);
return hModule;
}
void OsWin32_PlaceProcessInWindow(unsigned int instance, const char* name, unsigned int parent)
{
TFindWindowInfo w;
@ -711,115 +756,6 @@ long OsWin32_CloseChildren(unsigned int parent)
return n;
}
///////////////////////////////////////////////////////////
// Hardlock Support
///////////////////////////////////////////////////////////
#include "hlapi_c.h"
bool OsWin32_HL_Login(unsigned short address, const unsigned char* label, const unsigned char* password)
{
int err = HL_LOGIN(address, LOCAL_DEVICE, (unsigned char*)label, (unsigned char*)password);
return err == STATUS_OK;
}
bool OsWin32_HL_Logout()
{
HL_LOGOUT();
return TRUE;
}
bool OsWin32_HL_Read(unsigned short reg, unsigned short* data)
{
int err = HL_READ(reg, data);
return err == STATUS_OK;
}
bool OsWin32_HL_ReadBlock(unsigned char* data)
{
int err = HL_READBL(data);
return err == STATUS_OK;
}
bool OsWin32_HL_Write(unsigned short reg, unsigned short data)
{
int err = HL_WRITE(reg, data);
return err == STATUS_OK;
}
bool OsWin32_HL_Crypt(unsigned short* data) // Array di 4 words (8 bytes)
{
int err = HL_CODE(data, 1);
return err == STATUS_OK;
}
///////////////////////////////////////////////////////////
// Eutron Smartlink Support
///////////////////////////////////////////////////////////
#include "skeylink.h"
static KEY_NET _eutron_key;
bool OsWin32_SL_Crypt(unsigned short* data)
{
_eutron_key.net_command = NET_KEY_ACCESS;
_eutron_key.command = SCRAMBLING_MODE;
memcpy(_eutron_key.data, data, 8);
smartlink(&_eutron_key);
if (_eutron_key.status == ST_OK)
memcpy(data, _eutron_key.data, 8);
return _eutron_key.status == ST_OK;
}
bool OsWin32_SL_Login(const unsigned char* label, const unsigned char* password)
{
memset(&_eutron_key, 0, sizeof(KEY_NET));
_eutron_key.net_command = NET_KEY_OPEN;
_eutron_key.status = ST_HW_FAILURE; // Don't leave ST_OK = 0 here!
memcpy(_eutron_key.label, label, strlen((const char*)label));
memcpy(_eutron_key.password, password, strlen((const char*)password));
smartlink(&_eutron_key);
return _eutron_key.status == ST_OK;
}
bool OsWin32_SL_Logout()
{
_eutron_key.net_command = NET_KEY_CLOSE;
_eutron_key.command = 0;
smartlink(&_eutron_key);
return true;
}
bool OsWin32_SL_ReadBlock(unsigned short reg, unsigned short size, unsigned short* data)
{
_eutron_key.net_command = NET_KEY_ACCESS;
_eutron_key.command = BLOCK_READING_MODE;
unsigned short* pointer = (unsigned short*)(&_eutron_key.data[0]);
unsigned short* number = (unsigned short*)(&_eutron_key.data[2]);
*pointer = reg;
*number = size;
smartlink(&_eutron_key);
bool ok = _eutron_key.status == ST_OK;
if (ok)
memcpy(data, &_eutron_key.data[4], size*sizeof(unsigned short));
return ok;
}
bool OsWin32_SL_WriteBlock(unsigned short reg, unsigned short size, const unsigned short* data)
{
_eutron_key.net_command = NET_KEY_ACCESS;
_eutron_key.command = BLOCK_WRITING_MODE;
unsigned short* pointer = (unsigned short*)(&_eutron_key.data[0]);
unsigned short* number = (unsigned short*)(&_eutron_key.data[2]);
*pointer = reg;
*number = size;
memcpy(&_eutron_key.data[4], data, size*sizeof(unsigned short));
smartlink(&_eutron_key);
return _eutron_key.status == ST_OK;
}
///////////////////////////////////////////////////////////
// Ex-Golem utilities
///////////////////////////////////////////////////////////
@ -1083,3 +1019,215 @@ void OsWin32_NumberFormat(char* str, int size)
wxStrncpy(str, buf, size);
}
}
///////////////////////////////////////////////////////////
// OsWin32_Progress...
///////////////////////////////////////////////////////////
static const wchar_t* str2wstr(const char* str, int maxlen = -1)
{
static wchar_t wstr[260];
if (str && *str && maxlen)
{
if (maxlen < 0 || maxlen > 256)
maxlen = strlen(str);
wxConvCurrent->ToWChar(wstr, 260, str, maxlen);
}
else
wstr[0] = '\0';
return wstr;
}
class Win32ProgressIndicator
{
IProgressDialog* m_ppd;
long _curr, _total, _perc;
bool _cancellable;
int _lines;
clock_t _start;
static int __nProgress; // Instances
public:
bool IsOk() const { return m_ppd != NULL; }
bool SetProgress(long curr, long tot);
void SetText(const char* msg);
Win32ProgressIndicator(WXHWND hwndParent, const char* strTitle, long nMax, bool bCanCancel);
~Win32ProgressIndicator();
};
int Win32ProgressIndicator::__nProgress = 0;
bool Win32ProgressIndicator::SetProgress(long nCurrent, long nTotal)
{
bool ok = IsOk();
if (ok)
{
if (nCurrent <= 0 || nTotal != _total)
{
m_ppd->Timer(PDTIMER_RESET, NULL);
_start = clock();
_perc = 0;
}
m_ppd->SetProgress(nCurrent, nTotal);
_curr = nCurrent;
_total = nTotal;
if (_lines < 2)
{
const int newperc = nTotal > 0 && nCurrent > 0 ? nCurrent*100/nTotal : 0;
if (newperc != _perc)
{
_perc = newperc;
const long nSec = (clock() -_start) / CLOCKS_PER_SEC;
if (nSec > 0)
{
const int nSpeed = nCurrent / nSec;
int s = nSec;
const int h = s / 3600; s %= 3600;
const int m = s / 60; s %= 60;
wxString str;
if (nSpeed < 120)
str.Format("%d%% - %ld / %ld - %02d:%02d:%02d - %d / sec", _perc, nCurrent, nTotal, h, m, s, nSpeed);
else
str.Format("%d%% - %ld / %ld - %02d:%02d:%02d - %d / min", _perc, nCurrent, nTotal, h, m, s, nSpeed/60);
m_ppd->SetLine(2, str2wstr(str), FALSE, NULL);
}
}
}
if (_cancellable && m_ppd->HasUserCancelled())
ok = false;
}
return ok;
}
void Win32ProgressIndicator::SetText(const char* msg)
{
if (IsOk())
{
if (msg && *msg)
{
const char* acapo = strchr(msg, '\n');
if (acapo)
{
m_ppd->SetLine(1, str2wstr(msg, acapo-msg), FALSE, NULL);
m_ppd->SetLine(2, str2wstr(acapo+1), FALSE, NULL);
_lines = 2;
}
else
{
m_ppd->SetLine(1, str2wstr(msg), FALSE, NULL);
m_ppd->SetLine(2, L"", FALSE, NULL);
_lines = 1;
}
}
else
{
m_ppd->SetLine(1, L"", FALSE, NULL);
m_ppd->SetLine(2, L"", FALSE, NULL);
_lines = 0;
}
}
}
Win32ProgressIndicator::Win32ProgressIndicator(WXHWND hwndParent, const char* strTitle, long nMax, bool bCanCancel)
{
m_ppd = NULL;
::CoCreateInstance(CLSID_ProgressDialog, NULL, CLSCTX_INPROC_SERVER, IID_IProgressDialog, (void **)&m_ppd);
if (m_ppd)
{
if (strTitle && *strTitle)
m_ppd->SetTitle(str2wstr(strTitle)); // Set the title of the dialog.
DWORD dwFlags = PROGDLG_AUTOTIME | PROGDLG_MODAL | PROGDLG_NOMINIMIZE;
if (nMax <= 1)
{
if (nMax == 1)
dwFlags |= PROGDLG_MARQUEEPROGRESS;
else
dwFlags |= PROGDLG_NOPROGRESSBAR;
}
_cancellable = bCanCancel && nMax > 1;
if (_cancellable)
m_ppd->SetCancelMsg(L"Attendere prego...", NULL); // Will only be displayed if Cancel button is pressed.
else
dwFlags |= PROGDLG_NOCANCEL;
_lines = 0; // No text right now!
_perc = 0; // No progress right now
m_ppd->StartProgressDialog((HWND)hwndParent, NULL, dwFlags, NULL); // Display and enable automatic estimated time remaining.
m_ppd->Timer(PDTIMER_RESET, NULL);
_start = clock();
IOleWindow* m_wnd = NULL;
if (SUCCEEDED(m_ppd->QueryInterface(IID_IOleWindow, (void**)m_wnd)))
{
HWND hwnd = NULL;
if (m_wnd && SUCCEEDED(m_wnd->GetWindow(&hwnd)))
{
RECT rct; ::GetWindowRect(hwnd, &rct);
const int x = rct.left;
const int y = int((1.5*__nProgress+0.5)*(rct.bottom-rct.top));
::SetWindowPos(hwnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
WXHICON hIcon = xvtart_GetIconResource(0).GetHICON();
::SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
}
}
__nProgress++;
}
}
Win32ProgressIndicator::~Win32ProgressIndicator()
{
if (m_ppd)
{
wxASSERT(__nProgress >= 0);
m_ppd->StopProgressDialog();
m_ppd->Release();
m_ppd = NULL;
__nProgress--;
}
}
WXHWND OsWin32_ProgressCreate(WXHWND hwndParent, const char* strTitle, long nMax, bool bCanCancel)
{
Win32ProgressIndicator* pi = new Win32ProgressIndicator(hwndParent, strTitle, nMax, bCanCancel);
if (pi && !pi->IsOk())
{
delete pi;
pi = NULL;
}
return (WXHWND)pi;
}
void OsWin32_ProgressDestroy(WXHWND prog)
{
if (prog)
{
Win32ProgressIndicator* ppd = (Win32ProgressIndicator*)prog;
delete ppd;
}
}
bool OsWin32_ProgressSetStatus(WXHWND prog, long nCurrent, long nTotal)
{
bool ok = true;
if (prog)
{
Win32ProgressIndicator* ppd = (Win32ProgressIndicator*)prog;
ok = ppd->SetProgress(nCurrent, nTotal);
}
return ok;
}
void OsWin32_ProgressSetText(WXHWND prog, const char* msg)
{
Win32ProgressIndicator* pd = (Win32ProgressIndicator*)prog;
if (pd && pd->IsOk())
pd->SetText(msg);
}

View File

@ -1,50 +1,44 @@
void OsWin32_Beep(int severity);
bool OsWin32_CheckPrinterInfo(const void* data, unsigned int size);
void* OsWin32_ConvertFromNativePrinterInfo(void* hGlobal, unsigned int& nSize);
void* OsWin32_ConvertToNativePrinterInfo(void* data, unsigned int nSize);
HBITMAP OsWin32_CreateBitmap(const wxImage& img, wxDC& dc);
bool OsWin32_DrawBitmap(HBITMAP hBMP, wxDC& dc, const wxRect& dst, const wxRect& src);
void OsWin32_DrawDottedRect(WXHDC hDC, int left, int top, int right, int bottom);
wxString OsWin32_File2App(const char* filename);
bool OsWin32_GotoUrl(const char* url, const char* action);
wxIcon OsWin32_LoadIcon(const char* file);
int OsWin32_EnumerateFamilies(WXHDC hDC, char** families, int max_count);
int OsWin32_EnumerateSizes(WXHDC hDC, const char* name, long* sizes, short* scalable, int max_count);
void OsWin32_SetCaptionStyle(WXHWND handle, long style);
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_CloseSiblings(unsigned int parent);
void OsWin32_UpdateWindow(unsigned int handle);
void OsWin32_NumberFormat(char* str, int size);
int OsWin32_Help(WXHWND handle, const char* hlp, unsigned int cmd, const char* topic);
bool OsWin32_HL_Crypt(unsigned short* data);
bool OsWin32_HL_Login(unsigned short address, const unsigned char* label, const unsigned char* password);
bool OsWin32_HL_Logout() ;
bool OsWin32_HL_Read(unsigned short reg, unsigned short* data);
bool OsWin32_HL_ReadBlock(unsigned char* data);
bool OsWin32_HL_Write(unsigned short reg, unsigned short data);
bool OsWin32_SL_Crypt(unsigned short* data);
bool OsWin32_SL_Login(const unsigned char* label, const unsigned char* password);
bool OsWin32_SL_Logout() ;
bool OsWin32_SL_ReadBlock(unsigned short reg, unsigned short size, unsigned short* data);
bool OsWin32_SL_WriteBlock(unsigned short reg, unsigned short size, const unsigned short* data);
int OsWin32_GetSessionId();
bool OsWin32_IsWindowsServer();
//#define SPEECH_API 1
#ifdef SPEECH_API
bool OsWin32_InitializeSpeech();
bool OsWin32_Speak(const char* text, bool async);
void OsWin32_DeinitializeSpeech();
#endif
void OsWin32_Beep(int severity);
bool OsWin32_CheckPrinterInfo(const void* data, unsigned int size);
void* OsWin32_ConvertFromNativePrinterInfo(void* hGlobal, unsigned int& nSize);
void* OsWin32_ConvertToNativePrinterInfo(void* data, unsigned int nSize);
HBITMAP OsWin32_CreateBitmap(const wxImage& img, wxDC& dc);
bool OsWin32_DrawBitmap(HBITMAP hBMP, wxDC& dc, const wxRect& dst, const wxRect& src);
void OsWin32_DrawDottedRect(WXHDC hDC, int left, int top, int right, int bottom);
wxString OsWin32_File2App(const char* filename);
bool OsWin32_GotoUrl(const char* url, const char* action);
wxIcon OsWin32_LoadIcon(const char* file);
int OsWin32_EnumerateFamilies(WXHDC hDC, char** families, int max_count);
int OsWin32_EnumerateSizes(WXHDC hDC, const char* name, long* sizes, short* scalable, int max_count);
void OsWin32_SetCaptionStyle(WXHWND handle, long style);
void* OsWin32_GetPrinterInfo(int& size, const char* printer);
WXHINSTANCE OsWin32_ProcessModule(const char* name);
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_CloseSiblings(unsigned int parent);
void OsWin32_UpdateWindow(unsigned int handle);
void OsWin32_NumberFormat(char* str, int size);
int OsWin32_Help(WXHWND handle, const char* hlp, unsigned int cmd, const char* topic);
int OsWin32_GetSessionId();
bool OsWin32_IsWindowsServer();
WXHWND OsWin32_ProgressCreate(WXHWND hwndOwner, const char* strTtle, long nTotal, bool bCanCancel);
void OsWin32_ProgressDestroy(WXHWND hProgDlg);
bool OsWin32_ProgressSetStatus(WXHWND hProgDlg, long nCurrent, long nTotal);
void OsWin32_ProgressSetText(WXHWND hProgDlg, const char* msg);
//#define SPEECH_API 1
#ifdef SPEECH_API
bool OsWin32_InitializeSpeech();
bool OsWin32_Speak(const char* text, bool async);
void OsWin32_DeinitializeSpeech();
#endif

View File

@ -168,8 +168,8 @@ void xvt_app_create(int WXUNUSED(argc), char** WXUNUSED(argv), unsigned long WXU
pParent = NULL;
}
wxMenu* Menus[3];
wxString Title[3];
wxMenu* Menus[4] = { NULL };
wxString Title[4];
Title[0] = "&File";
Menus[0] = new wxMenu;
Menus[0]->Append(M_FILE_PG_SETUP, "&Impostazione Stampante...");
@ -185,10 +185,11 @@ void xvt_app_create(int WXUNUSED(argc), char** WXUNUSED(argv), unsigned long WXU
Menus[1]->Append(M_EDIT_CLEAR, "&Elimina\tCanc");
Title[2] = "&?";
Menus[2] = new wxMenu;
Menus[2]->Append(M_HELP_CONTENTS, "&Sommario");
Menus[2]->Append(M_HELP_CONTENTS, "&Sommario");
Menus[2]->Append(M_HELP_ONCONTEXT, "&Aiuto contestuale");
Menus[2]->AppendSeparator();
Menus[2]->Append(M_FILE_ABOUT, "&Informazioni");
Menus[2]->Append(M_HELP_VERSION, "Storia delle &modifiche");
Menus[2]->Append(M_FILE_ABOUT, "&Informazioni");
wxMenuBar* pMenubar = new wxMenuBar(3, Menus, Title);
_task_win->SetMenuBar(pMenubar);
@ -349,103 +350,37 @@ void xvt_debug_printf(const char* fmt, ...)
///////////////////////////////////////////////////////////
BOOLEAN xvt_dongle_hl_crypt(unsigned short* data) // Array di 4 words (8 bytes)
{
#ifdef __WXMSW__
return OsWin32_HL_Crypt(data);
#else
return OsLinux_HL_Crypt(data);
#endif
}
{ return FALSE; }
BOOLEAN xvt_dongle_hl_login(unsigned short address, const unsigned char* label, const unsigned char* password)
{
#ifdef __WXMSW__
return OsWin32_HL_Login(address, label, password);
#else
return OsLinux_HL_Login(address, label, password);
#endif
}
{ return FALSE; }
BOOLEAN xvt_dongle_hl_logout()
{
#ifdef __WXMSW__
return OsWin32_HL_Logout();
#else
return OsLinux_HL_Logout();
#endif
}
{ return FALSE; }
BOOLEAN xvt_dongle_hl_read(unsigned short reg, unsigned short* data)
{
#ifdef __WXMSW__
return OsWin32_HL_Read(reg, data);
#else
return OsLinux_HL_Read(reg, data);
#endif
}
{ return FALSE; }
BOOLEAN xvt_dongle_hl_read_block(unsigned char* data)
{
#ifdef __WXMSW__
return OsWin32_HL_ReadBlock(data);
#else
return OsLinux_HL_ReadBlock(data);
#endif
}
{ return FALSE; }
BOOLEAN xvt_dongle_hl_write(unsigned short reg, unsigned short data)
{
#ifdef __WXMSW__
return OsWin32_HL_Write(reg, data);
#else
return OsLinux_HL_Write(reg, data);
#endif
}
{ return FALSE; }
BOOLEAN xvt_dongle_sl_crypt(unsigned short* data)
{
#ifdef __WXMSW__
return OsWin32_SL_Crypt(data);
#else
return OsLinux_SL_Crypt(data);
#endif
}
{ return FALSE; }
BOOLEAN xvt_dongle_sl_login(const unsigned char* label, const unsigned char* password)
{
#ifdef __WXMSW__
return OsWin32_SL_Login(label, password);
#else
return OsLinux_SL_Login(label, password);
#endif
}
{ return FALSE; }
BOOLEAN xvt_dongle_sl_logout()
{
#ifdef __WXMSW__
return OsWin32_SL_Logout();
#else
return OsLinux_SL_Logout();
#endif
}
{ return FALSE; }
BOOLEAN xvt_dongle_sl_read_block(unsigned short reg, unsigned short size, unsigned short* data)
{
#ifdef __WXMSW__
return OsWin32_SL_ReadBlock(reg, size, data);
#else
return OsLinux_SL_ReadBlock(reg, size, data);
#endif
}
{ return FALSE; }
BOOLEAN xvt_dongle_sl_write_block(unsigned short reg, unsigned short size, const unsigned short* data)
{
#ifdef __WXMSW__
return OsWin32_SL_WriteBlock(reg, size, data);
#else
return OsLinux_SL_WriteBlock(reg, size, data);
#endif
}
{ return FALSE; }
///////////////////////////////////////////////////////////
// Font cache
@ -1824,7 +1759,7 @@ SLIST xvt_fsys_list_files(const char *type, const char *pat, BOOLEAN dirs)
int flags = wxFILE | wxDIR;
if (dirs)
{
if (strcmp(type, DIR_TYPE) == 0)
if (xvt_str_same(type, DIR_TYPE))
flags = wxDIR;
}
else
@ -1833,12 +1768,12 @@ SLIST xvt_fsys_list_files(const char *type, const char *pat, BOOLEAN dirs)
const wxURL url(pat);
if (url.GetScheme() == "ftp")
{
const wxString strHost = url.GetServer();
const wxString strUser = url.GetUser();
const wxString strPwd = url.GetPassword();
const wxString strHost = url.GetServer();
const wxString strUser = url.GetUser();
const wxString strPwd = url.GetPassword();
const wxFileName fnPath = url.GetPath();
const wxString fnDir = fnPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
const wxString fnName = fnPath.GetFullName();
const wxString fnDir = fnPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
const wxString fnName = fnPath.GetFullName();
wxFTP ftp;
@ -3163,11 +3098,17 @@ SLIST_ELT xvt_slist_get_next(SLIST list, SLIST_ELT item)
// XVT Strings???
///////////////////////////////////////////////////////////
int xvt_str_compare_ignoring_case (const char* s1, const char* s2)
int xvt_str_compare_ignoring_case(const char* s1, const char* s2)
{
return wxStricmp(s1, s2);
return s1 && s2 ? wxStricmp(s1, s2) : -883;
}
BOOLEAN xvt_str_same(const char* s1, const char* s2)
{
return s1 && s2 && wxStricmp(s1, s2) == 0;
}
char* xvt_str_duplicate(const char* str)
{
return str ? wxStrdup(str) : NULL; // bleah!
@ -3453,38 +3394,33 @@ long xvt_sys_execute_in_window(const char* cmdline, WINDOW win)
if (inst > 0 && win != NULL_WIN)
{
CAST_WIN(win, w);
#ifdef __WXMSW__
OsWin32_PlaceProcessInWindow(inst, "", (unsigned int)w.GetHandle());
#else
OsLinux_PlaceProcessInWindow(inst, "", w.GetHandle());
#endif
}
return inst;
}
long xvt_sys_close_children(WINDOW win)
{
long c = 0;
#ifdef __WXMSW__
CAST_WIN(win, w);
c = OsWin32_CloseChildren((unsigned int)w.GetHandle());
#endif
return c;
return OsWin32_CloseChildren((unsigned int)w.GetHandle());
}
BOOLEAN xvt_sys_goto_url(const char* url, const char* action)
{
#ifdef __WXMSW__
if (action && *action && xvt_str_compare_ignoring_case(action, "open") != 0)
if (action && *action && !xvt_str_same(action, "open"))
return OsWin32_GotoUrl(url, action);
#endif
return wxLaunchDefaultBrowser(url);
}
BOOLEAN xvt_sys_dongle_server_is_running()
int xvt_sys_dongle_server_running()
{
wxSingleInstanceChecker sic("Authorization");
return sic.IsAnotherRunning();
int s = 0;
if (OsWin32_ProcessModule("Authoriz.exe"))
s |= 1;
if (OsWin32_ProcessModule("SSAAgent.exe"))
s |= 2;
return s;
}
#define OEM_INI wxString(_startup_dir+wxT("/setup/oem.ini"))
@ -3533,11 +3469,12 @@ int xvt_sys_get_profile_string(const char* file, const char* paragraph, const ch
if (file == NULL || *file == '\0')
file = xvt_fsys_get_campo_ini();
if (wxStricmp(file, "ssa.ini") == 0)
if (!(paragraph && *paragraph) && wxStricmp(file, "ssa.ini") == 0)
{
wxTextFile ssa;
if (ssa.Open(file))
if (xvt_fsys_file_exists(file))
{
wxTextFile ssa;
ssa.Open(file);
for (wxString str = ssa.GetFirstLine(); !ssa.Eof(); str = ssa.GetNextLine())
{
str.Trim(false);
@ -3554,37 +3491,16 @@ int xvt_sys_get_profile_string(const char* file, const char* paragraph, const ch
return wxStrlen(defval);
}
if (paragraph == NULL || *paragraph == '\0')
if (!(paragraph && *paragraph))
paragraph = "Main";
#ifdef __WXMSW__
int len = ::GetPrivateProfileString(paragraph, name, defval, value, maxsize, file);
#else
wxFileConfig ini("", "", file, "", wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH);
wxString path;
path << "/" << paragraph;
ini.SetPath(path);
int len = 0;
wxString val;
if (!ini.Read(name, &val))
val = defval;
len = val.Length();
if (value)
{
wxStrncpy(value, val, maxsize);
value[maxsize-1] = '\0';
}
#endif
return len;
}
long xvt_sys_get_profile_int(const char* file, const char* paragraph, const char* name, long defval)
{
char defstr[16] = "", str[16] = "";
char defstr[16] = { 0 }, str[16] = { 0 };
long value = defval;
if (defval != 0)
wxSprintf(defstr, "%ld", defval);
@ -3593,8 +3509,13 @@ long xvt_sys_get_profile_int(const char* file, const char* paragraph, const char
return value;
}
BOOLEAN xvt_sys_set_profile_string(const char* file, const char* paragraph,
const char* name, const char* value)
BOOLEAN xvt_sys_set_profile_int(const char* file, const char* paragraph, const char* name, long value)
{
char str[16] = { 0 }; wxSprintf(str, "%ld", value);
return xvt_sys_set_profile_string(file, paragraph, name, str);
}
BOOLEAN xvt_sys_set_profile_string(const char* file, const char* paragraph, const char* name, const char* value)
{
if (file == NULL || *file == '\0')
file = xvt_fsys_get_campo_ini();
@ -3657,8 +3578,8 @@ int xvt_sys_get_os_version()
case 108: os = XVT_WS_WIN_2008R2; break;
case 109: os = XVT_WS_WIN_7; break;
case 110: os = XVT_WS_WIN_2012; break;
case 111:
default : os = XVT_WS_WIN_8; break;
case 111: os = XVT_WS_WIN_8; break;
default : os = XVT_WS_WIN_10; break;
}
return os;
@ -3682,8 +3603,8 @@ int xvt_sys_get_version(char* os_version, char* ptk_version, int maxsize)
const int version = xvt_sys_get_os_version();
if (os_version && maxsize >= 8)
{
if (version >= XVT_WS_WIN_VISTA) // wxWidgets non sa descrivere i moderni sistemi Microsoft
::GetWinVer(os_version, maxsize, NULL);
if (version >= XVT_WS_WIN_VISTA)
::GetWinVer(os_version, maxsize, NULL); // wxWidgets non sa descrivere i moderni sistemi Microsoft
else
wxStrncpy(os_version, wxGetOsDescription(), maxsize);
}
@ -3711,12 +3632,6 @@ XVTDLL BOOLEAN xvt_sys_get_env(const char* varname, char* value, int max_size)
return ok;
}
void xvt_sys_searchenv(const char * filename, const char * varname, char * pathname)
{
DEPRECATED_BOX("xvt_sys_search_env");
xvt_sys_search_env(filename, varname, pathname);
}
void xvt_sys_search_env(const char * filename, const char * varname, char * pathname)
{
_searchenv(filename, varname, pathname);
@ -3826,12 +3741,6 @@ BOOLEAN xvt_fsys_remove_file(const char *pathname)
return wxRemoveFile(pathname);
}
BOOLEAN xvt_fsys_removefile(const char *pathname)
{
DEPRECATED_BOX("xvt_fsys_remove_file");
return xvt_fsys_remove_file(pathname);
}
BOOLEAN xvt_fsys_rename_file(const char *src_pathname, const char *dst_pathname)
{
return wxRenameFile(src_pathname, dst_pathname);
@ -3961,10 +3870,7 @@ long xvt_vobj_get_attr(WINDOW win, long data)
break;
case ATTR_APPL_VERSION_YEAR:
if (_appl_version.IsEmpty())
{
const wxString str = wxVERSION_STRING;
ret = str >= wxT("wxWidgets 2.8.12") ? 2121 : 2091;
}
ret = 2151;
else
ret = wxAtoi(_appl_version.Left(4));
break;
@ -4326,11 +4232,7 @@ WINDOW xvt_win_create(WIN_TYPE wtype, const RCT* rct_p, const char* title, int m
w->_app_data = app_data;
w->SetBackgroundStyle(wxBG_STYLE_CUSTOM); // Lo sfondo viene disegnato nella OnPaint
#ifdef __WXMSW__
OsWin32_SetCaptionStyle(w->GetHWND(), style);
#else
OsLinux_SetCaptionStyle(w, style);
#endif
if (menu_rid > 0 && menu_rid != 8000) // 8000 = NULL_MENU_RID
{

View File

@ -69,10 +69,14 @@ XVTDLL void xvt_dm_popup_message(const char *fmt);
XVTDLL void xvt_dm_popup_warning(const char *fmt);
XVTDLL void xvt_dm_popup_error(const char *fmt);
XVTDLL WINDOW xvt_dm_progress_create(WINDOW parent, const char* msg, long total, BOOLEAN cancellable);
XVTDLL BOOLEAN xvt_dm_progress_set_status(WINDOW prog, long current, long total);
XVTDLL void xvt_dm_progress_set_text(WINDOW prog, const char* msg);
XVTDLL void xvt_dm_progress_destroy(WINDOW prog);
XVTDLL void xvt_dm_post_about_box(void);
XVTDLL ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char*Btn2, const char* Btn3, const char* xin_buffer);
XVTDLL COLOR xvt_dm_post_choose_color(WINDOW win, COLOR c); // Added by guy and now deprecated: use xvt_dm_post_color_sel
XVTDLL unsigned int xvt_dm_post_choose_date(WINDOW win, const RCT* ownrct, unsigned int ansidate); // Added by guy
XVTDLL unsigned int xvt_dm_post_date_sel(WINDOW win, const RCT* ownrct, unsigned int ansidate); // Added by guy
XVTDLL BOOLEAN xvt_dm_post_color_sel(COLOR* color, unsigned long reserved);
XVTDLL void xvt_dm_post_error(const char *fmt);
XVTDLL void xvt_dm_post_fatal_exit(const char *fmt);
@ -90,20 +94,7 @@ XVTDLL BOOLEAN xvt_dm_post_speech(const char* text, int priority, BOOLEAN
XVTDLL void xvt_dm_speech_enable(int mode);
XVTDLL int xvt_dm_speech_enabled(void);
// Dongle support by AGA
XVTDLL BOOLEAN xvt_dongle_hl_crypt(unsigned short* data);
XVTDLL BOOLEAN xvt_dongle_hl_login(unsigned short address, const unsigned char* label, const unsigned char* password);
XVTDLL BOOLEAN xvt_dongle_hl_logout();
XVTDLL BOOLEAN xvt_dongle_hl_read(unsigned short reg, unsigned short* data);
XVTDLL BOOLEAN xvt_dongle_hl_read_block(unsigned char* data);
XVTDLL BOOLEAN xvt_dongle_hl_write(unsigned short reg, unsigned short data);
XVTDLL BOOLEAN xvt_dongle_sl_crypt(unsigned short* data);
XVTDLL BOOLEAN xvt_dongle_sl_login(const unsigned char* label, const unsigned char* password);
XVTDLL BOOLEAN xvt_dongle_sl_logout();
XVTDLL BOOLEAN xvt_dongle_sl_read_block(unsigned short reg, unsigned short size, unsigned short* data);
XVTDLL BOOLEAN xvt_dongle_sl_write_block(unsigned short reg, unsigned short size, const unsigned short* data);
// Dongle support by Sirio
XVTDLL int xvt_dongle_sa_crypt(unsigned short* data);
XVTDLL int xvt_dongle_sa_login(const char* module);
XVTDLL int xvt_dongle_sa_logout(const char* module);
@ -201,7 +192,6 @@ XVTDLL BOOLEAN xvt_fsys_is_fixed_drive(const char* path);
XVTDLL BOOLEAN xvt_fsys_test_disk_free_space(const char* path, unsigned long filesize);
XVTDLL BOOLEAN xvt_fsys_mkdir(const char *pathname);
XVTDLL BOOLEAN xvt_fsys_rmdir(const char *pathname);
XVTDLL BOOLEAN xvt_fsys_removefile(const char *pathname); // DEPRECATED!
XVTDLL BOOLEAN xvt_fsys_remove_file(const char *pathname);
XVTDLL BOOLEAN xvt_fsys_rename_file(const char *src_pathname, const char *dst_pathname);
XVTDLL int xvt_fsys_access(const char *pathname, int mode);
@ -220,6 +210,8 @@ XVTDLL void xvt_help_close_helpfile(XVT_HELP_INFO hi);
XVTDLL XVT_HELP_INFO xvt_help_open_helpfile(FILE_SPEC *fs, unsigned long flags);
XVTDLL BOOLEAN xvt_help_process_event(XVT_HELP_INFO hi, WINDOW win, EVENT *ev);
XVTDLL BOOLEAN xvt_html_set_url(WINDOW win, const char* url);
XVTDLL void xvt_image_blur(XVT_IMAGE image, short radius);
XVTDLL XVT_IMAGE xvt_image_capture(WINDOW win, const RCT* rct);
XVTDLL XVT_IMAGE xvt_image_create(XVT_IMAGE_FORMAT format, short width, short height, COLOR color);
@ -367,8 +359,9 @@ 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 char* xvt_str_number_format(char* str, int size);
XVTDLL BOOLEAN xvt_str_md5(const char* instr, char* outstr32);
XVTDLL char* xvt_str_number_format(char* str, int size);
XVTDLL BOOLEAN xvt_str_same(const char* s1, const char* s2);
XVTDLL XVT_TREEVIEW_NODE xvt_treeview_add_child_node(WINDOW win,
XVT_TREEVIEW_NODE parent, XVT_TREEVIEW_NODE_TYPE type,
@ -414,15 +407,18 @@ XVTDLL BOOLEAN xvt_sys_multithread(XVT_MULTITHREAD_CALLBACK callback, void* pCa
XVTDLL BOOLEAN xvt_sys_get_host_name(char* name, int maxlen);
XVTDLL BOOLEAN xvt_sys_get_user_name(char* name, int maxlen);
XVTDLL BOOLEAN xvt_sys_goto_url(const char* url, const char* action);
XVTDLL BOOLEAN xvt_sys_dongle_server_is_running();
XVTDLL int xvt_sys_dongle_server_running();
XVTDLL BOOLEAN xvt_sys_find_editor(const char* file, char* editor);
XVTDLL BOOLEAN xvt_sys_get_env(const char* varname, char* value, int max_size);
XVTDLL long xvt_sys_get_oem_int(const char* name, long defval);
XVTDLL int xvt_sys_get_oem_string(const char* name, const char* defval, char* value, int maxsize);
XVTDLL long xvt_sys_get_profile_int(const char* file, const char* paragraph, const char* name, long defval);
XVTDLL int xvt_sys_get_profile_string(const char* file, const char* paragraph, const char* name,
const char* defval, char* value, int maxsize);
XVTDLL long xvt_sys_get_profile_int(const char* file, const char* paragraph, const char* name, long defval);
XVTDLL BOOLEAN xvt_sys_set_profile_int(const char* file, const char* paragraph, const char* name, long value);
XVTDLL BOOLEAN xvt_sys_set_profile_string(const char* file, const char* paragraph, const char* name, const char* value);
XVTDLL int xvt_sys_get_session_id();
XVTDLL unsigned long xvt_sys_get_free_memory();
XVTDLL unsigned long xvt_sys_get_free_memory_kb();
@ -433,7 +429,6 @@ XVTDLL unsigned int xvt_sys_load_icon(const char* file);
XVTDLL void xvt_sys_sleep(unsigned long msec);
XVTDLL void xvt_sys_search_env(const char* filename, const char* varname, char* pathname);
XVTDLL void xvt_sys_searchenv(const char * filename, const char * varname, char * pathname); // DEPRECATED!
XVTDLL BOOLEAN xvt_sys_set_env(const char* varname, const char* value);
XVTDLL void xvt_sys_sorry_box(const char* func, const char* file, int line);
XVTDLL void xvt_sys_deprecated_box(const char* oldfunc, const char* file, const char* newfunc);
@ -557,7 +552,7 @@ XVTDLL void xvt_treelist_suspend(WINDOW win);
XVTDLL BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
const char* subject, const char* msg, const char* attach, short flags); // 0x1=UI; 0x2=Receipt
XVTDLL BOOLEAN xvt_mail_installed();
XVTDLL short xvt_mail_installed();
XVTDLL void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down);
XVTDLL int xvt_net_get_status();

View File

@ -23,6 +23,7 @@
#define XVT_WS_WIN_7 311
#define XVT_WS_WIN_2012 312
#define XVT_WS_WIN_8 313
#define XVT_WS_WIN_10 314
#define XVT_WS_UNKNOWN 0
#define MACWS 100 /* Apple Macintosh */
@ -73,5 +74,4 @@
#define XVT_CC_NOARGS() (void)
/* Default to no linkage conventions in callback typedef */
#define XVT_CALLCONV_TYPEDEF(ret, func, args) \
ret (* func) XVT_CC_ARGS(args)
#define XVT_CALLCONV_TYPEDEF(ret, func, args) ret (*func)XVT_CC_ARGS(args)

View File

@ -28,7 +28,7 @@ bool XVT_SQLDataBase::TableExists(const char* name) const
for (SLIST_ELT e = xvt_slist_get_first(list); e != NULL && !yes; e = xvt_slist_get_next(list, e))
{
const char* table = xvt_slist_get(list, e, NULL);
yes = xvt_str_compare_ignoring_case(name, table) == 0;
yes = xvt_str_same(name, table) != 0;
}
xvt_slist_destroy(list);
@ -324,6 +324,7 @@ ULONG xvt_sql_execute(XVT_SQLDB handle, const char* sql, ODBC_CALLBACK cb, void*
catch(wxSQLite3Exception& e)
{
xvt_dm_post_error(e.GetMessage() + "\n" + sql);
n = ~0;
}
}
}

View File

@ -8,13 +8,43 @@
#include <errno.h>
static int _ssa_serial = SSA_UTENTE_NON_LOGGATO;
static wxString _ssa_module;
///////////////////////////////////////////////////////////
// TSSA_Pinger
///////////////////////////////////////////////////////////
class TSSA_Pinger : public wxTimer
{
int m_nSerNo;
bool m_bRemote;
wxString m_strModule;
protected:
virtual void Notify();
bool IsRemote() const { return m_bRemote; }
bool IsMenu() const;
int AddRef(const wxString& m, int nDelta = +1);
int DecRef(const wxString& m) { return AddRef(m, -1); }
wxString NormalizedModule(const char* m) const;
bool LoginProduct();
bool LogoutProduct();
const char* UserId() const;
public:
int Login(const char* module);
int Serial() const { return m_nSerNo; }
int Logout(const char* module);
TSSA_Pinger();
};
static TSSA_Pinger* _ssa_timer = NULL;
static const char* const _ssa_product = "CAMPO";
static const char* xvt_dongle_sa_id()
const char* TSSA_Pinger::UserId() const
{
static char id[256] = { '\0' };
static char id[256] = { 0 };
if (!*id)
{
const int sess = xvt_sys_get_session_id();
@ -26,42 +56,117 @@ static const char* xvt_dongle_sa_id()
return id;
}
static BOOLEAN xvt_dongle_sa_is_remote_ba0()
bool TSSA_Pinger::IsMenu() const
{
BOOLEAN yes = FALSE;
const wxFileName argv0 = __argv[0];
if (wxStricmp(argv0.GetName(), "ba0") == 0)
{
char ssaagent[128];
const int len = xvt_sys_get_profile_string("ssa.ini", "", "SSA-PORT", "", ssaagent, sizeof(ssaagent));
yes = len > 0;
}
return yes;
return argv0.GetName().IsSameAs("ba0", false);
}
///////////////////////////////////////////////////////////
// TSSA_Pinger
///////////////////////////////////////////////////////////
class TSSA_Pinger : public wxTimer
{
protected:
virtual void Notify();
public:
TSSA_Pinger();
};
static TSSA_Pinger* _ssa_timer = NULL;
void TSSA_Pinger::Notify()
{ SSA_Ping(xvt_dongle_sa_id()); }
{ SSA_Ping(UserId()); }
bool TSSA_Pinger::LoginProduct()
{
bool bLoggedIn = IsRemote() && !IsMenu();
if (!bLoggedIn)
{
const int err = SSA_Login(UserId(), _ssa_product);
bLoggedIn = err == 0;
}
if (bLoggedIn && m_nSerNo < 0)
m_nSerNo = SSA_NumeroSerie(_ssa_product);
if (bLoggedIn && IsRemote() && IsMenu())
::WritePrivateProfileSection(UserId(), "\0\0", "./ssa.ini"); // Azzera tutti i conteggi dei moduli
return bLoggedIn;
}
bool TSSA_Pinger::LogoutProduct()
{
m_nSerNo = SSA_UTENTE_NON_LOGGATO;
if (IsRemote() && !IsMenu())
return true;
int err = SSA_Logout(UserId(), _ssa_product);
return err == 0;
}
wxString TSSA_Pinger::NormalizedModule(const char* m) const
{
wxString module;
if (m && *m)
{
module = m;
module.Trim();
module.MakeLower();
module.Truncate(2);
}
return module;
}
int TSSA_Pinger::AddRef(const wxString& module, int nDelta)
{
int nCount = xvt_sys_get_profile_int("./ssa.ini", UserId(), module, 0);
nCount += nDelta;
if (nCount < 0) nCount = 0;
xvt_sys_set_profile_int("./ssa.ini", UserId(), module, nCount);
return nCount;
}
int TSSA_Pinger::Login(const char* mod)
{
if (mod == NULL || *mod == '\0')
return LoginProduct() ? Serial() : SSA_UTENTE_NON_LOGGATO;
const wxString module = NormalizedModule(mod);
if (module == "ba" || module == "pd" || module == "ps") // Base o personalizzazione
return 0;
if (IsRemote() && AddRef(module) > 1)
return 0;
const char* uid = UserId();
int err = SSA_ApriModulo(uid, module);
if (err == SSA_UTENTE_NON_LOGGATO) // ritenta!
{
LoginProduct();
err = SSA_ApriModulo(uid, module);
}
if (err != 0 && *module >= 'a')
err = SSA_ApriModulo(uid, module.Upper());
if (IsRemote() && err != 0)
DecRef(module);
if (err == 0)
m_strModule = module;
return err;
}
int TSSA_Pinger::Logout(const char* mod)
{
const wxString module = mod == NULL ? m_strModule : NormalizedModule(mod);
int err= 0;
bool cm = !module.IsEmpty() && module != "ba";
if (cm)
{
if (IsRemote())
cm = DecRef(module) <= 0;
if (cm)
err = SSA_ChiudiModulo(UserId(), module);
}
if (err == 0)
LogoutProduct();
return err;
}
TSSA_Pinger::TSSA_Pinger()
{
const int sec = xvt_sys_get_profile_int("ssa.ini", "", "PING-DELAY", 600);
if (sec > 0)
Start(sec*1000);
char ssaagent[128] = { 0 };
const int len = xvt_sys_get_profile_string("ssa.ini", "", "SSA-PORT", "", ssaagent, sizeof(ssaagent));
m_bRemote = len > 8;
m_nSerNo = -1;
}
///////////////////////////////////////////////////////////
@ -70,50 +175,18 @@ TSSA_Pinger::TSSA_Pinger()
int xvt_dongle_sa_login(const char* module)
{
int err = _ssa_serial;
const int nAssYear = xvt_vobj_get_attr(NULL_WIN, ATTR_APPL_VERSION_YEAR);
if (nAssYear >= 2121)
{
if (_ssa_serial < 0)
{
err = SSA_Login(xvt_dongle_sa_id(), _ssa_product);
if (err == 0)
{
err = _ssa_serial = SSA_NumeroSerie(_ssa_product);
if (_ssa_timer == NULL && xvt_dongle_sa_is_remote_ba0())
_ssa_timer = new TSSA_Pinger; // solo il menu principale fa il ping
}
}
if (_ssa_serial >= 0 && module && *module)
{
wxString m = module;
err = SSA_ApriModulo(xvt_dongle_sa_id(), m);
if (err != 0 && *module >= 'a')
{
m.MakeUpper();
err = SSA_ApriModulo(xvt_dongle_sa_id(), m);
}
if (err == 0)
{
if (!_ssa_module.IsEmpty())
xvt_dongle_sa_logout(_ssa_module);
_ssa_module = m;
}
}
}
return err;
if (_ssa_timer == NULL)
_ssa_timer = new TSSA_Pinger;
return _ssa_timer->Login(module);
}
int xvt_dongle_sa_crypt(unsigned short* data)
{
if (_ssa_serial < 0)
if (_ssa_timer == NULL)
return SSA_UTENTE_NON_LOGGATO;
if (data == NULL)
return -EACCES;
data[0] ^= 0xDEAD;
data[1] ^= 0xBEEF;
data[2] ^= 0xDEAD;
@ -124,40 +197,15 @@ int xvt_dongle_sa_crypt(unsigned short* data)
int xvt_dongle_sa_logout(const char* module)
{
int err = SSA_UTENTE_NON_LOGGATO;
if (_ssa_serial >= 0)
{
if (module && *module)
{
if (_ssa_module == module)
{
err = SSA_ChiudiModulo(xvt_dongle_sa_id(), _ssa_module);
_ssa_module.Empty();
}
else
err = SSA_MOD_NOTFOUND;
}
else
{
err = SSA_Logout(xvt_dongle_sa_id(), _ssa_product);
if (err == 0)
{
_ssa_serial = SSA_UTENTE_NON_LOGGATO;
_ssa_module.Empty();
if (_ssa_timer)
{
delete _ssa_timer;
_ssa_timer = NULL;
}
}
}
}
if (_ssa_timer != NULL)
err = _ssa_timer->Logout(module); // logout
return err;
}
int xvt_dongle_sa_test(const char* module)
{
int err = SSA_PROD_NOTFOUND;
if (module && *module)
if (module && *module && *module != '?')
{
wxString p = _ssa_product;
wxString m = module;
@ -177,5 +225,3 @@ int xvt_dongle_sa_test(const char* module)
}
return err;
}

View File

@ -6,20 +6,13 @@
#define TRUE 1
#endif
#ifdef LINUX
#define _MAX_PATH 512
#define _MAX_EXT 6
#define _MAX_DRIVE 6
#define _MAX_DIR 512
#define _MAX_FNAME 512
#endif
typedef unsigned long WINDOW;
typedef unsigned int UNIT_TYPE;
typedef unsigned long ULONG;
typedef unsigned long XVT_ERRMSG;
typedef unsigned long XVT_ODBC;
typedef unsigned long XVT_SQLDB;
typedef unsigned long XVT_SQLSTMT;
typedef wchar_t XVT_WCHAR;
typedef short MENU_TAG;

View File

@ -6,6 +6,7 @@
#include "treelistctrl.h"
#include <wx/artprov.h>
#include <wx/wxhtml.h>
#include <wx/filename.h>
#include <wx/tokenzr.h>
#include <wx/treectrl.h>
@ -325,6 +326,12 @@ WINDOW xvt_ctl_create_def(WIN_DEF* win_def_p, WINDOW parent_win, long app_data)
win = (WINDOW)nb;
}
break;
case WC_HTML:
{
wxHtmlWindow* hw = new wxHtmlWindow(pParent, id, rct.GetPosition(), rct.GetSize());
win = (WINDOW)hw;
}
break;
case WC_TREE:
{
TwxTreeCtrl* tv = new TwxTreeCtrl(pParent, id, rct.GetPosition(), rct.GetSize());
@ -3275,6 +3282,21 @@ XVT_TREEVIEW_NODE xvt_treelist_find_node_string(WINDOW win, const char* text)
return node;
}
BOOLEAN xvt_html_set_url(WINDOW win, const char* url)
{
BOOLEAN done = FALSE;
wxHtmlWindow* w = win ? wxDynamicCast((wxObject*)win, wxHtmlWindow) : NULL;
if (w)
{
wxString strLocation = url;
if (strLocation.IsEmpty() || strLocation.StartsWith("<"))
done = w->SetPage(strLocation);
else
done = w->LoadPage(strLocation);
}
return done;
}
///////////////////////////////////////////////////////////
// Sad but needed migration from xvaga.cpp
///////////////////////////////////////////////////////////
@ -3297,15 +3319,18 @@ WIN_TYPE xvt_vobj_get_type(WINDOW win)
const wxControl* ctl = wxDynamicCast((wxObject*)win, wxControl);
if (ctl != NULL)
{
if (ctl->IsKindOf(CLASSINFO(wxHtmlWindow))) return WC_HTML;
if (ctl->IsKindOf(CLASSINFO(wxTreeCtrl))) return WC_TREE;
if (ctl->IsKindOf(CLASSINFO(wxTreeListCtrl))) return WC_TREELIST;
if (ctl->IsKindOf(CLASSINFO(wxPropertyGrid))) return WC_PROPGRID; // Siamo fiduciosi, ma ...
}
// ... non deriva da wxControl :-)
const wxPropertyGrid* pg = wxDynamicCast((wxObject*)win, wxPropertyGrid);
if (pg != NULL)
return WC_PROPGRID;
else
{
// ... non deriva da wxControl :-)
const wxPropertyGrid* pg = wxDynamicCast((wxObject*)win, wxPropertyGrid);
if (pg != NULL)
return WC_PROPGRID;
}
return WO_TE; // Unknown custom control
}

View File

@ -488,19 +488,11 @@ int xvt_dm_speech_enabled(void)
void xvt_dm_post_about_box()
{
const char* ver = (const char*)xvt_vobj_get_attr(NULL_WIN, ATTR_APPL_VERSION_STRING);
if (ver == NULL || !*ver) ver = "2012 11.0/200";
if (ver == NULL || !*ver) ver = "2015 12.0/100";
wxString msg; msg << "Versione " << ver;
xvt_dm_post_message(msg);
}
COLOR xvt_dm_post_choose_color(WINDOW win, COLOR xc)
{
DEPRECATED_BOX("xvt_dm_post_color_sel");
if (!xvt_dm_post_color_sel(&xc, win))
xc = COLOR_INVALID;
return xc;
}
BOOLEAN xvt_dm_post_color_sel(COLOR* color, unsigned long reserved)
{
CAST_COLOR(*color, wc);
@ -580,7 +572,7 @@ TwxCalendarDlg::TwxCalendarDlg(wxWindow* parent, wxDateTime& date)
sizer->SetSizeHints(this);
}
unsigned int xvt_dm_post_choose_date(WINDOW win, const RCT* rct, unsigned int ansidate)
unsigned int xvt_dm_post_date_sel(WINDOW win, const RCT* rct, unsigned int ansidate)
{
int d = ansidate%100;
int m = (ansidate/100)%100;
@ -833,3 +825,42 @@ BOOLEAN xvt_help_process_event(XVT_HELP_INFO WXUNUSED(hi), WINDOW win, EVENT *ev
return bProcessed;
}
///////////////////////////////////////////////////////////
// Progress dialog
///////////////////////////////////////////////////////////
WINDOW xvt_dm_progress_create(WINDOW owner, const char* title, long nTotal, BOOLEAN cancellable)
{
#ifdef __WXMSW__
WXHWND hwnd = (WXHWND)xvt_vobj_get_attr(owner, ATTR_NATIVE_WINDOW);
return (WINDOW)OsWin32_ProgressCreate(hwnd, title, nTotal, cancellable != 0);
#endif
return NULL_WIN;
}
void xvt_dm_progress_destroy(WINDOW prog)
{
#ifdef __WXMSW__
if (prog)
OsWin32_ProgressDestroy((WXHWND)prog);
#endif
}
BOOLEAN xvt_dm_progress_set_status(WINDOW prog, long nCurrent, long nTotal)
{
#ifdef __WXMSW__
return OsWin32_ProgressSetStatus((WXHWND)prog, nCurrent, nTotal);
#endif
return FALSE;
}
void xvt_dm_progress_set_text(WINDOW prog, const char* msg)
{
#ifdef __WXMSW__
OsWin32_ProgressSetText((WXHWND)prog, msg);
#endif
if (msg && *msg)
xvt_app_process_pending_events();
}

View File

@ -637,7 +637,7 @@ PRINT_RCD* xvt_print_create_by_name(int* sizep, const char* name)
TPRINT_RCD* pr = NULL;
*sizep = 0;
const bool ispdf = name != NULL && xvt_str_compare_ignoring_case(name, XVT_PDF_PRINTER_NAME) == 0;
const bool ispdf = name != NULL && xvt_str_same(name, XVT_PDF_PRINTER_NAME);
if (ispdf)
name = NULL;
@ -730,7 +730,7 @@ BOOLEAN xvt_print_is_pdf(const PRINT_RCD* precp)
{
char strName[MAX_PATH];
xvt_print_get_name(precp, strName, sizeof(strName));
yes = xvt_str_compare_ignoring_case(strName, XVT_PDF_PRINTER_NAME) == 0;
yes = xvt_str_same(strName, XVT_PDF_PRINTER_NAME) != 0;
}
return yes;
}
@ -912,9 +912,7 @@ BOOLEAN xvt_print_restart_thread()
{
TwxPrintOut& po = m_PrintoutCache.Get(NULL);
po.OnBeginPrinting();
po.OnBeginDocument(1, 32000);
return TRUE;
return po.OnBeginDocument(1, 32000);
}
BOOLEAN xvt_print_open_page(PRINT_RCD* WXUNUSED(precp))
@ -946,26 +944,10 @@ BOOLEAN xvt_print_open_page(PRINT_RCD* WXUNUSED(precp))
// Added by XVAGA
///////////////////////////////////////////////////////////
#ifdef LINUX
static const char * cups_file = "/etc/cups/printers.conf";
static const char * cups_local_file = "./printers.conf";
static const char * prcap_local_file = "./printcap";
static bool is_cups()
{
static int printer_system = -1;
if (printer_system < 0)
printer_system = xvt_fsys_file_exists(cups_file) ? 1 : 2;
return printer_system == 1;
}
#endif
SLIST xvt_print_list_devices()
{
SLIST list = xvt_slist_create();
#ifdef __WXMSW__
const DWORD dwFlags = PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS;
const int level = xvt_sys_get_os_version() >= XVT_WS_WIN_NT ? 4 : 5;
DWORD dwSize = 0, dwPrinters = 0;
@ -994,125 +976,30 @@ SLIST xvt_print_list_devices()
}
delete[] pBuffer;
}
#else
if (is_cups())
{
ifstream p(cups_local_file);
char line[4096];
const char * str_to_find = "Printer";
while (p.getline(line, sizeof(line)))
{
char * s;
if (line[0] == '<' && line[1] != '/' &&
(s = strstr(line, str_to_find)) != NULL)
{
s += strlen(str_to_find);
while (isspace(*s))
s++;
if (*s)
{
char * l = s + strlen(s) - 1;
while (*l == '>' || isspace(*l))
l--;
*(l + 1) = '\0';
xvt_slist_add_at_elt(list, NULL, s, 0L);
}
}
}
}
else
{
ifstream p(prcap_local_file); // vedere
char line[4096];
while (p.getline(line, sizeof(line)))
{
if (line[0] != '#')
{
const int len = strlen(line);
int i;
for (i = 0; i < len; i++)
{
const char c = line[i];
if (!(isalpha(c) || isdigit(c) || isblank(c)))
break;
}
line[i] = '\0';
xvt_slist_add_at_elt(list, NULL, line, 0L);
}
}
}
#endif
return list;
}
BOOLEAN xvt_print_set_default_device(const char* name)
{
BOOLEAN ok = name != NULL && *name > ' ';
#ifdef WIN32
if (ok)
{
wxString pdev(name);
if (pdev.Find(',') < 0)
{
char szDevice[256];
char szDevice[_MAX_PATH];
::GetProfileString ("devices", pdev, "", szDevice, sizeof(szDevice));
pdev << ',' << szDevice;
}
ok = ::WriteProfileString("windows", "device", pdev) != 0;
}
#endif
return ok;
}
BOOLEAN xvt_print_get_default_device(char* name, int namesize)
{
bool ok = FALSE;
#ifdef __WXMSW__
ok = ::GetProfileString ("windows", "device", ",,,", name, namesize) != 0;
#else
*name = '\0';
if (is_cups())
{
ifstream p(cups_local_file);
char line[4096];
const char * str_to_find = "<DefaultPrinter";
while (p.getline(line, sizeof(line)))
{
char * s = strstr(line, str_to_find) ;
if (s != NULL)
{
s += strlen(str_to_find);
while (isspace(*s))
s++;
if (*s)
{
char * l = s + strlen(s) - 1;
while (*l == '>' || isspace(*l))
l--;
*(l + 1) = '\0';
strcpy(name, s);
}
ok = TRUE;
}
}
}
#endif
return ok;
return ::GetProfileString ("windows", "device", ",,,", name, namesize) != 0;
}
///////////////////////////////////////////////////////////
@ -1122,7 +1009,7 @@ BOOLEAN xvt_print_get_default_device(char* name, int namesize)
int xvt_fsys_get_campo_stp_value(const char* name, char* value, int valsize)
{
BOOLEAN bFound = FALSE;
#ifdef __WXMSW__
const char* const stpfile = "c:/campo.stp";
int p;
DIRECTORY dir;
@ -1141,14 +1028,13 @@ int xvt_fsys_get_campo_stp_value(const char* name, char* value, int valsize)
len--;
path[len] = '\0';
}
if (xvt_str_compare_ignoring_case(path, exedir) == 0)
if (xvt_str_same(path, exedir))
{
xvt_sys_get_profile_string(stpfile, para, name, "", value, valsize);
bFound = *value > ' ';
break;
}
}
#endif
return bFound;
}

View File

@ -3,17 +3,77 @@
#include "email.h"
#include <wx/tokenzr.h>
#include <wx/filename.h>
BOOLEAN xvt_mail_installed()
static wxString GetMailParam(const char* key, const char* def = "")
{
BOOLEAN bMapiInstalled = TRUE;
static wxString ini;
if (ini.IsEmpty())
{
wxString cu = "ADMIN";
for (int i = __argc-1; i > 1; i--)
{
wxString u = __argv[i]; u.MakeUpper();
if (u.StartsWith("/U") || u.StartsWith("-U"))
{
cu = u.Mid(2);
break;
}
}
#ifdef __WXMSW__
bMapiInstalled = (::GetProfileInt(_T("MAIL"), _T("MAPI"), 0) != 0) &&
(SearchPath(NULL, _T("MAPI32.DLL"), NULL, 0, NULL, NULL) != 0);
#endif
char study[_MAX_PATH]; xvt_sys_get_profile_string(NULL, "Main", "Study", "", study, sizeof(study));
ini = study;
if (!wxEndsWithPathSeparator(ini))
ini += wxFILE_SEP_PATH;
ini += "config\\"; ini += cu; ini += ".ini";
}
wxString val; const size_t sz = _MAX_PATH;
xvt_sys_get_profile_string(ini, "Mail", key, def, val.GetWriteBuf(sz), sz);
val.UngetWriteBuf();
return val;
}
return bMapiInstalled;
static bool GetMailParams(wxString& smtp, wxString& port, wxString& user, wxString& pass, wxString& from)
{
smtp = GetMailParam("Server", "MAPI");
port = GetMailParam("Port");
user = GetMailParam("User");
pass = GetMailParam("Password");
wxString f = user; f += "@"; f += smtp.AfterFirst('.');
from = GetMailParam("From", f);
return !smtp.IsEmpty() && !pass.IsEmpty();
}
short xvt_mail_installed()
{
short bInstalled = 0;
if (::GetProfileInt(_T("MAIL"), _T("MAPI"), 0) != 0 &&
SearchPath(NULL, _T("MAPI32.DLL"), NULL, 0, NULL, NULL) != 0)
bInstalled |= 0x1;
if (xvt_fsys_file_exists("servers/mailsend.exe"))
{
wxString smtp, port, user, pass, from;
GetMailParams(smtp, port, user, pass, from);
if (!pass.IsEmpty() && smtp != "MAPI")
bInstalled |= 0x2;
}
return bInstalled;
}
static void AppendQuotedString(wxString& cmd, const char* key, const wxString& value)
{
if (!value.IsEmpty())
{
cmd += " -";
cmd += key;
cmd += " \"";
cmd += value;
cmd += "\"";
}
}
BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
@ -56,11 +116,59 @@ BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
while (Tok.HasMoreTokens())
Msg.AddBcc(Tok.GetNextToken());
}
xvt_fsys_save_dir();
wxEmail Mail;
BOOLEAN ok = Mail.Send(Msg, wxEmptyString, ui);
xvt_fsys_restore_dir();
const short mail_inst = xvt_mail_installed();
BOOLEAN ok = FALSE;
wxString server, port, user, password, from;
if ((mail_inst & 0x2) && GetMailParams(server, port, user, password, from))
{
wxString cmd = "servers/mailsend.exe";
AppendQuotedString(cmd, "to", Msg.m_to[0]);
AppendQuotedString(cmd, "from", from);
if (Msg.m_cc.IsEmpty())
cmd += " +cc";
else
AppendQuotedString(cmd, "cc", Msg.m_cc[0]);
if (Msg.m_bcc.IsEmpty())
cmd += " +bc";
else
AppendQuotedString(cmd, "bc", Msg.m_bcc[0]);
AppendQuotedString(cmd, "smtp", server);
if (!port.IsEmpty())
{
cmd += " -port ";
cmd += port;
}
AppendQuotedString(cmd, "sub", Msg.m_subject);
AppendQuotedString(cmd, "user", user);
AppendQuotedString(cmd, "pass", password);
if (!Msg.m_attachments.IsEmpty())
{
for (size_t a = 0; a < Msg.m_attachments.size(); a++)
AppendQuotedString(cmd, "attach", Msg.m_attachments[a]);
}
wxArrayString output, error;
wxExecute(cmd, output, error, wxEXEC_SYNC);
ok = FALSE;
for (size_t i = 0; !ok && i < error.size(); i++)
ok = error[i].find("uccess") > 0;
} else
if (mail_inst & 1)
{
xvt_fsys_save_dir();
wxEmail Mail;
ok = Mail.Send(Msg, wxEmptyString, ui);
xvt_fsys_restore_dir();
}
return ok;
}

View File

@ -554,9 +554,28 @@ long TwxWindow::DoXvtEvent(EVENT& e)
void TwxWindow::OnChar(wxKeyEvent& evt)
{
static int nSkipNextDotKey = -883; // Valore indefinito
if (nSkipNextDotKey == -883) // Devo stabilire se attivare la gestione o no
{
const char* campoini = xvt_fsys_get_campo_ini();
char str[2];
xvt_sys_get_profile_string(campoini, "Main", "Point2Comma", "1", str, sizeof(str));
nSkipNextDotKey = strchr("1XY", *str) != NULL ? 0 : -1; // Dis/Abilita conversione punto in virgola
}
XVT_EVENT e(E_CHAR);
int k = evt.GetKeyCode();
if (nSkipNextDotKey == 1)
{
nSkipNextDotKey = 0;
if (k == '.')
{
evt.Skip();
return;
}
}
switch (k)
{
case WXK_ALT:
@ -573,6 +592,14 @@ void TwxWindow::OnChar(wxKeyEvent& evt)
case WXK_NUMPAD9:
evt.Skip();
return;
case WXK_NUMPAD_DECIMAL: // Arriva solo dalla 2.6.3 in poi
case WXK_DECIMAL: // ??? Arriva sia '.' sia WXK_DECIMAL=340
if (nSkipNextDotKey == 0)
{
k = ','; // Trasformo il punto in virgola
nSkipNextDotKey = 1;
}
break;
case WXK_NUMPAD_ADD: k = '+';break;
case WXK_DOWN : k = K_DOWN; break;
case WXK_END : k = K_LEND; break;
@ -624,22 +651,6 @@ void TwxWindow::OnKeyDown(wxKeyEvent& e)
OnChar(e);
return;
}
} else
if (k == WXK_NUMPAD_DECIMAL)
{
static int nPoint2Comma = -883; // Valore indefinito
if (nPoint2Comma == -883) // Devo stabilire se attivare la gestione o no
{
char str[4] = { 0 };
xvt_sys_get_profile_string(NULL, "Main", "Point2Comma", "1", str, sizeof(str));
nPoint2Comma = wxStrchr("1XY", *str) ? 1 : 0; // Dis/Abilita conversione punto in virgola
}
if (nPoint2Comma)
{
e.m_keyCode = ',';
OnChar(e);
return;
}
}
e.Skip();
}
@ -1241,3 +1252,4 @@ void xvt_trayicon_destroy(WINDOW tray)
if (pTray != NULL)
delete pTray;
}