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:
villa 1994-12-30 10:11:18 +00:00
parent 1877ed7dee
commit 4fbe28d0b7
5 changed files with 715 additions and 697 deletions

View File

@ -1,14 +1,14 @@
/* Maschera ricerca per viswin */ /* Maschera ricerca per viswin */
#include "bagn005.h" #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 BEGIN
PROMPT 1 1 "Ricerca: " PROMPT 1 1 "Ricerca "
END END
LIST F_DIRECT LIST F_DIRECT 8
BEGIN BEGIN
PROMPT 1 2 "Direzione " PROMPT 1 2 "Direzione "
ITEM "D|Avanti" ITEM "D|Avanti"
@ -17,7 +17,7 @@ END
BOOLEAN F_CASE BOOLEAN F_CASE
BEGIN BEGIN
PROMPT 30 2 "Maiuscolo/Minuscolo" PROMPT 36 2 "Maiuscolo/Minuscolo"
END END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2

View File

@ -1,4 +1,4 @@
/* $Id: maskfld.h,v 1.18 1994-12-29 14:51:27 villa Exp $ */ /* $Id: maskfld.h,v 1.19 1994-12-30 10:11:11 villa Exp $ */
#ifndef __MASKFLD_H #ifndef __MASKFLD_H
#define __MASKFLD_H #define __MASKFLD_H

View File

@ -1479,6 +1479,12 @@ bool TViswin::on_key (KEY key)
switch (key) switch (key)
{ {
case K_F7:
find();
break;
case K_F8:
find_next();
break;
case CTRL_E: case CTRL_E:
if (_isedit) if (_isedit)
{ {
@ -1882,7 +1888,7 @@ void TViswin::goto_top()
goto_pos(0l,0l);; 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) if (r >= _txt.lines() || c >= 256)
return; return;
@ -1891,7 +1897,9 @@ void TViswin::goto_pos(long r, long c)
if (_isselection) erase_selection(); if (_isselection) erase_selection();
_point.x = c; _point.x = c;
_point.y = r; _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); check_link(&_point);
if (_isselection) display_selection(); if (_isselection) display_selection();
display_point(); display_point();
@ -1943,7 +1951,7 @@ void TViswin::find()
} }
else else
{ {
goto_pos(l,(long)x); goto_pos(l, (long)x, FALSE);
_last_found.x = (long)x; _last_found.x = (long)x;
_last_found.y = l; _last_found.y = l;
} }
@ -1958,11 +1966,11 @@ void TViswin::find_next()
beep(); beep();
else 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) if (l == -1)
beep(); beep();
else else
goto_pos(l,x); goto_pos(l,x,FALSE);
} }
} }
@ -2137,12 +2145,17 @@ void TBrowsefile_field::parse_head(TScanner& scanner)
// Certified 100% // Certified 100%
void TBrowsefile_field::create(WINDOW parent) void TBrowsefile_field::create(WINDOW parent)
{ {
CURSOR oldcur = get_cursor(TASK_WIN);
set_cursor(TASK_WIN,CURSOR_WAIT);
const TMask& m = mask(); const TMask& m = mask();
_viswin = new TViswin(_prompt, _prompt, FALSE, FALSE, FALSE, _x, _y, _viswin = new TViswin(_prompt, _prompt, FALSE, FALSE, FALSE, _x, _y,
_size, _width, _flags.rightjust ? TRUE : FALSE, parent, this); _size, _width, _flags.rightjust ? TRUE : FALSE, parent, this);
_win = _viswin->win(); _win = _viswin->win();
enable_window(_win, enabled()); enable_window(_win, enabled());
show_window(_win, shown()); show_window(_win, shown());
set_cursor(TASK_WIN, oldcur);
} }
@ -2154,6 +2167,9 @@ long TBrowsefile_field::set_text(const char* file, const char* line)
if (instr == NULL) if (instr == NULL)
fatal_box("File non trovato: %s", file); fatal_box("File non trovato: %s", file);
CURSOR oldcur = get_cursor(TASK_WIN);
set_cursor(TASK_WIN,CURSOR_WAIT);
TString256 tmpp; TString256 tmpp;
long ret = -1l; long ret = -1l;
long lines = 0l; long lines = 0l;
@ -2176,6 +2192,8 @@ long TBrowsefile_field::set_text(const char* file, const char* line)
fclose(instr); fclose(instr);
_viswin->close_print(); _viswin->close_print();
set_cursor(TASK_WIN, oldcur);
return ret; return ret;
} }
@ -2243,7 +2261,7 @@ void TBrowsefile_field::close()
void TBrowsefile_field::goto_pos(long r, long c) 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() void TBrowsefile_field::goto_top()

View File

@ -147,7 +147,7 @@ public:
void goto_end(); void goto_end();
void goto_top(); void goto_top();
void goto_pos(long,long); void goto_pos(long r, long c, bool moveorigin = TRUE);
void refresh(); void refresh();
void add_line(const char* l); void add_line(const char* l);