Patch level : 10.0

Files correlati     : avaga.dll
Ricompilazione Demo : [ ]
Commento            :
Ripristinata possibilita' di fare copia/incolla anche nelle applicazioni eseguite in cascata tramite "Collega"


git-svn-id: svn://10.65.10.50/trunk@19535 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-10-28 10:38:03 +00:00
parent 7953f17424
commit 0756a4ec73
5 changed files with 230 additions and 106 deletions

View File

@ -1,6 +1,7 @@
#include "wxinc.h"
#include <wx/artprov.h>
#include <wx/aui/aui.h>
#include <wx/clipbrd.h>
#include <wx/calctrl.h>
#include <wx/colordlg.h>
@ -9,13 +10,17 @@
#include <wx/filename.h>
#include <wx/fontdlg.h>
#include <wx/image.h>
#include <wx/filefn.h>
#include <wx/snglinst.h>
#include <wx/statline.h>
#include <wx/sysopt.h>
#include <wx/thread.h>
#include <wx/tokenzr.h>
#include <wx/aui/aui.h>
#if wxCHECK_VERSION(2,9,0)
#include <wx/propgrid.h>
#else
#include <wx/propgrid/propgrid.h>
#endif
#include "xvt.h"
#include "statbar.h"
@ -84,10 +89,10 @@ void TMessageBox::OnButton(wxCommandEvent& evt)
int ec = wxCANCEL;
switch (evt.GetId())
{
case wxID_YES: ec = wxYES; break;
case wxID_OK : ec = wxOK; break;
case wxID_NO : ec = wxNO; break;
default : ec = wxCANCEL; break;
case wxID_YES: ec = wxYES; break;
case wxID_OK : ec = wxOK; break;
case wxID_NO : ec = wxNO; break;
default : ec = GetEscapeId(); break;
}
EndModal(ec);
}
@ -115,6 +120,17 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
: wxDialog(pParent, wxID_ANY, _GetAppTitle(), wxDefaultPosition, wxDefaultSize,
wxCAPTION | wxRAISED_BORDER), m_timer(this)
{
TTaskWin* tw = wxDynamicCast(pParent ? pParent : _task_win, TTaskWin);
if (tw != NULL)
{
const COLOR col = tw->GetCtlColor(XVT_COLOR_BACKGROUND);
if (col != COLOR_INVALID)
{
CAST_COLOR(col, rgb);
SetOwnBackgroundColour(rgb);
}
}
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* sz1 = new wxBoxSizer(wxHORIZONTAL);
@ -125,7 +141,7 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
if (nStyle & wxICON_INFORMATION) nIco = wxART_INFORMATION; else
if (nStyle & wxICON_EXCLAMATION) nIco = wxART_WARNING; else
if (nStyle & wxICON_QUESTION) nIco = wxART_QUESTION; else
if (nStyle & 0x1000) nIco = "10204";
if (nStyle & 0x1000) nIco = "220";
const wxBitmap img = wxArtProvider::GetBitmap(nIco, wxART_MESSAGE_BOX, wxSize(64,64));
@ -280,13 +296,24 @@ TPopUpBox::TPopUpBox(wxWindow* pParent, const wxString& msg, int nStyle, int nTi
: wxDialog(pParent, wxID_ANY, wxEmptyString, wxPoint(0,2024), wxDefaultSize, wxBORDER_SIMPLE),
m_nTimeout(nTimeout*1000), m_Timer(this), m_nStep(0)
{
TTaskWin* tw = wxDynamicCast(pParent ? pParent : _task_win, TTaskWin);
if (tw != NULL)
{
const COLOR col = tw->GetCtlColor(XVT_COLOR_BACKGROUND);
if (col != COLOR_INVALID)
{
CAST_COLOR(col, rgb);
SetOwnBackgroundColour(rgb);
}
}
wxBoxSizer* sz = new wxBoxSizer(wxHORIZONTAL);
wxArtID nIco = wxART_ERROR;
if (nStyle & wxICON_HAND) nIco = wxART_ERROR; else
if (nStyle & wxICON_INFORMATION) nIco = wxART_INFORMATION; else
if (nStyle & wxICON_EXCLAMATION) nIco = wxART_WARNING; else
if (nStyle & 0x1000) nIco = "10204";
if (nStyle & 0x1000) nIco = "220";
const wxBitmap img = wxArtProvider::GetBitmap(nIco, wxART_MESSAGE_BOX);
wxStaticBitmap* bmp = new wxStaticBitmap(this, wxID_ANY, img);
@ -315,37 +342,42 @@ static void _PopUpBox(const wxString& msg, int nStyle, int nTimeout = 4)
_MessageBox(msg, nStyle|wxOK|wxCENTRE, nTimeout);
}
WX_DECLARE_STRING_HASH_MAP(int, TMessagesMap);
void xvt_sys_sorry_box(const char* func, const char* file, int line)
{
static wxHashTable sorry(wxKEY_STRING);
if (sorry.Get(func) == NULL)
#ifndef NDEBUG
static TMessagesMap sorry;
if (sorry[func]++ == 0)
{
sorry.Put(func, &sorry); // Dummy
wxString strMessage;
strMessage.Printf("Function %s in file %s at line %d\nis not implemented yet: be patient...",
func, file, line);
_PopUpBox(strMessage, 0x1000); // Smiley Icon
}
#endif
}
void xvt_sys_deprecated_box(const char* func, const char* file, int line)
void xvt_sys_deprecated_box(const char* oldfunc, const char* file, const char* newfunc)
{
static wxHashTable deprecated;
if (deprecated.Get(func) == NULL)
#ifndef NDEBUG
static TMessagesMap deprecated;
if (deprecated[oldfunc]++ == 0)
{
deprecated.Put(func, &deprecated); // Dummy
wxString strMessage;
strMessage.Printf("Function %s in file %s at line %d is deprecated:\nYou can blame Guy for this, if you're bold enough!",
func, file, line);
_PopUpBox(strMessage, wxICON_WARNING);
strMessage.Printf("Function %s in file %s is deprecated:\n%s is much more trendy now!\nYou can blame Guy for this, if you're bold enough!",
oldfunc, file, newfunc);
_PopUpBox(strMessage, 0x1000);
}
#endif
}
///////////////////////////////////////////////////////////
// Font cache
///////////////////////////////////////////////////////////
WX_DECLARE_HASH_MAP(wxString, wxFont*, wxStringHash, wxStringEqual, wxFontHashMap);
//WX_DECLARE_HASH_MAP(wxString, wxFont*, wxStringHash, wxStringEqual, wxFontHashMap);
WX_DECLARE_STRING_HASH_MAP(wxFont*, wxFontHashMap);
class TFontCache
{
@ -464,9 +496,9 @@ void xvt_app_create(int argc, char **argv, unsigned long WXUNUSED(flags),
long style = wxDEFAULT_FRAME_STYLE;
wxWindow* pParent = NULL;
bool bHasMenu = true, bCanChangeFirm = true;
bool bCanChangeFirm = true;
#ifdef WIN32
#ifdef __WXMSW__
HWND hwndParent = (HWND)OsWin32_FindMenuContainer();
if (hwndParent != NULL)
{
@ -475,10 +507,10 @@ void xvt_app_create(int argc, char **argv, unsigned long WXUNUSED(flags),
const wxSize szWin = pParent->GetSize();
const wxSize szCli = pParent->GetClientSize();
xvt_rect_set(&_startup_rect, 0, 0, szWin.x, szWin.y);
style = wxSYSTEM_MENU; // Lo stile si riduce al minimo: niente cornici
bHasMenu = (szWin.y - szCli.y) < 2;
bCanChangeFirm = false;
style = wxSYSTEM_MENU; // Lo stile si riduce al minimo: niente cornici
if ((szWin.y - szCli.y) > 2) // Sposto la finestra in modo da coprire il menu del padre
_startup_rect.top -= xvt_vobj_get_attr(NULL_WIN, ATTR_MENU_HEIGHT);
bCanChangeFirm = false; // In ogni caso NON posso piu' cambiare ditta
}
#endif
@ -515,45 +547,36 @@ void xvt_app_create(int argc, char **argv, unsigned long WXUNUSED(flags),
pParent = NULL;
}
if (bHasMenu)
wxMenu* Menus[3];
wxString Title[3];
Title[0] = "&File";
Menus[0] = new wxMenu;
if (bCanChangeFirm)
{
wxMenu* Menus[3];
wxString Title[3];
Title[0] = "&File";
Menus[0] = new wxMenu;
if (bCanChangeFirm)
{
Menus[0]->Append(M_FILE_NEW, "Scelta &Ditta...");
Menus[0]->AppendSeparator();
}
Menus[0]->Append(M_FILE_PG_SETUP, "&Impostazione Stampante...");
Menus[0]->Append(M_FILE_PRINT, "&Stampa");
Menus[0]->Append(M_FILE_PREVIEW, "&Anteprima");
Menus[0]->AppendSeparator();
Menus[0]->Append(M_FILE_QUIT, "&Fine");
Title[1] = "&Modifica";
Menus[1] = new wxMenu;
Menus[1]->Append(M_EDIT_CUT, "&Taglia\tCtrl+X");
Menus[1]->Append(M_EDIT_COPY, "&Copia\tCtrl+C");
Menus[1]->Append(M_EDIT_PASTE, "&Incolla\tCtrl+V");
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_ONCONTEXT, "&Aiuto contestuale");
Menus[2]->AppendSeparator();
Menus[2]->Append(M_FILE_ABOUT, "&Informazioni");
#ifdef WIN32
wxMenuBar* pMenubar = new wxMenuBar(3, Menus, Title);
#else
wxMenuBar* pMenubar = new wxMenuBar();
for (int i= 0; i < 3; i++)
pMenubar->Append(Menus[i], Title[i]);
#endif
_task_win->SetMenuBar(pMenubar);
Menus[0]->Append(M_FILE_NEW, "Scelta &Ditta...");
Menus[0]->AppendSeparator();
}
Menus[0]->Append(M_FILE_PG_SETUP, "&Impostazione Stampante...");
Menus[0]->Append(M_FILE_PRINT, "&Stampa");
Menus[0]->Append(M_FILE_PREVIEW, "&Anteprima");
Menus[0]->AppendSeparator();
Menus[0]->Append(M_FILE_QUIT, "&Fine");
Title[1] = "&Modifica";
Menus[1] = new wxMenu;
Menus[1]->Append(M_EDIT_CUT, "&Taglia\tCtrl+X");
Menus[1]->Append(M_EDIT_COPY, "&Copia\tCtrl+C");
Menus[1]->Append(M_EDIT_PASTE, "&Incolla\tCtrl+V");
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_ONCONTEXT, "&Aiuto contestuale");
Menus[2]->AppendSeparator();
Menus[2]->Append(M_FILE_ABOUT, "&Informazioni");
wxMenuBar* pMenubar = new wxMenuBar(3, Menus, Title);
_task_win->SetMenuBar(pMenubar);
if (style & wxMAXIMIZE)
_task_win->Maximize();
@ -810,9 +833,21 @@ BOOLEAN xvt_dongle_sl_write_block(unsigned short reg, unsigned short size, const
// Common dialogs
///////////////////////////////////////////////////////////
void xvt_dm_post_about_box()
{
SORRY_BOX();
}
COLOR xvt_dm_post_choose_color(WINDOW win, COLOR xc)
{
CAST_COLOR(xc, wc);
DEPRECATED_BOX("xvt_dm_post_color_sel");
xvt_dm_post_color_sel(&xc, win);
return xc;
}
BOOLEAN xvt_dm_post_color_sel(COLOR* color, unsigned long reserved)
{
CAST_COLOR(*color, wc);
wxColourData cd;
cd.SetChooseFull(true);
@ -827,15 +862,16 @@ COLOR xvt_dm_post_choose_color(WINDOW win, COLOR xc)
cd.SetCustomColour(i, col);
}
CAST_WIN(win, w);
wxColourDialog dialog(&w, &cd);
wxWindow* win = wxDynamicCast ((void*)reserved, wxWindow);
wxColourDialog dialog(win, &cd);
if (dialog.ShowModal() == wxID_OK)
{
xc = MAKE_XVT_COLOR(dialog.GetColourData().GetColour());
if (xc == 0) xc = COLOR_BLACK; // 0x000000 confonde XI, mentre con 0x07000000 e' a suo agio
*color = MAKE_XVT_COLOR(dialog.GetColourData().GetColour());
if (*color == 0) *color = COLOR_BLACK; // 0x000000 confonde XI, mentre con 0x07000000 e' a suo agio
return TRUE;
}
return xc;
return FALSE;
}
class TwxCalendarDlg : public wxDialog
@ -2814,8 +2850,8 @@ MENU_ITEM* xvt_menu_get_tree(WINDOW win)
MENU_ITEM* m = NULL;
if (win == TASK_WIN)
{
TTaskWin& w = *(TTaskWin*)win;
m = xvt_menu_duplicate_tree(w.GetMenuTree());
TTaskWin* w = wxStaticCast((wxObject*)win, TTaskWin);
m = xvt_menu_duplicate_tree(w->GetMenuTree());
}
else
{
@ -4055,7 +4091,7 @@ XVTDLL BOOLEAN xvt_sys_get_env(const char* varname, char* value, int max_size)
void xvt_sys_searchenv(const char * filename, const char * varname, char * pathname)
{
DEPRECATED_BOX();
DEPRECATED_BOX("xvt_sys_search_env");
xvt_sys_search_env(filename, varname, pathname);
}
@ -4125,7 +4161,7 @@ BOOLEAN xvt_fsys_remove_file(const char *pathname)
BOOLEAN xvt_fsys_removefile(const char *pathname)
{
DEPRECATED_BOX();
DEPRECATED_BOX("xvt_fsys_remove_file");
return xvt_fsys_remove_file(pathname);
}
@ -4203,35 +4239,45 @@ long xvt_vobj_get_attr(WINDOW win, long data)
case ATTR_APP_CTL_COLORS:
{
XVT_COLOR_COMPONENT* xcc = (XVT_COLOR_COMPONENT*)xvt_mem_zalloc(sizeof(XVT_COLOR_COMPONENT)*16);
if (win != NULL_WIN && win != SCREEN_WIN)
{
TTaskWin* tw = wxDynamicCast(_task_win, TTaskWin);
if (tw != NULL)
{
const XVT_COLOR_COMPONENT* tcc = tw->GetCtlColors();
int c = 0;
for (c = 0; c < 15 && tcc[c].type != XVT_COLOR_NULL; c++);
memcpy(xcc, tcc, (c+1)*sizeof(XVT_COLOR_COMPONENT));
return long(xcc);
}
}
// XVT components
xcc[0].type = XVT_COLOR_FOREGROUND;
xcc[0].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
xcc[1].type = XVT_COLOR_BACKGROUND;
xcc[1].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
xcc[2].type = XVT_COLOR_BLEND;
xcc[2].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT));
xcc[3].type = XVT_COLOR_BORDER;
xcc[3].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
xcc[4].type = XVT_COLOR_SELECT;
xcc[4].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
xcc[5].type = XVT_COLOR_HIGHLIGHT;
xcc[5].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
xcc[6].type = XVT_COLOR_TROUGH;
xcc[6].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
xcc[0].type = XVT_COLOR_FOREGROUND;
xcc[0].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
xcc[1].type = XVT_COLOR_BACKGROUND;
xcc[1].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
xcc[2].type = XVT_COLOR_BLEND;
xcc[2].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT));
xcc[3].type = XVT_COLOR_BORDER;
xcc[3].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
xcc[4].type = XVT_COLOR_SELECT;
xcc[4].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
xcc[5].type = XVT_COLOR_HIGHLIGHT;
xcc[5].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
xcc[6].type = XVT_COLOR_TROUGH;
xcc[6].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
// AGA components
xcc[7].type = XVT_COLOR_CAPTIONLT;
xcc[7].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION));
xcc[8].type = XVT_COLOR_CAPTIONDK;
xcc[8].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION));
xcc[9].type = XVT_COLOR_CAPTIONTEXT;
xcc[9].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT));
xcc[7].type = XVT_COLOR_CAPTIONLT;
xcc[7].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION));
xcc[8].type = XVT_COLOR_CAPTIONDK;
xcc[8].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION));
xcc[9].type = XVT_COLOR_CAPTIONTEXT;
xcc[9].color = MAKE_XVT_COLOR(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT));
// Last (NULL) component
xcc[10].type = XVT_COLOR_NULL;
xcc[10].color = 0;
// Ensure last (NULL) component
xcc[15].type = XVT_COLOR_NULL;
xcc[15].color = 0;
ret = (long)xcc;
}
break;
@ -4287,6 +4333,18 @@ long xvt_vobj_get_attr(WINDOW win, long data)
ret = (long)w->GetHandle();
}
break;
case ATTR_PRINTER_HEIGHT:
xvt_app_escape(XVT_ESC_GET_PRINTER_INFO, NULL, &ret, NULL, NULL, NULL);
break;
case ATTR_PRINTER_HRES:
xvt_app_escape(XVT_ESC_GET_PRINTER_INFO, NULL, NULL, NULL, NULL, &ret);
break;
case ATTR_PRINTER_VRES:
xvt_app_escape(XVT_ESC_GET_PRINTER_INFO, NULL, NULL, NULL, &ret, NULL);
break;
case ATTR_PRINTER_WIDTH:
xvt_app_escape(XVT_ESC_GET_PRINTER_INFO, NULL, NULL, &ret, NULL, NULL);
break;
case ATTR_SCREEN_HEIGHT:
ret = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);
break;
@ -4498,6 +4556,14 @@ void xvt_vobj_set_attr(WINDOW win, long data, long value)
{
switch (data)
{
case ATTR_APP_CTL_COLORS:
if (win == TASK_WIN)
{
TTaskWin* tw = wxDynamicCast(_task_win, TTaskWin);
if (tw != NULL)
tw->SetCtlColors((XVT_COLOR_COMPONENT*)value);
}
break;
case ATTR_BACK_COLOR: SetArtistColor(win, wxAUI_DOCKART_BACKGROUND_COLOUR, value); break;
case ATTR_ERRMSG_HANDLER: _error_handler = (XVT_ERRMSG_HANDLER)value; break;
case ATTR_EVENT_HOOK: SORRY_BOX(); break; // TBI?: Native events hook!

View File

@ -70,9 +70,11 @@ 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 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
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 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);
XVTDLL FL_STATUS xvt_dm_post_file_open(FILE_SPEC *fsp, const char *msg);
@ -402,7 +404,7 @@ XVTDLL void xvt_sys_search_env(const char* filename, const char* varnam
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* file, int line);
XVTDLL void xvt_sys_deprecated_box(const char* oldfunc, const char* file, const char* newfunc);
XVTDLL struct tm* xvt_time_now();
XVTDLL long xvt_timer_create(WINDOW win, long interval);
@ -487,9 +489,9 @@ XVTDLL int xvt_net_get_status();
#define SORRY_BOX() xvt_sys_sorry_box(__FUNCTION__, __FILE__, __LINE__)
#ifdef NDEBUG
#define DEPRECATED_BOX()
#define DEPRECATED_BOX(newfunc)
#else
#define DEPRECATED_BOX() xvt_sys_deprecated_box(__FUNCTION__, __FILE__, __LINE__)
#define DEPRECATED_BOX(newfunc) xvt_sys_deprecated_box(__FUNCTION__, __FILE__, newfunc)
#endif
#endif

View File

@ -233,10 +233,19 @@ wxIconBundle TArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient
wxSize TArtProvider::GetNativeSizeHint(const wxArtClient& client)
{
if (client == wxART_FRAME_ICON)
return wxSize(16,16);
{
const int ix = wxSystemSettings::GetMetric(wxSYS_SMALLICON_X);
const int iy = wxSystemSettings::GetMetric(wxSYS_SMALLICON_Y);
return wxSize(ix,iy);
}
const int ix = wxSystemSettings::GetMetric(wxSYS_ICON_X);
const int iy = wxSystemSettings::GetMetric(wxSYS_ICON_Y);
if (client == wxART_MESSAGE_BOX)
return wxSize(64,64);
return wxSize(32,32);
return wxSize(ix*2,iy*2);
return wxSize(ix, iy);
}
wxIconBundle TArtProvider::GetIconBundle(const wxArtID& id, const wxArtClient& client)

View File

@ -1115,9 +1115,46 @@ void TTaskWin::PopMenuTree()
m_MenuOwner = NULL; // = this;
}
const XVT_COLOR_COMPONENT* TTaskWin::GetCtlColors() const
{
if (m_xcc == NULL)
((TTaskWin*)this)->m_xcc = (XVT_COLOR_COMPONENT*)xvt_vobj_get_attr(NULL_WIN, ATTR_APP_CTL_COLORS);
return m_xcc;
}
COLOR TTaskWin::GetCtlColor(XVT_COLOR_TYPE ct) const
{
COLOR croma = COLOR_INVALID;
const XVT_COLOR_COMPONENT* xcc = GetCtlColors();
for (int i = 0; i < 16 && xcc[i].type != XVT_COLOR_NULL; i++)
{
if (xcc[i].type == ct)
{
croma = xcc[i].color;
break;
}
}
return croma;
}
void TTaskWin::SetCtlColors(const XVT_COLOR_COMPONENT* colors)
{
GetCtlColors(); // Ensure m_xcc is not NULL
for (int c = 0; colors[c].type != XVT_COLOR_NULL; c++)
{
int k = -1;
for (k = 0; m_xcc[k].type != colors[c].type; k++);
if (k < 15)
{
m_xcc[k].type = colors[c].type;
m_xcc[k].color = colors[c].color;
}
}
}
TTaskWin::TTaskWin(wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style)
: wxFrame(NULL, id, title, pos, size, style), m_menu(NULL), m_pOldBar(NULL), m_MenuOwner(NULL)
: wxFrame(NULL, id, title, pos, size, style), m_menu(NULL), m_pOldBar(NULL), m_MenuOwner(NULL), m_xcc(NULL)
{
const wxIcon ico = xvtart_GetIconResource(ICON_RSRC);
SetIcon(ico);
@ -1133,6 +1170,11 @@ TTaskWin::~TTaskWin()
xvt_res_free_menu_tree(m_menu);
m_menu = NULL;
}
if (m_xcc)
{
xvt_mem_free((DATA_PTR)m_xcc);
m_xcc = NULL;
}
wxExit(); // Exits main loop in the "rare" case it's still running
}

