예제 #1
0
inline void myFromString(const std::string& text, LOGFONT& value) {
	CString wide_text = Utf8ToWCstring(text);
	LOGFONT font;
	StringToFont(wide_text, &font);
	value = font;
}
예제 #2
0
CSettings::CSettings()
{
#if !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	IsPortable = false;
	FindDataFolder();
	if (!IsDirectory(DataFolder))
	{
		CreateDirectory(DataFolder, 0);
	}
	if (!IsDirectory(IuCoreUtils::Utf8ToWstring(SettingsFolder).c_str()))
	{
		CreateDirectory(IuCoreUtils::Utf8ToWstring(SettingsFolder).c_str(), 0);
	}
	BOOL isElevated = false;
	IsElevated(&isElevated);
	if ( isElevated  || CmdLine.IsOption(L"afterupdate")) {
		WinUtils::MakeDirectoryWritable(DataFolder);
	}
#endif
#if !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	CString copyFrom = WinUtils::GetAppFolder() + SETTINGS_FILE_NAME;
	CString copyTo = DataFolder + SETTINGS_FILE_NAME;
	if (FileExists(copyFrom) && !FileExists(copyTo))
	{
		MoveFile(copyFrom, copyTo);
	}

	
		
	// Default values of settings
	ExplorerCascadedMenu = true;
	ConnectionSettings.UseProxy =  FALSE;
	ConnectionSettings.ProxyPort = 0;
	ConnectionSettings.NeedsAuth = false;
	ConnectionSettings.ProxyType = 0;
	#endif
	LastUpdateTime = 0;
	UploadBufferSize = /*65536*/1024*1024;
	FileRetryLimit = 3;
	ActionRetryLimit = 2;
#if !defined(IU_SHELLEXT) && !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	if ( !IsFFmpegAvailable() ){
		VideoSettings.Engine = VideoEngineDirectshow;
	}
	
	WatchClipboard = true;
	ShowTrayIcon = false;
	ShowTrayIcon_changed = false;
	*m_Directory = 0;
	UseTxtTemplate = false;
	UseDirectLinks = true;
	CodeLang = 0;
	ConfirmOnExit = 1;
	ExplorerContextMenu = false;
	ExplorerVideoContextMenu = true;
	ExplorerContextMenu_changed = false;
	ThumbsPerLine = 4;
	SendToContextMenu_changed = false;
	SendToContextMenu = 0;
	QuickUpload = 1;
	ParseSubDirs = 1;
	UseNewIcon = false;
	RememberImageServer = true;
    RememberFileServer = true;
	
	ShowUploadErrorDialog = true;

	ImageEditorPath = _T("mspaint.exe \"%1\"");
	AutoCopyToClipboard = false;
	AutoShowLog = true;
	

