SGraph.c File Reference

#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include "sci_mem_alloc.h"
#include "GetProperty.h"
#include "DestroyObjects.h"
#include "SGraph.h"
#include "xs2file.h"
#include "Xcall1.h"
#include "WindowList.h"
#include "Actions.h"
#include "periWin.h"
#include "math.h"
#include "men_Sutils.h"
#include "men_scilab.h"
#include "All-extern.h"
#include "All-extern-x1.h"
#include "Events.h"

Include dependency graph for SGraph.c:

Go to the source code of this file.

Data Structures

struct  MenuData

Defines

#define DEFAULT_MES   "graphic window"
#define WINMINW   100
#define WINMINH   100
#define FDEBUG(x)
#define FDEBUG_EP1(x)

Typedefs

typedef struct MenuDataMenuDataPtr

Functions

int StoreCommand __PARAMS ((char *command))
char * getenv ()
int getpid ()
Widget initColors __PARAMS ((Widget))
Window GetBGWindowNumber __PARAMS ((int))
void DisplayInit __PARAMS ((char *string, Display **dpy, Widget *toplevel))
void ChangeBandF __PARAMS ((int win_num, Pixel fg, Pixel bg))
integer F2C (fbutn)
int IswmDeleteWindow (XEvent *event)
int IsCloseSGWindow (XEvent *event)
static void reset_click_counter (XtPointer ptr)
void btn_pressed (Widget widget, XEvent *event, String *params, Cardinal *num_params)
void btn_released (Widget widget, XEvent *event, String *params, Cardinal *num_params)
void ctrl_key (Widget widget, XEvent *event, String *params, Cardinal *num_params)
void key_pressed (Widget widget, XEvent *event, String *params, Cardinal *num_params)
void key_released (Widget widget, XEvent *event, String *params, Cardinal *num_params)
void mouse_moved (Widget widget, XEvent *event, String *params, Cardinal *num_params)
static int AddNewWin (int popupc, struct BCG *ScilabXgc)
void PannerCallback (Widget w, XtPointer scigc_ptr, XtPointer report_ptr)
void SciViewportMove (struct BCG *ScilabXgc, int x, int y)
void SciViewportGet (struct BCG *ScilabXgc, int *x, int *y)
void SciViewportClipGetSize (struct BCG *ScilabXgc, int *w, int *h)
void sci_pixmap_resize (struct BCG *Xgc, int x, int y)
void ViewportCallback (Widget w, XtPointer scigc_ptr, XtPointer report_ptr)
void SetBar (Widget w, Position top, Dimension length, Dimension total)
void RedrawThumbs (ViewportWidget w)
static void MoveChild (Widget viewp, Position x, Position y)
void GViewportResize (struct BCG *ScilabXgc, int *width, int *height)
void GPopupResize (struct BCG *ScilabXgc, int *width, int *height)
static void ignore_events (Widget widget, XEvent *event2, long mask)
static XtEventHandler EventProc1 (Widget widget, XtPointer number, XEvent *event)
static void Efface (Widget w, XtPointer number, XtPointer client_data)
static void Select (Widget w, XtPointer number, XtPointer client_data)
int get_xclick_client_message_flag (void)
static void Delete (Widget w, XtPointer number, XtPointer client_data)
int C2F() deletewin (integer *number)
static void Print (Widget w, XtPointer number, XtPointer client_data)
void scig_print (integer number)
static void SavePs (Widget w, XtPointer number, XtPointer client_data)
void scig_export (integer number)
static void Save (Widget w, XtPointer number, XtPointer client_data)
static void Load (Widget w, XtPointer number, XtPointer client_data)
static void Zoom (Widget w, XtPointer number, XtPointer client_data)
static void UnZoom (Widget w, XtPointer number, XtPointer client_data)
static void Rot3D (Widget w, XtPointer number, XtPointer client_data)
void SGDeleteWindow (Widget w, XEvent *event, String *params, Cardinal *num__PARAMS)
void CreatePopupWindow (integer WinNum, Widget button, struct BCG *ScilabXgc, Pixel *fg, Pixel *bg)
void ChangeBandF (int win_num, Pixel fg, Pixel bg)
static void ChangeBF1 (Widget w, char *str, Pixel fg, Pixel bg)
static void KillButton (Widget w, XtPointer client_data, caddr_t call_data)
static void SelMenu (Widget w, XtPointer client_data, caddr_t call_data)
int C2F() delbtn (integer *win_num, char *button_name)
void AddMenu (integer *win_num, char *button_name, char **entries, integer *ne, integer *typ, char *fname, integer *ierr)
int C2F() addmen (integer *win_num, char *button_name, integer *entries, integer *ptrentries, integer *ne, integer *typ, char *fname, integer *ierr)
static void SetUnsetMenu (integer *win_num, char *button_name, integer *ne, int flag)
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)
static int GetChilds (int win_num, int *nc, WidgetList *wL, Widget *outer, char *name, int *name_pos)
int getNbSubMenus (int winNumber, char *menuName)
void refreshMenus (struct BCG *ScilabGC)

Variables

XtAppContext app_con
static Bool wait_dclick = FALSE
static Bool dclick = FALSE
static Bool lose_up = FALSE
static long timerId
static XtActionsRec event_actions []
static String event_translations
static char bufname [256]
static char printer [128]
static char file [256]
static String sg_trans
Widget commandWindow


Define Documentation

#define DEFAULT_MES   "graphic window"

Definition at line 338 of file SGraph.c.

#define FDEBUG ( x   ) 

Definition at line 815 of file SGraph.c.

Referenced by ignore_events().

#define FDEBUG_EP1 ( x   ) 

Definition at line 844 of file SGraph.c.

Referenced by EventProc1().

#define WINMINH   100

Definition at line 695 of file SGraph.c.

Referenced by GPopupResize(), and GViewportResize().

#define WINMINW   100

used when we resize the graphic window (i.e the drawbox) at Scilab level

Definition at line 694 of file SGraph.c.

Referenced by GPopupResize(), and GViewportResize().


Typedef Documentation

typedef struct MenuData* MenuDataPtr


Function Documentation

void ChangeBandF __PARAMS ( (int win_num, Pixel fg, Pixel bg)   ) 

