Potenziata gestione fonts
git-svn-id: svn://10.65.10.50/trunk@494 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
14abd67ee4
commit
e821f7c378
@ -43,10 +43,10 @@ bool xvt_running() { return _application != NULL; }
|
||||
|
||||
HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
|
||||
{
|
||||
#if XVTWS == WMWS
|
||||
clear_window( win, COLOR_BLUE );
|
||||
#else
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
clear_window( win, COLOR_GRAY );
|
||||
#else
|
||||
clear_window( win, COLOR_BLUE );
|
||||
#endif
|
||||
|
||||
return 0L;
|
||||
@ -54,7 +54,10 @@ HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
|
||||
|
||||
HIDDEN void create_backdrop( void )
|
||||
{
|
||||
#if XVTWS == WMWS
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
xvt_create_statbar();
|
||||
xvt_statbar_set("");
|
||||
#else
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MENU, COLOR_BLACK, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DIALOG, COLOR_BLUE, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_WINDOW, COLOR_RED, COLOR_WHITE);
|
||||
@ -67,9 +70,6 @@ HIDDEN void create_backdrop( void )
|
||||
create_window(W_PLAIN, &rct, (char*) "BACKDROP", 0, TASK_WIN,
|
||||
WSF_NO_MENUBAR | WSF_CH_BACKDROP , EM_UPDATE,
|
||||
backdrop_eh, 0L );
|
||||
#else
|
||||
xvt_create_statbar();
|
||||
xvt_statbar_set("");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -104,14 +104,16 @@ void TBanner::handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
if (ep->type == E_UPDATE)
|
||||
{
|
||||
const int BIGY = CHARY<<1;
|
||||
|
||||
clear(COLOR_LTGRAY);
|
||||
RCT r; get_client_rect(win, &r);
|
||||
|
||||
set_color(COLOR_WHITE, COLOR_LTGRAY);
|
||||
set_font(FF_TIMES, FS_BOLD | FS_ITALIC, CHARY<<1);
|
||||
set_font(FF_TIMES, FS_BOLD | FS_ITALIC, BIGY);
|
||||
char* t = (char*)(const char*)main_app().title();
|
||||
int w = win_get_text_width(win, t, -1);
|
||||
int x = (r.right-r.left-w)>>1, y = r.bottom - 4*CHARY;
|
||||
int x = (r.right-r.left-w)>>1, y = r.bottom - BIGY;
|
||||
win_draw_text(win, x+1, y+1, t, -1);
|
||||
set_color(COLOR_BLACK, COLOR_LTGRAY);
|
||||
win_draw_text(win, x, y, t, -1);
|
||||
@ -119,12 +121,12 @@ void TBanner::handler(WINDOW win, EVENT* ep)
|
||||
set_font(FF_TIMES);
|
||||
t = "PRASSI S.p.A.";
|
||||
w = win_get_text_width(win, t, -1);
|
||||
x = (r.right-r.left-w)>>1, y = 2*CHARY;
|
||||
x = (r.right-r.left-w)>>1, y = BIGY;
|
||||
win_draw_text(win, x, y, t, -1);
|
||||
|
||||
t = "Caricamento in corso";
|
||||
w = win_get_text_width(win, t, -1);
|
||||
x = (r.right-r.left-w)>>1, y = r.bottom - 2*CHARY;
|
||||
x = (r.right-r.left-w)>>1, y = r.bottom - CHARY;
|
||||
win_draw_text(win, x, y, t, -1);
|
||||
|
||||
r.left += 4; r.right -= 4;
|
||||
@ -227,25 +229,21 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
return _application->handler(win, ep);
|
||||
}
|
||||
|
||||
long TApplication::handler(WINDOW, EVENT* ep)
|
||||
long TApplication::handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
{
|
||||
bool ok = FALSE;
|
||||
{
|
||||
TBanner banner;
|
||||
ok = create();
|
||||
}
|
||||
if (!ok)
|
||||
stop_run();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E_COMMAND:
|
||||
{
|
||||
const MENU_TAG mt = ep->v.cmd.tag;
|
||||
switch(mt)
|
||||
switch(ep->v.cmd.tag)
|
||||
{
|
||||
case M_FILE_QUIT:
|
||||
if (can_close())
|
||||
@ -267,32 +265,32 @@ long TApplication::handler(WINDOW, EVENT* ep)
|
||||
about();
|
||||
break;
|
||||
default:
|
||||
if (mt >= BAR_ITEM(1))
|
||||
if (ep->v.cmd.tag >= BAR_ITEM(1))
|
||||
{
|
||||
if(!menu(mt))
|
||||
if(!menu(ep->v.cmd.tag))
|
||||
stop_run();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case E_CLOSE:
|
||||
if (can_close())
|
||||
stop_run();
|
||||
if (can_close())
|
||||
stop_run();
|
||||
break;
|
||||
case E_QUIT:
|
||||
if (ep->v.query)
|
||||
{
|
||||
if (can_close())
|
||||
quit_OK();
|
||||
}
|
||||
else
|
||||
stop_run();
|
||||
break;
|
||||
if (ep->v.query)
|
||||
{
|
||||
if (can_close())
|
||||
quit_OK();
|
||||
}
|
||||
else
|
||||
stop_run();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
return 0L;
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
|
||||
@ -540,7 +538,7 @@ bool TApplication::config()
|
||||
TConfig cnf(CONFIG_DITTA);
|
||||
bool ok = FALSE;
|
||||
|
||||
TString80 maskname(cnf.get("EdMask"));
|
||||
TFilename maskname(cnf.get("EdMask"));
|
||||
if (!maskname.empty())
|
||||
{
|
||||
TMask m(maskname);
|
||||
|
@ -218,7 +218,7 @@ TConfig::TConfig(int which_config, const char* paragraph)
|
||||
{
|
||||
if (which_config == CONFIG_DITTA)
|
||||
{
|
||||
_file.insert(format("%s/", MainApp()->get_firm_dir()));
|
||||
_file.insert(format("%s/", main_app().get_firm_dir()));
|
||||
if (!fexist(_file))
|
||||
fcopy(files[CONFIG_DITTA], _file);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ void TControl::create(
|
||||
}
|
||||
|
||||
|
||||
// Virtual destructor needed to make derived descrutors active!
|
||||
// Virtual destructor needed to make derived descrutors live!
|
||||
TControl::~TControl()
|
||||
{}
|
||||
|
||||
@ -339,7 +339,7 @@ TText::TText(short left, short top, short right, short bottom,
|
||||
void TText::update() const
|
||||
{
|
||||
TControl::update();
|
||||
win_draw_text(_hdc, _client.left, _client.top+CHARY-3, (char*)caption(), -1);
|
||||
win_draw_text(_hdc, _client.left, _client.top+BASEY, (char*)caption(), -1);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -383,6 +383,7 @@ void TGroup::draw_round_rect(const RCT& r, COLOR c) const
|
||||
void TGroup::update() const
|
||||
{
|
||||
TText::update();
|
||||
|
||||
RCT r = _client;
|
||||
r.top += CHARY;
|
||||
r.right-=4; r.bottom-=ROWY/2;
|
||||
@ -592,7 +593,7 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
||||
_accel *= CHARX;
|
||||
|
||||
_dx = (right-left-strlen(caption())*CHARX) >> 1;
|
||||
_dy = ((height-CHARY) >> 1) + CHARY-3;
|
||||
_dy = byte(height+BASEY) >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -776,7 +777,7 @@ void TTag_button::update() const
|
||||
#endif
|
||||
|
||||
char n[4]; sprintf(n, "%d", i+1);
|
||||
win_draw_text(_hdc, (width-CHARX)/2 + i*width, CHARY-3, n, -1);
|
||||
win_draw_text(_hdc, (width-CHARX)/2 + i*width, BASEY, n, -1);
|
||||
}
|
||||
|
||||
CPEN pen;
|
||||
@ -882,14 +883,14 @@ void TCheckbox::update() const
|
||||
TButton::update();
|
||||
|
||||
const int x = _client.left+20;
|
||||
const int y = _client.top + CHARY-1;
|
||||
const int y = _client.top + BASEY;
|
||||
|
||||
if (focused())
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
RECT r;
|
||||
r.left = x-2; r.top = _client.top;
|
||||
r.right = _client.right; r.bottom = _client.bottom;
|
||||
r.right = _client.right; r.bottom = y+3;
|
||||
|
||||
HWND hwnd = (HWND)get_value(_hdc, ATTR_NATIVE_WINDOW);
|
||||
HDC hdc = GetDC(hwnd);
|
||||
@ -959,10 +960,10 @@ WINDOW xvt_create_pushbutton(
|
||||
pb = new TTag_button(parent, (byte)flags, (byte)app_data);
|
||||
break;
|
||||
default:
|
||||
if (bottom-top > ROWY)
|
||||
if (bottom-top > (CHARY<<1))
|
||||
{
|
||||
top += 6;
|
||||
bottom -= ROWY/2 -4;
|
||||
top += CHARY>>1;
|
||||
bottom -= CHARY>>1;
|
||||
}
|
||||
pb = new TPush_button(left, top, right, bottom,
|
||||
caption, parent,
|
||||
|
@ -14,10 +14,6 @@
|
||||
#include <applicat.h>
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_DOS
|
||||
#include <holdev.h>
|
||||
#endif
|
||||
|
||||
#include <execp.h>
|
||||
|
||||
|
||||
@ -38,39 +34,32 @@ int TExternal_app::run(bool async)
|
||||
// save cwd
|
||||
save_dir();
|
||||
|
||||
|
||||
#if XVT_OS == XVT_OS_DOS
|
||||
|
||||
// ems swap
|
||||
setems(1);
|
||||
// *** BLinker support; uncomment as needed
|
||||
// BLIUNHOOK();
|
||||
// *******************
|
||||
char* s = getenv("TMPDIR");
|
||||
if (s == NULL)
|
||||
_exitcode = holdev("\\tmp;",0,_path);
|
||||
else
|
||||
_exitcode = holdev(s,0,_path);
|
||||
// *** BLinker support; uncomment as needed
|
||||
// BLREINIT();
|
||||
// *******************
|
||||
if (!_exitcode)
|
||||
_exitcode = childret();
|
||||
else
|
||||
_exitcode = -_exitcode;
|
||||
xvt_escape(XVT_ESC_CH_REFRESH);
|
||||
|
||||
#elif XVT_OS == XVT_OS_WIN
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||
_exitcode = WinExec((char*)_path, SW_SHOW);
|
||||
if (_exitcode >= 32)
|
||||
{
|
||||
if (!async) MainApp()->wait_for(_path);
|
||||
_exitcode = 0;
|
||||
}
|
||||
else
|
||||
error_box("Impossibile eseguire '%s':\nErrore %d", (const char*)_path, _exitcode);
|
||||
|
||||
const int req = 25;
|
||||
int perc = GetFreeSystemResources(GFSR_SYSTEMRESOURCES);
|
||||
if (perc < req)
|
||||
{
|
||||
if (yesno_box("Le risorse di Windows sono quasi esaurite:\n"
|
||||
"eseguire ugualmente l'applicazione %s", (const char*)_path))
|
||||
perc = req;
|
||||
else
|
||||
_exitcode = 8;
|
||||
}
|
||||
|
||||
if (perc >= req)
|
||||
{
|
||||
_exitcode = WinExec((char*)_path, SW_SHOW);
|
||||
|
||||
if (_exitcode >= 32)
|
||||
{
|
||||
if (!async) main_app().wait_for(_path);
|
||||
_exitcode = 0;
|
||||
}
|
||||
else
|
||||
error_box("Impossibile eseguire '%s':\nErrore %d", (const char*)_path, _exitcode);
|
||||
}
|
||||
set_cursor(TASK_WIN, CURSOR_ARROW);
|
||||
#else
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: maskfld.cpp,v 1.37 1994-10-26 09:14:44 guy Exp $
|
||||
// $Id: maskfld.cpp,v 1.38 1994-10-31 12:09:31 guy Exp $
|
||||
#include <xvt.h>
|
||||
|
||||
#include <applicat.h>
|
||||
@ -2884,7 +2884,7 @@ void TRadio_field::create(WINDOW parent)
|
||||
|
||||
if (_prompt.not_empty())
|
||||
{
|
||||
const int dy = _flags.persistent ? 3 : items+2;
|
||||
const int dy = _flags.zerofilled ? 3 : items+2;
|
||||
create_prompt(parent, _width, dy);
|
||||
}
|
||||
_x++; _y++;
|
||||
@ -2892,7 +2892,7 @@ void TRadio_field::create(WINDOW parent)
|
||||
|
||||
const char* s;
|
||||
|
||||
const int width = _flags.persistent ? (_width-2)/items-1 : _width-2;
|
||||
const int width = _flags.zerofilled ? (_width-2)/items-1 : _width-2;
|
||||
for(_nitems = 0; (s = _values.get()) != NULL; _nitems++)
|
||||
{
|
||||
CHECKD(_nitems < MAX_RADIO, "Too many items in radio button ", id);
|
||||
@ -2901,7 +2901,7 @@ void TRadio_field::create(WINDOW parent)
|
||||
_radio_ctl_win[_nitems] = _win;
|
||||
_dlg += 1000;
|
||||
|
||||
if (_flags.persistent)
|
||||
if (_flags.zerofilled)
|
||||
_x += width+1;
|
||||
else
|
||||
_y++;
|
||||
|
@ -88,13 +88,12 @@ public:
|
||||
virtual ~TSpreadsheet();
|
||||
};
|
||||
|
||||
// Certified 99%
|
||||
// Certified 100%
|
||||
void TSpreadsheet::init()
|
||||
{
|
||||
static bool first = TRUE;
|
||||
if (!first) return;
|
||||
|
||||
xvt_set_font(TASK_WIN, FF_FIXED, 0);
|
||||
DRAW_CTOOLS ct;
|
||||
win_get_draw_ctools(TASK_WIN, &ct);
|
||||
xi_set_font(&ct.font);
|
||||
@ -127,6 +126,9 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
TToken_string header(head);
|
||||
TToken_string new_header(256);
|
||||
int i = 0, tot_width = NUMBER_WIDTH+1;
|
||||
int f_width = tot_width<<1; // Stima larghezza colonne fisse
|
||||
int max_width = f_width; // Stima larghezza della colonna piu' grande
|
||||
|
||||
for (const char* h = header.get(); h; h = header.get(), i++)
|
||||
{
|
||||
CHECKD(i < MAX_COL, "Tu meni calumns in scit: ", i);
|
||||
@ -141,9 +143,12 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
if (at >= 0)
|
||||
{
|
||||
const TString& wi = testa.mid(at+1);
|
||||
if (wi[wi.len()-1] == 'F')
|
||||
fixed_columns++;
|
||||
m = atoi(wi);
|
||||
if (wi[wi.len()-1] == 'F')
|
||||
{
|
||||
fixed_columns++;
|
||||
f_width += m+1;
|
||||
}
|
||||
testa.cut(at);
|
||||
v = max(at, m+(f->has_query() ? 1 : 0));
|
||||
}
|
||||
@ -155,6 +160,8 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
|
||||
m_width[i] = m+1; // m = number of allowed chars
|
||||
v_width[i] = v+1; // v = width of column
|
||||
if (v >= max_width) max_width = v+1;
|
||||
|
||||
tot_width += v_width[i];
|
||||
|
||||
new_header.add(testa);
|
||||
@ -170,8 +177,11 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
}
|
||||
|
||||
RCT rct = resize_rect(x, y, dx, dy, WO_TE, parent);
|
||||
rct.right -= 28;
|
||||
rct.bottom -= 8;
|
||||
rct.right -= 28;
|
||||
|
||||
if ((f_width+max_width)*CHARX > rct.right)
|
||||
fixed_columns = 1;
|
||||
|
||||
XI_OBJ_DEF* itfdef = xi_create_itf_def(ITF_CID,
|
||||
(XI_EVENT_HANDLER)xiev_handler, &rct, (char*)maskname,
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: relapp.cpp,v 1.21 1994-10-26 12:23:10 guy Exp $
|
||||
// $Id: relapp.cpp,v 1.22 1994-10-31 12:09:42 guy Exp $
|
||||
#include <mailbox.h>
|
||||
#include <sheet.h>
|
||||
#include <urldefid.h>
|
||||
@ -279,12 +279,17 @@ int TRelation_application::set_mode(int mode)
|
||||
const char* t = "";
|
||||
switch(mode)
|
||||
{
|
||||
case MODE_QUERY : t = "Ricerca"; break;
|
||||
case MODE_MOD : t = "Modifica"; break;
|
||||
case NO_MODE : t = "Ricerca/Inserimento"; break;
|
||||
case MODE_INS : t = "Inserimento"; break;
|
||||
default : break;
|
||||
}
|
||||
case MODE_QUERY:
|
||||
t = "Ricerca"; break;
|
||||
case MODE_MOD:
|
||||
t = "Modifica"; break;
|
||||
case NO_MODE:
|
||||
t = "Ricerca/Inserimento"; break;
|
||||
case MODE_INS:
|
||||
t = "Inserimento"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
xvt_statbar_set(t);
|
||||
|
||||
@ -707,7 +712,7 @@ bool TRelation_application::main_loop()
|
||||
case K_QUIT:
|
||||
if (save(TRUE))
|
||||
{
|
||||
if (_mask->mode() == MODE_MOD &&
|
||||
if (_mask->edit_mode() &&
|
||||
(_autoins_caller.not_empty() || _lnflag))
|
||||
recins = file().recno();
|
||||
}
|
||||
@ -739,10 +744,8 @@ bool TRelation_application::main_loop()
|
||||
insert_mode();
|
||||
break;
|
||||
case K_DEL:
|
||||
{
|
||||
if (relation_remove())
|
||||
query_mode();
|
||||
}
|
||||
break;
|
||||
case K_F9:
|
||||
if (save(TRUE))
|
||||
|
@ -182,7 +182,7 @@ bool TWindow::_ctools_saved;
|
||||
|
||||
TWindow::TWindow()
|
||||
: _win(NULL_WIN), _open(FALSE), _modal(FALSE),
|
||||
_running(FALSE), _lastkey(0)
|
||||
_running(FALSE), _pixmap(FALSE), _lastkey(0)
|
||||
{}
|
||||
|
||||
|
||||
@ -526,15 +526,22 @@ void TWindow::set_font(int family, int style, int dim)
|
||||
PNT TWindow::log2dev(long x, long y) const
|
||||
{
|
||||
PNT pnt;
|
||||
pnt.h = (int)x*CHARX;
|
||||
pnt.v = (int)y*CHARY;
|
||||
|
||||
pnt.h = (int)x;
|
||||
pnt.v = (int)y;
|
||||
|
||||
if (!_pixmap)
|
||||
{
|
||||
pnt.h *= CHARX;
|
||||
pnt.v *= CHARY;
|
||||
}
|
||||
|
||||
return pnt;
|
||||
}
|
||||
|
||||
TPoint TWindow::dev2log(const PNT& p) const
|
||||
{
|
||||
TPoint pnt(p.h / CHARX, p.v / CHARY);
|
||||
TPoint pnt(_pixmap ? p.h : p.h/CHARX, _pixmap ? p.v : p.v/CHARY);
|
||||
return pnt;
|
||||
}
|
||||
|
||||
@ -543,7 +550,7 @@ void TWindow::stringat(short x, short y, const char* str)
|
||||
{
|
||||
PNT pnt = log2dev(x,y);
|
||||
#if XVTWS != WMVS
|
||||
pnt.v += CHARY-3;
|
||||
pnt.v += BASEY;
|
||||
#endif
|
||||
|
||||
win_draw_text(win(), pnt.h, pnt.v, (char *)str, -1);
|
||||
|
@ -46,8 +46,8 @@ class TWindow
|
||||
friend class TWindow_manager;
|
||||
|
||||
// @DPRIV
|
||||
static DRAW_CTOOLS _ct; // Set di drawing tools (xvttype.h)
|
||||
static bool _ctools_saved; // E' stata salvata _ct ?
|
||||
static DRAW_CTOOLS _ct; // Set di drawing tools (xvttype.h)
|
||||
static bool _ctools_saved; // E' stata salvata _ct ?
|
||||
|
||||
WINDOW _win; // Descrittore finestra
|
||||
KEY _lastkey; // Tasto di uscita
|
||||
@ -61,6 +61,7 @@ protected:
|
||||
bool _open : 1; // Se la finestra e' aperta
|
||||
bool _modal : 1; // Se la finestra e' modale
|
||||
bool _running : 1; // Se la finestra e' in esecuzione
|
||||
bool _pixmap : 1; // Se se le coordiante sono in pixel
|
||||
|
||||
// @FPROT
|
||||
static long window_handler(WINDOW win, EVENT* ep);
|
||||
|
@ -22,7 +22,7 @@ void fatal_hook()
|
||||
|
||||
short CHARX = 8;
|
||||
short CHARY = 8;
|
||||
short COLX = 8;
|
||||
short BASEY = 8;
|
||||
short ROWY = 8;
|
||||
|
||||
COLOR MASK_BACK_COLOR = COLOR_WHITE;
|
||||
@ -36,6 +36,7 @@ COLOR FOCUS_BACK_COLOR = COLOR_WHITE;
|
||||
#else
|
||||
|
||||
#include <windows.h>
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __CTL3D__
|
||||
#include <ctl3d.h>
|
||||
@ -64,24 +65,14 @@ extern "C" {
|
||||
}
|
||||
#include <controls.h>
|
||||
|
||||
short COLX = 8;
|
||||
short ROWY = GetSystemMetrics(SM_CYSCREEN) / 25;
|
||||
short CHARX = 8;
|
||||
short ROWY = GetSystemMetrics(SM_CYSCREEN) / 25;
|
||||
short CHARY = 14;
|
||||
short BASEY = 12;
|
||||
|
||||
HIDDEN LOGFONT NormalLogFont =
|
||||
{
|
||||
CHARY-3, CHARX,
|
||||
0, 0,
|
||||
300, FALSE, FALSE, FALSE,
|
||||
OEM_CHARSET,
|
||||
OUT_TT_PRECIS,
|
||||
CLIP_STROKE_PRECIS,
|
||||
PROOF_QUALITY,
|
||||
FIXED_PITCH | FF_SYSTEM,
|
||||
(LPSTR)"Courier New"
|
||||
};
|
||||
HIDDEN HFONT NormalFont = CreateFontIndirect(&NormalLogFont);
|
||||
HIDDEN HFONT NormalFont = NULL;
|
||||
HIDDEN LOGFONT LogFont;
|
||||
HIDDEN int FontWeight;
|
||||
|
||||
#ifdef __CTL3D__
|
||||
COLOR MASK_BACK_COLOR = COLOR_LTGRAY;
|
||||
@ -246,9 +237,11 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
|
||||
{
|
||||
if (y >= 0) y++;
|
||||
if (x > 0 || (wt != WO_TE && x == 0))
|
||||
{
|
||||
const int width = (int)get_value(NULL_WIN, ATTR_SCREEN_WIDTH);
|
||||
if (width > 640) x += (width-640) / (2*COLX);
|
||||
{
|
||||
RCT pc; get_client_rect(parent, &pc); // Get parent window size
|
||||
const int width = pc.right;
|
||||
const int tot = 80*CHARX;
|
||||
if (width > tot) x += (width-tot) / (CHARX<<1);
|
||||
}
|
||||
}
|
||||
wt = WC_EDIT;
|
||||
@ -258,23 +251,23 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
|
||||
switch (wt)
|
||||
{
|
||||
case WC_EDIT :
|
||||
r.left = (x+1)*COLX;
|
||||
r.left = (x+1)*CHARX;
|
||||
r.top = y*ROWY;
|
||||
r.right = dx*CHARX;
|
||||
r.bottom = CHARY+3;
|
||||
r.bottom = (CHARY << 1) - BASEY;
|
||||
if (dy > 1)
|
||||
r.bottom += ROWY*(dy-1);
|
||||
break;
|
||||
case W_DOC:
|
||||
r.left = x * COLX;
|
||||
r.left = x * CHARX;
|
||||
r.top = y * ROWY;
|
||||
r.right = dx * CHARX;
|
||||
r.bottom = dy * CHARY;
|
||||
break;
|
||||
default:
|
||||
r.left = x * COLX;
|
||||
r.left = x * CHARX;
|
||||
r.top = y * ROWY;
|
||||
r.right = (dx+2)*COLX;
|
||||
r.right = (dx+2)*CHARX;
|
||||
r.bottom = dy*ROWY-1;
|
||||
break;
|
||||
}
|
||||
@ -305,7 +298,7 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
|
||||
r.left = spc + num*(spc+r.right);
|
||||
}
|
||||
else
|
||||
r.left = MAXX - r.right - x*COLX;
|
||||
r.left = MAXX - r.right - x*CHARX;
|
||||
}
|
||||
|
||||
if (y < 0)
|
||||
@ -323,7 +316,7 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
|
||||
r.top = MAXY - r.bottom - (y-1)*ROWY;
|
||||
}
|
||||
|
||||
if (dx <= 0) r.right = MAXX + dx*COLX;
|
||||
if (dx <= 0) r.right = MAXX + dx*CHARX;
|
||||
else r.right += r.left;
|
||||
if (dy <= 0) r.bottom = MAXY + dy*ROWY;
|
||||
else r.bottom += r.top;
|
||||
@ -481,7 +474,6 @@ void dispatch_e_scroll(WINDOW win, KEY key)
|
||||
if (w != SC_NONE) dispatch_event(win, &e);
|
||||
}
|
||||
|
||||
|
||||
void customize_controls(bool on)
|
||||
{
|
||||
#if XVTWS == WMWS
|
||||
@ -495,13 +487,16 @@ void customize_controls(bool on)
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (on)
|
||||
{
|
||||
const long taskwin_style = WSF_ICONIZABLE | WSF_SIZE | WSF_CLOSE | WSF_MAXIMIZED;
|
||||
set_value(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE, taskwin_style);
|
||||
const long TWIN_STYLE = WSF_ICONIZABLE | WSF_SIZE | WSF_CLOSE | WSF_MAXIMIZED;
|
||||
set_value(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE, TWIN_STYLE);
|
||||
|
||||
set_value(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
|
||||
set_value(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
|
||||
|
||||
NormalFont = GetStockObject(ANSI_FIXED_FONT);
|
||||
GetObject(NormalFont, sizeof(LOGFONT), &LogFont);
|
||||
#ifdef __CTL3D__
|
||||
set_value(NULL_WIN,ATTR_WIN_CREATEWINDOW_HOOK, (long)createwindow_hook);
|
||||
// set_value(NULL_WIN,ATTR_WIN_CREATEWINDOW_HOOK, (long)createwindow_hook);
|
||||
HINSTANCE _hInstance = (HINSTANCE)get_value(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
Ctl3dRegister(_hInstance);
|
||||
Ctl3dAutoSubclass(_hInstance);
|
||||
@ -527,19 +522,62 @@ void customize_controls(bool on)
|
||||
}
|
||||
|
||||
|
||||
void xvt_init_font()
|
||||
{
|
||||
NormalFont = GetStockObject(ANSI_FIXED_FONT);
|
||||
GetObject(NormalFont, sizeof(LOGFONT), &LogFont);
|
||||
|
||||
TConfig font(CONFIG_GENERAL, "Font");
|
||||
CHARY = (int)font.get_long("Height");
|
||||
if (CHARY > 0)
|
||||
{
|
||||
LogFont.lfHeight = CHARY;
|
||||
LogFont.lfWidth = (int)font.get_long("Width");
|
||||
LogFont.lfWeight = FontWeight = (int)font.get_long("Weight");
|
||||
LogFont.lfCharSet = (int)font.get_long("CharSet");
|
||||
LogFont.lfClipPrecision = (int)font.get_long("Clip");
|
||||
LogFont.lfOutPrecision = (int)font.get_long("Precision");
|
||||
LogFont.lfQuality = (int)font.get_long("Quality");;
|
||||
LogFont.lfPitchAndFamily = (int)font.get_long("Pitch");
|
||||
strcpy(LogFont.lfFaceName, font.get("Name"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFont.lfHeight = CHARY = 10;
|
||||
FontWeight = 400;
|
||||
}
|
||||
NormalFont = CreateFontIndirect(&LogFont);
|
||||
xvt_set_font(TASK_WIN, FF_FIXED, 0);
|
||||
|
||||
// Get true text size
|
||||
TEXTMETRIC tm;
|
||||
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
HDC hdc = GetDC(hwnd);
|
||||
GetTextMetrics(hdc, &tm);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
|
||||
const int COLX = GetSystemMetrics(SM_CXSCREEN) / 80;
|
||||
CHARX = tm.tmAveCharWidth+1;
|
||||
if (CHARX > COLX) CHARX = COLX;
|
||||
|
||||
CHARY = tm.tmHeight;
|
||||
BASEY = tm.tmAscent;
|
||||
if (CHARY > ROWY-2) CHARY = ROWY-2;
|
||||
}
|
||||
|
||||
|
||||
void xvt_set_font(WINDOW win, int family, int style, int dim)
|
||||
{
|
||||
CHECK(win != NULL_WIN, "Can't set the font in a NULL window");
|
||||
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (dim < 1)
|
||||
{
|
||||
NormalLogFont.lfHeight = (style & FS_BOLD) ? CHARY-1 : CHARY-3;
|
||||
NormalLogFont.lfWidth = (style & FS_BOLD) ? CHARX-1 : CHARX;
|
||||
NormalLogFont.lfWeight = (style & FS_BOLD) ? 600 : 300;
|
||||
NormalLogFont.lfItalic = (style & FS_ITALIC) ? TRUE : FALSE;
|
||||
set_value(NULL_WIN, ATTR_WIN_PM_LOGFONT, long(&NormalLogFont));
|
||||
// LogFont.lfWidth = (style & FS_BOLD) ? width : width;
|
||||
// LogFont.lfHeight = CHARY + ((style & FS_BOLD) ? 2 : 0);
|
||||
LogFont.lfWeight = FontWeight + ((style & FS_BOLD) ? 300 : 0);
|
||||
LogFont.lfItalic = (style & FS_ITALIC) ? TRUE : FALSE;
|
||||
set_value(NULL_WIN, ATTR_WIN_PM_LOGFONT, (long)&LogFont);
|
||||
set_value(NULL_WIN, ATTR_WIN_PM_USERFONT, TRUE);
|
||||
win_set_font(win, NULL, FALSE);
|
||||
set_value(NULL_WIN, ATTR_WIN_PM_USERFONT, FALSE);
|
||||
@ -578,7 +616,7 @@ WINDOW xvt_create_window(WIN_TYPE wt,
|
||||
{
|
||||
HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW);
|
||||
word style = GetClassWord(hwnd, GCW_STYLE);
|
||||
style |= CS_BYTEALIGNCLIENT | CS_SAVEBITS;
|
||||
style |= CS_BYTEALIGNCLIENT;
|
||||
SetClassWord(hwnd, GCW_STYLE, style);
|
||||
to_set = FALSE;
|
||||
}
|
||||
@ -679,11 +717,6 @@ const char* xvt_get_title(WINDOW win)
|
||||
const TControl* c = TControl::WINDOW2TControl(win);
|
||||
return c->caption();
|
||||
#else
|
||||
/*
|
||||
static char title[81];
|
||||
get_title(win, title, 80);
|
||||
return title;
|
||||
*/
|
||||
get_title(win, __tmp_string, 80);
|
||||
return __tmp_string;
|
||||
#endif
|
||||
@ -771,21 +804,19 @@ WINDOW xvt_create_statbar()
|
||||
const int prop_count = 4;
|
||||
char* prop_list[prop_count+1] =
|
||||
{
|
||||
"",
|
||||
"Status bar",
|
||||
"HEIGHT=23",
|
||||
"TASK_WIN=TRUE",
|
||||
"TASK_WIN",
|
||||
"FIELD_OFFSET=24",
|
||||
NULL
|
||||
};
|
||||
|
||||
statbar = statbar_create(-1, 0, 0, 1, 1, prop_count, prop_list,
|
||||
TASK_WIN, 0, 0, NULL);
|
||||
xvt_set_font(statbar, FF_FIXED, 0);
|
||||
DRAW_CTOOLS ct;
|
||||
win_get_draw_ctools(statbar, &ct);
|
||||
#ifndef XVT_R3_API
|
||||
statbar = statbar_create(0, 0, 600, 1024, 800, prop_count, prop_list,
|
||||
TASK_WIN, 0, 0, "");
|
||||
|
||||
xvt_init_font();
|
||||
DRAW_CTOOLS ct; win_get_draw_ctools(TASK_WIN, &ct);
|
||||
statbar_set_font(statbar, &ct.font);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return statbar;
|
||||
@ -798,7 +829,7 @@ void xvt_statbar_set(const char* text)
|
||||
{
|
||||
stattext.strncpy(text, 56);
|
||||
const TDate oggi(TODAY);
|
||||
stattext << '\t' << oggi.string() << " - " << MainApp()->title();
|
||||
stattext << '\t' << oggi.string() << " - " << main_app().title();
|
||||
}
|
||||
statbar_set_title(statbar, (char*)(const char*)stattext);
|
||||
#endif
|
||||
|
@ -63,7 +63,7 @@ WINDOW xvt_create_window(WIN_TYPE wt,
|
||||
|
||||
/* @END */
|
||||
|
||||
extern short CHARX, CHARY, COLX, ROWY;
|
||||
extern short CHARX, CHARY, BASEY, ROWY;
|
||||
|
||||
/* @END */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user