//	StringToFont(_T("Tahoma,7,b,204"), &ThumbSettings.ThumbFont);
	StringToFont(_T("Tahoma,8,,204"), &VideoSettings.Font);

	/*ThumbSettings.CreateThumbs = true;
	ThumbSettings.ThumbWidth = 180;
	ThumbSettings.ThumbHeight = 140;
	ThumbSettings.DrawFrame = true;
	ThumbSettings.ThumbAddImageSize  = true;
	ThumbSettings.FrameColor = RGB( 0, 74, 111);
	ThumbSettings.BackgroundColor = RGB( 255, 255, 255);f
	ThumbSettings.ThumbColor1 =  RGB( 13, 86, 125);
	ThumbSettings.ThumbColor2 = RGB( 6, 174, 255);
	ThumbSettings.UseServerThumbs = false;
	ThumbSettings.ScaleByHeight = false;
	ThumbSettings.ThumbTextColor = RGB( 255, 255, 255);
	ThumbSettings.ThumbAlpha = 120;
	ThumbSettings.Text = _T("%width%x%height% (%size%)");
	ThumbSettings.Format = ThumbCreatingParams::tfJPEG;
	ThumbSettings.FileName = "default";
	ThumbSettings.Quality = 85;*/

	VideoSettings.Columns = 3;
	VideoSettings.TileWidth =  200;
	VideoSettings.GapWidth = 5;
	VideoSettings.GapHeight = 7;
	VideoSettings.NumOfFrames = 8;
	VideoSettings.JPEGQuality =  100;
	VideoSettings.UseAviInfo = TRUE;
	VideoSettings.ShowMediaInfo = TRUE;
	VideoSettings.TextColor = RGB(0, 0, 0);
	VideoSettings.SnapshotsFolder = IuCoreUtils::Utf8ToWstring(Settings.SettingsFolder).c_str() + CString(_T("Snapshots"));
	VideoSettings.SnapshotFileTemplate = _T("%f%_%cx%_%cy%_%uid%\\grab_%i%.png");
	
	VideoSettings.Engine = IsFFmpegAvailable() ? VideoEngineAuto : VideoEngineDirectshow;
	

	ScreenshotSettings.Format =  1;
	ScreenshotSettings.Quality = 85;
	ScreenshotSettings.WindowHidingDelay = 450;
	ScreenshotSettings.Delay = 1;
	ScreenshotSettings.brushColor = RGB(255, 0, 0);
	ScreenshotSettings.ShowForeground = false;
	ScreenshotSettings.FilenameTemplate = _T("screenshot %y-%m-%d %i");
	ScreenshotSettings.CopyToClipboard = false;
	ScreenshotSettings.RemoveCorners = !WinUtils::IsWindows8orLater();
	ScreenshotSettings.AddShadow = false;
	ScreenshotSettings.RemoveBackground = false;
	ScreenshotSettings.OpenInEditor = true;
	ScreenshotSettings.UseOldRegionScreenshotMethod = false;

	TrayIconSettings.LeftClickCommand = 0; // without action
	TrayIconSettings.LeftDoubleClickCommand = 12; 

	TrayIconSettings.RightClickCommand = 1; // context menu
	TrayIconSettings.MiddleClickCommand = 7; // region screenshot
	TrayIconSettings.DontLaunchCopy = FALSE;
	TrayIconSettings.ShortenLinks = FALSE;
	TrayIconSettings.TrayScreenshotAction = TRAY_SCREENSHOT_OPENINEDITOR;

	ImageEditorSettings.BackgroundColor = Gdiplus::Color(255,255,255);
	ImageEditorSettings.ForegroundColor = Gdiplus::Color(255,0,0);
	ImageEditorSettings.PenSize = 12;
	ImageEditorSettings.RoundingRadius = ImageEditorSettings.PenSize;
	StringToFont(_T("Arial,12,b,204"), &ImageEditorSettings.Font);



	ImageReuploaderSettings.PasteHtmlOnCtrlV = true;
	Hotkeys_changed = false;
#endif
	
	/* binding settings */
	SettingsNode& general = mgr_["General"];
		general.n_bind(LastUpdateTime);
#if !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
		general.n_bind(Language);
		general.n_bind(ExplorerContextMenu);
		/*general.n_bind(ExplorerVideoContextMenu);
		general.n_bind(ExplorerCascadedMenu);*/
