SmeLine.c File Reference

#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xaw3d/XawInit.h>
#include <X11/Xaw3d/SmeLineP.h>
#include <X11/Xaw3d/Cardinals.h>

Include dependency graph for SmeLine.c:

Go to the source code of this file.

Defines

#define offset(field)   XtOffsetOf(SmeLineRec, sme_line.field)
#define SUPERCLASS   (&smeClassRec)

Functions

static void Redisplay ()
static void Initialize ()
static void DestroyGC ()
static void CreateGC ()
static Boolean SetValues ()
static XtGeometryResult QueryGeometry ()
static void Initialize (Widget request, Widget new, ArgList args, Cardinal *num_args)
static void CreateGC (Widget w)
static void DestroyGC (Widget w)
static void Redisplay (Widget w, XEvent *event, Region region)
static Boolean SetValues (Widget current, Widget request, Widget new, ArgList args, Cardinal *num_args)
static XtGeometryResult QueryGeometry (Widget w, XtWidgetGeometry *intended, XtWidgetGeometry *return_val)

Variables

static XtResource resources []
SmeLineClassRec smeLineClassRec
WidgetClass smeLineObjectClass = (WidgetClass) &smeLineClassRec


Define Documentation

#define offset ( field   )     XtOffsetOf(SmeLineRec, sme_line.field)

Definition at line 48 of file SmeLine.c.

#define SUPERCLASS   (&smeClassRec)

Definition at line 69 of file SmeLine.c.


Function Documentation

static void CreateGC ( Widget  w  )  [static]

Definition at line 159 of file SmeLine.c.

References FALSE, SmeLinePart::foreground, SmeLinePart::gc, SmeLinePart::line_width, _SmeLineRec::sme_line, and SmeLinePart::stipple.

00161 {
00162     SmeLineObject entry = (SmeLineObject) w;
00163     XGCValues values;
00164     XtGCMask mask = GCForeground | GCGraphicsExposures | GCLineWidth ;
00165     
00166     values.foreground = entry->sme_line.foreground;
00167     values.graphics_exposures = FALSE;
00168     values.line_width = entry->sme_line.line_width;
00169     
00170     if (entry->sme_line.stipple != XtUnspecifiedPixmap) {
00171         values.stipple = entry->sme_line.stipple;
00172         values.fill_style = FillStippled; 
00173         mask |= GCStipple | GCFillStyle;
00174         
00175         entry->sme_line.gc = XCreateGC(XtDisplayOfObject(w), 
00176                                       RootWindowOfScreen(XtScreenOfObject(w)),
00177                                       mask, &values);
00178     }
00179     else
00180         entry->sme_line.gc = XtGetGC(w, mask, &values);
00181 }

static void CreateGC (  ) 

static void DestroyGC ( Widget  w  )  [static]

Definition at line 190 of file SmeLine.c.

References SmeLinePart::gc, _SmeLineRec::sme_line, and SmeLinePart::stipple.

00192 {
00193     SmeLineObject entry = (SmeLineObject) w;
00194 
00195     if (entry->sme_line.stipple != XtUnspecifiedPixmap) 
00196         XFreeGC(XtDisplayOfObject(w), entry->sme_line.gc);
00197     else
00198         XtReleaseGC(w, entry->sme_line.gc);
00199 }

static void DestroyGC (  )  [static]

Referenced by Destroy(), and SetValues().

Here is the caller graph for this function:

