ba0.cpp Corretta gestione colori
ba0300a.uml maschera editor ba4* gestione fax git-svn-id: svn://10.65.10.50/trunk@3296 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									b3f835da0d
								
							
						
					
					
						commit
						be6438d301
					
				
							
								
								
									
										217
									
								
								ba/ba0.cpp
									
									
									
									
									
								
							
							
						
						
									
										217
									
								
								ba/ba0.cpp
									
									
									
									
									
								
							| @ -1,3 +1,5 @@ | ||||
| #include <xi.h> | ||||
| 
 | ||||
| #include <applicat.h> | ||||
| #include <colors.h>   | ||||
| #include <config.h> | ||||
| @ -34,6 +36,8 @@ protected: // TMask | ||||
|   virtual void update(); | ||||
| 
 | ||||
| public: | ||||
|   virtual bool stop_run(KEY key) { return TWindow::stop_run(key); } | ||||
| 
 | ||||
|   TPicture_mask(const char* name, int dx, int dy, TImage& image); | ||||
|   virtual ~TPicture_mask() {} | ||||
| }; | ||||
| @ -50,12 +54,18 @@ void TPicture_mask::update() | ||||
|   if (_image.ok()) | ||||
|   { | ||||
|     RCT cli; fld(1).get_rect(cli); | ||||
|      | ||||
|     const short maxx = cli.left; | ||||
|     const short maxy = short((long)maxx*_image.height()/_image.width()); | ||||
|     RCT dst; xvt_rect_set(&dst, 1, 1, maxx, maxy); | ||||
|      | ||||
|     if (xvt_dwin_is_update_needed(win(), &dst)) | ||||
|       _image.draw(win(), dst); | ||||
|      | ||||
|     xvt_vobj_get_client_rect(win(), &cli); | ||||
|     cli.bottom--; | ||||
|     cli.right--; | ||||
|     xvt_draw_rect(win(), cli, MASK_LIGHT_COLOR, MASK_DARK_COLOR, 1); | ||||
|   }   | ||||
| } | ||||
| 
 | ||||
| @ -69,10 +79,16 @@ class TColor_mask : public TMask | ||||
| 
 | ||||
| protected: // TMask
 | ||||
|   virtual void update();               | ||||
|   virtual bool stop_run(KEY key) { return TWindow::stop_run(key); } | ||||
| 
 | ||||
|   // @cmember Converte le coordinate logiche (caratteri) in coordinate fisiche (pixel)
 | ||||
|   virtual PNT log2dev(long x, long y) const; | ||||
|    | ||||
| protected:   | ||||
|   static bool color_handler(TMask_field& f, KEY k); | ||||
|   static bool azzera_handler(TMask_field& f, KEY k); | ||||
|    | ||||
|   COLOR get_color(const char* c) const; | ||||
|   COLOR get_color_entry(const char* c) const; | ||||
|   void set_color_entry(const char* name, COLOR col); | ||||
|   const char* cid2name(short cid) const; | ||||
|   COLOR cid2color(short cid) const; | ||||
| @ -80,6 +96,8 @@ protected: // TMask | ||||
| public: | ||||
|   void save_colors(); | ||||
|   | ||||
|   virtual KEY run(); | ||||
| 
 | ||||
|   TColor_mask(); | ||||
|   virtual ~TColor_mask() { } | ||||
| }; | ||||
| @ -104,6 +122,73 @@ TColor_mask::TColor_mask() | ||||
|   }   | ||||
| } | ||||
| 
 | ||||
| PNT TColor_mask::log2dev(long x, long y) const | ||||
| { | ||||
|   PNT p = { int(y * XI_FU_MULTIPLE), int(x * XI_FU_MULTIPLE) }; | ||||
|    | ||||
|   XI_OBJ* itf = xi_get_itf(win()); | ||||
|   xi_fu_to_pu(itf, &p, 1);    | ||||
|    | ||||
|   p.v = int(y * ROWY); | ||||
|   p.h += XI_FU_MULTIPLE / 2; | ||||
|   return p; | ||||
| } | ||||
| 
 | ||||
