Patch level : 10.0
Files correlati : xvaga Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@17434 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
429faed747
commit
60b68debc1
@ -57,6 +57,10 @@ static BOOL GetWinVer(LPTSTR lpszVersion, int nVersionSize, int *nVersion);
|
||||
#define WNT4STR _T("Windows NT 4")
|
||||
#define W2KSTR _T("Windows 2000")
|
||||
#define WXPSTR _T("Windows XP")
|
||||
#define W2003STR _T("Windows Server 2003")
|
||||
#define WVISTASTR _T("Windows Vista")
|
||||
#define W2008STR _T("Windows Server 2008")
|
||||
#define W7STR _T("Windows 7")
|
||||
|
||||
#define WCESTR _T("Windows CE")
|
||||
|
||||
@ -64,24 +68,28 @@ static BOOL GetWinVer(LPTSTR lpszVersion, int nVersionSize, int *nVersion);
|
||||
#define WUNKNOWN 0
|
||||
|
||||
#define W9XFIRST 1
|
||||
#define W95 1
|
||||
#define W95 1
|
||||
#define W95SP1 2
|
||||
#define W95OSR2 3
|
||||
#define W98 4
|
||||
#define W98 4
|
||||
#define W98SP1 5
|
||||
#define W98SE 6
|
||||
#define WME 7
|
||||
#define W9XLAST 99
|
||||
#define W98SE 6
|
||||
#define WME 7
|
||||
#define W9XLAST 99
|
||||
|
||||
#define WNTFIRST 101
|
||||
#define WNT351 101
|
||||
#define WNT4 102
|
||||
#define W2K 103
|
||||
#define WXP 104
|
||||
#define WNT4 102
|
||||
#define W2K 103
|
||||
#define WXP 104
|
||||
#define W2003 105
|
||||
#define WVISTA 106
|
||||
#define W2008 107
|
||||
#define W7 108
|
||||
#define WNTLAST 199
|
||||
|
||||
#define WCEFIRST 201
|
||||
#define WCE 201
|
||||
#define WCE 201
|
||||
#define WCELAST 299
|
||||
|
||||
|
||||
@ -588,12 +596,9 @@ static BOOL GetWinVer(LPTSTR lpszVersion, int nVersionSize, int *pnVersion)
|
||||
_tcsncpy(lpszVersion, WUNKNOWNSTR, nVersionSize-1);
|
||||
*pnVersion = WUNKNOWN;
|
||||
|
||||
TCHAR *cp = NULL;
|
||||
|
||||
OSVERSIONINFO osinfo;
|
||||
OSVERSIONINFO osinfo; memset(&osinfo, 0, sizeof(osinfo));
|
||||
osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
|
||||
if (!GetVersionEx(&osinfo))
|
||||
if (!::GetVersionEx(&osinfo))
|
||||
return FALSE;
|
||||
|
||||
DWORD dwPlatformId = osinfo.dwPlatformId;
|
||||
@ -602,6 +607,7 @@ static BOOL GetWinVer(LPTSTR lpszVersion, int nVersionSize, int *pnVersion)
|
||||
DWORD dwBuildNumber = osinfo.dwBuildNumber & 0xFFFF; // Win 95 needs this
|
||||
TRACE(_T("%d: %d.%d.%d\n"), dwPlatformId, dwMajorVersion, dwMinorVersion, dwBuildNumber);
|
||||
|
||||
LPCTSTR cp = WUNKNOWNSTR;
|
||||
if ((dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && (dwMajorVersion == 4))
|
||||
{
|
||||
if ((dwMinorVersion < 10) && (dwBuildNumber == 950))
|
||||
@ -644,25 +650,36 @@ static BOOL GetWinVer(LPTSTR lpszVersion, int nVersionSize, int *pnVersion)
|
||||
}
|
||||
else if (dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||
{
|
||||
if ((dwMajorVersion == 3) && (dwMinorVersion == 51))
|
||||
if (dwMajorVersion == 3)
|
||||
{
|
||||
cp = WNT351STR;
|
||||
*pnVersion = WNT351;
|
||||
}
|
||||
else if ((dwMajorVersion == 4) && (dwMinorVersion == 0))
|
||||
else if (dwMajorVersion == 4)
|
||||
{
|
||||
cp = WNT4STR;
|
||||
*pnVersion = WNT4;
|
||||
}
|
||||
else if ((dwMajorVersion == 5) && (dwMinorVersion == 0))
|
||||
else if (dwMajorVersion == 5)
|
||||
{
|
||||
cp = W2KSTR;
|
||||
*pnVersion = W2K;
|
||||
switch (dwMinorVersion)
|
||||
{
|
||||
case 0: cp = W2KSTR; *pnVersion = W2K; break;
|
||||
case 1: cp = WXPSTR; *pnVersion = WXP; break;
|
||||
case 2:
|
||||
default: cp = W2003STR; *pnVersion = W2003; break;
|
||||
}
|
||||
}
|
||||
else if ((dwMajorVersion == 5) && (dwMinorVersion == 1))
|
||||
else if (dwMajorVersion == 6)
|
||||
{
|
||||
cp = WXPSTR;
|
||||
*pnVersion = WXP;
|
||||
cp = WVISTASTR;
|
||||
*pnVersion = WVISTA;
|
||||
// TBI: Windows 2008 Server
|
||||
}
|
||||
else if (dwMajorVersion >= 7)
|
||||
{
|
||||
cp = W7STR;
|
||||
*pnVersion = W7;
|
||||
}
|
||||
}
|
||||
else if (dwPlatformId == VER_PLATFORM_WIN32_CE)
|
||||
|
@ -2,7 +2,6 @@
|
||||
#ifndef __WXINC_H__
|
||||
#define __WXINC_H__
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#define __WINDOWS__
|
||||
#define __WXMSW__
|
||||
|
@ -21,10 +21,7 @@
|
||||
|
||||
#include "agasys.h"
|
||||
#include "fstrcmp.h"
|
||||
#include <limits.h>
|
||||
#include "matche.h"
|
||||
|
||||
#include "xvtpdf.h"
|
||||
#include "xvtwin.h"
|
||||
|
||||
#ifdef WIN32
|
||||
@ -227,7 +224,7 @@ wxString GetResourceIni()
|
||||
|
||||
wxString _GetResourceName(const char* type, int rid)
|
||||
{
|
||||
wxString strName; strName.Printf("%ss", type);
|
||||
wxString strName(type); strName << "s";
|
||||
wxString strKey; strKey.Printf("%d", rid);
|
||||
wxString val;
|
||||
|
||||
@ -1441,13 +1438,6 @@ static void DrawImageOnDC(wxDC& dc, TXVT_IMAGE* image, const wxRect& dst, const
|
||||
#endif
|
||||
}
|
||||
|
||||
void xvt_dwin_draw_image_on_pdf(WINDOW win, const char* name, RCT* dest)
|
||||
{
|
||||
CAST_DC(win, dc);
|
||||
const wxRect dst = NormalizeRCT(dest);
|
||||
((TwxPDFDC&)dc).DrawImage(name, dst);
|
||||
}
|
||||
|
||||
void xvt_dwin_draw_image(WINDOW win, XVT_IMAGE img, RCT* dest, RCT* source)
|
||||
{
|
||||
CAST_TIMAGE(img, image);
|
||||
@ -1900,7 +1890,7 @@ void xvt_font_destroy(XVT_FNTID font_id)
|
||||
BOOLEAN xvt_font_get_family(XVT_FNTID font_id, char* buf, long max_buf)
|
||||
{
|
||||
CAST_FONT(font_id, font);
|
||||
strncpy(buf, font.FaceName(), max_buf);
|
||||
wxStrncpy(buf, font.FaceName(), max_buf);
|
||||
buf[max_buf-1] = '\0';
|
||||
return TRUE;
|
||||
}
|
||||
@ -1998,7 +1988,7 @@ long xvt_font_serialize(XVT_FNTID font_id, char *buf, long max_buf)
|
||||
str = wxString::Format("01\\%s\\0\\%d\\WIN01/%d/%d/0/0/%d/0/0/0/0/0/0/0/0/%s",
|
||||
name, size, size, weight, italic, name);
|
||||
|
||||
strncpy(buf, str, max_buf);
|
||||
wxStrncpy(buf, str, max_buf);
|
||||
buf[max_buf-1] = '\0';
|
||||
return strlen(buf);
|
||||
}
|
||||
@ -2013,7 +2003,7 @@ void xvt_font_unmap(XVT_FNTID font_id)
|
||||
// File system
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
BOOLEAN xvt_fsys_build_pathname(char *mbs, const char *volname, const char *dirname, const char *leafroot, const char *leafext, const char* /* leafvers */)
|
||||
BOOLEAN xvt_fsys_build_pathname(char* mbs, const char* volname, const char* dirname, const char* leafroot, const char* leafext, const char* /* leafvers */)
|
||||
{
|
||||
#ifdef WIN32
|
||||
_makepath(mbs, volname, dirname, leafroot, leafext);
|
||||
@ -2037,7 +2027,7 @@ BOOLEAN xvt_fsys_build_pathname(char *mbs, const char *volname, const char *dirn
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN xvt_fsys_parse_pathname(const char *mbs, char *volname, char *dirname, char *leafroot, char *leafext, char *leafvers)
|
||||
BOOLEAN xvt_fsys_parse_pathname(const char* mbs, char* volname, char* dirname, char* leafroot, char* leafext, char* leafvers)
|
||||
{
|
||||
wxString volume, path, file, ext;
|
||||
wxFileName::SplitPath(mbs, &volume, &path, &file, &ext);
|
||||
@ -2067,18 +2057,27 @@ BOOLEAN xvt_fsys_parse_pathname(const char *mbs, char *volname, char *dirname, c
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOLEAN xvt_fsys_convert_dir_to_str(DIRECTORY *dirp, char *path, int sz_path)
|
||||
BOOLEAN xvt_fsys_convert_dir_to_str(DIRECTORY* dirp, char* path, int sz_path)
|
||||
{
|
||||
wxStrncpy(path, dirp->path, sz_path);
|
||||
path[sz_path-1] = '\0';
|
||||
return TRUE;
|
||||
BOOLEAN ok = path != NULL && dirp != NULL;
|
||||
if (ok)
|
||||
{
|
||||
wxStrncpy(path, dirp->path, sz_path-1);
|
||||
path[sz_path-1] = '\0';
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
BOOLEAN xvt_fsys_convert_str_to_dir(const char *path, DIRECTORY *dirp)
|
||||
{
|
||||
if (dirp != NULL)
|
||||
strcpy(dirp->path, path);
|
||||
return dirp != NULL;
|
||||
BOOLEAN ok = path != NULL && dirp != NULL;
|
||||
if (ok)
|
||||
{
|
||||
const int sz = sizeof(dirp->path)-1;
|
||||
wxStrncpy(dirp->path, path, sz);
|
||||
dirp->path[sz] = '\0';
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
BOOLEAN xvt_fsys_convert_fspec_to_str(const FILE_SPEC *fs, char *path, int sz_path)
|
||||
@ -3009,7 +3008,7 @@ 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);
|
||||
strncpy(s, str, sz_s);
|
||||
wxStrncpy(s, str, sz_s);
|
||||
s[sz_s-1] = '\0';
|
||||
return s;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ XVTDLL BOOLEAN xvt_print_set_default_device(const char* name);
|
||||
XVTDLL BOOLEAN xvt_print_get_default_device(char* name, int namesize);
|
||||
XVTDLL BOOLEAN xvt_print_suspend_thread();
|
||||
XVTDLL BOOLEAN xvt_print_restart_thread();
|
||||
XVTDLL BOOLEAN xvt_print_is_pdf(PRINT_RCD* precp);
|
||||
XVTDLL BOOLEAN xvt_print_is_pdf(const PRINT_RCD* precp);
|
||||
XVTDLL BOOLEAN xvt_print_pdf_version(char* version, int size);
|
||||
|
||||
XVTDLL int xvt_rect_get_height(RCT *rctp);
|
||||
@ -442,6 +442,7 @@ 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);
|
||||
XVTDLL BOOLEAN xvt_odbc_free_connection(XVT_ODBC handle);
|
||||
XVTDLL ULONG xvt_odbc_execute(XVT_ODBC handle, const char* sql, ODBC_CALLBACK cb, void* jolly);
|
||||
XVTDLL BOOLEAN xvt_odbc_driver(XVT_ODBC handle, char* str, int max_size);
|
||||
|
||||
XVTDLL BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
|
||||
const char* subject, const char* msg, const char* attach, BOOLEAN ui);
|
||||
|
@ -151,7 +151,6 @@ class TwxOutlookBar : public wxVListBox
|
||||
TwxOutlookItem m_item[MAX_ITEMS];
|
||||
bool m_bCaptured;
|
||||
int m_nHovering;
|
||||
wxColour m_clrLite, m_clrDark;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
@ -165,7 +164,6 @@ protected:
|
||||
|
||||
public:
|
||||
int Add(short nIconId, const wxString strText, int nFlags);
|
||||
void SetColors(const XVT_COLOR_COMPONENT* colors);
|
||||
|
||||
TwxOutlookBar(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
||||
~TwxOutlookBar();
|
||||
@ -254,7 +252,6 @@ WINDOW xvt_ctl_create_def(WIN_DEF* win_def_p, WINDOW parent_win, long app_data)
|
||||
long style = 0;
|
||||
TwxOutlookBar* tob = new TwxOutlookBar(pParent, id, rct.GetPosition(), rct.GetSize(), style);
|
||||
win = (WINDOW)tob;
|
||||
tob->SetColors(win_def_p->ctlcolors);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -291,11 +288,11 @@ WINDOW xvt_ctl_create_def(WIN_DEF* win_def_p, WINDOW parent_win, long app_data)
|
||||
break;
|
||||
case XVT_COLOR_BACKGROUND:
|
||||
if (win_def_p->wtype == WC_PUSHBUTTON)
|
||||
w.SetBackgroundColour(rgb);
|
||||
w.SetOwnBackgroundColour(rgb);
|
||||
break;
|
||||
case XVT_COLOR_BLEND:
|
||||
if (win_def_p->wtype != WC_PUSHBUTTON)
|
||||
w.SetBackgroundColour(rgb);
|
||||
w.SetOwnBackgroundColour(rgb);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@ -1251,8 +1248,17 @@ void TwxOutlookBar::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) con
|
||||
}
|
||||
else
|
||||
{
|
||||
color1 = m_clrLite;
|
||||
color2 = m_clrDark;
|
||||
if (InheritsBackgroundColour())
|
||||
{
|
||||
color1 = ModulateColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION), +20);
|
||||
color2 = ModulateColour(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION), -20);
|
||||
}
|
||||
else
|
||||
{
|
||||
const wxColour bkg = GetBackgroundColour();
|
||||
color1 = ModulateColour(bkg, +20);
|
||||
color2 = ModulateColour(bkg, -20);
|
||||
}
|
||||
}
|
||||
}
|
||||
dc.GradientFillLinear(rect, color1, color2, wxDOWN);
|
||||
@ -1394,49 +1400,11 @@ static bool AreSystemColors(const XVT_COLOR_COMPONENT* colors)
|
||||
return yes;
|
||||
}
|
||||
|
||||
void TwxOutlookBar::SetColors(const XVT_COLOR_COMPONENT* colors)
|
||||
{
|
||||
if (AreSystemColors(colors))
|
||||
{
|
||||
m_clrLite = ModulateColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION), +20);
|
||||
m_clrDark = ModulateColour(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION), -20);
|
||||
}
|
||||
else
|
||||
{
|
||||
int nFound = 0;
|
||||
wxColour lite, dark, back;
|
||||
for (int c = 0; colors[c].type; c++)
|
||||
{
|
||||
CAST_COLOR(colors[c].color, rgb);
|
||||
switch(colors[c].type)
|
||||
{
|
||||
case XVT_COLOR_BLEND : lite = rgb; nFound |= 1; break;
|
||||
case XVT_COLOR_BORDER : dark = rgb; nFound |= 2; break;
|
||||
case XVT_COLOR_BACKGROUND : back = rgb; nFound |= 4; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
switch (nFound)
|
||||
{
|
||||
case 0x1: m_clrLite = lite; m_clrDark = ModulateColour(lite, -40); break;
|
||||
case 0x2: m_clrLite = ModulateColour(dark, 40); m_clrDark = dark; break;
|
||||
case 0x3: m_clrLite = lite; m_clrDark = dark; break;
|
||||
case 0x4: m_clrLite = ModulateColour(back, 20); m_clrDark = ModulateColour(back, -20); break;
|
||||
case 0x5: m_clrLite = MeanColour(back, lite); m_clrDark = ModulateColour(back, -20); break;
|
||||
case 0x6: m_clrLite = ModulateColour(back, 20); m_clrDark = MeanColour(back, dark); break;
|
||||
case 0x7: m_clrLite = MeanColour(back, lite); m_clrDark = MeanColour(back, dark); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TwxOutlookBar::TwxOutlookBar(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxVListBox(parent, id, pos, size, style),
|
||||
m_bCaptured(false), m_nHovering(wxNOT_FOUND)
|
||||
: wxVListBox(parent, id, pos, size, style), m_bCaptured(false), m_nHovering(wxNOT_FOUND)
|
||||
{
|
||||
SetItemCount(0);
|
||||
SetColors(NULL); // Set default colors
|
||||
}
|
||||
|
||||
TwxOutlookBar::~TwxOutlookBar()
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "wxinc.h"
|
||||
#include "wx/print.h"
|
||||
#include "wx/printdlg.h"
|
||||
|
||||
#include "xvt.h"
|
||||
|
||||
@ -117,7 +116,7 @@ public:
|
||||
bool HasBadDriver() const { return m_bBadDriver; }
|
||||
|
||||
wxString PrinterName() const;
|
||||
bool IsPDF() const { return !HasBadDriver() && xvt_print_is_pdf((PRINT_RCD *)m_prcd) != 0; }
|
||||
bool IsPDF() const { return !HasBadDriver() && xvt_print_is_pdf(m_prcd) != 0; }
|
||||
|
||||
void InitDC(const TPRINT_RCD* prcd, const char* title);
|
||||
TwxPrintOut(const TPRINT_RCD* prcd = NULL);
|
||||
@ -214,7 +213,6 @@ wxDC* TwxPrintOut::CreateDC(const TPRINT_RCD* prcd, const char* title)
|
||||
if (s.x > 0)
|
||||
SetPPIPrinter(s.x, s.y);
|
||||
|
||||
|
||||
s = dc->GetSize();
|
||||
if (s.x > 0)
|
||||
SetPageSizePixels(s.x, s.y);
|
||||
@ -244,7 +242,7 @@ void TwxPrintOut::InitDC(const TPRINT_RCD* prcd, const char* title)
|
||||
wxDC* dc = CreateDC(prcd, title);
|
||||
|
||||
wxSize s = dc->GetPPI();
|
||||
if (s.x >0)
|
||||
if (s.x > 0)
|
||||
SetPPIPrinter(s.x, s.y);
|
||||
|
||||
s = dc->GetSize();
|
||||
@ -413,28 +411,17 @@ BOOLEAN xvt_app_escape(int esc_code, PRINT_RCD* rcd, long* ph, long* pw, long* p
|
||||
case XVT_ESC_SET_PRINTER_INFO:
|
||||
if (xvt_print_is_valid(rcd) && ph != NULL && pw != NULL)
|
||||
{
|
||||
TPRINT_RCD* prcd = (TPRINT_RCD*)rcd;
|
||||
wxPrintData data;
|
||||
|
||||
TPRINT_RCD* prcd = (TPRINT_RCD*)rcd;
|
||||
#ifdef WIN32
|
||||
|
||||
RCD2data(prcd, data);
|
||||
|
||||
data.SetOrientation(*ph > *pw ? 1 : 2);
|
||||
data.ConvertToNative();
|
||||
|
||||
data2RCD(data, prcd);
|
||||
|
||||
#else
|
||||
RCD2data(prcd, data);
|
||||
data.SetOrientation(*ph > *pw ? 1 : 2);
|
||||
data2RCD(data, prcd);
|
||||
#endif
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -463,6 +450,14 @@ BOOLEAN xvt_dm_post_page_setup(PRINT_RCD* precp)
|
||||
return ok;
|
||||
}
|
||||
|
||||
void xvt_dwin_draw_image_on_pdf(WINDOW win, const char* name, RCT* dest)
|
||||
{
|
||||
wxASSERT(win == PRINTER_WIN);
|
||||
const wxRect dst = NormalizeRCT(dest);
|
||||
TwxPDFDC& dc = *wxStaticCast(&GetTDCMapper().GetDC(win), TwxPDFDC);
|
||||
dc.DrawImage(name, dst);
|
||||
}
|
||||
|
||||
long xvt_fmap_get_family_sizes(PRINT_RCD *precp, char *family, long *size_array, BOOLEAN *scalable, long max_sizes)
|
||||
{
|
||||
long size = 0;
|
||||
@ -552,7 +547,7 @@ int xvt_print_set_name(PRINT_RCD* precp, const char* name)
|
||||
wxString n = name;
|
||||
|
||||
#ifdef WIN32
|
||||
strncpy(((char*)precp) + 4, name, 32);
|
||||
wxStrncpy(((char*)precp) + 4, name, 32);
|
||||
#else
|
||||
TPRINT_RCD* rcd = (TPRINT_RCD*)precp;
|
||||
wxPrintData data;
|
||||
@ -622,7 +617,8 @@ WINDOW xvt_print_create_win(PRINT_RCD* precp, const char* title)
|
||||
|
||||
void xvt_print_destroy(PRINT_RCD* precp)
|
||||
{
|
||||
delete precp;
|
||||
if (precp != NULL)
|
||||
delete precp;
|
||||
}
|
||||
|
||||
RCT* xvt_print_get_next_band(void)
|
||||
@ -644,7 +640,7 @@ RCT* xvt_print_get_next_band(void)
|
||||
return &rct;
|
||||
}
|
||||
|
||||
BOOLEAN xvt_print_is_pdf(PRINT_RCD* precp)
|
||||
BOOLEAN xvt_print_is_pdf(const PRINT_RCD* precp)
|
||||
{
|
||||
char strName[MAX_PATH];
|
||||
xvt_print_get_name(precp, strName, sizeof(strName));
|
||||
@ -725,29 +721,41 @@ BOOLEAN xvt_print_open(void)
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void CreateAbortWindow()
|
||||
class TwxPrintAbortDialog : public wxPrintAbortDialog
|
||||
{
|
||||
wxFrame* parent = (wxFrame*)TASK_WIN;
|
||||
wxString strCaption = wxT("Stampa");
|
||||
wxString strPrompt = strCaption + wxT(" in corso...");
|
||||
wxPrintAbortDialog* win = new wxPrintAbortDialog(parent, strCaption,
|
||||
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE);
|
||||
public:
|
||||
void Pulse();
|
||||
TwxPrintAbortDialog();
|
||||
};
|
||||
|
||||
void TwxPrintAbortDialog::Pulse()
|
||||
{
|
||||
wxGauge* pGauge = wxStaticCast(FindWindow(wxID_FORWARD), wxGauge);
|
||||
pGauge->Pulse();
|
||||
}
|
||||
|
||||
TwxPrintAbortDialog::TwxPrintAbortDialog()
|
||||
: wxPrintAbortDialog(NULL, wxT("Stampa"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
||||
{
|
||||
wxBoxSizer *button_sizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
button_sizer->Add(new wxStaticText( win, wxID_STATIC, strPrompt, wxDefaultPosition, wxSize(320,-1)), 0, wxALL, 10 );
|
||||
button_sizer->Add( new wxButton( win, wxID_CANCEL, wxT("Annulla") ), 0, wxALL | wxALIGN_CENTER, 10 );
|
||||
button_sizer->Add(new wxStaticText(this, wxID_STATIC, wxT("Stampa in corso..."), wxDefaultPosition, wxSize(320,-1)), 0, wxALL, 10 );
|
||||
button_sizer->Add(new wxGauge(this, wxID_FORWARD, 1, wxDefaultPosition, wxSize(320,-1)), 0, wxALL, 10 );
|
||||
button_sizer->Add(new wxButton(this, wxID_CANCEL, wxT("Annulla") ), 0, wxALL | wxALIGN_CENTER, 10 );
|
||||
|
||||
win->SetAutoLayout(true);
|
||||
win->SetSizer(button_sizer);
|
||||
SetAutoLayout(true);
|
||||
SetSizer(button_sizer);
|
||||
|
||||
button_sizer->Fit(win);
|
||||
button_sizer->SetSizeHints(win);
|
||||
button_sizer->Fit(this);
|
||||
button_sizer->SetSizeHints(this);
|
||||
|
||||
win->Show();
|
||||
win->Update();
|
||||
Show();
|
||||
Update();
|
||||
}
|
||||
|
||||
wxPrinterBase::sm_abortWindow = win;
|
||||
void CreateAbortWindow()
|
||||
{
|
||||
wxPrinterBase::sm_abortWindow = new TwxPrintAbortDialog;
|
||||
}
|
||||
|
||||
void DestroyAbortWindow()
|
||||
@ -767,15 +775,13 @@ BOOLEAN xvt_print_start_thread(BOOLEAN(*print_fcn)(long), long data)
|
||||
const wxString strDir = ::wxGetCwd(); // Memorizzo la directory corrente (Acrobat la cambia)
|
||||
|
||||
wxBeginBusyCursor();
|
||||
|
||||
m_PrintoutCache.Reset(); // Forza nuovo contesto di stampa
|
||||
TwxPrintOut& po = m_PrintoutCache.Get(NULL);
|
||||
m_PrintoutCache.Lock();
|
||||
wxEndBusyCursor();
|
||||
|
||||
CreateAbortWindow();
|
||||
|
||||
const BOOLEAN aborted = print_fcn(data);
|
||||
const BOOLEAN aborted = print_fcn(data);
|
||||
DestroyAbortWindow();
|
||||
|
||||
po.OnEndDocument();
|
||||
@ -823,6 +829,11 @@ BOOLEAN xvt_print_open_page(PRINT_RCD* precp)
|
||||
TwxPrintOut& po = m_PrintoutCache.Get(NULL);
|
||||
po.GetDC()->StartPage();
|
||||
TPrintDC::SetPageStart(); // Flag per azzeramento dati DC
|
||||
|
||||
// Aggiorna barra di attesa
|
||||
TwxPrintAbortDialog* pad = wxDynamicCast(wxPrinterBase::sm_abortWindow, TwxPrintAbortDialog);
|
||||
if (pad != NULL)
|
||||
pad->Pulse();
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
@ -852,19 +863,6 @@ SLIST xvt_print_list_devices()
|
||||
{
|
||||
SLIST list = xvt_slist_create();
|
||||
#ifdef WIN32
|
||||
/* Vecchio modo oblsoleto
|
||||
char buf[4096]; memset(buf, 0, sizeof(buf));
|
||||
GetProfileString("devices", NULL, "", buf, sizeof(buf));
|
||||
int start = 0;
|
||||
for (int i = 0; i < sizeof(buf); i++) if (buf[i] == '\0')
|
||||
{
|
||||
const char* pname = buf+start;
|
||||
if (*pname == '\0')
|
||||
break;
|
||||
xvt_slist_add_at_elt(list, NULL, pname, NULL);
|
||||
start = i+1;
|
||||
} */
|
||||
|
||||
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;
|
||||
@ -1159,3 +1157,4 @@ BOOLEAN xvt_fsys_file_md5(const char* path, char* outstr)
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,15 @@
|
||||
#include "wxinc.h"
|
||||
#include <wx/db.h>
|
||||
|
||||
#include "xvt.h"
|
||||
|
||||
#if wxUSE_ODBC
|
||||
|
||||
#include <wx/db.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TwxConnectionDlg
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TwxConnectionDlg : public wxDialog
|
||||
{
|
||||
protected:
|
||||
@ -42,13 +47,17 @@ TwxConnectionDlg::TwxConnectionDlg() : wxDialog(NULL, wxID_ANY, "ODBC",
|
||||
wxSizer* ctlButtonSizer = CreateButtonSizer(wxOK | wxCANCEL);
|
||||
|
||||
wxBoxSizer* ctlTopSizer = new wxBoxSizer(wxVERTICAL);
|
||||
ctlTopSizer ->Add(ctlTextSizer, 0, wxALIGN_CENTER);
|
||||
ctlTopSizer ->Add(ctlButtonSizer, 0, wxALIGN_CENTER);
|
||||
ctlTopSizer->Add(ctlTextSizer, 0, wxALIGN_CENTER);
|
||||
ctlTopSizer->Add(ctlButtonSizer, 0, wxALIGN_CENTER);
|
||||
|
||||
SetSizer(ctlTopSizer);
|
||||
ctlTopSizer->SetSizeHints(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// xvt_odbc_...
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
XVT_ODBC xvt_odbc_get_connection(const char* dsn, const char* usr, const char* pwd, const char* dir)
|
||||
{
|
||||
wxString strDsn(dsn), strUsr(usr), strPwd(pwd), strDir(dir);
|
||||
@ -100,7 +109,6 @@ ULONG xvt_odbc_execute(XVT_ODBC handle, const char* sql, ODBC_CALLBACK cb, void*
|
||||
if (handle && sql && *sql)
|
||||
{
|
||||
wxDb* db = (wxDb*)handle;
|
||||
|
||||
if (cb != NULL) // Ho una vera callback?
|
||||
{
|
||||
wxDbColInf* columns = NULL;
|
||||
@ -197,6 +205,18 @@ ULONG xvt_odbc_execute(XVT_ODBC handle, const char* sql, ODBC_CALLBACK cb, void*
|
||||
return nCount;
|
||||
}
|
||||
|
||||
BOOLEAN xvt_odbc_driver(XVT_ODBC handle, char* str, int max_size)
|
||||
{
|
||||
if (handle != NULL)
|
||||
{
|
||||
const wxDb* db = (const wxDb*)handle;
|
||||
wxStrncpy(str, db->dbInf.driverName, max_size);
|
||||
}
|
||||
else
|
||||
wxStrncpy(str, "ODBC 2.0", max_size);
|
||||
return handle != NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
XVT_ODBC xvt_odbc_get_connection(const char* dsn, const char* usr, const char* pwd, const char* dir)
|
||||
@ -206,14 +226,12 @@ XVT_ODBC xvt_odbc_get_connection(const char* dsn, const char* usr, const char* p
|
||||
}
|
||||
|
||||
BOOLEAN xvt_odbc_free_connection(XVT_ODBC handle)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
{ return FALSE; }
|
||||
|
||||
ULONG xvt_odbc_execute(XVT_ODBC handle, const char* sql, ODBC_CALLBACK cb, void* jolly)
|
||||
{
|
||||
{ return 0; }
|
||||
|
||||
return 0;
|
||||
}
|
||||
BOOLEAN xvt_odbc_driver(XVT_ODBC handle, char* str, int max_size)
|
||||
{ return FALSE; }
|
||||
|
||||
#endif
|
@ -1,15 +1,7 @@
|
||||
#include "wxinc.h"
|
||||
#include "xvtpdf.h"
|
||||
|
||||
#include "wx/log.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/paper.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/dcmemory.h"
|
||||
|
||||
#include "XFont.h"
|
||||
#include <math.h>
|
||||
#include "xvtpdf.h"
|
||||
|
||||
#define RAD2DEG 57.29577951308
|
||||
#define BEZIERK 0.55228475
|
||||
@ -19,53 +11,31 @@ IMPLEMENT_DYNAMIC_CLASS(TwxPDFDC, wxDC)
|
||||
|
||||
//-- Contructor and Destructor -------------------------------------------
|
||||
|
||||
TwxPDFDC::TwxPDFDC ()
|
||||
TwxPDFDC::TwxPDFDC()
|
||||
{
|
||||
m_pageNumber = 0;
|
||||
m_topDown = true;
|
||||
m_clipping = false;
|
||||
m_pageopen = false;
|
||||
|
||||
m_ok = FALSE;
|
||||
|
||||
for(int i=0;i<PDF_IMG_CACHE_SIZE;i++)
|
||||
{
|
||||
m_filenames[i] = "";
|
||||
m_handles[i] = 0;
|
||||
}
|
||||
m_cacheidx = 0;
|
||||
|
||||
if ((m_PDFlib = PDF_new_dl(&m_p)) == (PDFlib_api *) NULL)
|
||||
{
|
||||
wxLogError( _("Cannot create PDFlib object (DLL not found?)\n"));
|
||||
m_ok = FALSE;
|
||||
}
|
||||
wxASSERT(false); // Dummy constructor!
|
||||
}
|
||||
|
||||
TwxPDFDC::TwxPDFDC (const wxPrintData& printData, const char* strFilename)
|
||||
TwxPDFDC::TwxPDFDC (const wxPrintData& printData, const char* strFilename)
|
||||
: m_PDFlib(NULL), m_p(NULL)
|
||||
{
|
||||
m_pageNumber = 0;
|
||||
m_topDown = true;
|
||||
m_clipping = false;
|
||||
m_pageopen = false;
|
||||
|
||||
m_printData = printData;
|
||||
m_fileName = strFilename;
|
||||
|
||||
m_ok = TRUE;
|
||||
|
||||
for(int i=0;i<PDF_IMG_CACHE_SIZE;i++)
|
||||
for(int i=0; i < PDF_IMG_CACHE_SIZE; i++)
|
||||
{
|
||||
m_filenames[i] = "";
|
||||
m_handles[i] = 0;
|
||||
}
|
||||
m_cacheidx = 0;
|
||||
|
||||
if ((m_PDFlib = PDF_new_dl(&m_p)) == (PDFlib_api *) NULL)
|
||||
{
|
||||
m_PDFlib = PDF_new_dl(&m_p);
|
||||
m_ok = m_PDFlib != NULL;
|
||||
if (!m_ok)
|
||||
wxLogError( _("Cannot create PDFlib object (DLL not found?)\n"));
|
||||
m_ok = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
TwxPDFDC::~TwxPDFDC ()
|
||||
@ -77,9 +47,7 @@ TwxPDFDC::~TwxPDFDC ()
|
||||
//-- Status --------------------------------------------------------------
|
||||
|
||||
bool TwxPDFDC::Ok() const
|
||||
{
|
||||
return m_ok;
|
||||
}
|
||||
{ return m_ok; }
|
||||
|
||||
//-- Document and Pages --------------------------------------------------
|
||||
|
||||
@ -90,8 +58,8 @@ bool TwxPDFDC::StartDoc( const wxString& message )
|
||||
if (m_PDFlib->PDF_begin_document(m_p, m_fileName, 0, "") == -1)
|
||||
{
|
||||
wxLogError( _("Cannot open file for PDF printing!"));
|
||||
m_ok = FALSE;
|
||||
return FALSE;
|
||||
m_ok = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
PDF_TRY_DL(m_PDFlib, m_p)
|
||||
@ -103,13 +71,13 @@ bool TwxPDFDC::StartDoc( const wxString& message )
|
||||
PDF_CATCH_DL(m_PDFlib, m_p)
|
||||
{
|
||||
wxLogError("%s: %s", m_PDFlib->PDF_get_apiname(m_p), m_PDFlib->PDF_get_errmsg(m_p));
|
||||
m_ok = FALSE;
|
||||
m_ok = false;
|
||||
}
|
||||
|
||||
m_pageNumber = 0;
|
||||
|
||||
m_ok = TRUE;
|
||||
return TRUE;
|
||||
m_ok = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void TwxPDFDC::EndDoc ()
|
||||
@ -125,7 +93,7 @@ void TwxPDFDC::EndDoc ()
|
||||
PDF_CATCH_DL(m_PDFlib, m_p)
|
||||
{
|
||||
wxLogError("%s: %s", m_PDFlib->PDF_get_apiname(m_p), m_PDFlib->PDF_get_errmsg(m_p));
|
||||
m_ok = FALSE;
|
||||
m_ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,7 +121,7 @@ void TwxPDFDC::StartPage()
|
||||
PDF_CATCH_DL(m_PDFlib, m_p)
|
||||
{
|
||||
wxLogError("%s: %s", m_PDFlib->PDF_get_apiname(m_p), m_PDFlib->PDF_get_errmsg(m_p));
|
||||
m_ok = FALSE;
|
||||
m_ok = false;
|
||||
}
|
||||
|
||||
SetBrush(*wxBLACK_BRUSH);
|
||||
@ -181,7 +149,7 @@ void TwxPDFDC::EndPage()
|
||||
PDF_CATCH_DL(m_PDFlib, m_p)
|
||||
{
|
||||
wxLogError("%s: %s", m_PDFlib->PDF_get_apiname(m_p), m_PDFlib->PDF_get_errmsg(m_p));
|
||||
m_ok = FALSE;
|
||||
m_ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1198,6 +1166,5 @@ void TwxPDFDC::DestroyClippingRegion()
|
||||
}
|
||||
}
|
||||
wxDC::DestroyClippingRegion();
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
#ifndef __XVTPDF_H
|
||||
#define __XVTPDF_H
|
||||
|
||||
#ifndef PDFLIB_H
|
||||
struct PDF_c {};
|
||||
#include "../pdf/pdflib/pdflibdl.h"
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TwxPDFDC
|
||||
@ -9,11 +12,12 @@
|
||||
|
||||
class TwxPDFDC : public wxDC
|
||||
{
|
||||
enum { PDF_IMG_CACHE_SIZE = 5 };
|
||||
enum { PDF_IMG_CACHE_SIZE = 4 };
|
||||
|
||||
protected:
|
||||
TwxPDFDC(); // Dummy constructor for dynamic construction
|
||||
|
||||
public:
|
||||
TwxPDFDC();
|
||||
|
||||
// Recommended constructor
|
||||
TwxPDFDC(const wxPrintData& data, const char* strFilename);
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
// Utilities
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
wxHashTable _nice_windows;
|
||||
wxFrame* _task_win = NULL;
|
||||
wxHashTable _nice_windows;
|
||||
wxFrame* _task_win = NULL;
|
||||
EVENT_HANDLER _task_win_handler = NULL;
|
||||
|
||||
wxRect NormalizeRCT(const RCT* prct)
|
||||
|
Loading…
x
Reference in New Issue
Block a user