Patch level : 2.0 664
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Aggiunta possibilita' di customizzare anche le icone dei bottoni Migliorata funzione per determinare il nome della stampante git-svn-id: svn://10.65.10.50/trunk@11680 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5e957d628a
commit
b978a2d3d8
@ -67,8 +67,6 @@ void xvt_sys_sorry_box(const char * file,int line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CAST_WIN(win,w) XVT_ASSERT(win != NULL_WIN); wxWindow& w = *(wxWindow*)win
|
|
||||||
|
|
||||||
static bool RectIntersect(const wxRect &rect1, const wxRect &rect2)
|
static bool RectIntersect(const wxRect &rect1, const wxRect &rect2)
|
||||||
{
|
{
|
||||||
if (rect1.GetRight() < rect2.GetLeft())
|
if (rect1.GetRight() < rect2.GetLeft())
|
||||||
@ -93,22 +91,33 @@ wxRect NormalizeRCT(const RCT* prct)
|
|||||||
return rct;
|
return rct;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString GetResourceName(const char* type, int rid)
|
wxString GetResourceIni()
|
||||||
{
|
{
|
||||||
wxString strName;
|
wxString strName;
|
||||||
strName = *_startup_dir;
|
strName = *_startup_dir;
|
||||||
strName += "/res/resource.ini";
|
strName += "/res/resource.ini";
|
||||||
wxFileConfig ini("", "", strName);
|
return strName;
|
||||||
|
}
|
||||||
|
|
||||||
strName = "/"; strName += type; strName += "s";
|
wxString GetResourceName(const char* type, int rid)
|
||||||
|
{
|
||||||
|
wxFileConfig ini("", "", GetResourceIni());
|
||||||
|
|
||||||
|
wxString strName = "/"; strName += type; strName += "s";
|
||||||
ini.SetPath(strName);
|
ini.SetPath(strName);
|
||||||
|
|
||||||
wxString val;
|
wxString val;
|
||||||
if (ini.Read(wxString::Format("%d", rid), &val))
|
if (ini.Read(wxString::Format("%d", rid), &val))
|
||||||
|
{
|
||||||
|
strName = *_startup_dir;
|
||||||
|
strName += "/custom/";
|
||||||
|
strName += val;
|
||||||
|
if (!wxFileExists(strName))
|
||||||
{
|
{
|
||||||
strName = *_startup_dir;
|
strName = *_startup_dir;
|
||||||
strName += "/res/";
|
strName += "/res/";
|
||||||
strName += val;
|
strName += val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strName.Empty();
|
strName.Empty();
|
||||||
@ -725,7 +734,7 @@ void TwxWindow::OnChar(wxKeyEvent& event)
|
|||||||
if (event.AltDown())
|
if (event.AltDown())
|
||||||
{
|
{
|
||||||
e.v.chr.control = TRUE;
|
e.v.chr.control = TRUE;
|
||||||
if (k >= 'a' && k <= 'z')
|
if (isalnum(k))
|
||||||
k = toupper(k);
|
k = toupper(k);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -970,6 +979,7 @@ TwxWindow::~TwxWindow()
|
|||||||
_nice_windows.Delete((WINDOW)this);
|
_nice_windows.Delete((WINDOW)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CAST_WIN(win,w) XVT_ASSERT(win != NULL_WIN); wxWindow& w = *(wxWindow*)win
|
||||||
#define CAST_TWIN(win,w) XVT_ASSERT(win != NULL_WIN); TwxWindow& w = *(TwxWindow*)win; XVT_ASSERT(_task_win != &w);
|
#define CAST_TWIN(win,w) XVT_ASSERT(win != NULL_WIN); TwxWindow& w = *(TwxWindow*)win; XVT_ASSERT(_task_win != &w);
|
||||||
#define CAST_TDC(win,dc) XVT_ASSERT(win != NULL_WIN); TDC& dc = _dc_map.GetTDC((TwxWindow*)win);
|
#define CAST_TDC(win,dc) XVT_ASSERT(win != NULL_WIN); TDC& dc = _dc_map.GetTDC((TwxWindow*)win);
|
||||||
#define CAST_DC(win,dc) XVT_ASSERT(win != NULL_WIN); wxDC& dc = _dc_map.GetDC((TwxWindow*)win);
|
#define CAST_DC(win,dc) XVT_ASSERT(win != NULL_WIN); wxDC& dc = _dc_map.GetDC((TwxWindow*)win);
|
||||||
@ -1199,7 +1209,7 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
|
|||||||
style |= wxMAXIMIZE;
|
style |= wxMAXIMIZE;
|
||||||
|
|
||||||
_task_win = new TTaskWin(NULL, ICON_RSRC, title, pos, size, style);
|
_task_win = new TTaskWin(NULL, ICON_RSRC, title, pos, size, style);
|
||||||
_nice_windows.Put((long)_task_win, _task_win);
|
_nice_windows.Put((WINDOW)_task_win, _task_win);
|
||||||
|
|
||||||
wxMenu* Menus[3];
|
wxMenu* Menus[3];
|
||||||
wxString Title[3];
|
wxString Title[3];
|
||||||
@ -2346,17 +2356,18 @@ void xvt_dwin_set_std_cpen(WINDOW win, long flag)
|
|||||||
|
|
||||||
void xvt_dwin_draw_line(WINDOW win, PNT pnt)
|
void xvt_dwin_draw_line(WINDOW win, PNT pnt)
|
||||||
{
|
{
|
||||||
CAST_TDC(win, dc);
|
CAST_TDC(win, tdc);
|
||||||
const wxPoint to(pnt.h, pnt.v);
|
const wxPoint to(pnt.h, pnt.v);
|
||||||
if (dc._pnt != to)
|
wxDC& dc = tdc.GetDC();
|
||||||
dc.GetDC().DrawLine(dc._pnt, to);
|
if (tdc._pnt != to)
|
||||||
dc.GetDC().DrawPoint(to);
|
dc.DrawLine(tdc._pnt, to);
|
||||||
dc._pnt = to;
|
dc.DrawPoint(to);
|
||||||
|
tdc._pnt = to;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_dwin_update(WINDOW win)
|
void xvt_dwin_update(WINDOW win)
|
||||||
{
|
{
|
||||||
CAST_TWIN(win, w);
|
CAST_WIN(win, w);
|
||||||
w.Update();
|
w.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3310,14 +3321,12 @@ static void FillMenuItem(const wxString& strValue, MENU_ITEM* mi)
|
|||||||
|
|
||||||
MENU_ITEM* xvt_res_get_menu(int rid)
|
MENU_ITEM* xvt_res_get_menu(int rid)
|
||||||
{
|
{
|
||||||
wxString strName;
|
wxFileConfig ini("", "", GetResourceIni());
|
||||||
strName = *_startup_dir;
|
|
||||||
strName += "/res/resource.ini";
|
|
||||||
wxFileConfig ini("", "", strName);
|
|
||||||
|
|
||||||
const int MAX_MENU = 16;
|
const int MAX_MENU = 16;
|
||||||
MENU_ITEM* TheMenu = (MENU_ITEM*)xvt_mem_zalloc(sizeof(MENU_ITEM)*MAX_MENU);
|
MENU_ITEM* TheMenu = (MENU_ITEM*)xvt_mem_zalloc(sizeof(MENU_ITEM)*MAX_MENU);
|
||||||
|
|
||||||
|
wxString strName;
|
||||||
if (rid >= 10000 && rid < 10100)
|
if (rid >= 10000 && rid < 10100)
|
||||||
{
|
{
|
||||||
wxFileName::SplitPath(wxTheApp->argv[0], NULL, &strName, NULL);
|
wxFileName::SplitPath(wxTheApp->argv[0], NULL, &strName, NULL);
|
||||||
@ -3506,12 +3515,14 @@ static void AddWinToList(SLIST list, WINDOW win)
|
|||||||
SLIST xvt_scr_list_wins()
|
SLIST xvt_scr_list_wins()
|
||||||
{
|
{
|
||||||
SLIST list = xvt_slist_create();
|
SLIST list = xvt_slist_create();
|
||||||
|
|
||||||
_nice_windows.BeginFind();
|
_nice_windows.BeginFind();
|
||||||
for (wxNode* node = _nice_windows.Next(); node; node = _nice_windows.Next())
|
for (wxNode* node = _nice_windows.Next(); node; node = _nice_windows.Next())
|
||||||
{
|
{
|
||||||
WINDOW win = (WINDOW)node->GetData();
|
wxObject* pWin = node->GetData();
|
||||||
AddWinToList(list, win);
|
AddWinToList(list, (WINDOW)pWin);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4122,15 +4133,6 @@ long xvt_vobj_get_attr(WINDOW win, long data)
|
|||||||
ret = (long)_error_handler;
|
ret = (long)_error_handler;
|
||||||
break;
|
break;
|
||||||
case ATTR_NATIVE_GRAPHIC_CONTEXT:
|
case ATTR_NATIVE_GRAPHIC_CONTEXT:
|
||||||
/*
|
|
||||||
if (_nice_windows.Get(win) != NULL)
|
|
||||||
{
|
|
||||||
#ifdef WIN32
|
|
||||||
CAST_DC(win, dc);
|
|
||||||
ret = dc.GetHDC();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
SORRY_BOX(); // Obsoleto e non piu' usato
|
SORRY_BOX(); // Obsoleto e non piu' usato
|
||||||
break;
|
break;
|
||||||
case ATTR_NATIVE_WINDOW:
|
case ATTR_NATIVE_WINDOW:
|
||||||
|
@ -215,7 +215,8 @@ XVTDLL void xvt_palet_set_tolerance(XVT_PALETTE p, int t);
|
|||||||
XVTDLL void xvt_print_close(void);
|
XVTDLL void xvt_print_close(void);
|
||||||
XVTDLL BOOLEAN xvt_print_close_page(PRINT_RCD *precp);
|
XVTDLL BOOLEAN xvt_print_close_page(PRINT_RCD *precp);
|
||||||
XVTDLL PRINT_RCD* xvt_print_create(int *sizep);
|
XVTDLL PRINT_RCD* xvt_print_create(int *sizep);
|
||||||
XVTDLL PRINT_RCD* xvt_print_create_by_name(int* sizep, const char* name);
|
XVTDLL PRINT_RCD* xvt_print_create_by_name(int* sizep, const char* name); // Added by Aga
|
||||||
|
XVTDLL int xvt_print_get_name(PRINT_RCD *precp, char* name, int sz_s); // Added by Aga
|
||||||
XVTDLL WINDOW xvt_print_create_win(PRINT_RCD *precp, char *title);
|
XVTDLL WINDOW xvt_print_create_win(PRINT_RCD *precp, char *title);
|
||||||
XVTDLL void xvt_print_destroy(PRINT_RCD *precp);
|
XVTDLL void xvt_print_destroy(PRINT_RCD *precp);
|
||||||
XVTDLL RCT* xvt_print_get_next_band(void);
|
XVTDLL RCT* xvt_print_get_next_band(void);
|
||||||
|
@ -254,7 +254,6 @@ BOOLEAN xvt_dm_post_page_setup(PRINT_RCD* precp)
|
|||||||
TPRINT_RCD* rcd = (TPRINT_RCD*)precp;
|
TPRINT_RCD* rcd = (TPRINT_RCD*)precp;
|
||||||
|
|
||||||
wxPageSetupData& pdd = dlg.GetPageSetupData();
|
wxPageSetupData& pdd = dlg.GetPageSetupData();
|
||||||
// pdd.EnablePrinter(false); // Vieta di cambiare stampante
|
|
||||||
wxPrintData& data = pdd.GetPrintData();
|
wxPrintData& data = pdd.GetPrintData();
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -289,12 +288,7 @@ long xvt_fmap_get_family_sizes(PRINT_RCD *precp, char *family, long *size_array,
|
|||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
TwxPrintOut* po = m_PrintoutCache.Get((TPRINT_RCD*)precp);
|
TwxPrintOut* po = m_PrintoutCache.Get((TPRINT_RCD*)precp);
|
||||||
if (po->HasBadDriver())
|
if (!po->HasBadDriver())
|
||||||
{
|
|
||||||
HDC hdc = ::GetDC(NULL); // Screen DC
|
|
||||||
size = OsWin32_EnumerateSizes((unsigned int)hdc, family, size_array, scalable, max_sizes);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
size = OsWin32_EnumerateSizes(po->GetDC()->GetHDC(), family, size_array, scalable, max_sizes);
|
size = OsWin32_EnumerateSizes(po->GetDC()->GetHDC(), family, size_array, scalable, max_sizes);
|
||||||
#else
|
#else
|
||||||
size = OsLinux_EnumerateSizes(family, size_array, scalable, max_sizes);
|
size = OsLinux_EnumerateSizes(family, size_array, scalable, max_sizes);
|
||||||
@ -315,11 +309,7 @@ long xvt_fmap_get_families(PRINT_RCD *precp, char **family_array, long max_famil
|
|||||||
TwxPrintOut* po = m_PrintoutCache.Get((TPRINT_RCD*)precp);
|
TwxPrintOut* po = m_PrintoutCache.Get((TPRINT_RCD*)precp);
|
||||||
size = OsWin32_EnumerateFamilies(po->GetDC()->GetHDC(), family_array, max_families);
|
size = OsWin32_EnumerateFamilies(po->GetDC()->GetHDC(), family_array, max_families);
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
{
|
|
||||||
po->SetBadDriver(true);
|
po->SetBadDriver(true);
|
||||||
HDC hdc = ::GetDC(NULL); // Screen DC
|
|
||||||
size = OsWin32_EnumerateFamilies((unsigned int)hdc, family_array, max_families);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
size = OsLinux_EnumerateFamilies(family_array, max_families);
|
size = OsLinux_EnumerateFamilies(family_array, max_families);
|
||||||
#endif
|
#endif
|
||||||
@ -447,6 +437,36 @@ BOOLEAN xvt_print_is_valid(PRINT_RCD* precp)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int xvt_print_get_name(PRINT_RCD* precp, char* name, int sz_s)
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
wxString n = ((const char*)precp) + 4;
|
||||||
|
if (n.Length() > 30)
|
||||||
|
{
|
||||||
|
SLIST plist = xvt_print_list_devices();
|
||||||
|
for (SLIST_ELT pitem = xvt_slist_get_first(plist);
|
||||||
|
pitem != NULL; pitem = xvt_slist_get_next(plist, pitem))
|
||||||
|
{
|
||||||
|
const wxString pname = xvt_slist_get(plist, pitem, NULL);
|
||||||
|
if (pname.StartsWith(n))
|
||||||
|
{
|
||||||
|
n = pname;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xvt_slist_destroy(plist);
|
||||||
|
}
|
||||||
|
if (name != NULL && sz_s > 0)
|
||||||
|
{
|
||||||
|
strncpy(name, n, sz_s);
|
||||||
|
name[sz_s-1] = '\0';
|
||||||
|
}
|
||||||
|
return n.Length();
|
||||||
|
#else
|
||||||
|
return 0; // TBI
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
BOOLEAN xvt_print_open(void)
|
BOOLEAN xvt_print_open(void)
|
||||||
{
|
{
|
||||||
return m_po == NULL;
|
return m_po == NULL;
|
||||||
@ -498,13 +518,14 @@ BOOLEAN xvt_print_start_thread(BOOLEAN(*print_fcn)(long), long data)
|
|||||||
DestroyAbortWindow();
|
DestroyAbortWindow();
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
// Stampa un line feed aggiuntivo nella stampa su generica solo testo in Win 98
|
||||||
int w, h;
|
int w, h;
|
||||||
m_po->GetPPIPrinter(&w, &h);
|
m_po->GetPPIPrinter(&w, &h);
|
||||||
if (h == 6)
|
if (h == 6) // Solo Win 98 torna 6 pixel per pollice = 1 pixel per riga
|
||||||
{
|
{
|
||||||
wxDC* dc = m_po->GetDC();
|
wxDC* dc = m_po->GetDC();
|
||||||
dc->StartPage();
|
dc->StartPage();
|
||||||
OsWin32_SpoolRow("\n\n", 1, dc->GetHDC());
|
OsWin32_SpoolRow("\n\n", 1, dc->GetHDC()); // Probabilmente basta "\n" (visto che poi specifichiamo 1) ma non ci fidiamo
|
||||||
dc->EndPage();
|
dc->EndPage();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user