예제 #1
0
파일: cp.c 프로젝트: SayCV/flickernoise
void cp_autostart(void)
{
	char autostart[256];
	int dt, as;

	switch(sysconfig_get_autostart_mode()) {
		case SC_AUTOSTART_NONE:
			break;
		case SC_AUTOSTART_SIMPLE:
			sysconfig_get_autostart_mode_simple(&dt, &as);
			start_performance(1, dt, as);
			break;
		case SC_AUTOSTART_FILE:
			sysconfig_get_autostart(autostart);
			if(autostart[0] == 0) {
				messagebox("Autostart failed", "No performance file specified.");
				fb_unblank();
				return;
			}
			if(!config_load(autostart)) {
				messagebox("Autostart failed", "Unable to load the specified performance file.\nCheck the 'Autostart' section in the 'System settings' dialog box.");
				fb_unblank();
				return;
			}
			on_config_change();
			update_title_default_config(autostart);
			start_performance(0, 0, 0);
			break;
	}
}
예제 #2
0
파일: ir.c 프로젝트: SayCV/flickernoise
static void autobuild_callback(mtk_event *e, void *arg)
{
	char key[8];
	char filename[384];
	char *c;
	int i, index;

	mtk_req(appid, key, sizeof(key), "e_key.text");
	mtk_req(appid, filename, sizeof(filename), "e_filename.text");
	index = strtol(key, &c, 0);
	if((*c != 0x00) || (index < 0) || (index > 63)) {
		messagebox("Auto build failed",
			   "Invalid key code.\nUse a decimal or hexadecimal (0x...) number between 0 and 63.");
		return;
	}

	if(filename[0] == 0x00)
		strcpy(filename, SIMPLE_PATCHES_FOLDER);
	i = strlen(filename);
	if(filename[i-1] == '/')
		filename[i-1] = 0x00;

	autobuild(index, filename);
	update_list();
}
예제 #3
0
파일: edit.c 프로젝트: AlexSteel/wine
BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath)
{
    BOOL result = FALSE;
    LONG lRet;
    HKEY hKey;

    lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ|KEY_SET_VALUE, &hKey);
    if (lRet != ERROR_SUCCESS) {
	error_code_messagebox(hwnd, lRet);
	return FALSE;
    }
    
    if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_BOX_TITLE, IDS_DELETE_BOX_TEXT, keyPath) != IDYES)
	goto done;
	
    lRet = SHDeleteKeyW(hKeyRoot, keyPath);
    if (lRet != ERROR_SUCCESS) {
	error(hwnd, IDS_BAD_KEY, keyPath);
	goto done;
    }
    result = TRUE;
    
done:
    RegCloseKey(hKey);
    return result;
}
예제 #4
0
파일: edit.c 프로젝트: AlexSteel/wine
BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName, BOOL showMessageBox)
{
    BOOL result = FALSE;
    LONG lRet;
    HKEY hKey;
    LPCWSTR visibleValueName = valueName ? valueName : g_pszDefaultValueName;
    WCHAR empty = 0;

    lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
    if (lRet != ERROR_SUCCESS) return FALSE;

    if (showMessageBox)
    {
        if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_BOX_TITLE, IDS_DELETE_BOX_TEXT, visibleValueName) != IDYES)
            goto done;
    }

    lRet = RegDeleteValueW(hKey, valueName ? valueName : &empty);
    if (lRet != ERROR_SUCCESS && valueName) {
        error(hwnd, IDS_BAD_VALUE, valueName);
    }
    if (lRet != ERROR_SUCCESS) goto done;
    result = TRUE;

