コード例 #1
0
void FileIconCollection::ReadImagesAsync(HWND hwndNotify, UINT uMsgNotify, WPARAM wParamNotify)
{
	bReadingImages = true;

	for (FileIcon *pEnum = pFirstIcon; pEnum; pEnum = pEnum->NextIcon()) {
		tg.run([=] { ReadIcon(pEnum, hwndNotify, uMsgNotify, wParamNotify); } );
	}
}
コード例 #2
0
ファイル: xengineoutput.c プロジェクト: zhenglu/meowboard
static void InitializeEngineOutput()
{
        ReadIcon(WHITE_14,   nColorWhite);
        ReadIcon(BLACK_14,   nColorBlack);
        ReadIcon(UNKNOWN_14, nColorUnknown);

        ReadIcon(CLEAR_14,   nClear);
        ReadIcon(PONDER_14,  nPondering);
        ReadIcon(THINK_14,   nThinking);
        ReadIcon(ANALYZE_14, nAnalyzing);
}
コード例 #3
0
FileIcon *FileIconCollection::AddFile(PCTCHAR pcszNewName, bool bReadIcon)
{
	WIN32_FIND_DATA	ffd;
	HANDLE hff = FindFirstFile(pcszNewName, &ffd);
	if (hff == INVALID_HANDLE_VALUE) return nullptr;

	FindClose(hff);

	FileIcon *pfi = AddIcon(pcszNewName, ffd.nFileSizeLow, *(QWORD *)&ffd.ftLastWriteTime, ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
	if (!pfi) return nullptr;

	if (bReadIcon) ReadIcon(pfi);

	if (pfi->GetType() == fitImage) Cache.Invalidate();

	return pfi;
}
コード例 #4
0
ファイル: xengineoutput.c プロジェクト: Jvlythical/ECS40
void
InitEngineOutput (Option *opt, Option *memo2)
{	// front-end, because it must have access to the pixmaps
#ifdef TODO_GTK
	Widget w = opt->handle;
	memoWidget = memo2->handle;
#endif
    ReadIcon("eo_White.svg", nColorWhite);
    ReadIcon("eo_Black.svg", nColorBlack);
    ReadIcon("eo_Unknown.svg", nColorUnknown);

    ReadIcon("eo_Clear.svg", nClear);
    ReadIcon("eo_Ponder.svg", nPondering);
    ReadIcon("eo_Thinking.svg", nThinking);
    ReadIcon("eo_Analyzing.svg", nAnalyzing);
}
コード例 #5
0
// image selection callback
void XMLBarEditor::imageSelCb(void)
{
	static String lastPath = "";
	
	// opens a file selector, allows selection of some
	// kind of image formats
	FileSel fs;
	fs.ActiveDir(lastPath);
	fs.Type(t_("Image files"), "*.png,*.jpg,*.ico,*.bmp");
	if(!fs.ExecuteOpen(t_("Select icon file")))
		return;
	String path = fs.Get();
	lastPath = GetFileFolder(path);
	String ext = ToUpper(GetFileExt(path));
	Image img;
	if(ext != ".ICO")
		img = StreamRaster::LoadFileAny(path);
	else
	{
		String data = LoadFile(path);
		Vector<Image> imgVec;
		try
		{
		 	imgVec = ReadIcon(data);
		}
		catch(...)
		{
		}
		if(imgVec.GetCount())
			img = imgVec[0];
		else
			img = Null;
	}
	curIcon = img;
	itemPane.icon.SetImage(img);
	fieldsModCb();
}
コード例 #6
0
ファイル: init.c プロジェクト: 9072997/wikireader
int
ReadCommands(const char *filename)
{
	int handle = file_open(filename, FILE_OPEN_READ);
	if (handle < 0) {
		debug_printf("init: open error = %d\n", handle);
		return false;
	}

	ssize_t r = file_read(handle, buffer, sizeof(buffer));
	(void)file_close(handle);
	if (r == 0) {
		debug_print("init: empty file\n");
		return false;
	} else if (r < 0) {
		debug_printf("init: read error = %ld\n", (long)r);
		return false;
	}

	memset(MenuRecord, 0, sizeof(MenuRecord));

	enum {
		STATE_SkipSpaces,
		STATE_ignore,
		STATE_icon,
		STATE_StartCommand,
		STATE_EndCommand,
	} state = STATE_SkipSpaces;
	size_t item = 0;
	ssize_t i;
	for (i = 0; i < r; ++i) {
		char c = buffer[i];

		// parse:
		// <spaces> <icon> <spaces> : <spaces> <command>
		switch (state) {

		case STATE_SkipSpaces:
			if (';' == c || '#' == c) {
				state = STATE_ignore;
			} else if (!isspace(c)) {
				MenuRecord[item].IconName = &buffer[i];
				state =  STATE_icon;
				if ('\n' == c || ':' == c) {
					buffer[i] = '\0';
					state =  STATE_SkipSpaces;  // ignore blank icon
				}
			}
			break;

		case STATE_ignore:
			if ('\n' == c) {
				state =  STATE_SkipSpaces;
			}
			break;

		case STATE_icon:
			if ('\n' == c) {
				buffer[i] = '\0';
				state =  STATE_SkipSpaces;         // ignore if command is missing
			} else if (':' == c) {
				buffer[i] = '\0';
				size_t j;
				for (j = i - 1; j > 0 && isspace(buffer[j]) ; --j) {
					buffer[j] = '\0';
				}
				if (ReadIcon(MenuRecord[item].icon, sizeof(MenuRecord[item].icon),
					     MenuRecord[item].IconName)) {
					state = STATE_StartCommand;
				} else {
					state =  STATE_SkipSpaces;  // ignore invalid icon
				}
			}
			break;

		case STATE_StartCommand:
			if (!isspace(c)) {
				MenuRecord[item].command = &buffer[i];
				state =  STATE_EndCommand;
				if ('\n' == c) {
					buffer[i] = '\0';
					state =  STATE_SkipSpaces;  // ignore blank commands
				}
			}
			break;

		case STATE_EndCommand:
			if ('\n' == c) {
				MenuRecord[item].ok = true;
				buffer[i] = '\0';
				state =  STATE_SkipSpaces;
				size_t j;
				for (j = i - 1; j > 0 && isspace(buffer[j]) ; --j) {
					buffer[j] = '\0';
				}
				++item;
				if (item >= SizeOfArray(MenuRecord)) {
					return true;
				}
			}
			break;
		}
	}

	return(item);
}