| KEY TColor_mask::run() | ||||
| { | ||||
|   KEY k = K_CTRL + 'R'; | ||||
|   while (k == K_CTRL + 'R')  | ||||
|     k = TMask::run();              | ||||
|   return k; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void TColor_mask::update() | ||||
| {  | ||||
|   COLOR p, b;                | ||||
|    | ||||
|   const int x = 1; | ||||
|   const int y = 7; | ||||
|   const int w = 32;   | ||||
|   const int h = 9; | ||||
|    | ||||
|   set_pen(COLOR_BLACK); | ||||
|   set_brush(b = get_color_entry("MaskBack")); | ||||
|   frame(x+0, y+0, x+w, y+h, 0); | ||||
|    | ||||
|   set_pen(p = get_color_entry("MaskLight")); | ||||
|   line(x+1, y, x+w-2, y);  | ||||
|   line(x+1, y, x+1, y+h-1); | ||||
|    | ||||
|   set_pen(p = get_color_entry("MaskDark")); | ||||
|   line(x+1, y+h-1, x+w-2, y+h-1);  | ||||
|   line(x+w-2, y+h-1, x+w-2, y); | ||||
| 
 | ||||
|   set_opaque_text(FALSE); | ||||
|   set_pen(p = get_color_entry("Normal")); | ||||
|   set_brush(b = get_color_entry("NormalBack")); | ||||
|   frame(x+3, y+1, x+w-3, y+2, 0);        | ||||
|   set_color(p, b); | ||||
|   stringat(x+4, y+1, "Campo normale"); | ||||
| 
 | ||||
|   set_pen(p = get_color_entry("Focus")); | ||||
|   set_brush(b = get_color_entry("FocusBack")); | ||||
|   frame(x+3, y+3, x+w-3, y+4, 0); | ||||
|   set_color(p, b); | ||||
|   stringat(x+4, y+3, "Campo attivo"); | ||||
|    | ||||
|   set_pen(p = get_color_entry("Disabled")); | ||||
|   set_brush(b = get_color_entry("DisabledBack")); | ||||
|   frame(x+3, y+5, x+w-3, y+6, 0); | ||||
|   set_color(p, b); | ||||
|   stringat(x+4, y+5, "Campo disabilitato"); | ||||
|    | ||||
|   set_pen(p = get_color_entry("ButtonLight")); | ||||
|   set_brush(b = get_color_entry("ButtonBack")); | ||||
|   frame(x+3, y+7, x+w-3, y+8, 0); | ||||
|   stringat(x+4, y+7, "Bottone normale"); | ||||
| } | ||||
| 
 | ||||
| void TColor_mask::save_colors() | ||||
| { | ||||
|   TConfig colors(CONFIG_USER, "Colors"); | ||||
| @ -116,7 +201,7 @@ void TColor_mask::save_colors() | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| COLOR TColor_mask::get_color(const char* name) const | ||||
| COLOR TColor_mask::get_color_entry(const char* name) const | ||||
| {                                | ||||
|   COLOR c = COLOR_INVALID; | ||||
|   const TObject* s = ((TColor_mask*)this)->_color.objptr(name); | ||||
| @ -147,9 +232,11 @@ const char* TColor_mask::cid2name(short cid) const | ||||
|   const char* name[] = { "MaskBack", "MaskLight", "MaskDark", | ||||
|                          "Normal", "NormalBack", | ||||
|                          "Focus", "FocusBack", | ||||
|                          "Disabled", "DisabledBack" }; | ||||
|                          "Disabled", "DisabledBack",          | ||||
|                          "ButtonBack", "ButtonLight", "ButtonDark" | ||||
|                           }; | ||||
|   const int i = cid - 101;                        | ||||
|   CHECK(i >= 0 && i < 9, "Invalid color id"); | ||||
|   CHECK(i >= 0 && i < 12, "Invalid color id"); | ||||
|   return name[i]; | ||||
| } | ||||
| 
 | ||||
| @ -158,10 +245,11 @@ COLOR TColor_mask::cid2color(short cid) const | ||||
|   COLOR color[] = { COLOR_DKCYAN, COLOR_CYAN, COLOR_GRAY, | ||||
|                     COLOR_BLACK, COLOR_WHITE, | ||||
|                     COLOR_BLACK, COLOR_CYAN, | ||||
|                     COLOR_GRAY, COLOR_DKCYAN }; | ||||
|                     COLOR_GRAY, COLOR_DKCYAN,  | ||||
|                     COLOR_LTGRAY, COLOR_WHITE, COLOR_GRAY}; | ||||
| 
 | ||||
|   const int i = cid - 101;                        | ||||
|   CHECK(i >= 0 && i < 9, "Invalid color id"); | ||||
|   CHECK(i >= 0 && i < 12, "Invalid color id"); | ||||
|   return color[i]; | ||||
| } | ||||
| 
 | ||||
