Aggiunta ricerca a viswin con F7 (cerca) e F8 (cerca il prossimo)
git-svn-id: svn://10.65.10.50/trunk@807 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1877ed7dee
commit
4fbe28d0b7
@ -1,23 +1,23 @@
|
||||
/* Maschera ricerca per viswin */
|
||||
#include "bagn005.h"
|
||||
|
||||
PAGE "Cerca testo" -1 -1 55 11
|
||||
PAGE "Cerca testo" -1 -1 60 5
|
||||
|
||||
STRING F_STRING 45 70
|
||||
STRING F_STRING 70 45
|
||||
BEGIN
|
||||
PROMPT 1 1 "Ricerca: "
|
||||
PROMPT 1 1 "Ricerca "
|
||||
END
|
||||
|
||||
LIST F_DIRECT
|
||||
LIST F_DIRECT 8
|
||||
BEGIN
|
||||
PROMPT 1 2 "Direzione "
|
||||
PROMPT 1 2 "Direzione "
|
||||
ITEM "D|Avanti"
|
||||
ITEM "U|Indietro"
|
||||
END
|
||||
|
||||
BOOLEAN F_CASE
|
||||
BEGIN
|
||||
PROMPT 30 2 "Maiuscolo/Minuscolo"
|
||||
PROMPT 36 2 "Maiuscolo/Minuscolo"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
|
230
include/form.h
230
include/form.h
@ -1,115 +1,115 @@
|
||||
#ifndef __FORM_H
|
||||
#define __FORM_H
|
||||
|
||||
#ifndef __PRINTER_H
|
||||
#include <printer.h>
|
||||
#endif
|
||||
|
||||
#ifndef __SCANNER_H
|
||||
#include <scanner.h>
|
||||
#endif
|
||||
|
||||
#ifndef __MASK_H
|
||||
class TMask;
|
||||
#endif
|
||||
|
||||
#ifndef __RELATION_H
|
||||
class TRelation;
|
||||
class TCursor;
|
||||
#endif
|
||||
|
||||
enum pagetype { odd_page, even_page, first_page, last_page };
|
||||
|
||||
class TForm;
|
||||
class TForm_item;
|
||||
|
||||
class TPrint_section : public TArray
|
||||
{
|
||||
static TMask* _msk;
|
||||
|
||||
word _height; // Altezza della sezione
|
||||
|
||||
TForm* _form; // Form cui appartiene alla sezione
|
||||
TArray _item; // Lista dei campi da stampare
|
||||
|
||||
const TPrint_section& copy(const TPrint_section& ps);
|
||||
|
||||
protected:
|
||||
virtual void print_on(ostream& out) const;
|
||||
TForm_item* parse_item(const TString& key);
|
||||
TForm_item* parse_item(TScanner& scanner);
|
||||
|
||||
public:
|
||||
TPrintrow& row(int num);
|
||||
TForm* form() const { return _form; }
|
||||
|
||||
TForm_item& field(int n) const { return (TForm_item&)_item[n]; }
|
||||
word fields() const { return _item.items(); }
|
||||
word height() const { return _height; }
|
||||
virtual bool ok() const { return height() > 0 || fields() > 0; }
|
||||
|
||||
void reset();
|
||||
bool update();
|
||||
bool parse(TScanner& scanner);
|
||||
|
||||
bool edit(const char* title);
|
||||
|
||||
const TPrint_section& operator=(const TPrint_section& ps) { return copy(ps); }
|
||||
TPrint_section(TForm* parent);
|
||||
TPrint_section(const TPrint_section& ps) { copy(ps); }
|
||||
virtual ~TPrint_section();
|
||||
};
|
||||
|
||||
|
||||
class TForm : public TObject
|
||||
{
|
||||
friend class TForm_editor;
|
||||
|
||||
TFilename _name; // Profile name
|
||||
|
||||
TRelation* _relation; // Can be NULL
|
||||
TCursor* _cursor; // Can be NULL
|
||||
|
||||
TArray _head; // Headers
|
||||
TArray _body; // Bodies
|
||||
TArray _foot; // Footers
|
||||
|
||||
bool _lastpage; // I am about to print the last page
|
||||
|
||||
TPrint_section* exist(char s, pagetype t, bool create = FALSE); // Can be NULL
|
||||
|
||||
static void header_handler(TPrinter& p);
|
||||
static void footer_handler(TPrinter& p);
|
||||
|
||||
protected:
|
||||
// H = Header, B = Body, F = Footer, R = Relation
|
||||
TPrint_section& section(char s = 'B', word page = 1);
|
||||
word height(); // Height of first page
|
||||
|
||||
void print_section(ostream& out, char s) const;
|
||||
virtual void print_on(ostream& out) const;
|
||||
bool edit_relation();
|
||||
|
||||
bool parse_use(TScanner&);
|
||||
bool parse_join(TScanner&);
|
||||
|
||||
word page(const TPrinter& p) const;
|
||||
|
||||
virtual long records() const;
|
||||
virtual word set_header(word p, bool u);
|
||||
virtual word set_body(word p, bool u);
|
||||
virtual word set_footer(word p, bool u);
|
||||
|
||||
public:
|
||||
bool print(long from = 0L, long to = -1L);
|
||||
|
||||
const TFilename& name() const { return _name; }
|
||||
|
||||
TRelation* relation() const { return _relation; }
|
||||
TCursor* cursor() const { return _cursor; }
|
||||
|
||||
TForm(const char* form);
|
||||
virtual ~TForm();
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef __FORM_H
|
||||
#define __FORM_H
|
||||
|
||||
#ifndef __PRINTER_H
|
||||
#include <printer.h>
|
||||
#endif
|
||||
|
||||
#ifndef __SCANNER_H
|
||||
#include <scanner.h>
|
||||
#endif
|
||||
|
||||
#ifndef __MASK_H
|
||||
class TMask;
|
||||
#endif
|
||||
|
||||
#ifndef __RELATION_H
|
||||
class TRelation;
|
||||
class TCursor;
|
||||
#endif
|
||||
|
||||
enum pagetype { odd_page, even_page, first_page, last_page };
|
||||
|
||||
class TForm;
|
||||
class TForm_item;
|
||||
|
||||
class TPrint_section : public TArray
|
||||
{
|
||||
static TMask* _msk;
|
||||
|
||||
word _height; // Altezza della sezione
|
||||
|
||||
TForm* _form; // Form cui appartiene alla sezione
|
||||
TArray _item; // Lista dei campi da stampare
|
||||
|
||||
const TPrint_section& copy(const TPrint_section& ps);
|
||||
|
||||
protected:
|
||||
virtual void print_on(ostream& out) const;
|
||||
TForm_item* parse_item(const TString& key);
|
||||
TForm_item* parse_item(TScanner& scanner);
|
||||
|
||||
public:
|
||||
TPrintrow& row(int num);
|
||||
TForm* form() const { return _form; }
|
||||
|
||||
TForm_item& field(int n) const { return (TForm_item&)_item[n]; }
|
||||
word fields() const { return _item.items(); }
|
||||
word height() const { return _height; }
|
||||
virtual bool ok() const { return height() > 0 || fields() > 0; }
|
||||
|
||||
void reset();
|
||||
bool update();
|
||||
bool parse(TScanner& scanner);
|
||||
|
||||
bool edit(const char* title);
|
||||
|
||||
const TPrint_section& operator=(const TPrint_section& ps) { return copy(ps); }
|
||||
TPrint_section(TForm* parent);
|
||||
TPrint_section(const TPrint_section& ps) { copy(ps); }
|
||||
virtual ~TPrint_section();
|
||||
};
|
||||
|
||||
|
||||
class TForm : public TObject
|
||||
{
|
||||
friend class TForm_editor;
|
||||
|
||||
TFilename _name; // Profile name
|
||||
|
||||
TRelation* _relation; // Can be NULL
|
||||
TCursor* _cursor; // Can be NULL
|
||||
|
||||
TArray _head; // Headers
|
||||
TArray _body; // Bodies
|
||||
TArray _foot; // Footers
|
||||
|
||||
bool _lastpage; // I am about to print the last page
|
||||
|
||||
TPrint_section* exist(char s, pagetype t, bool create = FALSE); // Can be NULL
|
||||
|
||||
static void header_handler(TPrinter& p);
|
||||
static void footer_handler(TPrinter& p);
|
||||
|
||||
protected:
|
||||
// H = Header, B = Body, F = Footer, R = Relation
|
||||
TPrint_section& section(char s = 'B', word page = 1);
|
||||
word height(); // Height of first page
|
||||
|
||||
void print_section(ostream& out, char s) const;
|
||||
virtual void print_on(ostream& out) const;
|
||||
bool edit_relation();
|
||||
|
||||
bool parse_use(TScanner&);
|
||||
bool parse_join(TScanner&);
|
||||
|
||||
word page(const TPrinter& p) const;
|
||||
|
||||
virtual long records() const;
|
||||
virtual word set_header(word p, bool u);
|
||||
virtual word set_body(word p, bool u);
|
||||
virtual word set_footer(word p, bool u);
|
||||
|
||||
public:
|
||||
bool print(long from = 0L, long to = -1L);
|
||||
|
||||
const TFilename& name() const { return _name; }
|
||||
|
||||
TRelation* relation() const { return _relation; }
|
||||
TCursor* cursor() const { return _cursor; }
|
||||
|
||||
TForm(const char* form);
|
||||
virtual ~TForm();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
1134
include/maskfld.h
1134
include/maskfld.h
File diff suppressed because it is too large
Load Diff
@ -1479,6 +1479,12 @@ bool TViswin::on_key (KEY key)
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case K_F7:
|
||||
find();
|
||||
break;
|
||||
case K_F8:
|
||||
find_next();
|
||||
break;
|
||||
case CTRL_E:
|
||||
if (_isedit)
|
||||
{
|
||||
@ -1882,7 +1888,7 @@ void TViswin::goto_top()
|
||||
goto_pos(0l,0l);;
|
||||
}
|
||||
|
||||
void TViswin::goto_pos(long r, long c)
|
||||
void TViswin::goto_pos(long r, long c, bool moveorigin)
|
||||
{
|
||||
if (r >= _txt.lines() || c >= 256)
|
||||
return;
|
||||
@ -1891,7 +1897,9 @@ void TViswin::goto_pos(long r, long c)
|
||||
if (_isselection) erase_selection();
|
||||
_point.x = c;
|
||||
_point.y = r;
|
||||
update_thumb (c,r);
|
||||
if (!moveorigin)
|
||||
c = (c > (origin().x + _textcolumns)) ? c - origin().x : 0l;
|
||||
update_thumb(c,r);
|
||||
check_link(&_point);
|
||||
if (_isselection) display_selection();
|
||||
display_point();
|
||||
@ -1943,7 +1951,7 @@ void TViswin::find()
|
||||
}
|
||||
else
|
||||
{
|
||||
goto_pos(l,(long)x);
|
||||
goto_pos(l, (long)x, FALSE);
|
||||
_last_found.x = (long)x;
|
||||
_last_found.y = l;
|
||||
}
|
||||
@ -1958,11 +1966,11 @@ void TViswin::find_next()
|
||||
beep();
|
||||
else
|
||||
{
|
||||
long l = search(_txt_to_find, x, _point.y, _down_dir);
|
||||
long l = search(_txt_to_find, x, _point.y+(_down_dir ? 1l : -1l), _down_dir);
|
||||
if (l == -1)
|
||||
beep();
|
||||
else
|
||||
goto_pos(l,x);
|
||||
goto_pos(l,x,FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2136,13 +2144,18 @@ void TBrowsefile_field::parse_head(TScanner& scanner)
|
||||
|
||||
// Certified 100%
|
||||
void TBrowsefile_field::create(WINDOW parent)
|
||||
{
|
||||
{
|
||||
CURSOR oldcur = get_cursor(TASK_WIN);
|
||||
set_cursor(TASK_WIN,CURSOR_WAIT);
|
||||
|
||||
const TMask& m = mask();
|
||||
_viswin = new TViswin(_prompt, _prompt, FALSE, FALSE, FALSE, _x, _y,
|
||||
_size, _width, _flags.rightjust ? TRUE : FALSE, parent, this);
|
||||
_win = _viswin->win();
|
||||
enable_window(_win, enabled());
|
||||
show_window(_win, shown());
|
||||
|
||||
set_cursor(TASK_WIN, oldcur);
|
||||
}
|
||||
|
||||
|
||||
@ -2153,6 +2166,9 @@ long TBrowsefile_field::set_text(const char* file, const char* line)
|
||||
FILE* instr = fopen(file,"r");
|
||||
if (instr == NULL)
|
||||
fatal_box("File non trovato: %s", file);
|
||||
|
||||
CURSOR oldcur = get_cursor(TASK_WIN);
|
||||
set_cursor(TASK_WIN,CURSOR_WAIT);
|
||||
|
||||
TString256 tmpp;
|
||||
long ret = -1l;
|
||||
@ -2175,7 +2191,9 @@ long TBrowsefile_field::set_text(const char* file, const char* line)
|
||||
}
|
||||
fclose(instr);
|
||||
|
||||
_viswin->close_print();
|
||||
_viswin->close_print();
|
||||
set_cursor(TASK_WIN, oldcur);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2243,7 +2261,7 @@ void TBrowsefile_field::close()
|
||||
|
||||
void TBrowsefile_field::goto_pos(long r, long c)
|
||||
{
|
||||
_viswin->goto_pos(r,c);
|
||||
_viswin->goto_pos(r,c,TRUE);
|
||||
}
|
||||
|
||||
void TBrowsefile_field::goto_top()
|
||||
|
@ -147,7 +147,7 @@ public:
|
||||
|
||||
void goto_end();
|
||||
void goto_top();
|
||||
void goto_pos(long,long);
|
||||
void goto_pos(long r, long c, bool moveorigin = TRUE);
|
||||
void refresh();
|
||||
|
||||
void add_line(const char* l);
|
||||
|
Loading…
x
Reference in New Issue
Block a user