wgraph.c File Reference

#include "wgraph.h"
#include "resource.h"
#include "Events.h"
#include "Messages.h"
#include "Warnings.h"
#include "Errors.h"
#include "WindowList.h"
#include "periScreen.h"
#include "Actions.h"
#include "win_mem_alloc.h"

Include dependency graph for wgraph.c:

Go to the source code of this file.

Functions

void sci_pixmapclear (HDC hdc_c, struct BCG *ScilabGC)
void sci_pixmapclear_rect (HDC hdc_c, struct BCG *ScilabGC, int w, int h)
void sci_pixmap_resize (struct BCG *ScilabGC, int x, int y)
void set_no_delete_win_mode ()
void DebugGW (char *fmt,...)
void DebugGW1 (char *fmt,...)
int check_pointer_win __PARAMS ((int *x1, int *y1, int *win))
void delete_sgwin_entities (int win_num)
int C2F (cluni0)
void SciViewportMove (struct BCG *ScilabGC, int x, int y)
void SciViewportGet (struct BCG *ScilabXgc, int *x, int *y)
void GPopupResize (struct BCG *ScilabXgc, int *width, int *height)
static void ScilabPaintWithBitmap (HWND hwnd, HDC hdc, struct BCG *ScilabGC)
static void sci_extra_margin (HDC hdc_c, struct BCG *ScilabGC)
void ScilabPaint (HWND hwnd, struct BCG *ScilabGC)
static void ScilabNoPaint (HWND hwnd, struct BCG *ScilabGC)
int ScilabGResize (HWND hwnd, struct BCG *ScilabGC, WPARAM wParam)
void scig_replay_hdc (char c, integer win_num, HDC hdc, int width, int height, int scale)
int GetScreenProperty (char *prop, char *value)
int GetScreenDPI (int *ixres, int *iyres)
integer GetCurrentFigureWindows (void)
void SetCurrentFigureWindows (integer win)

Variables

HINSTANCE hdllInstance
TW textwin
GW graphwin


Function Documentation

int check_pointer_win __PARAMS ( (int *x1, int *y1, int *win)   ) 

int C2F ( cluni0   ) 

Definition at line 26 of file wgraph.c.

References delete_sgwin_entities(), DeleteObjs(), DeleteSGWin(), num, scig_deletegwin_handler, scig_erase(), and v.

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 }

Here is the call graph for this function:

void DebugGW ( char *  fmt,
  ... 
)

void DebugGW1 ( char *  fmt,
  ... 
)

Definition at line 73 of file wgraph.c.

References args, buf, count, tagTW::hWndParent, MAXPRINTF, textwin, and tagTW::Title.

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 }

void delete_sgwin_entities ( int  win_num  ) 

delete_sgwin_entities(int win_num) This function is to be called after window deletion

Definition at line 758 of file DestroyObjects.c.

References C2F, BCG::CurWindow, dr(), tagHandleTab::index, L, NULL, tagHandleTab::pprev, SCI_FIGURE, sciGetEntityType(), sciGetNum(), sciGetpendofhandletab(), sciGetPointerFromHandle(), sciSetCurrentFigure(), sciSetCurrentObj(), and v.

00759 {
00760   double dv=0;
00761   double *XGC;
00762   struct BCG *CurrentScilabXgc; 
00763   int v=0;
00764   /* Need to reset the new current figure returned by sciGetCurrentFigure */
00765   sciHandleTab *hdl = NULL;
00766   sciPointObj  *pobj= NULL;
00767 
00768   C2F(dr)("xget","gc",&v,&v,&v,&v,&v,&v,(double *)&XGC,&dv,&dv,&dv,5L,10L); /* ajout cast ???*/
00769   CurrentScilabXgc=(struct BCG *)XGC;
00770 
00771 
00772   hdl = sciGetpendofhandletab();
00773 
00774   if(CurrentScilabXgc != NULL)
00775     while (hdl != NULL)
00776     {
00777       pobj=(sciPointObj *) sciGetPointerFromHandle (hdl->index);
00778       if (sciGetEntityType(pobj) == SCI_FIGURE && sciGetNum(pobj) == CurrentScilabXgc->CurWindow ) /* Adding F.Leray 19.04.04 */
00779       {
00780         sciSetCurrentFigure(pobj);
00781         sciSetCurrentObj(pobj); /* The current object will always be the figure too. */
00782         break;
00783 
00784       }
00785       hdl = hdl->pprev;
00786     }
00787 }

