WndGraphProc.c File Reference

#include "WndGraphProc.h"
#include "Actions.h"

Include dependency graph for WndGraphProc.c:

Go to the source code of this file.

Functions

int GetEventKeyboardAndMouse (UINT message, WPARAM wParam, LPARAM lParam, struct BCG *ScilabGC)
void SendGraphMacro (struct BCG *ScilabGC, UINT m)
int StoreCommand (char *command)
void ShowGraphToolBar (struct BCG *ScilabGC)
void HideGraphToolBar (struct BCG *ScilabGC)
void ScilabPaint (HWND hwnd, struct BCG *ScilabGC)
int sciGetScrollInfo (struct BCG *Scilabgc, int sb_ctl, SCROLLINFO *si)
int sciSetScrollInfo (struct BCG *Scilabgc, int sb_ctl, SCROLLINFO *si, BOOLEAN bRedraw)
int ScilabGResize (HWND hwnd, struct BCG *ScilabGC, WPARAM wParam)
void DragFunc (LPTW lptw, HDROP hdrop)
int C2F() deletewin (integer *number)
int PushClickQueue (int win, int x, int y, int ibut, int motion, int release)
void set_wait_click (val)
BOOL SendMacroEntityPicker (struct BCG *ScilabGC, int id)
BOOL ON_WND_GRAPH_WM_CLOSE (HWND hwnd)
BOOL ON_WND_GRAPH_WM_DESTROY (HWND hwnd)
BOOL ON_WND_GRAPH_WM_DROPFILES (HWND hwnd, HDROP hDrop)
void ON_WND_GRAPH_WM_VSCROLL (HWND hwnd, HWND hwndCtl, UINT code, int pos)
void ON_WND_GRAPH_WM_HSCROLL (HWND hwnd, HWND hwndCtl, UINT code, int pos)
BOOL ON_WND_GRAPH_WM_SIZE (HWND hwnd, UINT state, int cx, int cy)
BOOL ON_WND_GRAPH_WM_PAINT (HWND hwnd)
BOOL ON_WND_GRAPH_WM_CREATE (HWND hwnd, LPCREATESTRUCT lpCreateStruct)
void ON_WND_GRAPH_WM_KEY (HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags)
BOOL ON_WND_GRAPH_WM_COMMAND (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
EXPORT LRESULT CALLBACK WndGraphProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)


Function Documentation

int C2F() deletewin ( integer number  ) 

Definition at line 1008 of file SGraph.c.

References Delete(), and number.

01008                                     {
01009   Delete((Widget) 0,(XtPointer) *number,(XtPointer) 0);
01010   return(0);
01011 }

Here is the call graph for this function:

void DragFunc ( LPTW  lptw,
HDROP  hdrop 
)

Definition at line 13 of file DragnDrop.c.

00014 {
00015         static char szFile[MAX_PATH];
00016         int i, cFiles;
00017         
00018         cFiles = DragQueryFile (hdrop, 0xffffffff, (LPSTR) NULL, 0);
00019 
00020         lptw->bGetCh =FALSE;
00021 
00022         for (i = 0; i < cFiles; i++)
00023         {
00024                 DragQueryFile (hdrop, i, szFile, MAX_PATH);
00025                 LaunchFilebyExtension(szFile);  
00026         }
00027         DragFinish (hdrop);
00028 }

int GetEventKeyboardAndMouse ( UINT  message,
WPARAM  wParam,
LPARAM  lParam,
struct BCG ScilabGC 
)

Definition at line 8 of file Events.c.

References BCG::CWindow, ON_EVENT_GRAPH_WM_KEYDOWN(), ON_EVENT_GRAPH_WM_KEYUP(), ON_EVENT_GRAPH_WM_LBUTTONDBLCLK(), ON_EVENT_GRAPH_WM_LBUTTONDOWN(), ON_EVENT_GRAPH_WM_LBUTTONUP(), ON_EVENT_GRAPH_WM_MBUTTONDBLCLK(), ON_EVENT_GRAPH_WM_MBUTTONDOWN(), ON_EVENT_GRAPH_WM_MBUTTONUP(), ON_EVENT_GRAPH_WM_MOUSEMOVE(), ON_EVENT_GRAPH_WM_RBUTTONDBLCLK(), ON_EVENT_GRAPH_WM_RBUTTONDOWN(), ON_EVENT_GRAPH_WM_RBUTTONUP(), and TRUE.

Referenced by WndGraphProc().

