wgmenu.h File Reference

#include <stdio.h>
#include <string.h>
#include "wresource.h"
#include "wcommon.h"
#include <commdlg.h>
#include <direct.h>
#include "../../../../string/includes/men_Sutils.h"

Include dependency graph for wgmenu.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MAXSTR   255
#define MACROLEN   5000
#define MENUDEPTH   3
#define CMDMIN   131
#define LOADSCG   CMDMIN
#define SAVESCG   CMDMIN+1
#define NEWFIG   CMDMIN+2
#define CLOSE   CMDMIN+3
#define SCIPS   CMDMIN+4
#define SCIPR   CMDMIN+5
#define PRINTSETUP   CMDMIN+6
#define PRINT   CMDMIN+7
#define UPDINI   CMDMIN+8
#define SCIGSEL   UPDINI+1
#define TOOLBARGRAPH   SCIGSEL+1
#define REDRAW   SCIGSEL+2
#define CLEARWG   SCIGSEL+3
#define COPYCLIP   SCIGSEL+4
#define COPYCLIP1   SCIGSEL+5
#define ZOOM   COPYCLIP1+1
#define UNZOOM   ZOOM+1
#define ROT3D   ZOOM+2
#define EOS   ROT3D+1
#define CMDMAX   EOS
#define BUGGOTOCLEAN(str)

Functions

static void ExploreMenu (HMENU hmen, BYTE **macro)
static void SciDelMenu (LPMW lpmw, char *name)
static void SciChMenu (LPMW lpmw, char *name, char *new_name)
static void SciSetMenu (HMENU hmen, char *name, int num, int flag)
static void TranslateMacro (char *string)
static void scig_command_scilabgc (int number, void f(struct BCG *))
void SendGraphMacro (struct BCG *ScilabGC, UINT m)
void ScilabMenuAction (char *buf)
void write_scilab (char *buf)
void LoadGraphMacros (struct BCG *ScilabGC)
void CloseGraphMacros (struct BCG *ScilabGC)
void scig_h_copyclip (integer number)
void scig_h_copyclip1 (integer number)
void scig_print (integer number)
void scig_export (integer number)
void UpdateFileGraphNameMenu (struct BCG *ScilabGC)
int WGFindMenuPos (BYTE **macros)
int C2F() setmen (integer *win_num, char *button_name, integer *entries, integer *ptrentries, integer *ne, integer *ierr)
int C2F() unsmen (integer *win_num, char *button_name, integer *entries, integer *ptrentries, integer *ne, integer *ierr)
EXPORT BOOL CALLBACK ExportStyleDlgProc (HWND hdlg, UINT wmsg, WPARAM wparam, LPARAM lparam)
BOOL ExportStyle (struct BCG *ScilabGC)
void NewFigure (struct BCG *ScilabGC)
int FindFreeGraphicWindow (struct BCG *ScilabGC)
void RefreshMenus (struct BCG *ScilabGC)
void CreateGedMenus (struct BCG *ScilabGC)
BOOL IsEntityPickerMenu (struct BCG *ScilabGC, int id)

Variables

TW textwin
static char * keyword []
static BYTE keyeq []


Define Documentation

#define BUGGOTOCLEAN ( str   ) 

Value:

wsprintf(buf,str,nLine,ScilabGC->lpgw->szMenuName); \
      MessageBox(ScilabGC->hWndParent,(LPSTR) buf,ScilabGC->lpgw->Title,MB_ICONEXCLAMATION);\
      goto errorcleanup;

Definition at line 71 of file wgmenu.h.

Referenced by LoadGraphMacros(), and LoadMacros().

#define CLEARWG   SCIGSEL+3

Definition at line 58 of file wgmenu.h.

Referenced by SendGraphMacro().

#define CLOSE   CMDMIN+3

Definition at line 48 of file wgmenu.h.

Referenced by SendGraphMacro().

#define CMDMAX   EOS

Definition at line 68 of file wgmenu.h.

Referenced by SendGraphMacro(), and SendMacro().

#define CMDMIN   131

Definition at line 42 of file wgmenu.h.

Referenced by SendGraphMacro(), and SendMacro().

#define COPYCLIP   SCIGSEL+4

Definition at line 59 of file wgmenu.h.

Referenced by SendGraphMacro().

#define COPYCLIP1   SCIGSEL+5

Definition at line 60 of file wgmenu.h.

Referenced by SendGraphMacro().

#define EOS   ROT3D+1

Definition at line 66 of file wgmenu.h.

Referenced by DoChangeDir(), and SendMacro().

#define LOADSCG   CMDMIN

Warning must be like OPEN and SAVE in the wmenu.c file

Definition at line 45 of file wgmenu.h.

Referenced by SendGraphMacro().

#define MACROLEN   5000

Definition at line 35 of file wgmenu.h.

#define MAXSTR   255

Definition at line 34 of file wgmenu.h.

#define MENUDEPTH   3