Here is the call graph for this function:

integer GetCurrentFigureWindows ( void   ) 

Definition at line 546 of file wgraph.c.

References C2F, dr(), L, na, PD0, and PI0.

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 }

Here is the call graph for this function:

int GetScreenDPI ( int ixres,
int iyres 
)

Definition at line 533 of file wgraph.c.

References hdc, and NULL.

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 }

int GetScreenProperty ( char *  prop,
char *  value 
)

Definition at line 478 of file wgraph.c.

References BITSPIXEL, hdc, HORZSIZE, NULL, and VERTSIZE.

Referenced by TCL_UiGet().

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 }

Here is the caller graph for this function:

void GPopupResize ( struct BCG ScilabXgc,
int width,
int height 
)

GPopupResize : a little beat different to windowdim. GPopupResize sets the visible window (parents dimension)

See also:
: setwindowdim

Definition at line 154 of file wgraph.c.

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 }

static void sci_extra_margin ( HDC  hdc_c,
struct BCG ScilabGC 
) [static]

Definition at line 294 of file wgraph.c.

References BCG::CWindowHeight, BCG::CWindowHeightView, BCG::CWindowWidth, and BCG::CWindowWidthView.

Referenced by ScilabPaint(), and ScilabPaintWithBitmap().

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 }

Here is the caller graph for this function:

void sci_pixmap_resize ( struct BCG ScilabGC,
int  x,
int  y 
)

Resize the pixmap associated to CurWindow and store it back in the window List

Definition at line 498 of file periWin.c.

00499 {
00500   HDC hdc1;
00501   HBITMAP hbmTemp;
00502   hdc1=TryToGetDC(ScilabGC->CWindow);
00503   hbmTemp = CreateCompatibleBitmap (hdc1,x,y);
00504   ReleaseDC(ScilabGC->CWindow,hdc1);
00505   if (!hbmTemp)
00506     {
00507       sciprint("Can't resize pixmap\r\n");
00508       return;
00509     }
00510   else
00511     {
00512       HBITMAP  hbmSave;
00513       hbmSave = SelectObject ( ScilabGC->hdcCompat, hbmTemp);
00514       if ( ScilabGC->hbmCompat != NULL)
00515         DeleteObject (ScilabGC->hbmCompat);
00516       ScilabGC->hbmCompat = hbmTemp;
00517       sci_pixmapclear(ScilabGC->hdcCompat, ScilabGC);
00518       /* XXX C2F(show)(PI0,PI0,PI0,PI0); */ 
00519     }
00520 }

void sci_pixmapclear ( HDC  hdc_c,
struct BCG ScilabGC 
)

Definition at line 467 of file periWin.c.

References BCG::CWindowHeight, BCG::CWindowWidth, and sci_pixmapclear_rect().

Referenced by pixmapclear(), sci_pixmap_resize(), ScilabGResize(), and ScilabPaintWithBitmap().

00468 {
00469   sci_pixmapclear_rect(hdc_c,ScilabGC, 
00470                        ScilabGC->CWindowHeight,ScilabGC->CWindowWidth);
00471 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sci_pixmapclear_rect ( HDC  hdc_c,
struct BCG ScilabGC,
int  ww,
int  hh 
)

Pixmap routines

Definition at line 449 of file periWin.c.

References COLORREF, BCG::Colors, DefaultBackground, NULL, and BCG::NumBackground.

Referenced by sci_pixmapclear().

00450 {
00451   RECT rect;
00452   COLORREF px;
00453   HBRUSH hBrush;
00454   if ( hdc_c  == NULL) return ;
00455   px = (ScilabGC->Colors == NULL)? DefaultBackground 
00456     :  ScilabGC->Colors[ScilabGC->NumBackground];
00457   SetBkColor( hdc_c , px );
00458   rect.top    = 0;
00459   rect.bottom = ww ;
00460   rect.left   = 0;
00461   rect.right  = hh ;
00462   hBrush = CreateSolidBrush(px);
00463   FillRect( hdc_c , &rect,hBrush );
00464   DeleteObject(hBrush);
00465 }

Here is the caller graph for this function:

void scig_replay_hdc ( char  c,
integer  win_num,
HDC  hdc,
int  width,
int  height,
int  scale 
)

Definition at line 439 of file wgraph.c.

References C2F, cur, dr(), dr1(), GetDriver1(), L, na, name, PD0, PI0, ResetScilabXgc(), SciG_Font(), SciG_Font_Printer(), sciGetPixmapStatus(), sciRedrawF(), SetDriver(), SetGHdc(), and SwitchWindow().

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 }

