Patch level : 4.0
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Tolte deprecazioni ed aggiunti gradienti git-svn-id: svn://10.65.10.50/trunk@14925 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									a44ba2f2a7
								
							
						
					
					
						commit
						7ad9cab875
					
				
							
								
								
									
										130
									
								
								xvaga/xvaga.cpp
									
									
									
									
									
								
							
							
						
						
									
										130
									
								
								xvaga/xvaga.cpp
									
									
									
									
									
								
							| @ -41,12 +41,12 @@ | ||||
| // Funzione interna di utilita'
 | ||||
| MENU_ITEM* xvt_menu_duplicate_tree(const MENU_ITEM* m); | ||||
| 
 | ||||
| XVT_CONFIG* _config_ = NULL; | ||||
| wxWindow*   _task_win = NULL; | ||||
| wxWindow*   _mouse_trapper = NULL; | ||||
| RCT         _startup_rect = { 0,0,0,0 }; | ||||
| wxString*   _startup_dir = NULL; | ||||
| wxString    _startup_dir; | ||||
| wxString    _strDefaultStatbarText; | ||||
| wxString    _appl_name; | ||||
| 
 | ||||
| static wxHashTable _nice_windows; | ||||
| static wxHashTable _nice_icons; | ||||
| @ -56,6 +56,9 @@ static XVT_ERRMSG_HANDLER _error_handler = NULL; | ||||
| 
 | ||||
| #define XVT_ASSERT(test) assert_box((test), __LINE__, __FILE__ ) | ||||
| 
 | ||||
| const wxString& _GetAppTitle() | ||||
| { return _appl_name; } | ||||
| 
 | ||||
