Patch level : 10.0
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Aggiunte funzione per rilevazione versione PDF git-svn-id: svn://10.65.10.50/trunk@17357 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1c326244ca
commit
7b0752408c
@ -276,6 +276,7 @@ XVTDLL BOOLEAN xvt_print_get_default_device(char* name, int namesize);
|
|||||||
XVTDLL BOOLEAN xvt_print_suspend_thread();
|
XVTDLL BOOLEAN xvt_print_suspend_thread();
|
||||||
XVTDLL BOOLEAN xvt_print_restart_thread();
|
XVTDLL BOOLEAN xvt_print_restart_thread();
|
||||||
XVTDLL BOOLEAN xvt_print_is_pdf(PRINT_RCD* precp);
|
XVTDLL BOOLEAN xvt_print_is_pdf(PRINT_RCD* precp);
|
||||||
|
XVTDLL BOOLEAN xvt_print_pdf_version(char* version, int size);
|
||||||
|
|
||||||
XVTDLL int xvt_rect_get_height(RCT *rctp);
|
XVTDLL int xvt_rect_get_height(RCT *rctp);
|
||||||
XVTDLL int xvt_rect_get_width(RCT *rctp);
|
XVTDLL int xvt_rect_get_width(RCT *rctp);
|
||||||
|
@ -45,7 +45,7 @@ const wxBitmap& _GetToolResource(int nIcon, int nDesiredSize)
|
|||||||
if (nDesiredSize < 16) nDesiredSize = 16; else
|
if (nDesiredSize < 16) nDesiredSize = 16; else
|
||||||
if (nDesiredSize > 128) nDesiredSize = 128;
|
if (nDesiredSize > 128) nDesiredSize = 128;
|
||||||
const long nCode = 1000*nIcon + nDesiredSize;
|
const long nCode = 1000*nIcon + nDesiredSize;
|
||||||
wxBitmap* bmp = (wxBitmap*)_tool_icons.Get(nCode);
|
wxBitmap* bmp = wxDynamicCast(_tool_icons.Get(nCode), wxBitmap);
|
||||||
if (bmp == NULL)
|
if (bmp == NULL)
|
||||||
{
|
{
|
||||||
const int nIco[] = { nIcon, 100, ICON_RSRC, 0 };
|
const int nIco[] = { nIcon, 100, ICON_RSRC, 0 };
|
||||||
@ -1407,18 +1407,30 @@ BOOLEAN xvt_list_set_sel(WINDOW win, int index, BOOLEAN select)
|
|||||||
// ToolBar
|
// ToolBar
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class TwxToolBar : public wxToolBar
|
#if wxCHECK_VERSION(2,9,0)
|
||||||
|
#include <wx/aui/auibar.h>
|
||||||
|
#define TwxToolBarBase wxAuiToolBar
|
||||||
|
#else
|
||||||
|
#define TwxToolBarBase wxToolBar
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class TwxToolBar : public TwxToolBarBase
|
||||||
{
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(TwxToolBar)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
void OnTool(wxCommandEvent& evt);
|
void OnTool(wxCommandEvent& evt);
|
||||||
|
TwxToolBar() : TwxToolBarBase(NULL, wxID_ANY) { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TwxToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
TwxToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
||||||
const wxSize& size, long style);
|
const wxSize& size, long style);
|
||||||
};
|
};
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(TwxToolBar, wxToolBar)
|
IMPLEMENT_DYNAMIC_CLASS(TwxToolBar, TwxToolBarBase)
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(TwxToolBar, TwxToolBarBase)
|
||||||
EVT_TOOL(wxID_ANY, TwxToolBar::OnTool)
|
EVT_TOOL(wxID_ANY, TwxToolBar::OnTool)
|
||||||
END_EVENT_TABLE();
|
END_EVENT_TABLE();
|
||||||
|
|
||||||
@ -1435,29 +1447,34 @@ void TwxToolBar::OnTool(wxCommandEvent& evt)
|
|||||||
|
|
||||||
TwxToolBar::TwxToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
TwxToolBar::TwxToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
||||||
const wxSize& size, long style)
|
const wxSize& size, long style)
|
||||||
: wxToolBar(parent, id, pos, size, style)
|
: TwxToolBarBase(parent, id, pos, size, style)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
static wxToolBar* Win2Bar(WINDOW win)
|
static TwxToolBar* Win2Bar(WINDOW win)
|
||||||
{
|
{
|
||||||
return wxDynamicCast((wxWindow*)win, wxToolBar);
|
return wxDynamicCast((wxObject*)win, TwxToolBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN xvt_toolbar_add_control(WINDOW win, int cid, TOOL_TYPE type, const char *title,
|
BOOLEAN xvt_toolbar_add_control(WINDOW win, int cid, TOOL_TYPE type, const char *title,
|
||||||
int ico, int cust_width, int idx)
|
int ico, int cust_width, int idx)
|
||||||
{
|
{
|
||||||
BOOLEAN ok = FALSE;
|
BOOLEAN ok = FALSE;
|
||||||
wxToolBar* ptb = Win2Bar(win);
|
TwxToolBar* ptb = Win2Bar(win);
|
||||||
if (ptb != NULL)
|
if (ptb != NULL)
|
||||||
{
|
{
|
||||||
wxToolBar& tb = *ptb;
|
TwxToolBar& tb = *ptb;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case TOOL_SEPARATOR:
|
case TOOL_SEPARATOR:
|
||||||
|
#ifdef wxAuiToolBar
|
||||||
|
tb.AddSeparator();
|
||||||
|
ok = idx < 0;
|
||||||
|
#else
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
ok = tb.AddSeparator() != NULL;
|
ok = tb.AddSeparator() != NULL;
|
||||||
else
|
else
|
||||||
ok = tb.InsertSeparator(idx) != NULL;
|
ok = tb.InsertSeparator(idx) != NULL;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -1482,10 +1499,16 @@ BOOLEAN xvt_toolbar_add_control(WINDOW win, int cid, TOOL_TYPE type, const char
|
|||||||
if (acc >= 'A' && acc <= 'Z')
|
if (acc >= 'A' && acc <= 'Z')
|
||||||
tip << "\n(Alt+" << acc << ")";
|
tip << "\n(Alt+" << acc << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef wxAuiToolBar
|
||||||
|
tb.AddTool(cid, cap, bmp, wxNullBitmap, wxItemKind(type), tip, tip, NULL);
|
||||||
|
ok = idx < 0;
|
||||||
|
#else
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
ok = tb.AddTool(cid, cap, bmp, wxNullBitmap, wxItemKind(type), tip) != NULL;
|
ok = tb.AddTool(cid, cap, bmp, wxNullBitmap, wxItemKind(type), tip) != NULL;
|
||||||
else
|
else
|
||||||
ok = tb.InsertTool(idx, cid, cap, bmp, wxNullBitmap, wxItemKind(type), tip) != NULL;
|
ok = tb.InsertTool(idx, cid, cap, bmp, wxNullBitmap, wxItemKind(type), tip) != NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1495,6 +1518,25 @@ BOOLEAN xvt_toolbar_add_control(WINDOW win, int cid, TOOL_TYPE type, const char
|
|||||||
|
|
||||||
WINDOW xvt_toolbar_create(int cid, int left, int top, int right, int bottom, long nFlags, WINDOW parent)
|
WINDOW xvt_toolbar_create(int cid, int left, int top, int right, int bottom, long nFlags, WINDOW parent)
|
||||||
{
|
{
|
||||||
|
#ifdef wxAuiToolBar
|
||||||
|
long nStyle = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_GRIPPER;
|
||||||
|
if (nFlags & CTL_FLAG_PASSWORD)
|
||||||
|
nStyle |= wxAUI_TB_TEXT;
|
||||||
|
|
||||||
|
const wxPoint ptPos(left, top);
|
||||||
|
wxSize szSize(right-left, bottom-top);
|
||||||
|
|
||||||
|
int nIcoSize = 24;
|
||||||
|
if (bottom > 0)
|
||||||
|
{
|
||||||
|
nIcoSize = RoundToIcon(szSize.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nStyle |= wxAUI_TB_VERTICAL;
|
||||||
|
nIcoSize = RoundToIcon(szSize.x);
|
||||||
|
}
|
||||||
|
#else
|
||||||
long nStyle = wxNO_BORDER | wxTB_NODIVIDER;
|
long nStyle = wxNO_BORDER | wxTB_NODIVIDER;
|
||||||
if (nFlags & CTL_FLAG_PASSWORD)
|
if (nFlags & CTL_FLAG_PASSWORD)
|
||||||
nStyle |= wxTB_TEXT | wxTB_FLAT;
|
nStyle |= wxTB_TEXT | wxTB_FLAT;
|
||||||
@ -1513,6 +1555,7 @@ WINDOW xvt_toolbar_create(int cid, int left, int top, int right, int bottom, lon
|
|||||||
nStyle |= wxTB_VERTICAL;
|
nStyle |= wxTB_VERTICAL;
|
||||||
nIcoSize = RoundToIcon(szSize.x);
|
nIcoSize = RoundToIcon(szSize.x);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TwxToolBar* tb = new TwxToolBar((wxWindow*)parent, cid, ptPos, wxDefaultSize, nStyle);
|
TwxToolBar* tb = new TwxToolBar((wxWindow*)parent, cid, ptPos, wxDefaultSize, nStyle);
|
||||||
tb->SetToolBitmapSize(wxSize(nIcoSize, nIcoSize));
|
tb->SetToolBitmapSize(wxSize(nIcoSize, nIcoSize));
|
||||||
@ -1521,7 +1564,7 @@ WINDOW xvt_toolbar_create(int cid, int left, int top, int right, int bottom, lon
|
|||||||
|
|
||||||
void xvt_toolbar_enable_control(WINDOW win, int cid, BOOLEAN on)
|
void xvt_toolbar_enable_control(WINDOW win, int cid, BOOLEAN on)
|
||||||
{
|
{
|
||||||
wxToolBar* ptb = Win2Bar(win);
|
TwxToolBar* ptb = Win2Bar(win);
|
||||||
if (ptb != NULL && cid > 0)
|
if (ptb != NULL && cid > 0)
|
||||||
ptb->EnableTool(cid, on != 0);
|
ptb->EnableTool(cid, on != 0);
|
||||||
}
|
}
|
||||||
@ -1529,12 +1572,15 @@ void xvt_toolbar_enable_control(WINDOW win, int cid, BOOLEAN on)
|
|||||||
BOOLEAN xvt_toolbar_set_last_tool(WINDOW win, int id)
|
BOOLEAN xvt_toolbar_set_last_tool(WINDOW win, int id)
|
||||||
{
|
{
|
||||||
BOOLEAN bMoved = FALSE;
|
BOOLEAN bMoved = FALSE;
|
||||||
wxToolBar* ptb = Win2Bar(win);
|
TwxToolBar* ptb = Win2Bar(win);
|
||||||
if (ptb != NULL) // Is a valid toolbar?
|
if (ptb != NULL) // Is a valid toolbar?
|
||||||
{
|
{
|
||||||
const int pos = ptb->GetToolPos(id);
|
const int pos = ptb->GetToolPos(id);
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
{
|
{
|
||||||
|
#ifdef wxAuiToolBar
|
||||||
|
// TBI
|
||||||
|
#else
|
||||||
const int nCount = ptb->GetToolsCount();
|
const int nCount = ptb->GetToolsCount();
|
||||||
if (pos < nCount-1)
|
if (pos < nCount-1)
|
||||||
{
|
{
|
||||||
@ -1542,6 +1588,7 @@ BOOLEAN xvt_toolbar_set_last_tool(WINDOW win, int id)
|
|||||||
ptb->InsertTool(nCount-1, tool);
|
ptb->InsertTool(nCount-1, tool);
|
||||||
}
|
}
|
||||||
bMoved = TRUE;
|
bMoved = TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bMoved;
|
return bMoved;
|
||||||
@ -1549,7 +1596,7 @@ BOOLEAN xvt_toolbar_set_last_tool(WINDOW win, int id)
|
|||||||
|
|
||||||
void xvt_toolbar_realize(WINDOW win)
|
void xvt_toolbar_realize(WINDOW win)
|
||||||
{
|
{
|
||||||
wxToolBar* ptb = Win2Bar(win);
|
TwxToolBar* ptb = Win2Bar(win);
|
||||||
if (ptb != NULL) // Is a valid toolbar?
|
if (ptb != NULL) // Is a valid toolbar?
|
||||||
{
|
{
|
||||||
ptb->Realize(); // Update tools
|
ptb->Realize(); // Update tools
|
||||||
@ -1569,7 +1616,7 @@ void xvt_toolbar_realize(WINDOW win)
|
|||||||
|
|
||||||
void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on)
|
void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on)
|
||||||
{
|
{
|
||||||
wxToolBar* ptb = Win2Bar(win);
|
TwxToolBar* ptb = Win2Bar(win);
|
||||||
if (ptb != NULL && cid > 0)
|
if (ptb != NULL && cid > 0)
|
||||||
ptb->EnableTool(cid, on != 0); // Per ora non so come si faccia
|
ptb->EnableTool(cid, on != 0); // Per ora non so come si faccia
|
||||||
}
|
}
|
||||||
|
@ -648,7 +648,19 @@ BOOLEAN xvt_print_is_pdf(PRINT_RCD* precp)
|
|||||||
{
|
{
|
||||||
char strName[MAX_PATH];
|
char strName[MAX_PATH];
|
||||||
xvt_print_get_name(precp, strName, sizeof(strName));
|
xvt_print_get_name(precp, strName, sizeof(strName));
|
||||||
return (xvt_str_compare_ignoring_case(strName, XVT_PDF_PRINTER_NAME) == 0);
|
return xvt_str_compare_ignoring_case(strName, XVT_PDF_PRINTER_NAME) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN xvt_print_pdf_version(char* version, int size)
|
||||||
|
{
|
||||||
|
const BOOLEAN ok = version && size > 12;
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
wxString str = "PDFlib ";
|
||||||
|
str += PDFLIB_VERSIONSTRING;
|
||||||
|
wxStrncpy(version, str, size);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN xvt_print_is_valid(const PRINT_RCD* precp)
|
BOOLEAN xvt_print_is_valid(const PRINT_RCD* precp)
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
#ifndef __XVTPDF_H
|
#ifndef __XVTPDF_H
|
||||||
#define __XVTPDF_H
|
#define __XVTPDF_H
|
||||||
|
|
||||||
#define PDF_IMG_CACHE_SIZE 5
|
|
||||||
|
|
||||||
#include "../pdf/pdflib/pdflibdl.h"
|
#include "../pdf/pdflib/pdflibdl.h"
|
||||||
#include "wx/dc.h"
|
|
||||||
#include "wx/cmndata.h"
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TwxPDFDC
|
// TwxPDFDC
|
||||||
@ -13,6 +9,8 @@
|
|||||||
|
|
||||||
class TwxPDFDC : public wxDC
|
class TwxPDFDC : public wxDC
|
||||||
{
|
{
|
||||||
|
enum { PDF_IMG_CACHE_SIZE = 5 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TwxPDFDC();
|
TwxPDFDC();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user