Patch level : 10.0
Files correlati : or1.exe Ricompilazione Demo : [ ] Commento : Corretta TCursor::set_region(...) che interpretava male il simbolo ~ git-svn-id: svn://10.65.10.50/trunk@19654 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									69427f6b17
								
							
						
					
					
						commit
						4350d942ca
					
				| @ -19,6 +19,7 @@ class TAdvanced_property_sheet : public TMask | ||||
| 
 | ||||
| protected: | ||||
|   virtual long handler(WINDOW win, EVENT* e); | ||||
|   void edit(); | ||||
|   void esporta(); | ||||
| 
 | ||||
| public: | ||||
| @ -26,6 +27,7 @@ public: | ||||
|   void add_cat(const char* prompt); | ||||
|   void add_prop(const char* prompt, const char* value); | ||||
|   void add_prop(const char* prompt, long value); | ||||
|   bool curr_prop(TString& prop, TVariant& value); | ||||
| 
 | ||||
|   void set_read_only(bool ro = true); | ||||
| 	TAdvanced_property_sheet(const char* title = "", int width = 78, int height = 20); | ||||
| @ -44,6 +46,7 @@ long TAdvanced_property_sheet::handler(WINDOW win, EVENT* e) | ||||
|     case E_CONTROL: | ||||
|       switch(e->v.ctl.id) | ||||
|       { | ||||
|       case DLG_EDIT: edit(); return 0L; | ||||
|       case DLG_EXPORT: esporta(); return 0L; | ||||
|       default: break; | ||||
|       } | ||||
| @ -85,6 +88,28 @@ static BOOLEAN export_cb(WINDOW pg, XVT_TREEVIEW_NODE node, void* jolly) | ||||
|   return TRUE; | ||||
| } | ||||
| 
 | ||||