Definition at line 36 of file wgmenu.h.

Referenced by LoadGraphMacros(), and LoadMacros().

#define NEWFIG   CMDMIN+2

Definition at line 47 of file wgmenu.h.

Referenced by SendGraphMacro().

#define PRINT   CMDMIN+7

Definition at line 52 of file wgmenu.h.

#define PRINTSETUP   CMDMIN+6

Definition at line 51 of file wgmenu.h.

Referenced by SendGraphMacro(), and SendMacro().

#define REDRAW   SCIGSEL+2

Definition at line 57 of file wgmenu.h.

Referenced by SendGraphMacro().

#define ROT3D   ZOOM+2

Definition at line 64 of file wgmenu.h.

Referenced by SendGraphMacro().

#define SAVESCG   CMDMIN+1

Definition at line 46 of file wgmenu.h.

Referenced by SendGraphMacro().

#define SCIGSEL   UPDINI+1

Definition at line 55 of file wgmenu.h.

Referenced by SendGraphMacro().

#define SCIPR   CMDMIN+5

Definition at line 50 of file wgmenu.h.

Referenced by SendGraphMacro().

#define SCIPS   CMDMIN+4

Definition at line 49 of file wgmenu.h.

Referenced by SendGraphMacro().

#define TOOLBARGRAPH   SCIGSEL+1

Definition at line 56 of file wgmenu.h.

Referenced by SendGraphMacro().

#define UNZOOM   ZOOM+1

Definition at line 63 of file wgmenu.h.

Referenced by SendGraphMacro().

#define UPDINI   CMDMIN+8

Definition at line 53 of file wgmenu.h.

Referenced by SendGraphMacro().

#define ZOOM   COPYCLIP1+1

Definition at line 62 of file wgmenu.h.

Referenced by SendGraphMacro().


Function Documentation

void CloseGraphMacros ( struct BCG ScilabGC  ) 

Definition at line 480 of file wgmenu.c.

References i, and NUMMENU.

00481 {
00482   int i;
00483   HGLOBAL hglobal;
00484   if (ScilabGC->lpmw.macro != (BYTE **) NULL)
00485     {
00486       hglobal = GlobalHandle (ScilabGC->lpmw.macro);
00487       if (hglobal)
00488         {
00489           for (i = 0; i < NUMMENU; i++)
00490             if (ScilabGC->lpmw.macro[i] != (BYTE *) 0)
00491               {
00492                 LocalFree (ScilabGC->lpmw.macro[i]);
00493                 ScilabGC->lpmw.macro[i] = (BYTE *) 0;
00494               }
00495           GlobalUnlock (hglobal);
00496           GlobalFree (hglobal);
00497           ScilabGC->lpmw.macro = (BYTE **) NULL;
00498         }
00499     }
00500 
00501     if ( ScilabGC->lpmw.szMenuName != NULL )
00502     {
00503       FREE( ScilabGC->lpmw.szMenuName ) ;
00504       ScilabGC->lpmw.szMenuName = NULL ;
00505     }
00506 }

void CreateGedMenus ( struct BCG ScilabGC  ) 

Definition at line 1035 of file wgmenu.c.

References AddMenu(), BCG::CurWindow, ierr, LoadGraphMacros(), MSG_SCIMSG116, MSG_SCIMSG117, MSG_SCIMSG118, MSG_SCIMSG119, and UpdateFileGraphNameMenu().

01036 {
01037   int WinNum=ScilabGC->CurWindow;
01038 
01039 
01040   /*
01041   for new menus
01042   ScilabXgc->hMenuRoot=CreateMenu();
01043   ScilabXgc->IDM_Count=1;
01044 
01045   SetMenu(ScilabXgc->hWndParent,ScilabXgc->hMenuRoot); 
01046   */
01047 #ifdef WITH_TK
01048   integer ne=14, menutyp=2, ierr;
01049   char *EditMenusE[]={"&Select figure as current","&Redraw figure","&Erase figure","[--]","&Copy object","&Paste object","Move object","Delete object","[--]","Figure properties","Current &axes properties","[--]",MSG_SCIMSG116,MSG_SCIMSG117};
01050   char *EditMenusF[]={"&Selectionner figure comme courante","&Redessiner figure","[--]","&Effacer figure","Copier objet","Coller objet","Déplacer objet","Détruire objet","[--]","Propriétés de la &figure","Propriétés des &axes courants","[--]",MSG_SCIMSG118,MSG_SCIMSG119};
01051 
01052   /* Disable Double Arrow */
01053   integer ni=/*7*/6;
01054   char *InsertMenusE[]={"&Line","&Polyline","&Arrow",/*"&Double Arrow",*/"&Text","&Rectangle","&Circle"};
01055   char *InsertMenusF[]={"&Ligne","L&igne brisée","&Fleche",/*"&Double Fleche",*/"&Texte","&Rectangle","&Cercle"};
01056 #else
01057   integer ne=3, menutyp=2, ierr;
01058   char *EditMenusE[]={"&Select figure","&Redraw figure","&Erase figure"};
01059   char *EditMenusF[]={"&Selectionner figure","&Redessiner figure","&Effacer figure"};
01060 #endif
01061 
01062   UpdateFileGraphNameMenu(ScilabGC);
01063   LoadGraphMacros(ScilabGC);
01064 
01065   switch( ScilabGC->lpmw.CodeLanguage)
01066   {
01067   case 1:
01068     AddMenu(&WinNum,"&Editer", EditMenusF, &ne, &menutyp, "ged", &ierr);
01069 #ifdef WITH_TK
01070     /*AddMenu(&WinNum,"&Inserer", InsertMenusF, &ni, &menutyp, "ged_insert", &ierr);*/
01071 #endif
01072     break;
01073   default:
01074     AddMenu(&WinNum,"&Edit", EditMenusE, &ne, &menutyp, "ged", &ierr);
01075 #ifdef WITH_TK
01076     /*AddMenu(&WinNum,"&Insert", InsertMenusE, &ni, &menutyp, "ged_insert", &ierr);*/
01077 #endif
01078     break;
01079   }
01080 
01081 }

