예제 #1
0
void ErrorF(char *Format,...)
{
	void *Data;
	struct EasyStruct EasyStruct;
	ULONG IDCMPFlags;

	Data = &Format+1L;
	if (((struct Process *)FindTask(NULL))->pr_CLI)
	{
		VPrintf(Format,Data);
		FPutC(Output(),'\n');
		Flush(Output());
	}
	else
	{
		EasyStruct.es_StructSize = sizeof(struct EasyStruct);
		EasyStruct.es_Flags = 0L;
		EasyStruct.es_Title = "Error";
		EasyStruct.es_TextFormat = Format;
		EasyStruct.es_GadgetFormat = "Ok";

		IDCMPFlags = 0L;
		EasyRequestArgs(NULL,&EasyStruct,&IDCMPFlags,Data);
	}
}
예제 #2
0
void __showerror(char *format, const IPTR *args)
{
    struct IntuitionBase *IntuitionBase;
    struct DosLibrary *DOSBase = NULL;
    const char *name = FindTask(NULL)->tc_Node.ln_Name;

    if
    (
        !__forceerrorrequester                                                 &&
        (DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 0)) != NULL &&
	Cli() != NULL
    )
    {
        if (name)
	{
            PutStr(name);
            PutStr(": ");
	}

        if (args)
            VPrintf(format, args);
        else
            PutStr(format);
            
        PutStr("\n");
    }
    else
    if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0)))
    {
        struct EasyStruct es =
    	{
	    sizeof(struct EasyStruct),
	    0,
	    name,
	    format,
	    "Exit"
	};

	EasyRequestArgs(NULL, &es, NULL, args);

	CloseLibrary((struct Library *)IntuitionBase);
    }
    else
    {
        if (name)
            kprintf("%s: ", name);

        if (args) {
            vkprintf(format, args);
            kprintf("\n");
        }
        else
            kprintf("%s\n", format);
    }

    if (DOSBase != NULL)
        CloseLibrary((struct Library *)DOSBase);
    
}
예제 #3
0
long DoRequestA(STRPTR t,STRPTR gads,APTR args)
{
  struct EasyStruct es = {sizeof(struct EasyStruct),0,"DragTest-Request",NULL,NULL};

  es.es_TextFormat = t;
  es.es_GadgetFormat = gads;
  return(EasyRequestArgs(scr->FirstWindow,&es,0,args));
}
예제 #4
0
VOID Complain( STRPTR Bitch )
{
	if( IntuitionBase )
	{
		struct EasyStruct ErrorReq = {
			sizeof( struct EasyStruct ), 0, "Error", 0L, "Ok" };
		ErrorReq.es_TextFormat = Bitch;
		EasyRequestArgs( 0L, &ErrorReq, 0L, 0L );
	}
}
예제 #5
0
WORD ShowMessage(STRPTR title, STRPTR text, STRPTR gadtext)
{
    struct EasyStruct es;
    
    es.es_StructSize   = sizeof(es);
    es.es_Flags        = 0;
    es.es_Title        = title;
    es.es_TextFormat   = text;
    es.es_GadgetFormat = gadtext;
   
    return EasyRequestArgs(NULL, &es, NULL, NULL);  
}
예제 #6
0
void
ReqA( const char* text, APTR args )
{
    struct EasyStruct es =
    {
        sizeof (struct EasyStruct),
        0,
        (STRPTR) DevName,
        (STRPTR) text,
        "OK"
    };

    EasyRequestArgs( NULL, &es, NULL, args );
}
예제 #7
0
static ULONG Req( UBYTE *gadgets, UBYTE *body, ... ) {
  struct EasyStruct req = {
    sizeof (struct EasyStruct), 0, NULL, NULL, NULL
  };
  ULONG rc;

  req.es_Title        = (char *) msgTextProgramName;
  req.es_TextFormat   = body; 
  req.es_GadgetFormat = gadgets;

  SetAttrs( WO_Window, WA_BusyPointer, TRUE, TAG_DONE);
 	rc = EasyRequestArgs( Window, &req, NULL, ( ULONG * )( &body + 1 ) );
  SetAttrs( WO_Window, WA_BusyPointer, FALSE, TAG_DONE);

  return rc;
}
예제 #8
0
void
ReqA( const char*        text,
      APTR               args,
      struct DriverBase* AHIsubBase )
{
  struct EasyStruct es = 
  {
    sizeof (struct EasyStruct),
    0,
    (STRPTR) LibName,
    (STRPTR) text,
    "OK"
  };

