Exemple #1
0
static void de_run_icns_pass(deark *c, lctx *d, int pass)
{
	de_int64 i;
	de_int64 segment_pos;
	struct page_ctx *pg = NULL;
	int image_count;

	segment_pos = 8;
	image_count = 0;

	while(1) {
		de_int64 segment_len;

		if(pg) { de_free(c, pg); pg=NULL; }

		if(segment_pos+8 > d->file_size) break;

		pg = de_malloc(c, sizeof(struct page_ctx));
		pg->image_num = image_count;

		dbuf_read_fourcc(c->infile, segment_pos, &pg->code4cc, 0);

		segment_len = de_getui32be(segment_pos+4);

		pg->image_pos = segment_pos + 8;
		pg->image_len = segment_len - 8;

		if(pass==2) {
			de_dbg(c, "image #%d, type '%s', at %d, size=%d\n", pg->image_num, pg->code4cc.id_printable,
				(int)pg->image_pos, (int)pg->image_len);
		}
		if(segment_len<8 || segment_pos+segment_len > d->file_size) {
			if(pass==2) {
				de_err(c, "Invalid length for segment '%s' (%u)\n", pg->code4cc.id_printable,
					(unsigned int)segment_len);
			}
			break;
		}

		if(pass==2) {
			// Find this type code in the image_type_info array
			pg->type_info = NULL;
			for(i=0; image_type_info_arr[i].code!=0; i++) {
				if(image_type_info_arr[i].code==pg->code4cc.id) {
					pg->type_info = &image_type_info_arr[i];
					break;
				}
			}
			if(!pg->type_info) {
				de_warn(c, "(Image #%d) Unknown image type '%s'\n", pg->image_num, pg->code4cc.id_printable);
			}
		}

		if(pass==1) {
			switch(pg->code4cc.id) {
			case 0x69636d23: // icm# 16x12x1
				d->mkpos_16_16_1 = pg->image_pos + (16*12)/8;
				break;
			case 0x69637323: // ics# 16x16x1
				d->mkpos_16_16_1 = pg->image_pos + 16*16/8;
				break;
			case 0x49434e23: // ICN# 32x32x1
				d->mkpos_32_32_1 = pg->image_pos + 32*32/8;
				break;
			case 0x69636823: // ich# 48x48x1
				d->mkpos_48_48_1 = pg->image_pos + 48*48/8;
				break;
			case 0x73386d6b: // s8mk 16x16x8
				d->mkpos_16_16_8 = pg->image_pos;
				break;
			case 0x6c386d6b: // l8mk 32x32x8
				d->mkpos_32_32_8 = pg->image_pos;
				break;
			case 0x68386d6b: // h8mk 48x48x8
				d->mkpos_48_48_8 = pg->image_pos;
				break;
			case 0x74386d6b: // t8mk 128x128x8
				d->mkpos_128_128_8 = pg->image_pos;
				break;
			}
		}
		else if(pass==2) {
			de_dbg_indent(c, 1);
			do_icon(c, d, pg);
			de_dbg_indent(c, -1);
		}

		image_count++;
		segment_pos += segment_len;
	}

	if(pg) de_free(c, pg);
}
Exemple #2
0
void handle_msg(int *msg)
{
	WINDOWP	window;

	wake_mouse();
	window= get_window(msg[3]);			/* Zugeh�riges Fenster */

	switch (msg[0])							/* Art der Nachricht */
	{
		case MN_SELECTED:
			if (makro_rec)						/* Makro wird Tastendruck vorgegaukelt */
			{
				int	kstate, kreturn;
				char	str[50];
				
				get_string(menu, msg[4], str);
				if (str_to_key(str, &kstate, &kreturn))
				{
					kstate |= (kstate & 3);
					to_makro(kstate, kreturn);
				}
			}
			handle_menu(msg[3], msg[4], menu_ctrl);
			menu_ctrl = FALSE;
			break;
		case WM_REDRAW  :
			if (msg[3] == akt_handle)
				redraw_aktion();
			else
				redraw_window (window, (GRECT*)(msg+4));
			break;
		case WM_CLOSED  :
			do_icon(window->handle, DO_DELETE);
			break;
		case WM_FULLED  :
			full_window (window);
			break;
		case WM_ARROWED :
			arrow_window (window, msg[4], 1);
			break;
		case WM_HSLID	 :
			h_slider (window, msg[4]);
			break;
		case WM_VSLID	 :
			v_slider (window, msg[4]);
			break;
		case WM_SIZED	 :
			size_window (window, (GRECT*)(msg+4), TRUE);
			break;
		case WM_MOVED	 :
			move_window (window, (GRECT*)(msg+4));
			break;
		case WM_NEWTOP	 : /* Fenster von qed ist irgendwie nach oben gekommen */
		case WM_ONTOP	 :
			ontop_window(window);
			break;
		case WM_TOPPED  :
			top_window (window);
			break;
		case WM_UNTOPPED: /* qed hat jetzt nicht mehr das Top-Fenster */
			untop_window (window);
			break;
		case WM_BOTTOMED: 	/* AES 4.00 MagiC 3 : Fenster nach hinten */
		case WM_M_BDROPPED :	/* Magic 2 */
			bottom_window (window, msg[0]);
			break;
		case WM_ICONIFY:
			iconify_window(window, (GRECT*)(msg+4));
			break;
		case WM_ALLICONIFY:
			all_iconify(window, (GRECT*)(msg+4));
			break;
		case WM_UNICONIFY:
			if (all_iconified)
				all_uniconify(NULL, (GRECT*)(msg+4));
			else
				uniconify_window(window, (GRECT*)(msg+4));
			break;
		case WM_SHADED :
		case WM_UNSHADED :
			shade_window(window, msg[0]);
			break;

		case AP_TERM:
			if (all_iconified)
				all_uniconify(NULL, NULL);
			quick_close = TRUE;
			if (prepare_quit())
				do_quit();
			break;
		case AP_DRAGDROP :
			if (all_iconified)
				Bconout(2, 7);
			else
				handle_dd(msg);
			break;

		case SC_CHANGED :
			/*
			 * Ignorieren, da wir vor dem Paste sowieso neu laden.
			*/
			break;

		case VA_START :
		case VA_PROTOSTATUS :
		case VA_DRAG_COMPLETE :
		case VA_DRAGACCWIND :
		case AV_SENDKEY :
			handle_av(msg);
			break;

		case SE_INIT:
		case SE_OK:
		case SE_ACK:
		case SE_OPEN:
		case SE_ERROR:
		case SE_ERRFILE:
		case SE_PROJECT:
		case SE_QUIT:
		case SE_TERMINATE:
		case SE_CLOSE :
		case SE_MENU :
			if (all_iconified)
				all_uniconify(NULL, NULL);
		   handle_se(msg);
		   break;

		case OLGA_INIT :
		case OLE_NEW :
		case OLGA_ACK :
		case OLE_EXIT :
			handle_olga(msg);
			break;

		case SH_WDRAW:				/* schickt Freedom st�ndig */
		case DHST_ACK:				/* SMU antwortet */
			/* ignore */
			break;

		case FONT_CHANGED :
			if (msg[4] != 0)
				font_id = msg[4];
			if (msg[5] != 0)
				font_pts = msg[5];
			font_change();	
			break;
			
		default:
			if (debug_level)
			{
				char	str[12];
				int	d, i, id;
	
				if ((appl_xgetinfo(4, &d, &d, &i, &d)) && (i == 1))	/* gibts appl_search? */
				{
					i = appl_search(0, str, &d, &id);
					while (i != 0)
					{
						if (id == msg[1])
							break;
						i = appl_search( 1, str, &d, &id);
					}
				}
				else
				{
					strcpy(str, "");
					id = msg[1];
				}
				debug("Unbekannte Msg %d (0x%X) von %s (%d)\n", msg[0], msg[0], str, id);
			}
			break;
	}
}