Here is the call graph for this function:

static void ExploreMenu ( HMENU  hmen,
BYTE **  macro 
) [static]

BOOL ExportStyle ( struct BCG ScilabGC  ) 

Definition at line 87 of file ExportBox.c.

References ExportStyleDlgProc(), FALSE, hdllInstance, MyGetProcAddress, and TRUE.

Referenced by SavePs().

00088 {
00089   DLGPROC lpfnExportStyleDlgProc;
00090   BOOL status = FALSE;
00091   lpfnExportStyleDlgProc = (DLGPROC) MyGetProcAddress ("ExportStyleDlgProc",ExportStyleDlgProc);
00092   if (DialogBox (hdllInstance,"ExportStyleDlgBox",
00093                  ScilabGC->hWndParent, lpfnExportStyleDlgProc) == IDOK)
00094     {
00095       status = TRUE;
00096     }
00097   return status;
00098 }

Here is the call graph for this function:

Here is the caller graph for this function:

EXPORT BOOL CALLBACK ExportStyleDlgProc ( HWND  hdlg,
UINT  wmsg,
WPARAM  wparam,
LPARAM  lparam 
)

Definition at line 29 of file ExportBox.c.

References tagLS::colored, FALSE, i, L, tagLS::land, ls, MSG_SCIMSG92, MSG_SCIMSG93, MSG_SCIMSG94, MSG_SCIMSG95, Print_Formats, PS_COLOR, PS_LAND, tagLS::ps_type, PS_TYPE, TRUE, UINT, and tagLS::use_printer.

Referenced by ExportStyle().

00030 {
00031   int i;
00032   switch (wmsg)
00033     {
00034     case WM_INITDIALOG:
00035       SendDlgItemMessage (hdlg, PS_COLOR, CB_ADDSTRING, 0,
00036                           (LPARAM) ((LPSTR) MSG_SCIMSG92));
00037       SendDlgItemMessage (hdlg, PS_COLOR, CB_ADDSTRING, 0,
00038                           (LPARAM) ((LPSTR) MSG_SCIMSG93));
00039       SendDlgItemMessage (hdlg, PS_COLOR, CB_SETCURSEL,
00040                           ls.colored, 0L);
00041       SendDlgItemMessage (hdlg, PS_LAND, CB_ADDSTRING, 0,
00042                           (LPARAM) ((LPSTR) MSG_SCIMSG94));
00043       SendDlgItemMessage (hdlg, PS_LAND, CB_ADDSTRING, 0,
00044                           (LPARAM) ((LPSTR) MSG_SCIMSG95));
00045       SendDlgItemMessage (hdlg, PS_LAND, CB_SETCURSEL,
00046                           ls.land, 0L);
00047       if (ls.use_printer == 0)
00048         {
00049           for (i = 0; i < 8; i++)
00050             SendDlgItemMessage (hdlg, PS_TYPE, CB_ADDSTRING, 0,
00051                                 (LPARAM) ((LPSTR) Print_Formats[i]));
00052           SendDlgItemMessage (hdlg, PS_TYPE, CB_SETCURSEL,
00053                               ls.ps_type, 0L);
00054         }
00055       return TRUE;
00056     case WM_COMMAND:
00057       switch (LOWORD (wparam))
00058         {
00059         case PS_COLOR:
00060           ls.colored =
00061             (UINT) SendDlgItemMessage (hdlg, PS_COLOR, CB_GETCURSEL, 0, 0L);
00062           return FALSE;
00063         case PS_TYPE:
00064           ls.ps_type =
00065             (UINT) SendDlgItemMessage (hdlg, PS_TYPE, CB_GETCURSEL, 0, 0L);
00066           return FALSE;
00067         case PS_LAND:
00068           ls.land =
00069             (UINT) SendDlgItemMessage (hdlg, PS_LAND, CB_GETCURSEL, 0, 0L);
00070           return FALSE;
00071         case IDOK:
00072           EndDialog (hdlg, IDOK);
00073           return TRUE;
00074         case IDCANCEL:
00075           EndDialog (hdlg, IDCANCEL);
00076           return TRUE;
00077         }
00078       break;
00079       return FALSE;
00080     }
00081   return FALSE;
00082 }

