Patch level : 10.0

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :
Migliorata gestione cambi booleani nei property sheet


git-svn-id: svn://10.65.10.50/trunk@20120 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-02-15 12:14:44 +00:00
parent 031b00e220
commit b12d6131d3
4 changed files with 193 additions and 69 deletions

View File

@ -104,7 +104,7 @@ XVTDLL void xvt_app_pre_create(void)
#endif #endif
} }
void xvt_app_create(int argc, char** argv, unsigned long WXUNUSED(flags), void xvt_app_create(int WXUNUSED(argc), char** WXUNUSED(argv), unsigned long WXUNUSED(flags),
EVENT_HANDLER eh, XVT_CONFIG* config) EVENT_HANDLER eh, XVT_CONFIG* config)
{ {
_task_win_handler = eh; _task_win_handler = eh;
@ -932,8 +932,12 @@ void xvt_dwin_draw_oval(WINDOW win, const RCT* rctp)
dc.DrawEllipse(rct); dc.DrawEllipse(rct);
} }
void xvt_dwin_draw_pie(WINDOW win, const RCT *rctp, int start_x, int start_y, int stop_x, int stop_y) void xvt_dwin_draw_pie(WINDOW win, const RCT *rctp,
{ SORRY_BOX(); } int WXUNUSED(start_x), int WXUNUSED(start_y), int WXUNUSED(stop_x), int WXUNUSED(stop_y))
{
SORRY_BOX();
xvt_dwin_draw_oval(win, rctp);
}
void xvt_dwin_draw_polygon(WINDOW win, const PNT *lpnts, int npnts) void xvt_dwin_draw_polygon(WINDOW win, const PNT *lpnts, int npnts)
{ {
@ -1872,7 +1876,7 @@ XVT_IMAGE xvt_image_capture(WINDOW win, const RCT* src)
return (XVT_IMAGE)i; return (XVT_IMAGE)i;
} }
XVT_IMAGE xvt_image_create(XVT_IMAGE_FORMAT format, short width, short height, COLOR color) XVT_IMAGE xvt_image_create(XVT_IMAGE_FORMAT WXUNUSED(format), short width, short height, COLOR color)
{ {
TXVT_IMAGE* i = new TXVT_IMAGE; TXVT_IMAGE* i = new TXVT_IMAGE;
i->Image().Create(width, height); i->Image().Create(width, height);
@ -2082,7 +2086,7 @@ void xvt_image_replace_color(XVT_IMAGE image, COLOR old_color, COLOR new_color)
} }
void xvt_image_set_ncolors(XVT_IMAGE image, short ncolors) void xvt_image_set_ncolors(XVT_IMAGE WXUNUSED(image), short WXUNUSED(ncolors))
{ {
// SORRY_BOX(); // SORRY_BOX();
} }
@ -2290,8 +2294,10 @@ void xvt_menu_translate_tree(WINDOW win, TRANSLATE_CALLBACK tc)
} }
} }
void xvt_menu_set_font_sel(WINDOW win, XVT_FNTID font_id) void xvt_menu_set_font_sel(WINDOW win, XVT_FNTID WXUNUSED(font_id))
{ /* Ignored */ } {
XVT_ASSERT(win == TASK_WIN);
}
static wxMenuItem* GetXvtMenuItem(WINDOW win, MENU_TAG tag) static wxMenuItem* GetXvtMenuItem(WINDOW win, MENU_TAG tag)
{ {
@ -2352,14 +2358,14 @@ void xvt_menu_update(WINDOW /*win*/)
// Palette management // Palette management
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
short xvt_palet_add_colors(XVT_PALETTE palet, COLOR *colorsp, short numcolors) { return 0; } short xvt_palet_add_colors(XVT_PALETTE WXUNUSED(palet), COLOR* WXUNUSED(colorsp), short numcolors) { return numcolors; }
short xvt_palet_add_colors_from_image(XVT_PALETTE palet, XVT_IMAGE image) { return 0; } short xvt_palet_add_colors_from_image(XVT_PALETTE WXUNUSED(palet), XVT_IMAGE image) { return xvt_image_get_ncolors(image); }
XVT_PALETTE xvt_palet_create(XVT_PALETTE_TYPE type, XVT_PALETTE_ATTR reserved) { return NULL; } XVT_PALETTE xvt_palet_create(XVT_PALETTE_TYPE WXUNUSED(type), XVT_PALETTE_ATTR WXUNUSED(reserved)) { return NULL; }
void xvt_palet_destroy(XVT_PALETTE palet) { SORRY_BOX(); } void xvt_palet_destroy(XVT_PALETTE WXUNUSED(palet)) { SORRY_BOX(); }
short xvt_palet_get_colors(XVT_PALETTE palet, COLOR *colorsp, short maxcolors) { return 0; } short xvt_palet_get_colors(XVT_PALETTE WXUNUSED(palet), COLOR* WXUNUSED(colorsp), short WXUNUSED(maxcolors)) { return 0; }
short xvt_palet_get_ncolors(XVT_PALETTE palet) { return 0; } short xvt_palet_get_ncolors(XVT_PALETTE WXUNUSED(palet)) { return 0; }
int xvt_palet_get_tolerance(XVT_PALETTE p) { return 0; } int xvt_palet_get_tolerance(XVT_PALETTE WXUNUSED(p)) { return 0; }
void xvt_palet_set_tolerance(XVT_PALETTE p, int t) { SORRY_BOX(); } void xvt_palet_set_tolerance(XVT_PALETTE WXUNUSED(p), int WXUNUSED(t)) { SORRY_BOX(); }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Rectangles // Rectangles
@ -3023,6 +3029,41 @@ char* xvt_str_number_format(char* str, int size)
return str; return str;
} }
static const char* const ENCRYPTION_KEY = "QSECOFR-";
int xvt_str_encode(const char* text, char* cipher, int mode)
{
int i = 0;
switch (mode)
{
case 1: // BASE64
break;
default: // AGA
for (i = 0; text[i]; i++)
cipher[i] = text[i] + (i < 8 ? ENCRYPTION_KEY[i] : text[i - 8]);
cipher[i] = '\0';
break;
}
return i;
}
int xvt_str_decode(const char* cipher, char* text, int mode)
{
int i = 0;
switch (mode)
{
case 1: // BASE64
break;
default: // AGA
for (i = 0; cipher[i]; i++)
text[i] = cipher[i] - (i < 8 ? ENCRYPTION_KEY[i] : text[i - 8]);
text[i] = '\0';
break;
}
return i;
}
BOOLEAN xvt_str_match(const char* mbs, const char *pat, BOOLEAN case_sensitive) BOOLEAN xvt_str_match(const char* mbs, const char *pat, BOOLEAN case_sensitive)
{ {
/* /*
@ -3191,13 +3232,16 @@ long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask)
wxEnableTopLevelWindows(FALSE); wxEnableTopLevelWindows(FALSE);
TIconizeTaskThread* it = new TIconizeTaskThread(); // No need to delete TIconizeTaskThread* it = new TIconizeTaskThread(); // No need to delete
if (it != NULL)
{
__bChildRunning = true; __bChildRunning = true;
exitcode = wxExecute(cmd, wxEXEC_SYNC); exitcode = wxExecute(cmd, wxEXEC_SYNC);
__bChildRunning = false; __bChildRunning = false;
if (_task_win->IsIconized()) if (_task_win->IsIconized())
_task_win->Restore(); _task_win->Restore();
wxEnableTopLevelWindows(TRUE); wxEnableTopLevelWindows(TRUE);
}
} }
else else
exitcode = wxExecute(cmd, wxEXEC_SYNC); // Valutare wxEXEC_NODISABLE exitcode = wxExecute(cmd, wxEXEC_SYNC); // Valutare wxEXEC_NODISABLE
@ -3281,29 +3325,19 @@ BOOLEAN xvt_sys_dongle_server_is_running()
return sic.IsAnotherRunning(); return sic.IsAnotherRunning();
} }
int xvt_sys_get_oem_string(const char* name, const char* defval, char* value, int maxsize) #define OEM_INI wxString(_startup_dir+wxT("/setup/oem.ini"))
{
wxString strFileName = _startup_dir + "/setup/oem.ini";
const int oem = xvt_sys_get_profile_int(strFileName, "MAIN", "OEM", -1);
if (oem >= 0)
{
wxString strPara; strPara << "OEM_" << oem;
return xvt_sys_get_profile_string(strFileName, strPara, name, defval, value, maxsize);
}
return 0;
}
long xvt_sys_get_oem_int(const char* name, long defval) long xvt_sys_get_oem_int(const char* name, long defval)
{ {
static long _oem = -1; static long _oem = -1;
if (_oem < 0) if (_oem < 0)
_oem = xvt_sys_get_profile_int(_startup_dir+"/setup/oem.ini", "MAIN", "OEM", -1); _oem = xvt_sys_get_profile_int(OEM_INI, "MAIN", "OEM", -1);
if (_oem >= 0) if (_oem >= 0)
{ {
if (wxStricmp(name, "OEM") != 0) if (wxStricmp(name, wxT("OEM")) != 0)
{ {
wxString strPara; strPara << "OEM_" << _oem; wxString strPara; strPara.Printf(wxT("OEM_%d"), _oem);
defval = xvt_sys_get_profile_int(_startup_dir+"/setup/oem.ini", strPara, name, defval); defval = xvt_sys_get_profile_int(OEM_INI, strPara, name, defval);
} }
else else
defval = _oem; defval = _oem;
@ -3311,6 +3345,26 @@ long xvt_sys_get_oem_int(const char* name, long defval)
return defval; return defval;
} }
int xvt_sys_get_oem_string(const char* name, const char* defval, char* value, int maxsize)
{
const int oem = xvt_sys_get_oem_int("OEM", -1);
if (oem >= 0)
{
if (wxStricmp(name, wxT("OEM")) != 0)
{
wxString strPara; strPara.Printf(wxT("OEM_%d"), oem);
return xvt_sys_get_profile_string(OEM_INI, strPara, name, defval, value, maxsize);
}
else
{
wxString str; str.Printf("%d", oem);
wxStrncpy(value, str, maxsize);
return 1;
}
}
return 0;
}
int xvt_sys_get_profile_string(const char* file, const char* paragraph, const char* name, int xvt_sys_get_profile_string(const char* file, const char* paragraph, const char* name,
const char* defval, char* value, int maxsize) const char* defval, char* value, int maxsize)
{ {
@ -3999,7 +4053,7 @@ void xvt_vobj_set_enabled(WINDOW win, BOOLEAN enabled)
w.Enable(enabled != 0); w.Enable(enabled != 0);
} }
void xvt_vobj_set_palet(WINDOW win, XVT_PALETTE palet) void xvt_vobj_set_palet(WINDOW WXUNUSED(win), XVT_PALETTE WXUNUSED(palet))
{ {
// Do not implement! // Do not implement!
} }
@ -4037,7 +4091,8 @@ void xvt_vobj_translate_points(WINDOW from_win, WINDOW to_win, PNT *pntp, int np
// Real windows // Real windows
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
WINDOW xvt_win_create(WIN_TYPE wtype, const RCT* rct_p, const char* title, int menu_rid, WINDOW parent, long win_flags, EVENT_MASK mask, EVENT_HANDLER eh, long app_data) WINDOW xvt_win_create(WIN_TYPE wtype, const RCT* rct_p, const char* title, int menu_rid, WINDOW parent, long win_flags,
EVENT_MASK WXUNUSED(mask), EVENT_HANDLER eh, long app_data)
{ {
const wxRect rct = RCT2Rect(rct_p); const wxRect rct = RCT2Rect(rct_p);
const wxString caption = title; const wxString caption = title;
@ -4288,16 +4343,16 @@ XVT_FNTID statbar_get_fontid(WINDOW win, XVT_FNTID font_id)
return font_id; return font_id;
} }
WINDOW statbar_create(int cid, int left, int top, int right, int bottom, WINDOW statbar_create(int cid, int WXUNUSED(left), int WXUNUSED(top), int WXUNUSED(right), int WXUNUSED(bottom),
int prop_count, char **prop_list, WINDOW parent_win, int WXUNUSED(prop_count), char** WXUNUSED(prop_list), WINDOW parent_win,
int parent_rid, long parent_flags, char *parent_class) int WXUNUSED(parent_rid), long WXUNUSED(parent_flags), char* WXUNUSED(parent_class))
{ {
wxStatusBar* pStatusBar = NULL; wxStatusBar* pStatusBar = NULL;
wxFrame* w = wxDynamicCast(SafeCastWin(parent_win), wxFrame); wxFrame* w = wxDynamicCast(SafeCastWin(parent_win), wxFrame);
if (w != NULL) if (w != NULL)
{ {
const int nStyle = 0; // not wxST_SIZEGRIP const int nStyle = 0; // not wxST_SIZEGRIP
pStatusBar = w->CreateStatusBar(3, nStyle); pStatusBar = w->CreateStatusBar(3, nStyle, cid);
if (pStatusBar != NULL) if (pStatusBar != NULL)
{ {
const int widths[4] = { -4, -2, -2, 0 }; const int widths[4] = { -4, -2, -2, 0 };

View File

@ -342,6 +342,8 @@ XVTDLL SLIST_ELT xvt_slist_get_first(SLIST list);
XVTDLL SLIST_ELT xvt_slist_get_next(SLIST list, SLIST_ELT item); XVTDLL SLIST_ELT xvt_slist_get_next(SLIST list, SLIST_ELT item);
XVTDLL int xvt_str_compare_ignoring_case (const char* s1, const char* s2); XVTDLL int xvt_str_compare_ignoring_case (const char* s1, const char* s2);
XVTDLL int xvt_str_encode(const char* text, char* cypher, int mode);
XVTDLL int xvt_str_decode(const char* cypher, char* text, int mode);
XVTDLL char* xvt_str_duplicate(const char* str); XVTDLL char* xvt_str_duplicate(const char* str);
XVTDLL BOOLEAN xvt_str_match(const char* str, const char* pat, BOOLEAN case_sensitive); XVTDLL BOOLEAN xvt_str_match(const char* str, const char* pat, BOOLEAN case_sensitive);
XVTDLL double xvt_str_fuzzy_compare (const char* s1, const char* s2); XVTDLL double xvt_str_fuzzy_compare (const char* s1, const char* s2);
@ -483,9 +485,12 @@ typedef BOOLEAN PROP_CALLBACK(WINDOW win, XVT_TREEVIEW_NODE node, void* app_data
XVTDLL XVT_TREEVIEW_NODE xvt_prop_add(WINDOW win, const char* type, const char* name, const char* value, const char* label); XVTDLL XVT_TREEVIEW_NODE xvt_prop_add(WINDOW win, const char* type, const char* name, const char* value, const char* label);
XVTDLL XVT_TREEVIEW_NODE xvt_prop_current(WINDOW win); XVTDLL XVT_TREEVIEW_NODE xvt_prop_current(WINDOW win);
XVTDLL XVT_TREEVIEW_NODE xvt_prop_find(WINDOW win, const char* name); XVTDLL XVT_TREEVIEW_NODE xvt_prop_find(WINDOW win, const char* name);
XVTDLL void xvt_prop_fit_columns(WINDOW win);
XVTDLL BOOLEAN xvt_prop_for_each(WINDOW win, PROP_CALLBACK pcb, void* jolly); XVTDLL BOOLEAN xvt_prop_for_each(WINDOW win, PROP_CALLBACK pcb, void* jolly);
XVTDLL int xvt_prop_get_string(WINDOW win, XVT_TREEVIEW_NODE node, char* label, int maxlen);
XVTDLL int xvt_prop_get_data(WINDOW win, XVT_TREEVIEW_NODE node, char* value, int maxlen); XVTDLL int xvt_prop_get_data(WINDOW win, XVT_TREEVIEW_NODE node, char* value, int maxlen);
XVTDLL int xvt_prop_get_string(WINDOW win, XVT_TREEVIEW_NODE node, char* label, int maxlen);
XVTDLL int xvt_prop_get_type(WINDOW win, XVT_TREEVIEW_NODE node, char* type, int maxlen);
XVTDLL BOOLEAN xvt_prop_remove(WINDOW win, XVT_TREEVIEW_NODE node);
XVTDLL BOOLEAN xvt_prop_restart(WINDOW win); XVTDLL BOOLEAN xvt_prop_restart(WINDOW win);
XVTDLL BOOLEAN xvt_prop_set_data(WINDOW win, XVT_TREEVIEW_NODE node, const char* value); XVTDLL BOOLEAN xvt_prop_set_data(WINDOW win, XVT_TREEVIEW_NODE node, const char* value);
XVTDLL BOOLEAN xvt_prop_set_read_only(WINDOW win, XVT_TREEVIEW_NODE node, BOOLEAN ro); XVTDLL BOOLEAN xvt_prop_set_read_only(WINDOW win, XVT_TREEVIEW_NODE node, BOOLEAN ro);

View File

@ -944,8 +944,7 @@ void TwxTreeCtrl::OnExpanding(wxTreeEvent& evt)
if (!m_nFrozen) if (!m_nFrozen)
{ {
const wxTreeItemId id = evt.GetItem(); const wxTreeItemId id = evt.GetItem();
EVENT e; memset(&e, 0, sizeof(EVENT)); XVT_EVENT e(E_CONTROL);
e.type = E_CONTROL;
e.v.ctl.id = evt.GetId(); e.v.ctl.id = evt.GetId();
e.v.ctl.ci.type = WC_TREE; e.v.ctl.ci.type = WC_TREE;
e.v.ctl.ci.win = WINDOW(this); e.v.ctl.ci.win = WINDOW(this);
@ -965,8 +964,7 @@ void TwxTreeCtrl::OnCollapsed(wxTreeEvent& evt)
if (!m_nFrozen) if (!m_nFrozen)
{ {
Suspend(); Suspend();
EVENT e; memset(&e, 0, sizeof(EVENT)); XVT_EVENT e(E_CONTROL);
e.type = E_CONTROL;
e.v.ctl.id = evt.GetId(); e.v.ctl.id = evt.GetId();
e.v.ctl.ci.type = WC_TREE; e.v.ctl.ci.type = WC_TREE;
e.v.ctl.ci.win = WINDOW(this); e.v.ctl.ci.win = WINDOW(this);
@ -983,8 +981,7 @@ void TwxTreeCtrl::OnClick(wxTreeEvent& evt, bool bDouble)
if (!m_nFrozen) if (!m_nFrozen)
{ {
Suspend(); Suspend();
EVENT e; memset(&e, 0, sizeof(EVENT)); XVT_EVENT e(E_CONTROL);
e.type = E_CONTROL;
e.v.ctl.id = evt.GetId(); e.v.ctl.id = evt.GetId();
e.v.ctl.ci.type = WC_TREE; e.v.ctl.ci.type = WC_TREE;
e.v.ctl.ci.win = WINDOW(this); e.v.ctl.ci.win = WINDOW(this);
@ -1038,8 +1035,7 @@ void TwxTreeCtrl::OnRightDown(wxMouseEvent& evt)
TwxWindow* pParent = wxDynamicCast(GetParent(), TwxWindow); TwxWindow* pParent = wxDynamicCast(GetParent(), TwxWindow);
if (pParent != NULL) if (pParent != NULL)
{ {
EVENT e; memset(&e, 0, sizeof(EVENT)); XVT_EVENT e(E_MOUSE_DOWN);
e.type = E_MOUSE_DOWN;
e.v.mouse.button = 1; e.v.mouse.button = 1;
e.v.mouse.control = evt.ControlDown(); e.v.mouse.control = evt.ControlDown();
e.v.mouse.shift = evt.ShiftDown(); e.v.mouse.shift = evt.ShiftDown();
@ -1524,8 +1520,27 @@ void TwxOutlookBar::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
color = wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT); color = wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT);
dc.SetTextForeground(color); dc.SetTextForeground(color);
const wxSize szText = dc.GetTextExtent(oi.m_strText); const wxString& str = oi.m_strText;
dc.DrawText(oi.m_strText, rect.x+nTextOffset, rect.y+(nSide-szText.y)/2); const int nMaxX = rect.width - nTextOffset;
const wxSize szText = dc.GetTextExtent(str);
if (szText.x > nMaxX && szText.y*2 < nSide)
{
const int nMid = str.Len() / 2;
int nBest = nMid, nDist = nMid;
for (int i = 0; i < 2*nMid; i++) if (str[i] <= wxChar(' '))
{
const int d = abs(nMid-i);
if (d < nDist)
{
nBest = i;
nDist = d;
}
}
dc.DrawText(str.Left(nBest+1), rect.x+nTextOffset, rect.y+nSide/2-szText.y);
dc.DrawText(str.Mid(nBest+1), rect.x+nTextOffset, rect.y+nSide/2);
}
else
dc.DrawText(oi.m_strText, rect.x+nTextOffset, rect.y+(nSide-szText.y)/2);
} }
wxCoord TwxOutlookBar::OnMeasureItem(size_t WXUNUSED(n)) const wxCoord TwxOutlookBar::OnMeasureItem(size_t WXUNUSED(n)) const
@ -1568,8 +1583,7 @@ void TwxOutlookBar::OnSelected(wxCommandEvent& evt)
TwxWindow* win = wxDynamicCast(GetParent(), TwxWindow); TwxWindow* win = wxDynamicCast(GetParent(), TwxWindow);
if (win != NULL) if (win != NULL)
{ {
EVENT e; memset(&e, 0, sizeof(EVENT)); XVT_EVENT e(E_CONTROL);
e.type = E_CONTROL;
e.v.ctl.id = evt.GetId(); e.v.ctl.id = evt.GetId();
e.v.ctl.ci.type = WC_OUTLOOKBAR; e.v.ctl.ci.type = WC_OUTLOOKBAR;
e.v.ctl.ci.win = WINDOW(this); e.v.ctl.ci.win = WINDOW(this);
@ -1778,8 +1792,7 @@ void TwxPopUp::NotifySelection()
TwxWindow* win = wxDynamicCast(GetParent(), TwxWindow); TwxWindow* win = wxDynamicCast(GetParent(), TwxWindow);
if (win != NULL) if (win != NULL)
{ {
EVENT e; memset(&e, 0, sizeof(EVENT)); XVT_EVENT e(E_CONTROL);
e.type = E_CONTROL;
e.v.ctl.id = GetId(); e.v.ctl.id = GetId();
e.v.ctl.ci.type = WC_LISTEDIT; e.v.ctl.ci.type = WC_LISTEDIT;
e.v.ctl.ci.win = WINDOW(this); e.v.ctl.ci.win = WINDOW(this);
@ -1972,8 +1985,7 @@ END_EVENT_TABLE();
void TwxToolBar::OnTool(wxCommandEvent& evt) void TwxToolBar::OnTool(wxCommandEvent& evt)
{ {
EVENT e; memset(&e, 0, sizeof(EVENT)); XVT_EVENT e(E_CONTROL);
e.type = E_CONTROL;
e.v.ctl.id = evt.GetId(); e.v.ctl.id = evt.GetId();
e.v.ctl.ci.type = WC_ICON; // WC_PUSHBUTTON entra in conflitto coi bottoni e.v.ctl.ci.type = WC_ICON; // WC_PUSHBUTTON entra in conflitto coi bottoni
e.v.ctl.ci.win = WINDOW(this); e.v.ctl.ci.win = WINDOW(this);
@ -2237,8 +2249,7 @@ void TwxPropertyGrid::OnPropertyChanged(wxPropertyGridEvent& evt)
TwxWindow* win = wxDynamicCast(GetParent(), TwxWindow); TwxWindow* win = wxDynamicCast(GetParent(), TwxWindow);
if (win != NULL && !IsFrozen()) if (win != NULL && !IsFrozen())
{ {
EVENT e; memset(&e, 0, sizeof(EVENT)); XVT_EVENT e(E_CONTROL);
e.type = E_CONTROL;
e.v.ctl.id = evt.GetId(); e.v.ctl.id = evt.GetId();
e.v.ctl.ci.v.treeview.sgl_click = TRUE; e.v.ctl.ci.v.treeview.sgl_click = TRUE;
e.v.ctl.ci.v.treeview.node = evt.GetProperty(); e.v.ctl.ci.v.treeview.node = evt.GetProperty();
@ -2319,7 +2330,9 @@ BOOLEAN xvt_prop_set_data(WINDOW win, XVT_TREEVIEW_NODE node, const char* value)
else else
{ {
if (strType == "long" || strType == "int") if (strType == "long" || strType == "int")
pgp->SetValue(atol(value)); pgp->SetValue(atol(value)); else
if (strType == "bool")
pgp->SetValue(*value > '0' && strchr("1TXY", *value) != NULL);
else else
pgp->SetValue(value); pgp->SetValue(value);
} }
@ -2342,10 +2355,20 @@ XVT_TREEVIEW_NODE xvt_prop_add(WINDOW win, const char* type, const char* name, c
{ {
switch (toupper(*type)) switch (toupper(*type))
{ {
case 'C': pgp = new wxColourProperty(strLabel, name, STR2COLOUR(value)); break; case 'B':
pgp = new wxBoolProperty(strLabel, name, *value > '0' && strchr("1TXY", *value) != NULL);
pgp->SetAttribute(wxString("UseCheckbox"), true);
break;
case 'C':
pgp = new wxColourProperty(strLabel, name, STR2COLOUR(value));
break;
case 'I': case 'I':
case 'L': pgp = new wxIntProperty(strLabel, name, atol(value)); break; case 'L':
default : pgp = new wxStringProperty(strLabel, name, value); break; pgp = new wxIntProperty(strLabel, name, atol(value));
break;
default :
pgp = new wxStringProperty(strLabel, name, value);
break;
} }
} }
else else
@ -2377,6 +2400,28 @@ XVT_TREEVIEW_NODE xvt_prop_find(WINDOW win, const char* name)
return node; return node;
} }
void xvt_prop_fit_columns(WINDOW win)
{
wxPropertyGrid* pg = wxDynamicCast((wxObject*)win, wxPropertyGrid);
if (pg != NULL)
pg->FitColumns();
}
BOOLEAN xvt_prop_remove(WINDOW win, XVT_TREEVIEW_NODE node)
{
wxPropertyGrid* pg = wxDynamicCast((wxObject*)win, wxPropertyGrid);
if (pg != NULL)
{
wxPGProperty* pgp = wxDynamicCast((wxObject*)node, wxPGProperty);
if (pgp != NULL)
{
pg->DeleteProperty(pgp->GetId());
return TRUE;
}
}
return FALSE;
}
int xvt_prop_get_string(WINDOW win, XVT_TREEVIEW_NODE node, char* label, int maxlen) int xvt_prop_get_string(WINDOW win, XVT_TREEVIEW_NODE node, char* label, int maxlen)
{ {
int len = -1; int len = -1;
@ -2398,6 +2443,25 @@ int xvt_prop_get_string(WINDOW win, XVT_TREEVIEW_NODE node, char* label, int max
return len; return len;
} }
int xvt_prop_get_type(WINDOW win, XVT_TREEVIEW_NODE node, char* type, int maxlen)
{
int len = 0;
wxPropertyGrid* pg = wxDynamicCast((wxObject*)win, wxPropertyGrid);
if (pg != NULL)
{
const wxPGProperty* pgp = wxDynamicCast((wxObject*)node, wxPGProperty);
if (pgp != NULL)
{
wxString strType = pgp->GetType();
if (strType == "wxColour")
strType = "color";
wxStrncpy(type, strType, maxlen);
len = strType.Len();
}
}
return len;
}
int xvt_prop_get_data(WINDOW win, XVT_TREEVIEW_NODE node, char* value, int maxlen) int xvt_prop_get_data(WINDOW win, XVT_TREEVIEW_NODE node, char* value, int maxlen)
{ {
int len = -1; int len = -1;

View File

@ -352,7 +352,7 @@ void xvt_dm_speech_enable(int mode)
{ {
#ifdef SPEECH_API #ifdef SPEECH_API
m_nSpeechMode = mode; m_nSpeechMode = mode;
#ifdef WIN32 #ifdef __WXMSW__
if (m_nSpeechMode != 0) if (m_nSpeechMode != 0)
{ {
if (!OsWin32_InitializeSpeech()) if (!OsWin32_InitializeSpeech())
@ -513,7 +513,7 @@ BOOLEAN xvt_dm_post_speech(const char* text, int priority, BOOLEAN async)
#ifdef SPEECH_API #ifdef SPEECH_API
if ((m_nSpeechMode & (1 << priority)) != 0) if ((m_nSpeechMode & (1 << priority)) != 0)
{ {
#ifdef WIN32 #ifdef __WXMSW__
ok = OsWin32_Speak(text, async != 0); ok = OsWin32_Speak(text, async != 0);
#endif #endif
} }
@ -521,7 +521,7 @@ BOOLEAN xvt_dm_post_speech(const char* text, int priority, BOOLEAN async)
return ok; return ok;
} }
ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char* Btn2, const char* Btn3, const char* fmt) ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char* WXUNUSED(Btn2), const char* Btn3, const char* fmt)
{ {
int nFlags = wxICON_QUESTION | wxYES_NO; int nFlags = wxICON_QUESTION | wxYES_NO;
if (Btn3 == NULL) if (Btn3 == NULL)
@ -707,7 +707,7 @@ void xvt_help_close_helpfile(XVT_HELP_INFO hi)
hi = (XVT_HELP_INFO)&help_info; hi = (XVT_HELP_INFO)&help_info;
} }
BOOLEAN xvt_help_process_event(XVT_HELP_INFO hi, WINDOW win, EVENT *ev) BOOLEAN xvt_help_process_event(XVT_HELP_INFO WXUNUSED(hi), WINDOW win, EVENT *ev)
{ {
BOOLEAN bProcessed = FALSE; BOOLEAN bProcessed = FALSE;