View File

@ -194,6 +194,7 @@ class TTaskWin : public wxFrame
wxMenuBar* m_pOldBar;
wxWindow* m_MenuOwner;
XVT_COLOR_COMPONENT* m_xcc;
protected:
virtual void OnClose(wxCloseEvent& e);
@ -204,6 +205,7 @@ public:
virtual void OnPaint(wxPaintEvent& e);
DECLARE_DYNAMIC_CLASS(TTaskWin);
DECLARE_EVENT_TABLE();
TTaskWin() : wxFrame(), m_menu(NULL), m_pOldBar(NULL), m_MenuOwner(NULL), m_xcc(NULL) { } // Needed by DECLARE_DYNAMIC_CLASS
public:
void SetMenuTree(const MENU_ITEM* tree);
@ -211,7 +213,10 @@ public:
void PushMenuTree(const MENU_ITEM* tree, wxWindow* owner);
void PopMenuTree();
TTaskWin() : wxFrame(), m_menu(NULL), m_pOldBar(NULL) { } // Needed by DECLARE_DYNAMIC_CLASS
COLOR GetCtlColor(XVT_COLOR_TYPE c) const;
const XVT_COLOR_COMPONENT* GetCtlColors() const;
void SetCtlColors(const XVT_COLOR_COMPONENT* colors);
TTaskWin(wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE);