Patch level : 10.0 gamma

Files correlati     : *.*
Ricompilazione Demo : [ ]
Commento            :
Gestione terminalini


git-svn-id: svn://10.65.10.50/trunk@19688 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-12-01 10:18:24 +00:00
parent 6fc2a216b4
commit 3280d61832
4 changed files with 82 additions and 47 deletions

View File

@ -175,7 +175,7 @@ bool aga_zip_filelist(const char* filelist, const char* zipfile)
// DDE
///////////////////////////////////////////////////////////
#ifdef WIN32
#ifdef __WXMSW__
#include <wx/dde.h>
#define wxAgaClient wxDDEClient
#define wxAgaConnection wxDDEConnection

View File

@ -1,5 +1,14 @@
#include "wxinc.h"
#include "xvt.h"
#include "statbar.h"
#include "agasys.h"
#include "fstrcmp.h"
#include "matche.h"
#include "xvtart.h"
#include "xvtwin.h"
#include <wx/artprov.h>
#include <wx/aui/aui.h>
#include <wx/clipbrd.h>
@ -18,14 +27,6 @@
#include <wx/propgrid/propgrid.h>
#endif
#include "xvt.h"
#include "statbar.h"
#include "agasys.h"
#include "fstrcmp.h"
#include "matche.h"
#include "xvtart.h"
#include "xvtwin.h"
#ifdef WIN32
#include "oswin32.h"
@ -3382,6 +3383,19 @@ int xvt_sys_get_os_version()
return os;
}
BOOLEAN xvt_sys_is_pda()
{
wxSize sz;
if (_task_win == NULL)
{
sz.x = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
sz.y = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);
}
else
sz = _task_win->GetSize();
return max(sz.x,sz.y) <= 640;
}
int xvt_sys_get_version(char* os_version, char* ptk_version, int maxsize)
{
const int version = xvt_sys_get_os_version();
@ -3560,6 +3574,14 @@ void xvt_vobj_destroy(WINDOW win)
}
}
static long xvt_vobj_get_metric(WINDOW win, wxSystemMetric data)
{
wxWindow* w = wxDynamicCast((wxObject*)win, wxWindow);
if (w == NULL) w = _task_win;
long ret = wxSystemSettings::GetMetric(data, w);
return ret;
}
long xvt_vobj_get_attr(WINDOW win, long data)
{
long ret = 0L;
@ -3613,29 +3635,19 @@ long xvt_vobj_get_attr(WINDOW win, long data)
case ATTR_APPL_VERSION_STRING:
ret = (long)(const char*)_appl_version;
break;
case ATTR_DOCFRAME_WIDTH:
case ATTR_FRAME_WIDTH:
#ifdef LINUX
ret = 8; //verificare not impl
#else
ret = wxSystemSettings::GetMetric(wxSYS_FRAMESIZE_X);
#endif
ret = xvt_vobj_get_metric(win, wxSYS_FRAMESIZE_X);
break;
case ATTR_DOCFRAME_HEIGHT:
case ATTR_FRAME_HEIGHT:
#ifdef LINUX
ret = 8; //verificare not impl
#else
ret = wxSystemSettings::GetMetric(wxSYS_FRAMESIZE_Y);
#endif
ret = xvt_vobj_get_metric(win, wxSYS_FRAMESIZE_Y);
break;
case ATTR_MENU_HEIGHT:
ret = wxSystemSettings::GetMetric(wxSYS_MENU_Y);
ret = xvt_vobj_get_metric(win, wxSYS_MENU_Y);
break;
case ATTR_TITLE_HEIGHT:
#ifdef LINUX
ret = 32; //verificare not impl
#else
ret = wxSystemSettings::GetMetric(wxSYS_CAPTION_Y);
#endif
ret = xvt_vobj_get_metric(win, wxSYS_CAPTION_Y);
break;
case ATTR_CTL_VERT_SBAR_WIDTH:
ret = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
@ -3708,10 +3720,10 @@ long xvt_vobj_get_attr(WINDOW win, long data)
ret = _startup_style;
break;
case ATTR_ICON_WIDTH:
ret = wxSystemSettings::GetMetric(wxSYS_ICON_X);
ret = xvt_vobj_get_metric(win, wxSYS_ICON_X);
break;
case ATTR_ICON_HEIGHT:
ret = wxSystemSettings::GetMetric(wxSYS_ICON_Y);
ret = xvt_vobj_get_metric(win, wxSYS_ICON_Y);
break;
default:
SORRY_BOX();
@ -3762,7 +3774,11 @@ RCT* xvt_vobj_get_outer_rect(WINDOW win, RCT *rctp)
if (win != NULL_WIN)
{
if (win == SCREEN_WIN)
xvt_rect_set(rctp, 0, 0, wxSystemSettings::GetMetric(wxSYS_SCREEN_X), wxSystemSettings::GetMetric(wxSYS_SCREEN_Y));
{
const short sx = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
const short sy = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);
xvt_rect_set(rctp, 0, 0, sx, sy);
}
else
{
CAST_WIN(win, w);

View File

@ -394,13 +394,14 @@ XVTDLL BOOLEAN xvt_sys_get_env(const char* varname, char* value, int max_size);
XVTDLL long xvt_sys_get_oem_int(const char* name, long defval);
XVTDLL int xvt_sys_get_oem_string(const char* name, const char* defval, char* value, int maxsize);
XVTDLL 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);
XVTDLL long xvt_sys_get_profile_int(const char* file, const char* paragraph, const char* name, long defval);
XVTDLL BOOLEAN xvt_sys_set_profile_string(const char* file, const char* paragraph, const char* name, const char* value);
XVTDLL int xvt_sys_get_session_id();
XVTDLL unsigned long xvt_sys_get_free_memory();
XVTDLL unsigned long xvt_sys_get_free_memory_kb();
XVTDLL int xvt_sys_get_os_version();
XVTDLL BOOLEAN xvt_sys_is_pda();
XVTDLL int xvt_sys_get_version(char* os_version, char* ptk_version, int maxsize);
XVTDLL unsigned int xvt_sys_load_icon(const char* file);
XVTDLL void xvt_sys_sleep(unsigned long msec);

View File

@ -8,6 +8,7 @@
#include <wx/colordlg.h>
#include <wx/fontdlg.h>
#include <wx/statline.h>
#include <wx/tokenzr.h>
///////////////////////////////////////////////////////////
// TMessageBox
@ -20,7 +21,7 @@ class TMessageBox : public wxDialog
protected:
void OnButton(wxCommandEvent& evt);
void OnTimeout(wxTimerEvent& evt);
void AddButton(wxSizer* sz, int id, int ico);
void AddButton(wxSizer* sz, int id);
DECLARE_EVENT_TABLE()
public:
@ -59,9 +60,10 @@ void TMessageBox::OnTimeout(wxTimerEvent& WXUNUSED(evt))
EndModal(wxCANCEL);
}
void TMessageBox::AddButton(wxSizer* sz, int id, int WXUNUSED(ico))
void TMessageBox::AddButton(wxSizer* sz, int id)
{
sz->Add(new wxButton(this, id, wxEmptyString, wxDefaultPosition, wxSize(80, 32)), 0, wxALL, 4);
const wxSize szButt(64,-1);
sz->Add(new wxButton(this, id, wxEmptyString, wxDefaultPosition, szButt), 0, wxALL, 4);
}
TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int nTimeout)
@ -90,13 +92,30 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
if (nStyle & wxICON_EXCLAMATION) nIco = wxART_WARNING; else
if (nStyle & wxICON_QUESTION) nIco = wxART_QUESTION; else
if (nStyle & 0x1000) nIco = "220";
const BOOLEAN bTerminalino = xvt_sys_is_pda();
const int nBorder = bTerminalino ? 1 : 4;
const int nIcon = bTerminalino ? 32 : 64;
const int nWrap = bTerminalino ?160 :320;
const wxBitmap img = wxArtProvider::GetBitmap(nIco, wxART_MESSAGE_BOX, wxSize(nIcon,nIcon));
sz1->Add(new wxStaticBitmap(this, wxID_ANY, img), 0, wxALL|wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL, nBorder);
const wxBitmap img = wxArtProvider::GetBitmap(nIco, wxART_MESSAGE_BOX, wxSize(64,64));
const int nBorder = 8;
sz1->Add(new wxStaticBitmap(this, wxID_ANY, img), 0, wxALL, nBorder);
wxStaticText* ss = new wxStaticText(this, wxID_ANY, wxEmptyString);
ss->Wrap(160);
wxStaticText* ss = NULL;
if (bTerminalino)
{
int nLines = 0;
wxStringTokenizer tok(msg, wxT("\n"));
for (nLines = 0; tok.HasMoreTokens(); nLines++)
nLines += tok.GetNextToken().Len()/40;
ss = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxSize(nWrap, 16*nLines), wxST_NO_AUTORESIZE);
}
else
ss = new wxStaticText(this, wxID_ANY, wxEmptyString);
ss->Wrap(nWrap);
ss->SetLabel(msg);
sz1->Add(ss, 0, wxALL|wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL, nBorder);
@ -110,32 +129,31 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
{
SetAffirmativeId(wxID_NO);
SetEscapeId(wxID_YES);
AddButton(sz2, wxID_NO, 102);
AddButton(sz2, wxID_YES, 101);
AddButton(sz2, wxID_NO);
AddButton(sz2, wxID_YES);
}
else
{
SetAffirmativeId(wxID_YES);
SetEscapeId(wxID_NO);
AddButton(sz2, wxID_YES, 101);
AddButton(sz2, wxID_NO, 102);
AddButton(sz2, wxID_YES);
AddButton(sz2, wxID_NO);
}
}
if (nStyle & wxOK)
{
SetAffirmativeId(wxID_OK);
AddButton(sz2, wxID_OK, 101);
AddButton(sz2, wxID_OK);
}
if (nStyle & wxCANCEL)
{
SetEscapeId(wxID_CANCEL);
AddButton(sz2, wxID_CANCEL, 102);
AddButton(sz2, wxID_CANCEL);
}
SetSizerAndFit(sizer);
Centre();
CentreOnParent();
if (nTimeout > 0)
m_timer.Start(1000*nTimeout, true);
}