Here is the caller graph for this function:

int FindFreeGraphicWindow ( struct BCG ScilabGC  ) 

Definition at line 985 of file wgmenu.c.

References FREE, getWins(), i, ids, iflag, MALLOC, and num.

Referenced by NewFigure().

00986 {
00987   int FreeNumber=-1;
00988   integer iflag =0,ids,num,un=1;
00989 
00990   integer *tab=NULL;
00991   int sizetab=0;
00992   int i=0;
00993 
00994   iflag = 0; 
00995   getWins(&num,&ids ,&iflag);
00996   sizetab=num;
00997 
00998   tab=(integer*)MALLOC(sizeof(integer)*sizetab);
00999   for(i=0;i<sizetab;i++) tab[i]=0;
01000 
01001   iflag = 1; 
01002   getWins(&num,tab,&iflag);
01003 
01004   for(i=0;i<sizetab;i++)
01005   {
01006     if(FreeNumber<tab[i]) FreeNumber=tab[i];    
01007   }
01008   FreeNumber=FreeNumber+1;
01009   FREE(tab);
01010   return FreeNumber;
01011 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL IsEntityPickerMenu ( struct BCG ScilabGC,
int  id 
)

Definition at line 1110 of file wgmenu.c.

References FALSE, lenStringMenu, MSG_SCIMSG116, MSG_SCIMSG117, MSG_SCIMSG118, MSG_SCIMSG119, and TRUE.

Referenced by SendMacroEntityPicker().

01111 {
01112         BOOL bOK=FALSE;
01113         if (id == 23)
01114         {
01115                 #define lenStringMenu 64
01116                 char CurrentStringMenu[lenStringMenu];
01117                 GetMenuString(ScilabGC->lpmw.hMenu,id,CurrentStringMenu,lenStringMenu-1,MF_BYCOMMAND);
01118                 switch (ScilabGC->lpmw.CodeLanguage)
01119                 {
01120                         case 1:
01121                                 if (strcmp(CurrentStringMenu,MSG_SCIMSG118)==0) bOK=TRUE;
01122                         break;
01123 
01124                         case 0: default:
01125                                 if (strcmp(CurrentStringMenu,MSG_SCIMSG116)==0) bOK=TRUE;
01126                         break;
01127                 }
01128         }
01129 
01130         if (id == 24)
01131         {
01132                 #define lenStringMenu 64
01133                 char CurrentStringMenu[lenStringMenu];
01134                 GetMenuString(ScilabGC->lpmw.hMenu,id,CurrentStringMenu,lenStringMenu-1,MF_BYCOMMAND);
01135                 switch (ScilabGC->lpmw.CodeLanguage)
01136                 {
01137                         case 1:
01138                                 if (strcmp(CurrentStringMenu,MSG_SCIMSG119)==0) bOK=TRUE;
01139                         break;
01140 
01141                         case 0: default:
01142                                 if (strcmp(CurrentStringMenu,MSG_SCIMSG117)==0) bOK=TRUE;
01143                         break;
01144                 }
01145         }
01146 
01147         return bOK;
01148 }

Here is the caller graph for this function:

void LoadGraphMacros ( struct BCG ScilabGC  ) 

Definition at line 308 of file wgmenu.c.

References buf, BUGGOTOCLEAN, cleanup(), GetLine(), Gfopen(), i, LeftJustify(), MAXSTR, MENUDEPTH, MF_SEPARATOR, MSG_ERROR77, MSG_WARNING5, MSG_WARNING6, MSG_WARNING7, MSG_WARNING8, MSG_WARNING9, NULL, NUMMENU, TranslateMacro(), UINT, and WGFindMenuPos().

00309 {
00310   GFILE *menufile;
00311   BYTE *macroptr;
00312   char *buf;
00313   HMENU hMenu[MENUDEPTH + 1];
00314   int nLine = 1, nInc, i, nMenuLevel, nCountMenu;
00315   HGLOBAL hmacro;
00316   /* mark all buffers and menu file as unused */
00317   buf = (char *) NULL;
00318   hmacro = 0;
00319   ScilabGC->lpmw.macro = (BYTE **) NULL;
00320   menufile = (GFILE *) NULL;
00321 
00322   /* open menu file */
00323   if ((menufile = Gfopen (ScilabGC->lpgw->szMenuName, OF_READ)) == (GFILE *) NULL)
00324     goto errorcleanup;
00325 
00326   /* allocate buffers */
00327   if ((buf = LocalAlloc (LPTR, MAXSTR)) == (char *) NULL)
00328     goto nomemory;
00329   hmacro = GlobalAlloc (GHND, (NUMMENU) * sizeof (BYTE *));
00330   if ((ScilabGC->lpmw.macro = (BYTE **) GlobalLock (hmacro)) == (BYTE **) NULL)
00331     goto nomemory;
00332 
00333   /* Initialize macro array * */
00334   for (i = 0; i < NUMMENU; i++)
00335     {
00336       ScilabGC->lpmw.macro[i] = (BYTE *) 0;
00337     }
00340   ScilabGC->lpmw.nCountMenu = 0;
00341   ScilabGC->lpmw.nButton = 0;
00342   ScilabGC->lpmw.hMenu = hMenu[0] = CreateMenu ();
00343   nMenuLevel = 0;
00344 
00345   while ((nInc = GetLine (buf, MAXSTR, menufile)) != 0)
00346     {
00347       nLine += nInc;
00348       LeftJustify (buf, buf);
00349       if (buf[0] == '\0')
00350         {
00351           /* ignore blank lines */
00352         }
00353       else if (!lstrcmpi (buf, "[Menu]"))
00354         {
00355           /* new menu */
00356           if (!(nInc = GetLine (buf, MAXSTR, menufile)))
00357             {
00358               nLine += nInc;
00359               BUGGOTOCLEAN (MSG_WARNING5);
00360             }
00361           LeftJustify (buf, buf);
00362           if (nMenuLevel < MENUDEPTH)
00363             {
00364               nMenuLevel++;
00365             }
00366           else
00367             {
00368               BUGGOTOCLEAN (MSG_WARNING6);
00369             }
00370           hMenu[nMenuLevel] = CreateMenu ();
00371           AppendMenu (hMenu[nMenuLevel > 0 ? nMenuLevel - 1 : 0],
00372                       MF_STRING | MF_POPUP, (UINT) hMenu[nMenuLevel],
00373                       (LPCSTR) buf);
00374         }
00375       else if (!lstrcmpi (buf, "[EndMenu]"))
00376         {
00377           if (nMenuLevel > 0)
00378             nMenuLevel--;       /* back up one menu */
00379         }
00380       else
00381         {
00382           nCountMenu = WGFindMenuPos (ScilabGC->lpmw.macro);
00383           /* menu item */
00384           if (nCountMenu >= NUMMENU)
00385             {
00386               BUGGOTOCLEAN ( MSG_WARNING7 );
00387             }
00388           LeftJustify (buf, buf);
00389           if (buf[0] == '-')
00390             {
00391               if (nMenuLevel == 0)
00392                 AppendMenu (hMenu[0], MF_MENUBREAK, 0, (LPSTR) NULL);
00393               else
00394                 AppendMenu (hMenu[nMenuLevel], MF_SEPARATOR, 0, (LPSTR) NULL);
00395             }
00396           else if (buf[0] == '|')
00397             {
00398               AppendMenu (hMenu[nMenuLevel], MF_MENUBARBREAK, 0, (LPSTR) NULL);
00399             }
00400           else
00401             {
00402               AppendMenu (hMenu[nMenuLevel], MF_STRING, nCountMenu, (LPSTR) buf);
00403               ScilabGC->lpmw.nCountMenu++;
00404               if (!(nInc = GetLine (buf, MAXSTR, menufile)))
00405                 {
00406                   nLine += nInc;
00407                   BUGGOTOCLEAN (MSG_WARNING8);
00408                 }
00409               LeftJustify (buf, buf);
00410               TranslateMacro (buf);
00411               if ((macroptr = LocalAlloc (LPTR, lstrlen (buf) + 1)) != (BYTE *) NULL)
00412                 {
00413                   lstrcpy ((char *) macroptr, buf);
00414                 }
00415               else
00416                 {
00417                   BUGGOTOCLEAN (MSG_WARNING9);
00418                 }
00419               ScilabGC->lpmw.macro[nCountMenu] = macroptr;
00420             }
00421         }
00422     }
00423   nCountMenu = WGFindMenuPos (ScilabGC->lpmw.macro);
00424   if ((nCountMenu - ScilabGC->lpmw.nButton) > 0)
00425     {
00426       /* we have a menu bar so put it on the window */
00427       SetMenu (ScilabGC->hWndParent, ScilabGC->lpmw.hMenu);
00428       DrawMenuBar (ScilabGC->hWndParent);
00429     }
00430 
00431   goto cleanup;
00432 
00433  nomemory:
00434   MessageBox (ScilabGC->hWndParent, MSG_ERROR77,
00435               ScilabGC->lpgw->Title, MB_ICONEXCLAMATION);
00436 
00437  errorcleanup:
00438   if (hmacro)
00439     {
00440       for (i = 0; i < NUMMENU; i++)
00441         {
00442           if (ScilabGC->lpmw.macro[i] != (BYTE *) 0)
00443             {
00444               LocalFree (ScilabGC->lpmw.macro[i]);
00445               ScilabGC->lpmw.macro[i] = (BYTE *) 0;
00446             }
00447         }
00448       GlobalUnlock (hmacro);
00449       GlobalFree (hmacro);
00450       ScilabGC->lpmw.macro = (BYTE **) NULL;
00451     }
00452 
00453  cleanup:
00454   if (buf != (char *) NULL)
00455     LocalFree (buf);
00456   if (menufile != (GFILE *) NULL)
00457     Gfclose (menufile);
00458   return;
00459 }

Here is the call graph for this function:

void NewFigure ( struct BCG ScilabGC  ) 

Definition at line 971 of file wgmenu.c.

References FindFreeGraphicWindow(), MAX_PATH, and StoreCommand1().

Referenced by SendGraphMacro().

00972 {
00973         
00974   char Command[MAX_PATH];
00975   int FreeWindow=0;
00976 
00977   FreeWindow=FindFreeGraphicWindow(ScilabGC);
00978   wsprintf(Command,"xset(\"window\",%d);",FreeWindow);
00979   StoreCommand1(Command,0);
00980         
00981 }

Here is the call graph for this function:

Here is the caller graph for this function:

void RefreshMenus ( struct BCG ScilabGC  ) 

Definition at line 1013 of file wgmenu.c.

References CloseGraphMacros(), CreateGedMenus(), and BCG::CurWindow.

01014 {
01015 
01016         int WinNum=ScilabGC->CurWindow;
01017         BOOL LockToolBar=ScilabGC->lpmw.LockToolBar;
01018         int nButton=ScilabGC->lpmw.nButton;
01019         BOOL StateToolBar=ScilabGC->lpmw.ShowToolBar;
01020 
01021         DestroyMenu(GetMenu(ScilabGC->hWndParent));
01022         ScilabGC->hMenuRoot=NULL;
01023         ScilabGC->IDM_Count=1;
01024         SetMenu(ScilabGC->hWndParent,NULL);
01025 
01026         CloseGraphMacros (ScilabGC);
01027         CreateGedMenus(ScilabGC);
01028 
01029         ScilabGC->lpmw.nButton=nButton;
01030         ScilabGC->lpmw.ShowToolBar=StateToolBar;
01031         ScilabGC->lpmw.LockToolBar=LockToolBar;
01032 
01033 }

Here is the call graph for this function:

static void SciChMenu ( LPMW  lpmw,
char *  name,
char *  new_name 
) [static]

static void SciDelMenu ( LPMW  lpmw,
char *  name 
) [static]

static void scig_command_scilabgc ( int  number,
void   f(struct BCG *) 
) [static]

void scig_export ( integer  number  ) 

Definition at line 926 of file wgmenu.c.

00927 {
00928   scig_command_scilabgc (number, SavePs);
00929 }

void scig_h_copyclip ( integer  number  ) 

Definition at line 911 of file wgmenu.c.

References CopyToClipboardEMF(), and scig_command_scilabgc().

Here is the call graph for this function:

void scig_h_copyclip1 ( integer  number  ) 

Definition at line 916 of file wgmenu.c.

References CopyToClipboardBitmap(), and scig_command_scilabgc().

Here is the call graph for this function:

void scig_print ( integer  number  ) 

Definition at line 921 of file wgmenu.c.

00922 {
00923   scig_command_scilabgc (number, PrintPs);
00924 }

void ScilabMenuAction ( char *  buf  ) 

Definition at line 197 of file wgmenu.c.

References C2F, F2C(), fbutn(), FREE, MALLOC, NULL, rep, setfbutn(), StoreCommand1(), and strchr().

00198 {
00199         if (strlen (buf) > 2 && buf[0] == '@')
00200         {
00202             if (buf[1] == '0')
00203                 {
00204                   /* Interpreted mode : we store the action on a queue */
00205                   StoreCommand1 (buf + 2, 0);
00206                 }
00207             else
00208                 {
00209                         /* hard coded mode */
00210                         int rep, win, entry;
00211                         char *tmp=NULL;
00212                         char *LocalBuf=(char*)MALLOC((strlen(buf)+1)*sizeof(char));
00213                         char *FunctionName=(char*)MALLOC((strlen(buf)+1)*sizeof(char));
00214                         wsprintf(LocalBuf,"%s",buf+strlen("@1")+strlen("execstr("));
00215                         /*remove last char ')' */
00216                         LocalBuf[strlen(LocalBuf)-1]='\0';
00217 
00218                         if ( ( tmp = strchr (LocalBuf, '_') ) != NULL )
00219                         {
00220                                 sscanf (tmp + 1, "%d(%d)", &win, &entry);
00221                                 entry--;
00222                                 strncpy(FunctionName,LocalBuf,strlen(LocalBuf)-strlen(tmp));
00223                                 *tmp = '\0';
00224                         }
00225                         else
00226                         {
00227                                 win = -1;
00228                                 if ((tmp = strchr (LocalBuf, '(')) != NULL)
00229                                 {
00230                                         char *tmpbis=NULL;
00231                                         sscanf (tmp, "(%d)", &entry);
00232                                         
00233                                         if ( ( tmpbis = strchr (LocalBuf, '(') ) != NULL )
00234                                         {
00235                                                 strncpy(FunctionName,LocalBuf,strlen(LocalBuf)-strlen(tmpbis));
00236                                         }
00237 
00238                                         entry--;
00239                                         *tmp = '\0';
00240                                 }
00241                         }
00242 
00243                         C2F (setfbutn) (FunctionName, &rep);
00244                         if (rep == 0)
00245                         {
00246                                 F2C (fbutn) (FunctionName, &(win), &(entry));
00247                         }
00248 
00249                         if (FunctionName) {FREE(FunctionName);FunctionName=NULL;}
00250                         if (LocalBuf) {FREE(LocalBuf);LocalBuf=NULL;}
00251                 }
00252         }
00253         else 
00254         {
00255                 if (buf[0] != '\0')
00256                 {
00258                         if (strlen (buf) == 1 && buf[0] <= 31 && buf[0] >= 1) 
00259                         {
00260                                 StoreCommand1 (buf, 0);
00261                         }
00262                         else
00263                         {
00264                                 StoreCommand1 (buf, 1);
00265                         }
00266                 }
00267         }
00268 }

Here is the call graph for this function:

static void SciSetMenu ( HMENU  hmen,
char *  name,
int  num,
int  flag 
) [static]

void SendGraphMacro ( struct BCG ScilabGC,
UINT  m 
)

Definition at line 38 of file wgmenu.c.

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 }