| @ -182,7 +270,7 @@ bool TColor_mask::color_handler(TMask_field& f, KEY k) | ||||
|   {               | ||||
|     TColor_mask& m = (TColor_mask&)f.mask(); | ||||
|     const char* name = m.cid2name(f.dlg()); | ||||
|     COLOR col = m.get_color(name); | ||||
|     COLOR col = m.get_color_entry(name); | ||||
|      | ||||
| #if XVT_OS == XVT_OS_WIN                | ||||
|     CHOOSECOLOR cc; | ||||
| @ -237,7 +325,23 @@ bool TColor_mask::color_handler(TMask_field& f, KEY k) | ||||
|     if (ok) | ||||
|     { | ||||
|       m.set_color_entry(name, col); | ||||
|       m.force_update(); | ||||
|       XVT_PALETTE wp = xvt_vobj_get_palet(m.win()); | ||||
|       if (wp != NULL) | ||||
|       { | ||||
|         XVT_PALETTE up = xvt_palet_create(XVT_PALETTE_USER, 0); | ||||
|         if (up != NULL) | ||||
|         {                   | ||||
|           const int MAXPAL = 256; | ||||
|           COLOR color[MAXPAL]; | ||||
|           const int n = xvt_palet_get_colors(wp, color, MAXPAL); | ||||
|           if (n < MAXPAL) color[n] = col; | ||||
|           xvt_palet_set_tolerance(up, xvt_palet_get_tolerance(wp)); | ||||
|           xvt_palet_add_colors(up, color, n+1); | ||||
|           xvt_vobj_set_palet(m.win(), up); | ||||
|           xvt_palet_destroy(wp); | ||||
|         }   | ||||
|       }   | ||||
|       m.stop_run(K_CTRL + 'R'); | ||||
|     } | ||||
|   }               | ||||
|    | ||||
| @ -264,42 +368,6 @@ bool TColor_mask::azzera_handler(TMask_field& f, KEY k) | ||||
|   return TRUE; | ||||
| } | ||||
| 
 | ||||
| void TColor_mask::update() | ||||
| {  | ||||
|   COLOR p, b;                | ||||
|    | ||||
|   set_pen(COLOR_BLACK); | ||||
|   set_brush(b = get_color("MaskBack")); | ||||
|   frame(1, 10, 33, 19, 0); | ||||
|    | ||||
|   set_pen(p = get_color("MaskLight")); | ||||
|   line(2, 10, 31, 10);  | ||||
|   line(2, 10,  2, 18); | ||||
|    | ||||
|   set_pen(p = get_color("MaskDark")); | ||||
|   line( 2, 18, 31, 18);  | ||||
|   line(31, 18, 31, 10); | ||||
| 
 | ||||
|   set_opaque_text(FALSE); | ||||
|   set_pen(p = COLOR_BLACK); | ||||
|   set_brush(b = get_color("NormalBack")); | ||||
|   frame(4, 12, 30, 13, 0);        | ||||
|   set_color(get_color("Normal"), b); | ||||
|   stringat(5, 12, "Campo normale"); | ||||
| 
 | ||||
|   set_pen(p = get_color("Focus")); | ||||
|   set_brush(b = get_color("FocusBack")); | ||||
|   frame(4, 14, 30, 15, 0); | ||||
|   set_color(p, b); | ||||
|   stringat(5, 14, "Campo attivo"); | ||||
|    | ||||
|   set_pen(p = COLOR_BLACK); | ||||
|   set_brush(b = get_color("DisabledBack")); | ||||
|   frame(4, 16, 30, 17, 0); | ||||
|   set_color(get_color("Disabled"), b); | ||||
|   stringat(5, 16, "Campo disabilitato"); | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // Menu application
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| @ -325,6 +393,7 @@ protected:  // TApplication | ||||
|   virtual bool destroy(); | ||||
|   virtual bool menu(MENU_TAG m); | ||||
|   virtual bool build_firm_data(long cod, bool flagcom = FALSE); | ||||
|   virtual long handler(WINDOW win, EVENT* ep); | ||||
| 
 | ||||
| protected: | ||||
|   bool main_loop(); | ||||
| @ -339,6 +408,7 @@ protected: | ||||
|   bool module_enabled(int module) const { return has_module(module);} | ||||
| 
 | ||||
|   bool choose_colors(); | ||||
|   bool choose_editors(); | ||||
|    | ||||
| public:     | ||||
|   void reload_images(); | ||||
| @ -687,6 +757,9 @@ int TMenu_application::do_level() | ||||
|     menu.reset(); | ||||
|     m = -2;  | ||||
|     break;     | ||||
|   case K_CTRL+'R': | ||||
|     m = 0; | ||||
|     break;   | ||||
|   default: | ||||
|     if (_find_button) | ||||
|       m = -1; | ||||
| @ -977,14 +1050,61 @@ bool TMenu_application::choose_colors() | ||||
|      | ||||
|     // Provoca chiusura forzata del menu
 | ||||
|     if (_mask != NULL)  | ||||
|     { | ||||
|       _last_button = 100; | ||||
|       _mask->stop_run(K_AUTO_ENTER); | ||||
|     }   | ||||
|       _mask->stop_run(K_CTRL + 'R'); | ||||
|   } | ||||
|   return TRUE; | ||||
| }  | ||||
| 
 | ||||
