Beispiel #1
0
void wxSTEditorOptions::LoadConfig(wxConfigBase &config)
{
    if (HasConfigOption(STE_CONFIG_PREFS) && GetEditorPrefs().Ok())
        GetEditorPrefs().LoadConfig(config, GetConfigPath(STE_OPTION_CFGPATH_PREFS));
    if (HasConfigOption(STE_CONFIG_STYLES) && GetEditorStyles().Ok())
        GetEditorStyles().LoadConfig(config, GetConfigPath(STE_OPTION_CFGPATH_STYLES));
    if (HasConfigOption(STE_CONFIG_LANGS) && GetEditorLangs().Ok())
        GetEditorLangs().LoadConfig(config, GetConfigPath(STE_OPTION_CFGPATH_LANGS));
}
Beispiel #2
0
void wxSTEditorOptions::SaveConfig(wxConfigBase &config)
{
    if (HasConfigOption(STE_CONFIG_PREFS) && GetEditorPrefs().Ok())
        GetEditorPrefs().SaveConfig(config, GetConfigPath(STE_OPTION_CFGPATH_PREFS));
    if (HasConfigOption(STE_CONFIG_STYLES) && GetEditorStyles().Ok())
        GetEditorStyles().SaveConfig(config, GetConfigPath(STE_OPTION_CFGPATH_STYLES));
    if (HasConfigOption(STE_CONFIG_LANGS) && GetEditorLangs().Ok())
        GetEditorLangs().SaveConfig(config, GetConfigPath(STE_OPTION_CFGPATH_LANGS));

    if (GetEditorPrefs().Ok() || GetEditorStyles().Ok() || GetEditorLangs().Ok())
        config.Flush(true); // what is current only?
}
Beispiel #3
0
void CThhylDlg::CopyOrMoveRpy(LPCTSTR DialogTitle, BOOL bCopy)
{
	if (!m_filestatus.IsValid())
		return;
	
	CString filter((LPCTSTR)IDS_DLGFILTER), newfilename;
	
	CFileDialogWZ dlg(FALSE, _T("rpy"), m_rpyfile,
		OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST,
		filter, this);
	dlg.m_ofn.lpstrTitle=DialogTitle;
	if (dlg.DoModal()==IDCANCEL)
		return;
	
	newfilename=dlg.GetPathName();
	
	BOOL result;
	result = bCopy
		? CopyFile(m_rpyfile, newfilename, FALSE)
		: MoveFileEx(m_rpyfile, newfilename, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH);

	if (result) { //复制/移动成功
		//如果是移动,或者在选项中选中了“打开复制后的目标文件”
		if (!bCopy || HasConfigOption(CFG_COPYOPENDEST)) {
			m_rpyfile = newfilename;
			Analyze();
		}
	}
	else {
		LPCTSTR ErrorMsg;
		ErrorMsg = GetErrorMessage(GetLastError());
		MessageBox( ErrorMsg, DialogTitle, MB_ICONSTOP );
	}
}
Beispiel #4
0
void CThhylDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) 
{
	CDlgBaseWZ::OnActivate(nState, pWndOther, bMinimized);
	
	// TODO: Add your message handler code here
	// TRACE1("thhylDlg OnActivate %d", nState == WA_ACTIVE || nState == WA_CLICKACTIVE);
	if (nState == WA_ACTIVE || nState == WA_CLICKACTIVE) {
		if (m_bNeedReanalyze && m_filestatus.IsValid()) {
			CFileStatusWZ newfilestatus;

			m_bNeedReanalyze = FALSE;
			if (CFile::GetStatus(m_filestatus.m_szFullName, newfilestatus)) {
				// file still exists, Re-analyze if the file has been modified
				if ( !newfilestatus.IsSameDateAndSize(m_filestatus) ) {
					Analyze();
				}
				m_filestatus.Update(newfilestatus);
			}
			else {
				// file does not exist or cannot be opened, close it.
				if (HasConfigOption(CFG_AUTOEXIT))
					OnCancel();
				else
					CloseFile();
			}
		}
	}
}
Beispiel #5
0
void CThhylDlg::OnMButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default

	if( HasConfigOption(CFG_MBTN) )
		OnFiledelete();

	//CDlgBaseWZ::OnMButtonUp(nFlags, point);
}
Beispiel #6
0
void CThhylDlg::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	if( HasConfigOption(CFG_DBLCLK) )
		OnExit();
	else
		EnableMaximize(m_hWnd, -1); // maximize or restore

	//CDlgBaseWZ::OnLButtonDblClk(nFlags, point);
}
Beispiel #7
0
CDlgOption::CDlgOption(CWnd* pParent /*=NULL*/)
	: CDlgBaseWZ(CDlgOption::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgOption)
	m_CommentCodeEdit = cfg.CommentCode;
	m_InfoCodeEdit    = cfg.InfoCode;
	m_chkDblClk       = HasConfigOption(CFG_DBLCLK);
	m_chkMBtn         = HasConfigOption(CFG_MBTN);
	m_chkConfirm      = HasConfigOption(CFG_CONFIRM);
	m_chkPlayTime     = HasConfigOption(CFG_SHOWPLAYTIME);
	m_chkSlowRate     = HasConfigOption(CFG_SHOWSLOWRATE);
	m_chk9            = HasConfigOption(CFG_9);
	m_chkCopyOpenDest = HasConfigOption(CFG_COPYOPENDEST);
	m_chkAnyDrag      = HasConfigOption(CFG_ANYDRAG);
	m_chkAutoExit     = HasConfigOption(CFG_AUTOEXIT);
	//}}AFX_DATA_INIT
}
Beispiel #8
0
void CThhylDlg::OnFiledelete() 
{
	// TODO: Add your command handler code here
	if (!m_filestatus.IsValid())
		return;

	int            ret;
	SHFILEOPSTRUCT fos = {0};

	const bool bPressed = IsKeyDown(VK_SHIFT);

	//Perform delete operation via Shell
	{
		const size_t len = m_rpyfile.GetLength()+2;
		LPTSTR rpyfile = new TCHAR[len];

		_tcscpy(rpyfile, m_rpyfile);
		rpyfile[len-1]=_T('\0');

		fos.hwnd   = this->m_hWnd;
		fos.wFunc  = FO_DELETE;
		fos.pFrom  = rpyfile;
		fos.fFlags = FOF_SILENT |
			(bPressed ? 0 : FOF_ALLOWUNDO) |
			(HasConfigOption(CFG_CONFIRM) ? 0 : FOF_NOCONFIRMATION);
		ret = SHFileOperation(&fos);

		delete []rpyfile;
	}

	if (ret==0 && !fos.fAnyOperationsAborted) { //删除成功
		if (HasConfigOption(CFG_AUTOEXIT))
			OnCancel();
		else
			CloseFile();
	}
}
Beispiel #9
0
BOOL CThhylDlg::OnInitDialog()
{
	CDlgBaseWZ::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here

	//设置RPYAnalyzer框字体大小
	LoadEditCtrlFont((CEdit*)GetDlgItem(IDC_RPYINFO));

	// 初始化与控件关联的变量
	m_rpyfile = ((CThhylApp*)AfxGetApp())->m_rpyfile;
	m_bOnTop = ((CThhylApp*)AfxGetApp())->m_bOnTop;
	m_bAutocomp = HasConfigOption(CFG_AUTOCOMP);

	CoInitialize(NULL);

	if (m_rpyfile.IsEmpty()) {
		m_rpyfile.LoadString(IDS_HINTNOFILE);
		m_rpyinfo.LoadString(IDS_HINTSTART);

		UpdateData(FALSE);

		// 没有文件打开,将焦点置于“录像文件”框,方便输入文件路径
		CEdit* const pRpyFileEdit = (CEdit*)GetDlgItem(IDC_RPYFILE);
		pRpyFileEdit->SetFocus();
		pRpyFileEdit->SetSel(0, -1); //全选
	}
	else {
		UpdateData(FALSE);
		Analyze(); // analyze() 将置焦点于 RPYAnalyzer 框
	}

	// 置顶
	if (m_bOnTop) OnOntop();
	if (m_bAutocomp) OnAutocomp();

	// Set window pos
	if (cfg.WinPlace.length == sizeof(WINDOWPLACEMENT)) {
		cfg.WinPlace.showCmd = AfxGetApp()->m_nCmdShow;
		SetWindowPlacement(&cfg.WinPlace);
	}
	
	// set button titles to graphical unicode characters
	((CButton*)GetDlgItem(IDC_CUTFILE))->SetWindowText(_T("\x2704"));
	((CButton*)GetDlgItem(IDC_COPYFILE))->SetWindowText(_T("\x2750"));

	// 设置 tooltip 
	m_tooltip.AddTool( GetDlgItem(IDC_RPYFILE), _T("鼠标左键+滚轮可以调整本窗口的不透明度") );
	m_tooltip.AddTool( GetDlgItem(IDC_RPYINFO), _T("Ctrl+滚轮可以调整录像信息框的字体大小") );
	m_tooltip.AddTool( GetDlgItem(IDC_BROWSE), _T("打开录像文件[CTRL+B 或 CTRL+O]") );
	m_tooltip.AddTool( GetDlgItem(IDC_CLOSEFILE), _T("关闭录像文件[CTRL+L 或 CTRL+W]") );
	m_tooltip.AddTool( GetDlgItem(IDC_CUTFILE), _T("剪切[F9]") );
	m_tooltip.AddTool( GetDlgItem(IDC_COPYFILE), _T("复制[F10]") );
	m_tooltip.AddTool( GetDlgItem(IDC_CHGFONT), _T("更改录像信息框的字体") );
	m_tooltip.AddTool( GetDlgItem(IDC_COPY), _T("复制录像信息到剪贴板(若有选区则只复制选区内容,否则复制全部)") );
	m_tooltip.AddTool( GetDlgItem(IDC_EDITCOMMENT), _T("编辑录像注释(红魔乡和妖妖梦的录像不支持该功能)") );
	m_tooltip.AddTool( GetDlgItem(IDC_ONTOP), _T("让本窗口总在最前") );
	m_tooltip.AddTool( GetDlgItem(IDC_AUTOCOMP), _T("手动输入路径时是否显示自动完成的提示框") );
	m_tooltip.Activate(TRUE);

	// 设置不透明度
	SetWindowAlpha(this->GetSafeHwnd(), cfg.byteAlpha);

	// 设置 DlgBaseWZ 对话框选项
	m_dlgopt = DLGWZ_OPT_ENABLEMAXIMIZE;
	
	return FALSE;  // return TRUE  unless you set the focus to a control
}