int C2F() setmen ( integer win_num,
char *  button_name,
integer entries,
integer ptrentries,
integer ne,
integer ierr 
)

activate a menu (scilab interface)

Definition at line 541 of file wgmenu.c.

References getWindowXgcNumber(), tagMW::hMenu, tagTW::hWndParent, tagTW::lpmw, SciSetMenu(), SetUnsetMenu(), and textwin.

00544 {
00545   struct BCG *ScilabGC;
00546   if (*win_num == -1)
00547     {
00548       SciSetMenu (textwin.lpmw->hMenu, button_name, *ne, MF_ENABLED);
00549       DrawMenuBar (textwin.hWndParent);
00550     }
00551   else
00552     {
00553       ScilabGC = getWindowXgcNumber (*win_num);
00554       if (ScilabGC != (struct BCG *) 0)
00555         {
00556           SciSetMenu (ScilabGC->lpmw.hMenu, button_name, *ne, MF_ENABLED);
00557           DrawMenuBar (ScilabGC->hWndParent);
00558         }
00559     }
00560   return (0);
00561 }

Here is the call graph for this function:

static void TranslateMacro ( char *  string  )  [static]

Definition at line 1064 of file wmenu.c.

01065 {
01066   int i, len;
01067   LPSTR ptr;
01068   for (i = 0; keyword[i] != (char *) NULL; i++)
01069     {
01070       if ((ptr = strstr (string, keyword[i])) != NULL)
01071         {
01072           len = lstrlen (keyword[i]);
01073           *ptr = keyeq[i];
01074           lstrcpy (ptr + 1, ptr + len);
01075           i--;                  /* allows for more than one occurrence of keyword */
01076         }
01077     }
01078 }