done:
    RegCloseKey(hKey);
    return result;
}
예제 #5
0
static inline void _perror_x(const char *errstr)
{
	char str[1024];
	char *errmsg;
	
	errmsg = strerror(errno);

	sprintf(str, "%s: %s: %s\n", EXECNAME, errstr, errmsg);
	console_err(str);
	messagebox(EXECNAME, str);
}
예제 #6
0
void panic(const char *message)
{
	char str[1024];

	sprintf(str, "%s: panic: %s\n", EXECNAME, message);
	console_err(str);
	messagebox(EXECNAME, str);

#if !defined(WIN32)
	exit(EXIT_FAILURE);
#endif
}
예제 #7
0
파일: QMsgBox.C 프로젝트: Tyf0n/IQmol
QMessageBox::StandardButton QMsgBox::question(QWidget* parent, const QString&
		title, const QString& text, QMessageBox::StandardButtons buttons,
		QMessageBox::StandardButton defaultButton)
{
	QPixmap pixmap;
    pixmap.load(":/imageQuestion");

	QMessageBox messagebox(QMessageBox::NoIcon, title, text, buttons, parent);
	messagebox.setDefaultButton(defaultButton);
	messagebox.setIconPixmap(pixmap);

	return (QMessageBox::StandardButton) messagebox.exec();
}
예제 #8
0
파일: QMsgBox.C 프로젝트: Tyf0n/IQmol
QMessageBox::StandardButton QMsgBox::critical(QWidget* parent, const QString&
		title, const QString& text, QMessageBox::StandardButtons buttons,
		QMessageBox::StandardButton defaultButton)
{
	QPixmap pixmap;
    pixmap.load(":/imageCritical");

	QMessageBox messagebox(QMessageBox::NoIcon, title, text, buttons, parent);
	messagebox.setDefaultButton(defaultButton);
	messagebox.setIconPixmap(pixmap);

    QLOG_ERROR() << text;
	return (QMessageBox::StandardButton) messagebox.exec();
}
예제 #9
0
파일: cp.c 프로젝트: SayCV/flickernoise
static void loadok_callback(void *arg)
{
	char buf[4096];

	get_filedialog_selection(load_dlg, buf, sizeof(buf));
	if(!config_load(buf)) {
		messagebox("Performance load",
			   "Unable to load the performance file");
		return;
	}

	on_config_change();
	update_title_default_config(buf);
}
예제 #10
0
/* zero-malloc or die */
void *zmalloc(size_t size)
{
	void *value = calloc(size, 1);
	if (!value) {
#ifndef WIN32
		fprintf(stderr, "%s: virtual memory exhausted\n", EXECNAME);
#else
		char str[256];
		sprintf (str, "hermit: virtual memory exhausted");
		messagebox(EXECNAME, str);
#endif
		exit(7);
	}
	return value;
}
예제 #11
0
char *xstrdup(const char *s)
{
	char *value = strdup(s);
	if (!value) {
#ifndef WIN32
		fprintf(stderr, "%s: virtual memory exhausted\n", EXECNAME);
#else
		char str[256];
		sprintf (str, "hermit: virtual memory exhausted");
		messagebox(EXECNAME, str);
#endif
		exit(7);
	}
	return value;
}
예제 #12
0
static rtems_task gui_task(rtems_task_argument argument)
{
	init_fb_mtk(sysconfig_get_autostart_mode() == SC_AUTOSTART_FILE);
	sysconfig_set_mtk_language();
	sysconfig_set_mtk_wallpaper();
	init_input();
	input_add_callback(mtk_input);
	init_shortcuts();
	init_osc();
	init_messagebox();
	init_performance();
	init_renderer();
	init_cp();
	init_keyboard();
	init_ir();
	init_audio();
	init_midi();
	init_oscsettings();
	init_dmxspy();
	init_dmxdesk();
	init_dmx();
	init_videoin();
	init_rsswall();
	init_patcheditor();
	init_monitor();
	init_firstpatch();
	init_filemanager();
#ifdef WITH_PDF
	init_pdfreader();
#endif
	init_sysettings();
	init_about();
	init_flash();
	init_shutdown();

	cp_autostart();
	
	if(sysconfig_is_rescue())
		messagebox("Rescue mode", "You have booted in rescue mode.\n"
			"Your system will function as usual, using back-up software.\n"
			"From there, you can update the main software or perform\nother actions to fix the problem.\n");

	/* FIXME: work around "black screen" bug in MTK */
	mtk_cmd(1, "screen.refresh()");
	
	input_eventloop();
}
예제 #13
0
파일: ir.c 프로젝트: SayCV/flickernoise
static void addupdate_callback(mtk_event *e, void *arg)
{
	char key[8];
	int index;
	char *c;
	char filename[384];

	mtk_req(appid, key, sizeof(key), "e_key.text");
	mtk_req(appid, filename, sizeof(filename), "e_filename.text");
	index = strtol(key, &c, 0);
	if((*c != 0x00) || (index < 0) || (index > 63)) {
		messagebox("Error", "Invalid key code.\nUse a decimal or hexadecimal (0x...) number between 0 and 63.");
		return;
	}
	strcpy(key_bindings[index], filename);
	update_list();
	mtk_cmd(appid, "e_key.set(-text \"\")");
	mtk_cmd(appid, "e_filename.set(-text \"\")");
}
예제 #14
0
파일: ir.c 프로젝트: SayCV/flickernoise
static void autobuild(int sk, char *folder)
{
	DIR *d;
	struct dirent *entry;
	struct stat s;
	char fullname[384];
	char *c;
	char *files[384];
	int n_files;
	int max_files = 64 - sk;
	int i;

	d = opendir(folder);
	if(!d) {
		messagebox("Auto build failed", "Unable to open directory");
		return;
	}
	n_files = 0;
	while((entry = readdir(d))) {
		if(entry->d_name[0] == '.') continue;
		snprintf(fullname, sizeof(fullname), "%s/%s", folder, entry->d_name);
		lstat(fullname, &s);
		if(!S_ISDIR(s.st_mode)) {
			c = strrchr(entry->d_name, '.');
			if((c != NULL) && (strcmp(c, ".fnp") == 0)) {
				if(n_files < 384) {
					files[n_files] = strdup(entry->d_name);
					n_files++;
				}
			}
		}
	}
	closedir(d);

	qsort(files, n_files, sizeof(char *), cmpstringp);

	for(i=0;i<n_files;i++) {
		if(i < max_files)
			sprintf(key_bindings[i+sk], "%s/%s", folder, files[i]);
		free(files[i]);
	}
}
예제 #15
0
void panicf(const char *format, ...)
{
	va_list ap;
	char str[1024];
	int ptr;

	ptr = sprintf(str, "%s: panic: ", EXECNAME);

	va_start(ap, format);
	ptr += vsprintf(&str[ptr], format, ap);
	va_end(ap);
	sprintf(&str[ptr], "\n");
	
	console_err(str);
	messagebox(EXECNAME, str);

#if !defined(WIN32)
	exit(EXIT_FAILURE);
#endif
}
예제 #16
0
void eSoftwareUpdate::stop_mode()
{
	eMessageBox messagebox(_("Are you sure you want to put\n"
				"your box in **STOP** mode?\n"
				"When the box is in **STOP** mode\n"
				"you need to connect to it with\n"
				"a webbrowser and flash the new image\n"
				"Make sure you make a backup of\n"
				"your settings before continuing"), _("Flash new image"), eMessageBox::iconInfo | eMessageBox::btYes | eMessageBox::btNo, eMessageBox::btNo );

	messagebox.show();
	int ret = messagebox.exec();
	messagebox.hide();
	if ( ret == eMessageBox::btYes )
	{
		system("mount /boot -o remount,rw && mv /boot/autoexec.bat /boot/autoexec.bat.ignore");
		// Now reboot the box
		eZap::getInstance()->quit(4);
	}
}
예제 #17
0
void CPopupHandler::HandlePotentialPopup(HWND potential_popup, bool hard_kill)
{
	char title[MAX_WINDOW_TITLE];
	GetWindowText(potential_popup, title, MAX_WINDOW_TITLE);
	write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Going to handle [%d] [%s]\n",
			potential_popup, title);

	// First: ignore all harmless windows
	if (!IsWindow(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Not a window\n");
		return;
	}
	if (!IsWindowVisible(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is invisible\n");
		return;
	}
	if (WinIsMinimized(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is minimized\n");
		return;
	}
	if (WinIsZeroSized(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is zero-sized\n");
		return;
	}
	if (WinIsOutOfScreen(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is out of screen\n");
		return;
	}
	// Second: ignore the good windows
	//   and always present windows (to avoid flickering)
	// This includes:
	//   * program manager (desktop) 
	//   * task-bar with Start-button
	//   * task manager to be able to kill the popup-blocker if necessary ;-)
	if (WinIsDesktop(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is desktop\n");
		return;
	}
	if (WinIsTaskbar(potential_popup))
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is task-bar with Start-button\n");
		return;
	}
	if (WinIsTaskManager(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is task-manager\n");
		return;
	}
	if (WinIsProgramManager(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is program manager\n");
		return;
	}
	if (p_sharedmem->PokerWindowAttached(potential_popup))
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window is a served poker table\n");
		return;
	}
	if (WinIsOpenHoldem(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window belongs to OpenHoldem\n");
		return;
	}
	
	if (WinIsBring(potential_popup))			
	{
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Window belongs to Bring\n");
		return;
	}

	GetWindowText(potential_popup, title, MAX_WINDOW_TITLE);
	// Minimize or kill the remaining ones
	if (hard_kill)
	{
		// CloseWindow():
		// http://msdn.microsoft.com/en-us/library/windows/desktop/ms632678%28v=vs.85%29.aspx
		// DestroyWindow() can't be used:
		// http://msdn.microsoft.com/en-us/library/windows/desktop/ms632682%28v=vs.85%29.aspx
		CloseWindow(potential_popup);
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Killed [%d] [%s]\n",
			potential_popup, title);
	}
	else
	{
#ifdef MESSAGEBOX_BEFORE_MINIMIZING
		message.format("going to minimize window [%i]\n[%s]",
			potential_popup, title);
		messagebox(0, message, "popup blocker", 0);
#endif
		MinimizeWindow(potential_popup);
		write_log(preferences.debug_popup_blocker(), "[CPopupHandler] Minimized [%d] [%s]\n",
			potential_popup, title);
	}
}
예제 #18
0
BOOL BookOpenManager::OpenArchiveBook()
{
    DebugPrintf(DLC_BOOKOPENMANAGER, "%s, %d, %s, %s START", __FILE__,  __LINE__, "BookOpenManager", __FUNCTION__);
	if(!m_pCurPage)
	{
		return FALSE;
	}

	CDisplay* display = CDisplay::GetDisplay();
	if(NULL == display)
	{
		return FALSE;
	}

	IFileContentsModel *pCurBookContent = NULL;
	if(S_FALSE == CFileContentsFactory::CreateFileContentsInstance(GetBookPath(),&pCurBookContent))
	{
		return FALSE;
	}

	if(NULL == pCurBookContent)
	{
		return FALSE;
	}

	char Password[128]={0};
	if(pCurBookContent->HasPassword())
	{
		if(GetFilePassword(m_pCurPage,m_iBookID,Password,128))
		{
			pCurBookContent->SetPassword(Password);
		}
		else
		{
			return TRUE;
		}
	}

	vector < CFileChapterInfo > ChapterList;
	if(!pCurBookContent->GetChapterList(ChapterList))
	{
		delete pCurBookContent;
		pCurBookContent = NULL;
		return FALSE;
	}

	int iChapterCount = ChapterList.size();
	FileListItem *pZipFileList = new FileListItem[iChapterCount];
	if(NULL == pZipFileList)
	{
		delete pCurBookContent;
		pCurBookContent = NULL;
		return FALSE;
	}

	INT iImageCount = 0;
	INT iAdjustIndex = 0;
	LPCSTR pExtension = NULL;
	LPCSTR pFileName = NULL;

	LPCSTR *pNameArray = new LPCSTR[iChapterCount];
	if(NULL == pNameArray)
	{
		delete pCurBookContent;
		pCurBookContent = NULL;

		delete[] pZipFileList;
		pZipFileList = NULL;
		return FALSE;
	}

	for(INT index= 0; index < iChapterCount; index++)
	{
		pExtension = ChapterList[index].GetChapterExName();
		if(DFC_Picture == GetFileCategoryForZipFile(pExtension))
		{
			pFileName = ChapterList[index].GetChapterPath();
			iAdjustIndex = AdjustFileList(pZipFileList, iImageCount, pNameArray, pFileName);

			pZipFileList[iAdjustIndex].uFileId = ChapterList[index].GetChapterId();
			pZipFileList[iAdjustIndex].eFileCategory = DFC_Picture;

			strncpy(pZipFileList[iAdjustIndex].pExtension, pExtension, 16);
			iAdjustIndex++;
			iImageCount++;
		}
	}

	DebugPrintf(DLC_BOOKOPENMANAGER, "BookOpenManager::OpenBook iImageCount %d\n", iImageCount);

	delete[] pNameArray;
	pNameArray = NULL;

	if(iChapterCount == iImageCount)
	{
		BookFileList * pZipBookList = new BookFileList();
		if(NULL == pZipBookList)
		{
			delete pCurBookContent;
			pCurBookContent = NULL;

			delete[] pZipFileList;
			pZipFileList = NULL;
			return FALSE;
		}

		pZipBookList->pFileList = pZipFileList;
		pZipBookList->iBookId= m_iBookID;
		pZipBookList->uLength = iImageCount;

		DkReaderPage *pReader = new DkReaderPage();
		if(NULL == pReader)
		{
			delete pCurBookContent;
			pCurBookContent = NULL;

			delete pZipBookList;
			pZipBookList = NULL;

			return FALSE;
		}

		if(!pReader->Initialize(SPtr<BookFileList>(pZipBookList), 0, TRUE,Password))
		{

			UIMessageBox messagebox(m_pCurPage, StringManager::GetStringById(CANNOT_OPEN_BOOK), MB_OK);
			messagebox.DoModal();

			delete pCurBookContent;
			pCurBookContent = NULL;

			delete pReader;
			pReader = NULL;
			return FALSE;
		}
		else
		{
			pReader->MoveWindow(0, 0, display->GetScreenWidth(), display->GetScreenHeight());
			CPageNavigator::Goto(pReader);
			delete pCurBookContent;
			pCurBookContent = NULL;
			return TRUE;
		}
	}
	else	//如果压缩包中含有非图片内容,则暂不支持!
    {
        UIMessageBox messagebox(m_pCurPage, StringManager::GetStringById(CANNOT_OPEN_BOOK), MB_OK);
        messagebox.DoModal();

		delete pCurBookContent;
		pCurBookContent = NULL;
		delete[] pZipFileList;
		pZipFileList = NULL;
		return FALSE;
    }
    DebugPrintf(DLC_BOOKOPENMANAGER, "%s, %d, %s, %s end", __FILE__,  __LINE__, "BookOpenManager", __FUNCTION__);
    return true;
}
예제 #19
0
BOOL BookOpenManager::OpenBook()
{
    DebugPrintf(DLC_BOOKOPENMANAGER, "%s, %d, %s, %s START", __FILE__,  __LINE__, "BookOpenManager", __FUNCTION__);
	if(!m_pCurPage)
	{
		return FALSE;
	}
	CDKFileManager * pclsFileManager = CDKFileManager::GetFileManager();
	if(!pclsFileManager)
	{
		return FALSE;
	}
	pclsFileManager->ConvertDKPToDKX(GetBookPath());

	//CHourglass* pIns = CHourglass::GetInstance();
	//if(m_iHourglassLeft == 0 && m_iHourglassTop == 0)
	//{
	//	pIns = NULL;
	//}

	//if(pIns)
	//{
	//	pIns->Start(m_iHourglassLeft, m_iHourglassTop);
	//}

	CDisplay* display = CDisplay::GetDisplay();
	if(NULL == display)
	{
		return FALSE;
	}

	DkFileFormat Format = GetBookFormat();
	switch (Format)
	{
	case DFF_Text:
		SQM::GetInstance()->IncCounter(SQM_ACTION_BOOKREADER_FORMAT_TXT);
		break;
	case DFF_ZipFile:
		SQM::GetInstance()->IncCounter(SQM_ACTION_BOOKREADER_FORMAT_ZIP);
		break;
	case DFF_RoshalArchive:
		SQM::GetInstance()->IncCounter(SQM_ACTION_BOOKREADER_FORMAT_RAR);
		break;
	case DFF_PortableDocumentFormat:
		SQM::GetInstance()->IncCounter(SQM_ACTION_BOOKREADER_FORMAT_PDF);
		break;            
	case DFF_ElectronicPublishing:
		SQM::GetInstance()->IncCounter(SQM_ACTION_BOOKREADER_FORMAT_EPUB);
		break;            
	case DFF_Serialized:
		SQM::GetInstance()->IncCounter(SQM_ACTION_BOOKREADER_FORMAT_SERIALIZED);
		break;         
	case DFF_Unknown:
		SQM::GetInstance()->IncCounter(SQM_ACTION_BOOKREADER_FORMAT_UNKNOWN);
		break;
	default:
		//DONOTHING for others
		break;
	}

	if(Format == DFF_ZipFile || Format == DFF_RoshalArchive || Format == DFF_Serialized)
	{

		BOOL bOpenSuccess = OpenArchiveBook();

		//if(pIns)
		//{
		//	pIns->Stop();
		//}

		return bOpenSuccess;
	}
	else
	{
		DkReaderPage *pReader = new DkReaderPage();
		if(NULL == pReader)
		{
			//if(pIns)
			//{
			//	pIns->Stop();
			//}

			return FALSE;
		}

		if (!pReader->Initialize(GetBookPath(), GetBookName(), m_iBookID))
		{
			delete pReader;
			pReader = NULL;
			//if(pIns)
			//{
			//	pIns->Stop();
			//}

			UIMessageBox messagebox(m_pCurPage, StringManager::GetStringById(CANNOT_OPEN_BOOK), MB_OK);
			messagebox.DoModal();
		}
		else
		{
			pReader->MoveWindow(0, 0, display->GetScreenWidth(), display->GetScreenHeight());
			//Here: we move the pIns->Stop() into UIBookReaderContainer::Draw() to fix bug like: KTV00026614
            CDisplay::GetDisplay()->SetFullRepaint(true);
			CPageNavigator::Goto(pReader);
		}
    }
    DebugPrintf(DLC_BOOKOPENMANAGER, "%s, %d, %s, %s end", __FILE__,  __LINE__, "BookOpenManager", __FUNCTION__);
	return TRUE;
}