| HIDDEN bool browse_file_handler(TMask_field& f, KEY k) | ||||
| { | ||||
|   if (k == K_F9) | ||||
|   {   | ||||
|     FILE_SPEC fs; memset(&fs, 0, sizeof(FILE_SPEC)); | ||||
|     strcpy(fs.type, "EXE"); | ||||
|     strcpy(fs.name, f.get()); | ||||
|     strcpy(fs.creator, "ba0"); | ||||
|     xvt_fsys_get_default_dir(&fs.dir); | ||||
|     xvt_fsys_save_dir(); | ||||
|     if (xvt_dm_post_file_open(&fs, "Selezione programma") == FL_OK) | ||||
|     {        | ||||
|       TFilename n; | ||||
|       xvt_fsys_convert_dir_to_str(&fs.dir, (char*)(const char*)n, n.size()); | ||||
|       n.add(fs.name); | ||||
|       f.set(n); | ||||
|       xvt_fsys_restore_dir(); | ||||
|     } | ||||
|   } | ||||
|    | ||||
|   return TRUE; | ||||
| } | ||||
| 
 | ||||
| bool TMenu_application::choose_editors() | ||||
| {  | ||||
|   TConfig link(CONFIG_USER, "Link"); | ||||
|   TMask editor("ba0300a"); | ||||
|    | ||||
|   editor.set_handler(101, browse_file_handler); | ||||
|   editor.set(101, link.get("Editor")); | ||||
|    | ||||
|   if (editor.run() == K_ENTER) | ||||
|   { | ||||
|     link.set("Editor", editor.get(101)); | ||||
|   } | ||||
|    | ||||
|   return TRUE; | ||||
| } | ||||
| 
 | ||||
| long TMenu_application::handler(WINDOW win, EVENT* ep) | ||||
| { | ||||
|   long ret = TApplication::handler(win, ep); | ||||
|   if (ep->type == E_FONT) | ||||
|   { | ||||
|     if (_mask != NULL)  | ||||
|       _mask->stop_run(K_CTRL + 'R'); | ||||
|   }   | ||||
|   return ret;   | ||||
| } | ||||
| 
 | ||||