static void Initialize ( Widget  request,
Widget  new,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 136 of file SmeLine.c.

References CreateGC(), SmeLinePart::line_width, _SmeLineRec::rectangle, and _SmeLineRec::sme_line.

00140 {
00141     SmeLineObject entry = (SmeLineObject) new;
00142 
00143     if (entry->rectangle.height == 0)
00144         entry->rectangle.height = entry->sme_line.line_width;
00145 
00146     CreateGC(new);
00147 }

Here is the call graph for this function:

static void Initialize (  ) 

Definition at line 26 of file javasci_globals.c.

00027 {
00028   static char env[1024];
00029   static char initstr[]="exec(\"SCI/etc/scilab.start\",-1);quit;";
00030   static int iflag=-1, stacksize = 1000000, ierr=0;
00031 
00032   #ifdef _MSC_VER
00033     static char JavaSciInterf[]="javasci";
00034     static char nw[]="-nw";
00035     static char nb[]="-nb";
00036   #endif
00037 
00038   
00039   char *p1 = (char*)getenv ("SCI");
00040   
00041   
00042   #ifdef _MSC_VER
00043   /* Supprime le mode windows et la baniere */
00044     add_sci_argv(JavaSciInterf);
00045     add_sci_argv(nb);
00046   #endif
00047   
00048   #ifdef _MSC_VER 
00049     if ( p1== NULL )
00050     {
00051                 /* Detection Scilab path */
00052                 char modname[MAX_PATH+1];
00053                 if (!GetModuleFileName (GetModuleHandle("javasci.dll"), modname, MAX_PATH))
00054                 {
00055                         MessageBox(NULL,"javasci.dll not found","Warning",MB_ICONWARNING);
00056                 }
00057                 else
00058                 {
00059                         char *p;
00060                         if ((p = strrchr (modname, '\\')) == NULL) exit(1); /* remove \javasci.dll from modname */
00061                         else
00062                         {
00063                                 *p='\0';
00064                                 if ((p = strrchr (modname, '\\')) == NULL) exit(1); /* remove \bin from modname */
00065                                 else
00066                                 {
00067                                         *p='\0';
00068                                         set_sci_env(modname);
00069                                 }
00070                         }
00071                 }
00072     }
00073     else 
00074         {
00075                 char *pathSCI=(char*)MALLOC((strlen(p1)+1)*sizeof(char));
00076                 sprintf(pathSCI,"%s",p1);
00077                 set_sci_env(pathSCI);
00078                 if (pathSCI) {FREE(pathSCI);pathSCI=NULL;}
00079         }
00080   #else
00081    if (p1==NULL)
00082    {
00083         fprintf(stderr,"Please define SCI environment variable\n");
00084         sprintf (env, "%s=%s", "SCI",SCI);
00085         setSCIpath(SCI);
00086         putenv (env);
00087    }
00088   #endif
00089   /* set TMPDIR */
00090   C2F(settmpdir)();
00091   /* Scilab Initialization */
00092   C2F(inisci)(&iflag,&stacksize,&ierr);
00093   if ( ierr > 0 ) 
00094     {
00095       fprintf(stderr,"Scilab initialization failed !\n");
00096       exit(1);
00097     }
00098 
00099 
00100   /* Initialisation fenetre graphique */
00101   #ifdef _MSC_VER
00102     InitWindowGraphDll();
00103   #endif
00104 
00105   /* pour initialisation de la primitive scilab : fromjava() */
00106   SetFromJavaToON();
00107 
00108   /* Chargement de Scilab.start */
00109   C2F(scirun)(initstr,(int)strlen(initstr));
00110  
00111 }

static XtGeometryResult QueryGeometry ( Widget  w,
XtWidgetGeometry *  intended,
XtWidgetGeometry *  return_val 
) [static]

Definition at line 267 of file SmeLine.c.

References mode, _SmeRec::rectangle, and width.

00270 {
00271     SmeObject entry = (SmeObject) w;
00272     Dimension width;
00273     XtGeometryResult ret_val = XtGeometryYes;
00274     XtGeometryMask mode = intended->request_mode;
00275 
00276     width = 1;                  /* we can be really small. */
00277 
00278     if ( ((mode & CWWidth) && (intended->width != width)) ||
00279          !(mode & CWWidth) ) {
00280         return_val->request_mode |= CWWidth;
00281         return_val->width = width;
00282         mode = return_val->request_mode;
00283         
00284         if ( (mode & CWWidth) && (width == entry->rectangle.width) )
00285             return(XtGeometryNo);
00286         return(XtGeometryAlmost);
00287     }
00288     return(ret_val);
00289 }

static XtGeometryResult QueryGeometry (  )  [static]

static void Redisplay ( Widget  w,
XEvent *  event,
Region  region 
) [static]

Definition at line 210 of file SmeLine.c.

References SmeLinePart::gc, int, SmeLinePart::line_width, _SmeLineRec::rectangle, _SmeLineRec::sme_line, SmeLinePart::stipple, and y.

00214 {
00215     SmeLineObject entry = (SmeLineObject) w;
00216     int y = entry->rectangle.y + 
00217             (int)(entry->rectangle.height - entry->sme_line.line_width) / 2;
00218 
00219     if (entry->sme_line.stipple != XtUnspecifiedPixmap) 
00220         XSetTSOrigin(XtDisplayOfObject(w), entry->sme_line.gc, 0, y);
00221 
00222     XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
00223                    entry->sme_line.gc, 
00224                    0, y, (unsigned int) entry->rectangle.width, 
00225                    (unsigned int) entry->sme_line.line_width );
00226 }

static void Redisplay (  )  [static]

static Boolean SetValues ( Widget  current,
Widget  request,
Widget  new,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 238 of file SmeLine.c.

References CreateGC(), DestroyGC(), FALSE, SmeLinePart::line_width, _SmeLineRec::sme_line, SmeLinePart::stipple, and TRUE.

00242 {
00243     SmeLineObject entry = (SmeLineObject) new;
00244     SmeLineObject old_entry = (SmeLineObject) current;
00245   
00246     if ( (entry->sme_line.line_width != old_entry->sme_line.line_width) &&
00247          (entry->sme_line.stipple != old_entry->sme_line.stipple) ) {
00248         DestroyGC(current);
00249         CreateGC(new);
00250         return(TRUE);
00251     }
00252     return(FALSE);
00253 }

Here is the call graph for this function:

static Boolean SetValues (  )  [static]


Variable Documentation

XtResource resources[] [static]

Initial value:

 {
  {XtNlineWidth, XtCLineWidth, XtRDimension, sizeof(Dimension),
     offset(line_width), XtRImmediate, (XtPointer) 1},
  {XtNstipple, XtCStipple, XtRBitmap, sizeof(Pixmap),
     offset(stipple), XtRImmediate, (XtPointer) XtUnspecifiedPixmap},
  {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
     offset(foreground), XtRString, XtDefaultForeground},
}

Definition at line 49 of file SmeLine.c.

SmeLineClassRec smeLineClassRec

Definition at line 71 of file SmeLine.c.

WidgetClass smeLineObjectClass = (WidgetClass) &smeLineClassRec

Definition at line 118 of file SmeLine.c.


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