示例#1
0
文件: AppDM.cpp 项目: uvbs/XDLL
void CAppDM::Init()
{
	m_bGlobalEnd = FALSE;
	m_dwGlobalStartTickCount = ::GetTickCount();
 	GetTmpFolder();
	GetCurrentFolder();

	// init log
	bool bEnableLog = false;
#ifdef _DEBUG
	bEnableLog = true;
#endif
	//g_log.Init(bEnableLog, _T("pplap"), NULL);
	//g_log.SetOutType(LOGOUT_FILE);
	//g_log.LogA("New start!\n");

	// delete .(old) file
	VECTOR_TSTRING vt = CUtils::FindFileByExt(m_strCurrentFolder, _T(".(old)"));
	for (size_t i = 0; i < vt.size(); i++)
	{
		if (::DeleteFile(vt[i].c_str()) == 0)
		{
			//g_log.LogA("DeleteFile error code = %d\n", ::GetLastError());
		}
	}
}
示例#2
0
int main(int argc, char * argv[])
{
	// Print the current directory for reference:
	char folder[FILENAME_MAX];
	GetCurrentFolder(folder, sizeof(folder));
	LOG("Running cPrefabPiecePool test from folder \"%s\".", folder);

	// Run the test:
	int res = DoTest();
	LOG("cPrefabPiecePool loading test done: %s", (res == 0) ? "success" : "failure");
	return res;
}
示例#3
0
void CLog::CreateDefaultFile()
{
	WCHAR *pCurretFolder =  GetCurrentFolder();
	m_PathToLog = pCurretFolder;
	delete pCurretFolder;
	pCurretFolder = NULL;

	if (m_PathToLog.size() > 0)
	{
		if (m_PathToLog.at(m_PathToLog.size() - 1) != L'\\' )
			m_PathToLog += L'\\';
		m_PathToLog.append(sLogName);
	}
}
void ribi::QtSitemapGeneratorMainDialog::on_button_start_clicked()
{
  std::vector<std::string> args;
  args.push_back("--page");
  args.push_back(ui->edit_website->text().toStdString());
  args.push_back("--exe");
  args.push_back(GetCurrentFolder());

  ui->text_output->clear();

  SitemapGeneratorMenuDialog d;
  d.m_signal_log.connect(
    boost::bind(&ribi::QtSitemapGeneratorMainDialog::OnLogMessage,this,boost::lambda::_1)
  );
  const int result = d.Execute(args);
  const std::string text {
    std::string("SitemapGeneratorMenuDialog returned with error code ")
    + boost::lexical_cast<std::string>(result)
  };
  ui->text_output->appendPlainText(text.c_str());
}
示例#5
0
bool DeleteFolder(const KString& FolderName, bool bRecursive, bool bSafe)
{
	if(!CleanFolder(FolderName, bRecursive, bSafe))
		return false;

	if(!GetCurrentFolder().CollateNoCase(SlashedFolderName(FolderName)))
		_tchdir(TEXT(".."));

	if(_trmdir(UnslashedFolderName(FolderName)))
	{
		if(!bSafe)
		{
			INITIATE_DEFINED_CODE_FAILURE(	(KString)TEXT("Error deleteing folder \"") +
												FolderName +
												TEXT("\""),
											errno);
		}

		return false;
	}

	return true;
}
示例#6
0
INT_PTR CALLBACK FilterDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	static DWORD			dwFilters;
	static DWORD			dwpFilters;
	static LPCFOLDERDATA	lpFilterRecord;
	char					strText[250];
	int 					i;

	switch (Msg)
	{
	case WM_INITDIALOG:
	{
		LPTREEFOLDER folder = GetCurrentFolder();
		LPTREEFOLDER lpParent = NULL;
		LPCFILTER_ITEM g_lpFilterList = GetFilterList();

		dwFilters = 0;

		if (folder != NULL)
		{
			char tmp[80];

			win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_EDIT), g_FilterText);
			Edit_SetSel(GetDlgItem(hDlg, IDC_FILTER_EDIT), 0, -1);
			// Mask out non filter flags
			dwFilters = folder->m_dwFlags & F_MASK;
			// Display current folder name in dialog titlebar
			snprintf(tmp,ARRAY_LENGTH(tmp),"Filters for %s Folder",folder->m_lpTitle);
			win_set_window_text_utf8(hDlg, tmp);
			if ( GetFilterInherit() )
			{
				BOOL bShowExplanation = FALSE;
				lpParent = GetFolder( folder->m_nParent );
				if( lpParent )
				{
					/* Check the Parent Filters and inherit them on child,
                     * No need to promote all games to parent folder, works as is */
					dwpFilters = lpParent->m_dwFlags & F_MASK;
					/*Check all possible Filters if inherited solely from parent, e.g. not being set explicitly on our folder*/
					if( (dwpFilters & F_CLONES) && !(dwFilters & F_CLONES) )
					{
						/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
						win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_CLONES), strText, 250);
						strcat(strText, " (*)");
						win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_CLONES), strText);
						bShowExplanation = TRUE;
					}
					if( (dwpFilters & F_NONWORKING) && !(dwFilters & F_NONWORKING) )
					{
						/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
						win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_NONWORKING), strText, 250);
						strcat(strText, " (*)");
						win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_NONWORKING), strText);
						bShowExplanation = TRUE;
					}
					if( (dwpFilters & F_UNAVAILABLE) && !(dwFilters & F_UNAVAILABLE) )
					{
						/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
						win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_UNAVAILABLE), strText, 250);
						strcat(strText, " (*)");
						win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_UNAVAILABLE), strText);
						bShowExplanation = TRUE;
					}
					if( (dwpFilters & F_VECTOR) && !(dwFilters & F_VECTOR) )
					{
						/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
						win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_VECTOR), strText, 250);
						strcat(strText, " (*)");
						win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_VECTOR), strText);
						bShowExplanation = TRUE;
					}
					if( (dwpFilters & F_RASTER) && !(dwFilters & F_RASTER) )
					{
						/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
						win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_RASTER), strText, 250);
						strcat(strText, " (*)");
						win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_RASTER), strText);
						bShowExplanation = TRUE;
					}
					if( (dwpFilters & F_ORIGINALS) && !(dwFilters & F_ORIGINALS) )
					{
						/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
						win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_ORIGINALS), strText, 250);
						strcat(strText, " (*)");
						win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_ORIGINALS), strText);
						bShowExplanation = TRUE;
					}
					if( (dwpFilters & F_WORKING) && !(dwFilters & F_WORKING) )
					{
						/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
						win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_WORKING), strText, 250);
						strcat(strText, " (*)");
						win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_WORKING), strText);
						bShowExplanation = TRUE;
					}
					if( (dwpFilters & F_AVAILABLE) && !(dwFilters & F_AVAILABLE) )
					{
						/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
						win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_AVAILABLE), strText, 250);
						strcat(strText, " (*)");
						win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_AVAILABLE), strText);
						bShowExplanation = TRUE;
					}
					if( (dwpFilters & F_HORIZONTAL) && !(dwFilters & F_HORIZONTAL) )
					{
						/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
						win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_HORIZONTAL), strText, 250);
						strcat(strText, " (*)");
						win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_HORIZONTAL), strText);
						bShowExplanation = TRUE;
					}
					if( (dwpFilters & F_VERTICAL) && !(dwFilters & F_VERTICAL) )
					{
						/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
						win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_VERTICAL), strText, 250);
						strcat(strText, " (*)");
						win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_VERTICAL), strText);
						bShowExplanation = TRUE;
					}
					/*Do not or in the Values of the parent, so that the values of the folder still can be set*/
					//dwFilters |= dwpFilters;
				}
				if( ! bShowExplanation )
				{
					ShowWindow(GetDlgItem(hDlg, IDC_INHERITED), FALSE );
				}
			}
			else
			{
				ShowWindow(GetDlgItem(hDlg, IDC_INHERITED), FALSE );
			}
			// Find the matching filter record if it exists
			lpFilterRecord = FindFilter(folder->m_nFolderId);

			// initialize and disable appropriate controls
			for (i = 0; g_lpFilterList[i].m_dwFilterType; i++)
			{
				DisableFilterControls(hDlg, lpFilterRecord, &g_lpFilterList[i], dwFilters);
			}
		}
		SetFocus(GetDlgItem(hDlg, IDC_FILTER_EDIT));
		return FALSE;
	}
	case WM_HELP:
		// User clicked the ? from the upper right on a control
		HelpFunction((HWND)((LPHELPINFO)lParam)->hItemHandle, MAMEUICONTEXTHELP,
					 HH_TP_HELP_WM_HELP, GetHelpIDs());
		break;

	case WM_CONTEXTMENU:
		HelpFunction((HWND)wParam, MAMEUICONTEXTHELP, HH_TP_HELP_CONTEXTMENU, GetHelpIDs());
		break;

	case WM_COMMAND:
	{
		WORD wID		 = GET_WM_COMMAND_ID(wParam, lParam);
		WORD wNotifyCode = GET_WM_COMMAND_CMD(wParam, lParam);
		LPTREEFOLDER folder = GetCurrentFolder();
		LPCFILTER_ITEM g_lpFilterList = GetFilterList();

		switch (wID)
		{
		case IDOK:
			dwFilters = 0;

			win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_EDIT), g_FilterText, FILTERTEXT_LEN);

			// see which buttons are checked
			for (i = 0; g_lpFilterList[i].m_dwFilterType; i++)
			{
				if (Button_GetCheck(GetDlgItem(hDlg, g_lpFilterList[i].m_dwCtrlID)))
					dwFilters |= g_lpFilterList[i].m_dwFilterType;
			}

			// Mask out invalid filters
			dwFilters = ValidateFilters(lpFilterRecord, dwFilters);

			// Keep non filter flags
			folder->m_dwFlags &= ~F_MASK;

			// put in the set filters
			folder->m_dwFlags |= dwFilters;

			EndDialog(hDlg, 1);
			return TRUE;

		case IDCANCEL:
			EndDialog(hDlg, 0);
			return TRUE;

		default:
			// Handle unchecking mutually exclusive filters
			if (wNotifyCode == BN_CLICKED)
				EnableFilterExclusions(hDlg, wID);
		}
	}
	break;
	}
	return 0;
}
void QtSitemapGeneratorMainDialog::on_button_start_clicked()
{
  const std::string page_location = ui->edit_website->text().toStdString();
  const std::string sitemapgen_location = GetCurrentFolder();

  ui->text_output->clear();

  ui->text_output->appendPlainText(
      QString("* This application runs in the folder \'")
    + QString(sitemapgen_location.c_str())
    + QString("'"));

  ui->text_output->appendPlainText(
      QString("* Searching for HTML files found in folder '")
    + QString(page_location.c_str())
    + QString("\'"));

  const std::vector<std::string> files_raw = GetHtmlFilesInFolder(page_location);


  if (files_raw.empty())
  {
    ui->text_output->appendPlainText(
        QString("* No HTML files found in folder '")
      + QString(page_location.c_str())
      + QString("\'"));
    ui->text_output->appendPlainText(
      "* Please select the correct folder with the websites' HTML files");
    return;
  }

  ui->text_output->appendPlainText(
      QString("* ")
    + QString(boost::lexical_cast<std::string>(files_raw.size()).c_str())
    + QString(" HTML files found in folder '")
    + QString(page_location.c_str())
    + QString("\'"));

  //BOOST_FOREACH(const std::string& s,files_raw) std::clog << s << '\n';

  //Save config.xml to file CreateConfigXml()
  {
    assert(!GetCurrentFolder().empty());
    assert(GetCurrentFolder().at(GetCurrentFolder().size() - 1));
    const std::string config_filename = GetCurrentFolder() + "/config.xml";

    ui->text_output->appendPlainText(
      (std::string("* Creating '")
      + config_filename +
      std::string("' in this app's folder")).c_str()
    );
    std::ofstream file(config_filename);
    std::vector<std::string> config_file(CreateConfigXml(page_location,sitemapgen_location));
    std::copy(config_file.begin(),config_file.end(),std::ostream_iterator<std::string>(file,"\n"));
    ui->text_output->appendPlainText(
      (std::string("'")
      + config_filename
      + std::string("' created successfully")).c_str()
    );
  }

  //Save urllist to file
  {
    //Convert short filenames to full filenames
    std::vector<std::string> files_full;
    BOOST_FOREACH(const std::string& line, files_raw)
    {
      files_full.push_back("http://www.richelbilderbeek.nl/" + line);
    }
    //Add header to full filenames
    const std::vector<std::string> full_files_with_header = AddHeader(files_full);
    ui->text_output->appendPlainText("* Saving urllist.txt in this app's folder");
    const std::string sitemapgen_url_list_filename = sitemapgen_location + "/urllist.txt";
    std::ofstream file(sitemapgen_url_list_filename.c_str());
    std::copy(full_files_with_header.begin(),full_files_with_header.end(),std::ostream_iterator<std::string>(file,"\n"));
  }
示例#8
0
文件: setmail.c 项目: jens-maus/yam
void rx_setmail(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg)
{
  struct args *args = params->args;

  ENTER();

  switch(action)
  {
    case RXIF_INIT:
    {
      params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args));
    }
    break;

    case RXIF_ACTION:
    {
      Object *lv = (Object *)xget(G->MA->GUI.PG_MAILLIST, MUIA_MainMailListGroup_MainList);
      int num = -1;
      int max = xget(lv, MUIA_NList_Entries);

      if(args->msgid != NULL)
      {
        struct Mail *mail;

        // find the mail with the given message id first
        if((mail = FindMailByMsgID(GetCurrentFolder(), args->msgid)) != NULL)
        {
          int idx = 0;
          struct Mail *nlistMail;

          // now find the mail in the GUI
          do
          {
            DoMethod(G->MA->GUI.PG_MAILLIST, MUIM_NList_GetEntry, idx, &nlistMail);
            if(nlistMail == mail)
            {
              num = idx;
              break;
            }
            else

            idx++;
          }
          while(nlistMail != NULL);
        }
      }
      else
      {
        num = *args->num;
      }

      if(num >= 0 && num < max)
        DoMethod(lv, MUIM_NList_SetActive, num, MUIV_NList_SetActive_Jump_Center);
      else
        params->rc = RETURN_ERROR;
    }
    break;

    case RXIF_FREE:
    {
      if(args != NULL)
        FreeVecPooled(G->SharedMemPool, args);
    }
    break;
  }

  LEAVE();
}
//---------------------------------------------------------------------------
///ProjectRampalTest is the testing facility of ProjectRampal.
///A newly developed brach of the project can be tested with
///this program in terms of obtaining the right output and speed.
///ProjectRampalTest forbids the use of a release mode,
///because its purpose is to test the code.
int main(int argc, char* argv[])
{
  if (argc == 1)
  {
    QApplication a(argc, argv);
    DialogRampalTest d;
    d.show();
    return a.exec();
  }

  std::cout << GetCurrentFolder(argv[0]) << "/" << argv[0]
    << " (version 300.0)\n";
  #ifdef NDEBUG
    std::cout
      << "ProjectTest cannot be run in no-debug mode!\n"
      << "Please recompile without the NDEBUG #define"
      << std::endl;
    return 1;
  #endif

  if (argc!=4) { ShowCorrectUse(); return 0; }

  const std::string argv1 = StrToLower(argv[1]);
  const std::string argv2 = StrToLower(argv[2]);
  //Check if the fourth argument is an integer
  try
  {
    boost::lexical_cast<int>(argv[3]);
  }
  catch (boost::bad_lexical_cast&)
  {
    ShowCorrectUse();
    return 1;
  }
  const int argv3 = boost::lexical_cast<int>(argv[3]);
  //Test sanity of input
  //First parameter: theta
  {
    try { boost::lexical_cast<double>(argv1); } //Is it a double?
    catch(...)
    {
      if (argv1!="-m" && argv1!="-r") { ShowCorrectUse(); return 0; }
    }
  }
  //Second parameter: phylogeny
  {
    try { BinaryNewickVector n(argv2); } //Is it a newick?
    catch(...)
    {
      if (argv2!="-m" && argv2!="-r" ) { ShowCorrectUse(); return 0; }
    }
  }
  //Third parameter: test
  {
    if (argv3 <= 0 || argv3 > 63) { ShowCorrectUse(); return 0; }
  }
  //Input is sane

  RandomizeTimer();

  std::ofstream file("Results.txt");
  file << "Results of " << argv[0] << " " << argv[1] << " " << argv[2] << " " << argv[3] << "\n";
  file.close();

  std::cout << std::setprecision(10);

  while (1)
  {
    //Obtain theta
    //Theta input parameters:
    // -any positive non-zero value, for example '10.0'
    // -f: theta values from file 'test_thetas.txt'
    // -m: manual input of thetas
    double theta = 0.0;
    if (argv1 == "-m")
    {
      theta = AskUserForTheta();
      if (theta==0.0) break;
    }
    else if (argv1 == "-r")
    {
      theta = GetRandomUniform() * 100.0;
    }
    else
    {
      theta = boost::lexical_cast<double>(argv1);
    }

    //Obtain newick
    std::string newick;
    //Input parameters:
    // -any newick string, for example '(1,(2,3))'
    // -m: manual input of newick strings
    // -p: predefined newick strings
    // -r: random newick strings
    if (argv2 == "-m")
    {
      newick = AskUserForNewick();
      if (newick.empty()) break;
    }
    else if (argv2 == "-r")
    {
      newick = Newick::CreateRandomNewick(7,7);
    }
    else
    {
      newick = argv2;
    }

    std::ofstream file("Results.txt", std::ios_base::app);
    file << std::setprecision(99);

    //Create all tests
    std::vector<boost::shared_ptr<Test> > tests
      = Test::CreateTests(newick,theta,argv3);

    //Execute all tests
    BOOST_FOREACH(boost::shared_ptr<Test> t,tests)
    {
      t->Execute();
    }

    //Show test results
    std::cout
      << '\n'
      << "Theta: '" << theta << "'\n"
      << "Newick: '" << newick << "'\n"
      << "Number of combinations: "
      << Newick::CalcNumOfCombinations(BinaryNewickVector(newick).Get())
      << "\n\n\n\n\n"
      << "TestName\t\t\tProbability\tTime\n";

    BOOST_FOREACH(boost::shared_ptr<Test> t,tests)
    {
      std::cout
        << t->GetTestName()
        << "\t" << t->GetProbability()
        //<< '\t' << t->GetEwensProbability()
        << '\t' << t->GetTime()
        << '\n';
      file
        << t->GetTestName()
        << '\t' << t->GetNewick()
        << '\t' << t->GetProbability()
        << '\t' << t->GetEwensProbability()
        << '\t' << t->GetTime()
        << '\n';
    }

    //Probably we're done,
    //except if the user wants to input another value manually
    if (argv1!="-m" && argv2!="-m") break;
  }
示例#10
0
INT_PTR CALLBACK FilterDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	switch (Msg)
	{
		case WM_INITDIALOG:
		{
			CenterWindow(hDlg);
			hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAMEUI_ICON));
			SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
			hBrush = CreateSolidBrush(RGB(240, 240, 240));
			DisableVisualStylesFilters(hDlg);
			LPTREEFOLDER folder = GetCurrentFolder();
			LPTREEFOLDER lpParent = NULL;
			LPCFILTER_ITEM g_lpFilterList = GetFilterList();
			dwFilters = 0;

			if (folder != NULL)
			{
				char tmp[80];
				win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_EDIT), g_FilterText.c_str());
				Edit_SetSel(GetDlgItem(hDlg, IDC_FILTER_EDIT), 0, -1);
				// Mask out non filter flags
				dwFilters = folder->m_dwFlags & F_MASK;
				// Display current folder name in dialog titlebar
				snprintf(tmp, WINUI_ARRAY_LENGTH(tmp), "Filters for %s folder", folder->m_lpTitle);
				win_set_window_text_utf8(hDlg, tmp);

				if (GetFilterInherit())
				{
					lpParent = GetFolder(folder->m_nParent);
					bool bShowExplanation = false;

					if (lpParent)
					{
						std::string strText;
						/* Check the Parent Filters and inherit them on child,
						* No need to promote all games to parent folder, works as is */
						dwpFilters = lpParent->m_dwFlags & F_MASK;
						/*Check all possible Filters if inherited solely from parent, e.g. not being set explicitly on our folder*/

						if ((dwpFilters & F_CLONES) && !(dwFilters & F_CLONES))
						{
							/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
							strText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_CLONES));
							strText.append(" (*)");
							win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_CLONES), strText.c_str());
							bShowExplanation = true;
						}

						if ((dwpFilters & F_NONWORKING) && !(dwFilters & F_NONWORKING))
						{
							/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
							strText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_NONWORKING));
							strText.append(" (*)");
							win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_NONWORKING), strText.c_str());
							bShowExplanation = true;
						}

						if ((dwpFilters & F_UNAVAILABLE) && !(dwFilters & F_UNAVAILABLE))
						{
							/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
							strText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_UNAVAILABLE));
							strText.append(" (*)");
							win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_UNAVAILABLE), strText.c_str());
							bShowExplanation = true;
						}

						if ((dwpFilters & F_VECTOR) && !(dwFilters & F_VECTOR))
						{
							/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
							strText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_VECTOR));
							strText.append(" (*)");
							win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_VECTOR), strText.c_str());
							bShowExplanation = true;
						}

						if ((dwpFilters & F_RASTER) && !(dwFilters & F_RASTER))
						{
							/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
							strText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_RASTER));
							strText.append(" (*)");
							win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_RASTER), strText.c_str());
							bShowExplanation = true;
						}

						if ((dwpFilters & F_ORIGINALS) && !(dwFilters & F_ORIGINALS))
						{
							/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
							strText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_ORIGINALS));
							strText.append(" (*)");
							win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_ORIGINALS), strText.c_str());
							bShowExplanation = true;
						}

						if ((dwpFilters & F_WORKING) && !(dwFilters & F_WORKING))
						{
							/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
							strText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_WORKING));
							strText.append(" (*)");
							win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_WORKING), strText.c_str());
							bShowExplanation = true;
						}

						if ((dwpFilters & F_AVAILABLE) && !(dwFilters & F_AVAILABLE))
						{
							/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
							strText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_AVAILABLE));
							strText.append(" (*)");
							win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_AVAILABLE), strText.c_str());
							bShowExplanation = true;
						}

						if ((dwpFilters & F_HORIZONTAL) && !(dwFilters & F_HORIZONTAL))
						{
							/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
							strText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_HORIZONTAL));
							strText.append(" (*)");
							win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_HORIZONTAL), strText.c_str());
							bShowExplanation = true;
						}

						if ((dwpFilters & F_VERTICAL) && !(dwFilters & F_VERTICAL))
						{
							/*Add a Specifier to the Checkbox to show it was inherited from the parent*/
							strText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_VERTICAL));
							strText.append(" (*)");
							win_set_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_VERTICAL), strText.c_str());
							bShowExplanation = true;
						}
						/*Do not or in the Values of the parent, so that the values of the folder still can be set*/
						//dwFilters |= dwpFilters;
					}

					if(bShowExplanation)
					{
						ShowWindow(GetDlgItem(hDlg, IDC_INHERITED), true);
					}
				}
				else
				{
					ShowWindow(GetDlgItem(hDlg, IDC_INHERITED), false);
				}

				// Find the matching filter record if it exists
				lpFilterRecord = FindFilter(folder->m_nFolderId);

				// initialize and disable appropriate controls
				for (int i = 0; g_lpFilterList[i].m_dwFilterType; i++)
				{
					DisableFilterControls(hDlg, lpFilterRecord, &g_lpFilterList[i], dwFilters);
				}
			}

			SetFocus(GetDlgItem(hDlg, IDC_FILTER_EDIT));
			return false;
		}

		case WM_CTLCOLORDLG:
			return (LRESULT) hBrush;	

		case WM_CTLCOLORSTATIC:
		case WM_CTLCOLORBTN:
			hDC = (HDC)wParam;
			SetBkMode(hDC, TRANSPARENT);
			SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
			return (LRESULT) hBrush;

		case WM_COMMAND:
		{
			WORD wID = GET_WM_COMMAND_ID(wParam, lParam);
			WORD wNotifyCode = GET_WM_COMMAND_CMD(wParam, lParam);
			LPTREEFOLDER folder = GetCurrentFolder();
			LPCFILTER_ITEM g_lpFilterList = GetFilterList();

			switch (wID)
			{
				case IDOK:
					dwFilters = 0;
					g_FilterText = win_get_window_text_utf8(GetDlgItem(hDlg, IDC_FILTER_EDIT));

					// see which buttons are checked
					for (int i = 0; g_lpFilterList[i].m_dwFilterType; i++)
					{
						if (Button_GetCheck(GetDlgItem(hDlg, g_lpFilterList[i].m_dwCtrlID)))
							dwFilters |= g_lpFilterList[i].m_dwFilterType;
					}

					// Mask out invalid filters
					dwFilters = ValidateFilters(lpFilterRecord, dwFilters);
					// Keep non filter flags
					folder->m_dwFlags &= ~F_MASK;
					// put in the set filters
					folder->m_dwFlags |= dwFilters;
					DestroyIcon(hIcon);
					DeleteObject(hBrush);
					EndDialog(hDlg, 1);
					return true;

				case IDCANCEL:
					DestroyIcon(hIcon);
					DeleteObject(hBrush);
					EndDialog(hDlg, 0);
					return true;

				default:
					// Handle unchecking mutually exclusive filters
					if (wNotifyCode == BN_CLICKED)
						EnableFilterExclusions(hDlg, wID);
			}

			break;
		}
	}

	return false;
}