..gata nella gestione delle pagine disabilitate
git-svn-id: svn://10.65.10.50/trunk@636 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									e738fe49c0
								
							
						
					
					
						commit
						76f16c5b5f
					
				| @ -389,7 +389,10 @@ const char* TApplication::get_module_name() const | ||||
|   if (ok) ok = has_module(aut); | ||||
| 
 | ||||
|   if (!ok) | ||||
|     fatal_box("Il modulo '%s' non e' autorizzato", module); | ||||
|   { | ||||
|     error_box("Il modulo '%s' non e' autorizzato", module); | ||||
|     module = ""; | ||||
|   }   | ||||
| 
 | ||||
|   return module; | ||||
| } | ||||
| @ -480,8 +483,11 @@ void TApplication::run(int argc, char* argv[], const char* title) | ||||
|   } | ||||
|   set_perms(); | ||||
| 
 | ||||
|   const TFixed_string mod(get_module_name()); | ||||
|   if (mod.empty()) return; | ||||
|    | ||||
|   TString80 caption; | ||||
|   caption << "PRASSI S.p.A. - " << get_module_name(); | ||||
|   caption << "PRASSI S.p.A. - " << mod; | ||||
| 
 | ||||
|   static XVT_CONFIG cfg; | ||||
|   cfg.base_appl_name = (char*)base.name(); | ||||
|  | ||||
| @ -39,6 +39,8 @@ int fatal_box(const char* fmt, ...) | ||||
| 
 | ||||
|   if (xvt_running()) | ||||
|     main_app().stop_run(); | ||||
|   else | ||||
|     exit(1); | ||||
| #else | ||||
|   beep(); | ||||
|   if (xvt_running()) xvt_fatal("%s", msg); | ||||
|  | ||||
| @ -706,6 +706,8 @@ protected: | ||||
| 
 | ||||
| public: | ||||
|   TPage_button(WINDOW parent, byte flag); | ||||
|   byte get_flag() const { return _flag; } | ||||
|   void set_flag(byte f); | ||||
| }; | ||||
| 
 | ||||
| TPage_button::TPage_button(WINDOW parent, byte flag) : _flag(flag) | ||||
| @ -728,8 +730,15 @@ void TPage_button::mouse_up() | ||||
| 
 | ||||
| void TPage_button::update() const | ||||
| { | ||||
|   TControl::update(); | ||||
|   cpb_win_picture_draw_at(_hdc, cpb[BMP_BOOK1 + _flag -1], 0, 0); | ||||
|   TControl::update();     | ||||
|   if (_flag) | ||||
|     cpb_win_picture_draw_at(_hdc, cpb[BMP_BOOK1 + _flag -1], 0, 0); | ||||
| } | ||||
| 
 | ||||
| void TPage_button::set_flag(byte f) | ||||
| {            | ||||
|   _flag = f; | ||||
|   update(); | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| @ -752,6 +761,8 @@ protected: | ||||
| 
 | ||||
| public: | ||||
|   TTag_button(WINDOW parent, byte p, byte tot); | ||||
|   byte get_pages() const { return _pages; } | ||||
|   void set_pages(byte p); | ||||
| }; | ||||
| 
 | ||||
| TTag_button::TTag_button(WINDOW parent, byte p, byte tot) | ||||
| @ -809,7 +820,8 @@ void TTag_button::update() const | ||||
| void TTag_button::mouse_down(PNT where) | ||||
| { | ||||
|   _curr = where.h / width; | ||||
|   if (_curr >= _pages) _curr = _pages-1; | ||||
|   if (_curr >= _pages) _curr = _pages-1; else | ||||
|     if (_curr < 0) _curr = 0; | ||||
| } | ||||
| 
 | ||||
| void TTag_button::mouse_up() | ||||
| @ -818,6 +830,12 @@ void TTag_button::mouse_up() | ||||
|     dispatch_e_char(_parent, K_CTRL + K_F1 + _curr); | ||||
| } | ||||
| 
 | ||||
