Patch level : 2.1 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento : Preservato font su cambio stampante git-svn-id: svn://10.65.10.50/trunk@12218 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
419ad40c9e
commit
5bb16d6e83
@ -61,19 +61,22 @@ void TPrinter_setup_mask::fill_font_list()
|
||||
char* family[MAX_FAMILIES];
|
||||
const int num_families = (int)xvt_fmap_get_families(_pcd, family, MAX_FAMILIES);
|
||||
|
||||
TToken_string fn(256);
|
||||
TToken_string fn(num_families * 16);
|
||||
for (int i = 0; i < num_families; i++)
|
||||
{
|
||||
fn.add(family[i]);
|
||||
xvt_mem_free(family[i]);
|
||||
}
|
||||
|
||||
TString oldfont = _font; // Memorizzo il font corrente in quanto poi cambia
|
||||
|
||||
TList_field& lst = (TList_field&)field(MSK_FONT);
|
||||
lst.replace_items(fn, fn);
|
||||
|
||||
// Controlla se il font c'e' ancora
|
||||
if (fn.get_pos(_font) < 0)
|
||||
_font = fn.get(0);
|
||||
set(MSK_FONT, _font, 0x1);
|
||||
if (fn.get_pos(oldfont) < 0)
|
||||
oldfont = fn.get(0);
|
||||
set(MSK_FONT, oldfont, 0x1);
|
||||
}
|
||||
|
||||
void TPrinter_setup_mask::fill_size_list()
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <image.h>
|
||||
#include <printer.h>
|
||||
#include <printwin.h>
|
||||
#include <utility.h>
|
||||
|
||||
HIDDEN int LEN_SPACES(WINDOW win, int x)
|
||||
{
|
||||
@ -272,9 +273,7 @@ bool TPrintwin::print_band(
|
||||
|
||||
// @comm Di solito viene disegnata l'intera pagina, ma la cosa dipende dal driver di stampa
|
||||
{
|
||||
#ifdef TRC
|
||||
const clock_t start = clock();
|
||||
#endif
|
||||
TPerformance_profiler timer("print_band");
|
||||
|
||||
const long first_row = (long)page * _formlen;
|
||||
const int rows = (r.bottom - r.top) / _chary;
|
||||
@ -291,11 +290,6 @@ bool TPrintwin::print_band(
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef TRC
|
||||
const clock_t total = clock() - start;
|
||||
TRACE("Page %d: %u msec", page, total);
|
||||
#endif
|
||||
|
||||
return (first_row + k < lines);
|
||||
}
|
||||
|
||||
|
@ -1790,59 +1790,3 @@ TRecordset_sheet::TRecordset_sheet(TRecordset& query)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TPerformance_profiler
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TPerformance_profiler::TPerformance_profiler(const char* desc)
|
||||
: _desc(desc)
|
||||
{
|
||||
#ifdef DBG
|
||||
_start = clock();
|
||||
|
||||
TString80 msg;
|
||||
msg << "Profiling " << desc << "...";
|
||||
statbar_set_title(TASK_WIN, msg);
|
||||
|
||||
while (true)
|
||||
{
|
||||
const clock_t clk = clock();
|
||||
if (clk != _start)
|
||||
{
|
||||
_start = clk;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void TPerformance_profiler::show() const
|
||||
{
|
||||
#ifdef DBG
|
||||
const double s = double(clock() - _start) / CLOCKS_PER_SEC;
|
||||
|
||||
int hour = 0, min = 0;
|
||||
int sec = int(s);
|
||||
const int cent = int((s - sec)*100);
|
||||
|
||||
if (sec >= 3600)
|
||||
{
|
||||
hour = sec / 3600;
|
||||
sec -= hour * 3600;
|
||||
}
|
||||
if (sec >= 60)
|
||||
{
|
||||
min = sec / 60;
|
||||
sec -= min * 60;
|
||||
}
|
||||
|
||||
TString80 msg = _desc;
|
||||
msg.format("%s %02d:%02d:%02d.%02d", (const char*)_desc, hour, min, sec, cent);
|
||||
statbar_set_title(TASK_WIN, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
TPerformance_profiler::~TPerformance_profiler()
|
||||
{
|
||||
show();
|
||||
}
|
||||
|
@ -163,18 +163,6 @@ public:
|
||||
// Utility
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TPerformance_profiler : public TObject
|
||||
{
|
||||
TString _desc;
|
||||
clock_t _start;
|
||||
|
||||
public:
|
||||
void show() const;
|
||||
|
||||
TPerformance_profiler(const char* desc = "");
|
||||
~TPerformance_profiler();
|
||||
};
|
||||
|
||||
bool select_custom_file(TFilename& path, const char* ext);
|
||||
const TString& logic2table(int logic_num);
|
||||
int table2logic(const TString& name);
|
||||
|
@ -1,14 +1,73 @@
|
||||
#include <xvt.h>
|
||||
#include <errno.h>
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
#endif
|
||||
#include <statbar.h>
|
||||
|
||||
#include <diction.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include <utility.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TPerformance_profiler
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TPerformance_profiler::TPerformance_profiler(const char* desc, bool trc)
|
||||
: _desc(desc), _trc(trc)
|
||||
{
|
||||
#ifdef DBG
|
||||
_start = clock();
|
||||
|
||||
if (!_trc)
|
||||
{
|
||||
TString80 msg;
|
||||
msg << "Profiling " << desc << "...";
|
||||
statbar_set_title(TASK_WIN, msg);
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
const clock_t clk = clock();
|
||||
if (clk != _start)
|
||||
{
|
||||
_start = clk;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void TPerformance_profiler::show() const
|
||||
{
|
||||
#ifdef DBG
|
||||
const double s = double(clock() - _start) / CLOCKS_PER_SEC;
|
||||
|
||||
int hour = 0, min = 0;
|
||||
int sec = int(s);
|
||||
const int cent = int((s - sec)*100);
|
||||
|
||||
if (sec >= 3600)
|
||||
{
|
||||
hour = sec / 3600;
|
||||
sec -= hour * 3600;
|
||||
}
|
||||
if (sec >= 60)
|
||||
{
|
||||
min = sec / 60;
|
||||
sec -= min * 60;
|
||||
}
|
||||
|
||||
TString256 msg = _desc;
|
||||
msg.format("%s %02d:%02d:%02d.%02d", (const char*)_desc, hour, min, sec, cent);
|
||||
|
||||
if (_trc)
|
||||
__trace(msg);
|
||||
else
|
||||
statbar_set_title(TASK_WIN, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
TPerformance_profiler::~TPerformance_profiler()
|
||||
{
|
||||
show();
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @func Permette di copiare un file
|
||||
|
@ -9,8 +9,18 @@
|
||||
#include <../xvaga/incstr.h>
|
||||
#endif
|
||||
|
||||
class TString_array;
|
||||
class TFilename;
|
||||
class TPerformance_profiler : public TObject
|
||||
{
|
||||
TString _desc;
|
||||
long _start;
|
||||
bool _trc;
|
||||
|
||||
public:
|
||||
void show() const;
|
||||
|
||||
TPerformance_profiler(const char* desc = "", bool trc = false);
|
||||
~TPerformance_profiler();
|
||||
};
|
||||
|
||||
char* format (const char* fmt, ...);
|
||||
const char* cmd2name(const char* argv0, const char* argv1 = "");
|
||||
|
Loading…
x
Reference in New Issue
Block a user