Ejemplo n.º 1
0
	int OnNotify(GViewI *c, int f)
	{
		switch (c->GetId())
		{
			case IDC_CMD_LINE:
			{
				LgiMsg(	this,
						"These are the command line options you can use with LrStrip. If you specify these\n"
						"then no window will be shown and the application will exit after it's completed\n"
						"it's work.\n"
						"\n"
						"Required options:\n"
						"\n"
						"    -in \'<FileName>\'\n"
						"    -out \'<FileName>\'\n"
						"    -langs \'<LangId>[, <LangId>]\'\n"
						"\n"
						"Where 'LangId' is a standard language code (like 'en' for english).",
						AppName);
				break;
			}
			case IDC_LOAD_FILE:
			{
				GFileSelect s;
				s.Parent(this);
				s.Type("Lgi Resource", "*.lr*");
				if (s.Open())
				{
					Load(s.Name());
				}
				break;
			}
			case IDOK:
			{
				GFileSelect s;
				s.Parent(this);
				s.Type("Lgi Resource", "*.lr*");
				if (s.Save())
				{
					// put together the list of langs
					Langs.Empty();

					List<LangInc> LangLst;
					Inc->GetAll(LangLst);
					for (LangInc *i = LangLst.First(); i; i = LangLst.Next())
					{
						if (i->Value())
						{
							Langs.Add(i->GetText(1), i);
						}
					}

					// overwrite check
					if (FileExists(s.Name()))
					{
						if (LgiMsg(this, "Overwrite '%s'?", AppName, MB_YESNO, s.Name()) == IDNO)
						{
							return 0;
						}
					}

					// save the file...
					if (Save(s.Name()))
					{
						LgiMsg(this, "Striped resource file written ok.", AppName);
					}
				}
				break;
			}
			case IDCANCEL:
			{
				EndModal(c->GetId());
				break;
			}
		}

		return 0;
	}