  EasyRequestArgs( NULL, &es, NULL, args );
}
예제 #9
0
void
ReqA( const char* text, APTR args )
{
  struct EasyStruct es = 
  {
    sizeof (struct EasyStruct),
    0,
    (STRPTR) ISAPNPNAME " " VERS,
    (STRPTR) text,
    "OK"
  };

  if( IntuitionBase != NULL )
  {
    EasyRequestArgs( NULL, &es, NULL, args );
  }
}
예제 #10
0
int MessageBox(HWND hWnd, TCHAR *lpText, TCHAR *lpCaption, UINT uType) {

  struct EasyStruct req;
  LONG res;

  DebOut("MessageBox(): %s \n", lpText);

  if(!uType & MB_OK) {
    DebOut("WARNING: unsupported type: %lx\n", uType);
  }

  req.es_StructSize=sizeof(struct EasyStruct);
  req.es_Flags = 0;
  req.es_TextFormat=lpText;

  if(lpCaption) {
    req.es_Title=lpCaption;
  }
  else {
    req.es_Title="Error";
  }

  if(uType & MB_YESNO) {
    req.es_GadgetFormat="Yes|No";
  }
  else {
    /* MB_OK 0x00000000L is the default */
    req.es_GadgetFormat="Ok";
  }

  res=EasyRequestArgs(0, &req, 0, 0);

  if(uType & MB_YESNO) {
    if(res==1) {
      return IDYES;
    }
    return IDNO;
  }

  return IDOK;
}
예제 #11
0
// Open dopus5.library
void startup_open_dopuslib()
{
    // Open the library
#ifdef __amigaos4__
    if (!OpenLibIFace("dopus5:libs/dopus5.library", (APTR)&DOpusBase, (APTR)&IDOpus, LIB_VERSION))
#else
    if (!(DOpusBase=OpenLibrary("dopus5:libs/dopus5.library",LIB_VERSION)))
#endif
    {
#ifndef __amigaos3__
        struct Library *IntuitionBase; //Crashes OS3 binary
#endif
        // Get Intuition
#ifdef __amigaos4__
        if (OpenLibIFace("intuition.library", (APTR)&IntuitionBase, (APTR)&IIntuition, 0))
#else
        if ((IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0)))
#endif
        {
            struct EasyStruct easy;

            // Fill out EasyStruct
            easy.es_StructSize=sizeof(easy);
            easy.es_Flags=0;
            easy.es_Title=dopus_name;
            easy.es_TextFormat="Unable to open dopus5.library!";
            easy.es_GadgetFormat="Ok";

            // Show error
            EasyRequestArgs(0,&easy,0,0);

            // Close library
#ifdef __amigaos4__
            DropInterface((struct Interface *)IIntuition);
#endif
            CloseLibrary((struct Library *)IntuitionBase);
        }
        exit(0);
    }
}
예제 #12
0
void ErrorMessage(char *fmt, ...)
{
	va_list ap;
	struct IntuitionBase *IntuitionBase;

	IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 36);
	if (IntuitionBase) {
		struct EasyStruct es = {
			sizeof (struct EasyStruct),
			0,
			"FAT filesystem critical error",
			NULL,
			"Ok"
		};
		va_start(ap, fmt);

		es.es_TextFormat = fmt;
		EasyRequestArgs(NULL, &es, NULL, ARGS(ap));
		va_end(ap);
		CloseLibrary((struct Library *)IntuitionBase);
	}
}
예제 #13
0
/***********************************************************************************
 * Procedure: request
 * Synopsis:  rc = request(nochoice, txtidx, parm, option)
 * Purpose:   Present a requester to the user
 ***********************************************************************************/
