Patch level : 2.0 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
eliminato completamente os_dep.h ed os_win32.cpp
togliere dai progetti delle librerie os_win32.cpp


git-svn-id: svn://10.65.10.50/trunk@11022 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-04-16 15:49:59 +00:00
parent d5abdda769
commit 2edfb10238
23 changed files with 349 additions and 745 deletions

@ -6,7 +6,6 @@
#include <extcdecl.h>
#include <mask.h>
#include <modaut.h>
#include <os_dep.h>
#include <prefix.h>
#include <printer.h>
#include <progind.h>
@ -359,7 +358,11 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
void TApplication::dispatch_e_menu(MENU_TAG tag)
{
::dispatch_e_menu(TASK_WIN, tag);
// ::dispatch_e_menu(TASK_WIN, tag);
EVENT e; memset(&e, 0, sizeof(e));
e.type = E_COMMAND;
e.v.cmd.tag = tag;
xvt_win_post_event(TASK_WIN, &e);
}
long TApplication::handler(WINDOW win, EVENT* ep)
@ -418,7 +421,10 @@ long TApplication::handler(WINDOW win, EVENT* ep)
{
WINDOW w = cur_win();
if (w != NULL_WIN && w != win)
::dispatch_e_menu(w, ep->v.cmd.tag);
{
// ::dispatch_e_menu(w, ep->v.cmd.tag);
dispatch_event(w, *ep, TRUE);
}
}
else
{
@ -1049,9 +1055,9 @@ bool TApplication::firm_change_enabled() const
// @comm Praticamente controlla se e' stato lanciato da ba0 o dal program manager
{
#ifdef _DEMO_
return FALSE;
return false;
#else
return ::os_spawn_by_menu();
return true;
#endif
}

@ -1,8 +1,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <xvt.h>
#include <checks.h>
#include <keys.h>
#include <os_dep.h>
#define buildmsg() char msg[256];va_list argptr;va_start(argptr,fmt);vsprintf(msg,fmt,argptr);va_end(argptr)

@ -1,10 +1,10 @@
#ifndef __CHECKS_H
#define __CHECKS_H
#ifndef __STDTYPES_H
#include <stdtypes.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif

@ -15,7 +15,6 @@ extern "C"
#include <controls.h>
#include <image.h>
#include <mask.h>
#include <os_dep.h>
#include <urldefid.h>
#include <statbar.h>
@ -407,10 +406,6 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
width = max_rct.right + dx * CHARX;
if (left > 0)
width -= left;
#ifndef XVAGA
if (!tag && dx == 0 && y > 0) // Aggiusta toolbar
top++;
#endif
}
if (x < 0) left = (max_rct.right - width) / 2;
@ -484,11 +479,6 @@ void attach_interface(WINDOW win, COLOR back)
{
xvt_win_set_handler(win, (EVENT_HANDLER)xi_event);
/* xvt_vobj_translate_points NON funziona! Ma qui non serve.
RCT rc; xvt_vobj_get_client_rect(win, &rc);
WINDOW wp = xvt_vobj_get_parent(win);
xvt_vobj_translate_points(win, wp, (PNT*)&rc, 2);
*/
RCT rc; xvt_vobj_get_outer_rect(win, &rc);
char caption[80]; xvt_vobj_get_title(win, caption, 80);
@ -1480,7 +1470,7 @@ TPushbutton_control::TPushbutton_control(WINDOW win, short cid,
short left, short top, short width, short height,
const char* flags, const char* text,
short bmp_up, short bmp_dn)
: _bmp_up(bmp_up), _bmp_dn(bmp_dn), _native_hicon(0)
: _bmp_up(bmp_up), _bmp_dn(bmp_dn)
{
create(win, cid, left, top, width, height, flags, text, WC_PUSHBUTTON, NULL);
@ -1488,9 +1478,7 @@ TPushbutton_control::TPushbutton_control(WINDOW win, short cid,
}
TPushbutton_control::~TPushbutton_control()
{
if (_native_hicon)
os_destroy_native_icon(_native_hicon);
{
}
char TPushbutton_control::mnemonic() const
@ -1506,26 +1494,19 @@ void TPushbutton_control::set_caption(const char* c)
if (*cap)
{
TControl::set_caption(cap);
set_native_icon(0);
set_central_icon(0);
set_bmp(0, 0);
_obj->v.btn->drawable = FALSE;
_obj->v.btn->fore_color = color;
}
}
void TPushbutton_control::set_native_icon(unsigned hicon)
void TPushbutton_control::set_central_icon(unsigned int hicon)
{
if (_native_hicon)
{
os_destroy_native_icon(_native_hicon);
_native_hicon = 0;
}
if (hicon)
{
_native_hicon = hicon;
set_bmp(0, 0);
_obj->v.btn->drawable = TRUE;
}
xi_set_icon(_obj, hicon, hicon);
_obj->v.btn->icon_x = (_obj->v.btn->rct.right - _obj->v.btn->rct.left - 32) / 2 - 5;
_obj->v.btn->icon_y = (_obj->v.btn->rct.bottom - _obj->v.btn->rct.top - 32) / 2 - 5;
_obj->v.btn->drawable = FALSE;
}
void TPushbutton_control::set_bmp(short bmp_up, short bmp_dn)
@ -1534,7 +1515,7 @@ void TPushbutton_control::set_bmp(short bmp_up, short bmp_dn)
{
_bmp_up = (bmp_up > 0 && _picture->add(bmp_up)) ? bmp_up : 0;
_bmp_dn = (bmp_dn > 0 && _picture->add(bmp_dn)) ? bmp_dn : _bmp_up;
set_native_icon(0);
set_central_icon(0);
}
else
_bmp_up = _bmp_dn = 0;
@ -1561,17 +1542,6 @@ void TPushbutton_control::update()
xvt_dwin_set_std_cpen(win, TL_PEN_HOLLOW);
xvt_dwin_draw_rect(win, &rct);
if (_native_hicon)
{
if (_obj->v.btn->down)
{
rct.left += 2; rct.right += 2;
rct.top += 2; rct.bottom += 2;
}
os_draw_native_icon(win, rct, _native_hicon);
return;
}
const short bmp = (_bmp_dn > 0 && _obj->v.btn->down) ? _bmp_dn : _bmp_up;
if (bmp > 0)
{

@ -208,7 +208,6 @@ public:
class TPushbutton_control : public TButton_control
{
short _bmp_up, _bmp_dn;
unsigned _native_hicon;
protected:
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
@ -220,7 +219,7 @@ public:
virtual void set_caption(const char* c);
void set_bmp(short up, short dn);
void set_native_icon(unsigned hicon);
void set_central_icon(unsigned int hicon);
char mnemonic() const;
TPushbutton_control(WINDOW win, short cid,

@ -1,10 +1,9 @@
#include <stdlib.h>
#include <xvt.h>
#include <applicat.h>
#include <config.h>
#include <dongle.h>
#include <isamrpc.h>
#include <os_dep.h>
#include <utility.h>
///////////////////////////////////////////////////////////
@ -523,7 +522,7 @@ bool TDongle::network_login(bool test_all_keys)
int TDongle::can_try_server() const
{
if (os_dongle_server_running())
if (xvt_sys_dongle_server_is_running())
return 3;
TConfig ini(CONFIG_INSTALL, "Server");

@ -1,6 +1,7 @@
#include <xvt.h>
#include <dongle.h>
#include <execp.h>
#include <os_dep.h>
#include <prefix.h>
#include <recarray.h>
@ -8,12 +9,12 @@
// @mfunc Esegue il processo
//
// @rdesc Ritorna il codice di uscita del processo (-1 in caso di errore).
word TExternal_app::run(
// @rdesc Ritorna il codice di uscita del processo (0 in caso di errore).
long TExternal_app::run(
bool async, // @parm Per eseguire il processo in parallelo
byte utente, // @parm Permette di inserire il nome dell'utente nella riga di comando
bool iconize, // @parm Iconizza il programma chiamante
bool show) // @parm Mostra o nascondi il programma chiamato
bool iconize) // @parm Iconizza il programma chiamante
// ,bool show) // @parm Mostra o nascondi il programma chiamato
// @comm Se <p asyn> e' FALSE aspetta che termini il processo in esecuzione prima di iniziare il nuovo
@ -37,12 +38,9 @@ word TExternal_app::run(
if (!our_app)
utente = FALSE;
}
if (utente)
path << " /u" << user();
_exitcode = 0;
// save cwd
DIRECTORY oldir;
xvt_fsys_get_dir(&oldir);
@ -56,13 +54,15 @@ word TExternal_app::run(
}
if (!async)
{
safely_close_closeable_isamfiles();
if (dongle().local())
dongle().logout();
}
if (dongle().local())
dongle().logout();
iconize &= !async && show;
_exitcode = os_execute(path, !async, iconize, show);
// iconize &= !async && show;
// _exitcode = os_execute(path, !async, iconize, show);
_exitcode = xvt_sys_execute(path, !async, iconize);
// restore cwd
xvt_fsys_set_dir(&oldir);
@ -76,7 +76,7 @@ word TExternal_app::run(
// non ci saranno piu' posti liberi nell'HL_server: il programma comunque non
// puo' interrompersi a meta'; ecco perche il valore di ritorno di HL_LOGIN viene
// ignorato.
if (dongle().local())
if (!async && dongle().local())
dongle().login();
return _exitcode;

@ -35,7 +35,7 @@ public:
// @cmember Controlla se l'utente puo' eseguire il programma
bool can_run() const;
// @cmember Esegue il processo
word run(bool async = FALSE, byte user = TRUE, bool iconize = TRUE, bool show = TRUE);
long run(bool async = FALSE, byte user = TRUE, bool iconizetask = TRUE /*, bool showchild = TRUE */);
// @cmember Ritorna l'ultimo codice di uscita
int exitcode()
{ return _exitcode; }

@ -6,7 +6,6 @@
#include <expr.h>
#include <form.h>
#include <msksheet.h>
#include <os_dep.h>
#include <printer.h>
#include <relation.h>
#include <tabutil.h>

@ -7,7 +7,6 @@
#include <golem.h>
#include <image.h>
#include <msksheet.h>
#include <os_dep.h>
#include <prefix.h>
#include <relation.h>
#include <urldefid.h>
@ -23,156 +22,13 @@
// Liberamente tradotto da Windows Developer Journal August 1997
///////////////////////////////////////////////////////////////////////////////
HIDDEN long get_reg_key(HKEY key, const char* subkey, TString& retdata)
{
HKEY hkey;
long retval = RegOpenKey(key, subkey, &hkey);
if (retval == ERROR_SUCCESS)
{
long datasize = retdata.size();
RegQueryValue(hkey, NULL, retdata.get_buffer(), &datasize);
RegCloseKey(hkey);
}
return retval;
}
HIDDEN bool file2app(const char* filename, TString& app)
{
bool ok = FALSE;
if (*filename != '.')
{
HINSTANCE hinst = FindExecutable(filename, ".", app.get_buffer());
DWORD* pinst = (DWORD*)hinst;
UINT err = LOWORD(pinst);
ok = err > 32;
}
if (!ok)
{
TString ext(_MAX_EXT);
if (*filename == '.')
ext = filename;
else
_splitpath(filename, NULL, NULL, NULL, ext.get_buffer());
ext.lower();
TFilename key;
if (get_reg_key(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS)
{
key << "\\shell\\open\\command";
if (get_reg_key(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS)
{
key.strip("\"");
int pos = key.find("%1");
if (pos > 0)
key.cut(pos);
key.trim();
app = key;
ok = TRUE;
}
}
}
return ok;
}
HIDDEN bool internet_address(const char* filename)
{
const TFilename url(filename);
if (url.find("://") > 0)
return TRUE;
if (url.find("www.") >= 0)
return TRUE;
const char* extensions[] = { "com","edu","gov","it","mil","net","org", NULL };
const char* ext = url.ext();
for (int e = 0; extensions[e]; e++)
if (stricmp(ext, extensions[e]) == 0)
return TRUE;
return FALSE;
}
HIDDEN word file2icon(const char* filename)
{
TFilename key;
word icon = 0;
int icon_number = 0;
TString ext(_MAX_EXT);
if (*filename == '.' && strlen(filename) < _MAX_EXT)
ext = filename;
else
{
if (internet_address(filename))
ext = ".htm";
else
_splitpath(filename, NULL, NULL, NULL, ext.get_buffer());
}
ext.lower();
if (ext != ".exe")
{
if (get_reg_key(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS)
{
key << "\\DefaultIcon";
if (get_reg_key(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS) // Windows 95 only
{
const int comma = key.find(',');
if (comma > 0)
{
icon_number = atoi(key.mid(comma+1));
key.cut(comma);
}
}
else
{
if (!file2app(filename, key))
file2app(".htm", key);
}
}
}
else
key = filename;
// Toglie eventuali parametri sulla riga si comando
const int space_pos = key.find(' ');
if (space_pos > 0) key.cut(space_pos);
HINSTANCE hInst = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
HICON hicon = ExtractIcon(hInst, key, icon_number);
if (hicon == NULL && icon_number != 0)
hicon = ExtractIcon(hInst, key, 0);
if (hicon != NULL)
{
DWORD dwicon = DWORD((DWORD*)hicon);
icon = LOWORD(dwicon);
}
return icon;
}
HIDDEN word mail2icon()
HIDDEN unsigned int mail2icon()
{
word icon = 0;
// Non so se questo debba rimanere
TFilename key;
if (get_reg_key(HKEY_CLASSES_ROOT, "msgfile\\shell\\open\\command", key) == ERROR_SUCCESS)
{
const int space = key.find(' ');
if (space) key.cut(space);
icon = file2icon(key);
}
unsigned int icon = xvt_sys_load_icon(".eml");
if (icon == 0)
icon = file2icon(".eml");
icon = xvt_sys_load_icon(".msg");
if (icon == 0)
icon = file2icon(".msg");
if (icon == 0)
icon = file2icon(".mmf");
icon = xvt_sys_load_icon(".mmf");
return icon;
}
@ -187,7 +43,7 @@ bool goto_url(const char* url)
if (app.not_empty())
{
app << " \"" << url << '"';
UINT error = WinExec(app, SW_SHOWNORMAL);
UINT error = xvt_sys_execute(app, FALSE, FALSE);
if (error > 32)
return TRUE;
else
@ -199,18 +55,7 @@ bool goto_url(const char* url)
HINSTANCE hinst = ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
DWORD winst = DWORD((DWORD*)hinst);
UINT error = UINT(winst); // Tutto 'sto giro per evitare un warning
if (error <= 32)
{
if (file2app(".htm", app))
{
app << " \"" << url << '"';
error = WinExec(app, SW_SHOWNORMAL);
if (error > 32)
retflag = TRUE;
}
}
else
retflag = TRUE;
retflag = error > 32;
return retflag;
}
@ -410,12 +255,10 @@ bool TGolem_mask::ole_handler(TMask_field& f, KEY k)
file.temp(NULL, ext);
sm.set(S_FILE, file);
ofstream out(file);
out.close();
sheet.row(selected) = file;
sheet.force_update();
TFilename app; file2app(ext, app);
app << " \"" << file << '"';
WinExec(app, SW_SHOWNORMAL);
edit_url(file);
}
}
return TRUE;
@ -462,7 +305,7 @@ TGolem_mask::TGolem_mask()
FOR_EACH_ARRAY_ROW(list, r, row)
{
TString16 ext = *row;
unsigned icon;
unsigned int icon;
if (ext == "mailto")
{
@ -471,7 +314,7 @@ TGolem_mask::TGolem_mask()
else
{
ext.insert(".", 0);
icon = file2icon(ext);
icon = xvt_sys_load_icon(ext);
}
if (icon)
{
@ -479,7 +322,7 @@ TGolem_mask::TGolem_mask()
const int y = i < ITEMS_PER_ROW ? 0 : 2;
TButton_field& btn = add_button(301+i, 0, ext, x, y, 3, 2);
btn.set_handler(ole_handler);
btn.set_native_icon(icon);
btn.set_central_icon(icon);
i++;
if (i > MAX_ITEMS)
break;
@ -498,19 +341,19 @@ TString& TGolem_field::get_window_data()
void TGolem_field::set_window_data(const char* data)
{
unsigned icon = 0;
unsigned int icon = 0;
char* pipe = strchr(data, '|');
if (pipe)
{
*pipe = '\0'; // Poor man TToken_string
icon = file2icon(data);
icon = xvt_sys_load_icon(data);
*pipe = '|';
}
TPushbutton_control* btn = (TPushbutton_control*)_ctl;
if (icon)
btn->set_native_icon(icon);
btn->set_central_icon(icon);
else
btn->set_bmp(BMP_OLE, 0);
@ -787,11 +630,11 @@ bool TGolem_window::on_key(KEY k)
}
}
if (!cmd.exist())
file2app(file, cmd);
xvt_sys_find_editor(file, cmd.get_buffer(), cmd.size());
if (cmd.not_empty())
{
cmd << ' ' << file;
_last_handle = os_execute_in_window(cmd, win());
_last_handle = xvt_sys_execute_in_window(cmd, win());
}
}
}
@ -1368,220 +1211,3 @@ bool TMail_messages::remove()
}
///////////////////////////////////////////////////////////
// Obsolete DDE management
///////////////////////////////////////////////////////////
/*
#include <dde.h>
///////////////////////////////////////////////////////////
// DDE
///////////////////////////////////////////////////////////
static TDDE* CUR_DDE = NULL;
HIDDEN BOOLEAN hook(HWND hwnd,
UINT msg,
UINT wparam,
ULONG lparam,
long* ret)
{
CHECK(CUR_DDE, "No DDE available");
bool normal_process = TRUE;
if (CUR_DDE->hwnd() == (word)hwnd) switch (msg)
{
case WM_DDE_INITIATE:
if (wparam != CUR_DDE->hwnd()) // Non initiarti da solo!
{
ATOM app = LOWORD(lparam);
ATOM topic = HIWORD(lparam);
TString a(256), t(256);
if (app)
GlobalGetAtomName(app, (char*)(const char*)a, a.size());
if (topic)
GlobalGetAtomName(topic, (char*)(const char*)t, t.size());
bool ok = FALSE;
const char* an = CUR_DDE->get_app_name();
if (an && *an)
ok = a.empty() || a.compare(an, -1, TRUE) == 0;
if (ok) // Server name ok
{
const bool query_topics = t.empty() || t == "*";
TToken_string topics = CUR_DDE->get_topics();
ok = !topics.empty_items(); // No topics?
if (ok && !query_topics)
{
ok = FALSE;
// for (const char* topo = topics.get(0); topo; topo = topics.get())
FOR_EACH_TOKEN(topics, topo)
{
if (t.compare(topo, -1, TRUE) == 0)
{
ok = TRUE;
break;
}
}
}
if (ok) // Topic ok
{
ok = CUR_DDE->do_initiate(wparam, t);
if (ok) // Connection ok
{
if (!query_topics)
topics = t;
for (t = topics.get(0); t.not_empty(); t = topics.get())
{ // E' obbligatorio crearne dei nuovi! Non spostare fuori dal ciclo!
app = GlobalAddAtom(CUR_DDE->get_app_name());
topic = GlobalAddAtom(t);
SendMessage((HWND)wparam, WM_DDE_ACK, (WPARAM)hwnd, MAKELPARAM(app,topic));
}
}
}
}
normal_process = FALSE;
}
break;
case WM_DDE_ACK:
{
ATOM a = LOWORD(lparam); if (a) GlobalDeleteAtom(a);
ATOM t = HIWORD(lparam); if (t) GlobalDeleteAtom(t);
CUR_DDE->do_ack(wparam);
normal_process = FALSE;
}
break;
case WM_DDE_DATA:
{
ATOM i = HIWORD(lparam); if (i) GlobalDeleteAtom(i);
}
break;
case WM_DDE_EXECUTE:
{
const TString cmd((const char*)lparam);
DDEACK ack; memset(&ack, 0, sizeof(ack));
ack.fAck = CUR_DDE->do_execute(wparam, cmd);
// Ritorna indietro l'handle globale che verra' distrutto dal chiamante
PostMessage((HWND)wparam, WM_DDE_ACK, (WPARAM)hwnd, lparam);
normal_process = FALSE;
}
break;
case WM_DDE_TERMINATE:
CUR_DDE->do_terminate(wparam);
normal_process = FALSE;
break;
case WM_DROPFILES:
if (CUR_DDE->do_custom_message(msg, wparam, lparam))
{
*ret = 0;
normal_process = FALSE;
}
break;
default:
if (msg > (UINT)WM_USER && msg < 0x7FFF)
{
if (CUR_DDE->do_custom_message(msg, wparam, lparam))
normal_process = FALSE;
}
break;
}
return normal_process;
}
TDDE::TDDE()
: _server(0), _old_hook(-1)
{
CHECK(CUR_DDE == NULL, "Double DDE");
CUR_DDE = this;
_hwnd = (word)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
}
TDDE::~TDDE()
{
do_events(); // Flush degli venti in coda prima di sganciare tutto
terminate();
_hwnd = 0;
CUR_DDE = NULL;
}
bool TDDE::initiate(const char* app, const char* topic)
{
if (_old_hook == -1)
{
_old_hook = xvt_vobj_get_attr(NULL_WIN, ATTR_EVENT_HOOK);
xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, (long)hook);
}
_server = 0;
ATOM a_app = GlobalAddAtom(app);
ATOM a_topic = GlobalAddAtom(topic);
SendMessage(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)_hwnd, MAKELPARAM(a_app, a_topic));
GlobalDeleteAtom(a_app);
GlobalDeleteAtom(a_topic);
return _server != 0;
}
bool TDDE::execute(const char* cmd) const
{
HGLOBAL hg = GlobalAlloc(GMEM_DDESHARE, strlen(cmd)+1);
char* c = (char*)GlobalLock(hg);
strcpy(c, cmd);
GlobalUnlock(hg);
return PostMessage((HWND)_server, WM_DDE_EXECUTE, (WPARAM)_hwnd, MAKELPARAM(0, hg)) != 0;
}
bool TDDE::execute(const char* app, const char* topic, const char* cmd, const char* filename)
{
bool running = initiate(app, topic);
if (!running)
{
if (filename == NULL || *filename == '\0')
filename = app;
TExternal_app server(filename);
if (server.run(TRUE) == 0)
{
for (int failures = 0; !running && failures < 10; failures++)
{
const clock_t end = clock() + 3*CLOCKS_PER_SEC;
while (clock() < end)
do_events();
running = initiate(app, topic);
}
}
}
if (running)
{
if (cmd && *cmd)
execute(cmd);
terminate();
}
return running;
}
bool TDDE::start_server()
{
if (_old_hook == -1)
{
_old_hook = xvt_vobj_get_attr(NULL_WIN, ATTR_EVENT_HOOK);
xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, (long)hook);
}
return TRUE;
}
void TDDE::terminate()
{
if (_old_hook != -1)
{
xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, _old_hook);
_old_hook = -1;
PostMessage((HWND)_server, (WPARAM)_hwnd, WM_DDE_TERMINATE, (LPARAM)0);
_server = 0;
}
}
*/

@ -6,7 +6,6 @@
#include <colors.h>
#include <diction.h>
#include <msksheet.h>
#include <os_dep.h>
#include <prefix.h>
#include <relation.h>
#include <urldefid.h>

@ -1161,9 +1161,9 @@ void TButton_field::set_bmp(short up, short dn)
((TPushbutton_control*)_ctl)->set_bmp(up, dn);
}
void TButton_field::set_native_icon(unsigned icon)
void TButton_field::set_central_icon(unsigned icon)
{
((TPushbutton_control*)_ctl)->set_native_icon(icon);
((TPushbutton_control*)_ctl)->set_central_icon(icon);
}
///////////////////////////////////////////////////////////
@ -1892,8 +1892,10 @@ void TBrowse::parse_input(TScanner& scanner)
{
CHECKS(_inp_id.get_pos(s) < 0, "Duplicate input field ", s);
_inp_id.add(s);
if (scanner.popkey() == "SE") _inp_id << '@'; // Special FILTERing field
else scanner.push();
if (scanner.popkey() == "SE")
_inp_id << '@'; // Special FILTERing field
else
scanner.push();
}
}
@ -2095,17 +2097,19 @@ int TBrowse::do_input(
if (f.is_edit() && val.not_empty() && !filter_flag)
ne++; // Increment not empty fields count
}
TFieldref fldref(_inp_fn.get(), 0); // Output field
fldref.write(val, *_cursor->relation());
if (tofilter)
{
if (val.empty()) val.fill('~', fldref.len(cur));
const int len = fldref.len(cur);
if (val.len() < len)
val.left_just(len, '~');
fldref.write(val, filtrec);
}
}
if (!filter) return ne;
if (!filter)
return ne;
TString work(_filter.size());
bool filter_update = FALSE;

@ -530,7 +530,7 @@ public:
void set_exit_key(KEY k) { _exit_key = k; }
void set_bmp(short up, short dn);
void set_native_icon(unsigned icon);
void set_central_icon(unsigned int icon);
// @cmember Costruttore
TButton_field(TMask* mask);

@ -31,7 +31,7 @@ void TMultiple_rectype::load_rows_file(int logicnum)
_changed.reset(index);
}
int TMultiple_rectype::find(int logicnum, const char * fieldname, const char * s, int from, bool reverse) const
int TMultiple_rectype::find(int logicnum, const char* fieldname, const char* s, int from, bool reverse) const
{
const TRecord_array & recarray = body(logicnum);
const int last = recarray.last_row();

@ -48,7 +48,7 @@ protected:
virtual void load_rows_file(int logicnum);
// @cmember Ritorna l'indice di <p _files> del numero logico passato
int log2ind(int logicnum) const;
// @cmember RIcerca la prima occorrenza del corpo con fieldname uguale a s
// @cmember Ricerca la prima occorrenza del corpo con fieldname uguale a s
virtual int find(int logicnum, const char * fieldname, const char * s, int from = 0, bool reverse = FALSE) const ;
// @cmember Scrive/riscrive un corpo
virtual int write_rewrite(TBaseisamfile& f, bool re = FALSE) const;

@ -2,7 +2,6 @@
#include <config.h>
#include <golem.h>
#include <mask.h>
#include <os_dep.h>
#include <printer.h>
#include <printwin.h>
#include <urldefid.h>
@ -903,7 +902,7 @@ HIDDEN bool set_windows_print_device (TMask_field& f, KEY key)
TPrinter& pr = printer();
const TString& pdev = f.get(); // Nome stampante corrente
os_set_default_printer(pdev);
xvt_print_set_default_device(pdev);
if (m.is_running())
{
pr.set_printrcd();
@ -991,7 +990,7 @@ TPrinter::TPrinter()
_footersize = 0;
_isopen = FALSE;
os_get_default_printer(_defPrinter);
xvt_print_get_default_device(_defPrinter.get_buffer(), _defPrinter.size());
// read configuration file
read_configuration ();
@ -1170,7 +1169,7 @@ TPrinter::~TPrinter ()
xvt_print_destroy(_print_rcd);
_print_rcd = NULL;
}
os_set_default_printer(_defPrinter);
xvt_print_set_default_device(_defPrinter);
}
const char* TPrinter::class_name() const
@ -1491,7 +1490,7 @@ void TPrinter::reset()
bool TPrinter::open()
{
os_set_default_printer(_prname);
xvt_print_set_default_device(_prname);
if (_printertype == screenvis)
{
@ -1528,7 +1527,16 @@ bool TPrinter::set()
const bool can_save = _config == "Printer";
mask.enable(DLG_OK, can_save);
TToken_string pn2; os_get_printer_names(pn2);
// Crea la lista delle stampanti
TToken_string pn2;
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 char* pname = xvt_slist_get(plist, pitem, NULL);
pn2.add(pname);
}
xvt_slist_destroy(plist);
TList_field& plst = (TList_field&)mask.field (MSK_PRINTERS);
plst.replace_items(pn2, pn2); // Genera printer list
@ -1571,14 +1579,9 @@ bool TPrinter::set()
// l'handler setta default di windows a quella nel listbox e ribecca l'rcd
if (xvt_dm_post_page_setup(get_printrcd()))
{
// Ricarica la lista delle stampanti (L'utente puo' aggiungerne!)
os_get_printer_names(pn2);
plst.replace_items(pn2, pn2); // Genera printer list
// see if user has changed printer
// determine index of currently selected printer
// ACTHUNG! Deep hacking of XVT internals! NON PORTABLE!
// ACTHUNG! Deep hacking of XVT internals! NON PORTABLE!
_prname = (const char *)(get_printrcd()) + 4;
if (_prname.blank())
_prname = oldprn;
@ -1593,7 +1596,7 @@ bool TPrinter::set()
// riaggiusta stampante default windows come prima
// curprn e rcd sono quelle di prima
main_app().enable_menu_item(M_FILE_PG_SETUP);
os_set_default_printer(oldprn);
xvt_print_set_default_device(oldprn);
_prname = oldprn;
PRINT_RCD* rcd = get_printrcd();
memcpy(rcd, (const char *)oldrcd, old_rcd_size);
@ -1745,7 +1748,7 @@ void TPrinter::close ()
else if (_printertype == winprinter && _txt.lines() > 0L)
{
print_txt(_txt);
os_set_default_printer(_defPrinter);
xvt_print_set_default_device(_defPrinter);
}
else if (_printertype == fileprinter)
{

@ -12,9 +12,6 @@
// *** check if not already defined
#define NOTFOUND (-1)
// *** maximum number of elements in a cursor working page
#define CMAXELPAGE 8192
#define print_name(out, f) out << (f.num() == LF_TABCOM ? "%" : "") << f.name()
extern int get_error(int);
@ -968,10 +965,29 @@ void TCursor::close_index(FILE* f)
}
}
int TCursor::read_page(long page)
{
_pagefirstpos = page * _cmaxelpage;
CHECKD(_pagefirstpos < _totrec, "Bad cursor page ", page);
unsigned long elements = _totrec - _pagefirstpos;
if (elements > _cmaxelpage)
elements = _cmaxelpage;
const unsigned long startpos = sizeof(TRecnotype) * _pagefirstpos;
const unsigned long size = sizeof(TRecnotype) * elements;
FILE * indf = open_index();
fseek(indf, startpos, SEEK_SET);
if (fread(_page, size, 1, indf) != 1)
fatal_box("Can't read page number %d in cursor n. %d\n", page, file().num());
return (int) elements;
}
bool TCursor::has_simple_filter() const
{
bool yes = _filterfunction == NULL;
if (yes && _fexpr && _fexpr->numvar() > 0)
if (yes && _fexpr != NULL && _fexpr->numvar() > 0)
{
const RecDes& recd = *curr().rec_des(); // Descrizione del record della testata
const KeyDes& kd = recd.Ky[_nkey-1]; // Elenco dei campi della chiave del cursore
@ -997,121 +1013,103 @@ bool TCursor::has_simple_filter() const
TRecnotype TCursor::buildcursor(TRecnotype rp)
{
TRecnotype oldrecno=0,ap = 0;
int pagecnt = 0;
const bool filtered = has_filter();
_pagefirstpos = 0L;
memset(_page, 0, sizeof(TRecnotype)*_cmaxelpage);
_fpkey.destroy();
FILE* _f = open_index(TRUE);
const int fhnd = file().handle();
if (DB_reccount(fhnd) == 0)
{
close_index(_f);
return 0;
}
fseek(_f, 0L, SEEK_SET);
TRecnotype oldrecno=0,ap = 0;
int pagecnt = 0;
FILE* indf = NULL;
const int l = strlen(to());
int junk = DB_index_seek(fhnd, (char*)(const char*) from());
if (junk < 0) junk=get_error(junk);
if (junk == _iseof) return 0;
TRecnotype* page = new TRecnotype[CMAXELPAGE];
DB_index_recno(fhnd);
_pos=-1;
const bool simple_filter = has_simple_filter();
while (TRUE)
const bool filtered = has_filter();
const bool simple_filter = filtered && has_simple_filter();
while (!DB_index_eof(fhnd))
{
if (DB_index_eof(fhnd)) break;
const char* s0 = DB_index_getkey(fhnd);
const char *s0 = DB_index_getkey(fhnd);
if (l && (strncmp(to(), s0, l) < 0))
break;
const TRecnotype recno = DB_index_recno(fhnd);
if (recno == oldrecno)
break; // means that no more keys are available
oldrecno=recno;
if (pagecnt == CMAXELPAGE)
{
if (filtered && !simple_filter)
pagecnt = filtercursor(pagecnt,page);
fwrite(page,sizeof(TRecnotype),pagecnt,_f);
for (int i= 0; i< pagecnt; i++)
if (page[i] == rp)
{
_pos = ap + i;
break;
}
ap += pagecnt;
pagecnt = 0;
}
if (filtered && simple_filter)
{
if (simple_filtercursor(s0))
page[pagecnt++] = recno;
}
else
page[pagecnt++] = recno;
bool to_be_added = TRUE;
if (filtered)
{
if (simple_filter)
to_be_added = simple_filtercursor(s0);
else
to_be_added = filtercursor(recno);
}
if (to_be_added)
{
_page[pagecnt++] = recno;
if (_pos < 0 && recno == rp)
_pos = ap;
ap++;
}
if (pagecnt == _cmaxelpage)
{
_fpkey.add(new TToken_string(s0));
pagecnt = 0;
if (indf == NULL)
{
indf = open_index(TRUE);
fseek(indf, 0L, SEEK_SET);
}
fwrite(_page,sizeof(TRecnotype)*_cmaxelpage, 1, indf);
}
DB_index_next(fhnd);
} // while
if (pagecnt)
{
if (filtered && !simple_filter)
pagecnt = filtercursor(pagecnt, page);
fwrite(page, sizeof(TRecnotype), pagecnt, _f);
for (int i = 0; i < pagecnt; i++)
if (page[i] == rp)
{
_pos = ap + i;
break;
}
ap += pagecnt;
}
close_index(_f);
if (ap > CMAXELPAGE)
if (indf != NULL)
{
delete page;
page = NULL;
if (pagecnt > 0)
fwrite(_page,sizeof(TRecnotype)*pagecnt, 1, indf);
close_index(indf);
}
_pagefirstpos = ap > _cmaxelpage ? -(_cmaxelpage + 1) : 0L ;
return ap;
}
int TCursor::filtercursor(int pagecnt, TRecnotype* page)
bool TCursor::filtercursor(TRecnotype recno)
{
TLocalisamfile& fil = file();
TRectype& rec = fil.curr();
int np = 0;
for (int i = 0; i < pagecnt; i++)
{
rec.readat(fil,page[i]);
if (update_relation())
_if->update(-filter_limit());
file().readat(recno);
if (update_relation())
_if->update(-filter_limit());
bool ok = TRUE;
if (_filterfunction)
ok = _filterfunction(_if);
if (ok && _fexpr)
ok = __evalcondition(*_if, _fexpr, _frefs);
bool ok = TRUE;
if (_filterfunction)
ok = _filterfunction(_if);
if (ok && _fexpr)
ok = __evalcondition(*_if, _fexpr, _frefs);
if (ok)
{
if (np < i) page[np] = page[i];
np++;
}
}
return np;
return ok;
}
bool TCursor::simple_filtercursor(const char* key) const
{
if (_fexpr == NULL)
return true;
const RecDes& recd = *curr().rec_des(); // Descrizione del record della testata
const KeyDes& kd = recd.Ky[_nkey-1]; // Elenco dei campi della chiave del cursore
@ -1297,7 +1295,7 @@ void TCursor::filter(
kf = kto = f.name();
}
if (from != NULL)
matildator(*from, _nkey, (bool)(tilde & 0x1), kf);
matildator(*from, _nkey, (tilde & 0x1) != 0, kf);
if (to != NULL)
matildator(*to, _nkey, (tilde & 0x2) != 0, kto);
@ -1444,26 +1442,39 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop)
}
else
{
FILE* _f = open_index();
rewind(_f);
TRecnotype *page = new TRecnotype [CMAXELPAGE];
int pagecnt;
const int pages = (_totrec-1) / _cmaxelpage + 1;
_pos = -1;
for (TRecnotype max = _totrec; _pos == -1 && max > 0; max -= pagecnt)
{
pagecnt = (max < CMAXELPAGE) ? (int)max : CMAXELPAGE;
fread(page, sizeof(TRecnotype), pagecnt, _f);
for (int i = 0; i < pagecnt; i++)
if (page[i] == curpos)
{
_pos = _totrec - max + i;
break;
}
}
delete page;
close_index(_f);
_pos = -1;
if (pages > 1)
{
const TString match(curfile.curr().key(_nkey));
bool found = FALSE;
FOR_EACH_ARRAY_ROW(_fpkey, p , s)
{
if (match <= *s)
{
const int pagecnt = read_page(p);
found = TRUE;
for (int i = 0; i < pagecnt && _pos < 0L; i++)
if (_page[i] == curpos)
_pos = _pagefirstpos + i;
}
}
if (!found)
{
const int pagecnt = read_page(pages - 1);
for (int i = 0; i < pagecnt && _pos < 0L; i++)
if (_page[i] == curpos)
_pos = _pagefirstpos + i;
}
}
else
{
for (int i = 0; i < _cmaxelpage && _pos < 0L; i++)
if (_page[i] == curpos)
_pos = i;
}
if (_pos < 0L)
_pos = 0L;
@ -1484,6 +1495,11 @@ TCursor::TCursor(TRelation* r, const char* fil, int nkey,
_totrec = 0;
_lastrec = 0;
_lastkrec = 0;
_pagefirstpos = 0L,
_page = new TRecnotype[_cmaxelpage];
memset(_page, 0, _cmaxelpage * sizeof(TRecnotype));
filter(fil, from, to, tilde);
}
@ -1499,6 +1515,7 @@ TCursor::~TCursor()
}
::remove(_indexname);
}
delete _page;
if (_fexpr)
delete _fexpr;
}
@ -1516,15 +1533,11 @@ TRecnotype TCursor::readrec()
}
file().setstatus(NOERR);
FILE* _f = open_index();
if (fseek(_f, _pos * sizeof(TRecnotype), SEEK_SET) != 0)
fatal_box("Can't seek position %ld in cursor n. %d\n", _pos, file().num());
if (_pos < _pagefirstpos || _pos > _pagefirstpos + _cmaxelpage)
read_page(_pos / _cmaxelpage);
nrec = _page[_pos - _pagefirstpos];
if (fread(&nrec, sizeof(TRecnotype), 1, _f) != 1)
fatal_box("Can't read position %ld in cursor n. %d\n", _pos, file().num());
close_index(_f);
curr().setdirty();
file().readat(nrec);
repos();
@ -1677,9 +1690,18 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
int abspos=0,junk, l, pagecnt = 0;
const bool filtered = has_filter();
TString s;
FILE* _f = NULL;
_sort = new TSort(sizeof(El_To_Sort));
_order_expr.restart();
setpagefirstpos(0L);
memset(page(), 0, sizeof(TRecnotype) * pagesize());
fpkey().destroy();
if (file().empty())
return 0;
TSort sort(sizeof(El_To_Sort));
_order_expr.restart();
while ((s=_order_expr.get()).not_empty())
{
check_expr(s); // Toglie l'eventuale operatore UPPER(), in modo che l'ultimo carattere
@ -1691,7 +1713,7 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
// Il controllo del file e' automatico in f.len()
const int n = f.file();
const int flen = f.len(relation()->curr(n));
_sort->addsortkey(abspos,flen,versus);
sort.addsortkey(abspos,flen,versus);
CHECKS(flen!=0,"Field can not have null length: ",(const char *) s);
const TRectype& r = relation()->curr(n);
@ -1699,87 +1721,76 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
CHECKD(abspos<=256, "Sort key too long: ", abspos);
}
_sort->init();
FILE* _f = open_index(TRUE);
if (file().empty())
{
close_index(_f);
return 0;
}
const int handle = file().handle();
fseek(_f, 0L, SEEK_SET);
const int handle = file().handle();
sort.init();
l = strlen(to());
junk=DB_index_seek(handle, (char*)(const char*) from());
if (junk < 0) junk=get_error(junk);
if (junk == _iseof) return 0;
TRecnotype* page = new TRecnotype [CMAXELPAGE];
pos = DB_index_recno(handle);
TCursor::pos()=-1;
while (TRUE)
while (!DB_index_eof(handle))
{
if (DB_index_eof(handle)) break;
const char* s0 = DB_index_getkey(handle);
if (l && (strncmp(to(), s0, l) < 0))
break;
const TRecnotype recno = DB_index_recno(handle);
if (l && (strncmp(to(), s0, l) < 0)) break;
if (recno == oldrecno) break; // means that no more keys are available
oldrecno=recno;
if (pagecnt == CMAXELPAGE)
{
pagecnt = filtercursor(pagecnt,page);
for (int i= 0; i< pagecnt; i++)
if (page[i] == rp)
{
TCursor::pos() = ap + i;
break;
}
ap += pagecnt;
pagecnt = 0;
}
page[pagecnt++] = recno; // lasciare cosi' altrimenti la readat legge due volte lo stesso record
if (recno == oldrecno)
break; // means that no more keys are available
oldrecno=recno;
bool to_be_added = TRUE;
if (filtered)
to_be_added = filtercursor(recno);
if (to_be_added)
{
El_To_Sort Element;
fill_sort_key(Element.f);
Element.p=recno;
sort.sort((char *) &Element);
if (TCursor::pos() < 0 && recno == rp)
TCursor::pos() = ap;
ap++;
}
long rec = DB_index_next(handle);
if (rec < 0)
fatal_box("Can't read index n. %d - file n. %d",file().getkey(),file().num());
} // while
if (pagecnt)
{
pagecnt = filtercursor(pagecnt, page);
for (int i = 0; i < pagecnt; i++)
if (page[i] == rp)
{
TCursor::pos() = ap + i;
break;
}
ap += pagecnt;
}
_sort->endsort();
sort.endsort();
ap = 0;
pagecnt = 0;
El_To_Sort* Element = NULL;
while ((Element=(El_To_Sort *)_sort->retrieve()) != NULL)
while ((Element=(El_To_Sort *)sort.retrieve()) != NULL)
{
page[pagecnt++]=Element->p;
if (pagecnt==CMAXELPAGE)
page()[pagecnt++]=Element->p;
if (pagecnt == pagesize())
{
fwrite(page,sizeof(TRecnotype),pagecnt,_f);
if (_f == NULL)
{
_f = open_index(TRUE);
fseek(_f, 0L, SEEK_SET);
}
fwrite(page(), sizeof(TRecnotype) * pagesize(), 1, _f);
pagecnt=0;
fpkey().add(new TToken_string(Element->f));
}
ap++;
}
if (pagecnt)
fwrite(page,sizeof(TRecnotype),pagecnt,_f);
// if (TCursor::pos() == -1) pos=0; // Guy: Non serve ad una cippa!
delete page;
if (_sort) delete _sort;
close_index(_f);
if (_f != NULL)
{
if (pagecnt > 0)
fwrite(page(),sizeof(TRecnotype) * pagecnt, 1, _f);
close_index(_f);
}
setpagefirstpos(ap > pagesize() ? -(pagesize() + 1) : 0L) ;
return ap;
}
@ -1814,34 +1825,6 @@ const char* TSorted_cursor::fill_sort_key(char* k)
return k;
}
int TSorted_cursor::filtercursor(int pagecnt, TRecnotype* page)
{
int np=0 /*, handle=file().filehnd()->fhnd */;
TRectype& rec=file().curr();
TString s, sf, fmt;
El_To_Sort Element;
for (int i=0; i< pagecnt; i++)
{
file().readat(rec,page[i]);
if (update_relation())
relation()->update(-filter_limit());
if ((filterfunction() ? filterfunction()(relation()) : TRUE ) &&
(expression() ? __evalcondition(*relation(), expression(), field_refs()) : TRUE))
{
if (np < i) page[np] = page[i];
np++;
fill_sort_key(Element.f);
Element.p=page[i];
_sort->sort((char *) &Element);
}
}
return np;
}
bool TSorted_cursor::changed()
{
bool rt = FALSE;
@ -1866,7 +1849,17 @@ TRecnotype TSorted_cursor::read(TIsamop op, TReclock lockop)
TRecnotype last = items()-1;
TRecnotype found = -1L;
const bool ghiacciato = !frozen();
FOR_EACH_ARRAY_ROW(fpkey(), i, s)
{
const int cmp = searching.compare(*s, cmplen);
if (cmp <= 0)
last = (i + 1) * pagesize() - 1;
else
first = i * pagesize();
}
const bool ghiacciato = !frozen();
if (ghiacciato) freeze(TRUE);
TString256 testing;
@ -2083,15 +2076,7 @@ static TString buffer;
const char* TFieldref::read(TConfig& ini, const char* defpar) const
{
const char* para = defpar;
if (_id.not_empty())
{
if (isdigit(_id[0]))
para = _id;
else
para = _id[0] == '%' ? "4" : "5";
}
ini.set_paragraph(para);
ini.set_paragraph(_id.empty() ? defpar : _id);
if (!ini.exist(_name))
return "";
@ -2162,15 +2147,7 @@ void TFieldref::write(TConfig& ini, const char* defpar, const char* val) const
if ((val == NULL || *val == '\0') && !ini.exist(_name))
return;
const char* para = defpar;
if (_id.not_empty())
{
if (isdigit(_id[0]))
para = _id;
else
para = _id[0] == '%' ? "4" : "5";
}
const char* para = _id.empty() ? defpar : _id;
if (_from > 0 || _to > 0)
{
buffer = ini.get(_name, para);
@ -2262,14 +2239,22 @@ void TFieldref::write(const char* val, TRectype& rec) const
int TFieldref::len(const TRectype &rec) const
{
if (_to > _from)
return _to - _from;
if (_fileid <= 0)
return rec.length(_name) - _from;
const TRectype r(_fileid);
const int len = r.length(_name);
return len - _from;
int len = 0;
if (_to < _from)
{
if (_fileid > 0)
{
const RecDes& recd = prefix().get_recdes(_fileid);
const int p = findfld(&recd, _name);
len = p != FIELDERR ? recd.Fd[p].Len : 0;
}
else
len = rec.length(_name);
}
else
len = _to;
len -= _from;
return len;
}
///////////////////////////////////////////////////////////

@ -223,6 +223,9 @@ class TCursor : public TContainer
// @access:(INTERNAL) Private Member
{
// *** maximum number of elements in a cursor working page
enum {_cmaxelpage=4096};
// @cmember:(INTERNAL) Relazione su cui costruire il cursore
TRelation* _if;
// @cmember:(INTERNAL) Chiave del file principale
@ -262,19 +265,29 @@ class TCursor : public TContainer
// @cmember:(INTERNAL) Nome del file indice
TFilename _indexname;
long _pagefirstpos;
TRecnotype* _page;
TString_array _fpkey;
// @access Protected Member
protected:
int pagesize() const { return _cmaxelpage;}
void setpagefirstpos(long pos) { _pagefirstpos = pos;}
TRecnotype * page() { return _page; }
TString_array & fpkey() { return _fpkey; }
// @cmember Apre il file di indice
FILE* open_index(bool create = FALSE);
// @cmember Chiude il file di indice
void close_index(FILE* f);
// @cmember Legge una pagina del file di indice
int read_page(long page);
// @cmember Ritorna se e' stato modificato il cursore (cioe' quando occorre fare l'update)
virtual bool changed();
// @cmember Costruisce il cursore a partire dal record
virtual TRecnotype buildcursor(TRecnotype rp);
// @cmember Permette di creare una pagina di cursori
virtual int filtercursor(int pagecnt, TRecnotype* page);
virtual bool filtercursor(TRecnotype recno);
// Controlla se una chiave rispetta il filtro
bool simple_filtercursor(const char* key) const;
// @cmember Posiziona il cursore in modo che il record corrente corrisponda alla
@ -449,8 +462,6 @@ class TSorted_cursor : public TCursor
{
// @cmember:(INTERNAL) Espressione per l'ordinamento
TToken_string _order_expr;
// @cmember:(INTERNAL) Puntatore all'oggetto per ordinare il cursore (vedi <c TSort>)
TSort* _sort;
// @cmember:(INTERNAL) Indica se l'espressione e' cambiata
bool _is_changed_expr;
// @cmember:(INTERNAL) Indica se l'espressione e' valida
@ -467,8 +478,6 @@ protected:
// @cmember Costruisce il cursore a partire dal record (vedi <c TCursor>)
virtual TRecnotype buildcursor(TRecnotype rp);
// @cmember Permette di creare una pagina di cursori (vedi <c TCursor>)
virtual int filtercursor(int pagecnt, TRecnotype* page);
// @cmember Ritorna se e' stato modificato il cursore (cioe' quando occorre fare l'update) (vedi <c TCursor>)
virtual bool changed();

@ -652,8 +652,11 @@ TString& TString::fill(
// riempita col carattere <p c> per tutta la lunghezza.
{
if (n < 0) n = size(); else
if (n > size()) resize(n, FALSE);
if (n < 0)
n = size();
else
if (n > size())
resize(n, FALSE);
memset(_str, c, n);
_str[n] = '\0';
return *this;
@ -672,12 +675,16 @@ TString& TString::right_just(
//
// @xref <mf TString::left_just> <mf TString::center_just>
{
TString& spark = get_tmp_string();
if (n < 0) n = size();
if (n < 0)
n = size();
trim();
spark = _str;
fill(c, n);
overwrite(spark, n-spark.len());
if (len() < n)
{
TString& spark = get_tmp_string();
spark = _str;
fill(c, n);
overwrite(spark, n-spark.len());
}
return *this;
}
@ -695,13 +702,17 @@ TString& TString::center_just(
//
// @xref <mf TString::left_just> <mf TString::right_just>
{
TString& spark = get_tmp_string();
if (n < 0) n = size();
if (n < 0)
n = size();
trim();
spark = _str;
fill(c, n);
const int p = (n-spark.len()) >> 1;
overwrite(spark, p);
if (len() < n)
{
TString& spark = get_tmp_string();
spark = _str;
fill(c, n);
const int p = (n-spark.len()) >> 1;
overwrite(spark, p);
}
return *this;
}
@ -719,13 +730,16 @@ TString& TString::left_just(
//
// @xref <mf TString::right_just> <mf TString::center_just>
{
TString& spark = get_tmp_string();
if (n < 0) n = size();
if (n < 0)
n = size();
trim();
spark = _str;
fill(c, n);
overwrite(spark, 0);
if (len() < n)
{
TString& spark = get_tmp_string();
spark = _str;
fill(c, n);
overwrite(spark, 0);
}
return *this;
}

@ -1,7 +1,7 @@
#include <xvt.h>
#include <direct.h>
#include <diction.h>
#include <os_dep.h>
#include <strings.h>
#define __UTILITY_CPP

@ -3,7 +3,6 @@
#include <applicat.h>
#include <colors.h>
#include <os_dep.h>
#include <urldefid.h>
#define __WINDOW_CPP
@ -549,14 +548,9 @@ void TWindow::set_focus()
}
}
void TWindow::iconize() const
{
os_iconize_window(win());
}
void TWindow::maximize() const
{
os_maximize_window(win());
xvt_vobj_maximize(win());
}
void TWindow::set_background_color(COLOR col)

@ -183,8 +183,6 @@ public:
// @cmember Permette di fare tutti gli aggiornamenti necessari
virtual void on_idle();
// @cmember Iconizza la finestra
void iconize() const;
// @cmember Massimizza la finestra
void maximize() const;
// @cmember Attiva/disattiva la finestra

@ -3,7 +3,6 @@
#include <config.h>
#include <controls.h>
#include <mask.h>
//#include <os_dep.h>
#include <urldefid.h>
#include <utility.h>
@ -280,7 +279,8 @@ void dispatch_e_menu(
EVENT e; memset(&e, 0, sizeof(e));
e.type = E_COMMAND;
e.v.cmd.tag = item;
xvt_win_post_event(win, &e);
// xvt_win_post_event(win, &e);
dispatch_event(win, e, TRUE);
}
// @doc EXTERNAL