int C2F() unsmen ( integer win_num,
char *  button_name,
integer entries,
integer ptrentries,
integer ne,
integer ierr 
)

Definition at line 563 of file wgmenu.c.

References getWindowXgcNumber(), tagMW::hMenu, tagTW::hWndParent, tagTW::lpmw, SciSetMenu(), SetUnsetMenu(), and textwin.

00565 {
00566   struct BCG *ScilabGC;
00567   if (*win_num == -1)
00568     {
00569       SciSetMenu (textwin.lpmw->hMenu, button_name, *ne, MF_GRAYED);
00570       DrawMenuBar (textwin.hWndParent);
00571     }
00572   else
00573     {
00574       ScilabGC = getWindowXgcNumber (*win_num);
00575       if (ScilabGC != (struct BCG *) 0)
00576         {
00577           SciSetMenu (ScilabGC->lpmw.hMenu, button_name, *ne, MF_GRAYED);
00578           DrawMenuBar (ScilabGC->hWndParent);
00579         }
00580     }
00581   return (0);
00582 }

Here is the call graph for this function:

void UpdateFileGraphNameMenu ( struct BCG ScilabGC  ) 

Definition at line 931 of file wgmenu.c.

References tagMW::CodeLanguage, FALSE, FILEGRAPHMENUENGLISH, FILEGRAPHMENUFRENCH, FREE, GetScilabDirectory(), GetTextWinScilab(), IsWindowInterface(), tagTW::lpmw, MALLOC, MAX_PATH, and ScilexWindowName.