void DisplayInit __PARAMS ( (char *string, Display **dpy, Widget *toplevel  ) 

Window GetBGWindowNumber __PARAMS ( (int  ) 

Widget initColors __PARAMS ( (Widget)   ) 

int StoreCommand __PARAMS ( (char *command  ) 

int C2F() addmen ( integer win_num,
char *  button_name,
integer entries,
integer ptrentries,
integer ne,
integer typ,
char*  fname,
integer ierr 
)

Definition at line 1634 of file SGraph.c.

References AddMenu(), FREE, i, ierr, NULL, and ScilabMStr2CM().

01637 {
01638   char ** menu_entries = NULL ;
01639   int i ;
01640   *ierr =0;
01641   if (*ne!=0) {
01642     ScilabMStr2CM(entries,ne,ptrentries,&menu_entries,ierr);
01643     if ( *ierr == 1) return(0);
01644   }
01645   AddMenu(win_num,button_name,menu_entries,ne,typ,fname,ierr);
01646   /* ScilabMStr2CM allocate menu_entries */
01647   for ( i = 0 ; i  < *ne ; i++ )
01648   {
01649     FREE( menu_entries[i] ) ;
01650   }
01651   FREE( menu_entries ) ;
01652   return(0);
01653 }

Here is the call graph for this function:

void AddMenu ( integer win_num,
char *  button_name,
char **  entries,
integer ne,
integer typ,
char *  fname,
integer ierr 
)

Definition at line 1512 of file SGraph.c.

References args, command, commandWidgetClass, MenuData::entry, FALSE, MenuData::fname, GetChilds(), height, i, iargs, KillButton(), MALLOC, menuButtonWidgetClass, nc, NULL, SelMenu(), simpleMenuWidgetClass, smeBSBObjectClass, MenuData::type, w, width, MenuData::win_num, x, XtNfont, XtNfromHoriz, and XtNfromVert.

Referenced by addmen(), CreateGedMenus(), initgraphic(), and test_menu().

01520 {  
01521   int newline,i;
01522   WidgetList childs;
01523   Widget outer,command,w,menu,entry;
01524   Position x;
01525   Dimension width,height,mainwidth,mainheight,bw=0;
01526   XFontStruct     *temp_font;
01527   char *func;
01528   MenuDataPtr datas;
01529   int nc, name_pos;
01530   if (GetChilds(*win_num,&nc,&childs,&outer,NULL,&name_pos)== FALSE) return;
01531   if ( nc < 2 ) return ; 
01532   iargs=0;
01533   XtSetArg(args[iargs], XtNx,&x);             iargs++;
01534   XtSetArg(args[iargs], XtNwidth,&width);     iargs++;
01535   XtSetArg(args[iargs], XtNheight,&height);     iargs++;
01536   XtSetArg(args[iargs], XtNfont, &temp_font);  iargs++;
01537   XtGetValues(childs[nc-1], args, iargs);
01538   iargs=0;
01539   XtSetArg(args[iargs], XtNwidth,&mainwidth);       iargs++;
01540   XtSetArg(args[iargs], XtNheight,&mainheight);       iargs++;
01541   XtGetValues(outer, args, iargs);
01542 
01543   bw= ( temp_font != NULL )? strlen(button_name)*((temp_font)->max_bounds.width) : 0;
01544   if ( (Dimension) (width+bw+x)  < mainwidth)
01545     {
01547       newline=0;
01548       iargs=0;
01549       XtSetArg(args[iargs], XtNfromVert,&w);  iargs++;
01550       XtGetValues(childs[nc-1], args, iargs);
01551       iargs=0;
01552       XtSetArg(args[iargs], XtNfromHoriz,childs[nc-1]);  iargs++;
01553       XtSetArg(args[iargs], XtNfromVert,w);  iargs++;
01554     }
01555   else
01556     {
01558       newline=1;
01559       iargs=0;
01560       XtSetArg(args[iargs], XtNfromVert,childs[nc-1]);  iargs++;
01561       XtSetArg(args[iargs], XtNfromHoriz,childs[0]);  iargs++;
01562     }
01563 
01564   func=(char *) MALLOC( (strlen(fname)+1)*(sizeof(char)));
01565   if ( func == ( char *) 0 ) 
01566     {
01567       *ierr=1 ;return;
01568     }
01569   strcpy(func,fname);
01570 
01571   XtSetArg(args[iargs], XtNheight,height);     iargs++;
01572   if (*ne==0) {
01573     command = XtCreateManagedWidget(button_name,
01574                                     commandWidgetClass,outer,args, iargs);
01575     datas= (MenuDataPtr) MALLOC(sizeof(MenuData) );
01576     if ( datas == (MenuDataPtr) 0) 
01577       {
01578         *ierr=1 ;return;
01579       }
01580     datas->win_num= *win_num;
01581     datas->entry=0;
01582     datas->type=*typ;
01583     datas->fname=func;
01584     XtAddCallback(command, XtNcallback,(XtCallbackProc) SelMenu,
01585                   (XtPointer)datas);
01586     XtAddCallback(command, XtNdestroyCallback,(XtCallbackProc) KillButton,
01587                   (XtPointer)datas);
01588   }
01589   else {
01590     command = XtCreateManagedWidget(button_name,
01591                                     menuButtonWidgetClass,outer,args, iargs);
01592     iargs=0;
01593     menu = XtCreatePopupShell("menu", simpleMenuWidgetClass, 
01594                               command,args, iargs);
01595     for (i=0;i<*ne;i++){
01596       iargs=0;
01597       entry= XtCreateManagedWidget(entries[i], smeBSBObjectClass, menu,
01598                                    args, iargs);
01599       datas= (MenuDataPtr) MALLOC(sizeof(MenuData) );
01600       if ( datas == (MenuDataPtr) 0) 
01601         {
01602           *ierr=1 ;return;
01603         }
01604       datas->win_num = *win_num;
01605       datas->entry=i;
01606       datas->type=*typ;
01607       datas->fname=func;
01608       XtAddCallback(entry,XtNcallback,(XtCallbackProc)SelMenu, 
01609                     (XtPointer)datas);
01610       XtAddCallback(entry, XtNdestroyCallback,(XtCallbackProc) KillButton,
01611                     (XtPointer)datas);
01612     }
01613   }
01614   if (newline==1) {
01615     /* here we should increase the height of scigmForm */
01616   }
01617 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int AddNewWin ( int  popupc,
struct BCG ScilabXgc 
) [static]

Definition at line 340 of file SGraph.c.

References AddNewMenu(), args, boxWidgetClass, BCG::CinfoW, commandWidgetClass, Delete(), demo_menu_activate, BCG::drawbox, Efface(), EventProc1(), formWidgetClass, iargs, initColors(), labelWidgetClass, Load(), load, menuButtonWidgetClass, NULL, panedWidgetClass, BCG::Panner, PannerCallback(), pannerWidgetClass, BCG::popup, Print(), Rot3D(), Save(), SavePs(), ScilabXgc, Select(), simpleMenuWidgetClass, smeBSBObjectClass, UnZoom(), BCG::Viewport, ViewportCallback(), viewportWidgetClass, XtNlabel, XtNreportCallback, ZERO, and Zoom().

Referenced by CreatePopupWindow().

00341 {
00342   Widget bbox,color;
00343   Widget outer,zoom_,rot3d,unzoom_,sel,menuform;
00344   Widget filebutton,filemenu,clear,prnt,save,load,delete,saveps;
00345 
00346   iargs=0;
00347   /* eventually add a box to check for visual type */
00348   color = initColors(ScilabXgc->popup); 
00349   outer = XtCreateManagedWidget( "scigForm", panedWidgetClass,
00350                                  color,
00351                                  args, iargs);
00352 
00354   iargs = 0;
00355   menuform = XtCreateManagedWidget( "scigmForm", formWidgetClass,outer,
00356                                   args, iargs);
00357 
00358   ScilabXgc->Panner = XtCreateManagedWidget("Panner", pannerWidgetClass, 
00359                                  menuform , NULL, ZERO);
00360 
00361   iargs=0;
00362   XtSetArg(args[iargs], XtNlabel," ");iargs++;
00363   ScilabXgc->CinfoW = XtCreateManagedWidget("scigraphicinfo",labelWidgetClass, 
00364                                      menuform, args, iargs);
00365 
00367   /* Menu File */
00368   iargs=0;
00369   filebutton = XtCreateManagedWidget("File",
00370                                   menuButtonWidgetClass,menuform,args, iargs);
00371   iargs=0;
00372   filemenu = XtCreatePopupShell("menu", simpleMenuWidgetClass, 
00373                             filebutton,args, iargs);
00374   iargs=0;
00375   clear = XtCreateManagedWidget("Clear", smeBSBObjectClass,filemenu,args, iargs);
00376   XtAddCallback(clear, XtNcallback,(XtCallbackProc) Efface,(XtPointer) popupc); 
00377   sel = XtCreateManagedWidget("Select", smeBSBObjectClass,filemenu,args, iargs);
00378   XtAddCallback(sel, XtNcallback,(XtCallbackProc) Select,(XtPointer) popupc); 
00379   prnt = XtCreateManagedWidget("Print", smeBSBObjectClass,filemenu,args, iargs);
00380   XtAddCallback(prnt, XtNcallback,(XtCallbackProc)  Print,(XtPointer) popupc);
00381   saveps = XtCreateManagedWidget("Export", smeBSBObjectClass,filemenu,args, iargs);
00382   XtAddCallback(saveps, XtNcallback,(XtCallbackProc)  SavePs,(XtPointer)popupc);
00383   save = XtCreateManagedWidget("Save", smeBSBObjectClass,filemenu,args, iargs);
00384   XtAddCallback(save, XtNcallback,(XtCallbackProc)  Save,(XtPointer)popupc);
00385   load = XtCreateManagedWidget("Load", smeBSBObjectClass,filemenu,args, iargs);
00386   XtAddCallback(load, XtNcallback,(XtCallbackProc)  Load,(XtPointer)popupc);
00387   delete = XtCreateManagedWidget("Close", smeBSBObjectClass,filemenu,args, iargs);
00388   XtAddCallback(delete, XtNcallback,(XtCallbackProc)  Delete,(XtPointer)popupc);
00389   
00390   /* Other buttons */
00391   zoom_ = XtCreateManagedWidget("Zoom", commandWidgetClass,menuform,args, iargs);
00392   XtAddCallback(zoom_, XtNcallback,(XtCallbackProc)  Zoom,
00393                 (XtPointer) popupc);
00394   unzoom_ = XtCreateManagedWidget("UnZoom", commandWidgetClass,menuform,args, iargs);
00395   XtAddCallback(unzoom_, XtNcallback,(XtCallbackProc)  UnZoom,
00396                 (XtPointer) popupc);
00397   rot3d = XtCreateManagedWidget("Rot3D", commandWidgetClass,menuform,args, iargs);
00398   XtAddCallback(rot3d, XtNcallback,(XtCallbackProc) Rot3D,
00399                 (XtPointer) popupc);
00400 
00403   iargs =0;
00404 
00405   ScilabXgc->Viewport = XtCreateManagedWidget("graphicviewport",viewportWidgetClass,outer,args,iargs);
00406 
00407   bbox= XtCreateManagedWidget("bbox",boxWidgetClass,ScilabXgc->Viewport, args, iargs);
00408 
00409   /* I use a label in order to have foreground and background */
00410   iargs=0;
00411   XtSetArg(args[iargs], XtNlabel," ");iargs++;
00412   ScilabXgc->drawbox= XtCreateManagedWidget("scigraphic",labelWidgetClass,bbox, args, iargs);
00413 
00414   /* EventProc Must select the client Message Events */
00415 
00416   XtAddEventHandler(ScilabXgc->drawbox, ExposureMask| StructureNotifyMask,
00417                     False,
00418                     (XtEventHandler) EventProc1,
00419                     (XtPointer) popupc);  
00420 
00421   /* even if EventProc is unused by xclick or xgetmouse : the next line 
00422      set the proper mask for the drawbox window and this is necessary for 
00423      xclick and xgetmouse to work. Moreover this EventHandler keeps the 
00424      queue of unused events ok 
00425   */
00426 
00427   /* XtAddEventHandler(ScilabXgc->drawbox, 
00428                     ButtonPressMask|PointerMotionMask|ButtonReleaseMask|
00429                     KeyPressMask|KeyReleaseMask,False,
00430                     (XtEventHandler) EventProc, (XtPointer) popupc); */
00431 
00432   XtOverrideTranslations(ScilabXgc->drawbox,
00433                  XtParseTranslationTable(event_translations));
00434   XtAppAddActions(app_con, event_actions, XtNumber(event_actions));
00435 
00438   XtAddCallback( ScilabXgc->Viewport,
00439                 XtNreportCallback, ViewportCallback, (XtPointer) ScilabXgc);
00440   XtAddCallback(ScilabXgc->Panner, 
00441                 XtNreportCallback, PannerCallback, (XtPointer) ScilabXgc);
00442 
00443   /* For Graphic demo */
00444   if ( demo_menu_activate == 1 )  AddNewMenu(outer,ScilabXgc->drawbox);
00445   return(0);
00446 }

Here is the call graph for this function:

Here is the caller graph for this function:

void btn_pressed ( Widget  widget,
XEvent *  event,
String *  params,
Cardinal *  num_params 
)

Definition at line 152 of file SGraph.c.

References FALSE, GetEventWindow(), NULL, PushClickQueue(), reset_click_counter(), and TRUE.

00153 {
00154   
00155   /* The following instruction has been commented out not to lose btn_pressed 
00156      emited just before an xclick or xgemouse call
00157     if (!get_wait_click()) return;
00158   */
00159 
00160   if (wait_dclick) {
00161    /* If we are waiting for a double-click, we only handle Button events
00162       in a special fashion.*/
00163       wait_dclick = FALSE;
00164       dclick = TRUE;
00165       lose_up = FALSE;
00166       XtRemoveTimeOut (timerId);
00167       return;
00168  }
00169   timerId = XtAppAddTimeOut(app_con, MultiClickTime,
00170                              (XtTimerCallbackProc) reset_click_counter, (XtPointer) NULL);
00171   wait_dclick = TRUE;
00172   lose_up = FALSE;
00173   dclick = FALSE;
00174 
00175   /*Wait until wait_dclick becomes FALSE 
00176     - either because of two consecutive btn press
00177     - either because of timeout 
00178     - either because of a mouse move  */
00179   do {
00180     if (XtAppPending (app_con))
00181       XtAppProcessEvent (app_con, XtIMAll);
00182   }  while (wait_dclick); 
00183 
00184   /* So here, dclick&lose_up have correct values.*/
00185 
00186   if (dclick ) { /* double click detected [10 11 12]*/
00187      PushClickQueue(GetEventWindow(event),event->xbutton.x,
00188                      event->xbutton.y,
00189                      event->xbutton.button-1+10,0,0);
00190   }
00191   else  {
00192     if  (lose_up) { /* simple click detected [3 4 5]*/
00193       if (params[0][0]=='0')
00194         PushClickQueue(GetEventWindow(event),event->xbutton.x,
00195                        event->xbutton.y,
00196                        event->xbutton.button-1+3,0,0);
00197       else if (params[0][0]=='1') /*shift press*/
00198         PushClickQueue(GetEventWindow(event),event->xbutton.x,
00199                        event->xbutton.y,
00200                        event->xbutton.button-1+3+2000,0,0);
00201       else if (params[0][0]=='2') /*ctrl press*/
00202         PushClickQueue(GetEventWindow(event),event->xbutton.x,
00203                        event->xbutton.y,
00204                        event->xbutton.button-1+3+1000,0,0);
00205 
00206       lose_up = FALSE;
00207       
00208     }
00209     else { /* button pressed detected [0 1 2]*/
00210       if (params[0][0]=='0')
00211         PushClickQueue(GetEventWindow(event),event->xbutton.x,
00212                        event->xbutton.y,
00213                        event->xbutton.button-1,0,0);
00214       else if (params[0][0]=='1') /*shift press*/
00215         PushClickQueue(GetEventWindow(event),event->xbutton.x,
00216                        event->xbutton.y,
00217                        event->xbutton.button-1+2000,0,0);
00218       else if (params[0][0]=='2') /*ctrl press*/
00219         PushClickQueue(GetEventWindow(event),event->xbutton.x,
00220                        event->xbutton.y,
00221                        event->xbutton.button-1+1000,0,0);
00222 
00223     }
00224    
00225  }
00226 
00227 
00228 
00229 }

Here is the call graph for this function:

void btn_released ( Widget  widget,
XEvent *  event,
String *  params,
Cardinal *  num_params 
)

Definition at line 232 of file SGraph.c.

References GetEventWindow(), PushClickQueue(), and TRUE.

00233 {
00234   if (wait_dclick) {
00235     lose_up = TRUE;
00236     return;
00237   }
00238   if (dclick)  return;
00239  /* button released detected [-5 -4 -3]*/
00240   PushClickQueue(GetEventWindow(event),event->xbutton.x,
00241                  event->xbutton.y,
00242                  event->xbutton.button-6,0,1);
00243 }

Here is the call graph for this function:

void ChangeBandF ( int  win_num,
Pixel  fg,
Pixel  bg 
)

Definition at line 1313 of file SGraph.c.

References ChangeBF1(), DisplayInit(), dpy, getWindowXgcNumber(), NULL, BCG::popup, and toplevel.

Referenced by set_default_colormap3(), and setcolormap3().

01317 {
01318   struct BCG *SciGc;
01319   Widget popup,toplevel;
01320   static Display *dpy = (Display *) NULL;
01321   DisplayInit("",&dpy,&toplevel);
01322   SciGc = getWindowXgcNumber(win_num);
01323   if ( SciGc != NULL ) 
01324     {
01325       popup = SciGc->popup;
01326       if (popup == NULL) return;
01327       ChangeBF1(popup,"*.scigForm.scigmForm.File",fg,bg);
01328       ChangeBF1(popup,"*.scigForm.scigmForm.File.menu",fg,bg);
01329       ChangeBF1(popup,"*.scigForm.scigmForm.File.menu.Clear",fg,bg);
01330       ChangeBF1(popup,"*.scigForm.scigmForm.File.menu.Select",fg,bg);
01331       ChangeBF1(popup,"*.scigForm.scigmForm.File.menu.Print",fg,bg);
01332       ChangeBF1(popup,"*.scigForm.scigmForm.File.menu.Export",fg,bg);
01333       ChangeBF1(popup,"*.scigForm.scigmForm.File.menu.Save",fg,bg);
01334       ChangeBF1(popup,"*.scigForm.scigmForm.File.menu.Load",fg,bg);
01335       ChangeBF1(popup,"*.scigForm.scigmForm.File.menu.Close",fg,bg);
01336       ChangeBF1(popup,"*.scigForm.scigmForm.Zoom",fg,bg);
01337       ChangeBF1(popup,"*.scigForm.scigmForm.UnZoom",fg,bg);
01338       ChangeBF1(popup,"*.scigForm.scigmForm.Rot3D",fg,bg);
01339     }
01340 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ChangeBF1 ( Widget  w,
char *  str,
Pixel  fg,
Pixel  bg 
) [static]

Definition at line 1342 of file SGraph.c.

References args, iargs, NULL, sciprint(), and XtNforeground.

01347 {
01348   Widget loc;
01349   loc = XtNameToWidget(w,str);
01350   if ( loc != NULL)  
01351     {
01352       iargs=0;
01353       XtSetArg(args[iargs], XtNforeground, fg); iargs++;
01354       XtSetArg(args[iargs], XtNbackground, bg); iargs++;
01355       XtSetValues(loc, args, iargs);
01356     }
01357   else
01358     {
01359       sciprint("widget %s not found\r\n",str);
01360     }
01361 }

Here is the call graph for this function:

void CreatePopupWindow ( integer  WinNum,
Widget  button,
struct BCG ScilabXgc,
Pixel fg,
Pixel bg 
)

Definition at line 1260 of file SGraph.c.

References AddNewWin(), args, BCG::CBGWindow, BCG::CWindow, DisplayInit(), dpy, BCG::drawbox, iargs, BCG::popup, ScilabXgc, toplevel, topLevelShellWidgetClass, x_bg_color, x_fg_color, and XtNforeground.

Referenced by initgraphic().

01261 {
01262   Widget toplevel;
01263   Display *dpy;
01264   XColor x_fg_color,x_bg_color;
01265   static XSetWindowAttributes attributes;
01266   unsigned char winname[6];
01267   iargs=0;
01268   XtSetArg(args[iargs], XtNx, 100+20*WinNum % 200);     iargs++;
01269   XtSetArg(args[iargs], XtNy, 100+20*WinNum % 200);     iargs++;
01270   sprintf(popupname,"ScilabGraphic%d",(int)WinNum);
01271   XtSetArg(args[iargs],XtNtitle,popupname);iargs++;
01272   
01273   DisplayInit("",&dpy,&toplevel);
01274   MultiClickTime=XtGetMultiClickTime(dpy);
01275 
01276   /* 
01277   ScilabXgc->popup = XtCreatePopupShell(popupname,
01278                              topLevelShellWidgetClass, button, args, iargs); 
01279                              */
01280   ScilabXgc->popup = XtAppCreateShell("Xscilab",popupname,topLevelShellWidgetClass,dpy,
01281                                       args,iargs);
01282   AddNewWin((int) WinNum,ScilabXgc);
01283   XtPopup(ScilabXgc->popup, XtGrabNone);
01284   SetHints(ScilabXgc->popup);
01285   
01286   sprintf((char *)winname,"BG%d",(int)WinNum);
01287   XChangeProperty(XtDisplay(ScilabXgc->drawbox),
01288                   XtWindow(ScilabXgc->drawbox), XA_WM_NAME, XA_STRING, 8, 
01289                   PropModeReplace, winname, 5);
01290   attributes.backing_store = Always;
01291   attributes.bit_gravity = NorthWestGravity;
01292   XChangeWindowAttributes(XtDisplay((ScilabXgc->drawbox)), 
01293                           XtWindow((ScilabXgc->drawbox)),
01294                           CWBackingStore | CWBitGravity,&attributes);
01295   XSync(XtDisplay(ScilabXgc->popup),0);
01296   ScilabXgc->CWindow=XtWindow(ScilabXgc->drawbox);
01297   ScilabXgc->CBGWindow=XtWindow(ScilabXgc->popup);
01298   XtOverrideTranslations(ScilabXgc->popup, XtParseTranslationTable(sg_trans));
01299   /*  Getting the values of foreground and background */
01300   XtSetArg(args[0],XtNforeground, &x_fg_color.pixel);
01301   XtSetArg(args[1],XtNbackground, &x_bg_color.pixel);
01302   XtGetValues(ScilabXgc->drawbox,args,2);
01303   *fg = x_fg_color.pixel;
01304   *bg = x_bg_color.pixel;
01305 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ctrl_key ( Widget  widget,
XEvent *  event,
String *  params,
Cardinal *  num_params 
)

Definition at line 246 of file SGraph.c.

References buf, compose_status, GetEventWindow(), NULL, and PushClickQueue().

00247 {
00248   char buf[10];
00249   int ten=10;
00250   KeySym keysym;
00251   XComposeStatus compose_status = {NULL, 0};
00252   XLookupString((XKeyEvent *)&(event->xkey), buf, 
00253                 ten, &keysym,&compose_status);
00254   /* <Ctrl> key  detected return  )keysym+1000 */
00255   PushClickQueue(GetEventWindow(event),event->xkey.x,
00256                  event->xkey.y,(int)keysym+1000,0,0);
00257 }

Here is the call graph for this function:

int C2F() delbtn ( integer win_num,
char *  button_name 
)

Definition at line 1443 of file SGraph.c.

References args, FALSE, GetChilds(), h, i, iargs, int, nc, NULL, pos, v, w, XawChainTop, XtNbottom, XtNfromHoriz, XtNfromVert, and XtNtop.

01446 {  
01447   int nc=0;
01448   WidgetList childs;
01449   Widget outer,h,v,w;
01450   int i,pos=0;
01451   int name_pos ;
01452 
01453   if (GetChilds(*win_num,&nc,&childs,&outer,button_name,&name_pos)== FALSE)
01454     return 0;
01455   if (name_pos  == -1 ) return 0; /* button_name not found */
01456   /* position in widget list */
01457   pos = name_pos +1;
01458   if ( pos==(int)nc ) 
01459     {
01460       /* button_name is the  last button : simply destroy it */
01461       XtDestroyWidget(childs[name_pos]);
01462       return 0;
01463     }
01464   iargs=0;
01465   XtSetArg(args[iargs], XtNfromHoriz,&h);    iargs++;
01466   XtSetArg(args[iargs], XtNfromVert,&v);     iargs++;
01467   XtGetValues(childs[pos-1], args, iargs);
01468   /* reconstruct next widget layout */
01469   iargs=0;
01470   XtSetArg(args[iargs], XtNfromHoriz,h);    iargs++;
01471   XtSetArg(args[iargs], XtNtop,XawChainTop); iargs++;
01472   XtSetArg(args[iargs], XtNbottom,XawChainTop); iargs++;
01473   XtSetValues(childs[pos], args, iargs);
01474 
01475   if (v!=NULL) {
01476     iargs=0;
01477     XtSetArg(args[iargs], XtNfromVert,v);    iargs++;
01478     XtSetArg(args[iargs], XtNtop,XawChainTop); iargs++;
01479     XtSetArg(args[iargs], XtNbottom,XawChainTop); iargs++;
01480     XtSetValues(childs[pos], args, iargs);
01481     for (i=pos+1;i<(int)nc;i++) {
01482       iargs=0;
01483       XtSetArg(args[iargs], XtNfromVert,&w);     iargs++;
01484       XtGetValues(childs[i], args, iargs);
01485       if (w== childs[pos-1]) {
01486         iargs=0;
01487         XtSetArg(args[iargs], XtNfromVert,v);     iargs++;
01488         XtSetArg(args[iargs], XtNtop,XawChainTop); iargs++;
01489         XtSetArg(args[iargs], XtNbottom,XawChainTop); iargs++;
01490         XtSetValues(childs[i], args, iargs);
01491       }
01492     }
01493   }
01494   /* destroy widget */
01495   if ( childs[pos-1] != NULL)
01496     XtDestroyWidget(childs[pos-1]);
01497   return(0);
01498 }

Here is the call graph for this function:

static void Delete ( Widget  w,
XtPointer  number,
XtPointer  client_data 
) [static]

Definition at line 978 of file SGraph.c.

References delete_sgwin_entities(), DeleteObjs(), DeleteSGWin(), Efface(), get_delete_win_mode(), get_xclick_client_message_flag(), PushClickQueue(), scig_deletegwin_handler, and wininfo().

Referenced by AddNewWin(), deletewin(), f_clos(), and SGDeleteWindow().

00979 {
00980   int v_flag = 1;
00981   integer win_num = (integer) number ;
00982   if (  get_delete_win_mode() == 1 )
00983     {
00984       wininfo("Cannot destroy window while acquiring zoom rectangle ");
00985       return;
00986     }
00987   if ( get_xclick_client_message_flag() == 1 ) 
00988     {
00989       /* the client message is only used while waiting for 
00990        * a mouse click 
00991        */
00992       PushClickQueue(win_num,0,0,-100,0,0);
00993     }
00995   Efface((Widget) 0,(XtPointer) number, (XtPointer) 0);
00996   DeleteObjs(win_num);
00997   v_flag = 0;
00998   scig_deletegwin_handler(win_num);
00999   DeleteSGWin(win_num); /* Here we 1) destroy the ScilabXgc (set to NULL) if it is the last window in the list */
01000                         /*         2) or reset the ScilabXgc to the next one see DeleteSGWin*/
01001 
01002   /* So, we use another flag named v_flag :*/
01003   delete_sgwin_entities(win_num);
01004 }

Here is the call graph for this function:

Here is the caller graph for this function:

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:

static void Efface ( Widget  w,
XtPointer  number,
XtPointer  client_data 
) [static]

Definition at line 921 of file SGraph.c.

References scig_erase().

Referenced by AddNewWin(), and Delete().

00925 {
00926   integer win_num = (integer) number ;
00927   scig_erase(win_num);
00928 }

Here is the call graph for this function:

Here is the caller graph for this function:

static XtEventHandler EventProc1 ( Widget  widget,
XtPointer  number,
XEvent *  event 
) [static]

Definition at line 849 of file SGraph.c.

References BCG::Cdrawable_flag, FDEBUG_EP1, getWindowXgcNumber(), ignore_events(), scig_expose(), and scig_resize().

Referenced by AddNewWin().

00850 {
00851   XEvent event2;
00852   integer win_num= (integer) number;
00853   XExposeEvent *event1;
00854 #ifdef EP1DEBUG
00855   static int counter=0;
00856   counter++;
00857 #endif 
00858   switch (event->type) 
00859     {
00860     case Expose :
00862       event1= (XExposeEvent *) event;
00863       /* 
00864          FDEBUG_EP1((stderr,"EventProc1: Expose: count %d x %d y %d width %d height %d\n",
00865          event1->count ,event1->x,event1->y,event1->width,event1->height));
00866       */
00867       if ( event1->count == 0) 
00868         {
00869           struct BCG *SciGc =  getWindowXgcNumber(win_num );
00870           if ( SciGc->Cdrawable_flag ==  1) 
00871             {
00872               FDEBUG_EP1((stderr,"EventProc1: Expose: --> scig_resize %d \r\n",counter)); 
00873               SciGc->Cdrawable_flag = 0;
00874               scig_resize(win_num);
00875             }
00876           else 
00877             {
00878               FDEBUG_EP1((stderr,"EventProc1: Expose: --> scig_expose %d \r\n",counter)); 
00879               scig_expose(win_num);
00880             }
00881           ignore_events(widget,&event2, ExposureMask | StructureNotifyMask) ;
00882         }
00883       break;
00884     case VisibilityNotify :
00885       /* We should get there only if server does not performs save_under */
00886       FDEBUG_EP1((stderr,"EventProc1: VisibilityNotify\n"));
00887       break;
00888     case ConfigureNotify :
00889       FDEBUG_EP1((stderr,"EventProc1: ConfigureNotify %d \n",counter));
00890       scig_resize(win_num);
00892       ignore_events(widget,&event2, ExposureMask | StructureNotifyMask);
00893       break; 
00894     case CreateNotify  :
00895       FDEBUG_EP1((stderr,"EventProc1: CreateNotify\r\n",counter));
00896       break ;
00897     case MapNotify : 
00898       FDEBUG_EP1((stderr,"EventProc1: MapNotify\r\n",counter)); 
00900       ignore_events(widget,&event2, ExposureMask );
00901       break;
00902     case ReparentNotify :
00903       FDEBUG_EP1((stderr,"EventProc1: ReparentNotify\r\n"));
00904       break;
00905     default:
00906       FDEBUG_EP1((stderr,"EventProc1: default, event=%d window=%d\r\n",event->type,(int) win_num));
00907       return(0);
00908     }
00909   return(0);
00910 }

Here is the call graph for this function:

Here is the caller graph for this function:

integer F2C ( fbutn   ) 

Definition at line 47 of file SGraph.c.

00096 {
00097  XSizeHints             size_hints;
00098  size_hints.width       = 600;
00099  size_hints.height      = 400;
00100  size_hints.min_width   = 400;
00101  size_hints.min_height  = 300;
00102  size_hints.flags =  USSize | PMinSize;
00103  XSetNormalHints(XtDisplay(topW),XtWindow(topW), &size_hints);
00104  /*
00105   *  Add a protocol flag indicating we wish to handle
00106   *  WM_DELETE_WINDOW requests (in fact we ignore it)
00107   */
00108  wmDeleteWindow = XInternAtom(XtDisplay(topW), "WM_DELETE_WINDOW", False);
00109  XSetWMProtocols(XtDisplay(topW),XtWindow(topW),&wmDeleteWindow, 1);
00111  Close_SG_Window_Activated = XInternAtom(XtDisplay(topW), 
00112                                          "SCI_DELETE_WINDOW", False);
00113 }

int get_xclick_client_message_flag ( void   ) 

Definition at line 437 of file periX11.c.

Referenced by Delete().

00437 { return client_message;}

Here is the caller graph for this function:

static int GetChilds ( int  win_num,
int nc,
WidgetList *  wL,
Widget *  outer,
char *  name,
int name_pos 
) [static]

Definition at line 1737 of file SGraph.c.

References args, DisplayInit(), dpy, FALSE, getWindowXgcNumber(), i, iargs, int, label, NULL, BCG::popup, toplevel, TRUE, and XtNlabel.

Referenced by AddMenu(), delbtn(), getNbSubMenus(), and SetUnsetMenu().

01744 { 
01745   Cardinal nc1=0;
01746   Widget popup,toplevel;
01747   char * label;
01748   static Display *dpy = (Display *) NULL;
01749   DisplayInit("",&dpy,&toplevel);
01750   if ( win_num == -1) 
01751     {
01752       *outer = commandWindow;
01753     }
01754   else 
01755     {
01756       struct BCG *SciGc;
01757       SciGc = getWindowXgcNumber(win_num);
01758       if ( SciGc ==  NULL ) return FALSE;
01759       if ((popup = SciGc->popup)== NULL) return FALSE;
01760       *outer=XtNameToWidget(popup,"*.scigForm.scigmForm");
01761       if (*outer == NULL) return FALSE;
01762     }
01763   iargs=0;
01764   XtSetArg(args[iargs], XtNnumChildren, &nc1);    iargs++;
01765   XtSetArg(args[iargs], XtNchildren, wL);   iargs++;
01766   XtGetValues(*outer, args, iargs);
01767   *nc=nc1;
01768   *name_pos = -1;
01769   if ( name != NULL) 
01770     {
01771       int i;
01772       for (i=0; i < (int)nc1;i++) 
01773         {
01774           iargs=0;
01775           label=NULL;
01776           XtSetArg(args[iargs], XtNlabel,&label);   iargs++;
01777           XtGetValues( (*wL)[i], args, iargs);
01778           if ( label != NULL && (strcmp(label,name)==0))
01779             {
01780               *name_pos = i;
01781               break;
01782             }
01783         }
01784     }
01785   return TRUE;
01786 }

Here is the call graph for this function:

Here is the caller graph for this function:

char* getenv (  ) 

getpid

int getNbSubMenus ( int  winNumber,
char *  menuName 
)

Definition at line 1791 of file SGraph.c.

References args, FALSE, GetChilds(), iargs, NULL, and XtNmenuName.

01792 {
01793   int        nbMenus        ;
01794   WidgetList subMenus       ;
01795   Widget     menu           ;
01796   Widget     subMenu        ;
01797   int        menuId         ;
01798   int        nbSubMenus = 0 ;
01799   String     mname      = NULL ;
01800 
01801   if ( GetChilds( winNumber ,
01802                   &nbMenus   ,
01803                   &subMenus ,
01804                   &menu     ,
01805                   menuName  ,
01806                   &menuId    )  == FALSE )
01807   { 
01808     return 0 ;
01809   }
01810   /* a submenu is specified by its position 
01811    * in the menu item list  (*ne) 
01812    */
01813   iargs=0;
01814   XtSetArg(args[iargs], XtNmenuName, &mname);
01815   iargs++;
01816   XtGetValues(subMenus[menuId], args, iargs);
01817   
01818   if ( mname == NULL )
01819   {
01820     return 0 ;
01821   }
01822   
01823   subMenu = XtNameToWidget(subMenus[menuId],mname) ;
01824   iargs = 0 ;
01825   XtSetArg(args[iargs], XtNnumChildren, &nbSubMenus);
01826   iargs++;
01827   XtGetValues( subMenu , args, iargs);
01828   
01829   return nbSubMenus ;
01830 }

Here is the call graph for this function:

int getpid (  ) 

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

used when we resize the popup at scilab level

Definition at line 791 of file SGraph.c.

References args, CPixmapResize1(), BCG::CWindow, FALSE, iargs, Max, NULL, BCG::popup, SB_HORZ, SB_VERT, sciGetScrollInfo(), sciGetwresize(), ScilabXgc, sciSetScrollInfo(), TRUE, WINMINH, WINMINW, x, and y.

00792 {
00793   Dimension clwidth = Max(*width,  WINMINW);
00794   Dimension clheight= Max(*height, WINMINH);
00795   if ( ScilabXgc->popup!=(Widget)0) { /* check if it is not a tk canvas */
00796     iargs = 0;
00797     XtSetArg (args[iargs], XtNwidth, clwidth ); iargs++;
00798     XtSetArg (args[iargs], XtNheight,clheight); iargs++;
00799     XtSetValues (ScilabXgc->popup, args, iargs);
00800   }
00801 }

Here is the call graph for this function:

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

Definition at line 697 of file SGraph.c.

References args, BCG::Cdrawable, BCG::CurResizeStatus, BCG::drawbox, Height, iargs, Max, BCG::Panner, BCG::popup, RedrawThumbs(), sci_pixmap_resize(), ScilabXgc, BCG::Viewport, w, Width, WINMINH, WINMINW, x, XtNcanvasHeight, XtNcanvasWidth, XtNsliderHeight, XtNsliderWidth, XtNsliderX, XtNsliderY, and y.

Referenced by xset_windowdim().

00698 {
00699   int Width = Max(*width,  WINMINW);
00700   int Height= Max(*height, WINMINH);
00701   Position x,y;
00702   Dimension cwidth,cheight,clwidth,clheight,wv,hv;
00703   ViewportWidget w = (  ViewportWidget ) ScilabXgc->Viewport;
00704   register Widget clip = w->viewport.clip;
00705   register Widget child = w->viewport.child;
00706 
00707   if ( ScilabXgc->CurResizeStatus == 0) 
00708     {
00710       XtResizeWidget(ScilabXgc->drawbox ,Width,Height,0);
00712       if (ScilabXgc->Cdrawable != (Drawable) 0 ) /* ScilabXgc->CWindow ) */
00713         {
00714           sci_pixmap_resize(ScilabXgc,Width,Height);
00715         }
00716       /*
00717        * Resize the viewport child which contains the graphic widget 
00718        * we don't want the viewport child to be smaller than the 
00719        * clip region 
00720        */
00721       wv = Max(Width,clip->core.width);
00722       hv = Max(Height,clip->core.height);
00723       XtResizeWidget(child,wv,hv,0);
00724       RedrawThumbs(w);
00725       
00728       iargs = 0 ;
00729       XtSetArg (args[iargs], XtNx, &x); iargs++;
00730       XtSetArg (args[iargs], XtNy, &y); iargs++;
00731       XtSetArg (args[iargs], XtNwidth, &cwidth ); iargs++;
00732       XtSetArg (args[iargs], XtNheight, &cheight); iargs++;
00733       XtGetValues (child, args, iargs);
00735       iargs = 0 ;
00736       XtSetArg (args[iargs], XtNwidth, &clwidth ); iargs++;
00737       XtSetArg (args[iargs], XtNheight, &clheight); iargs++;
00738       XtGetValues (clip, args, iargs);
00741       iargs =0;
00742       XtSetArg (args[iargs], XtNsliderX, -x); iargs++;
00743       XtSetArg (args[iargs], XtNsliderY, -y); iargs++;
00744       XtSetArg (args[iargs], XtNsliderWidth, clwidth ); iargs++;
00745       XtSetArg (args[iargs], XtNsliderHeight, clheight); iargs++;
00746       XtSetArg (args[iargs], XtNcanvasWidth,  cwidth); iargs++;
00747       XtSetArg (args[iargs], XtNcanvasHeight,  cheight); iargs++;
00750       XtSetValues (ScilabXgc->Panner, args, iargs);
00751     }
00752   else
00753     {
00754       /* 
00755        * in order to resize the drawbox, we must resize the 
00756        * popup window.
00757        */
00758       iargs =0;
00759       XtSetArg (args[iargs], XtNwidth, &clwidth ); iargs++;
00760       XtSetArg (args[iargs], XtNheight, &clheight); iargs++;
00761       XtGetValues (ScilabXgc->popup, args, iargs);
00762       iargs =0;
00763       XtSetArg (args[iargs], XtNwidth, &cwidth ); iargs++;
00764       XtSetArg (args[iargs], XtNheight, &cheight); iargs++;
00765       XtGetValues (ScilabXgc->drawbox, args, iargs);
00766       /* we add to Width and Height the expected offset 
00767        * the drawbox can be bigger than the popup if 
00768        * we are comming back from a ScilabXgc->CurResizeStatus==0 state 
00769        */
00770       clwidth = Width  + Max(0,(int)clwidth - (int)cwidth);
00771       clheight= Height + Max(0,(int)clheight - (int)cheight);
00772       iargs = 0;
00773       XtSetArg (args[iargs], XtNwidth, clwidth ); iargs++;
00774       XtSetArg (args[iargs], XtNheight,clheight); iargs++;
00775       XtSetValues (ScilabXgc->popup, args, iargs);
00777       if (ScilabXgc->Cdrawable != (Drawable) 0 ) /* ScilabXgc->CWindow ) */
00778         {
00780           iargs =0;
00781           XtSetArg (args[iargs], XtNwidth, &cwidth ); iargs++;
00782           XtSetArg (args[iargs], XtNheight, &cheight); iargs++;
00783           XtGetValues (ScilabXgc->drawbox, args, iargs);
00784           sci_pixmap_resize(ScilabXgc,cwidth,cheight); 
00785           /* scig_resize(ScilabXgc->CurWindow);  */
00786         }
00787     }
00788 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ignore_events ( Widget  widget,
XEvent *  event2,
long  mask 
) [static]

Definition at line 819 of file SGraph.c.

References count, and FDEBUG.

Referenced by EventProc1().

00820 {
00821   while (XCheckWindowEvent(XtDisplay(widget),XtWindow(widget),mask ,event2)==True)
00822     { 
00823       FDEBUG((stderr,"inside ignore_events count = %d\n",((XExposeEvent *) event2)->count));
00824     }
00825 }

Here is the caller graph for this function:

int IsCloseSGWindow ( XEvent *  event  ) 

if true the window number is returnde

Definition at line 126 of file SGraph.c.

00127 {
00128   if ( event->type == ClientMessage &&
00129        ((XClientMessageEvent *)event)->message_type == Close_SG_Window_Activated )
00130     return event->xclient.data.l[0];
00131   else
00132     return -1;
00133 }

int IswmDeleteWindow ( XEvent *  event  ) 

to check that an event is of type wmDeleteWindow

Definition at line 117 of file SGraph.c.

References int.

00118 {
00119   return event->type == ClientMessage &&
00120     event->xclient.data.l[0] == (int)wmDeleteWindow ;
00121 }

void key_pressed ( Widget  widget,
XEvent *  event,
String *  params,
Cardinal *  num_params 
)

Definition at line 260 of file SGraph.c.

References buf, compose_status, GetEventWindow(), NULL, and PushClickQueue().

00261 {
00262   char buf[10];
00263   int ten=10;
00264   KeySym keysym;
00265   XComposeStatus compose_status = {NULL, 0};
00266   XLookupString((XKeyEvent *)&(event->xkey), buf, 
00267                 ten, &keysym,&compose_status);
00268   if ((int)keysym < XK_Shift_L ||(int)keysym ==XK_Delete ){
00269     /* regular key pressed detected. return  keysym */
00270     PushClickQueue(GetEventWindow(event),event->xkey.x,
00271                    event->xkey.y,(int)keysym,0,0);
00272   }
00273 }

Here is the call graph for this function:

void key_released ( Widget  widget,
XEvent *  event,
String *  params,
Cardinal *  num_params 
)

Definition at line 275 of file SGraph.c.

References buf, compose_status, GetEventWindow(), NULL, and PushClickQueue().

00276 {
00277   char buf[10];
00278   int ten=10;
00279   KeySym keysym;
00280   XComposeStatus compose_status = {NULL, 0};
00281   XLookupString((XKeyEvent *)&(event->xkey), buf, 
00282                 ten, &keysym,&compose_status);
00283   if ((int)keysym <65000) {
00284     /* regular key released detected. return  -keysym */
00285     PushClickQueue(GetEventWindow(event),event->xkey.x,
00286                    event->xkey.y,-(int)keysym,0,1);
00287   }
00288 }

Here is the call graph for this function:

static void KillButton ( Widget  w,
XtPointer  client_data,
caddr_t  call_data 
) [static]

Definition at line 1378 of file SGraph.c.

References MenuData::entry, MenuData::fname, and FREE.

Referenced by AddMenu().

01382 {
01383   MenuDataPtr datas =(MenuDataPtr)client_data;
01385   if ( datas->entry == 0)
01386     FREE(datas->fname);
01387   FREE(datas);
01388 }

Here is the caller graph for this function:

static void Load ( Widget  w,
XtPointer  number,
XtPointer  client_data 
) [static]

Definition at line 1124 of file SGraph.c.

References C2F, cur, dr(), filename, GetFileWindow(), ierr, init, L, na, PD0, PI0, rep, and TRUE.

Referenced by AddNewWin().

01125 {
01126   char *filename;
01127   integer win_num = (integer) number ;
01128   int ierr=0,rep;
01129   static char *init ="*.scg";
01130   rep=GetFileWindow(init,&filename,".",0,&ierr,"Load Graphic File");
01131   if ( ierr == 0 && rep == TRUE )
01132     {
01133       integer verb=0,cur,na;
01134       C2F(dr)("xget","window",&verb,&cur,&na,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);  
01135       C2F(dr)("xset","window",&win_num,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01136           //      C2F(xloadplots)(filename,0L);
01137       C2F(dr)("xset","window",&cur,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
01138     }
01139 }

Here is the call graph for this function:

Here is the caller graph for this function:

void mouse_moved ( Widget  widget,
XEvent *  event,
String *  params,
Cardinal *  num_params 
)

Definition at line 290 of file SGraph.c.

References FALSE, GetEventWindow(), and PushClickQueue().

00291 {
00292   /*ignore_events(widget,&event2, ExposureMask) ;*/
00293   if (wait_dclick) { /*move during a double click detection*/
00294     wait_dclick=FALSE;
00295     XtRemoveTimeOut (timerId);
00296     return;
00297   }
00298   PushClickQueue(GetEventWindow(event),event->xbutton.x,
00299                  event->xbutton.y,
00300                  -1,1,0);
00301 }

Here is the call graph for this function:

static void MoveChild ( Widget  viewp,
Position  x,
Position  y 
) [static]

Definition at line 671 of file SGraph.c.

References RedrawThumbs(), and w.

00672 {
00673   ViewportWidget w =   (ViewportWidget) viewp;
00674   register Widget child = w->viewport.child;
00675   register Widget clip = w->viewport.clip;
00676 
00677   /* make sure we never move past right/bottom borders */
00678   if ((int) (x + clip->core.width) > (int) child->core.width)
00679     x = child->core.width - clip->core.width;
00680 
00681   if ((int) (y + clip->core.height) > (int ) child->core.height)
00682     y = child->core.height - clip->core.height;
00683 
00684   /* make sure we never move past left/top borders */
00685   if (x < 0) x = 0;
00686   if (y < 0) y = 0;
00687 
00688   XtMoveWidget(child, - x, - y);
00689   RedrawThumbs(w);
00690 }

Here is the call graph for this function:

void PannerCallback ( Widget  w,
XtPointer  scigc_ptr,
XtPointer  report_ptr 
)

Definition at line 459 of file SGraph.c.

References MoveChild(), report(), ScilabXgc, and BCG::Viewport.

Referenced by AddNewWin().

00462 {
00463   struct BCG *ScilabXgc = ((struct BCG *) scigc_ptr);
00464   Widget viewport = ScilabXgc->Viewport;
00465   XawPannerReport *report = (XawPannerReport *) report_ptr;
00466   MoveChild(viewport, report->slider_x ,report->slider_y);
00467 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void Print ( Widget  w,
XtPointer  number,
XtPointer  client_data 
) [static]

Definition at line 1023 of file SGraph.c.

References getenv(), ok, orientation, prtdlg(), scig_toPs(), and sciprint().

Referenced by AddNewWin(), and scig_print().

01024 {
01025   char *p1;
01026   integer win_num = (integer) number ;
01027   integer colored,orientation,flag=1,ok;
01028 
01029   prtdlg(&flag,printer,&colored,&orientation,file,&ok);
01030   if (ok==1) 
01031     {
01032       if ( ( p1 = getenv("TMPDIR"))  == (char *) 0 )
01033         {
01034           sciprint("Cannot find environment variable TMPDIR\r\n");
01035         }
01036 
01037       sprintf(bufname,"%s/scilab-%d",p1,(int)win_num);
01038       scig_toPs(win_num,colored,bufname,"Pos");
01039       sprintf(bufname,"$SCI/bin/scilab -%s %s/scilab-%d %s",
01040               (orientation == 1) ? "print_l" : "print_p",
01041               p1,(int)win_num,printer);
01042       system(bufname);
01043   }
01044 }

Here is the call graph for this function:

Here is the caller graph for this function:

void RedrawThumbs ( ViewportWidget  w  ) 

Definition at line 655 of file SGraph.c.

References SetBar(), and w.

00656 {
00657   register Widget child = w->viewport.child;
00658   register Widget clip = w->viewport.clip;
00659 
00660   if (w->viewport.horiz_bar)
00661     SetBar( w->viewport.horiz_bar, -(child->core.x),
00662            clip->core.width, child->core.width );
00663 
00664   if (w->viewport.vert_bar)
00665     SetBar( w->viewport.vert_bar, -(child->core.y),
00666            clip->core.height, child->core.height );
00667 }

Here is the call graph for this function:

void refreshMenus ( struct BCG ScilabGC  ) 

Definition at line 1833 of file SGraph.c.

Referenced by initgraphic().

01833 {}

Here is the caller graph for this function:

static void reset_click_counter ( XtPointer  ptr  )  [static]

Definition at line 144 of file SGraph.c.

References FALSE.

Referenced by btn_pressed().

00145 {
00146   dclick = FALSE;
00147   wait_dclick = FALSE;
00148 }

Here is the caller graph for this function:

static void Rot3D ( Widget  w,
XtPointer  number,
XtPointer  client_data 
) [static]

Definition at line 1198 of file SGraph.c.

References args, iargs, ne, scig_3drot(), and SetUnsetMenu().

Referenced by AddNewWin().

01202 {
01203   integer win_num = (integer) number,ne=0;
01204   iargs=0;
01205   XtSetArg(args[iargs], XtNsensitive, False); iargs++;
01206   XtSetValues(w, args, iargs);
01207   SetUnsetMenu(&win_num,"UnZoom",&ne,False);
01208   SetUnsetMenu(&win_num,"Zoom",&ne,False);
01209   SetUnsetMenu(&win_num,"File",&ne,False);
01210   scig_3drot(win_num);
01211   iargs = 0;
01212   XtSetArg(args[iargs], XtNsensitive,True); iargs++;
01213   XtSetValues(w, args, iargs);
01214   SetUnsetMenu(&win_num,"UnZoom",&ne,True);
01215   SetUnsetMenu(&win_num,"Zoom",&ne,True);
01216   SetUnsetMenu(&win_num,"File",&ne,True);
01217 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void Save ( Widget  w,
XtPointer  number,
XtPointer  client_data 
) [static]

Definition at line 1106 of file SGraph.c.

References filename, GetFileWindow(), ierr, init, rep, and TRUE.

Referenced by AddNewWin().

01107 {
01108   char *filename;
01109   //  integer win_num = (integer) number ;
01110   int ierr=0,rep;
01111   static char *init ="*.scg";
01112   rep=GetFileWindow(init,&filename,".",0,&ierr,"Save Graphic File");
01113   if ( ierr == 0 && rep == TRUE )
01114     {
01115                 //      C2F(xsaveplots)(&win_num,filename,0L);
01116     }
01117 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void SavePs ( Widget  w,
XtPointer  number,
XtPointer  client_data 
) [static]

Definition at line 1058 of file SGraph.c.

References ok, orientation, prtdlg(), and scig_toPs().

01059 {
01060   integer win_num = (integer) number ;
01061   integer colored,orientation,flag=2,ok;
01062   prtdlg(&flag,printer,&colored,&orientation,file,&ok);
01063   if (ok==1) 
01064     {
01065       if (strncmp(printer,"Postscript",10)==0 ) 
01066         {
01068           scig_toPs(win_num,colored,file,"Pos");
01069         }
01070       else if (strcmp(printer,"Xfig")==0)
01071         {
01073           scig_toPs(win_num,colored,file,"Fig");
01074         }
01075       else if (strcmp(printer,"Gif")==0)
01076         {
01078           scig_toPs(win_num,colored,file,"GIF");
01079         }
01080       else if (strcmp(printer,"PPM")==0)
01081         {
01083           scig_toPs(win_num,colored,file,"PPM");
01084         }
01085       if ( strcmp(printer,"Postscript No Preamble") != 0)
01086         {
01087           sprintf(bufname,"$SCI/bin/scilab -%s %s %s",
01088                   ( orientation == 1) ? "save_l" : "save_p",file,printer);
01089           system(bufname);
01090         }
01091   }
01092 }

Here is the call graph for this function:

void sci_pixmap_resize ( struct BCG Xgc,
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.

References BCG::Cdrawable, BCG::CWindow, hdc1, Max, NULL, PixmapClear(), sci_pixmapclear(), sciprint(), and TryToGetDC().

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 }

Here is the call graph for this function:

void scig_export ( integer  number  ) 

Definition at line 1096 of file SGraph.c.

References NULL, SavePs(), and scig_command_scilabgc().

01097 {
01098   SavePs(NULL,(XtPointer) number,NULL);
01099 }

Here is the call graph for this function:

void scig_print ( integer  number  ) 

Definition at line 1048 of file SGraph.c.

References NULL, Print(), PrintPs(), and scig_command_scilabgc().

01049 {
01050   Print(NULL,(XtPointer) number,NULL);
01051 }

Here is the call graph for this function:

void SciViewportClipGetSize ( struct BCG ScilabXgc,
int w,
int h 
)

Definition at line 513 of file SGraph.c.

References _ViewportPart::clip, NULL, ScilabXgc, BCG::Viewport, and _ViewportRec::viewport.

Referenced by xset_wresize().

00514 {
00515   if ( ScilabXgc != NULL) 
00516     {
00517       ViewportWidget widg = (  ViewportWidget ) ScilabXgc->Viewport;
00518       register Widget clip = widg->viewport.clip;
00519       *w = clip->core.width;
00520       *h = clip->core.height;
00521     }
00522 }

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 488 of file SGraph.c.

References args, dx, dy, n, NULL, BCG::Panner, ScilabXgc, XtNsliderX, and XtNsliderY.

00489 {
00490   Widget panner;
00491   Cardinal n=0;
00492   if ( ScilabXgc != NULL) 
00493     {
00494       Dimension dx,dy;
00495       panner = ScilabXgc->Panner;
00496       XtSetArg (args[n], XtNsliderX, &dx); n++;  
00497       XtSetArg (args[n], XtNsliderY, &dy); n++;
00498       XtGetValues (panner, args, n);
00499       *x = dx; *y=dy;
00500     }
00501   else
00502     {
00503       *x=0;*y=0;
00504     }
00505 }

void SciViewportMove ( struct BCG ScilabXgc,
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 470 of file SGraph.c.

References args, FALSE, max, min, MoveChild(), n, NULL, BCG::Panner, SB_HORZ, SB_VERT, sciGetScrollInfo(), ScilabXgc, sciSetScrollInfo(), TRUE, BCG::Viewport, XtNsliderX, and XtNsliderY.

00472 {
00473   Widget viewport,panner;
00474   Cardinal n=0;
00475   if ( ScilabXgc != NULL) 
00476     {
00477       viewport = ScilabXgc->Viewport;
00478       panner = ScilabXgc->Panner;
00479       MoveChild(viewport,x,y);
00480       XtSetArg (args[n], XtNsliderX, x); n++;  
00481       XtSetArg (args[n], XtNsliderY, y); n++;
00482       XtSetValues (panner, args, n);
00483     }
00484 }

Here is the call graph for this function:

static void Select ( Widget  w,
XtPointer  number,
XtPointer  client_data 
) [static]

Definition at line 937 of file SGraph.c.

References scig_sel().

Referenced by AddNewWin(), and main().

00941 {
00942   integer win_num = (integer) number ;
00943   scig_sel(win_num);
00944 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void SelMenu ( Widget  w,
XtPointer  client_data,
caddr_t  call_data 
) [static]

Definition at line 1394 of file SGraph.c.

References buf, C2F, MenuData::entry, F2C(), fbutn(), MenuData::fname, rep, setfbutn(), StoreCommand(), MenuData::type, and MenuData::win_num.

Referenced by AddMenu().

01398 {
01399   static char buf[256];
01400   MenuDataPtr datas = (MenuDataPtr) client_data;
01401   if (datas->type == 0) 
01402     { 
01403       /* Interpreted mode : we store the action on a queue */
01404       if ( datas->win_num < 0 ) 
01405         {
01406           sprintf(buf,"execstr(%s(%d))",datas->fname,datas->entry+1);
01407         }
01408       else 
01409         {
01410           sprintf(buf,"execstr(%s_%d(%d))",datas->fname,datas->win_num,datas->entry+1);
01411         }
01412       StoreCommand(buf);
01413     }
01414   else if (datas->type == 2) 
01415     { 
01416       /* Interpreted mode : we store the action on a queue */
01417       if ( datas->win_num < 0 ) 
01418         {
01419           sprintf(buf,"%s(%d)",datas->fname,datas->entry+1);
01420         }
01421       else 
01422         {
01423           sprintf(buf,"%s(%d,%d)",datas->fname,datas->entry+1,datas->win_num);
01424         }
01425       StoreCommand(buf);
01426     }
01427   else
01428     { 
01429       /* hard coded mode */
01430       int rep ;
01431       C2F(setfbutn)(datas->fname,&rep);
01432       if ( rep == 0) 
01433         F2C(fbutn)((datas->fname),&(datas->win_num),&(datas->entry));
01434     }
01435 }

Here is the call graph for this function:

Here is the caller graph for this function:

void SetBar ( Widget  w,
Position  top,
Dimension  length,
Dimension  total 
)

Definition at line 647 of file SGraph.c.

References XawScrollbarSetThumb().

00648 {
00649   XawScrollbarSetThumb(w, (float) top / (float) total, 
00650                        (float) length / (float) total );
00651 }

Here is the call graph for this function:

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 1710 of file SGraph.c.

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

01713 {
01714   SetUnsetMenu(win_num,button_name,ne,True);
01715   return(0);
01716 }

Here is the call graph for this function:

static void SetUnsetMenu ( integer win_num,
char *  button_name,
integer ne,
int  flag 
) [static]

Definition at line 1659 of file SGraph.c.

References args, FALSE, GetChilds(), iargs, nc, NULL, and XtNmenuName.

Referenced by Rot3D(), setmen(), unsmen(), and Zoom().

01664 {  
01665   Cardinal nc=0;
01666   WidgetList childs;
01667   Widget outer;
01668   int nc1,name_pos;
01669   if (GetChilds(*win_num,&nc1,&childs,&outer,button_name,&name_pos)== FALSE) return;
01670   if (name_pos  == -1 ) return; /* button_name not found */
01671   if (*ne==0) 
01672     {
01674       iargs=0;
01675       XtSetArg(args[iargs],XtNsensitive,flag); iargs++;
01676       XtSetValues(childs[name_pos], args, iargs );
01677     }
01678   else 
01679     {
01680       Widget w1;
01681       String mname=NULL;
01682       /* a submenu is specified by its position 
01683        * in the menu item list  (*ne) 
01684        */
01685       iargs=0;
01686       XtSetArg(args[iargs], XtNmenuName, &mname);    iargs++;
01687       XtGetValues(childs[name_pos], args, iargs); 
01688       w1= (mname == NULL) ? NULL : XtNameToWidget(childs[name_pos],mname);
01689       if (w1==NULL) {
01690         iargs=0;
01691         XtSetArg(args[iargs],XtNsensitive,flag); iargs++;
01692         XtSetValues(childs[name_pos], args, iargs );
01693         return;
01694       }
01695       iargs=0;
01696       XtSetArg(args[iargs], XtNnumChildren, &nc);    iargs++;
01697       XtSetArg(args[iargs], XtNchildren, &childs);   iargs++;
01698       XtGetValues(w1, args, iargs); 
01699       if (*ne <= (int)nc) {
01700         iargs=0;
01701         XtSetArg(args[iargs],XtNsensitive,flag); iargs++;
01702         XtSetValues(childs[*ne-1], args, iargs ); 
01703       }
01704     }
01705 }

Here is the call graph for this function:

Here is the caller graph for this function:

void SGDeleteWindow ( Widget  w,
XEvent *  event,
String *  params,
Cardinal *  num__PARAMS 
)

returns the number of the deleted window or -1 if no deleted windows

sciprint("Le window manager veut tuer une fenetre graphique %d\n",i);

Definition at line 1233 of file SGraph.c.

References Delete(), GetBGWindowNumber(), getWinsMaxId(), and i.

01238 {
01239   int i;
01240   Window Win = XtWindow(w), Win1;
01241   int wincount =  getWinsMaxId()+1;
01242   for (i=0 ; i < wincount ; i++) 
01243     {
01244       Win1=GetBGWindowNumber(i);
01245       if (Win1 == Win ) 
01246         {
01248           Delete((Widget) 0,(XtPointer) i,(XtPointer) 0);
01249           return ;
01250         }
01251     }
01252   return ;
01253 }

Here is the call graph for this function:

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

Definition at line 1718 of file SGraph.c.

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

01721 {
01722   SetUnsetMenu(win_num,button_name,ne,False);
01723   return(0);
01724 }

Here is the call graph for this function:

static void UnZoom ( Widget  w,
XtPointer  number,
XtPointer  client_data 
) [static]

Definition at line 1176 of file SGraph.c.

References args, iargs, and scig_unzoom().

Referenced by AddNewWin().

01180 {
01181   integer win_num = (integer) number;
01182   iargs = 0;
01183   XtSetArg(args[iargs], XtNsensitive, False); iargs++;
01184   XtSetValues(w, args, iargs);
01185   scig_unzoom(win_num);
01186   iargs = 0;
01187   XtSetArg(args[iargs], XtNsensitive,True); iargs++;
01188   XtSetValues(w, args, iargs);
01189 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ViewportCallback ( Widget  w,
XtPointer  scigc_ptr,
XtPointer  report_ptr 
)

Definition at line 538 of file SGraph.c.

References args, BCG::Cdrawable, BCG::Cdrawable_flag, _ViewportPart::child, _ViewportPart::clip, BCG::CurResizeStatus, BCG::CWindowHeight, BCG::CWindowWidth, BCG::drawbox, iargs, Max, n, NULL, BCG::Panner, report(), ScilabXgc, _ViewportRec::viewport, XawPRSliderX, XawPRSliderY, XtNcanvasHeight, XtNcanvasWidth, XtNsliderHeight, XtNsliderWidth, XtNsliderX, and XtNsliderY.

Referenced by AddNewWin().

00539 {
00540   Dimension cwidth,cheight,clwidth,clheight,gwidth,gheight;
00541   ViewportWidget viewpw = (  ViewportWidget ) w;
00542   register Widget clip = viewpw->viewport.clip;
00543   register Widget child = viewpw->viewport.child;
00544 
00545   Cardinal n = 0;
00546   XawPannerReport *report = (XawPannerReport *) report_ptr;
00547   struct BCG *ScilabXgc = ((struct BCG *) scigc_ptr);
00548   Widget panner = ScilabXgc->Panner;
00549   
00550 
00551   if ( ScilabXgc->CurResizeStatus  == 0) 
00552     {
00553 
00554       XtSetArg (args[n], XtNsliderX, report->slider_x); n++;
00555       XtSetArg (args[n], XtNsliderY, report->slider_y); n++;
00556       if (report->changed != (XawPRSliderX | XawPRSliderY)) {
00557         XtSetArg (args[n], XtNsliderWidth, report->slider_width); n++;
00558         XtSetArg (args[n], XtNsliderHeight, report->slider_height); n++;
00559         XtSetArg (args[n], XtNcanvasWidth, report->canvas_width); n++;
00560         XtSetArg (args[n], XtNcanvasHeight, report->canvas_height); n++;
00561         /*
00562           fprintf(stderr,"new reported %d %d %d %d \n",report->slider_width, report->slider_height,
00563           report->canvas_width, report->canvas_height);
00564         */
00565       }
00566       XtSetValues (panner, args, n);
00567 
00571       iargs = 0 ;
00572       XtSetArg (args[iargs], XtNwidth, &cwidth ); iargs++;
00573       XtSetArg (args[iargs], XtNheight, &cheight); iargs++;
00574       XtGetValues (child, args, iargs);
00575       iargs = 0;
00576       XtSetArg (args[iargs], XtNwidth, &clwidth ); iargs++;
00577       XtSetArg (args[iargs], XtNheight, &clheight); iargs++;
00578       XtGetValues (clip, args, iargs);
00579 
00580       if (  ScilabXgc->drawbox != NULL) 
00581         {
00582           int nw,nh;
00583           iargs = 0;
00584           XtSetArg (args[iargs], XtNwidth, &gwidth ); iargs++;
00585           XtSetArg (args[iargs], XtNheight, &gheight); iargs++;
00586           XtGetValues (ScilabXgc->drawbox, args, iargs);
00587           nw= Max(gwidth,clwidth);
00588           nh= Max(gheight,clheight);
00589           if ( nw < cwidth || nh < cheight )
00590             {
00591               XtResizeWidget(child,nw,nh,0);
00592               n=0;
00593               XtSetArg (args[n], XtNcanvasWidth, nw); n++;
00594               XtSetArg (args[n], XtNcanvasHeight,nh); n++;
00595               XtSetValues (panner, args, n);
00596             }
00597         }
00598     }
00599   else
00600     {
00605       iargs = 0 ;
00606       XtSetArg (args[iargs], XtNwidth, &cwidth ); iargs++;
00607       XtSetArg (args[iargs], XtNheight, &cheight); iargs++;
00608       XtGetValues (child, args, iargs);
00609       iargs = 0;
00610       XtSetArg (args[iargs], XtNwidth, &clwidth ); iargs++;
00611       XtSetArg (args[iargs], XtNheight, &clheight); iargs++;
00612       XtGetValues (clip, args, iargs);
00613       if (   ScilabXgc->drawbox != NULL) 
00614         {
00615           /* We resize Scilab drawbox and update window dimensions */
00616           XtResizeWidget(ScilabXgc->drawbox,clwidth,clheight,0);
00617           ScilabXgc->CWindowWidth  = clwidth;
00618           ScilabXgc->CWindowHeight = clheight;
00619           XtResizeWidget(child,clwidth,clheight,0);
00620           /* if necessary we must resize the pixmap */
00621           if (ScilabXgc->Cdrawable != (Drawable) NULL) /* ScilabXgc->CWindow ) */
00622             {
00623               /* here the best stuff to do is a scig_resize 
00624                * scig_resize(ScilabXgc->CurWindow); 
00625                * unfortunately this callback is called too 
00626                * frequently when resizing and scig_resize can be slow 
00627                * thus we just resize the window pixmap 
00628                * and set a flag.
00629                * Thus the last expose will have to properly redraw the window
00630                */
00631               /* will be done by expose 
00632                  sci_pixmap_resize(ScilabXgc,ScilabXgc->CWindowWidth, 
00633                  ScilabXgc->CWindowHeight);
00634               */
00635               ScilabXgc->Cdrawable_flag=1;
00636             }
00637           n=0;
00638           XtSetArg (args[n], XtNsliderWidth, clwidth); n++;
00639           XtSetArg (args[n], XtNsliderHeight,clheight); n++;
00640           XtSetArg (args[n], XtNcanvasWidth, clwidth); n++;
00641           XtSetArg (args[n], XtNcanvasHeight,clheight); n++;
00642           XtSetValues (panner, args, n);
00643         }
00644     }
00645 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void Zoom ( Widget  w,
XtPointer  number,
XtPointer  client_data 
) [static]

Definition at line 1150 of file SGraph.c.

References args, iargs, ne, scig_2dzoom(), and SetUnsetMenu().

Referenced by AddNewWin().

01151 {
01152 
01153   integer win_num = (integer) number,ne=0;
01154   iargs = 0;
01155   XtSetArg(args[iargs], XtNsensitive, False); iargs++;
01156   XtSetValues(w, args, iargs);
01157   SetUnsetMenu(&win_num,"3D Rot.",&ne,False);
01158   SetUnsetMenu(&win_num,"UnZoom",&ne,False);
01159   SetUnsetMenu(&win_num,"File",&ne,False);
01160   if(scig_2dzoom(win_num) != 1){ /* ==1 <=> zoom failed (the window has been closed while zooming ) */
01161     iargs = 0;
01162     XtSetArg(args[iargs], XtNsensitive,True); iargs++;
01163     XtSetValues(w, args, iargs);
01164   }
01165   SetUnsetMenu(&win_num,"3D Rot.",&ne,True);
01166   SetUnsetMenu(&win_num,"UnZoom",&ne,True);
01167   SetUnsetMenu(&win_num,"File",&ne,True);
01168 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

XtAppContext app_con

Definition at line 76 of file inter.c.

char bufname[256] [static]

Definition at line 1018 of file SGraph.c.

Widget commandWindow

Definition at line 72 of file command.c.

Bool dclick = FALSE [static]

Definition at line 140 of file SGraph.c.

XtActionsRec event_actions[] [static]

Initial value:

{
    {"BtnPressed", (XtActionProc) btn_pressed},
    {"BtnReleased", (XtActionProc) btn_released},
    {"CtrlKey", (XtActionProc) ctrl_key},
    {"KeyPressed", (XtActionProc) key_pressed},
    {"KeyReleased", (XtActionProc) key_released},
    {"MouseMoved", (XtActionProc) mouse_moved},
}

Definition at line 308 of file SGraph.c.

String event_translations [static]

Initial value:

"\
<MouseMoved>:MouseMoved()\n\
Ctrl<Key>:CtrlKey()\n\
!Shift<KeyDown>:KeyPressed(1)\n\
!Lock<KeyDown>:KeyPressed(1)\n\
!Lock Shift <KeyDown>:KeyPressed(0)\n\
None<KeyDown>:KeyPressed(0)\n\
!Shift<KeyUp>:KeyReleased(1)\n\
!Lock<KeyUp>:KeyReleased(1)\n\
!Lock Shift<KeyUp>:KeyReleased(1)\n\
None<KeyUp>:KeyReleased(0)\n\
<BtnUp>:BtnReleased()\n\
!Shift<BtnDown>:BtnPressed(1)\n\
!Ctrl<BtnDown>:BtnPressed(2)\n\
<BtnDown>:BtnPressed(0)\n\
"

Definition at line 318 of file SGraph.c.

char file[256] [static]

Definition at line 1020 of file SGraph.c.

Bool lose_up = FALSE [static]

Definition at line 141 of file SGraph.c.

char printer[128] [static]

Definition at line 1019 of file SGraph.c.

Referenced by CopyPrint(), and gp_printfile().

String sg_trans [static]

Initial value:

"<Message>WM_PROTOCOLS: SGDeleteWindow()\n\
     <ClientMessage>WM_PROTOCOLS: SGDeleteWindow()\n"

Definition at line 1256 of file SGraph.c.

long timerId [static]

Definition at line 142 of file SGraph.c.

Bool wait_dclick = FALSE [static]

Definition at line 139 of file SGraph.c.


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