| void TAdvanced_property_sheet::edit() | ||||
| { | ||||
|   TString name; | ||||
|   TVariant value; | ||||
|   if (_pf->current_property(name, value)) | ||||
|   { | ||||
|     TFilename n = value.as_string(); | ||||
|     if (n.exist()) | ||||
|     { | ||||
| #ifdef WIN32 | ||||
|       if (n.ends_with(".msk"), true) | ||||
|       { | ||||
|         n.insert("notepad "); | ||||
|         xvt_sys_execute(n, FALSE, FALSE); | ||||
|       } | ||||
|       else | ||||
| #endif | ||||
|         xvt_sys_goto_url(n, "open"); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void TAdvanced_property_sheet::esporta() | ||||
| { | ||||
|   TString cap; get_caption(cap); | ||||
| @ -125,6 +150,8 @@ TAdvanced_property_sheet::TAdvanced_property_sheet(const char* title, int width, | ||||
| { | ||||
|   add_button_tool(DLG_CANCEL, TR("Ritorna"), TOOL_CANCEL); | ||||
|   add_button_tool(DLG_EXPORT, TR("Esporta"), TOOL_EXCEL); | ||||
|   if (is_power_reseller(true)) | ||||
|     add_button_tool(DLG_EDIT, TR("Edit"), TOOL_EDIT); | ||||
|   add_button_tool(DLG_HELP, TR("Help"), TOOL_HELP); | ||||
| 
 | ||||
|   _pf = new TProp_field(this); | ||||
|  | ||||
| @ -112,6 +112,71 @@ char TMask_field::TField_Flags::update(const char* f, bool reset) | ||||
|   return *s; | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // TField_property_sheet
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| class TField_property_sheet : public TProperty_sheet  | ||||
| { | ||||
| public: | ||||
|   TField_property_sheet(const TOperable_field& f); | ||||
| }; | ||||
| 
 | ||||
| TField_property_sheet::TField_property_sheet(const TOperable_field& f)  | ||||
|                      : TProperty_sheet(f.prompt(), 60, 10) | ||||
| { | ||||
|   add_cat(TR("Sorgente")); | ||||
|   TFilename fn = f.mask().source_file(); fn.lower(); | ||||
|   add_prop(TR("Maschera"), fn); | ||||
|   add_prop(TR("Personalizzata"), fn.find("custom") > 0 ? "Si" : "No"); | ||||
|   if (f.mask().get_sheet() != NULL) | ||||
|     add_prop(TR("Spreadsheet"), f.mask().get_sheet()->dlg()); | ||||
| 
 | ||||
|   add_cat(TR("Informazioni")); | ||||
|   TString16 id; id << f.dlg(); | ||||
|   // p.add_prop(TR("Tipo"), class_name());  // Per ora ritorna sempre "Field"!
 | ||||
|   add_prop(TR("Identificatore"), id); | ||||
|   add_prop(TR("Lunghezza"), long(f.size())); | ||||
|   if (f.help().full()) | ||||
|     add_prop(TR("Help"), f.help()); | ||||
|   add_prop(TR("Obbligatorio"), f.required() ? TR("Si") : TR("No")); | ||||
| 
 | ||||
|   add_cat(TR("Database")); | ||||
|   id.cut(0); | ||||
|   if (f.field() != NULL) | ||||
|   { | ||||
|     const TIsam_handle f0 = atoi(f.field()->id()); | ||||
|     if (f0 <= 0)  | ||||
|     { | ||||
|       if (main_app().class_id() == CLASS_RELATION_APPLICATION) | ||||
|       { | ||||
|         TRelation_application& ra = (TRelation_application&)main_app(); | ||||
|         id = ra.get_relation()->file(0).name(); | ||||
|       } | ||||
|     } | ||||
|     else | ||||
|       id << f0; | ||||
|     TString80 str; str << *f.field(); | ||||
|     add_prop(TR("Campo"), str); | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|     // add_prop(TR("Campo"), TR("Nessuno")); ???
 | ||||
|     if (class_id() == CLASS_EDIT_FIELD || is_kind_of(CLASS_EDIT_FIELD)) | ||||
|     { | ||||
|       const TEdit_field& ef = (TEdit_field&)f; | ||||
|       const TBrowse* b = ef.browse(); | ||||
|       if (b != NULL && b->cursor() != NULL) | ||||
|         id = b->cursor()->file(0).name(); | ||||
|     } | ||||
|   } | ||||
|   if (id.full()) | ||||
|   { | ||||
|     add_prop(TR("Tabella"), id); | ||||
|     add_prop(TR("Descrizione"), prefix().description(id)); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // TMask_field
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| @ -5327,3 +5392,4 @@ const char* TZoom_field::get_first_line() const | ||||
| { return raw2win(_str); } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -517,6 +517,8 @@ public: | ||||
|    | ||||
|   // @cmember Abilita/disabilita il campo (lo rende scrivibile) (vedi <mf TMask_field::enable>)
 | ||||
|   virtual void enable(bool on = true); | ||||
| 
 | ||||
|   const TString& help() const { return _help ? *_help : (const TString&)EMPTY_STRING; } | ||||
|    | ||||
|   TOperable_field(TMask* m); | ||||
|   virtual ~TOperable_field(); | ||||
|  | ||||
| @ -5,10 +5,6 @@ | ||||
| #include <window.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifndef __ARRAY_H | ||||
| #include <array.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifndef __TEXT_H | ||||
| #include <text.h> | ||||
| #endif | ||||
|  | ||||
| @ -1358,24 +1358,28 @@ HIDDEN void matildator(const TRectype& oldrec, int key, bool tilde, TString& str | ||||
|     const RecDes& recd = oldrec.rec_des(); // Descrizione del record della testata
 | ||||
|     const KeyDes& kd = recd.Ky[key-1];     // Elenco dei campi della chiave
 | ||||
|     const int len = str.len(); | ||||
| 		const int nfields = kd.NkFields; | ||||
| 		const int kfields = kd.NkFields; | ||||
| 		int foc = 0; | ||||
|     for (int i = 0; i < nfields; i++) | ||||
|     for (int k = 0; k < kfields; k++) | ||||
|     {  | ||||
|       const int nf = kd.FieldSeq[i] % MaxFields; | ||||
|       const int nf = kd.FieldSeq[k] % MaxFields; | ||||
|       const RecFieldDes& rf = recd.Fd[nf];   | ||||
| 			const int toc = foc + kd.FromCh[i] == 255 ? rf.Len : (kd.ToCh[i] - kd.FromCh[i] + 1); | ||||
| 
 | ||||
| 			int toc = foc; | ||||
|       if (kd.FromCh[k] == 255) // Non e' stato specificato un range
 | ||||
|         toc += rf.Len;         // Considero l'intera lunghezza del campo 
 | ||||
|       else | ||||
|         toc += kd.ToCh[k] - kd.FromCh[k] + 1; | ||||
|       CHECK(toc > foc, "Invalid addition"); | ||||
| 			if (toc >= len) | ||||
|       { | ||||
|         if (str[foc] > ' ' && rf.TypeF == _alfafld) | ||||
|           str.left_just(toc, ' '); | ||||
|         break; | ||||
|       }  | ||||
| 			foc = toc + 1; | ||||
| 			foc = toc; | ||||
|     } | ||||
|   } | ||||
|   str.replace('~', ' '); // non togliere posson arivare record con gia' le tildi
 | ||||
|   str.replace('~', ' '); | ||||
| } | ||||
| 
 | ||||
| // @doc EXTERNAL
 | ||||
|  | ||||
| @ -946,7 +946,7 @@ bool TBook::open_page() | ||||
|   } | ||||
| 
 | ||||
|   _page++; | ||||
|   _index.add_long(_out->tellp(), page()); // Scrive alla posizione 1 l'inizio di pagina 1
 | ||||
|   _index.add_long((long)_out->tellp(), page()); // Scrive alla posizione 1 l'inizio di pagina 1
 | ||||
|   | ||||
|   *_out << "<page number=" << page() << '>' << endl; | ||||
| 
 | ||||
| @ -1898,7 +1898,7 @@ void TBook::split_file(int colonne) | ||||
|         if (str.starts_with("<page ")) | ||||
|         { | ||||
|           const int p = (page-1)*colonne+1+c; | ||||
|           index.add_long(out.tellp(), p); | ||||
|           index.add_long((long)out.tellp(), p); | ||||
|           str.format("<page number=%d>", p); | ||||
|         } else | ||||
|         if (str.starts_with("<frame ")) | ||||
| @ -1972,7 +1972,7 @@ void TBook::join_file(int pps) | ||||
|       if (sub == 0) | ||||
|       { | ||||
|         out_page = (in_page - 1) / pps + 1; | ||||
|         _index.add_long(out.tellp(), out_page); | ||||
|         _index.add_long((long)out.tellp(), out_page); | ||||
|         str.format("<page number=%d>", out_page); | ||||
|       } | ||||
|       else | ||||
|  | ||||
| @ -73,8 +73,8 @@ void TField_window::update() | ||||
|   {  | ||||
|     const WINDOW pa = parent(); | ||||
|     RCT rct; xvt_vobj_get_outer_rect(me, &rct); | ||||
|     rct.left -= 2; rct.top -= 2; rct.right += 2; rct.bottom += 2; | ||||
|     xi_draw_3d_rect((XinWindow)pa, (XinRect *) &rct, TRUE, 2, | ||||
|     xvt_rect_inflate(&rct, 2, 2); | ||||
|     xi_draw_3d_rect((XinWindow)pa, (XinRect*)&rct, TRUE, 2, | ||||
|                     MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR); | ||||
|   } | ||||
|   xvt_dwin_clear(me, NORMAL_BACK_COLOR); | ||||
| @ -1028,6 +1028,30 @@ COLOR TProp_field::get_color_property(const char* name) const | ||||
|   return col; | ||||
| } | ||||
| 
 | ||||
| bool TProp_field::current_property(TString& name, TVariant& value) const | ||||
| { | ||||
|   name.cut(0); | ||||
|   value.set_null(); | ||||
|    | ||||
|   WINDOW pg = win().win(); | ||||
|   if (pg != NULL_WIN) | ||||
|   { | ||||
|     XVT_TREEVIEW_NODE node = xvt_prop_current(pg); | ||||
|     if (node != NULL) | ||||
|     { | ||||
|       TFilename n; | ||||
|       xvt_prop_get_string(pg, node, n.get_buffer(), n.size()); | ||||
|       name = n; | ||||
|       xvt_prop_get_data(pg, node, n.get_buffer(), n.size()); | ||||
|       if (real::is_natural(n)) | ||||
|         value = atol(n); | ||||
|       else | ||||
|         value = n; | ||||
|     } | ||||
|   } | ||||
|   return !value.is_null(); | ||||
| } | ||||
| 
 | ||||
| bool TProp_field::for_each_property(PROP_CALLBACK pcb, void* jolly) | ||||
| { | ||||
|   return xvt_prop_for_each(win().win(), pcb, jolly) != 0; | ||||
|  | ||||
| @ -5,6 +5,10 @@ | ||||
| #include "maskfld.h" | ||||
| #endif | ||||
| 
 | ||||
| #ifndef __VARIANT_H | ||||
| #include "variant.h" | ||||
| #endif | ||||
| 
 | ||||
| // Native control host window: autresizes its unique child control
 | ||||
| class TControl_host_window : public TField_window | ||||
| { | ||||
| @ -144,8 +148,10 @@ public: | ||||
|   const TString& get_property(const char* name) const; | ||||
|   COLOR get_color_property(const char* name) const; | ||||
|   long get_long_property(const char* name) const; | ||||
|   const TVariant& get_var_property(const char* name) const; | ||||
| 
 | ||||
|   bool for_each_property(PROP_CALLBACK pcb, void* jolly); | ||||
|   bool current_property(TString& name, TVariant& value) const; | ||||
| 
 | ||||
|   TProp_field(TMask* m); | ||||
| }; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user