00932 {
00933 #define FILEGRAPHMENUFRENCH "wgscilabF.mnu"
00934 #define FILEGRAPHMENUENGLISH "wgscilabE.mnu"
00935   extern char ScilexWindowName[MAX_PATH];
00936   char *ScilabDirectory=NULL;
00937 
00938   HWND hWndTmpScilex=FindWindow(NULL,ScilexWindowName);
00939   int LangCode=0; /*English*/
00940 
00941   if (IsWindowInterface())
00942     {
00943       if (hWndTmpScilex)
00944         {
00945           LPTW lptw=GetTextWinScilab();
00946           LangCode=lptw->lpmw->CodeLanguage;
00947         }
00948       else LangCode=0;
00949     }
00950   else LangCode=0;
00951   ScilabGC->lpmw.CodeLanguage=LangCode;
00952 
00953   ScilabDirectory=GetScilabDirectory(FALSE);
00954         
00955   if (ScilabGC->lpgw->szMenuName!=NULL) FREE(ScilabGC->lpgw->szMenuName);
00956   ScilabGC->lpgw->szMenuName = (LPSTR) MALLOC (strlen (ScilabDirectory) +strlen("\\bin\\")+ strlen (FILEGRAPHMENUENGLISH) + 1);
00957         
00958   switch (LangCode)
00959   {
00960     case 1:
00961           wsprintf(ScilabGC->lpgw->szMenuName,"%s\\bin\\%s",ScilabDirectory, FILEGRAPHMENUFRENCH);
00962       break;
00963     default : case 0:
00964           wsprintf(ScilabGC->lpgw->szMenuName,"%s\\bin\\%s",ScilabDirectory, FILEGRAPHMENUENGLISH);
00965       break;
00966   }
00967 
00968   if (ScilabDirectory){FREE(ScilabDirectory);ScilabDirectory=NULL;}     
00969 }

