Aggiornate chiavi relapp anche in modifica (creava problemi in modo multi-maschera)
git-svn-id: svn://10.65.10.50/trunk@1151 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5ad08f7a90
commit
3e69e38b92
@ -1,220 +1,220 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef FOXPRO
|
#ifdef FOXPRO
|
||||||
#undef XVT_OS
|
#undef XVT_OS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <pro_ext.h>
|
#include <pro_ext.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XVT_OS
|
#ifdef XVT_OS
|
||||||
#include <xvt.h>
|
#include <xvt.h>
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <keys.h>
|
#include <keys.h>
|
||||||
#else
|
#else
|
||||||
#include <xvtility.h>
|
#include <xvtility.h>
|
||||||
#endif
|
#endif
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#endif /* XVT_OS */
|
#endif /* XVT_OS */
|
||||||
|
|
||||||
|
|
||||||
#include <checks.h>
|
#include <checks.h>
|
||||||
|
|
||||||
#define buildmsg() char msg[256];va_list argptr;va_start(argptr,fmt);vsprintf(msg,fmt,argptr);va_end(argptr)
|
#define buildmsg() char msg[256];va_list argptr;va_start(argptr,fmt);vsprintf(msg,fmt,argptr);va_end(argptr)
|
||||||
|
|
||||||
#ifdef XVT_OS
|
#ifdef XVT_OS
|
||||||
|
|
||||||
int fatal_box(const char* fmt, ...)
|
int fatal_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
MessageBeep(MB_ICONHAND);
|
MessageBeep(MB_ICONHAND);
|
||||||
MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL);
|
MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL);
|
||||||
|
|
||||||
if (xvt_running())
|
if (xvt_running())
|
||||||
main_app().stop_run();
|
main_app().stop_run();
|
||||||
else
|
else
|
||||||
exit(1);
|
exit(1);
|
||||||
#else
|
#else
|
||||||
beep();
|
beep();
|
||||||
if (xvt_running()) xvt_dm_post_fatal_exit("%s", msg);
|
if (xvt_running()) xvt_dm_post_fatal_exit("%s", msg);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n", msg);
|
fprintf(stderr, "%s\n", msg);
|
||||||
getchar();
|
getchar();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int error_box(const char* fmt, ...)
|
int error_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
MessageBeep(MB_ICONEXCLAMATION);
|
MessageBeep(MB_ICONEXCLAMATION);
|
||||||
MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION);
|
MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION);
|
||||||
#else
|
#else
|
||||||
beep();
|
beep();
|
||||||
if (xvt_running()) xvt_dm_post_error("%s", msg);
|
if (xvt_running()) xvt_dm_post_error("%s", msg);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n", msg);
|
fprintf(stderr, "%s\n", msg);
|
||||||
getchar();
|
getchar();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int warning_box(const char* fmt, ...)
|
int warning_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
MessageBeep(MB_ICONQUESTION);
|
MessageBeep(MB_ICONQUESTION);
|
||||||
MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION);
|
MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION);
|
||||||
#else
|
#else
|
||||||
beep();
|
beep();
|
||||||
xvt_dm_post_note("%s", msg);
|
xvt_dm_post_note("%s", msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int message_box(const char* fmt, ...)
|
int message_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION);
|
MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION);
|
||||||
#else
|
#else
|
||||||
xvt_dm_post_note("%s", msg);
|
xvt_dm_post_note("%s", msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sorry_box(const char* fmt, ...)
|
int sorry_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
MessageBeep(MB_OK);
|
MessageBeep(MB_OK);
|
||||||
MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION);
|
MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION);
|
||||||
#else
|
#else
|
||||||
xvt_dm_post_note("%s", msg);
|
xvt_dm_post_note("%s", msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int yesno_box(const char* fmt, ...)
|
int yesno_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION);
|
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION);
|
||||||
return r == IDYES;
|
return r == IDYES;
|
||||||
#else
|
#else
|
||||||
ASK_RESPONSE r = xvt_dm_post_ask((char*) "Si", (char*) "No", NULL, "%s", msg);
|
ASK_RESPONSE r = xvt_dm_post_ask((char*) "Si", (char*) "No", NULL, "%s", msg);
|
||||||
return r == RESP_DEFAULT;
|
return r == RESP_DEFAULT;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int yesnofatal_box(const char* fmt, ...)
|
int yesnofatal_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
char s[256]; sprintf(s, "%s\nContinuare ugualmente?", msg);
|
char s[256]; sprintf(s, "%s\nContinuare ugualmente?", msg);
|
||||||
const int ret = yesno_box("%s", s);
|
const int ret = yesno_box("%s", s);
|
||||||
if (!ret) fatal_box("");
|
if (!ret) fatal_box("");
|
||||||
#else
|
#else
|
||||||
fatal_box("%s", msg);
|
fatal_box("%s", msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int yesnocancel_box(const char* fmt, ...)
|
int yesnocancel_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNOCANCEL | MB_ICONQUESTION);
|
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNOCANCEL | MB_ICONQUESTION);
|
||||||
if (r == IDYES) r = K_YES;
|
if (r == IDYES) r = K_YES;
|
||||||
else
|
else
|
||||||
if (r == IDNO) r = K_NO;
|
if (r == IDNO) r = K_NO;
|
||||||
else
|
else
|
||||||
r = K_ESC;
|
r = K_ESC;
|
||||||
return r;
|
return r;
|
||||||
#else
|
#else
|
||||||
ASK_RESPONSE r = xvt_dm_post_ask((char*) "Si", (char*) "No", (char*) "Annulla", "%s", msg);
|
ASK_RESPONSE r = xvt_dm_post_ask((char*) "Si", (char*) "No", (char*) "Annulla", "%s", msg);
|
||||||
if (r == RESP_DEFAULT) r = K_YES;
|
if (r == RESP_DEFAULT) r = K_YES;
|
||||||
else
|
else
|
||||||
if (r == RESP_2) r = K_NO;
|
if (r == RESP_2) r = K_NO;
|
||||||
else
|
else
|
||||||
r = K_ESC;
|
r = K_ESC;
|
||||||
return r;
|
return r;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int __trace(const char* fmt, ...)
|
int __trace(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
FILE* f = fopen("trace.log", "a");
|
FILE* f = fopen("trace.log", "a");
|
||||||
if (f != NULL)
|
if (f != NULL)
|
||||||
{
|
{
|
||||||
fprintf(f, "%s\n", msg);
|
fprintf(f, "%s\n", msg);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return f != NULL;
|
return f != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // XVT_OS
|
#endif // XVT_OS
|
||||||
|
|
||||||
|
|
||||||
#ifdef FOXPRO
|
#ifdef FOXPRO
|
||||||
|
|
||||||
int error_box(const char* fmt, ...)
|
int error_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
_UserError(msg);
|
_UserError(msg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fatal_box(const char* fmt, ...)
|
int fatal_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
MessageBeep(MB_ICONHAND);
|
MessageBeep(MB_ICONHAND);
|
||||||
buildmsg();
|
buildmsg();
|
||||||
_UserError(msg);
|
_UserError(msg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int message_box(const char* fmt, ...)
|
int message_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
_UserError(msg);
|
_UserError(msg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int yesnofatal_box(const char* fmt, ...)
|
int yesnofatal_box(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
_UserError(msg);
|
_UserError(msg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif // FOXPRO
|
#endif // FOXPRO
|
||||||
|
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
#ifndef __KEYS_H
|
#ifndef __KEYS_H
|
||||||
#define __KEYS_H
|
#define __KEYS_H
|
||||||
|
|
||||||
#ifndef XVT_INCL_DEFS
|
#ifndef XVT_INCL_DEFS
|
||||||
#include <xvt_defs.h>
|
#include <xvt_defs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* @M */
|
/* @M */
|
||||||
#define K_BACKSPACE 8
|
#define K_BACKSPACE 8
|
||||||
#define K_TAB 9
|
#define K_TAB 9
|
||||||
#define K_ENTER 13
|
#define K_ENTER 13
|
||||||
#define K_ESC 27
|
#define K_ESC 27
|
||||||
#define K_SPACE 32
|
#define K_SPACE 32
|
||||||
#define K_SHIFT 1000
|
#define K_SHIFT 1000
|
||||||
#define K_CTRL 10000
|
#define K_CTRL 10000
|
||||||
#define K_CTRL_ENTER K_CTRL+K_ENTER
|
#define K_CTRL_ENTER K_CTRL+K_ENTER
|
||||||
#define K_AUTO_ENTER 21013
|
#define K_AUTO_ENTER 21013
|
||||||
#define K_QUIT 20334
|
#define K_QUIT 20334
|
||||||
#define K_FORCE_CLOSE 21334
|
#define K_FORCE_CLOSE 21334
|
||||||
#define K_SAVE 20082
|
#define K_SAVE 20082
|
||||||
#define K_SHIFT_TAB K_SHIFT+K_TAB
|
#define K_SHIFT_TAB K_SHIFT+K_TAB
|
||||||
#define K_NO 20000+'N'
|
#define K_NO 20000+'N'
|
||||||
#define K_YES 20000+'Y'
|
#define K_YES 20000+'Y'
|
||||||
|
|
||||||
/* @END */
|
/* @END */
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,4 +30,5 @@
|
|||||||
#define PART_IMPTOTPAG "IMPTOTPAG"
|
#define PART_IMPTOTPAG "IMPTOTPAG"
|
||||||
#define PART_DATARIFPAG "DATARIFPAG"
|
#define PART_DATARIFPAG "DATARIFPAG"
|
||||||
#define PART_NUMRIFPAG "NUMRIFPAG"
|
#define PART_NUMRIFPAG "NUMRIFPAG"
|
||||||
|
#define PART_NRATA "NRATA"
|
||||||
#define PART_CHIUSA "CHIUSA"
|
#define PART_CHIUSA "CHIUSA"
|
||||||
|
@ -1,267 +1,267 @@
|
|||||||
// $Id: progind.cpp,v 1.4 1995-03-22 09:06:23 guy Exp $
|
// $Id: progind.cpp,v 1.5 1995-03-22 11:38:57 guy Exp $
|
||||||
|
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
|
|
||||||
const char* const CANCEL_TEXT = "Annulla";
|
const char* const CANCEL_TEXT = "Annulla";
|
||||||
const char* const TITLE_TEXT = "Attesa";
|
const char* const TITLE_TEXT = "Attesa";
|
||||||
|
|
||||||
word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
||||||
{
|
{
|
||||||
word lines = 0;
|
word lines = 0;
|
||||||
for(const char* t = s.get(0); t; t = s.get())
|
for(const char* t = s.get(0); t; t = s.get())
|
||||||
{
|
{
|
||||||
const word l = strlen(t);
|
const word l = strlen(t);
|
||||||
if (l > maxlen) maxlen = l;
|
if (l > maxlen) maxlen = l;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 70%
|
// Certified 70%
|
||||||
TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
||||||
{
|
{
|
||||||
_cancel = _bar = _text = NULL_WIN;
|
_cancel = _bar = _text = NULL_WIN;
|
||||||
|
|
||||||
_status = 0l;
|
_status = 0l;
|
||||||
_max = max;
|
_max = max;
|
||||||
if (_max <= 0) _max = 1;
|
if (_max <= 0) _max = 1;
|
||||||
_flags = 0x0;
|
_flags = 0x0;
|
||||||
|
|
||||||
TToken_string testo(txt, '\n');
|
TToken_string testo(txt, '\n');
|
||||||
word maxlen = div;
|
word maxlen = div;
|
||||||
const word lines = measure_text(testo, maxlen);
|
const word lines = measure_text(testo, maxlen);
|
||||||
|
|
||||||
int ver = lines+2;
|
int ver = lines+2;
|
||||||
|
|
||||||
int hor = maxlen+2; if (hor > 78) hor = 78;
|
int hor = maxlen+2; if (hor > 78) hor = 78;
|
||||||
|
|
||||||
if (bar)
|
if (bar)
|
||||||
{
|
{
|
||||||
_bar = ver * CHARY;
|
_bar = ver * CHARY;
|
||||||
ver += 3;
|
ver += 3;
|
||||||
}
|
}
|
||||||
ver += cancel ? 3 : 0;
|
ver += cancel ? 3 : 0;
|
||||||
|
|
||||||
create(-1, -1, hor, ver, TITLE_TEXT);
|
create(-1, -1, hor, ver, TITLE_TEXT);
|
||||||
|
|
||||||
RCT r; r.left = CHARX; r.top = CHARY; r.right = CHARX*(hor-2); r.bottom = r.top + lines*CHARY+4;
|
RCT r; r.left = CHARX; r.top = CHARY; r.right = CHARX*(hor-2); r.bottom = r.top + lines*CHARY+4;
|
||||||
_text = xvt_ctl_create(WC_TEXT, &r, (char*)txt, win(), CTL_FLAG_CENTER_JUST, 0l, DLG_NULL);
|
_text = xvt_ctl_create(WC_TEXT, &r, (char*)txt, win(), CTL_FLAG_CENTER_JUST, 0l, DLG_NULL);
|
||||||
|
|
||||||
if (cancel)
|
if (cancel)
|
||||||
_cancel = xvt_create_control(WC_PUSHBUTTON, -11, -1, 9, 2,
|
_cancel = xvt_create_control(WC_PUSHBUTTON, -11, -1, 9, 2,
|
||||||
CANCEL_TEXT, win(), 0, 0l, DLG_CANCEL);
|
CANCEL_TEXT, win(), 0, 0l, DLG_CANCEL);
|
||||||
open_modal();
|
open_modal();
|
||||||
do_events();
|
do_events();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIndwin::set_text(const char* t)
|
void TIndwin::set_text(const char* t)
|
||||||
{
|
{
|
||||||
xvt_vobj_set_title(_text, (char*)t);
|
xvt_vobj_set_title(_text, (char*)t);
|
||||||
}
|
}
|
||||||
|
|
||||||
TIndwin::~TIndwin()
|
TIndwin::~TIndwin()
|
||||||
{ close_modal(); }
|
{ close_modal(); }
|
||||||
|
|
||||||
bool TIndwin::can_be_closed() const
|
bool TIndwin::can_be_closed() const
|
||||||
{
|
{
|
||||||
const bool ok = (_flags & IND_FINISHED) || (_flags & IND_CANCELLED);
|
const bool ok = (_flags & IND_FINISHED) || (_flags & IND_CANCELLED);
|
||||||
if (!ok) error_box("Attendere la fine dell'operazione prima di chiudere l'applicazione");
|
if (!ok) error_box("Attendere la fine dell'operazione prima di chiudere l'applicazione");
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
KEY TIndwin::check_stop()
|
KEY TIndwin::check_stop()
|
||||||
{
|
{
|
||||||
KEY k = 0;
|
KEY k = 0;
|
||||||
if ((_flags & IND_FINISHED) || (_flags & IND_CANCELLED))
|
if ((_flags & IND_FINISHED) || (_flags & IND_CANCELLED))
|
||||||
{
|
{
|
||||||
k = (_flags & IND_FINISHED) ? K_ENTER : K_ESC;
|
k = (_flags & IND_FINISHED) ? K_ENTER : K_ESC;
|
||||||
stop_run(k);
|
stop_run(k);
|
||||||
}
|
}
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIndwin::update_bar()
|
void TIndwin::update_bar()
|
||||||
{
|
{
|
||||||
if (_status >= _max)
|
if (_status >= _max)
|
||||||
{
|
{
|
||||||
_status = _max;
|
_status = _max;
|
||||||
_flags |= IND_FINISHED;
|
_flags |= IND_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
const double prc = (double)_status/_max;
|
const double prc = (double)_status/_max;
|
||||||
|
|
||||||
RCT r; xvt_vobj_get_client_rect(win(), &r);
|
RCT r; xvt_vobj_get_client_rect(win(), &r);
|
||||||
r.left = CHARX; r.right -= CHARX;
|
r.left = CHARX; r.right -= CHARX;
|
||||||
r.top = (int)_bar;
|
r.top = (int)_bar;
|
||||||
r.bottom = r.top + 3*CHARY;
|
r.bottom = r.top + 3*CHARY;
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
r.top += 6;
|
r.top += 6;
|
||||||
r.bottom -= 6;
|
r.bottom -= 6;
|
||||||
#endif
|
#endif
|
||||||
const int width = r.right - r.left;
|
const int width = r.right - r.left;
|
||||||
|
|
||||||
RCT b = r;
|
RCT b = r;
|
||||||
set_brush(COLOR_BLUE);
|
set_brush(COLOR_BLUE);
|
||||||
b.right = b.left + int(width*prc);
|
b.right = b.left + int(width*prc);
|
||||||
xvt_dwin_draw_rect(win(), &b);
|
xvt_dwin_draw_rect(win(), &b);
|
||||||
|
|
||||||
set_brush(COLOR_WHITE);
|
set_brush(COLOR_WHITE);
|
||||||
b.left = b.right; b.right = r.right;
|
b.left = b.right; b.right = r.right;
|
||||||
xvt_dwin_draw_rect(win(), &b);
|
xvt_dwin_draw_rect(win(), &b);
|
||||||
|
|
||||||
set_mode(M_XOR);
|
set_mode(M_XOR);
|
||||||
xvt_dwin_set_fore_color(win(), COLOR_BLUE);
|
xvt_dwin_set_fore_color(win(), COLOR_BLUE);
|
||||||
char n[8]; sprintf(n, "%d%%", int(100*prc));
|
char n[8]; sprintf(n, "%d%%", int(100*prc));
|
||||||
xvt_dwin_draw_text(win(), r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1);
|
xvt_dwin_draw_text(win(), r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1);
|
||||||
set_mode(M_COPY);
|
set_mode(M_COPY);
|
||||||
|
|
||||||
check_stop();
|
check_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIndwin::update()
|
void TIndwin::update()
|
||||||
{
|
{
|
||||||
if (_bar) update_bar();
|
if (_bar) update_bar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TIndwin::handler(WINDOW w, EVENT* e)
|
void TIndwin::handler(WINDOW w, EVENT* e)
|
||||||
{
|
{
|
||||||
switch(e->type)
|
switch(e->type)
|
||||||
{
|
{
|
||||||
case E_UPDATE:
|
case E_UPDATE:
|
||||||
xvt_dwin_clear(w, COLOR_WHITE);
|
xvt_dwin_clear(w, COLOR_WHITE);
|
||||||
update();
|
update();
|
||||||
return;
|
return;
|
||||||
case E_CONTROL:
|
case E_CONTROL:
|
||||||
if (e->v.ctl.id == DLG_CANCEL)
|
if (e->v.ctl.id == DLG_CANCEL)
|
||||||
dispatch_e_char(w, K_ESC);
|
dispatch_e_char(w, K_ESC);
|
||||||
break;
|
break;
|
||||||
case E_CHAR:
|
case E_CHAR:
|
||||||
// allowed only if cancel button is there
|
// allowed only if cancel button is there
|
||||||
if (e->v.chr.ch == K_ESC)
|
if (e->v.chr.ch == K_ESC)
|
||||||
{
|
{
|
||||||
if (_cancel)
|
if (_cancel)
|
||||||
{
|
{
|
||||||
_flags |= IND_CANCELLED;
|
_flags |= IND_CANCELLED;
|
||||||
check_stop();
|
check_stop();
|
||||||
}
|
}
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TWindow::handler(w,e);
|
TWindow::handler(w,e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TProgind --------------------------------------------------------------
|
// TProgind --------------------------------------------------------------
|
||||||
|
|
||||||
TProgind::TProgind(long max, const char* txt, bool cancel, bool bar, int div)
|
TProgind::TProgind(long max, const char* txt, bool cancel, bool bar, int div)
|
||||||
: TIndwin(max, txt, cancel, bar, div)
|
: TIndwin(max, txt, cancel, bar, div)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// TTimerind ------------------------------------------------------------
|
// TTimerind ------------------------------------------------------------
|
||||||
|
|
||||||
long TTimerind::_timer_id = 0L;
|
long TTimerind::_timer_id = 0L;
|
||||||
|
|
||||||
void TTimerind::handler(WINDOW w, EVENT* e)
|
void TTimerind::handler(WINDOW w, EVENT* e)
|
||||||
{
|
{
|
||||||
switch(e->type)
|
switch(e->type)
|
||||||
{
|
{
|
||||||
case E_CREATE:
|
case E_CREATE:
|
||||||
case E_UPDATE:
|
case E_UPDATE:
|
||||||
if (_status == 0L)
|
if (_status == 0L)
|
||||||
_timer_id = xvt_timer_create(w, _interval);
|
_timer_id = xvt_timer_create(w, _interval);
|
||||||
break;
|
break;
|
||||||
case E_TIMER:
|
case E_TIMER:
|
||||||
if (e->v.timer.id == _timer_id)
|
if (e->v.timer.id == _timer_id)
|
||||||
{
|
{
|
||||||
_status += _interval;
|
_status += _interval;
|
||||||
force_update();
|
force_update();
|
||||||
xvt_timer_create(w, _interval);
|
xvt_timer_create(w, _interval);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TIndwin::handler(w,e);
|
TIndwin::handler(w,e);
|
||||||
}
|
}
|
||||||
|
|
||||||
TTimerind::TTimerind(long msec, const char* txt,
|
TTimerind::TTimerind(long msec, const char* txt,
|
||||||
bool cancel, bool bar, int div, int i) :
|
bool cancel, bool bar, int div, int i) :
|
||||||
TIndwin(msec, txt, cancel, bar, div)
|
TIndwin(msec, txt, cancel, bar, div)
|
||||||
{
|
{
|
||||||
_interval = i;
|
_interval = i;
|
||||||
_timer_id = 0L;
|
_timer_id = 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
TTimerind::~TTimerind()
|
TTimerind::~TTimerind()
|
||||||
{ xvt_timer_destroy(_timer_id); }
|
{ xvt_timer_destroy(_timer_id); }
|
||||||
|
|
||||||
// C-style binding
|
// C-style binding
|
||||||
// uses static pointer for single instance of TIndwin
|
// uses static pointer for single instance of TIndwin
|
||||||
|
|
||||||
static TIndwin* __indwin__p = NULL;
|
static TIndwin* __indwin__p = NULL;
|
||||||
|
|
||||||
void progind_create(long m, char* t, bool b, bool c, int n)
|
void progind_create(long m, char* t, bool b, bool c, int n)
|
||||||
{
|
{
|
||||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||||
__indwin__p = new TProgind(m,t,b,c,n);
|
__indwin__p = new TProgind(m,t,b,c,n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void progind_set_status(long l)
|
void progind_set_status(long l)
|
||||||
{
|
{
|
||||||
((TProgind*)__indwin__p)->setstatus(l);
|
((TProgind*)__indwin__p)->setstatus(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
void progind_cancel()
|
void progind_cancel()
|
||||||
{
|
{
|
||||||
__indwin__p->cancel();
|
__indwin__p->cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool progind_iscancelled()
|
bool progind_iscancelled()
|
||||||
{
|
{
|
||||||
return __indwin__p->iscancelled();
|
return __indwin__p->iscancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool progind_isfinished()
|
bool progind_isfinished()
|
||||||
{
|
{
|
||||||
return __indwin__p->isfinished();
|
return __indwin__p->isfinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void progind_destroy()
|
void progind_destroy()
|
||||||
{
|
{
|
||||||
delete __indwin__p;
|
delete __indwin__p;
|
||||||
__indwin__p = NULL;
|
__indwin__p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void timerind_create(long l, char* title, bool bar, bool cancel,
|
void timerind_create(long l, char* title, bool bar, bool cancel,
|
||||||
int divisions, int interval)
|
int divisions, int interval)
|
||||||
{
|
{
|
||||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||||
__indwin__p = new TTimerind(l,title,bar,cancel,divisions,interval);
|
__indwin__p = new TTimerind(l,title,bar,cancel,divisions,interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void timerind_cancel()
|
void timerind_cancel()
|
||||||
{
|
{
|
||||||
__indwin__p->cancel();
|
__indwin__p->cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool timerind_iscancelled()
|
bool timerind_iscancelled()
|
||||||
{
|
{
|
||||||
return __indwin__p->iscancelled();
|
return __indwin__p->iscancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool timerind_isfinished()
|
bool timerind_isfinished()
|
||||||
{
|
{
|
||||||
return __indwin__p->isfinished();
|
return __indwin__p->isfinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void timerind_destroy()
|
void timerind_destroy()
|
||||||
{
|
{
|
||||||
delete __indwin__p;
|
delete __indwin__p;
|
||||||
__indwin__p = NULL;
|
__indwin__p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: relapp.cpp,v 1.49 1995-03-22 09:06:25 guy Exp $
|
// $Id: relapp.cpp,v 1.50 1995-03-22 11:38:59 guy Exp $
|
||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -446,16 +446,20 @@ bool TRelation_application::modify_mode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mask = get_mask(MODE_MOD);
|
_mask = get_mask(MODE_MOD);
|
||||||
|
|
||||||
|
if (changing)
|
||||||
|
{
|
||||||
|
_mask->open_modal();
|
||||||
|
delete _maskeys; // May conflict! Keep this one
|
||||||
|
_maskeys = new TKey_array(_mask);
|
||||||
|
}
|
||||||
|
|
||||||
set_mode(MODE_MOD);
|
set_mode(MODE_MOD);
|
||||||
|
|
||||||
err = read(*_mask);
|
err = read(*_mask);
|
||||||
|
|
||||||
if (changing)
|
|
||||||
_mask->open_modal();
|
|
||||||
|
|
||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
{
|
{
|
||||||
error_box("Errore di caricamento dati nella maschera: %d", err);
|
error_box("Errore di caricamento dati: %d", err);
|
||||||
query_mode();
|
query_mode();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
256
include/text.h
256
include/text.h
@ -1,128 +1,128 @@
|
|||||||
/* actually -*-c++-*- */
|
/* actually -*-c++-*- */
|
||||||
#ifndef __TEXTFILE_H
|
#ifndef __TEXTFILE_H
|
||||||
#define __TEXTFILE_H
|
#define __TEXTFILE_H
|
||||||
|
|
||||||
#ifndef __STDIO_H
|
#ifndef __STDIO_H
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __STRINGS_H
|
#ifndef __STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __WINDOW_H
|
#ifndef __WINDOW_H
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
enum direction {up, down, updown};
|
enum direction {up, down, updown};
|
||||||
enum style {normal = XVT_FS_NONE, bold = XVT_FS_BOLD, italic = XVT_FS_ITALIC, underlined = XVT_FS_UNDERLINE };
|
enum style {normal = XVT_FS_NONE, bold = XVT_FS_BOLD, italic = XVT_FS_ITALIC, underlined = XVT_FS_UNDERLINE };
|
||||||
|
|
||||||
class TTextfile: public TObject
|
class TTextfile: public TObject
|
||||||
{
|
{
|
||||||
enum {DEFAULT_PAGESIZE = 128};
|
enum {DEFAULT_PAGESIZE = 128};
|
||||||
|
|
||||||
TArray _page;
|
TArray _page;
|
||||||
TBit_array _dirty_lines;
|
TBit_array _dirty_lines;
|
||||||
long _page_start;
|
long _page_start;
|
||||||
long _page_end;
|
long _page_end;
|
||||||
long _page_size;
|
long _page_size;
|
||||||
long _lines;
|
long _lines;
|
||||||
long _cur_line;
|
long _cur_line;
|
||||||
TFilename _filename;
|
TFilename _filename;
|
||||||
TFilename _indname;
|
TFilename _indname;
|
||||||
FILE* _index;
|
FILE* _index;
|
||||||
FILE* _instr;
|
FILE* _instr;
|
||||||
direction _direction;
|
direction _direction;
|
||||||
TToken_string _line;
|
TToken_string _line;
|
||||||
long _styles[256];
|
long _styles[256];
|
||||||
int _item;
|
int _item;
|
||||||
TArray _hotspots;
|
TArray _hotspots;
|
||||||
TArray _spots;
|
TArray _spots;
|
||||||
bool _dirty;
|
bool _dirty;
|
||||||
bool _isopen;
|
bool _isopen;
|
||||||
bool _istemp;
|
bool _istemp;
|
||||||
bool _accept;
|
bool _accept;
|
||||||
|
|
||||||
void _read_page(long line);
|
void _read_page(long line);
|
||||||
bool _in_page(long l)
|
bool _in_page(long l)
|
||||||
{ return l >= _page_start && l < _page_end; }
|
{ return l >= _page_start && l < _page_end; }
|
||||||
void _save_changes();
|
void _save_changes();
|
||||||
|
|
||||||
// void _parse_style(long j);
|
// void _parse_style(long j);
|
||||||
style _trans_style(char c);
|
style _trans_style(char c);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
long lines() { return _lines; }
|
long lines() { return _lines; }
|
||||||
bool changed() { return _dirty; }
|
bool changed() { return _dirty; }
|
||||||
|
|
||||||
// line() ritorna la stringa di caratteri senza formattazione
|
// line() ritorna la stringa di caratteri senza formattazione
|
||||||
const char* line(long row, long column = 0, int howmuch = -1);
|
const char* line(long row, long column = 0, int howmuch = -1);
|
||||||
// line_formatted() la ritorna, come e' logico attendersi, con
|
// line_formatted() la ritorna, come e' logico attendersi, con
|
||||||
// la formattazione
|
// la formattazione
|
||||||
const char* line_formatted(long row);
|
const char* line_formatted(long row);
|
||||||
// appende una riga al text (con i formati del caso)
|
// appende una riga al text (con i formati del caso)
|
||||||
bool append(const char* l);
|
bool append(const char* l);
|
||||||
|
|
||||||
// chide tutti i files per poter copiare o eseguire operazioni
|
// chide tutti i files per poter copiare o eseguire operazioni
|
||||||
// dopo close() non si puo' piu' fare nulla
|
// dopo close() non si puo' piu' fare nulla
|
||||||
void close();
|
void close();
|
||||||
void print();
|
void print();
|
||||||
// chiude l'aggiunta di nuove linee
|
// chiude l'aggiunta di nuove linee
|
||||||
void freeze() { _accept = FALSE; }
|
void freeze() { _accept = FALSE; }
|
||||||
bool frozen() { return !_accept; }
|
bool frozen() { return !_accept; }
|
||||||
|
|
||||||
// per leggere il testo formattato, si fa prima read_line, poi
|
// per leggere il testo formattato, si fa prima read_line, poi
|
||||||
// si prende un pezzo per volta
|
// si prende un pezzo per volta
|
||||||
// style() ritorna lo stile (vedi enum) del piece() corrente
|
// style() ritorna lo stile (vedi enum) del piece() corrente
|
||||||
// se chiamata con parametri ritorna lo stile del carattere alla
|
// se chiamata con parametri ritorna lo stile del carattere alla
|
||||||
// posizione data
|
// posizione data
|
||||||
// get_background() e get_foreground() ritornano il suo colore di bg e fg
|
// get_background() e get_foreground() ritornano il suo colore di bg e fg
|
||||||
// piece() ritorna il pezzo di linea successivo con stile e colore
|
// piece() ritorna il pezzo di linea successivo con stile e colore
|
||||||
// invarianti, o NULL quando non ce n'e' piu'
|
// invarianti, o NULL quando non ce n'e' piu'
|
||||||
// bello, vero?
|
// bello, vero?
|
||||||
|
|
||||||
void read_line(long j, long b = 0, bool pg = TRUE);
|
void read_line(long j, long b = 0, bool pg = TRUE);
|
||||||
const char* piece();
|
const char* piece();
|
||||||
int get_style(int pos = -1);
|
int get_style(int pos = -1);
|
||||||
char get_background(int pos = -1);
|
char get_background(int pos = -1);
|
||||||
char get_foreground(int pos = -1);
|
char get_foreground(int pos = -1);
|
||||||
|
|
||||||
long get_attribute(int pos = -1);
|
long get_attribute(int pos = -1);
|
||||||
|
|
||||||
// ritorna la parola alla posizione indicata
|
// ritorna la parola alla posizione indicata
|
||||||
const char* word_at(long x, long y);
|
const char* word_at(long x, long y);
|
||||||
// TBI ritorna il pezzo di testo da x a y
|
// TBI ritorna il pezzo di testo da x a y
|
||||||
// allochera' un altro TText che deve essere disfatto dall'utente
|
// allochera' un altro TText che deve essere disfatto dall'utente
|
||||||
TTextfile* section(TPoint& from, TPoint& to) { return this; }
|
TTextfile* section(TPoint& from, TPoint& to) { return this; }
|
||||||
const char* name() { return (const char*)_filename; }
|
const char* name() { return (const char*)_filename; }
|
||||||
|
|
||||||
// scrive il testo (non formattato) su file, da punto a punto
|
// scrive il testo (non formattato) su file, da punto a punto
|
||||||
// (tutto per default)
|
// (tutto per default)
|
||||||
bool write(const char* path, TPoint* from = NULL, TPoint* to = NULL);
|
bool write(const char* path, TPoint* from = NULL, TPoint* to = NULL);
|
||||||
// disfa tutto e svuota il file
|
// disfa tutto e svuota il file
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
// search and replace (una riga per volta, rispetta i formati)
|
// search and replace (una riga per volta, rispetta i formati)
|
||||||
// txt = text to search; pos = int to put the char position in;
|
// txt = text to search; pos = int to put the char position in;
|
||||||
// from = where to start; down = FALSE == up
|
// from = where to start; down = FALSE == up
|
||||||
long search (const char* txt, int& pos, long from = 0,
|
long search (const char* txt, int& pos, long from = 0,
|
||||||
bool down = TRUE, bool casesens = FALSE);
|
bool down = TRUE, bool casesens = FALSE);
|
||||||
// replace txt=txt in line=line at pos=pos for len=len
|
// replace txt=txt in line=line at pos=pos for len=len
|
||||||
int replace(long line, const char* txt, int pos = 0, int len = -1);
|
int replace(long line, const char* txt, int pos = 0, int len = -1);
|
||||||
|
|
||||||
// hypertext cazzuls
|
// hypertext cazzuls
|
||||||
// le si dice il colore che devono avere i punti selezionabili;
|
// le si dice il colore che devono avere i punti selezionabili;
|
||||||
// ritorna l'array in cui vengono messi gli hotspots relativi alla
|
// ritorna l'array in cui vengono messi gli hotspots relativi alla
|
||||||
// pagina in memoria (come TToken_string con x|y|text)
|
// pagina in memoria (come TToken_string con x|y|text)
|
||||||
void set_hotspots(char fg, char bg = 'w');
|
void set_hotspots(char fg, char bg = 'w');
|
||||||
TArray& hotspots() { return _spots; }
|
TArray& hotspots() { return _spots; }
|
||||||
|
|
||||||
TTextfile(const char* file = NULL, int pagesize = DEFAULT_PAGESIZE,
|
TTextfile(const char* file = NULL, int pagesize = DEFAULT_PAGESIZE,
|
||||||
direction preferred = updown);
|
direction preferred = updown);
|
||||||
virtual ~TTextfile();
|
virtual ~TTextfile();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user