#endif
		#if !defined(IU_SHELLEXT) && !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	


	general.n_bind(ConfirmOnExit);
	general.n_bind(SendToContextMenu);
	general.n_bind(ParseSubDirs);
	general.n_bind(ImageEditorPath);
	//general.n_bind(AutoStartup);
	general.n_bind(ShowTrayIcon);
	general.n_bind(AutoCopyToClipboard);
	general.n_bind(AutoShowLog);
	general.n_bind(ImagesFolder);
	general.n_bind(VideoFolder);
	general.n_bind(WatchClipboard);
	general.n_bind(UseNewIcon);
	general.n_bind(RememberFileServer);
	general.n_bind(RememberImageServer);
	#ifndef IU_SERVERLISTTOOL
	general.n_bind(Hotkeys);
	#endif
	SettingsNode& screenshot = mgr_["Screenshot"];
	screenshot.nm_bind(ScreenshotSettings, Delay);
	screenshot.nm_bind(ScreenshotSettings, Format);
	screenshot.nm_bind(ScreenshotSettings, Quality);
	screenshot.nm_bind(ScreenshotSettings, ShowForeground);
	screenshot.nm_bind(ScreenshotSettings, FilenameTemplate);
	screenshot.nm_bind(ScreenshotSettings, Folder);
	screenshot.nm_bind(ScreenshotSettings, AddShadow);
	screenshot.nm_bind(ScreenshotSettings, RemoveBackground);
	screenshot.nm_bind(ScreenshotSettings, RemoveCorners);
	screenshot.nm_bind(ScreenshotSettings, CopyToClipboard);
	screenshot.nm_bind(ScreenshotSettings, brushColor);
	screenshot.nm_bind(ScreenshotSettings, WindowHidingDelay);
	screenshot.nm_bind(ScreenshotSettings, OpenInEditor);
	screenshot.nm_bind(ScreenshotSettings, UseOldRegionScreenshotMethod);

	SettingsNode& imageEditor = mgr_["ImageEditor"];
	imageEditor.nm_bind(ImageEditorSettings, ForegroundColor);
	imageEditor.nm_bind(ImageEditorSettings, BackgroundColor);
	imageEditor.nm_bind(ImageEditorSettings, PenSize);
	imageEditor.nm_bind(ImageEditorSettings, RoundingRadius);
	imageEditor.nm_bind(ImageEditorSettings, Font);

	SettingsNode& image = mgr_["Image"];
	image["CurrentProfile"].bind(CurrentConvertProfileName);
	image.nm_bind(UploadProfile, KeepAsIs);

	/*SettingsNode& thumbnails = mgr_["Thumbnails"];
	thumbnails.nm_bind(ThumbSettings, FileName);
	thumbnails.nm_bind(ThumbSettings, CreateThumbs);
	thumbnails.nm_bind(ThumbSettings, ThumbWidth);
	thumbnails.nm_bind(ThumbSettings, ThumbHeight);
	thumbnails.nm_bind(ThumbSettings, ScaleByHeight);
	thumbnails.nm_bind(ThumbSettings, FrameColor);
	thumbnails.nm_bind(ThumbSettings, ThumbColor1);
	thumbnails.nm_bind(ThumbSettings, ThumbColor2);
	thumbnails.nm_bind(ThumbSettings, UseServerThumbs);
	thumbnails.nm_bind(ThumbSettings, ThumbAddImageSize);
	thumbnails.nm_bind(ThumbSettings, DrawFrame);
	thumbnails.nm_bind(ThumbSettings, Quality);
	thumbnails.nm_bind(ThumbSettings, Format);
	thumbnails.nm_bind(ThumbSettings, Text);
	thumbnails["Text"]["@Color"].bind(ThumbSettings.ThumbTextColor);
	thumbnails["Text"]["@Font"].bind(ThumbSettings.ThumbFont);
	thumbnails["Text"]["@TextOverThumb"].bind(ThumbSettings.TextOverThumb);
	thumbnails["Text"]["@ThumbAlpha"].bind(ThumbSettings.ThumbAlpha);*/

	SettingsNode& video = mgr_["VideoGrabber"];
	video.nm_bind(VideoSettings, Columns);
	video.nm_bind(VideoSettings, TileWidth);
	video.nm_bind(VideoSettings, GapWidth);
	video.nm_bind(VideoSettings, GapHeight);
	video.nm_bind(VideoSettings, NumOfFrames);
	video.nm_bind(VideoSettings, JPEGQuality);
	video.nm_bind(VideoSettings, ShowMediaInfo);
	video.nm_bind(VideoSettings, TextColor);
	video.nm_bind(VideoSettings, Font);
	video.nm_bind(VideoSettings, Engine);
	video.nm_bind(VideoSettings, SnapshotsFolder);
	video.nm_bind(VideoSettings, SnapshotFileTemplate);

	SettingsNode& tray = mgr_["TrayIcon"];
	tray.nm_bind(TrayIconSettings, LeftDoubleClickCommand);
	tray.nm_bind(TrayIconSettings, LeftClickCommand);
	tray.nm_bind(TrayIconSettings, RightClickCommand);
	tray.nm_bind(TrayIconSettings, MiddleClickCommand);
	tray.nm_bind(TrayIconSettings, DontLaunchCopy);
	tray.nm_bind(TrayIconSettings, ShortenLinks);
	tray.nm_bind(TrayIconSettings, TrayScreenshotAction);

	SettingsNode& history = mgr_["History"];
	history.nm_bind(HistorySettings, EnableDownloading);



	SettingsNode& imageReuploader = mgr_["ImageReuploader"];
	imageReuploader.nm_bind(ImageReuploaderSettings, PasteHtmlOnCtrlV);
	#endif

	SettingsNode& upload = mgr_["Uploading"];
#if !defined(IU_CLI) && !defined(IU_SERVERLISTTOOL)
	upload.n_bind(ServerName);
	upload.n_bind(FileServerName);