Here is the call graph for this function:

int WGFindMenuPos ( BYTE **  macros  ) 

Definition at line 465 of file wgmenu.c.

References i, and NUMMENU.

00466 {
00467   int i;
00468   for (i = 0; i < NUMMENU; i++)
00469     {
00470       if (macros[i] == (BYTE *) 0)
00471         return (i);
00472     }
00473   return (NUMMENU);
00474 }

void write_scilab ( char *  buf  ) 

Definition at line 274 of file wgmenu.c.

References IsWindowInterface(), Write_Scilab_Console(), and Write_Scilab_Window().

00275 {
00276   if ( IsWindowInterface() ) Write_Scilab_Window(buf);
00277   else Write_Scilab_Console(buf);
00278   
00279 }

Here is the call graph for this function:


Variable Documentation

BYTE keyeq[] [static]

Initial value:

{
  TOOLBARGRAPH,NEWFIG,ZOOM, UNZOOM, ROT3D, PRINTSETUP,PRINT, COPYCLIP, COPYCLIP1,
  REDRAW, LOADSCG, SAVESCG, CLEARWG, SCIPS, SCIPR, SCIGSEL, UPDINI, EOS,
  CLOSE,
  13, 27, 9,
  1, 2, 3, 4, 5, 6, 7, 8,
  9, 10, 11, 12, 13, 14, 15, 16,
  17, 18, 19, 20, 21, 22, 23, 24,
  25, 26, 28, 29, 30, 31,
  0  }

Definition at line 89 of file wgmenu.h.

Referenced by TranslateMacro().

char* keyword[] [static]

Initial value:

{
  "[TOOLBARGRAPH]","[NEWFIG]","[ZOOM]", "[UNZOOM]", "[ROT3D]", "[PRINTSETUP]", "[PRINT]", "[COPYCLIP]", "[COPYCLIP1]",
  "[REDRAW]", "[LOADSCG]", "[SAVESCG]", "[CLEARWG]", "[SCIPS]", "[SCIPR]",
  "[SCIGSEL]", "[UPDINI]", "[EOS]", "[CLOSE]",
  "{ENTER}", "{ESC}", "{TAB}",
  "{^A}", "{^B}", "{^C}", "{^D}", "{^E}", "{^F}", "{^G}", "{^H}",
  "{^I}", "{^J}", "{^K}", "{^L}", "{^M}", "{^N}", "{^O}", "{^P}",
  "{^Q}", "{^R}", "{^S}", "{^T}", "{^U}", "{^V}", "{^W}", "{^X}",
  "{^Y}", "{^Z}", "{^[}", "{^\\}", "{^]}", "{^^}", "{^_}",
  NULL}

Definition at line 77 of file wgmenu.h.

Referenced by TranslateMacro().

TW textwin

keeps information for the current graphic window

Definition at line 8 of file TextWindows.c.


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