| bool TMenu_application::menu(MENU_TAG mt) | ||||
| { | ||||
|   bool ok = TRUE; | ||||
| @ -992,6 +1112,7 @@ bool TMenu_application::menu(MENU_TAG mt) | ||||
|   { | ||||
|   case MENU_ITEM(1): ok = main_loop(); break; | ||||
|   case MENU_ITEM(2): choose_colors(); break;  | ||||
|   case MENU_ITEM(3): choose_editors(); break; | ||||
|   default: break; | ||||
|   } | ||||
|   return  ok; | ||||
|  | ||||
| @ -1,9 +1,10 @@ | ||||
| #include <default.url> | ||||
| 
 | ||||
| MENU TASK_MENUBAR | ||||
|   SUBMENU MENU_FILE     "~File" | ||||
|   SUBMENU M_FONT        "~Opzioni" | ||||
|   SUBMENU MENU_FILE "~File" | ||||
|   SUBMENU M_FONT    "~Opzioni" DISABLED | ||||
| 
 | ||||
| MENU M_FONT | ||||
|   ITEM M_FONT_SELECT "~Font"   | ||||
|   ITEM MENU_ITEM(2)  "~Colori" | ||||
|   ITEM MENU_ITEM(3)  "~Editor" | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| PAGE "Colori" -1 -1 50 16 | ||||
| PAGE "Colori" -1 -1 50 20 | ||||
| 
 | ||||
| GROUPBOX DLG_NULL 48 3 | ||||
| BEGIN | ||||
| @ -65,6 +65,26 @@ BEGIN | ||||
|   PROMPT 36 5 "Sfondo" | ||||
| END | ||||
| 
 | ||||
| GROUPBOX DLG_NULL 14 5 | ||||
| BEGIN | ||||
|   PROMPT 35 7 "Bottone" | ||||
| END | ||||
| 
 | ||||
| BUTTON 110 10 | ||||
| BEGIN | ||||
|   PROMPT 36 8 "Normale" | ||||
| END | ||||
| 
 | ||||
| BUTTON 111 10 | ||||
| BEGIN | ||||
|   PROMPT 36 9 "Chiaro" | ||||
| END | ||||
| 
 | ||||
| BUTTON 112 10 | ||||
| BEGIN | ||||
|   PROMPT 36 10 "Scuro" | ||||
| END | ||||
| 
 | ||||
| BUTTON DLG_OK 10 2 | ||||
| BEGIN | ||||
|   PROMPT -13 -1 "Conferma" | ||||
|  | ||||
							
								
								
									
										22
									
								
								ba/ba0300a.uml
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								ba/ba0300a.uml
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,22 @@ | ||||
| PAGE "Editor" -1 -1 62 5 | ||||
| 
 | ||||
| STRING 101 50 | ||||
| BEGIN | ||||
|   PROMPT 1 1 "Comando " | ||||
|   FLAGS "B" | ||||
|   FIELD Editor | ||||
| END | ||||
| 
 | ||||
| BUTTON DLG_OK 10 2 | ||||
| BEGIN | ||||
|   PROMPT -12 -1 "Conferma" | ||||
| END | ||||
| 
 | ||||
| BUTTON DLG_CANCEL 10 2 | ||||
| BEGIN | ||||
|   PROMPT -22 -1 "Annulla" | ||||
| END | ||||
| 
 | ||||
| ENDPAGE | ||||
| 
 | ||||
| ENDMASK | ||||
| @ -2,23 +2,23 @@ PAGE "POSIZIONAMENTO MODULI" -1 -1 55 6 | ||||
| 
 | ||||
| TEXT DLG_NULL | ||||
| BEGIN | ||||
| PROMPT 1 1 "Premere <Conferma> per confermare il posizionamento." | ||||
|   PROMPT 1 1 "Premere <Conferma> per confermare il posizionamento." | ||||
| END | ||||
| 
 | ||||
| TEXT DLG_NULL | ||||
| BEGIN | ||||
| PROMPT 1 2 "Premere <Riprova>  per ritentare  il posizionamento." | ||||
|   PROMPT 1 2 "Premere <Riprova>  per ritentare  il posizionamento." | ||||
| END | ||||
| 
 | ||||
| BUTTON DLG_OK 10 2 | ||||
| BEGIN | ||||
| PROMPT -12 -1 "" | ||||
|   PROMPT -12 -1 "" | ||||
| END | ||||
| 
 | ||||
| BUTTON DLG_USER 10 2 | ||||
| BEGIN | ||||
| PROMPT -22 -1 "~Riprova" | ||||
| MESSAGE EXIT,K_ESC | ||||
|   PROMPT -22 -1 "~Riprova" | ||||
|   MESSAGE EXIT,K_ESC | ||||
| END | ||||
| 
 | ||||
| ENDPAGE | ||||
|  | ||||
| @ -1,7 +1,6 @@ | ||||
| #include <relapp.h>   | ||||
| #include <msksheet.h> | ||||
| #include <stdtypes.h> | ||||
| #include <lffiles.h> | ||||
| #include "ba4.h" | ||||
| #include "ba4100.h" | ||||
| 
 | ||||
|  | ||||
| @ -1,4 +1,6 @@ | ||||
| #include <defmask.h> | ||||
| #include <execp.h> | ||||
| #include <golem.h> | ||||
| #include <mask.h> | ||||
| #include <mailbox.h> | ||||
| #include <relapp.h> | ||||
| @ -39,6 +41,7 @@ protected: | ||||
|   virtual TMask* get_mask(int mode) ; | ||||
|   virtual void write_enable(bool on = TRUE); | ||||
|    | ||||
|   static bool fax_handler(TMask_field& f, KEY k); | ||||
|   static bool ba4200_handler(TMask& m, KEY k); | ||||
|    | ||||
| public: | ||||
| @ -51,8 +54,8 @@ public: | ||||
|   void set_tip_ana(char tip) { _tip_ana = _next_ana = toupper(tip);} | ||||
|   void set_next_ana(char tip) { _next_ana = toupper(tip);} | ||||
|   void set_cod_ana(const char* cod) { _cod_ana = cod;} | ||||
|   const char* cod_ana() { return _cod_ana;} | ||||
|   char tip_ana() { return _tip_ana;} | ||||
|   const char* cod_ana() const { return _cod_ana;} | ||||
|   char tip_ana() const { return _tip_ana;} | ||||
|   virtual bool force_cursor_usage() const { return TRUE;} | ||||
|   void set_reset_uff_conc(bool reset) { _reset_uff_conc = reset; } | ||||
|   void set_reset_codreg(bool reset) { _reset_codreg = reset; } | ||||
| @ -96,7 +99,31 @@ bool TPersone_app::ba4200_handler(TMask& m, KEY k) | ||||
|   return FALSE; | ||||
| } | ||||
| 
 | ||||