//	upload.n_bind(UrlShorteningServer);
	upload.n_bind(QuickUpload);
	upload.n_bind(QuickServerName);
	upload.n_bind(CodeLang);
	upload.n_bind(ThumbsPerLine);
	upload.n_bind(UseDirectLinks);
	upload.n_bind(UseTxtTemplate);
	upload.n_bind(CodeType);
	upload.n_bind(ShowUploadErrorDialog);
	
	imageServer.bind(upload["Server"]);
	fileServer.bind(upload["FileServer"]);
	quickScreenshotServer.bind(upload["QuickScreenshotServer"]);
	contextMenuServer.bind(upload["ContextMenuServer"]);
	urlShorteningServer.bind(upload["UrlShorteningServer"]);


	ConvertProfiles["Default"] = ImageConvertingParams();
	CurrentConvertProfileName = "Default";
#endif
	upload.n_bind(UploadBufferSize);
	upload.n_bind(FileRetryLimit);

	upload.n_bind(ActionRetryLimit);
#if  !defined  (IU_CLI) && !defined(IU_SHELLEXT) && !defined(IU_SERVERLISTTOOL)
	SettingsNode& proxy = upload["Proxy"];
	proxy["@UseProxy"].bind(ConnectionSettings.UseProxy);
	proxy["@NeedsAuth"].bind(ConnectionSettings.NeedsAuth);
	proxy.nm_bind(ConnectionSettings, ServerAddress);
	proxy.nm_bind(ConnectionSettings, ProxyPort);
	proxy.nm_bind(ConnectionSettings, ProxyType);
	proxy.nm_bind(ConnectionSettings, ProxyUser);
	proxy.nm_bind(ConnectionSettings, ProxyPassword);;
#endif
}
예제 #3
0
void CThumbEditor::LoadParams()
{
	StringToFont(_T("Tahoma,7,b,204"), &ThumbFont);
	if(thumb_->existsParam("Font"))
	{
		std::string font = thumb_->getParamString("Font");
		CString wide_text = Utf8ToWCstring(font);
		StringToFont(wide_text, &ThumbFont);
	}

	if(thumb_->existsParam("FrameWidth"))
		SetDlgItemInt(IDC_FRAMEWIDTH, thumb_->getParam("FrameWidth"));
	else 
		::EnableWindow(GetDlgItem(IDC_FRAMEWIDTH), false);

	if(thumb_->existsParam("DrawFrame"))
	{
		bool DrawFrame = thumb_->getParam("DrawFrame")!=0;
		SendDlgItemMessage(IDC_DRAWFRAME, BM_SETCHECK, DrawFrame);
	}
	else
	{
		GuiTools::EnableNextN(GetDlgItem(IDC_DRAWFRAME), 3, false);
		::EnableWindow(GetDlgItem(IDC_DRAWFRAME), false);
	}

	bool DrawText = thumb_->getParam("DrawText")!=0;
	SendDlgItemMessage(IDC_ADDFILESIZE, BM_SETCHECK, DrawText);

	

	if(thumb_->existsParam("FrameColor"))
		FrameColor.SetColor(RGB2COLORREF(thumb_->getColor("FrameColor")));
	else 
	{
		FrameColor.EnableWindow(false);
		::EnableWindow(GetDlgItem(IDC_FRAMECOLORLABEL), false);
	}

	if(thumb_->existsParam("GradientColor1"))
		Color1.SetColor(RGB2COLORREF(thumb_->getColor("GradientColor1")));
	else
	{
		Color1.EnableWindow(false);
		::EnableWindow(GetDlgItem(IDC_GRADIENTCOLOR1LABEL), false);
	}

	if(thumb_->existsParam("TextColor"))
	{
		ThumbTextColor.SetColor(RGB2COLORREF(thumb_->getColor("TextColor")));
	}
	else
	{
		ThumbTextColor.EnableWindow(false);
		::EnableWindow(GetDlgItem(IDC_THUMBTEXTCOLORLABEL), false);
	}

	if(thumb_->existsParam("StrokeColor"))
	{
		StrokeColor.SetColor(RGB2COLORREF(thumb_->getColor("StrokeColor")));
	}
	else
	{
		StrokeColor.EnableWindow(false);
		::EnableWindow(GetDlgItem(IDC_THUMBSTROKECOLORLABEL), false);
	}


	if(thumb_->existsParam("GradientColor2"))
	Color2.SetColor(RGB2COLORREF(thumb_->getColor("GradientColor2")));
	else
	{
		Color2.EnableWindow(false);
		::EnableWindow(GetDlgItem(IDC_GRADIENTCOLOR2LABEL), false);
	}
	SetDlgItemText(IDC_THUMBTEXT, Utf8ToWCstring(thumb_->getParamString("Text")));
}