00009 {
00010         switch(message)
00011         {
00012                 HANDLE_MSG(ScilabGC->CWindow,WM_KEYDOWN,ON_EVENT_GRAPH_WM_KEYDOWN);
00013                 HANDLE_MSG(ScilabGC->CWindow,WM_KEYUP,ON_EVENT_GRAPH_WM_KEYUP);
00014                 
00015                 HANDLE_MSG(ScilabGC->CWindow,WM_LBUTTONDOWN,ON_EVENT_GRAPH_WM_LBUTTONDOWN);
00016                 HANDLE_MSG(ScilabGC->CWindow,WM_LBUTTONUP,ON_EVENT_GRAPH_WM_LBUTTONUP);
00017                 HANDLE_MSG(ScilabGC->CWindow,WM_LBUTTONDBLCLK,ON_EVENT_GRAPH_WM_LBUTTONDBLCLK);
00018 
00019                 HANDLE_MSG(ScilabGC->CWindow,WM_RBUTTONDOWN,ON_EVENT_GRAPH_WM_RBUTTONDOWN);
00020                 HANDLE_MSG(ScilabGC->CWindow,WM_RBUTTONUP,ON_EVENT_GRAPH_WM_RBUTTONUP);
00021                 HANDLE_MSG(ScilabGC->CWindow,WM_RBUTTONDBLCLK,ON_EVENT_GRAPH_WM_RBUTTONDBLCLK);
00022 
00023                 HANDLE_MSG(ScilabGC->CWindow,WM_MBUTTONDOWN,ON_EVENT_GRAPH_WM_MBUTTONDOWN);
00024                 HANDLE_MSG(ScilabGC->CWindow,WM_MBUTTONUP,ON_EVENT_GRAPH_WM_MBUTTONUP);
00025                 HANDLE_MSG(ScilabGC->CWindow,WM_MBUTTONDBLCLK,ON_EVENT_GRAPH_WM_MBUTTONDBLCLK);
00026 
00027                 HANDLE_MSG(ScilabGC->CWindow,WM_MOUSEMOVE,ON_EVENT_GRAPH_WM_MOUSEMOVE);
00028 
00029         }
00030         return TRUE;
00031 }

Here is the call graph for this function:

Here is the caller graph for this function:

void HideGraphToolBar ( struct BCG ScilabGC  ) 

Definition at line 23 of file Toolbar.c.

References FALSE, and i.

Referenced by CreateGraphToolBar(), HideToolBarWin32(), ON_WND_GRAPH_WM_KEY(), SendGraphMacro(), and ToolBarWin32().

00024 {
00025         int i=0;
00026         ScilabGC->lpmw.ShowToolBar=FALSE;
00027 
00028         for (i=0;i<ScilabGC->lpmw.nButton;i++)
00029         {
00030                 ShowWindow(ScilabGC->lpmw.hButton[i],SW_HIDE);
00031         }
00032 }

Here is the caller graph for this function:

BOOL ON_WND_GRAPH_WM_CLOSE ( HWND  hwnd  ) 

Definition at line 58 of file WndGraphProc.c.

References C2F, BCG::CurWindow, deletewin(), L, PushClickQueue(), set_wait_click(), TextMessage1(), and TRUE.

Referenced by WndGraphProc().

