Patch level : xx no patch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Sistemato il menu della viswin


git-svn-id: svn://10.65.10.50/trunk@9677 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2001-05-09 09:49:25 +00:00
parent 834bc1e30d
commit eeac6b63da
4 changed files with 66 additions and 53 deletions

View File

@ -58,24 +58,23 @@ SUBMENU MENU_VISWIN "~Visualizzazione"
SUBMENU MENU_VISWIN_EDIT "~Modifica" SUBMENU MENU_VISWIN_EDIT "~Modifica"
MENU MENU_VISWIN MENU MENU_VISWIN
ITEM M_EDIT_CLIPBOARD "Interrompi\tESC" ITEM M_VISWIN_STOP "Interrompi\tESC"
ITEM M_EDIT_CUT "Colle~ga...\tCtrl+G" DISABLED ITEM M_VISWIN_LINK "Colle~ga...\tCtrl+G" DISABLED
ITEM M_EDIT_PASTE "~Esporta...\tCtrl+E" ITEM M_VISWIN_EDIT "~Esporta...\tCtrl+E"
ITEM M_EDIT_SEL_ALL "~Stampa... \tCtrl+S" DISABLED ITEM M_VISWIN_PRINT "~Stampa... \tCtrl+S" DISABLED
SEPARATOR SEPARATOR
ITEM M_SHOW_RULERS "Mostra ~righelli" CHECKABLE ITEM M_SHOW_RULERS "Mostra ~righelli" CHECKABLE
ITEM M_SHOW_BUTTONS "Mostra ~bottoni" CHECKABLE ITEM M_SHOW_BUTTONS "Mostra ~bottoni" CHECKABLE
ITEM M_EDIT_UNDO "Ri~disegna" ITEM M_VISWIN_REDRAW "Ri~disegna"
SEPARATOR SEPARATOR
ITEM M_EDIT_QUIT "Chiudi\tESC+ESC" ITEM M_VISWIN_QUIT "Chiudi\tESC+ESC"
MENU MENU_VISWIN_EDIT MENU MENU_VISWIN_EDIT
ITEM M_EDIT_COPY "~Copia" DISABLED ITEM M_VISWIN_COPY "~Copia" DISABLED
ITEM M_EDIT_CLEAR "~Annulla" DISABLED ITEM M_VISWIN_CLEAR "~Annulla" DISABLED
SEPARATOR SEPARATOR
ITEM M_EDIT_SEARCH "Cerca...\tF7" ITEM M_VISWIN_SEARCH "Cerca...\tF7"
ITEM M_EDIT_DELETE "Cerca il prossimo\tF8" DISABLED ITEM M_VISWIN_NEXT "Cerca il prossimo\tF8" DISABLED
MENUBAR BROWSE_BAR MENUBAR BROWSE_BAR

View File

@ -16,19 +16,28 @@
#define VISWIN_BAR (7000) #define VISWIN_BAR (7000)
#define BROWSE_BAR (8000) #define BROWSE_BAR (8000)
#define MENU_VISWIN 7001 #define MENU_VISWIN (VISWIN_BAR+1)
#define MENU_VISWIN_EDIT 7002 #define MENU_VISWIN_EDIT (VISWIN_BAR+2)
#define M_VISWIN_STOP (VISWIN_BAR+3)
#define M_VISWIN_LINK (VISWIN_BAR+4)
#define M_VISWIN_EDIT (VISWIN_BAR+5)
#define M_VISWIN_PRINT (VISWIN_BAR+6)
#define M_SHOW_RULERS (VISWIN_BAR+7)
#define M_SHOW_BUTTONS (VISWIN_BAR+8)
#define M_VISWIN_REDRAW (VISWIN_BAR+9)
#define M_VISWIN_QUIT (VISWIN_BAR+10)
#define M_VISWIN_COPY (VISWIN_BAR+11)
#define M_VISWIN_CLEAR (VISWIN_BAR+12)
#define M_VISWIN_SEARCH (VISWIN_BAR+13)
#define M_VISWIN_NEXT (VISWIN_BAR+14)
#define MENU_FILE M_FILE #define MENU_FILE M_FILE
#define M_EDIT_SEARCH (M_EDIT+8) #define M_EDIT_SEARCH (M_EDIT+8)
#define M_EDIT_DELETE (M_EDIT+9) #define M_EDIT_DELETE (M_EDIT+9)
#define M_EDIT_QUIT (M_EDIT+10) #define M_EDIT_QUIT (M_EDIT+10)
#define M_SHOW_RULERS (M_EDIT+20)
#define M_SHOW_BUTTONS (M_EDIT+21)
#define M_PREF (M_FILE+700) #define M_PREF (M_FILE+700)
#define STR_FIRMNAME 101 #define STR_FIRMNAME 101

