home *** CD-ROM | disk | FTP | other *** search
- #include "struct.c"
- #include "WinPlot.h"
-
- /* Contruct Entry for FontListView */
- static __saveds __asm char *ConFont(register __a0 struct Hook *hook,
- register __a2 APTR mem_pool,
- register __a1 struct FileInfoBlock *fib)
- {
- char pattern[14];
-
- ParsePatternNoCase("#?.otag", pattern, 14);
-
- if (fib->fib_DirEntryType < 0)
- {
- if (MatchPatternNoCase(pattern, fib->fib_FileName))
- {
- char *entry;
- int len;
-
- len = strlen(fib->fib_FileName)-5;
-
- if (entry = LibAllocPooled(mem_pool, len+1))
- {
- fib->fib_FileName[len] = '\0';
- strcpy(entry, fib->fib_FileName);
- return entry;
- }
- }
- }
-
- return NULL;
- }
-
- struct Hook ConFontHook =
- {
- {
- NULL, NULL
- },
- (void *)ConFont,
- NULL, NULL
- };
-
- /* Deconstruct FontListView Entry */
- static __saveds __asm void DesFont(register __a0 struct Hook *hook,
- register __a2 APTR mem_pool,
- register __a1 char *line)
- {
- LibFreePooled(mem_pool, line, strlen(line)+1);
- }
-
- struct Hook DesFontHook =
- {
- {
- NULL, NULL
- },
- (void *)DesFont,
- NULL, NULL,
- };
-
- static __saveds __asm void RexxCommandFunc(register __a0 struct Hook *hook,
- register __a2 APTR object,
- register __a1 APTR param[])
- {
- SendRexxMsg(param[0]);
- }
-
- struct Hook RexxCommandHook =
- {
- {
- NULL, NULL
- },
- (void *)RexxCommandFunc,
- NULL, NULL
- };
-
- static __saveds __asm void StringCommandFunc(register __a0 struct Hook *hook,
- register __a2 APTR object)
- {
- char *Command;
-
- get(object, MUIA_String_Contents, &Command);
- SendRexxMsg(Command);
- }
-
- struct Hook StringCommandHook =
- {
- {
- NULL, NULL
- },
- (void *)StringCommandFunc,
- NULL, NULL
- };
-
- static __saveds __asm void CheckFunc(register __a0 struct Hook *hook,
- register __a2 APTR object,
- register __a1 APTR param[])
- {
- char Command[255];
- ULONG Selected;
-
- get(object, MUIA_Selected, &Selected);
- sprintf(Command, param[0], Selected ? "" : "no");
- SendRexxMsg(Command);
- }
-
- struct Hook CheckHook =
- {
- {
- NULL, NULL,
- },
- (void *)CheckFunc,
- NULL, NULL
- };
-
- static __saveds __asm void RangeFunc(register __a0 struct Hook *hook,
- register __a2 APTR object,
- register __a1 APTR param[])
- {
- struct RangeObject *ro;
- char *s, *Buffer, Command[255];
- double min, max;
-
- ro = (struct RangeObject *)param[0];
- s = (char *)param[1];
- get(ro->Min, MUIA_String_Contents, &Buffer);
- sscanf(Buffer, "%lg", &min);
- get(ro->Max, MUIA_String_Contents, &Buffer);
- sscanf(Buffer, "%lg", &max);
- sprintf(Command, "set %s [%g:%g]", s, min, max);
- SendRexxMsg(Command);
- }
-
- struct Hook RangeHook =
- {
- {
- NULL, NULL
- },
- (void *)RangeFunc,
- NULL, NULL
- };
-
- static __saveds __asm void LogScaleFunc(register __a0 struct Hook *hook,
- register __a2 APTR object,
- register __a1 APTR param[])
- {
- struct LogScaleObject *lco;
- char *s, *Buffer, Command[255];
- ULONG Selected;
-
- lco = (struct LogScaleObject *)param[0];
- s = (char *)param[1];
- get(lco->LogScale, MUIA_Selected, &Selected);
- if (Selected)
- {
- get(lco->Base, MUIA_String_Contents, &Buffer);
- sprintf(Command, s, "", Buffer);
- }
- else
- sprintf(Command, s, "no", "");
-
- SendRexxMsg(Command);
- }
-
- struct Hook LogScaleHook =
- {
- {
- NULL, NULL
- },
- (void *)LogScaleFunc,
- NULL, NULL
- };
-
- static __saveds __asm void StyleFunc(register __a0 struct Hook *hook,
- register __a2 APTR object,
- register __a1 APTR param[])
- {
- char *s, Command[255];
- ULONG ca;
-
- s = (char *)param[0];
- get(object, MUIA_Cycle_Active, &ca);
- sprintf(Command, s, StyleEntries[ca]);
-
- SendRexxMsg(Command);
- }
-
- struct Hook StyleHook =
- {
- {
- NULL, NULL,
- },
- (void *)StyleFunc,
- NULL, NULL
- };
-
- static __saveds __asm void LabelFunc(register __a0 struct Hook *hook,
- register __a2 APTR object,
- register __a1 APTR param[])
- {
- struct LabelObject *lo;
- char *Title, *Label, *XOff, *YOff, Command[255];
-
- lo = (struct LabelObject *)param[0];
- Title = (char *)param[1];
- get(lo->Label, MUIA_String_Contents, &Label);
- get(lo->XOff, MUIA_String_Contents, &XOff);
- get(lo->YOff, MUIA_String_Contents, &YOff);
- sprintf(Command, "set %s \"%s\" %s,%s", Title, Label, XOff, YOff);
- SendRexxMsg(Command);
- }
-
- struct Hook LabelHook =
- {
- {
- NULL, NULL,
- },
- (void *)LabelFunc,
- NULL, NULL
- };
-
- static __saveds __asm void ViewFunc(register __a0 struct Hook *hook,
- register __a2 APTR object,
- register __a1 APTR param[])
- {
- char *s, Command[255];
-
- get(object, MUIA_String_Contents, &s);
- sprintf(Command, param[0], s);
-
- SendRexxMsg(Command);
- }
-
- struct Hook ViewHook =
- {
- {
- NULL, NULL,
- },
- (void *)ViewFunc,
- NULL, NULL
- };
-
- /* Construct Entry for VarListView */
- static __saveds __asm char *ConVar(register __a0 struct Hook *hook,
- register __a2 APTR mem_pool,
- register __a1 udvt_entry *udvt)
- {
- char *entry, Buffer[255];
- int len;
-
- switch(udvt->udv_value.type)
- {
- case INTGR:
- len = sprintf(Buffer, "%s=%d", udvt->udv_name, udvt->udv_value.v.int_val);
- break;
- case CMPLX:
- len = sprintf(Buffer, "%s={%f, %f}", udvt->udv_name,
- udvt->udv_value.v.cmplx_val.real,
- udvt->udv_value.v.cmplx_val.imag);
- break;
- }
- entry = LibAllocPooled(mem_pool, len+1);
- strcpy(entry, Buffer);
-
- return entry;
- }
-
- struct Hook ConVarHook =
- {
- {
- NULL, NULL
- },
- (void *)ConVar,
- NULL, NULL
- };
-
- /* Deconstruct VarListView Entry */
- static __saveds __asm void DesVar(register __a0 struct Hook *hook,
- register __a2 APTR mem_pool,
- register __a1 char *entry)
- {
- LibFreePooled(mem_pool, entry, strlen(entry)+1);
- }
-
- struct Hook DesVarHook =
- {
- {
- NULL, NULL
- },
- (void *)DesVar,
- NULL, NULL,
- };
-