| void assert_box(bool test, int line, const char * file) | ||||
| { | ||||
| 	if (!test) | ||||
| @ -63,9 +66,9 @@ void assert_box(bool test, int line, const char * file) | ||||
| 		bool display = (_error_handler == NULL) || (_error_handler(SEV_FATAL, NULL) == FALSE); | ||||
|     if (display) | ||||
| 		{ | ||||
|     	const wxString strMessage = wxString::Format("Sorry, the application passed some invalid parameters on line %d file %s.", line, file); | ||||
| 			const wxString strCaption = "Emulated XVT Error "; | ||||
|       ::wxMessageBox(strMessage, strCaption, wxOK|wxICON_ERROR); | ||||
|     	wxString strMessage; | ||||
|       strMessage.Printf("Sorry, the application passed some invalid parameters on line %d file %s.", line, file); | ||||
|       ::wxMessageBox(strMessage, _GetAppTitle(), wxOK|wxICON_ERROR); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @ -110,7 +113,7 @@ wxRect NormalizeRCT(const RCT* prct) | ||||
| wxString GetResourceIni() | ||||
| { | ||||
| 	wxString strName; | ||||
|   strName = *_startup_dir; | ||||
|   strName = _startup_dir; | ||||
|   strName += "/res/resource.ini"; | ||||
|   return strName; | ||||
| } | ||||
| @ -125,12 +128,12 @@ wxString GetResourceName(const char* type, int rid) | ||||
| 	wxString val; | ||||
| 	if (ini.Read(wxString::Format("%d", rid), &val)) | ||||
| 	{ | ||||
| 		strName = *_startup_dir; | ||||
| 		strName = _startup_dir; | ||||
| 		strName += "/custom/"; | ||||
| 		strName += val; | ||||
|     if (!wxFileExists(strName)) | ||||
|     { | ||||
|       strName = *_startup_dir; | ||||
|       strName = _startup_dir; | ||||
| 		  strName += "/res/"; | ||||
| 		  strName += val; | ||||
|     } | ||||
| @ -1362,7 +1365,7 @@ void xvt_app_create(int argc, char **argv, unsigned long flags, | ||||
| #endif | ||||
| 
 | ||||
| 	_task_win_handler = eh; | ||||
| 	_config_ = config; | ||||
| 	_appl_name = config->appl_name; | ||||
| 
 | ||||
| 	const wxString title = config->taskwin_title; | ||||
| 
 | ||||
| @ -1450,7 +1453,7 @@ void xvt_app_create(int argc, char **argv, unsigned long flags, | ||||
| 	if (ret != 0) | ||||
|   { | ||||
|     // Simula main loop
 | ||||
| 	xvt_app_process_pending_events(); | ||||
| 	  xvt_app_process_pending_events(); | ||||
|   } | ||||
| 	a->ExitMainLoop(); // Non entrare nel main loop di wxWindows
 | ||||
| } | ||||
| @ -1479,9 +1482,8 @@ void xvt_app_process_pending_events(void) | ||||
| 	if (a != NULL) | ||||
|   { | ||||
|     while (a->Pending()) | ||||
| 	  a->Dispatch(); | ||||
| 
 | ||||
| 	a->Yield(true); | ||||
| 	    a->Dispatch(); | ||||
|   	a->Yield(true); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| @ -1536,14 +1538,12 @@ char* xvt_cb_get_data(CB_FORMAT cbfmt, char *name, long *sizep) | ||||
| 
 | ||||
| BOOLEAN xvt_cb_has_format(CB_FORMAT fmt, char *name) | ||||
| { | ||||
| 	BOOLEAN ok = fmt == CB_TEXT && wxTheClipboard->IsSupported(wxDF_TEXT); | ||||
| 	return ok; | ||||
| 	return (fmt == CB_TEXT) && wxTheClipboard->IsSupported(wxDF_TEXT); | ||||
| } | ||||
| 
 | ||||
| BOOLEAN xvt_cb_open(BOOLEAN writing) | ||||
| { | ||||
| 	wxTheClipboard->Open(); | ||||
| 	return TRUE; | ||||
| 	return wxTheClipboard->Open(); | ||||
| } | ||||
| 
 | ||||
| BOOLEAN xvt_cb_put_data(CB_FORMAT cbfmt, char *name, long size, PICTURE pic) | ||||
| @ -1737,16 +1737,6 @@ BOOLEAN xvt_dongle_sl_write_block(unsigned short reg, unsigned short size, const | ||||
| // Common dialogs
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| wxString _GetAppTitle() | ||||
| { | ||||
|   wxString strTitle; | ||||
|   if (_config_ != NULL) | ||||
|     strTitle = _config_->appl_name; | ||||
|   else | ||||
|     strTitle = "CAMPO"; | ||||
|   return strTitle; | ||||
| } | ||||
| 
 | ||||
| COLOR xvt_dm_post_choose_color(WINDOW win, COLOR xc) | ||||
| { | ||||
|   CAST_COLOR(xc, wc); | ||||
| @ -1772,7 +1762,6 @@ COLOR xvt_dm_post_choose_color(WINDOW win, COLOR xc) | ||||
|   return xc; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| class TwxCalendarDlg : public wxDialog | ||||
| { | ||||
|   enum { ID_CAL = 1883 }; | ||||
| @ -1790,7 +1779,7 @@ public: | ||||
| }; | ||||
| 
 | ||||
| BEGIN_EVENT_TABLE(TwxCalendarDlg, wxDialog) | ||||
|     EVT_CALENDAR(wxID_ANY, TwxCalendarDlg::OnCalendar) | ||||
|   EVT_CALENDAR(wxID_ANY, TwxCalendarDlg::OnCalendar) | ||||
| END_EVENT_TABLE() | ||||
| 
 | ||||
| void TwxCalendarDlg::OnCalendar(wxCalendarEvent& event) | ||||
| @ -1874,7 +1863,7 @@ BOOLEAN xvt_dm_post_speech(const char* text, int priority, BOOLEAN async) | ||||
|   return ok; | ||||
| } | ||||
| 
 | ||||
| ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char*Btn2, const char* Btn3, const char* fmt) | ||||
| ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char* Btn2, const char* Btn3, const char* fmt) | ||||
| { | ||||
|   int nFlags = wxCENTRE | wxICON_QUESTION | wxYES_NO; | ||||
|   if (Btn3 == NULL) | ||||
| @ -1886,12 +1875,11 @@ ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char*Btn2, const char* Btn3 | ||||
|     nFlags |= wxCANCEL; | ||||
| 
 | ||||
|   xvt_dm_post_speech(fmt, 3, TRUE); | ||||
|   const int answer = wxMessageBox(fmt, _GetAppTitle(), nFlags); | ||||
| 
 | ||||
|   const int answer = ::wxMessageBox(fmt, _GetAppTitle(), nFlags); | ||||
|   switch(answer) | ||||
|   { | ||||
|   case wxYES: xvt_dm_post_speech("si", 7, TRUE); break; | ||||
|   case wxNO : xvt_dm_post_speech("no", 7, TRUE); break; | ||||
|   case wxYES: xvt_dm_post_speech("si",      7, TRUE); break; | ||||
|   case wxNO : xvt_dm_post_speech("no",      7, TRUE); break; | ||||
|   default   : xvt_dm_post_speech("annulla", 7, TRUE); break; | ||||
|   } | ||||
| 
 | ||||
| @ -1996,14 +1984,14 @@ BOOLEAN xvt_dm_post_font_sel(WINDOW win, XVT_FNTID font_id, PRINT_RCD *precp, un | ||||
| void xvt_dm_post_message(const char *fmt) | ||||
| { | ||||
|   xvt_dm_post_speech(fmt, 2, TRUE); | ||||
|   wxMessageBox(fmt, _GetAppTitle(), wxOK | wxCENTRE | wxICON_INFORMATION); | ||||
|   ::wxMessageBox(fmt, _GetAppTitle(), wxOK | wxCENTRE | wxICON_INFORMATION); | ||||
|   xvt_dm_post_speech("OK", 7, TRUE); | ||||
| } | ||||
| 
 | ||||
| void xvt_dm_post_note(const char *fmt) | ||||
| { | ||||
|   xvt_dm_post_speech(fmt, 2, TRUE); | ||||
|   wxMessageBox(fmt, _GetAppTitle(), wxOK | wxCENTRE | wxICON_EXCLAMATION); | ||||
|   ::wxMessageBox(fmt, _GetAppTitle(), wxOK | wxCENTRE | wxICON_EXCLAMATION); | ||||
|   xvt_dm_post_speech("OK", 7, TRUE); | ||||
| } | ||||
| 
 | ||||
| @ -2018,7 +2006,7 @@ char* xvt_dm_post_string_prompt(const char* message, char* response, int respons | ||||
| void xvt_dm_post_warning(const char *fmt) | ||||
| { | ||||
|   xvt_dm_post_speech(fmt, 1, TRUE); | ||||
|   wxMessageBox(fmt, _GetAppTitle(), wxOK | wxCENTRE | wxICON_EXCLAMATION); | ||||
|   ::wxMessageBox(fmt, _GetAppTitle(), wxOK | wxCENTRE | wxICON_EXCLAMATION); | ||||
|   xvt_dm_post_speech("OK", 7, TRUE); | ||||
| } | ||||
| 
 | ||||
| @ -2320,6 +2308,47 @@ void xvt_dwin_draw_arc(WINDOW win, const RCT* r, int sx, int sy, int ex, int ey) | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void xvt_dwin_draw_gradient_circular(WINDOW win, const RCT* r, COLOR col1, COLOR col2, const PNT* center) | ||||
| { | ||||
|   if (r != NULL) | ||||
|   { | ||||
|     CAST_DC(win, dc); | ||||
|     const wxRect rect = NormalizeRCT(r); | ||||
|     CAST_COLOR(col1, color1); | ||||
|     CAST_COLOR(col2, color2); | ||||
|     if (center != NULL) | ||||
|       dc.GradientFillConcentric(rect, color1, color2, wxPoint(center->h, center->v)); | ||||
|     else | ||||
|       dc.GradientFillConcentric(rect, color1, color2); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void xvt_dwin_draw_gradient_linear(WINDOW win, const RCT* r, COLOR col1, COLOR col2, int angle) | ||||
| {  | ||||
|   if (r != NULL) | ||||
|   { | ||||
| 	  CAST_DC(win, dc); | ||||
|     const wxRect rect = NormalizeRCT(r); | ||||
|     CAST_COLOR(col1, color1); | ||||
|     CAST_COLOR(col2, color2); | ||||
| 
 | ||||
|     angle %= 360; | ||||
|     if (angle < 0)  | ||||
|       angle += 360; | ||||
|     wxDirection dir = wxDOWN; | ||||
|     switch (angle / 90) | ||||
|     { | ||||
|     case  0: dir = wxRIGHT; break; | ||||
|     case  1: dir = wxUP; break; | ||||
|     case  2: dir = wxLEFT; break; | ||||
|     default: dir = wxDOWN; break; | ||||
|     } | ||||
| 
 | ||||
|     dc.GradientFillLinear(rect, color1, color2, dir); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid) | ||||
| { | ||||
| 	wxIcon* ico = ::GetIconResource(rid); | ||||
| @ -3036,9 +3065,9 @@ BOOLEAN xvt_fsys_convert_str_to_fspec(const char *mbs, FILE_SPEC *fs) | ||||
| 
 | ||||
| void xvt_fsys_get_default_dir(DIRECTORY *dirp) | ||||
| { | ||||
|   if (_startup_dir == NULL) | ||||
|     _startup_dir = new wxString(::wxGetCwd()); | ||||
|   xvt_fsys_convert_str_to_dir(*_startup_dir, dirp); | ||||
|   if (_startup_dir.IsEmpty()) | ||||
|     _startup_dir = ::wxGetCwd(); | ||||
|   xvt_fsys_convert_str_to_dir(_startup_dir, dirp); | ||||
| } | ||||
| 
 | ||||
| BOOLEAN xvt_fsys_get_dir(DIRECTORY *dirp) | ||||
| @ -3355,7 +3384,7 @@ XVT_IMAGE xvt_image_read(const char* filenamep) | ||||
| 	wxString name; | ||||
| 	if (isalpha(filenamep[0u])) | ||||
| 	{ | ||||
| 		name = *_startup_dir; | ||||
| 		name = _startup_dir; | ||||
| 		name += "/"; | ||||
| 	} | ||||
| 	name += filenamep; | ||||
| @ -3733,6 +3762,15 @@ BOOLEAN xvt_rect_set_pos(RCT *rctp, PNT pos) | ||||
| 	return ok; | ||||
| } | ||||
| 
 | ||||
| void xvt_rect_inflate(RCT *rctp, short ix, short iy) | ||||
| { | ||||
|   if (rctp != NULL) | ||||
|   { | ||||
|     rctp->left -= ix; rctp->right += ix; | ||||
|     rctp->top -= iy; rctp->bottom += iy; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // Resource management
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| @ -4741,7 +4779,15 @@ long xvt_vobj_get_attr(WINDOW win, long data) | ||||
| 	case ATTR_WIN_PM_DRAWABLE_TWIN: | ||||
| 		ret = TRUE; | ||||
| 		break; | ||||
| 	default: SORRY_BOX(); break; | ||||
|   case ATTR_ICON_WIDTH: | ||||
|     ret = wxSystemSettings::GetMetric(wxSYS_ICON_X); | ||||
|     break; | ||||
|   case ATTR_ICON_HEIGHT: | ||||
|     ret = wxSystemSettings::GetMetric(wxSYS_ICON_Y); | ||||
|     break; | ||||
| 	default:  | ||||
|     SORRY_BOX();  | ||||
|     break; | ||||
| 	} | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| @ -86,6 +86,6 @@ public: | ||||
| 	virtual ~TPrintDC(); | ||||
| }; | ||||
| 
 | ||||
| wxString _GetAppTitle(); | ||||
| const wxString& _GetAppTitle(); | ||||
| 
 | ||||
| #endif | ||||
|  | ||||
| @ -95,6 +95,8 @@ XVTDLL BOOLEAN xvt_dongle_sl_write_block(unsigned short reg, unsigned short size | ||||
| XVTDLL void          xvt_dwin_clear(WINDOW win, COLOR col); | ||||
| XVTDLL void          xvt_dwin_draw_arc(WINDOW win, const RCT* r, int sx, int sy, int ex, int ey); | ||||
| XVTDLL void          xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid); | ||||
| XVTDLL void          xvt_dwin_draw_gradient_circular(WINDOW win, const RCT* r, COLOR col1, COLOR col2, const PNT* center); // Added by AGA
 | ||||
| XVTDLL void          xvt_dwin_draw_gradient_linear(WINDOW win, const RCT* r, COLOR col1, COLOR col2, int angle); // Added by AGA
 | ||||
| XVTDLL void          xvt_dwin_draw_image_on_pdf(WINDOW win, const char* name, RCT* dest); // Added by AGA
 | ||||
| XVTDLL void          xvt_dwin_draw_image(WINDOW win, XVT_IMAGE image, RCT* dest, RCT* source); | ||||
| XVTDLL void          xvt_dwin_draw_oval(WINDOW Win, const RCT* r); | ||||
| @ -262,6 +264,7 @@ XVTDLL void     xvt_rect_offset(RCT *rctp, short dh, short dv); | ||||
| XVTDLL void     xvt_rect_set(RCT *rctp, short left, short top, short right, short bottom); | ||||
| XVTDLL void     xvt_rect_set_empty(RCT *rctp); | ||||
| XVTDLL BOOLEAN  xvt_rect_set_pos(RCT *rctp, PNT pos); | ||||
| XVTDLL void     xvt_rect_inflate(RCT *rctp, short ix, short iy); | ||||
| 
 | ||||
| XVTDLL void        xvt_res_free_menu_tree(MENU_ITEM* tree); | ||||
| XVTDLL XVT_IMAGE   xvt_res_get_image(int rid); | ||||
|  | ||||
| @ -450,12 +450,11 @@ CB_PICT,	/* encapsulated picture */ | ||||
| CB_APPL	/* app's own (must have name) */ | ||||
| } CB_FORMAT; | ||||
| 
 | ||||
| typedef struct s_xvt_config { | ||||
| 
 | ||||
| short menu_bar_ID;	/* task menubar ResID */ | ||||
| short about_box_ID;	/* default aboutbox ResID */ | ||||
| char *base_appl_name;	/* application's "filename" */ | ||||
| char *appl_name;	/* application's name */ | ||||
| char *taskwin_title;	/* title for task window */ | ||||
| 
 | ||||
| typedef struct s_xvt_config  | ||||
| { | ||||
|   short menu_bar_ID;	        /* task menubar ResID */ | ||||
|   short about_box_ID;	        /* default aboutbox ResID */ | ||||
|   const char* base_appl_name;	/* application's "filename" */ | ||||
|   const char* appl_name;	    /* application's name */ | ||||
|   const char* taskwin_title;	/* title for task window */ | ||||
| } XVT_CONFIG; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user