View File

@ -20,10 +20,10 @@ int PRINT_HEIGHT = 10;
#define TEXTROWS (rows() - Y_OFFSET - BUTTONROW_SIZE) #define TEXTROWS (rows() - Y_OFFSET - BUTTONROW_SIZE)
#define TEXTCOLUMNS (columns() - X_OFFSET) #define TEXTCOLUMNS (columns() - X_OFFSET)
#define DLG_QUIT_TITLE "Fine" //#define DLG_QUIT_TITLE "Fine"
#define DLG_EDIT_TITLE "~Edit" //#define DLG_EDIT_TITLE "~Edit"
#define DLG_LINK_TITLE "Colle~ga" //#define DLG_LINK_TITLE "Colle~ga"
#define DLG_PRINT_TITLE "~Stampa" //#define DLG_PRINT_TITLE "~Stampa"
#define BACKGROUND (_toplevel ? MASK_BACK_COLOR : COLOR_GRAY) #define BACKGROUND (_toplevel ? MASK_BACK_COLOR : COLOR_GRAY)
#define FOREGROUND (_toplevel ? COLOR_BLACK : COLOR_WHITE) #define FOREGROUND (_toplevel ? COLOR_BLACK : COLOR_WHITE)
@ -283,7 +283,7 @@ void TViswin::display_link (long y, long x1, long x2, const char *d)
if (_link_button) if (_link_button)
{ {
if (_showbuts) _link_button->enable(); if (_showbuts) _link_button->enable();
if (_toplevel) enable_menu_item(M_EDIT_CUT, TRUE); if (_toplevel) enable_menu_item(M_VISWIN_LINK, TRUE);
} }
if (!_toplevel && !_inside_linkexec) if (!_toplevel && !_inside_linkexec)
{ {
@ -319,7 +319,7 @@ void TViswin::erase_link (
if (_link_button) if (_link_button)
{ {
if (_showbuts) _link_button->disable(); if (_showbuts) _link_button->disable();
if (_toplevel) enable_menu_item(M_EDIT_CUT, FALSE); if (_toplevel) enable_menu_item(M_VISWIN_LINK, FALSE);
} }
} }
} }
@ -392,9 +392,11 @@ bool TViswin::check_link (
if (p == &_point) if (p == &_point)
plinkID = -1; plinkID = -1;
for (int i = 0; i < _hotspots->items (); i++) TArray & h = _txt.hotspots();
for (int i = 0; i < h.items (); i++)
{ {
TToken_string & t = (TToken_string &) (*_hotspots)[i]; TToken_string & t = (TToken_string &) h[i];
t.restart (); t.restart ();
long ty = t.get_long (); long ty = t.get_long ();
long tx1 = t.get_long (); long tx1 = t.get_long ();
@ -513,7 +515,10 @@ void TViswin::erase_selection ()
paint_selection (); paint_selection ();
_sel_displayed = FALSE; _sel_displayed = FALSE;
if (_toplevel) if (_toplevel)
enable_menu_item(M_EDIT_COPY, FALSE); {
enable_menu_item(M_VISWIN_COPY, FALSE);
enable_menu_item(M_VISWIN_CLEAR, FALSE);
}
} }
void TViswin::display_selection () void TViswin::display_selection ()
@ -522,7 +527,10 @@ void TViswin::display_selection ()
paint_selection (); paint_selection ();
_sel_displayed = TRUE; _sel_displayed = TRUE;
if (_toplevel) if (_toplevel)
enable_menu_item(M_EDIT_COPY, TRUE); {
enable_menu_item(M_VISWIN_COPY, TRUE);
enable_menu_item(M_VISWIN_CLEAR, TRUE);
}
} }
// @doc INTERNAL // @doc INTERNAL
@ -1314,7 +1322,7 @@ void TViswin::on_button(short dlg)
} }
break; break;
case DLG_PRINT: case DLG_PRINT:
dispatch_e_menu(win(), M_EDIT_SEL_ALL); dispatch_e_menu(win(), M_VISWIN_PRINT);
break; break;
case DLG_EDIT: case DLG_EDIT:
check_link(); check_link();
@ -1381,16 +1389,16 @@ void TViswin::handler (WINDOW win, EVENT * ep)
} }
else switch(ep->v.cmd.tag) else switch(ep->v.cmd.tag)
{ {
case M_EDIT_CLIPBOARD: // interrompi case M_VISWIN_STOP: // interrompi
dispatch_e_char(win, K_ESC); dispatch_e_char(win, K_ESC);
break; break;
case M_EDIT_CUT: // collega case M_VISWIN_LINK: // collega
dispatch_e_char(win, CTRL_G); dispatch_e_char(win, CTRL_G);
break; break;
case M_EDIT_PASTE: // esporta case M_VISWIN_EDIT: // esporta
dispatch_e_char(win, CTRL_E); dispatch_e_char(win, CTRL_E);
break; break;
case M_EDIT_SEL_ALL: // stampa case M_VISWIN_PRINT: // stampa
xvt_statbar_set (""); xvt_statbar_set ("");
xvt_statbar_refresh (); xvt_statbar_refresh ();
stop_run(CTRL_S); stop_run(CTRL_S);
@ -1403,24 +1411,24 @@ void TViswin::handler (WINDOW win, EVENT * ep)
show_buttons(!_showbuts); show_buttons(!_showbuts);
check_menu_item(M_SHOW_BUTTONS, _showbuts); check_menu_item(M_SHOW_BUTTONS, _showbuts);
break; break;
case M_EDIT_QUIT: // chiudi case M_VISWIN_QUIT: // chiudi
xvt_statbar_set (""); xvt_statbar_set ("");
xvt_statbar_refresh (); xvt_statbar_refresh ();
stop_run (K_ENTER); stop_run (K_ENTER);
break; break;
case M_EDIT_COPY: // copia nella clipboard case M_VISWIN_COPY: // copia nella clipboard
dispatch_e_char(win, CTRL_C); dispatch_e_char(win, CTRL_C);
break; break;
case M_EDIT_CLEAR: // annulla selezione case M_VISWIN_CLEAR: // annulla selezione
dispatch_e_char(win,K_ENTER); dispatch_e_char(win,K_ENTER);
break; break;
case M_EDIT_SEARCH: // cerca case M_VISWIN_SEARCH: // cerca
find(); find();
break; break;
case M_EDIT_DELETE: // cerca il prossimo case M_VISWIN_NEXT: // cerca il prossimo
find_next(); find_next();
break; break;
case M_EDIT_UNDO: // ridisegna case M_VISWIN_REDRAW: // ridisegna
refresh(); refresh();
break; break;
} }
@ -2359,11 +2367,11 @@ void TViswin::close_print ()
_need_update = TRUE; _need_update = TRUE;
if (_toplevel) if (_toplevel)
{ {
xvt_menu_set_item_title(win(), M_EDIT_QUIT, "Chiudi\tESC"); xvt_menu_set_item_title(win(), M_VISWIN_QUIT, "Chiudi\tESC");
enable_menu_item(M_EDIT_CLIPBOARD, FALSE); enable_menu_item(M_VISWIN_STOP, FALSE);
if (_print_button) if (_print_button)
_print_button->enable(); _print_button->enable();
enable_menu_item(M_EDIT_SEL_ALL, TRUE); enable_menu_item(M_VISWIN_PRINT, TRUE);
// build bookmark menu tree // build bookmark menu tree
_bookmarks = &(printer().get_bookmarks()); _bookmarks = &(printer().get_bookmarks());
if (_bookmarks->items() > 0) if (_bookmarks->items() > 0)
@ -2495,7 +2503,7 @@ void TViswin::find()
_last_found.y = l; _last_found.y = l;
} }
} }
if (_toplevel) enable_menu_item(M_EDIT_DELETE, TRUE); if (_toplevel) enable_menu_item(M_VISWIN_NEXT, TRUE);
} }
void TViswin::find_next() void TViswin::find_next()
@ -2635,12 +2643,13 @@ TViswin::TViswin(const char *fname,
{ {
if (width == 0 && height == 0) if (width == 0 && height == 0)
maximize(); maximize();
enable_menu_item(M_EDIT_COPY, FALSE); enable_menu_item(M_VISWIN_COPY, FALSE);
enable_menu_item(M_VISWIN_CLEAR, FALSE);
enable_menu_item(M_SHOW_RULERS, TRUE); enable_menu_item(M_SHOW_RULERS, TRUE);
enable_menu_item(M_SHOW_BUTTONS, TRUE); enable_menu_item(M_SHOW_BUTTONS, TRUE);
check_menu_item(M_SHOW_RULERS, _rulers != 0); check_menu_item(M_SHOW_RULERS, _rulers != 0);
check_menu_item(M_SHOW_BUTTONS, _showbuts); check_menu_item(M_SHOW_BUTTONS, _showbuts);
enable_menu_item(M_EDIT_SEL_ALL, FALSE); enable_menu_item(M_VISWIN_PRINT, FALSE);
} }
if (_txt.lines() > 0l) if (_txt.lines() > 0l)
@ -2649,20 +2658,20 @@ TViswin::TViswin(const char *fname,
if (_toplevel) if (_toplevel)
{ {
add_button (DLG_QUIT, DLG_QUIT_TITLE, BMP_QUIT, BMP_QUITDN); add_button (DLG_QUIT, "", BMP_QUIT, BMP_QUITDN);
if (_isedit) if (_isedit)
add_button (DLG_EDIT, DLG_EDIT_TITLE, BMP_EDIT); add_button (DLG_EDIT, "", BMP_EDIT);
if (_islink) if (_islink)
{ {
_link_button = add_button(DLG_LINK, DLG_LINK_TITLE, BMP_LINK); _link_button = add_button(DLG_LINK, "", BMP_LINK);
_link_button->disable(); _link_button->disable();
} }
if (_isprint) if (_isprint)
{ {
_print_button = add_button (DLG_PRINT, DLG_PRINT_TITLE, BMP_PRINT); _print_button = add_button (DLG_PRINT, "", BMP_PRINT);
_print_button->disable(); _print_button->disable();
enable_menu_item(M_EDIT_SEL_ALL, FALSE); enable_menu_item(M_VISWIN_PRINT, FALSE);
} }
} }
@ -2694,8 +2703,6 @@ TViswin::TViswin(const char *fname,
t.restart(); t.restart();
_txt.set_hotspots(f, b); _txt.set_hotspots(f, b);
} }
_hotspots = &(_txt.hotspots());
} }
TViswin ::~TViswin () TViswin ::~TViswin ()

View File

@ -130,8 +130,6 @@ class TViswin : public TField_window
// @cmember:(INTERNAL) Array di link ammessi // @cmember:(INTERNAL) Array di link ammessi
TArray* _links; TArray* _links;
// @cmember:(INTERNAL) Array di hotspots
TArray* _hotspots;
// @cmember:(INTERNAL) Array di segnalibri // @cmember:(INTERNAL) Array di segnalibri
TArray* _bookmarks; TArray* _bookmarks;