| void TTag_button::set_pages(byte p) | ||||
| { | ||||
|   _pages = p; | ||||
|   update(); | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // Checkbox
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| @ -1024,3 +1042,23 @@ TControl* TControl::WINDOW2TControl(WINDOW win) | ||||
|   CHECK(model && *model, "Can't get the model from a window"); | ||||
|   return *model; | ||||
| } | ||||
| 
 | ||||
| void xvt_change_page_tags(WINDOW pag, bool on, WINDOW tag, byte p) | ||||
| { | ||||
|   if (pag != NULL_WIN) | ||||
|   { | ||||
|     TPage_button* pb = (TPage_button*)TControl::WINDOW2TControl(pag); | ||||
|     byte f = pb->get_flag(); | ||||
|     if (on) f |= 0x1; | ||||
|     else    f &= 0x2; | ||||
|     pb->set_flag(f); | ||||
|   }   | ||||
|    | ||||
|   if (tag != NULL_WIN) | ||||
|   { | ||||
|     TTag_button* pt = (TTag_button*)TControl::WINDOW2TControl(tag); | ||||
|     pt->set_pages(p); | ||||
|   }   | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -11,7 +11,8 @@ WINDOW xvt_create_checkbox( | ||||
|   WINDOW parent, | ||||
|   long flags, | ||||
|   long app_data, | ||||
|   int id); | ||||
|   int id | ||||
|   ); | ||||
| 
 | ||||
|   WINDOW xvt_create_radiobutton( | ||||
|     short left, short top, short right, short bottom, | ||||
| @ -19,7 +20,8 @@ WINDOW xvt_create_checkbox( | ||||
|     WINDOW parent, | ||||
|     long flags, | ||||
|     long app_data, | ||||
|     int id); | ||||
|     int id | ||||
|     ); | ||||
| 
 | ||||
|     WINDOW xvt_create_pushbutton( | ||||
|       short left, short top, short right, short bottom, | ||||
| @ -27,7 +29,8 @@ WINDOW xvt_create_checkbox( | ||||
|       WINDOW parent, | ||||
|       long flags, | ||||
|       long app_data, | ||||
|       int id); | ||||
|       int id | ||||
|       ); | ||||
| 
 | ||||
|       WINDOW xvt_create_text( | ||||
|         short left, short top, short right, short bottom, | ||||
| @ -35,7 +38,8 @@ WINDOW xvt_create_checkbox( | ||||
|         WINDOW parent, | ||||
|         long flags, | ||||
|         long app_data, | ||||
|         int id); | ||||
|         int id | ||||
|         ); | ||||
| 
 | ||||
|         WINDOW xvt_create_groupbox( | ||||
|           short left, short top, short right, short bottom, | ||||
| @ -43,7 +47,8 @@ WINDOW xvt_create_checkbox( | ||||
|           WINDOW parent, | ||||
|           long flags, | ||||
|           long app_data, | ||||
|           int id); | ||||
|           int id | ||||
|           ); | ||||
| 
 | ||||
|           void free_controls_bmp(); | ||||
| 
 | ||||