00059 {
00060         struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00061 
00062         int curWindowNum = ScilabGC->CurWindow ; /* save it before it the GC will be destroyed */
00063 
00064         PostQuitMessage (0);
00065         C2F (deletewin) (&(curWindowNum));
00066         SetWindowLong (hwnd, 0, (LONG) 0L);
00067 
00068         PushClickQueue (curWindowNum,0,0,-100, 0, -1);
00069         set_wait_click(0);
00070 
00071         /* Ajout pour probleme fermeture fenetre scicos
00072         si une boite de dialogue TK est presente */
00073         TextMessage1 (0);
00074 
00075         return TRUE;
00076 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL ON_WND_GRAPH_WM_COMMAND ( HWND  hwnd,
int  id,
HWND  hwndCtl,
UINT  codeNotify 
)

Definition at line 267 of file WndGraphProc.c.

References command, BCG::CurWindow, BCG::CWindow, NULL, NUMMENU, scig_2dzoom(), scig_3drot(), scig_unzoom(), SendGraphMacro(), SendMacroEntityPicker(), SetFocus(), StoreCommand(), TOOLBAR_ARROW, TOOLBAR_CIRCLE, TOOLBAR_GED, TOOLBAR_LINE, TOOLBAR_PICKER, TOOLBAR_POLYLINE, TOOLBAR_RECTANGLE, TOOLBAR_ROTATE3D, TOOLBAR_TEXT, TOOLBAR_UNZOOM, TOOLBAR_ZOOM, TRUE, and UINT.

Referenced by WndGraphProc().

00268 {
00269   struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00270 
00271   if (id < NUMMENU) 
00272   {
00273     if (!SendMacroEntityPicker(ScilabGC, id)) SendGraphMacro (ScilabGC, id);
00274   }
00275   else
00276   {
00277     switch (id)
00278     {
00279     case TOOLBAR_ROTATE3D:
00280       scig_3drot (ScilabGC->CurWindow);
00281       break;
00282 
00283     case TOOLBAR_ZOOM:
00284       scig_2dzoom (ScilabGC->CurWindow);
00285       break;
00286 
00287     case TOOLBAR_UNZOOM:
00288       scig_unzoom (ScilabGC->CurWindow);
00289       break;
00290 
00291     case TOOLBAR_GED:
00292       {
00293 
00294         char command[1024];
00295         wsprintf(command,"ged(8,%d);",ScilabGC->CurWindow);
00296         StoreCommand(command);
00297       }
00298       break;
00299 
00300     case TOOLBAR_PICKER:
00301       {
00302         LRESULT lResult;
00303 
00304         HWND hwndPicker=NULL;
00305         hwndPicker=GetDlgItem(ScilabGC->CWindow,TOOLBAR_PICKER);
00306 
00307         lResult=SendMessage(hwndPicker,(UINT) BM_GETCHECK,0,0);  
00308 
00309         if (lResult == BST_CHECKED)
00310         {
00311           char command[1024];
00312           wsprintf(command,"ged(10,%d);",ScilabGC->CurWindow);
00313           StoreCommand(command);
00314 
00315         }
00316         else
00317         {
00318           char command[1024];
00319           wsprintf(command,"ged(11,%d);",ScilabGC->CurWindow);
00320           StoreCommand(command);
00321         }
00322 
00323       }
00324       break;
00325 
00326     case TOOLBAR_LINE:
00327       {
00328 
00329         char command[1024];
00330         wsprintf(command,"ged_insert(1,%d);",ScilabGC->CurWindow);
00331         StoreCommand(command);
00332       }
00333       break;
00334 
00335     case TOOLBAR_POLYLINE:
00336       {
00337 
00338         char command[1024];
00339         wsprintf(command,"ged_insert(2,%d);",ScilabGC->CurWindow);
00340         StoreCommand(command);
00341       }
00342       break;
00343 
00344     case TOOLBAR_ARROW:
00345       {
00346         char command[1024];
00347         wsprintf(command,"ged_insert(3,%d);",ScilabGC->CurWindow);
00348         StoreCommand(command);
00349       }
00350       break;
00351 
00352       /* Disable Double Arrow */
00353       /*
00354       case TOOLBAR_DOUBLEARROW:
00355       {
00356       char command[1024];
00357       wsprintf(command,"ged_insert(4,%d);",ScilabGC->CurWindow);
00358       StoreCommand(command);
00359       }
00360       break;
00361       */
00362 
00363     case TOOLBAR_TEXT:
00364       {
00365 
00366         char command[1024];
00367         wsprintf(command,"ged_insert(4,%d);",ScilabGC->CurWindow);
00368         StoreCommand(command);
00369       }
00370       break;
00371 
00372     case TOOLBAR_RECTANGLE:
00373       {
00374         char command[1024];
00375         wsprintf(command,"ged_insert(5,%d);",ScilabGC->CurWindow);
00376         StoreCommand(command);
00377       }
00378       break;
00379 
00380     case TOOLBAR_CIRCLE:
00381       {
00382         char command[1024];
00383         wsprintf(command,"ged_insert(6,%d);",ScilabGC->CurWindow);
00384         StoreCommand(command);
00385       }
00386       break;
00387     }
00388     SetFocus(ScilabGC->CWindow);
00389     SetActiveWindow(ScilabGC->CWindow);
00390   }
00391 
00392 
00393   return TRUE;
00394 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL ON_WND_GRAPH_WM_CREATE ( HWND  hwnd,
LPCREATESTRUCT  lpCreateStruct 
)

Definition at line 235 of file WndGraphProc.c.

References TRUE.

Referenced by WndGraphProc().

00236 {
00237         struct BCG *ScilabGC = lpCreateStruct->lpCreateParams;
00238 
00239         SetWindowLong (hwnd, 0, (LONG) ScilabGC);
00240         ScilabGC->CWindow = hwnd;
00241         if (ScilabGC->lpgw->lptw) DragAcceptFiles (hwnd, TRUE);
00242 
00243         return TRUE;
00244 }

Here is the caller graph for this function:

BOOL ON_WND_GRAPH_WM_DESTROY ( HWND  hwnd  ) 

Definition at line 78 of file WndGraphProc.c.

References FALSE, and TRUE.

Referenced by WndGraphProc().

00079 {
00080         PostQuitMessage (0);
00081         DragAcceptFiles (hwnd, FALSE);
00082         return TRUE;
00083 }

Here is the caller graph for this function:

BOOL ON_WND_GRAPH_WM_DROPFILES ( HWND  hwnd,
HDROP  hDrop 
)

Definition at line 85 of file WndGraphProc.c.

References DragFunc(), and TRUE.

Referenced by WndGraphProc().

00086 {
00087         struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00088         if (ScilabGC->lpgw->lptw) DragFunc (ScilabGC->lpgw->lptw, hDrop);
00089         return TRUE;
00090 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ON_WND_GRAPH_WM_HSCROLL ( HWND  hwnd,
HWND  hwndCtl,
UINT  code,
int  pos 
)

Definition at line 137 of file WndGraphProc.c.

References BCG::CWindow, FALSE, max, min, NULL, SB_HORZ, sciGetScrollInfo(), sciSetScrollInfo(), and TRUE.

Referenced by WndGraphProc().

00138 {
00139         SCROLLINFO horzsi;
00140         int deltax = 0;
00141 
00142         struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00143         /* initialisation de SCROLLINFOs */
00144         sciGetScrollInfo (ScilabGC, SB_HORZ, &horzsi);
00145         switch (code)
00146         {
00147                 /* deltax = 0;*/
00148         case SB_PAGEUP:
00149                 deltax = horzsi.nPos;
00150                 horzsi.nPos = max (horzsi.nMin, horzsi.nPos - 50);
00151                 deltax = deltax - horzsi.nPos;
00152                 break;
00153         case SB_PAGEDOWN:
00154                 deltax = horzsi.nPos;
00155                 horzsi.nPos = min (horzsi.nMax - (int)horzsi.nPage, horzsi.nPos + 50);
00156                 deltax = deltax - horzsi.nPos;
00157                 break;
00158         case SB_LINEUP:
00159                 deltax = horzsi.nPos;
00160                 horzsi.nPos = max (horzsi.nMin, horzsi.nPos - 5);
00161                 deltax = deltax - horzsi.nPos;
00162                 break;
00163         case SB_LINEDOWN:
00164                 deltax = horzsi.nPos;
00165                 horzsi.nPos = min (horzsi.nMax - (int) horzsi.nPage, horzsi.nPos + 5);
00166                 deltax = deltax - horzsi.nPos;
00167                 break;
00168         case SB_THUMBTRACK:
00169                 deltax = horzsi.nPos;
00170                 horzsi.nPos = max (horzsi.nMin, min (horzsi.nMax,pos));
00171                 deltax = deltax - horzsi.nPos;
00172                 break;
00173         default:
00174                 deltax=0;
00175                 break;
00176         }
00177         sciSetScrollInfo (ScilabGC, SB_HORZ, &horzsi, TRUE);
00178         InvalidateRect (ScilabGC->CWindow, (LPRECT) NULL, FALSE);
00179 
00180 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ON_WND_GRAPH_WM_KEY ( HWND  hwnd,
UINT  vk,
BOOL  fDown,
int  cRepeat,
UINT  flags 
)

Definition at line 246 of file WndGraphProc.c.

References FALSE, HideGraphToolBar(), and ShowGraphToolBar().

Referenced by WndGraphProc().

00247 {
00248         switch (vk)
00249         {
00250                 case VK_F3:
00251                 {
00252                         struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00253                         if (ScilabGC->lpmw.LockToolBar == FALSE)
00254                         {
00255                                 if (ScilabGC->lpmw.ShowToolBar) HideGraphToolBar(ScilabGC);
00256                                 else ShowGraphToolBar(ScilabGC);
00257                         }
00258 
00259                 }
00260                 break;
00261 
00262                 default:
00263                 break;
00264         }
00265 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL ON_WND_GRAPH_WM_PAINT ( HWND  hwnd  ) 

Definition at line 228 of file WndGraphProc.c.

References ScilabPaint(), and TRUE.

Referenced by WndGraphProc().

00229 {
00230         struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00231         ScilabPaint (hwnd, ScilabGC);
00232         return TRUE;
00233 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL ON_WND_GRAPH_WM_SIZE ( HWND  hwnd,
UINT  state,
int  cx,
int  cy 
)

Definition at line 182 of file WndGraphProc.c.

References BCG::CurPixmapStatus, BCG::CurResizeStatus, BCG::CWindow, FALSE, NULL, SB_HORZ, SB_VERT, sciGetScrollInfo(), ScilabGResize(), sciSetScrollInfo(), and TRUE.

Referenced by WndGraphProc().

00183 {
00184         struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00185         int deltax = 0;
00186         int deltay = 0;
00187         SCROLLINFO vertsi;
00188         SCROLLINFO horzsi;
00189 
00190         /* initialisation de SCROLLINFs */
00191         sciGetScrollInfo (ScilabGC, SB_HORZ, &horzsi);
00192         sciGetScrollInfo (ScilabGC, SB_VERT, &vertsi);
00193         /* MAJ D.ABDEMOUCHE*/
00194         if (ScilabGC->CurResizeStatus == 0)
00195         {
00196                 horzsi.nPage = cx;
00197                 vertsi.nPage = cy;
00198                 /* on recupere la veritable position des scroll bar
00199                 * on a ainsi la possibilite de tirer le graphe
00200                 * quand on agrandi la fenetre 
00201                 */
00202                 horzsi.nPos = GetScrollPos (ScilabGC->CWindow, SB_HORZ);
00203                 vertsi.nPos = GetScrollPos (ScilabGC->CWindow, SB_VERT);
00204         }
00205         else
00206         {
00207                 /* eventually resize the pixmap size */
00208                 if (  ScilabGC->CurPixmapStatus  == 1 )
00209                 {
00210                         ScilabGResize (hwnd, ScilabGC, state); 
00211                 }
00212                 horzsi.nMax = cx;
00213                 vertsi.nMax = cy;
00214                 horzsi.nPage = horzsi.nMax;
00215                 vertsi.nPage = vertsi.nMax;
00216         }
00217         sciSetScrollInfo (ScilabGC, SB_HORZ, &(horzsi), TRUE);
00218         sciSetScrollInfo (ScilabGC, SB_VERT, &(vertsi), TRUE);
00219         /* on force le reclacule les positions des scrollbars
00220         et leur validation */
00221         sciGetScrollInfo (ScilabGC, SB_HORZ, &horzsi);
00222         sciGetScrollInfo (ScilabGC, SB_VERT, &vertsi);
00223         InvalidateRect (ScilabGC->CWindow, (LPRECT) NULL,FALSE);
00224 
00225         return TRUE;
00226 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ON_WND_GRAPH_WM_VSCROLL ( HWND  hwnd,
HWND  hwndCtl,
UINT  code,
int  pos 
)

Definition at line 92 of file WndGraphProc.c.

References BCG::CWindow, FALSE, max, min, NULL, SB_VERT, sciGetScrollInfo(), sciSetScrollInfo(), and TRUE.

Referenced by WndGraphProc().

00093 {
00094         SCROLLINFO vertsi;
00095         int deltay = 0;
00096         struct BCG *ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00097         /* initialisation de SCROLLINFs */
00098         sciGetScrollInfo (ScilabGC, SB_VERT, &vertsi);
00099         switch (code)
00100         {
00101                 /* deltay = 0; */
00102         case SB_PAGEUP:
00103                 deltay = vertsi.nPos;
00104                 vertsi.nPos = max (vertsi.nMin, vertsi.nPos - 50);
00105                 deltay = deltay - vertsi.nPos;
00106                 break;
00107         case SB_PAGEDOWN:
00108                 deltay = vertsi.nPos;
00109                 vertsi.nPos = min (vertsi.nMax - (int) vertsi.nPage, vertsi.nPos +50);
00110                 deltay = deltay - vertsi.nPos;
00111                 break;
00112         case SB_LINEUP:
00113                 deltay = vertsi.nPos;
00114                 vertsi.nPos = max (vertsi.nMin, vertsi.nPos - 5);
00115                 deltay = deltay - vertsi.nPos;
00116                 break;
00117         case SB_LINEDOWN:
00118                 deltay = vertsi.nPos;
00119                 vertsi.nPos = min (vertsi.nMax - (int) vertsi.nPage, vertsi.nPos +5);
00120                 deltay = deltay - vertsi.nPos;
00121                 break;
00122         case SB_THUMBTRACK:
00123                 deltay = vertsi.nPos;
00124                 vertsi.nPos = min (vertsi.nMax, max (vertsi.nMin, pos));
00125                 deltay = deltay - vertsi.nPos;
00126                 break; 
00127         default:
00128                 deltay = 0;
00129                 break;
00130         }
00131         sciSetScrollInfo (ScilabGC, SB_VERT, &vertsi, TRUE);
00132         InvalidateRect (ScilabGC->CWindow, (LPRECT) NULL, FALSE);
00133         /* UpdateWindow (ScilabGC->CWindow); */ 
00134 
00135 }

Here is the call graph for this function:

Here is the caller graph for this function:

int PushClickQueue ( int  win,
int  x,
int  y,
int  ibut,
int  motion,
int  release 
)

Definition at line 126 of file Events.c.

References ClickBuf, event_select, i, but::ibutton, lastc, MaxCB, but::motion, but::release, scig_click_handler, wait_for_click, but::win, but::x, and but::y.

00127 {
00128   /* first let a click_handler do the job  */
00129   if ( ( wait_for_click == 0 ) && ( scig_click_handler(win,x,y,ibut,motion,release) == 1 ) ) return 0;
00130   if (  event_select==0 &&(motion == 1 || release == 1) ) return 0;
00131                 
00132   if (((event_select&2)&&motion)||((event_select&4)&&release)||(motion==0&&release==0))
00133         {
00134                 /* store click event in a queue */
00135           if ( lastc == MaxCB ) 
00136     {
00137       int i;
00138       for ( i= 1 ; i < MaxCB ; i ++ ) 
00139                         {
00140                                 ClickBuf[i-1]=ClickBuf[i];
00141                         }
00142       ClickBuf[lastc-1].win = win;
00143       ClickBuf[lastc-1].x = x;
00144       ClickBuf[lastc-1].y = y;
00145       ClickBuf[lastc-1].ibutton = ibut;
00146       ClickBuf[lastc-1].motion = motion;
00147       ClickBuf[lastc-1].release = release;
00148     }
00149                 else 
00150     {
00151       ClickBuf[lastc].win = win;
00152       ClickBuf[lastc].x = x;
00153       ClickBuf[lastc].y = y;
00154       ClickBuf[lastc].ibutton = ibut;
00155       ClickBuf[lastc].motion = motion;
00156       ClickBuf[lastc].release = release;
00157       lastc++;
00158     }
00159   }
00160   return(0);
00161 }

int sciGetScrollInfo ( struct BCG Scilabgc,
int  sb_ctl,
SCROLLINFO *  si 
)

Returns the dimension of the scroll bars

Attention:
Do not call GetScrollInfo windows function, sciGetScrollInfo do that and more things !
Parameters:
[in] Scilabgc 
[in] sb_ctl 
[in] si 
Author:
Matthieu PHILIPPE
Date:
Dec 1999

Definition at line 214 of file periWin.c.

References BCG::CWindow, SB_HORZ, and SB_VERT.

00215 {
00216   SCROLLINFO totosi;
00217   switch (sb_ctl) 
00218     {
00219     case SB_VERT:
00220       /* definition des scroll bars verticalles */
00221       si->cbSize = Scilabgc->vertsi.cbSize;
00222       si->fMask  = Scilabgc->vertsi.fMask;
00223       si->nMin   = Scilabgc->vertsi.nMin;
00224       si->nMax   = Scilabgc->vertsi.nMax;
00225       si->nPage  = Scilabgc->vertsi.nPage;
00226       si->nPos   = Scilabgc->vertsi.nPos;
00227       break;
00228     case SB_HORZ:
00229       /* definition des scroll bars horizontalles */
00230       si->cbSize = Scilabgc->horzsi.cbSize;
00231       si->fMask  = Scilabgc->horzsi.fMask;
00232       si->nMin   = Scilabgc->horzsi.nMin;
00233       si->nMax   = Scilabgc->horzsi.nMax;
00234       si->nPage  = Scilabgc->horzsi.nPage;
00235       si->nPos   = Scilabgc->horzsi.nPos;
00236       break;
00237     default:
00238       break;
00239     }
00240   /* force le rafraichissement de l'affichage des SB !!! */
00241   GetScrollInfo(Scilabgc->CWindow, sb_ctl, &totosi);
00242   return 0;
00243 }

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:

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:

int sciSetScrollInfo ( struct BCG Scilabgc,
int  sb_ctl,
SCROLLINFO *  si,
BOOLEAN  bRedraw 
)

Sets the dimension of the scroll bars

Attention:
Do not call SetScrollInfo windows function, sciSetScrollInfo do that and more things !
Parameters:
[in] Scilabgc 
[in] sb_ctl 
[in] si 
[in] bRedraw 
Author:
Matthieu PHILIPPE
Date:
Dec 1999

Definition at line 245 of file periWin.c.

References BCG::CurResizeStatus, BCG::CWindow, SB_HORZ, SB_VERT, and sciGetScrollInfo().

00246 {
00247   int inttmp = si->nMax;
00248   SCROLLINFO totosi;
00249   
00250   switch (sb_ctl) {
00251   case SB_VERT:
00252     /* definition des scroll bars verticalles */
00253     Scilabgc->vertsi.cbSize = si->cbSize;
00254     Scilabgc->vertsi.fMask  = si->fMask;
00255     Scilabgc->vertsi.nMin   = si->nMin;
00256     Scilabgc->vertsi.nMax   = si->nMax;
00257     Scilabgc->vertsi.nPage  = si->nPage;
00258     if ( Scilabgc->CurResizeStatus == 1) 
00259       {
00260         si->nMax = 0; /* on effectue un swapp pour ne pas changer la val (pointeur !!) */
00261         /* 0 permet de faire disparaitre les scrollbars */
00262       }
00263     Scilabgc->vertsi.nPos   = si->nPos; 
00264     break;
00265   case SB_HORZ:
00266     /* definition des scroll bars horizontalles */
00267     Scilabgc->horzsi.cbSize = si->cbSize;
00268     Scilabgc->horzsi.fMask  = si->fMask;
00269     Scilabgc->horzsi.nMin   = si->nMin;
00270     Scilabgc->horzsi.nMax   = si->nMax;
00271     Scilabgc->horzsi.nPage  = si->nPage;
00272     if ( Scilabgc->CurResizeStatus == 1 ) {  si->nMax = 0;} 
00273     Scilabgc->horzsi.nPos   = si->nPos;
00274     break;
00275   default:
00276     break;
00277   }
00278   /* reset clip region after a scroll */
00279   /* set_clip_after_scroll() ; */
00280   /* ? */  
00281   SetScrollInfo(Scilabgc->CWindow, sb_ctl, si, bRedraw);
00282   if (  Scilabgc->CurResizeStatus == 1)
00283     si->nMax = inttmp;
00284   /* force le rafraichissement de l'affichage des SB !!! */
00285   sciGetScrollInfo(Scilabgc, sb_ctl, &totosi);
00286   return 0;
00287 }

Here is the call graph for this function:

void SendGraphMacro ( struct BCG ScilabGC,
UINT  m 
)

Definition at line 38 of file wgmenu.c.

References buf, C2F, Callback_PRINTSETUP(), CLEARWG, CLOSE, CMDMAX, CMDMIN, COPYCLIP, COPYCLIP1, CopyPrint(), CopyToClipboardBitmap(), CopyToClipboardEMF(), BCG::CurWindow, BCG::CWindow, deletewin(), FALSE, free(), HideGraphToolBar(), ierr, L, LOADSCG, M_WRITEINI, MAXSTR, NEWFIG, NewFigure(), NULL, NUMMENU, PrintPs(), PRINTSETUP, REDRAW, ROT3D, s, SaveCurrentLine(), SavePs(), SAVESCG, scig_2dzoom(), scig_3drot(), scig_erase(), scig_loadsg(), scig_replay(), scig_savesg(), scig_sel(), scig_unzoom(), SCIGSEL, ScilabMenuAction(), SciOpenSave(), SCIPR, SCIPS, ShowGraphToolBar(), TOOLBARGRAPH, TRUE, UNZOOM, UPDINI, wininfo(), and ZOOM.

00039 {
00040   BYTE *s;
00041   char *d;
00042   char *buf;
00043   BOOL flag = TRUE;
00044   wininfo (" ");
00045   if ((buf = LocalAlloc (LPTR, MAXSTR + 1)) == (char *) NULL)
00046     return;
00047   if (m >= NUMMENU || (int)m < 0)
00048     return;
00049   s = ScilabGC->lpmw.macro[m];
00050   d = buf;
00051   *d = '\0';
00052   while (s && *s && (d - buf < MAXSTR))
00053     {
00054       if (*s >= CMDMIN && *s <= CMDMAX)
00055         {
00056           int ierr = 0;
00057           
00059           switch (*s)
00060             {
00061             case TOOLBARGRAPH:
00062               if (ScilabGC->lpmw.LockToolBar == FALSE)
00063                 {
00064                   if (ScilabGC->lpmw.ShowToolBar)       HideGraphToolBar(ScilabGC);
00065                   else ShowGraphToolBar(ScilabGC);
00066                 }
00067               s++;
00068               break;
00069             case NEWFIG:
00070               SaveCurrentLine(TRUE);
00071               NewFigure(ScilabGC);
00072               s++;
00073               break;
00074             case ZOOM:
00075               scig_2dzoom (ScilabGC->CurWindow);
00076                   
00077               s++;
00078               break;
00079             case UNZOOM:
00080               scig_unzoom (ScilabGC->CurWindow);
00081                   
00082               s++;
00083               break;
00084             case ROT3D:
00085               scig_3drot (ScilabGC->CurWindow);
00086                   
00087               s++;
00088               break;
00089                 case PRINTSETUP:
00090                         Callback_PRINTSETUP();
00091                         s++;
00092                         break;
00093             case PRINT:
00094               CopyPrint (ScilabGC);
00095               s++;
00096               break;
00097             case COPYCLIP:
00098               {
00099                 CopyToClipboardEMF (ScilabGC);
00100                 s++;
00101               }
00102               break;
00103             case COPYCLIP1:
00104               CopyToClipboardBitmap (ScilabGC);
00105               s++;
00106               break;
00107             case REDRAW:
00108               scig_replay (ScilabGC->CurWindow);
00109               s++;
00110               break;
00111             case CLEARWG:
00112               scig_erase (ScilabGC->CurWindow);
00113               s++;
00114               break;
00115             case SCIPS:
00116                 {
00117                         char *SaveCurrentPath=NULL;
00118                         SaveCurrentPath=_getcwd( NULL, 0 );
00119                         SavePs (ScilabGC);
00120                         if (SaveCurrentPath)
00121                         {
00122                                 _chdir(SaveCurrentPath);
00123                                 free(SaveCurrentPath); /* here must be a "little" free with _getcwd*/
00124                                 SaveCurrentPath=NULL;
00125                         }
00126                         s++;
00127                 }
00128               break;
00129             case SCIPR:
00130               PrintPs (ScilabGC);
00131               s++;
00132               break;
00133             case SCIGSEL:
00134               scig_sel (ScilabGC->CurWindow);
00135               s++;
00136               break;
00137             case LOADSCG:
00138               flag = SciOpenSave (ScilabGC->hWndParent, &s,FALSE,&d, &ierr);
00139               if (flag == 0 || ierr == 1)
00140                 {
00141                   LocalFree (buf);
00142                   return;
00143                 }
00144               *d = '\0';
00145               scig_loadsg (ScilabGC->CurWindow, buf);
00146               break;
00147             case SAVESCG:
00148               flag = SciOpenSave (ScilabGC->hWndParent, &s,TRUE,&d, &ierr);
00149               if (flag == 0 || ierr == 1)
00150                 {
00151                   LocalFree (buf);
00152                   return;
00153                 }
00154               *d = '\0';
00155               /*C2F (xsaveplots) (&(ScilabGC->CurWindow), buf, 0L);*/
00156               scig_savesg( ScilabGC->CurWindow, buf ) ;
00157               break;
00158             case UPDINI:
00159               SendMessage (ScilabGC->CWindow, WM_COMMAND, M_WRITEINI, 0L);
00160               s++;
00161               break;
00162             case CLOSE:
00163               C2F (deletewin) (&(ScilabGC->CurWindow));
00164               s++;
00165               break;
00166             default:
00167               s++;
00168               break;
00169             }
00173           d = buf;
00174           s = (BYTE *) "";
00175         }
00176       else
00177         {
00178           *d++ = *s++;
00179         }
00180     }
00181   *d = '\0';
00186   ScilabMenuAction (buf);
00187   LocalFree (buf);
00188 
00189 }

Here is the call graph for this function:

BOOL SendMacroEntityPicker ( struct BCG ScilabGC,
int  id 
)

Definition at line 1083 of file wgmenu.c.

References command, BCG::CurWindow, FALSE, IsEntityPickerMenu(), ModifyEntityPickerToolbar(), StoreCommand(), and TRUE.

Referenced by ON_WND_GRAPH_WM_COMMAND().

01084 {
01085         BOOL bOK=FALSE;
01086         char command[1024];
01087         
01088         if (IsEntityPickerMenu(ScilabGC,id))
01089         {
01090                 if (id == 23)
01091                 {
01092                         wsprintf(command,"ged(10,%d);",ScilabGC->CurWindow); /* Start */
01093                         ModifyEntityPickerToolbar(ScilabGC,TRUE);
01094                         StoreCommand(command);
01095                         bOK=TRUE;
01096                 }
01097 
01098                 if (id == 24)
01099                 {
01100                         wsprintf(command,"ged(11,%d);",ScilabGC->CurWindow); /* Stop */
01101                         ModifyEntityPickerToolbar(ScilabGC,FALSE);
01102                         StoreCommand(command);
01103                         bOK=TRUE;
01104                 }
01105         }
01106         
01107         return bOK;
01108 }

Here is the call graph for this function:

Here is the caller graph for this function:

void set_wait_click ( val   ) 

void ShowGraphToolBar ( struct BCG ScilabGC  ) 

Definition at line 34 of file Toolbar.c.

References i, SW_SHOWNORMAL, and TRUE.

Referenced by ON_WND_GRAPH_WM_KEY(), SendGraphMacro(), and ToolBarWin32().

00035 {
00036         int i=0;
00037 
00038         ScilabGC->lpmw.ShowToolBar=TRUE;
00039         for (i=0;i<ScilabGC->lpmw.nButton;i++)
00040         {
00041                 ShowWindow(ScilabGC->lpmw.hButton[i],SW_SHOWNORMAL);
00042         }
00043 }

Here is the caller graph for this function:

int StoreCommand ( char *  command  ) 

Definition at line 82 of file dynamic_menus.c.

00083 {
00084         return (StoreCommand1 (command, 0)); /* jpc 1->0 */
00085 }

EXPORT LRESULT CALLBACK WndGraphProc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Warning : the following code won't work if the win.a library is replaced by a dll. The way to find WndGraphProc should be changed

Warning : Potential loop It's dangerous to use sciprint in the following code if the argument string to sciprint contains a
because this will call the TextMessage function ( which will enter a message loop). One can enter an infinite loop if TexMessage is activated while inside WndGraphProc and all the following function can be called while inside WndGraphProc.

Definition at line 36 of file WndGraphProc.c.

References GetEventKeyboardAndMouse(), NULL, ON_WND_GRAPH_WM_CLOSE(), ON_WND_GRAPH_WM_COMMAND(), ON_WND_GRAPH_WM_CREATE(), ON_WND_GRAPH_WM_DESTROY(), ON_WND_GRAPH_WM_DROPFILES(), ON_WND_GRAPH_WM_HSCROLL(), ON_WND_GRAPH_WM_KEY(), ON_WND_GRAPH_WM_PAINT(), ON_WND_GRAPH_WM_SIZE(), and ON_WND_GRAPH_WM_VSCROLL().

00037 {
00038         struct BCG *ScilabGC = (struct BCG *) NULL;
00039         ScilabGC = (struct BCG *) GetWindowLong (hwnd, 0);
00040         GetEventKeyboardAndMouse(message,wParam,lParam,ScilabGC);
00041 
00042         switch (message)
00043         {
00044                 HANDLE_MSG(hwnd,WM_COMMAND,ON_WND_GRAPH_WM_COMMAND);
00045                 HANDLE_MSG(hwnd,WM_KEYDOWN,ON_WND_GRAPH_WM_KEY);
00046                 HANDLE_MSG(hwnd,WM_CREATE,ON_WND_GRAPH_WM_CREATE);
00047                 HANDLE_MSG(hwnd,WM_PAINT,ON_WND_GRAPH_WM_PAINT);
00048                 HANDLE_MSG(hwnd,WM_SIZE,ON_WND_GRAPH_WM_SIZE);
00049                 HANDLE_MSG(hwnd,WM_HSCROLL,ON_WND_GRAPH_WM_HSCROLL);
00050                 HANDLE_MSG(hwnd,WM_VSCROLL,ON_WND_GRAPH_WM_VSCROLL);
00051                 HANDLE_MSG(hwnd,WM_DROPFILES,ON_WND_GRAPH_WM_DROPFILES);
00052                 HANDLE_MSG(hwnd,WM_DESTROY,ON_WND_GRAPH_WM_DESTROY);
00053                 HANDLE_MSG(hwnd,WM_CLOSE,ON_WND_GRAPH_WM_CLOSE);
00054         }
00055         return DefWindowProc (hwnd, message, wParam, lParam);
00056 }

Here is the call graph for this function:


Generated on Sun Mar 4 16:00:18 2007 for Scilab [trunk] by  doxygen 1.5.1