wgraph.c

Go to the documentation of this file.
00001 #include "wgraph.h"
00002 #include "resource.h"
00003 #include "Events.h"
00004 
00005 #include "Messages.h"
00006 #include "Warnings.h"
00007 #include "Errors.h"
00008 #include "WindowList.h"
00009 #include "periScreen.h"
00010 #include "Actions.h"
00011 #include "periScreen.h"
00012 
00013 #include "win_mem_alloc.h" /* MALLOC */
00014 /*-----------------------------------------------------------------------------------*/
00015 extern HINSTANCE hdllInstance;
00016 extern TW textwin;
00017 extern GW graphwin;
00018 extern void sci_pixmapclear(HDC hdc_c, struct BCG *ScilabGC );
00019 extern void sci_pixmapclear_rect(HDC hdc_c, struct BCG *ScilabGC,int w,int h); 
00020 extern void sci_pixmap_resize(struct BCG * ScilabGC, int x, int y) ;
00021 extern void   set_no_delete_win_mode() ;
00022 extern void DebugGW (char *fmt,...);
00023 extern void DebugGW1 (char *fmt,...);
00024 extern int check_pointer_win __PARAMS ((int *x1,int *y1,int *win));
00025 extern void delete_sgwin_entities(int win_num);
00026 extern int C2F(cluni0) __PARAMS((char *name, char *nams, integer *ln, long int name_len,long int nams_len));  
00027 extern EXPORT LRESULT CALLBACK WndGraphProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
00028 extern EXPORT LRESULT CALLBACK WndParentGraphProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
00029 extern void ExportBMP(struct BCG *ScilabGC,char *pszflname);
00030 extern void Setscig_buzyState(BOOL state);
00031 extern Scig_deletegwin_handler scig_deletegwin_handler;
00032 extern Scig_deletegwin_handler set_scig_deletegwin_handler(Scig_deletegwin_handler f);
00033 /*-----------------------------------------------------------------------------------*/
00034 static void sci_extra_margin(HDC hdc , struct BCG *ScilabGC);
00035 /*-----------------------------------------------------------------------------------*/
00036 int C2F (deletewin) (integer * number)
00037 {
00038   double dv=0;
00039   int v=0;
00040   int num = *number;
00041 
00042   /* destroying recorded graphic commands */
00043   scig_erase (num);
00044   /* delete the windows and resources */
00045   DeleteObjs(num);
00046   scig_deletegwin_handler (num);
00047   DeleteSGWin (num); /* Here we 1) destroy the ScilabXgc (set to NULL) if it is the last window in the list */
00048                         /*         2) or reset the ScilabXgc to the next one see DeleteSGWin*/
00049 
00050   
00051   /* So, we use another flag named v_flag :*/
00052   delete_sgwin_entities(num);
00053   return (0);
00054 }
00055 /*-----------------------------------------------------------------------------------*/
00056 /****************************************************
00057  * Debug Function 
00058  ****************************************************/
00059 extern void DebugGW (char *fmt,...)
00060 {
00061 #ifdef DEBUG
00062   int count;
00063   char buf[MAXPRINTF];
00064   va_list args;
00065   va_start (args, fmt);
00066   count = vsprintf (buf, fmt, args);
00067   MessageBox (textwin.hWndParent, (LPSTR) buf,
00068               textwin.Title, MB_ICONEXCLAMATION);
00069   va_end (args);
00070 #endif
00071 }
00072 /*-----------------------------------------------------------------------------------*/
00073 extern void DebugGW1 (char *fmt,...)
00074 {
00075   int  count;
00076   char buf[MAXPRINTF];
00077   va_list args;
00078   va_start (args, fmt);
00079   count = vsprintf (buf, fmt, args);
00080   MessageBox (textwin.hWndParent, (LPSTR) buf,
00081               textwin.Title, MB_ICONEXCLAMATION);
00082   va_end (args);
00083 }
00084 /*-----------------------------------------------------------------------------------*/
00099 void SciViewportMove (struct BCG *ScilabGC,int x, int y)
00100 {
00101   SCROLLINFO vertsi;
00102   SCROLLINFO horzsi;
00103 
00104   if (ScilabGC != NULL)
00105     {
00106       sciGetScrollInfo (ScilabGC, SB_VERT, &vertsi);
00107       sciGetScrollInfo (ScilabGC, SB_HORZ, &horzsi);
00108       /* MAJ D.ABDEMOUCHE*/
00109       if (ScilabGC->CurResizeStatus == 0)
00110         {
00111           horzsi.nPos = max (horzsi.nMin, min (horzsi.nMax, x));
00112           sciSetScrollInfo (ScilabGC, SB_HORZ, &horzsi, TRUE);
00113           vertsi.nPos = min (vertsi.nMax, max (vertsi.nMin, y));
00114           sciSetScrollInfo (ScilabGC, SB_VERT, &vertsi, TRUE);
00115           InvalidateRect (ScilabGC->CWindow, (LPRECT) NULL, FALSE);
00116         }
00117     }
00118 }
00119 /*-----------------------------------------------------------------------------------*/
00133 void SciViewportGet (struct BCG *ScilabXgc,int *x,int *y)
00134 {
00135   if (ScilabXgc != NULL)
00136     {
00137       *x = ScilabXgc->horzsi.nPos;
00138       *y = ScilabXgc->vertsi.nPos;
00139     }
00140   else
00141     {
00142       *x = 0;
00143       *y = 0;
00144     }
00145 }
00146 /*-----------------------------------------------------------------------------------*/
00154 void GPopupResize (struct BCG * ScilabXgc,int * width,int * height)
00155 {
00156   RECT rect, rect1;
00157   int xof, yof;
00158   SCROLLINFO vertsi;
00159   SCROLLINFO horzsi;
00160   int *x = width; /* F.Leray 01.07.04 copy the setwindowdim function philosohpy (see periwin.c)*/
00161   int *y = height;
00162 
00163  if ( (ScilabXgc->CWindow != NULL) && (ScilabXgc->hWndParent != NULL) )
00164   {
00165     /* initialisation des variables SCROLLINFO*/
00166     sciGetScrollInfo(ScilabXgc, SB_VERT, &vertsi);
00167     sciGetScrollInfo(ScilabXgc, SB_HORZ, &horzsi);
00168     
00169     ScilabXgc->CWindowWidth = Max((int) *x,50);
00170     ScilabXgc->CWindowHeight =Max((int) *y,50);
00171     if ( sciGetwresize() == 1 ) {
00172       ScilabXgc->CWindowWidthView  = ScilabXgc->CWindowWidth;
00173       ScilabXgc->CWindowHeightView = ScilabXgc->CWindowHeight;
00174       vertsi.nPos   = 0;
00175       horzsi.nPos   = 0;
00176     }
00177 
00178     if ( ScilabXgc->CWindowWidthView > ScilabXgc->CWindowWidth)
00179       ScilabXgc->CWindowWidthView = ScilabXgc->CWindowWidth;
00180 
00181     if (ScilabXgc->CWindowHeightView > ScilabXgc->CWindowHeight)
00182       ScilabXgc->CWindowHeightView = ScilabXgc->CWindowHeight;
00183     CPixmapResize1();
00184 
00185     GetWindowRect (ScilabXgc->hWndParent, &rect) ;
00186     GetWindowRect (ScilabXgc->CWindow, &rect1) ;
00187     xof = (rect.right-rect.left)- (rect1.right - rect1.left);
00188     yof = (rect.bottom-rect.top)- (rect1.bottom -rect1.top );
00189     if (sciGetwresize () == 0)
00190       {
00191         SetWindowPos (ScilabXgc->hWndParent, HWND_TOP, 0, 0,
00192                       ScilabXgc->CWindowWidthView + xof +
00193                       GetSystemMetrics (SM_CXVSCROLL),
00194                       ScilabXgc->CWindowHeightView + yof +
00195                       GetSystemMetrics (SM_CYHSCROLL),
00196                       SWP_NOMOVE | SWP_NOZORDER);
00197       }
00198     else
00199       {
00200         SetWindowPos(ScilabXgc->hWndParent,HWND_TOP,0,0,
00201                      ScilabXgc->CWindowWidthView  + xof,
00202                      ScilabXgc->CWindowHeightView + yof,
00203                      SWP_NOMOVE | SWP_NOZORDER );
00204       }
00205     vertsi.nMax   = ScilabXgc->CWindowHeight;
00206     vertsi.nPage  = ScilabXgc->CWindowHeightView;
00207     horzsi.nMax   = ScilabXgc->CWindowWidth;
00208     horzsi.nPage  = ScilabXgc->CWindowWidthView;  
00209     sciSetScrollInfo(ScilabXgc,SB_VERT, &(vertsi), TRUE);
00210     sciSetScrollInfo(ScilabXgc,SB_HORZ, &(horzsi), TRUE);
00211     if ( sciGetwresize() == 0 ) 
00212       {
00213         /* need to force a rdraw in that case */
00214         if ( ScilabXgc->horzsi.nPos + ScilabXgc->CWindowWidthView < 
00215              ScilabXgc->CWindowWidth 
00216              &&  ScilabXgc->vertsi.nPos + ScilabXgc->CWindowHeightView < 
00217              ScilabXgc->CWindowHeight) 
00218           InvalidateRect(ScilabXgc->CWindow,NULL,FALSE);
00219           }
00220   }
00221  
00222 }
00223 /*-----------------------------------------------------------------------------------*/
00224 /****************************************************
00225  * Drawing graphic window 
00226  ****************************************************/
00227 /* utility for backing store simulation */
00228 /* A améliorer pour que le bitmap ne soit pas plus grand que nécessaire 
00229  * ou au moins qu'il utilise rcpaint comme clipregion. 
00230  */
00231 static void ScilabPaintWithBitmap(HWND hwnd,HDC hdc , struct BCG *ScilabGC)
00232 {
00233   static HDC hdc_compat = NULL; 
00234   static HBITMAP hbmTemp = NULL; 
00235   static int hbm_width=0, hbm_height = 0;
00236   int win_w,win_h;
00237   HBITMAP hbmSave;
00238 
00239   if ( hdc_compat == NULL) 
00240     {
00241       if (( hdc_compat = CreateCompatibleDC (hdc)) == NULL)
00242         {
00243           sciprint(MSG_WARNING17);
00244           return ;
00245         }
00246       SetMapMode(hdc_compat, MM_TEXT);
00247       SetBkMode(hdc_compat,TRANSPARENT);
00248       SetTextAlign(hdc_compat, TA_LEFT|TA_BOTTOM);
00249     } 
00250   /* be sure that a previous clip does not remain */
00251   win_w= Max(ScilabGC->CWindowWidth,ScilabGC->CWindowWidthView);
00252   win_h= Max(ScilabGC->CWindowHeight,ScilabGC->CWindowHeightView);
00253   if ( hbmTemp != NULL ) 
00254     {
00255       if ( hbm_width < win_w || hbm_height < win_h )
00256         {
00257           hbm_width = win_w;
00258           hbm_height = win_h;
00259           hbmTemp =CreateCompatibleBitmap (hdc,hbm_width,hbm_height);
00260         }
00261     }
00262   else
00263     {
00264       hbm_width = win_w;
00265       hbm_height = win_h;
00266       hbmTemp =CreateCompatibleBitmap (hdc,hbm_width,hbm_height);
00267     }
00268   
00269   if (!hbmTemp)
00270     {
00271       sciprint(MSG_WARNING18);
00272       return ; 
00273     }
00274   hbmSave = SelectObject ( hdc_compat, hbmTemp);
00275   if ( hbmSave != NULL) DeleteObject ( hbmSave ); hbmSave = NULL;
00276 
00277   SelectClipRgn(hdc_compat,NULL);
00278   sci_pixmapclear(hdc_compat,ScilabGC); 
00279   scig_replay_hdc('W',ScilabGC->CurWindow,hdc_compat,ScilabGC->CWindowWidth,
00280                   ScilabGC->CWindowHeight,1);
00281   SelectClipRgn(hdc_compat,NULL);
00282   /* painting extra space in gray if necessary */ 
00283   sci_extra_margin(hdc_compat ,ScilabGC);
00284 
00285   /* be sure that there's no active clip set by graphics */ 
00286   if ( ScilabGC->ClipRegionSet == 1 )  SelectClipRgn(hdc,NULL);
00287   /* the grahics */
00288   BitBlt(hdc,ScilabGC->horzsi.nPos,ScilabGC->vertsi.nPos,
00289          ScilabGC->CWindowWidthView, ScilabGC->CWindowHeightView,
00290          hdc_compat,ScilabGC->horzsi.nPos,ScilabGC->vertsi.nPos,
00291          SRCCOPY); 
00292 }
00293 /*-----------------------------------------------------------------------------------*/
00294 static void sci_extra_margin(HDC hdc_c , struct BCG *ScilabGC)
00295 {
00296   if (  ScilabGC->CWindowWidth-ScilabGC->vertsi.nPos < ScilabGC->CWindowWidthView) 
00297     {
00298       RECT rect;
00299       HBRUSH hBrush =  GetStockBrush(GRAY_BRUSH); 
00300       rect.left   = ScilabGC->CWindowWidth;
00301       rect.top    = ScilabGC->vertsi.nPos ;
00302       rect.right  = ScilabGC->horzsi.nPos + ScilabGC->CWindowWidthView;
00303       rect.bottom = ScilabGC->vertsi.nPos + ScilabGC->CWindowHeightView;
00304       FillRect( hdc_c , &rect,hBrush );
00305     }
00306   if (  ScilabGC->CWindowHeight-ScilabGC->vertsi.nPos < ScilabGC->CWindowHeightView) 
00307     {
00308       RECT rect;
00309       HBRUSH hBrush =  GetStockBrush(GRAY_BRUSH); 
00310       rect.left   = ScilabGC->horzsi.nPos ;
00311       rect.top    = ScilabGC->CWindowHeight;
00312       rect.right  = ScilabGC->horzsi.nPos + ScilabGC->CWindowWidthView;
00313       rect.bottom = ScilabGC->vertsi.nPos + ScilabGC->CWindowHeightView;
00314       FillRect( hdc_c , &rect,hBrush );
00315     }
00316 }
00317 /*-----------------------------------------------------------------------------------*/
00318 /* the paint function */
00319 void ScilabPaint (HWND hwnd, struct BCG *ScilabGC)
00320 {
00321   /* static paint = 0; */
00322   HDC hdc;
00323   PAINTSTRUCT ps;
00324   
00325   Setscig_buzyState(TRUE);
00326         hdc = BeginPaint(hwnd, &ps);  
00327   
00328   if (ScilabGC->Inside_init == 1) goto paint_end;
00329   
00330   if ( ScilabGC->in_sizemove == 1) goto paint_end;
00331 
00332   SetMapMode (hdc, MM_TEXT);
00333   SetBkMode (hdc, TRANSPARENT);
00334   /* GetClientRect (hwnd, &rect);
00335    * SetViewportExtEx(hdc, rect.right, rect.bottom,NULL);*/
00336   SetViewportExtEx(hdc, ScilabGC->CWindowWidthView,ScilabGC->CWindowHeightView, NULL);
00337   /* MAJ D.ABDEMOUCHE*/
00338   if (ScilabGC->CurResizeStatus == 0)
00339     {
00340       /* xViewport = xWindow  + xViewOrg 
00341        * the viewport = [ScilabGC->horzsi.nPos,ScilabGC->vertsi.nPos,
00342        *                 ScilabGC->CWindowWidthView,ScilabGC->CWindowHeightView]
00343        */
00344       SetViewportOrgEx (hdc, -ScilabGC->horzsi.nPos,-ScilabGC->vertsi.nPos, NULL);
00345     }
00346   if (  ScilabGC->CurPixmapStatus == 1 )
00347     {
00348       /* pixmap status is on we use it for redrawing */ 
00349       if (ScilabGC->CurResizeStatus == 1)/* MAJ D.ABDEMOUCHE*/
00350         {
00351           SelectClipRgn(ScilabGC->hdcCompat,NULL);
00352           scig_replay_hdc('W',ScilabGC->CurWindow,ScilabGC->hdcCompat,
00353                           ScilabGC->CWindowWidth, ScilabGC->CWindowHeight,
00354                           1);
00355         }
00356       /* be sure that there's no active clip set by graphics */ 
00357       if ( ScilabGC->ClipRegionSet == 1 ) SelectClipRgn(hdc,NULL);
00358       BitBlt(hdc,ScilabGC->horzsi.nPos,ScilabGC->vertsi.nPos,
00359              ScilabGC->CWindowWidthView,ScilabGC->CWindowHeightView,
00360              ScilabGC->hdcCompat,ScilabGC->horzsi.nPos,ScilabGC->vertsi.nPos,
00361              SRCCOPY); 
00362       sci_extra_margin(hdc, ScilabGC);
00363     }
00364   else 
00365     {
00366       /* no backing store thus we must redraw */
00367       if (  emulate_backing_store == 1 ) 
00368         {
00369           ScilabPaintWithBitmap (hwnd,hdc,ScilabGC);
00370         }
00371       else 
00372         {
00373           if ( ScilabGC->ClipRegionSet == 1 )  SelectClipRgn(hdc,NULL);
00374           scig_replay_hdc('W',ScilabGC->CurWindow,hdc,
00375                           ScilabGC->CWindowWidth, ScilabGC->CWindowHeight,
00376                           1);
00377           if ( ScilabGC->ClipRegionSet == 1 )  SelectClipRgn(hdc,NULL);
00378           /* painting extra space in gray if necessary */ 
00379           sci_extra_margin(hdc ,ScilabGC);
00380         }
00381     }
00382   paint_end : 
00383     {
00384       EndPaint(hwnd, &ps);
00385       Setscig_buzyState(FALSE);
00386     }
00387 }
00388 /*-----------------------------------------------------------------------------------*/
00389 static void ScilabNoPaint (HWND hwnd, struct BCG *ScilabGC)
00390 {
00391   HDC hdc;
00392   PAINTSTRUCT ps;
00393   hdc = BeginPaint(hwnd, &ps);  
00394   EndPaint(hwnd, &ps);
00395 }
00396 /*-----------------------------------------------------------------------------------*/
00397 /****************************************************
00398  * Resize 
00399  ****************************************************/
00400 int ScilabGResize (HWND hwnd, struct BCG *ScilabGC, WPARAM wParam)
00401 {
00403   if ( ScilabGC->Inside_init != 1
00404       && ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED)))
00405     {
00406       HBITMAP hbmTemp;
00407       HBITMAP  hbmSave;
00408       HDC hdc1;
00409       hdc1 = TryToGetDC (ScilabGC->CWindow);
00410       hbmTemp = CreateCompatibleBitmap (hdc1,ScilabGC->CWindowWidth,
00411                                         ScilabGC->CWindowHeight);
00412           ReleaseDC(ScilabGC->CWindow,hdc1);
00413       if (hbmTemp == NULL )
00414         {
00415           sciprint(MSG_WARNING19);
00416           return FALSE;
00417         }
00418       hbmSave = SelectObject ( ScilabGC->hdcCompat, hbmTemp);
00419       if ( ScilabGC->hbmCompat != NULL)
00420         DeleteObject (ScilabGC->hbmCompat);
00421       ScilabGC->hbmCompat = hbmTemp;
00422       if ( ScilabGC->ClipRegionSet == 1 )  SelectClipRgn(ScilabGC->hdcCompat,NULL);
00423       sci_pixmapclear(ScilabGC->hdcCompat,ScilabGC); 
00424       
00425       return TRUE;
00426     }
00427   return FALSE;
00428 }
00429 /*-----------------------------------------------------------------------------------*/
00430 /********************************************************
00431  * A special Replay for win95 
00432  * we want to replay with a specific hdc 
00433  * and reset the hdc to its current value when leaving 
00434  * we must also protect the alufunction current value 
00435  *  ( for application like gr_menu or scicos : where 
00436  *    a redraw can occurs while we are using a alufunction 
00437  *    in a graphic mode without xtape )
00438  ********************************************************/
00439 void scig_replay_hdc (char c, integer win_num, HDC hdc, int width,int height,  int scale)
00440 {
00441   integer verb = 0, cur, na;
00442   char name[4];
00443   integer alu, narg, verbose = 0;
00444   GetDriver1 (name, PI0, PI0, PI0, PI0, PI0, PI0, PD0, PD0, PD0, PD0);
00446   C2F (SetDriver) ("Int", PI0, PI0, PI0, PI0, PI0, PI0, PD0, PD0, PD0, PD0);
00447   C2F (dr) ("xget", "window", &verb, &cur, &na, PI0, PI0, PI0, PD0, 
00448             PD0, PD0, PD0, 0L, 0L);
00449   C2F (dr) ("xset", "window", &win_num, PI0, PI0, PI0, PI0, PI0, PD0, 
00450             PD0, PD0, PD0, 0L, 0L);
00451   C2F (dr) ("xget", "alufunction", &verbose, &alu, &narg, PI0, PI0, 
00452             PI0, PD0, PD0, PD0, PD0, 0L, 0L);
00453   SetGHdc (hdc, width, height);
00455   if (c == 'P')
00456     SciG_Font_Printer (scale);
00458   ResetScilabXgc ();
00460   if (sciGetPixmapStatus() != 1)
00461     C2F (dr) ("xclear", "v", PI0, PI0, PI0, PI0, PI0, PI0, PD0, PD0, PD0, 
00462               PD0, 0L, 0L);
00463 
00464   sciRedrawF(&win_num); /* NG */
00465   C2F (dr1) ("xset", "alufunction", &alu, PI0, PI0, PI0, PI0, PI0, PD0, 
00466              PD0, PD0, PD0, 0L, 0L);
00467   C2F (dr) ("xset", "window", &cur, PI0, PI0, PI0, PI0, PI0, PD0, PD0, 
00468             PD0, PD0, 0L, 0L);
00469   C2F (SetDriver) (name, PI0, PI0, PI0, PI0, PI0, PI0, PD0, PD0, PD0, 
00470                    PD0);
00471   SetGHdc ((HDC) 0, 600, 400);
00473   SciG_Font ();
00474   SwitchWindow (&cur);
00475 }
00476 /*-----------------------------------------------------------------------------------*/
00477 /* A.C Aout 2004 */
00478 int GetScreenProperty(char *prop, char *value)
00479 {
00480   POINT Ecran = {GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)} ;
00481   HDC hdc=GetDC(NULL);
00482   if(!strcmp(prop,"screensize_px"))
00483     {
00484       sprintf(value,"%f|%f|%f|%f",(float)1,(float)1,
00485               (float)Ecran.x,
00486               (float)Ecran.y);
00487     }
00488   else if(!strcmp(prop,"screensize_mm"))
00489     {
00490       sprintf(value,"%f|%f|%f|%f",(float)0,(float)0,
00491               (float)GetDeviceCaps(hdc,HORZSIZE),
00492               (float)GetDeviceCaps(hdc,VERTSIZE));
00493     }
00494   else if(!strcmp(prop,"screensize_cm"))
00495     {
00496       sprintf(value,"%f|%f|%f|%f",(float)0,(float)0,
00497               (float)GetDeviceCaps(hdc,HORZSIZE)/10,
00498               (float)GetDeviceCaps(hdc,VERTSIZE)/10);
00499     }
00500   else if(!strcmp(prop,"screensize_in"))
00501     {
00502       sprintf(value,"%f|%f|%f|%f",(float)0,(float)0,
00503                                                                   (float)GetDeviceCaps(hdc,HORZSIZE)/25.4,
00504                                                                   (float)GetDeviceCaps(hdc,VERTSIZE)/25.4);
00505     }
00506   else if(!strcmp(prop,"screensize_pt"))
00507     {
00508       sprintf(value,"%f|%f|%f|%f",(float)0,(float)0,
00509                                                                   (float)GetDeviceCaps(hdc,HORZSIZE)/25.4*72,
00510                                                                   (float)GetDeviceCaps(hdc,VERTSIZE)/25.4*72);
00511     }
00512   else if(!strcmp(prop,"screensize_norm"))
00513     {
00514       sprintf(value,"%f|%f|%f|%f",(float)0,(float)0,(float)1,(float)1);
00515     }
00516   else if(!strcmp(prop,"screendepth"))
00517     {
00518       sprintf(value,"%f",(float)GetDeviceCaps(hdc,BITSPIXEL));
00519     }
00520   else
00521     {
00522       return -1;
00523     }
00524   ReleaseDC (NULL, hdc);
00525   return 0;
00526 }
00527 
00528 
00529 /*-----------------------------------------------------------------------------------*/
00530 /* Scilab get the DPI (root properties) */
00531 /* F.Leray 08.03.05 */
00532 /* return the x/y DPI */
00533 int GetScreenDPI(int *ixres, int *iyres)
00534 {
00535   POINT Ecran = {GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)} ;
00536   HDC hdc=GetDC(NULL);
00537 
00538   *ixres = GetDeviceCaps(hdc, LOGPIXELSX);
00539   *iyres = GetDeviceCaps(hdc, LOGPIXELSY);
00540   
00541   ReleaseDC (NULL, hdc);
00542   return 0;
00543 }
00544 
00545 /*-----------------------------------------------------------------------------------*/
00546 integer GetCurrentFigureWindows(void)
00547 {
00548         integer verb = 0;
00549         integer CurrentWindow=0;
00550         integer na=0;
00551         /* Backup Current Figure */
00552         C2F (dr) ("xget", "window", &verb, &CurrentWindow, &na, PI0, PI0, PI0, PD0, PD0, PD0, PD0, 0L, 0L);
00553         return CurrentWindow;
00554 }
00555 /*-----------------------------------------------------------------------------------*/
00556 void SetCurrentFigureWindows(integer win)
00557 {
00558         scig_sel (win);
00559 }
00560 /*-----------------------------------------------------------------------------------*/

Generated on Sun Mar 4 15:03:54 2007 for Scilab [trunk] by  doxygen 1.5.1