| void  TPersone_app::init_query_mode(TMask& m) | ||||
| bool TPersone_app::fax_handler(TMask_field& f, KEY k) | ||||
| {            | ||||
|   bool ok = TRUE; | ||||
|   if (k == K_SPACE) | ||||
|   {  | ||||
|     TConfig ini(CONFIG_USER, "Link"); | ||||
|     TFilename editor = ini.get("Editor", NULL, -1, "notepad"); | ||||
|     TExternal_app app(editor); | ||||
|     ok = app.run(TRUE, FALSE) == 0; | ||||
|     if (ok) | ||||
|     { | ||||
|       const TPersone_app& app = (const TPersone_app&)main_app(); | ||||
|       const char* tipo = app.tip_ana() == 'F' ? "Fisiche" : "Giuridiche"; | ||||
|       const char* codice = app.cod_ana(); | ||||
| 
 | ||||
|       TDDE dde; | ||||
|       TString cmd(80);                                                              | ||||
|       cmd << "[SetRecipient(" << tipo << ',' << codice << ")]"; | ||||
|       ok = dde.execute("EASYFAX", "FAX", cmd, "bafax"); | ||||
|     }   | ||||
|   } | ||||
|   return ok; | ||||
| } | ||||
| 
 | ||||
| void TPersone_app::init_query_mode(TMask& m) | ||||
| 
 | ||||
| { | ||||
|   m.disable(DLG_DITTE); | ||||
| @ -496,6 +523,8 @@ TMask* TPersone_app::get_mask(int mode) | ||||
|     _msk[MSKF]->set_handler(F_UFFCONC, uff_conc); | ||||
|     _msk[MSKF]->set_handler(F_CODREG96, cod_reg); | ||||
|     _msk[MSKF]->set_handler(F_TITCF, tit_cf); | ||||
|     _msk[MSKF]->set_handler(DLG_FAX, fax_handler); | ||||
| 
 | ||||
|     _msk[MSKF]->set_handler(ba4200_handler); | ||||
|   } | ||||
|   else | ||||
| @ -509,8 +538,11 @@ TMask* TPersone_app::get_mask(int mode) | ||||
|       _msk[MSKG]->set_handler(FLD_AG1_PAIV, no_dup_iva_g); | ||||
|       _msk[MSKG]->set_handler(F_UFFCONC, uff_conc); | ||||
|       _msk[MSKG]->set_handler(F_TITCF, tit_cf); | ||||
|       _msk[MSKG]->set_handler(DLG_FAX, fax_handler); | ||||
| 
 | ||||
|       _msk[MSKG]->set_handler(ba4200_handler); | ||||
|     } | ||||
|      | ||||
|   return _msk[tip_msk()]; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -253,6 +253,12 @@ PROMPT 56 16 "Utente " | ||||
| FLAGS "D" | ||||
| END | ||||
| 
 | ||||
| BUTTON DLG_FAX 10 2 | ||||
| BEGIN | ||||
|   PROMPT -11 -1 "Fax" | ||||
|   PICTURE BMP_FAX | ||||
| END | ||||
| 
 | ||||
| ENDPAGE | ||||
| 
 | ||||
