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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
#include <stdio.h>
#include <signal.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <stdlib.h>
#include <malloc.h>
#include <sys/time.h>
#define XK_MISCELLANY
#include <sys/types.h>
#include <sys/time.h>
#ifdef ISC
#include <sys/bsdtypes.h> /* Saul */
#endif
#if defined ___AIX || defined _AIX || defined __QNX__ || defined ___AIXV3 || defined AIXV3 || defined _SEQUENT_
#include <sys/select.h>
#endif
#include <X11/keysymdef.h>
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xproto.h>
#include <X11/cursorfont.h>
#include <X11/Xatom.h>
#include <X11/xpm.h>
#include <X11/X.h>
#include <fvwm/fvwmlib.h>
#include <FVWMconfig.h>
#include "../../fvwm/module.h"
#include <fvwm/version.h>
/* Constante de couleurs */
#define black 0
#define white 1
#define back 2
#define fore 3
#define shad 4
#define li 5
/* Constante vrai ou faux */
#define True 1
#define False 0
/* Constante type de widget */
#define PushButton 1
#define RadioButton 2
#define ItemDraw 3
#define CheckBox 4
#define TextField 5
#define HScrollBar 6
#define VScrollBar 7
#define PopupMenu 8
#define Rectangle 9
#define MiniScroll 10
#define SwallowExec 11
#define HDipstick 12
#define VDipstick 13
#define List 14
#define Menu 15
/* Structure qui regroupe commande et boucle conditionnelle */
typedef struct
{
int Type; /* Type de la commande */
long *TabArg; /* Tableau d'argument: id var,fnc,const,adr bloc... */
int NbArg;
} Instr;
/* Structure bloc d'instruction */
typedef struct
{
Instr *TabInstr; /* Tableau d'instruction */
int NbInstr; /* Nombre d'instruction */
} Bloc;
/* Structure pour enregistrer l'entete du script: valeur par defaut */
typedef struct /* Type pour la gestion X */
{
int x,y ; /* Origine de la fenetre */
int height,width; /* Hauteur et largeur */
char *titlewin; /* Titre */
char *forecolor; /* Couleur des lignes */
char *backcolor; /* Couleur de fond */
char *shadcolor; /* Couleur des lignes */
char *licolor; /* Couleur des lignes */
char *font; /* Police utilisee */
char *icon; /* Icone pour l'application iconisee */
Bloc *periodictasks; /* Tableau de taches periodiques */
Bloc *initbloc; /* Bloc d'initalisation */
} ScriptProp;
typedef struct
{
int NbCase;
int *LstCase; /* Tableau des valeurs case a verifier */
} CaseObj;
/* Structure pour enregistrer les caracteristiques des objets graphiques */
typedef struct /* Type pour les boutons */
{
int id;
char *type;
int x,y ; /* Origine du bouton */
int height,width; /* Hauteur et largeur */
char *title; /* Titre */
char *swallow; /* swallowexec */
char *icon; /* Icon */
char *forecolor; /* Couleur des lignes */
char *backcolor; /* Couleur de fond */
char *shadcolor;
char *licolor;
char *font; /* Police utilis */
int flags[5]; /* Etat du bouton:invisible, inactif et actif */
int value;
int value2;
int value3;
} MyObject;
typedef MyObject TabObj[100];
typedef struct
{
Display *display ;
int screen ;
Window root ;
Window win ;
Colormap colormap ;
GC gc ;
int depth ;
unsigned long WhitePix ;
unsigned long BlackPix ;
XColor TabColor[6];
XSizeHints size;
char *backcolor;
char *forecolor;
char *shadcolor;
char *licolor;
char *font;
char *icon;
char *title;
Bloc *periodictasks;
int HaveXSelection;
char* TabScriptId[99];
int NbChild;
time_t BeginTime;
char *TabArg[20];
} X11base ;
typedef struct
{
char *Msg;
char* R;
} TypeName;
typedef struct
{
int NbMsg;
TypeName TabMsg[40];
} TypeBuffSend ;
struct XObj
{
int TypeWidget;
Window win; /* Fenetre contenant l'objet */
Window *ParentWin; /* Fenetre parent */
Display *display;
int Screen;
Colormap *colormap;
XColor TabColor[6];
GC gc; /* gc utilise pour les requetes: 4 octets */
int id; /* Numero d'id */
int x,y; /* Origine du bouton */
int height,width; /* Hauteur et largeur */
char *title; /* Titre */
char *swallow; /* SwallowExec */
char *icon; /* Icon */
char *forecolor; /* Couleur des lignes */
char *backcolor; /* Couleur de fond */
char *shadcolor; /* Couleur des lignes */
char *licolor; /* Couleur de fond */
char *font; /* Police utilisee */
Pixmap iconPixmap; /* Icone charge */
Pixmap icon_maskPixmap; /* Icone masque */
int icon_w,icon_h; /* Largeur et hauteur de l'icone */
XFontStruct *xfont;
int value; /* Valeur courante */
int value2; /* Valeur minimale */
int value3; /* Valeur maximale */
int flags[5];
void (*InitObj) (struct XObj *xobj); /* Initialisation de l'objet */
void (*DestroyObj) (struct XObj *xobj); /* Destruction objet */
void (*DrawObj) (struct XObj *xobj); /* Dessin de l'objet */
void (*EvtMouse) (struct XObj *xobj,XButtonEvent *EvtButton);
void (*EvtKey) (struct XObj *xobj,XKeyEvent *EvtKey);
void (*ProcessMsg) (struct XObj *xobj,unsigned long type,unsigned long *body);
void *UserPtr;
};
void ChooseFunction(struct XObj *xobj,char *type);
void SendMsg(struct XObj *xobj,int TypeMsg);
void ExecBloc(Bloc *bloc);
void UnselectAllTextField(struct XObj **xobj);
int MyAllocNamedColor(Display *display,Colormap colormap,char* colorname,XColor* color);
void Quit (int NbArg,long *TabArg);
void SendMsgToScript(XEvent event);
|