| @ -51,7 +56,6 @@ WINDOW xvt_create_checkbox( | ||||
|           // Custom control
 | ||||
|           ///////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| 
 | ||||
|           class TControl | ||||
| { | ||||
|   WINDOW _win; | ||||
|  | ||||
| @ -162,15 +162,19 @@ void TMask::handler(WINDOW win, EVENT* ep) | ||||
| void TMask::init_mask(int mode) | ||||
| { | ||||
|   _sheets = _pages = 0;                       // Azzera numero pagine e sheets
 | ||||
|   _enabled = 0xffff;                          // Abilita tutte le pagine
 | ||||
|    | ||||
|   _enabled.set(MAX_PAGES); | ||||
|   _enabled.set();                             // Abilita tutte le pagine
 | ||||
|    | ||||
|   _focus = _first_focus = 0;                  // Nessuno ha il focus
 | ||||
|   _page = -1;                                 // Nessuna pagina corrente
 | ||||
|   _handler = NULL;                            // Nessun handler utente
 | ||||
|   _mode = mode;                               // Inizializza modo
 | ||||
|   _exchange = 1.0;                            // Il cambio per la valuta e' la lira
 | ||||
| 
 | ||||
|   for (int i = 0; i <= MAX_PAGES; i++) | ||||
|     _pagewin[i] = NULL_WIN;                   // Azzera le finestre delle varie pagine
 | ||||
|   memset(_pagewin, 0, sizeof(_pagewin)); | ||||
|   memset(_pagepag, 0, sizeof(_pagepag)); | ||||
|   memset(_pagetag, 0, sizeof(_pagetag)); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| @ -236,14 +240,14 @@ void TMask::add_buttons() | ||||
|   for (int p = 0; p < _pages; p++) | ||||
|   { | ||||
|     if (_pages > 1) | ||||
|     { | ||||
|       const byte flag = (p < _pages-1 ? 0x1 : 0x0) | (p > 0 ? 0x2 : 0x0); | ||||
|       xvt_create_control(WC_PUSHBUTTON, 0,0,1,1, "", | ||||
|                          _pagewin[p], flag, 0, DLG_PAGE); | ||||
|     {                                                     | ||||
|       const long flags = (p < _pages-1 ? 0x1 : 0x0) | (p > 0 ? 0x2 : 0x0); | ||||
|       _pagepag[p] = xvt_create_control(WC_PUSHBUTTON, 0, 0, 1, 1, "",  | ||||
|                                        _pagewin[p], flags, 0, DLG_PAGE); | ||||
|     }                                                                             | ||||
|     if (toolwin()) | ||||
|       xvt_create_control(WC_PUSHBUTTON, 0,0,0,1, "", | ||||
|                          _pagewin[p], p, _pages, DLG_PAGETAGS); | ||||
|       _pagetag[p] = xvt_create_control(WC_PUSHBUTTON, 0, 0, 0, 1, "", | ||||
|                                        _pagewin[p], p, _pages, DLG_PAGETAGS); | ||||
|   } | ||||
| #else | ||||
|   if (toolwin()) | ||||
| @ -384,23 +388,31 @@ void TMask::load_checks() const | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void TMask::enable_page(int page, bool on) | ||||
| // Dis/abilita una pagina e tutte le successive
 | ||||
| void TMask::enable_page(byte page, bool on) | ||||
| { | ||||
|   int first = (page >= 0) ? page : 1; | ||||
|   int last = (page >= 0) ? page+1 : _pages; | ||||
| 
 | ||||
|   for (int p = first; p < last; p++) | ||||
|   CHECK(page > 0, "Can't enable/disable first page"); | ||||
|    | ||||
|   if (_enabled[page] != on)  | ||||
|   { | ||||
|     const word n = 1 << p; | ||||
|     if (on) _enabled |= n; | ||||
|     else    _enabled &= ~n; | ||||
|     for (byte i = page; i < _pages; i++)                      | ||||
|       _enabled.set(i, on); | ||||
| 
 | ||||
| #if XVT_OS == XVT_OS_WIN                                                        | ||||
|     const byte p = on ? _pages : page; | ||||
|     for (i = 0; i < page-1; i++)                      | ||||
|       xvt_change_page_tags(NULL_WIN, FALSE, _pagetag[i], p); | ||||
| 
 | ||||
|     xvt_change_page_tags(_pagepag[page-1], on, _pagetag[page-1], p); | ||||
| #endif                       | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| bool TMask::page_enabled(int page) const | ||||
| // Controlla lo stato di abilitazione di una pagina    
 | ||||
| // Certified 100%
 | ||||
| bool TMask::page_enabled(byte page) const | ||||
| { | ||||
|   const unsigned long n = 1 << page; | ||||
|   return (_enabled & n) > 0; | ||||
|   return _enabled[page]; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| @ -426,7 +438,7 @@ void TMask::start_run() | ||||
|   for (i = 0; i < max; i++) | ||||
|   { | ||||
|     TMask_field& f = fld(i); | ||||
|     if (mode() == MODE_QUERY && f.is_edit() && f.in_key(1) &&  | ||||
|     if (query_mode() && f.is_edit() && f.in_key(1) &&  | ||||
|         !f.automagic() && !f.get().empty()) | ||||
|     { | ||||
|       f.set_dirty(TRUE); | ||||
| @ -497,7 +509,7 @@ void TMask::get_mask_fields() | ||||
| 
 | ||||
| int TMask::id2pos(short id) const | ||||
| { | ||||
|   const int MAX_FIELDS = 128; | ||||
|   const int MAX_FIELDS = 256; | ||||
|   static byte positions[MAX_FIELDS];      //  100 <= id < MAX_FIELDS
 | ||||
|   const int max = fields(); | ||||
| 
 | ||||
| @ -1124,26 +1136,34 @@ void TMask::autosave(TRelation* r) const | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void TMask::send_key(KEY key, short to) const | ||||
| void TMask::send_key(KEY key, short to, TMask_field* from) | ||||
| { | ||||
|   if (to == 0) | ||||
|   { | ||||
|     WINDOW w = win(); | ||||
|     if (w == NULL_WIN) w = _pagewin[0]; | ||||
|   {                 | ||||
|     WINDOW w = from ? from->parent() : _pagewin[0]; | ||||
|     dispatch_e_char(w, key); | ||||
|     return; | ||||
|   } | ||||
| 
 | ||||
|   if (to > 0) | ||||
|   { | ||||
|     const int pos = id2pos(to); | ||||
|     if (pos >= 0) | ||||
|       fld(pos).on_key(key); | ||||
| #ifdef DBG | ||||
|   {         | ||||
|     if (to == DLG_PAGE) | ||||
|     {                 | ||||
|       CHECK(from, "You should specify a sender!"); | ||||
|       const int p = find_parent_page(*from)+1; | ||||
|       CHECKD(p > 0 && p < _pages, "You should specify a good page, not ", p); | ||||
|       key -= K_CTRL+K_SHIFT; | ||||
|       enable_page(p, key == 's' || key == 'e'); | ||||
|     } | ||||
|     else | ||||
|       if (mode() != MODE_SEARCH)  | ||||
|     { | ||||
|       const int pos = id2pos(to); | ||||
|       if (pos >= 0) fld(pos).on_key(key); | ||||
| #ifdef DBG | ||||
|       else | ||||
|         yesnofatal_box("Can't send key %u to field %d", key, to); | ||||
| #endif | ||||
| #endif   | ||||
|     } | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|  | ||||
| @ -30,11 +30,13 @@ class TMask : public TWindow | ||||
|   // @DPRIV
 | ||||
|   enum { MAX_PAGES = 12 };      // Massimo numero di pagine nella maschera
 | ||||
|   WINDOW _pagewin[MAX_PAGES+1]; // Windows of the pages
 | ||||
| 
 | ||||
|   WINDOW _pagepag[MAX_PAGES];   // Windows of pgup/pgdn
 | ||||
|   WINDOW _pagetag[MAX_PAGES];   // Windows of pagetags
 | ||||
|    | ||||
|   int _pages;                   // Number of pages of the mask
 | ||||
|   int _page;                    // Current page
 | ||||
| 
 | ||||
|   word   _enabled;              // Are pages enabled (bit field)
 | ||||
|   TBit_array _enabled;          // Are pages enabled
 | ||||
|   int    _mode;                 // Mode of the mask
 | ||||
|   TArray _field;                // Fields in the mask
 | ||||
|    | ||||
| @ -150,9 +152,9 @@ public: | ||||
|   void disable(short fld_id) { enable(fld_id, FALSE); } | ||||
|   void enable_default(short fld_id = -1); | ||||
| 
 | ||||
|   void enable_page(int p, bool on = TRUE); | ||||
|   void disable_page(int p) { enable_page(p, FALSE); } | ||||
|   bool page_enabled(int p) const; | ||||
|   void enable_page(byte p, bool on = TRUE); | ||||
|   void disable_page(byte p) { enable_page(p, FALSE); } | ||||
|   bool page_enabled(byte p) const; | ||||
|    | ||||
|   byte num_keys() const; | ||||
|   void enable_key(byte key, bool on = TRUE); | ||||
| @ -170,7 +172,7 @@ public: | ||||
|   void autoload(const TRelation* = NULL); | ||||
|   void autosave(TRelation* = NULL) const; | ||||
| 
 | ||||
|   void send_key(KEY key, short id) const; | ||||
|   void send_key(KEY key, short id, TMask_field* from = NULL); | ||||
|   void set_handler(short fld_id, CONTROL_HANDLER handler); | ||||
|   void set_handler(MASK_HANDLER handler); | ||||
|   void set_workfile(const char* workfile) { _workfile = workfile; _lastpos = 0L;} | ||||
|  | ||||
							
								
								
									
										6104
									
								
								include/maskfld.cpp
									
									
									
									
									
								
							
							
						
						
									
										6104
									
								
								include/maskfld.cpp
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,4 +1,4 @@ | ||||
| /*      $Id: maskfld.h,v 1.10 1994-11-15 17:14:28 guy Exp $  */ | ||||
| /*      $Id: maskfld.h,v 1.11 1994-11-16 15:51:01 guy Exp $  */ | ||||
| #ifndef __MASKFLD_H | ||||
| #define __MASKFLD_H | ||||
| 
 | ||||
| @ -187,6 +187,7 @@ public: | ||||
|   const TFieldref* field() const { return _field; } | ||||
|    | ||||
|   void set_focus() const; | ||||
|   void send_key(KEY k, short to); | ||||
| 
 | ||||
|   // set focus, message-box, set focus  
 | ||||
|   bool message_box(const char* fmt, ...) const; | ||||
|  | ||||
| @ -1 +1 @@ | ||||
| #define VERSION 1.16 | ||||
| #define VERSION 1.15 | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| //      $Id: relapp.cpp,v 1.28 1994-11-15 11:23:19 guy Exp $        
 | ||||
| //      $Id: relapp.cpp,v 1.29 1994-11-16 15:51:05 guy Exp $        
 | ||||
| #include <mailbox.h> | ||||
| #include <sheet.h> | ||||
| #include <urldefid.h> | ||||
| @ -712,7 +712,6 @@ bool TRelation_application::main_loop() | ||||
|     // Dis/abilita cambio ditta
 | ||||
|     enable_menu_item(M_FILE_NEW, (_mask->mode() == MODE_QUERY)); | ||||
| 
 | ||||
|      | ||||
|     k = _mask->run(); | ||||
| 
 | ||||
|     // Seleziona il cursore a clessidra se necessario
 | ||||
|  | ||||
| @ -24,7 +24,8 @@ WINDOW xvt_create_window(WIN_TYPE wt, | ||||
|                          const char* caption, WINDOW parent, | ||||
|                          long flags, | ||||
|                          EVENT_HANDLER eh, | ||||
|                          long app_data); | ||||
|                          long app_data | ||||
|                          ); | ||||
| 
 | ||||
|                          WINDOW xvt_create_control(WIN_TYPE wt, | ||||
|                                                    short x, short y, short dx, short dy, | ||||
| @ -32,7 +33,8 @@ WINDOW xvt_create_window(WIN_TYPE wt, | ||||
|                                                    WINDOW parent, | ||||
|                                                    long flags, | ||||
|                                                    long app_data, | ||||
|                                                    int id); | ||||
|                                                    int id | ||||
|                                                    ); | ||||
| 
 | ||||
|                                                    WINDOW xvt_create_statbar(); | ||||
|                                                    void xvt_statbar_set(const char* text, bool def = FALSE); | ||||
| @ -53,6 +55,7 @@ WINDOW xvt_create_window(WIN_TYPE wt, | ||||
|                                                    bool xvt_get_checked_state(WINDOW win); | ||||
|                                                    void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count); | ||||
|                                                    int  xvt_get_checked_radio(const WINDOW* ctls, int count); | ||||
|                                                    void xvt_change_page_tags(WINDOW pag, bool on, WINDOW tag, byte p); | ||||
| 
 | ||||
|                                                    bool xvt_test_menu_tag(MENU_TAG tag);     | ||||
| 
 | ||||
| @ -60,9 +63,6 @@ WINDOW xvt_create_window(WIN_TYPE wt, | ||||
|                                                    PAT_STYLE trans_brush(char p); | ||||
|                                                    PEN_STYLE trans_pen  (char p); | ||||
| 
 | ||||
| 
 | ||||
|                                                    /* @END */ | ||||
| 
 | ||||
|                                                    extern short CHARX, CHARY, BASEY, ROWY; | ||||
| 
 | ||||
|                                                    /* @END */ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user