예제 #1
0
void CFileEvent::AddFile (LPCTSTR pszPathName)
  {
    CFileInfo *pFileInfo;
    if (m_mapFileInfo.Lookup (pszPathName, pFileInfo))
      return;
    pFileInfo = new CFileInfo (pszPathName);
    m_mapFileInfo.SetAt (pszPathName, pFileInfo);
    POSITION pos = m_lstFilePath.GetHeadPosition ();
    CFilePath *pFilePath;
    while (pos)
      {
        pFilePath = m_lstFilePath.GetNext (pos);
        ASSERT (pFilePath);
        if (!_tcscmp (pFilePath->GetPath (), pFileInfo->GetPath ()))
          {
            pFilePath->Inc ();
            return;
          }
      }
    m_lstFilePath.AddTail (new CFilePath (pFileInfo->GetPath ()));
    if (m_bEvent)
      {
        StopWatching ();
        StartWatching ();
      }
  }
예제 #2
0
void CFileEvent::RemoveFile (LPCTSTR pszPathName)
  {
    CFileInfo *pFileInfo;
    if (!m_mapFileInfo.Lookup (pszPathName, pFileInfo))
      return;
    ASSERT (pFileInfo);
    POSITION pos = m_lstFilePath.GetHeadPosition (), posOld;
    CFilePath *pFilePath;
    while (pos)
      {
        posOld = pos;
        pFilePath = m_lstFilePath.GetNext (pos);
        ASSERT (pFilePath);
        if (!_tcscmp (pFilePath->GetPath (), pFileInfo->GetPath ()))
          {
            if (pFilePath->GetCount () == 1)
              {
                delete pFilePath;
                delete pFileInfo;
                m_lstFilePath.RemoveAt (posOld);
                m_mapFileInfo.RemoveKey (pszPathName);
              }
            else
              pFilePath->Dec ();
            return;
          }
      }
  }