| PAGE "Pag.2" -1 -1 77 20 | ||||
|  | ||||
| @ -182,6 +182,12 @@ BEGIN | ||||
|   FLAGS "DA" | ||||
| END | ||||
| 
 | ||||
| BUTTON DLG_FAX 10 2 | ||||
| BEGIN | ||||
|   PROMPT -11 -1 "Fax" | ||||
|   PICTURE BMP_FAX | ||||
| END | ||||
| 
 | ||||
| ENDPAGE | ||||
| 
 | ||||
| PAGE "Pag.2" -1 -1 77 20 | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| #include <defmask.h> | ||||
| #include <execp.h> | ||||
| #include <files.h> | ||||
| #include <golem.h> | ||||
| #include <mailbox.h> | ||||
| #include <prefix.h> | ||||
| #include <relapp.h> | ||||
| @ -70,6 +71,8 @@ protected: | ||||
|   virtual bool protected_record(TRectype& rec) { return prefix().exist(rec.get_long("CODDITTA")); } | ||||
|   void set_att_prev(const TMask& m); | ||||
| 
 | ||||
|   static bool fax_handler(TMask_field& f, KEY k); | ||||
| 
 | ||||
| public: | ||||
|   TDitte_application(); | ||||
|   virtual TRelation* get_relation() const { return _rel;} | ||||
| @ -159,11 +162,36 @@ bool ba4300_handler(TMask& m, KEY k) | ||||
| TDitte_application::TDitte_application() | ||||
| {} | ||||
| 
 | ||||
| bool TDitte_application::fax_handler(TMask_field& f, KEY k) | ||||
| {            | ||||
|   bool ok = TRUE; | ||||
|   if (k == K_SPACE) | ||||
|   {  | ||||
|     TConfig ini(CONFIG_USER, "Link"); | ||||
|     TFilename editor = ini.get("Editor", NULL, -1, "notepad"); | ||||
|     TExternal_app app(editor); | ||||
|     ok = app.run(TRUE, FALSE) == 0; | ||||
|     if (ok) | ||||
|     { | ||||
|       const TDitte_application& app = (const TDitte_application&)main_app(); | ||||
|       const char* tipo = "Ditte"; | ||||
|       const char* codice = f.mask().get(FLD_GD1_CODDITTA); | ||||
| 
 | ||||
|       TDDE dde; | ||||
|       TString cmd(80); | ||||
|       cmd << "[SetRecipient(" << tipo << ',' << codice << ")]"; | ||||
|       ok = dde.execute("EASYFAX", "FAX", cmd, "bafax"); | ||||
|     }   | ||||
|   } | ||||
|   return ok; | ||||
| } | ||||
| 
 | ||||
| bool TDitte_application::user_create() // initvar e arrmask
 | ||||
| { | ||||
|   _msk = new TMask("ba4300a") ; | ||||
|   _msk->set_handler(DLG_FAX, fax_handler); | ||||
|   _msk->set_handler(ba4300_handler); | ||||
| 
 | ||||
|   _rel = new TRelation(LF_NDITTE); | ||||
|   _anag = new TLocalisamfile(LF_ANAG); | ||||
|   _unloc = new TLocalisamfile(LF_UNLOC); | ||||
| @ -237,12 +265,12 @@ void TDitte_application::set_att_prev(const TMask& m) | ||||
|   if (itwas) | ||||
|   { | ||||
|     if (_attiv->rewrite() != NOERR) | ||||
|       error_box("Non posso aggiornare l'attivita' prevalente : errore n. %d", _attiv->status()); | ||||
|       error_box("Impossibile aggiornare l'attivita' prevalente : errore n. %d", _attiv->status()); | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|     if (_attiv->write() != NOERR) | ||||
|       error_box("Non posso creare l'attivita' prevalente : errore n. %d", _attiv->status()); | ||||
|       error_box("Impossibile creare l'attivita' prevalente : errore n. %d", _attiv->status()); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -223,6 +223,12 @@ BEGIN | ||||
|   HELP "Numero telefonico del fax della ditta" | ||||
| END     | ||||
| 
 | ||||
| BUTTON DLG_FAX 10 2 | ||||
| BEGIN | ||||
|   PROMPT -11 -1 "Fax" | ||||
|   PICTURE BMP_FAX | ||||
| END | ||||
| 
 | ||||
| ENDPAGE | ||||
| 
 | ||||
| PAGE "Pag. 2" -1 -1 77 18 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user