int request(int nochoice,
            int txtidx,
            char *parm,
            char *option
           )
{
   int rqrc;

#ifdef PROJECT_VMAKE
/* VOpts doesn't support REXX - under VMake want to fail with no requester */
   if (global.inrexx)
   {
      global.rexxrc = txtidx; /* rexx RC matches config file text entries  */
      return 0;               /* equivalent to user clicking "Cancel"      */
   }
#endif

   if (IntuitionBase->LibNode.lib_Version >= 36)
   {
      int i;
      ULONG iflags;
      char *args[5];
      struct EasyStruct RespES = { sizeof(struct EasyStruct), 0, NULL, "%s", "%s|%s" };

      i = 0;
      args[i++] = global.text[txtidx];
      if (parm)
      {
         RespES.es_TextFormat = "%s\n%s";
         args[i++] = parm;
      }

      if (nochoice)
      {
         RespES.es_GadgetFormat = global.text[TEXT_OK];
      }
      else
      {
         args[i++] = global.text[TEXT_OK];
         if (option)
         {
            RespES.es_GadgetFormat = "%s|%s|%s";
            args[i++] = option;
         }
         args[i++] = global.text[TEXT_CANCEL];
      }

      iflags = IDCMP_DISKINSERTED;

      rqrc = EasyRequestArgs(global.window, &RespES, &iflags, (APTR)args);
   }
   else
   {
      struct IntuiText body, body1, pos, neg;
      int width, height;

      body.FrontPen  =
      body.BackPen   = -1;
      body.DrawMode  = JAM1;
      body.LeftEdge  = 6;
      body.TopEdge   = 4;
      body.ITextFont = &global.ri.TextAttr;
      body.IText     = global.text[txtidx];
      body.NextText  = NULL;

      body1 = body;
      pos   = body;
      neg   = body;
      width = IntuiTextLength(&body);
      height = 4 * global.iheight;
      if (parm)
      {
         int ewidth;
         body.NextText = &body1;
         body1.IText   = parm;
         body1.TopEdge = global.iheight;
         height += global.iheight;
         ewidth = IntuiTextLength(&body1);
         if (ewidth > width) width = ewidth;
      }
      width += 36;  /* margins, resize gadget etc. */
      pos.IText = global.text[TEXT_OK];
      if (nochoice)
      {
         neg.IText = pos.IText;
      }
      else
      {
         neg.IText = global.text[TEXT_CANCEL];
      }

      rqrc = AutoRequest(global.window,
                         &body, &pos, &neg, 0, 0, width, height);      
   }

#ifdef PROJECT_VMAKE
/* VOpts doesn't support ARexx - want VMake to set ARexx return code */
/* unless user followed a success path from the requester            */
   if ((rqrc == 0) || nochoice)
      global.rexxrc = txtidx;
#endif

   return rqrc;
}
예제 #14
0
void mountPartitions(struct List *ptlist) 
{
    struct EasyStruct es =
    {
        sizeof(struct EasyStruct), 0,
        "HDToolBox",
        0,
        "Yes|No"
    };
    struct PartitionTableNode *table;
    struct PartitionHandle *ph;
    WORD cm;
    WORD reboot = 0;

    D(bug("[HDToolBox] mountPartitions()\n"));

    table = (struct PartitionTableNode *)ptlist->lh_Head;
    while (table->ln.ln_Succ)
    {
        if (table->type != PHPTT_UNKNOWN)
        {
            ph = (struct PartitionHandle *)table->ph->table->list.lh_Head;
            while (ph->ln.ln_Succ)
            {
                if (existsAttr(table->pattrlist, PTA_AUTOMOUNT))
                {
                LONG flag;

                    GetPartitionAttrsA(ph, PT_AUTOMOUNT, &flag, TAG_DONE);
                    if (flag)
                    {
                        if (existsAttr(table->pattrlist, PTA_NAME))
                        {
                        UBYTE name[32];
                        struct DosEnvec de;
    
                            GetPartitionAttrsA(ph, PT_NAME, name, PT_DOSENVEC, &de, TAG_DONE);
                            cm = checkMount(table, name, &de);
                            if (cm == 1)
                                mount(table, ph, name, &de);
                            else if (cm == 2)
                                kprintf("may reboot\n");
                            else if (cm == 3)
                                kprintf("have to reboot\n");
                            else
                                kprintf("mount %s not needed\n", name);
                            if (reboot<cm)
                                reboot = cm;
                        }
                        else
                            kprintf("Partition with no name is automountable\n");
                    }
                }
                ph = (struct PartitionHandle *)ph->ln.ln_Succ;
            }
        }
        table = (struct PartitionTableNode *)table->ln.ln_Succ;
    }
    if (reboot > 1)
    {
        if (reboot == 2)
        {
            es.es_TextFormat =
                "A reboot is not necessary because the changes do not\n"
                "affect the work of any running filesystem.\n"
                "Do you want to reboot anyway?";
        }
        else
        {
            es.es_TextFormat =
                "A reboot is required because the changes affect\n"
                "the work of at least one running filesystem.\n"
                "Do you want to reboot now?";
        }
        if (EasyRequestArgs(0, &es, 0, 0))
            ColdReboot();
    }
}