Here is the call graph for this function:

int ScilabGResize ( HWND  hwnd,
struct BCG ScilabGC,
WPARAM  wParam 
)

Definition at line 400 of file wgraph.c.

References BCG::ClipRegionSet, BCG::CWindow, BCG::CWindowHeight, BCG::CWindowWidth, FALSE, hdc1, MSG_WARNING19, NULL, sci_pixmapclear(), sciprint(), TRUE, and TryToGetDC().

Referenced by ON_WND_GRAPH_WM_SIZE().

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ScilabNoPaint ( HWND  hwnd,
struct BCG ScilabGC 
) [static]

Definition at line 389 of file wgraph.c.

References hdc.

00390 {
00391   HDC hdc;
00392   PAINTSTRUCT ps;
00393   hdc = BeginPaint(hwnd, &ps);  
00394   EndPaint(hwnd, &ps);
00395 }

void ScilabPaint ( HWND  hwnd,
struct BCG ScilabGC 
)

Definition at line 319 of file wgraph.c.

References BCG::ClipRegionSet, BCG::CurPixmapStatus, BCG::CurResizeStatus, BCG::CurWindow, BCG::CWindowHeight, BCG::CWindowHeightView, BCG::CWindowWidth, BCG::CWindowWidthView, emulate_backing_store, FALSE, hdc, NULL, sci_extra_margin(), scig_replay_hdc(), ScilabPaintWithBitmap(), Setscig_buzyState(), and TRUE.

Referenced by ON_WND_GRAPH_WM_PAINT().

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ScilabPaintWithBitmap ( HWND  hwnd,
HDC  hdc,
struct BCG ScilabGC 
) [static]

Definition at line 231 of file wgraph.c.

References BCG::ClipRegionSet, BCG::CurWindow, BCG::CWindowHeight, BCG::CWindowHeightView, BCG::CWindowWidth, BCG::CWindowWidthView, Max, MSG_WARNING17, MSG_WARNING18, NULL, sci_extra_margin(), sci_pixmapclear(), scig_replay_hdc(), and sciprint().

Referenced by ScilabPaint().

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

void SciViewportGet ( struct BCG ScilabXgc,
int x,
int y 
)

SciViewportGet : used to get panner position through scilab command.

: struct BCG *ScilabGC : structure associated to a Scilab Graphic window int x,y : the x,y point of the graphic window to be moved at the up-left position of the viewport

: NONE

Author:
: Matthieu PHILIPPE
Date:
: Dec 1999

Definition at line 133 of file wgraph.c.

Referenced by sciGetViewport().

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 }

Here is the caller graph for this function:

void SciViewportMove ( struct BCG ScilabGC,
int  x,
int  y 
)

SciViewportMove : used to move the panner and the viewport interactively through scilab command.

: struct BCG *ScilabGC : structure associated to a Scilab Graphic window int x,y : the x,y point of the graphic window to be moved at the up-left position of the viewport

: NONE

Author:
: Matthieu PHILIPPE
Date:
: Dec 1999

Definition at line 99 of file wgraph.c.

Referenced by sciInitViewport(), and xset_wresize().

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 }

Here is the caller graph for this function:

void set_no_delete_win_mode (  ) 

Definition at line 113 of file Events.c.

References sci_graphic_protect.

00113 {  sci_graphic_protect = 1 ;}

void SetCurrentFigureWindows ( integer  win  ) 

Definition at line 556 of file wgraph.c.

References scig_sel().

00557 {
00558         scig_sel (win);
00559 }

Here is the call graph for this function:


Variable Documentation

GW graphwin

We need to provide a hdc for each graphic operation but hdc can be changed to be set to a window a printer a metafile etc... Thus hdc is kept as a global variable which will be set to what we need : see Xcall.c

Definition at line 8 of file GraphWindows.c.

HINSTANCE hdllInstance

Definition at line 88 of file wtext.c.

TW textwin

keeps information for the current graphic window

Definition at line 8 of file TextWindows.c.


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