예제 #3
0
CFilePath CFilePath::GetTempPath()
{
    BOOL bRetCode = FALSE;
    WCHAR sTempPath[MAX_PATH];

    ExpandEnvironmentStrings(L"%USERPROFILE%\\Local Settings\\Temp\\", sTempPath, MAX_PATH);
    bRetCode = PathFileExists(sTempPath);
    if (bRetCode == TRUE)
        return CFilePath(sTempPath);

    ExpandEnvironmentStrings(L"%TMP%\\", sTempPath, MAX_PATH);
    bRetCode = PathFileExists(sTempPath);
    if (bRetCode == TRUE)
        return CFilePath(sTempPath);

    ExpandEnvironmentStrings(L"%TEMP%\\", sTempPath, MAX_PATH);
    bRetCode = PathFileExists(sTempPath);
    if (bRetCode == TRUE)
        return CFilePath(sTempPath);

    CFilePath TempPath = CFilePath::GetModuleFileName();
    TempPath = TempPath.GetPath();
    TempPath &= L"Temp";

    CreateDirectory(TempPath, NULL);

    return CFilePath(sTempPath);
}
예제 #4
0
void MainWindow::updateCaption()
{
	// 名前の決定
	std::wstring name = L"";
	if(m_paths.size() == 0){
		name = L"無題";
	}
	else if(m_paths.size() == 1){
		CFilePath pathinfo = m_paths[0];
		name = pathinfo.GetTitle();
	}
	else{
		name = L"複数";
		if(qindex >= 0 && qindex < m_allList.getTotalCount()){
			name += L" (" + m_allList.getTotalAt(qindex).getFileName() + L")";
		}
	}

	// フィルタリングモード
	mystring mode = m_allList.getFilterLevelString();

	// キャプション設定
	setTextF(L"%ls (残り %02d/%02d) (%ls) - Paracka",
		name.c_str(),
		rndtable.getCurrentSize(),
		rndtable.getFirstSize(),
		mode.c_str()
	);
}
예제 #5
0
LONG CFilePath::ToRegistry(
    HKEY hBaseKey,
    LPCTSTR psSubKey,
    LPCTSTR psName,
    BOOL bReplaceEnv)
{
    CAutoHKEY Key;
    DWORD dwRetCode = RegCreateKeyEx(hBaseKey, psSubKey, NULL, NULL, 0, KEY_WRITE, NULL, Key.OutArg(), NULL);
    if (dwRetCode != ERROR_SUCCESS)
        return dwRetCode;

    CString sPath;
    if (bReplaceEnv)
    {
        CFilePath TempPath = sPath;
        TempPath.EnvUnexpandDefaultRoots();
        sPath = TempPath.GetStr();
    } else
    {
        sPath = GetStr();
    }

    dwRetCode = RegSetValueEx(
                    Key,
                    psName,
                    0,
                    bReplaceEnv ? REG_EXPAND_SZ : REG_SZ,
                    (BYTE *)sPath.operator LPCTSTR(),
                    (sPath.GetLength() + 1) * sizeof(TCHAR));

    return dwRetCode;
}
예제 #6
0
Bool CTexture2D::SetRawDataFromFile( const CFilePath& path )
{
    if( path.Exist() == FALSE )
        return FALSE;

    CoreManager.GetMemoryManager().GetStackHeap().PushMarker();
    {
        CImageFile* imageFile = NULL;
        CDDSFile ddsFile;
        CTGAFile tgaFile( &CoreManager.GetMemoryManager().GetStackHeap() );

        UInt32 offset = 0;
        Byte* destinationdata;
        UInt8 index;
        Char ext[6];

        path.GetExtension( ext, 6 );
        StringToLower( ext, ext, 6 );

        if( StringCompare( ext, "tga" ) == 0 )
            imageFile = &tgaFile;
        else if( StringCompare( ext, "dds" ) == 0 )
            imageFile = &ddsFile;

        if( imageFile && !imageFile->Load( path ) )
        {
            CoreManager.GetMemoryManager().GetStackHeap().PopMarker();
            return FALSE;
        }

        DebugAssert( imageFile->GetIsStandardTexture() );

        SetTextureInfo( imageFile->GetTextureInfo() );

        m_RawData.SetItemCount( GetTextureInfo().GetTextureByteCount() );
        destinationdata = m_RawData.GetBuffer();

        for( index = 0 ; index < GetTextureInfo().MipMapCount; index++)
        {
            UInt32 mipMapSize;
            const Byte* srcData = imageFile->GetSurfaceData( 0, index, mipMapSize );

            MemoryCopy( srcData, destinationdata + offset, mipMapSize );
            offset += mipMapSize;
        }
    }

    CoreManager.GetMemoryManager().GetStackHeap().PopMarker();

    return TRUE;
}
예제 #7
0
BOOL CFilePath::MakeRelative(CFilePath const &BasePath)
{
    CFilePath BasePathBS = BasePath;

    BasePathBS.AddBackslash();

    if (msPath.GetLength() > BasePathBS.GetLength())
    {
        if (0 == _tcsnicmp(BasePathBS, msPath, BasePathBS.GetLength()))
        {
            msPath = msPath.Mid(BasePathBS.GetLength());
            return TRUE;
        }
    }

    return FALSE;
}
예제 #8
0
Bool CGuiNinePatch::SetRawDataFromFile( const CFilePath& path )
{
	if( path.Exist() == FALSE )
		return FALSE;

	CFile file( path );
	return SetRawData( file );
}
예제 #9
0
INT_PTR CGeneralOptions::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			CAppMain &App=GetAppClass();

			::SendDlgItemMessage(hDlg,IDC_OPTIONS_DRIVERDIRECTORY,EM_LIMITTEXT,MAX_PATH-1,0);
			::SetDlgItemText(hDlg,IDC_OPTIONS_DRIVERDIRECTORY,m_BonDriverDirectory.c_str());

			// BonDriver
			::CheckRadioButton(hDlg,IDC_OPTIONS_DEFAULTDRIVER_NONE,
									IDC_OPTIONS_DEFAULTDRIVER_CUSTOM,
							   (int)m_DefaultDriverType+IDC_OPTIONS_DEFAULTDRIVER_NONE);
			EnableDlgItems(hDlg,IDC_OPTIONS_DEFAULTDRIVER,
								IDC_OPTIONS_DEFAULTDRIVER_BROWSE,
						   m_DefaultDriverType==DEFAULT_DRIVER_CUSTOM);

			const CDriverManager &DriverManager=App.DriverManager;
			DlgComboBox_LimitText(hDlg,IDC_OPTIONS_DEFAULTDRIVER,MAX_PATH-1);
			for (int i=0;i<DriverManager.NumDrivers();i++) {
				DlgComboBox_AddString(hDlg,IDC_OPTIONS_DEFAULTDRIVER,
									  DriverManager.GetDriverInfo(i)->GetFileName());
			}
			::SetDlgItemText(hDlg,IDC_OPTIONS_DEFAULTDRIVER,m_DefaultBonDriverName.c_str());

			DlgCheckBox_Check(hDlg,IDC_OPTIONS_RESIDENT,m_fResident);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_KEEPSINGLETASK,m_fKeepSingleTask);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_STANDALONEPROGRAMGUIDE,m_fStandaloneProgramGuide);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_ENABLE1SEGFALLBACK,m_fEnable1SegFallback);

			if (Util::OS::IsWindows7OrLater()) {
				DlgCheckBox_Check(hDlg,IDC_OPTIONS_USEUNIQUEAPPID,
								  App.TaskbarOptions.GetUseUniqueAppID());
				DlgCheckBox_Check(hDlg,IDC_OPTIONS_ENABLEJUMPLIST,
								  App.TaskbarOptions.GetEnableJumpList());
				DlgCheckBox_Check(hDlg,IDC_OPTIONS_JUMPLISTKEEPSINGLETASK,
								  App.TaskbarOptions.GetJumpListKeepSingleTask());
				EnableDlgItem(hDlg,IDC_OPTIONS_JUMPLISTKEEPSINGLETASK,
							  App.TaskbarOptions.GetEnableJumpList());
			} else {
				EnableDlgItems(hDlg,
							   IDC_OPTIONS_ENABLEJUMPLIST,
							   IDC_OPTIONS_USEUNIQUEAPPID,
							   false);
			}
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_OPTIONS_DRIVERDIRECTORY_BROWSE:
			{
				TCHAR szDirectory[MAX_PATH];

				if (::GetDlgItemText(hDlg,IDC_OPTIONS_DRIVERDIRECTORY,szDirectory,lengthof(szDirectory))>0) {
					if (::PathIsRelative(szDirectory)) {
						TCHAR szTemp[MAX_PATH];

						GetAppClass().GetAppDirectory(szTemp);
						::PathAppend(szTemp,szDirectory);
						::PathCanonicalize(szDirectory,szTemp);
					}
				} else {
					GetAppClass().GetAppDirectory(szDirectory);
				}
				if (BrowseFolderDialog(hDlg,szDirectory,TEXT("BonDriver の検索フォルダを選択してください。")))
					::SetDlgItemText(hDlg,IDC_OPTIONS_DRIVERDIRECTORY,szDirectory);
			}
			return TRUE;

		case IDC_OPTIONS_DEFAULTDRIVER_NONE:
		case IDC_OPTIONS_DEFAULTDRIVER_LAST:
		case IDC_OPTIONS_DEFAULTDRIVER_CUSTOM:
			EnableDlgItemsSyncCheckBox(hDlg,IDC_OPTIONS_DEFAULTDRIVER,
									   IDC_OPTIONS_DEFAULTDRIVER_BROWSE,
									   IDC_OPTIONS_DEFAULTDRIVER_CUSTOM);
			return TRUE;

		case IDC_OPTIONS_DEFAULTDRIVER_BROWSE:
			{
				OPENFILENAME ofn;
				TCHAR szFileName[MAX_PATH],szInitDir[MAX_PATH];
				CFilePath FilePath;

				::GetDlgItemText(hDlg,IDC_OPTIONS_DEFAULTDRIVER,szFileName,lengthof(szFileName));
				FilePath.SetPath(szFileName);
				if (FilePath.GetDirectory(szInitDir)) {
					::lstrcpy(szFileName,FilePath.GetFileName());
				} else {
					GetAppClass().GetAppDirectory(szInitDir);
				}
				InitOpenFileName(&ofn);
				ofn.hwndOwner=hDlg;
				ofn.lpstrFilter=
					TEXT("BonDriver(BonDriver*.dll)\0BonDriver*.dll\0")
					TEXT("すべてのファイル\0*.*\0");
				ofn.lpstrFile=szFileName;
				ofn.nMaxFile=lengthof(szFileName);
				ofn.lpstrInitialDir=szInitDir;
				ofn.lpstrTitle=TEXT("BonDriverの選択");
				ofn.Flags=OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_EXPLORER;
				if (FileOpenDialog(&ofn))
					::SetDlgItemText(hDlg,IDC_OPTIONS_DEFAULTDRIVER,szFileName);
			}
			return TRUE;

		case IDC_OPTIONS_ENABLEJUMPLIST:
			EnableDlgItemSyncCheckBox(hDlg,
									  IDC_OPTIONS_JUMPLISTKEEPSINGLETASK,
									  IDC_OPTIONS_ENABLEJUMPLIST);
			return TRUE;
		}
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			{
				TCHAR szDirectory[MAX_PATH];
				::GetDlgItemText(hDlg,IDC_OPTIONS_DRIVERDIRECTORY,
								 szDirectory,lengthof(szDirectory));
				m_BonDriverDirectory=szDirectory;

				m_DefaultDriverType=(DefaultDriverType)
					(GetCheckedRadioButton(hDlg,IDC_OPTIONS_DEFAULTDRIVER_NONE,
										   IDC_OPTIONS_DEFAULTDRIVER_CUSTOM)-
					IDC_OPTIONS_DEFAULTDRIVER_NONE);

				TCHAR szDefaultBonDriver[MAX_PATH];
				::GetDlgItemText(hDlg,IDC_OPTIONS_DEFAULTDRIVER,
								 szDefaultBonDriver,lengthof(szDefaultBonDriver));
				m_DefaultBonDriverName=szDefaultBonDriver;

				bool fResident=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_RESIDENT);
				if (fResident!=m_fResident) {
					m_fResident=fResident;
					SetUpdateFlag(UPDATE_RESIDENT);
				}

				m_fKeepSingleTask=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_KEEPSINGLETASK);

				m_fStandaloneProgramGuide=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_STANDALONEPROGRAMGUIDE);

				bool fEnable1SegFallback=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_ENABLE1SEGFALLBACK);
				if (fEnable1SegFallback!=m_fEnable1SegFallback) {
					m_fEnable1SegFallback=fEnable1SegFallback;
					SetUpdateFlag(UPDATE_1SEGFALLBACK);
				}

				if (Util::OS::IsWindows7OrLater()) {
					CTaskbarOptions &TaskbarOptions=GetAppClass().TaskbarOptions;

					TaskbarOptions.SetUseUniqueAppID(
						DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_USEUNIQUEAPPID));
					TaskbarOptions.SetEnableJumpList(
						DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_ENABLEJUMPLIST));
					TaskbarOptions.SetJumpListKeepSingleTask(
						DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_JUMPLISTKEEPSINGLETASK));
					TaskbarOptions.SetChanged();
				}

				m_fChanged=true;
			}
			return TRUE;
		}
		break;
	}

	return FALSE;
}
예제 #10
0
int
main(int argc, const char** argv) {
  CCommandLine arguments;
  arguments.ParseArgumentVector(argc, argv);
  deque<string> sourceFiles;
  string classPathString;
  CFilePath* classDestinationBase = 0;
  bool dependMode = false;

  if (arguments.GetArgumentCount() < 1) {
    SyntaxAbort(arguments.GetCommand());
  }
  for (CCommandLine::ArgumentIteratorType arg = arguments.GetArgumentBegin();
       arg != arguments.GetArgumentEnd(); ++arg) {
    unsigned long optionLength = (*arg).length();
    if (*arg == "-classpath") {
      ++arg;
      if (arg == arguments.GetArgumentEnd()) {
	SyntaxAbort(arguments.GetCommand());
      } else {
	classPathString = *arg;
      }
    } else if (*arg == "-version") {
      cerr << "guavac version " << VERSION << endl;
    } else if (*arg == "-M") {
      dependMode = true;
    } else if (*arg == "-d") {
      ++arg;
      if (arg == arguments.GetArgumentEnd()) {
	SyntaxAbort(arguments.GetCommand());
      } else {
	delete classDestinationBase;
	classDestinationBase = new CFilePath(*arg);
	if (!classDestinationBase->IsDirectory()) {
	  cerr << ">> Invalid destination directory: " << *arg << endl;
	  delete classDestinationBase;
	  classDestinationBase = 0;
	}
      }
    } else if (optionLength > 0 && (*arg)[0] == '-') {
      cerr << ">> Invalid compiler flag: " << *arg << endl;
      SyntaxAbort(arguments.GetCommand());
    } else {
      CFilePath filePath(*arg);
      if (!filePath.IsFile()) {
	cerr << ">> Invalid argument (not a plain file): " << *arg << endl;
	SyntaxAbort(arguments.GetCommand());
      } else if (optionLength < kSourceSuffix.length() ||
		 (*arg).compare(".java",
				optionLength - kSourceSuffix.length()) != 0) {
	cerr << ">> Invalid source file (no .java suffix): " << *arg << endl;
	SyntaxAbort(arguments.GetCommand());
      } else {
	sourceFiles.push_back(*arg);
      }
    }
  }
  if (classPathString.size() == 0) {
    const char* classPathEnvironment = getenv("CLASSPATH");
    if (classPathEnvironment == 0) {
      classPathString = DEFAULT_CLASSPATH;
    } else {
      classPathString = classPathEnvironment;
    }
  }
  if (sourceFiles.size() == 0) {
    cerr << ">> No valid source file names given." << endl;
    exit(1);
  }
  deque<string> classPath;
  if (! ParseClassPath(classPathString, classPath)) {
    cerr << ">> Invalid class path: " << classPathString << endl;
    exit(1);
  }
  bool success = true;
  for (deque<string>::const_iterator sourceIterator = sourceFiles.begin();
       success && !(sourceIterator == sourceFiles.end()); ++sourceIterator) {
    string fileName = *sourceIterator;
    string::size_type lastSlash = fileName.find_last_of('/');
    if (lastSlash == string::npos) {
      lastSlash = 0;
    } else {
      lastSlash++;
    }
    string fileDirectory(fileName, 0, lastSlash);
    CCompiler::ClassList resultClasses;
    deque<string> depends;
    success &= 
      CCompiler::CompileFile(fileName, classPath, resultClasses, depends);
    if (success) {
      if (!dependMode) {
	cout << "Compilation Successful.  Classes/interfaces found:" << endl;
      }
      for (CCompiler::ClassList::iterator i = resultClasses.begin();
	   i != resultClasses.end(); ++i) {
	string className = ::UnicodeToString((*i)->GetShortName());
	string outFileName;
	if (classDestinationBase == 0) {
	  outFileName = fileDirectory + className + ".class";
	} else {
	  outFileName = classDestinationBase->GetString() + "/" +
	    ::UnicodeToString((*i)->GetClassName()) + ".class";
	}
	if (dependMode) {
	  cout << outFileName << ":";
	  for (deque<string>::iterator iter = depends.begin();
	       !(iter == depends.end()); ++iter) {
	    cout << " \\\n        " << *iter;
	  }
	  cout << endl;
	} else if (MakeDirectories(outFileName)) {
	  ofstream outFile;
	  outFile.open(outFileName.c_str(), ios::out | ios::bin | ios::trunc);
	  if (!outFile.is_open()) {
	    cerr << ">> could not open output file " << outFileName << endl;
	  } else {
	    if (!(*i)->IsInner()) {
	      cout << " *  " << className << endl;
	    }
	    (*i)->Compile(outFile);
	    outFile.close();
	  }
	}
      }
    } else {
      cerr << "Compilation Failed" << endl;
    }
    for (CCompiler::ClassList::iterator i = resultClasses.begin();
	 i != resultClasses.end(); ++i) {
      delete *i;
    }
  }
  return success ? 0 : 1;
}
예제 #11
0
UINT CFileEvent::FileEventProc (LPVOID lpParam)
  {
    CFileEvent *pFileEvent = (CFileEvent*) lpParam;
    int nFilePathCount = pFileEvent->m_lstFilePath.GetCount ();
    HANDLE *phChanges = new HANDLE[nFilePathCount + 1];
    for (int i;;)
      {
        *phChanges = pFileEvent->m_evWatching;
        POSITION pos = pos = pFileEvent->m_lstFilePath.GetHeadPosition ();
        CFilePath *pFilePath;
        int j = 0;
        for (i = 0; i < nFilePathCount; i++)
          {
            if (!pos)
              {
                nFilePathCount = i;
                break;
              }
            pFilePath = pFileEvent->m_lstFilePath.GetNext (pos);
            ASSERT (pFilePath);
            HANDLE hFC = FindFirstChangeNotification (pFilePath->GetPath(), FALSE,
              FILE_NOTIFY_CHANGE_LAST_WRITE|FILE_NOTIFY_CHANGE_SIZE|FILE_NOTIFY_CHANGE_FILE_NAME);
            if (hFC != INVALID_HANDLE_VALUE) // if i can gen a notification --
              phChanges[++j] = hFC;
          }
        DWORD dwResult = WaitForMultipleObjects (j + 1, phChanges, FALSE, INFINITE);
        for (i = 1; i < j; i++)
          VERIFY (FindCloseChangeNotification (phChanges[i + 1]));
        if (dwResult == WAIT_OBJECT_0)
          break;
        int nPath = dwResult - WAIT_OBJECT_0 - 1;
        pos = pFileEvent->m_lstFilePath.FindIndex (nPath);
        //ASSERT (pos);
		if(pos == 0)
		{
			break;
		}
        pFilePath = pFileEvent->m_lstFilePath.GetAt (pos);
        //ASSERT (pFilePath);
		if(pFilePath == NULL)
		{
			break;
		}
        CString sPathName;
        CFileInfo *pFileInfo;
        for (pos = pFileEvent->m_mapFileInfo.GetStartPosition (); pos;)
          {
            pFileEvent->m_mapFileInfo.GetNextAssoc (pos, sPathName, pFileInfo);
            ASSERT (pFileInfo);
            if (!_tcscmp (pFilePath->GetPath (), pFileInfo->GetPath ()))
              {
                HANDLE hFile = CreateFile (sPathName, GENERIC_READ, FILE_SHARE_READ /*|FILE_SHARE_WRITE|FILE_SHARE_DELETE*/,
                  NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
				// add at 2006-05-06 by blueant
				if (hFile == INVALID_HANDLE_VALUE)
				{
					// 文件保存过程中很大情况下返回的是无效句柄,需要延迟一段时间等保存完毕再打开
					Sleep(50);
					hFile = CreateFile (sPathName, GENERIC_READ, FILE_SHARE_READ /*|FILE_SHARE_WRITE|FILE_SHARE_DELETE*/,
						NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
				}
                if (hFile != INVALID_HANDLE_VALUE)
                  {
                    FILETIME ftModified;
                    VERIFY (GetFileTime (hFile, NULL, NULL, &ftModified));
                    DWORD dwSize;
					// ->HE
					dwSize= GetFileSize (hFile, NULL);
					ASSERT(dwSize != (DWORD)-1);
					// <-HE
                   CloseHandle (hFile);
                    WPARAM wEvent = FE_NONE;
                    if (CompareFileTime (&pFileInfo->GetModified (), &ftModified) < 0)
                      {
                        pFileInfo->SetModified (ftModified);
                        wEvent |= FE_CHANGED_TIME;
                      }
                    if (pFileInfo->GetSize () != dwSize)
                      {
                        pFileInfo->SetSize (dwSize);
                        wEvent |= FE_CHANGED_SIZE;
                      }
                    if (wEvent)
                      pFileEvent->OnFileEvent (wEvent, sPathName);
                  }
                else
                  {
                    pFileEvent->OnFileEvent (FE_DELETED, sPathName);
                    pFileEvent->RemoveFile (sPathName);
                  }
              }
          }
      }
    delete [] phChanges;
    return 0;
  }
예제 #12
0
INT_PTR CViewOptions::DlgProc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg) {
	case WM_INITDIALOG:
		{
			// ウィンドウ設定
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_SNAPATWINDOWEDGE,
							  m_fSnapAtWindowEdge);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_ADJUSTASPECTRESIZING,
							  m_fAdjustAspectResizing);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_NEARCORNERRESIZEORIGIN,
							  m_fNearCornerResizeOrigin);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_ZOOMKEEPASPECTRATIO,m_fZoomKeepAspectRatio);
			{
				static const LPCTSTR AdjustWindowModeList[] = {
					TEXT("サイズを変えない"),
					TEXT("幅のみ変える"),
					TEXT("幅と高さを変える"),
				};
				for (int i=0;i<lengthof(AdjustWindowModeList);i++) {
					DlgComboBox_AddString(hDlg,IDC_OPTIONS_PANSCANADJUSTWINDOW,
										  AdjustWindowModeList[i]);
				}
				DlgComboBox_SetCurSel(hDlg,IDC_OPTIONS_PANSCANADJUSTWINDOW,
									  m_PanScanAdjustWindowMode);
			}
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_REMEMBER1SEGWINDOWSIZE,m_fRemember1SegWindowSize);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_MINIMIZETOTRAY,m_fMinimizeToTray);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_MINIMIZEDISABLEPREVIEW,
							  m_fDisablePreviewWhenMinimized);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_USELOGOICON,
							  m_fUseLogoIcon);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_SHOWTITLEEVENTTIME,
							  m_fShowTitleEventTime);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_SHOWLOGO,m_fShowLogo);
			::SetDlgItemText(hDlg,IDC_OPTIONS_LOGOFILENAME,m_szLogoFileName);
			::SendDlgItemMessage(hDlg,IDC_OPTIONS_LOGOFILENAME,EM_LIMITTEXT,MAX_PATH-1,0);
			::EnableDlgItems(hDlg,IDC_OPTIONS_LOGOFILENAME,IDC_OPTIONS_LOGOFILENAME_BROWSE,
							 m_fShowLogo);

			// 抑止設定
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_NOSCREENSAVER,m_fNoScreenSaver);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_NOMONITORLOWPOWER,m_fNoMonitorLowPower);
			DlgCheckBox_Check(hDlg,IDC_OPTIONS_NOMONITORLOWPOWERACTIVEONLY,
							  m_fNoMonitorLowPowerActiveOnly);
			EnableDlgItem(hDlg,IDC_OPTIONS_NOMONITORLOWPOWERACTIVEONLY,m_fNoMonitorLowPower);
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_OPTIONS_SHOWLOGO:
			EnableDlgItemsSyncCheckBox(hDlg,IDC_OPTIONS_LOGOFILENAME,IDC_OPTIONS_LOGOFILENAME_BROWSE,
									   IDC_OPTIONS_SHOWLOGO);
			return TRUE;

		case IDC_OPTIONS_LOGOFILENAME_BROWSE:
			{
				OPENFILENAME ofn;
				TCHAR szFileName[MAX_PATH],szInitDir[MAX_PATH];
				CFilePath FilePath;

				::GetDlgItemText(hDlg,IDC_OPTIONS_LOGOFILENAME,szFileName,lengthof(szFileName));
				FilePath.SetPath(szFileName);
				if (FilePath.GetDirectory(szInitDir)) {
					::lstrcpy(szFileName,FilePath.GetFileName());
				} else {
					GetAppClass().GetAppDirectory(szInitDir);
				}
				InitOpenFileName(&ofn);
				ofn.hwndOwner=hDlg;
				ofn.lpstrFilter=
					TEXT("BMPファイル(*.bmp)\0*.bmp\0")
					TEXT("すべてのファイル\0*.*\0");
				ofn.lpstrFile=szFileName;
				ofn.nMaxFile=lengthof(szFileName);
				ofn.lpstrInitialDir=szInitDir;
				ofn.lpstrTitle=TEXT("ロゴ画像の選択");
				ofn.Flags=OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_EXPLORER;
				if (::GetOpenFileName(&ofn)) {
					::SetDlgItemText(hDlg,IDC_OPTIONS_LOGOFILENAME,szFileName);
				}
			}
			return TRUE;

		case IDC_OPTIONS_NOMONITORLOWPOWER:
			EnableDlgItemSyncCheckBox(hDlg,IDC_OPTIONS_NOMONITORLOWPOWERACTIVEONLY,
									  IDC_OPTIONS_NOMONITORLOWPOWER);
			return TRUE;
		}
		return TRUE;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			{
				CAppMain &App=GetAppClass();
				bool f;

				m_fSnapAtWindowEdge=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_SNAPATWINDOWEDGE);
				m_fAdjustAspectResizing=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_ADJUSTASPECTRESIZING);
				m_fNearCornerResizeOrigin=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_NEARCORNERRESIZEORIGIN);
				m_fZoomKeepAspectRatio=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_ZOOMKEEPASPECTRATIO);
				m_PanScanAdjustWindowMode=(AdjustWindowMode)
					DlgComboBox_GetCurSel(hDlg,IDC_OPTIONS_PANSCANADJUSTWINDOW);
				m_fRemember1SegWindowSize=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_REMEMBER1SEGWINDOWSIZE);
				m_fMinimizeToTray=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_MINIMIZETOTRAY);
				m_fDisablePreviewWhenMinimized=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_MINIMIZEDISABLEPREVIEW);
				f=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_USELOGOICON);
				if (m_fUseLogoIcon!=f) {
					m_fUseLogoIcon=f;
					App.UICore.UpdateIcon();
				}
				f=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_SHOWTITLEEVENTTIME);
				if (m_fShowTitleEventTime!=f) {
					m_fShowTitleEventTime=f;
					App.UICore.UpdateTitle();
				}
				{
					bool fLogo=DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_SHOWLOGO);
					TCHAR szFileName[MAX_PATH];

					::GetDlgItemText(hDlg,IDC_OPTIONS_LOGOFILENAME,szFileName,MAX_PATH);
					if (fLogo!=m_fShowLogo
							|| ::lstrcmp(szFileName,m_szLogoFileName)!=0) {
						m_fShowLogo=fLogo;
						::lstrcpy(m_szLogoFileName,szFileName);
						SetUpdateFlag(UPDATE_LOGO);
					}
				}

				m_fNoScreenSaver=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_NOSCREENSAVER);
				m_fNoMonitorLowPower=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_NOMONITORLOWPOWER);
				m_fNoMonitorLowPowerActiveOnly=
					DlgCheckBox_IsChecked(hDlg,IDC_OPTIONS_NOMONITORLOWPOWERACTIVEONLY);
				App.UICore.PreventDisplaySave(true);

				m_fChanged=true;
			}
			break;
		}
		break;
	}

	return FALSE;
}