コード例 #1
0
ファイル: flmodes.cpp プロジェクト: CyberShadow/FAR
void FileList::SavePanelModes()
{
	if (!ViewSettingsChanged)
		return;

	ViewSettingsChanged = false;

	HierarchicalConfig *PanelModeCfg = Db->CreatePanelModeConfig();

	for (int I=0; I<10; I++)
	{
		string strColumnTitles, strColumnWidths;
		string strStatusColumnTitles, strStatusColumnWidths;

		PanelViewSettings NewSettings=ViewSettingsArray[VIEW_0+I];
		ViewSettingsToText(NewSettings.ColumnType,NewSettings.ColumnWidth,NewSettings.ColumnWidthType,
		                   NewSettings.ColumnCount,strColumnTitles,strColumnWidths);
		ViewSettingsToText(NewSettings.StatusColumnType,NewSettings.StatusColumnWidth,NewSettings.StatusColumnWidthType,
		                   NewSettings.StatusColumnCount,strStatusColumnTitles,strStatusColumnWidths);

		unsigned __int64 id = PanelModeCfg->CreateKey(0, FormatString() << I);
		if (!id)
			continue;

		PanelModeCfg->SetValue(id, L"ColumnTitles", strColumnTitles);
		PanelModeCfg->SetValue(id, L"ColumnWidths", strColumnWidths);
		PanelModeCfg->SetValue(id, L"StatusColumnTitles", strStatusColumnTitles);
		PanelModeCfg->SetValue(id, L"StatusColumnWidths", strStatusColumnWidths);
		PanelModeCfg->SetValue(id, L"Flags", NewSettings.Flags);
	}

	delete PanelModeCfg;
}
コード例 #2
0
ファイル: hilight.cpp プロジェクト: landswellsong/FAR
static void SetHighlighting(bool DeleteOld = false, HierarchicalConfig *ExternCfg = nullptr)
{
	unsigned __int64 root;
	HierarchicalConfig *cfg = ExternCfg?ExternCfg:CreateHighlightConfig();

	if (DeleteOld)
	{
		root = cfg->GetKeyID(0, HighlightKeyName);
		if (root)
			cfg->DeleteKeyTree(root);
	}

	if (!cfg->GetKeyID(0, HighlightKeyName))
	{
		root = cfg->CreateKey(0,HighlightKeyName);
		if (root)
		{
			static const wchar_t *Masks[]=
			{
				/* 0 */ L"*.*",
				/* 1 */ L"<arc>",
				/* 2 */ L"<temp>",
				/* $ 25.09.2001  IS
					Эта маска для каталогов: обрабатывать все каталоги, кроме тех, что
					являются родительскими (их имена - две точки).
				*/
				/* 3 */ L"*.*|..", // маска для каталогов
				/* 4 */ L"..",     // такие каталоги окрашивать как простые файлы
				/* 5 */ L"<exec>",
			};
			static struct DefaultData
			{
				const wchar_t *Mask;
				int IgnoreMask;
				DWORD IncludeAttr;
				BYTE InitNC;
				BYTE InitCC;
				FarColor NormalColor;
				FarColor CursorColor;
			}


			StdHighlightData[]=
			{
				/* 0 */{Masks[0], 0, 0x0002, 0x13, 0x38},
				/* 1 */{Masks[0], 0, 0x0004, 0x13, 0x38},
				/* 2 */{Masks[3], 0, 0x0010, 0x1F, 0x3F},
				/* 3 */{Masks[4], 0, 0x0010, 0x00, 0x00},
				/* 4 */{Masks[5], 0, 0x0000, 0x1A, 0x3A},
				/* 5 */{Masks[1], 0, 0x0000, 0x1D, 0x3D},
				/* 6 */{Masks[2], 0, 0x0000, 0x16, 0x36},
				// это настройка для каталогов на тех панелях, которые должны раскрашиваться
				// без учета масок (например, список хостов в "far navigator")
				/* 7 */{Masks[0], 1, 0x0010, 0x1F, 0x3F},
			};

			for (size_t I=0; I < ARRAYSIZE(StdHighlightData); I++)
			{
				Colors::ConsoleColorToFarColor(StdHighlightData[I].InitNC, StdHighlightData[I].NormalColor);
				MAKE_TRANSPARENT(StdHighlightData[I].NormalColor.BackgroundColor);
				Colors::ConsoleColorToFarColor(StdHighlightData[I].InitCC, StdHighlightData[I].CursorColor);
				MAKE_TRANSPARENT(StdHighlightData[I].CursorColor.BackgroundColor);

				unsigned __int64 key = cfg->CreateKey(root, FormatString() << L"Group" << I);
				if (!key)
					break;
				cfg->SetValue(key,HLS.Mask,StdHighlightData[I].Mask);
				cfg->SetValue(key,HLS.IgnoreMask,StdHighlightData[I].IgnoreMask);
				cfg->SetValue(key,HLS.IncludeAttributes,StdHighlightData[I].IncludeAttr);

				cfg->SetValue(key,HLS.NormalColor, &StdHighlightData[I].NormalColor, sizeof(FarColor));
				cfg->SetValue(key,HLS.CursorColor, &StdHighlightData[I].CursorColor, sizeof(FarColor));

				const FarColor DefaultColor = {FCF_FG_4BIT|FCF_BG_4BIT, 0xff000000, 0x00000000};
				cfg->SetValue(key,HLS.SelectedColor, &DefaultColor, sizeof(FarColor));
				cfg->SetValue(key,HLS.SelectedCursorColor, &DefaultColor, sizeof(FarColor));
				cfg->SetValue(key,HLS.MarkCharNormalColor, &DefaultColor, sizeof(FarColor));
				cfg->SetValue(key,HLS.MarkCharSelectedColor, &DefaultColor, sizeof(FarColor));
				cfg->SetValue(key,HLS.MarkCharCursorColor, &DefaultColor, sizeof(FarColor));
				cfg->SetValue(key,HLS.MarkCharSelectedCursorColor, &DefaultColor, sizeof(FarColor));
			}
		}
	}

	if (cfg!=ExternCfg)
	{
		delete cfg;
	}
}