Ejemplo n.º 1
0
// Show a requester
void global_requester(char *text)
{
	RexxRequester *req;
	char *ok_str;

	// Get OK string
	ok_str=GetString(&locale,MSG_OKAY);

	// Allocate requester argument packet
	if (req=AllocVec(sizeof(RexxRequester)+strlen(text)+strlen(ok_str)+5,MEMF_CLEAR))
	{
		// Store message
		req->command=RXCMD_REQUEST;

		// Copy string
		strcpy(req->args,"\"");
		strcat(req->args,text);
		strcat(req->args,"\" ");
		strcat(req->args,ok_str);

		// Startup requester process
		if (!(misc_startup(
			"dopus_rexx_request",
			REXX_REQUESTER,
			GUI->window,
			req,
			0))) FreeVec(req);
	}
}
Ejemplo n.º 2
0
// Edit a bank
BOOL buttons_edit_bank(
	Buttons *buttons,
	short col,
	short row,
	Cfg_Button *edit,
	struct AppMessage *appmsg,
	short can_start)
{
	buttons_edit_packet *packet;

	// Allocate packet
	if (packet=AllocVec(sizeof(buttons_edit_packet),MEMF_CLEAR))
	{
		// Fill out packet
		packet->buttons=buttons;
		packet->col=col;
		packet->row=row;
		packet->edit=edit;
		packet->can_start=can_start;
		packet->appmsg=appmsg;

		// Edit it
		if (misc_startup(NAME_BUTTON_EDITOR,MENU_EDIT_BUTTONS,buttons->window,packet,FALSE))
		{
			// Set flag for pending edit request
			buttons->flags|=BUTTONF_EDIT_REQUEST;
			return 1;
		}

		// Failed
		FreeVec(packet);
	}

	return 0;
}
Ejemplo n.º 3
0
int __stdcall WinMain(HINSTANCE hi, HINSTANCE hpi, LPSTR cmd, int cm)
{
	_qdgdfv_additional_int_info = (int) hi;
#else
int main(void)
{
#endif
	filp_startup();

	_qdgdfa_16_bit = 1;
	_qdgdfv_scale = 2;
	_qdgdfv_scale2x = 1;
	_qdgdfv_screen_x_size = 320;
	_qdgdfv_screen_y_size = 240;
	strcpy(_qdgdfv_window_title, "Freaks 2002 " VERSION);
/*	  strcpy(_qdgdfa_window_title,_qdgdfv_window_title);
*/ _qdgdfv_use_logger = 1;
	strcpy(_qdgdfv_logger_file, "fr2002.log");

	_qdgdfa_sound = 1;

	map_startup();

	filp_exec("\"$home_dir/config.filp\" load");
	filp_exec("'./setup.filp' load");

	qdgdfa_startup();
	qdgdfv_startup();

	render_startup();
	game_startup();
	misc_startup();

	for (;;) {
		if (main_menu())
			break;

		game_main_loop();
	}

	qdgdfv_shutdown();
	qdgdfa_shutdown();
	filp_shutdown();

	printf("qdgdfv version: %s\nqdgdfa version: %s\n", _qdgdfv_version, _qdgdfa_version);

	return 0;
}
Ejemplo n.º 4
0
// Trap 'more' in default tool
BOOL file_trap_more(char *name,char *tool)
{
	short len;
	BOOL ok=0;

	if (!(environment->env->settings.icon_flags&ICONFLAG_TRAP_MORE))
		return 0;

	// Look for 'more' in default tool
	len=strlen(tool);
	if (len>=4 && stricmp(tool+len-4,"more")==0 &&
		(len==4 || tool[len-5]=='/' || tool[len-5]==':'))
	{
		struct read_startup *read;

		// Allocate startup
		if ((read=AllocVec(sizeof(struct read_startup),MEMF_CLEAR)))
		{
			// Create list
			if ((read->files=(struct List *)Att_NewList(0)))
			{
				// Add file to list
				if (Att_NewNode((Att_List *)read->files,name,0,0))
				{
					// Substitute internal viewer
					misc_startup("dopus_more_trap",FUNC_SMARTREAD,0,read,FALSE);
					ok=1;
				}
				else Att_RemList((Att_List *)read->files,0);
			}
			if (!ok) FreeVec(read);
		}
	}

	return ok;
}
Ejemplo n.º 5
0
// Got a notify message from PutDiskObject()
BOOL backdrop_check_notify(
	BackdropInfo *info,
	DOpusNotify *notify,
	Lister *lister)
{
	char *name_buf;
	BOOL disk=0,ret=0;
	struct List *search;
	BackdropObject *object;

	if (!(name_buf=AllocVec(256,0)))
		return 0;

	// Disk icon?
	if (notify->dn_Name[strlen(notify->dn_Name)-1]==':')
	{
		char *ptr;

		// Get volume name
		if ((ptr=strchr(notify->dn_Name,':')))
		{
			stccpy(name_buf,notify->dn_Name,ptr-notify->dn_Name+1);
			disk=1;
		}
	}

	// Otherwise copy name and clear it
	else
	{
		// Get name pointer
		char *name=FilePart(notify->dn_Name);

		// Copy name
		strcpy(name_buf,name);
		*name=0;

		// Strip trailing '/'
		if (*(name-1)=='/') *(name-1)=0;
	}

	// Is this a lister?
	if (lister)
	{
		short len;
		BOOL ok=0;

		// Match length
		len=strlen(notify->dn_Name);

		// See if strings match
		if (strnicmp(lister->cur_buffer->buf_Path,notify->dn_Name,len)==0)
		{
			// Check termination
			if (lister->cur_buffer->buf_Path[len]=='\0') ok=1;

			// / can terminate too
			else
			if (lister->cur_buffer->buf_Path[len]=='/' &&
				lister->cur_buffer->buf_Path[len+1]=='\0') ok=1;
		}

		// Didn't match?
		if (!ok)
		{
			// Free message
			ReplyFreeMsg(notify);	
			FreeVec(name_buf);
			return 0;
		}
	}

	// Lock backdrop list
	lock_listlock(&info->objects,1);

	// See if there's an icon of this name
	search=&info->objects.list;
	while ((object=(BackdropObject *)FindNameI(search,name_buf)))
	{
		// Disk?
		if (object->type==BDO_DISK && disk)
		{
			// Matched
			break;
		}

		// Valid object?
		else
		if (object->type!=BDO_APP_ICON &&
			object->type!=BDO_BAD_DISK &&
			object->path)
		{
			char *path=0;
			BPTR lock;

			// If no lister, get full path of object
			if (!lister && (path=AllocVec(512,0)))
			{
				// Lock path
				if ((lock=Lock(object->path,ACCESS_READ)))
				{
					// Get full path
					DevNameFromLockDopus(lock,path,512);
					UnLock(lock);
				}

				// Failed
				else strcpy(path,object->path);
			}
					
			// Objects in same directory?
			if (lister || stricmp(notify->dn_Name,(path)?path:object->path)==0)
			{
				// Free path
				if (path) FreeVec(path);

				// Matched
				break;
			}

			// Free path
			if (path) FreeVec(path);
		}

		// If this is a lister, there could only be one
		if (lister)
		{
			object=0;
			break;
		}

		// Keep searching from this object
		search=(struct List *)object;
	}

	// Got object?
	if (object)
	{
		ULONG old_image1=0,old_image2=0,new_image1,new_image2,old_flags=0,new_flags;
		BOOL redraw=0;
		struct DiskObject *old;

		// Save old icon
		old=object->icon;
		object->icon=0;

		// Not deleted?
		if (!notify->dn_Flags)
		{
			// Get image checksums
			old_image1=IconCheckSum(old,0);
			old_image2=IconCheckSum(old,1);
			old_flags=GetIconFlags(old);

			// Get new icon
			backdrop_get_icon(info,object,GETICON_CD|GETICON_NO_POS|GETICON_FAIL);
		}

		// No icon now?
		if (!object->icon)
		{
			// Replace old icon
			object->icon=old;

			// Erase old object
			backdrop_erase_icon(info,object,BDSF_RECALC);

			// Is object a disk?
			if (object->type==BDO_DISK)
			{
				// Signal to refresh drives
				IPC_Command(info->ipc,MAINCMD_REFRESH_DRIVES,0,0,0,0);
			}

			// Remove object from list
			backdrop_remove_object(info,object);
		}

		// Ok to keep going
		else
		{
			// Get image checksums
			new_image1=IconCheckSum(object->icon,0);
			new_image2=IconCheckSum(object->icon,1);
			new_flags=GetIconFlags(object->icon);

			// Mask out uninteresting flag bits
			old_flags&=ICONF_BORDER_OFF|ICONF_BORDER_ON|ICONF_NO_LABEL;
			new_flags&=ICONF_BORDER_OFF|ICONF_BORDER_ON|ICONF_NO_LABEL;

			// Need to redraw?
			if (old_image1!=new_image1 ||
				old_image2!=new_image2 ||
				old_flags!=new_flags)
			{
				// Erase old object
				backdrop_erase_icon(info,object,0);
				redraw=1;
			}

			// Free old icon
			if (old)
			{
				// Free icon remapping
				RemapIcon(old,(info->window)?info->window->WScreen:0,1);

				// Free icon
				FreeCachedDiskObject(old);
			}

			// Fix new icon size
			backdrop_get_icon(info,object,GETICON_POS_ONLY|GETICON_SAVE_POS|GETICON_KEEP);

			// Need to get masks?
			if (!backdrop_icon_border(object))
			{
				// Get masks for this icon
				backdrop_get_masks(object);
			}
			
			// Show new icon
			if (redraw) backdrop_render_object(info,object,BRENDERF_CLIP);
		}

		ret=1;
	}

	// Otherwise, got lister?
	else
	if (lister)
	{
		// Tell lister to get icons
		IPC_Command(lister->ipc,LISTER_GET_ICONS,0,0,0,0);
		ret=1;
	}

	// Or, on the desktop?
	else
	if (info->flags&BDIF_MAIN_DESKTOP)
	{
		BPTR lock1,lock2;

		// Lock the desktop folder and the changed directory
		if ((lock1=Lock(environment->env->desktop_location,ACCESS_READ)) &&
			(lock2=Lock(notify->dn_Name,ACCESS_READ)))
		{
			// Same directory?
			if (SameLock(lock1,lock2)==LOCK_SAME)
			{
				// Update the desktop folder
				misc_startup("dopus_desktop_update",MENU_UPDATE_DESKTOP,GUI->window,0,TRUE);
			}

			// Unlock second lock
			UnLock(lock2);
		}

		// Unlock first lock
		UnLock(lock1);
	}

	// Unlock list
	unlock_listlock(&info->objects);

	// Free message
	ReplyFreeMsg(notify);	
	FreeVec(name_buf);
	return ret;
}