void CMidiAssignPropsDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMidiAssignPropsDlg)
	DDX_Control(pDX, IDC_MIDI_ASS_PROPS_PORT_SPIN, m_PortSpin);
	DDX_Control(pDX, IDC_MIDI_ASS_PROPS_ITEM_COUNT, m_ItemCountStat);
	DDX_Control(pDX, IDC_MIDI_ASS_PROPS_DEVICE_NAME, m_DeviceNameEdit);
	DDX_Control(pDX, IDC_MIDI_ASS_PROPS_RANGE_START, m_RangeStartEdit);
	DDX_Control(pDX, IDC_MIDI_ASS_PROPS_RANGE_END, m_RangeEndEdit);
	DDX_Control(pDX, IDC_MIDI_ASS_PROPS_PORT, m_PortEdit);
	DDX_Control(pDX, IDC_MIDI_ASS_PROPS_EVENT, m_EventCombo);
	DDX_Control(pDX, IDC_MIDI_ASS_PROPS_CONTROL, m_ControlCombo);
	DDX_Control(pDX, IDC_MIDI_ASS_PROPS_CHAN, m_ChanCombo);
	//}}AFX_DATA_MAP
	DDX_Text(pDX, IDC_MIDI_ASS_PROPS_PART_NAME, m_PartName);
	DDX_Text(pDX, IDC_MIDI_ASS_PROPS_TARGET_NAME, m_TargetName);
	CString	s;
	m_PortEdit.GetWindowText(s);
	if (!s.IsEmpty() || m_Inst.Port >= 0) {	// if non-empty or determinate
		DDX_Text(pDX, IDC_MIDI_ASS_PROPS_PORT, m_Inst.Port);
		DDV_MinMaxInt(pDX, m_Inst.Port, 0, INT_MAX);
	}
	DDX_CBIndex(pDX, IDC_MIDI_ASS_PROPS_CHAN, m_Inst.Chan);
	DDX_CBIndex(pDX, IDC_MIDI_ASS_PROPS_EVENT, m_Event);
	DDX_CBIndex(pDX, IDC_MIDI_ASS_PROPS_CONTROL, m_Control);
	m_RangeStartEdit.GetWindowText(s);
	if (!s.IsEmpty() || m_RangeStart != FLT_MAX)	// if non-empty or determinate
		DDX_Text(pDX, IDC_MIDI_ASS_PROPS_RANGE_START, m_RangeStart);
	m_RangeEndEdit.GetWindowText(s);
	if (!s.IsEmpty() || m_RangeEnd != FLT_MAX)	// if non-empty or determinate
		DDX_Text(pDX, IDC_MIDI_ASS_PROPS_RANGE_END, m_RangeEnd);
}
void CRevisionGraphDlg::OnFileSavegraphas()
{
	CString tempfile;
	int filterindex = 0;
	if (CAppUtils::FileOpenSave(tempfile, &filterindex, IDS_REVGRAPH_SAVEPIC, IDS_PICTUREFILEFILTER, false, m_hWnd))
	{
		// if the user doesn't specify a file extension, default to
		// svg and add that extension to the filename. But only if the
		// user chose the 'pictures' filter. The filename isn't changed
		// if the 'All files' filter was chosen.
		CString extension;
		int dotPos = tempfile.ReverseFind('.');
		int slashPos = tempfile.ReverseFind('\\');
		if (dotPos > slashPos)
			extension = tempfile.Mid(dotPos);
		if ((filterindex == 1)&&(extension.IsEmpty()))
		{
			extension = L".svg";
			tempfile += extension;
		}
		if ((filterindex == 2)&&(extension.IsEmpty()))
		{
			extension = L".gv";
			tempfile += extension;
		}
		m_Graph.SaveGraphAs(tempfile);
	}
}
Example #3
0
	void RefreshGlobal()
	{
		DoDataExchange(true);
		boost::filesystem::path configFile;
		GetConfigPath(static_cast<const TCHAR *>(m_ConfigLabel), configFile);
		CComPtr<IConfig> config = CreateIConfig(QUERYBUILDER_CFG, configFile);
		CString accountServer = config->Get(GLOBAL_SERVER_ACCOUNT);
		if (accountServer.IsEmpty())
		{
			GetDlgItem(IDC_EDIT_USER).EnableWindow(false);
			GetDlgItem(IDC_EDIT_PASSWORD).EnableWindow(false);
			m_User = _T("");
			m_Password = _T("");
			m_Msg = _T("(No username or password required)");
		}
		else
		{
			GetDlgItem(IDC_EDIT_USER).EnableWindow(true);
			GetDlgItem(IDC_EDIT_PASSWORD).EnableWindow(true);
			m_User = config->Get(GLOBAL_USER);
			m_Password = config->Get(GLOBAL_PASSWORD);
			m_Msg = _T("(Please enter username and password)");
		}
		if (m_configPrefs)
			GetDlgItem(IDC_LOGIN_PREFS).EnableWindow(m_ConfigLabel.IsEmpty()==false);
		DoDataExchange();
		m_autoUpdateLink.ShowWindow(SW_HIDE);
		if (!(bool)m_IniFile->Get(GLOBAL_DISABLEAUTOUPDATE))
			clib::thread run(__FUNCTION__, boost::bind(&thread_CheckForUpdates, this, m_autoupdate));

	}
Example #4
0
BOOL CGuideDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
	// commit the currently being edited text
	::SendMessage(theApp.GetLeftWnd(), WM_GUIDEUI, GM_COMMIT_RTF_NOW, 0);

	// "unlock" the file
	CString fileName = m_Locker.getFileName();
	// if the fileName is empty, it means that we're going to save a
	// previously unsaved document (untitled).
	if (fileName.IsEmpty() == FALSE)
		// otherwise unlock it
		m_Locker.unlock();

	// save the file
	ASSERT(m_pGuide);
	if (guide_store(lpszPathName, m_pGuide) != 0)
		return FALSE;

	// after first save, use the filename and lock in future
	if (fileName.IsEmpty() == TRUE)
		fileName = lpszPathName;

	// re-"lock" the file
	m_Locker.lock(fileName);

	// set unmodified flag
	SetModifiedFlag(FALSE);

	return TRUE;
}
void CIPFilterDlg::OnCopyIPFilter()
{
	CWaitCursor curWait;
	int iSelected = 0;
	CString strData;
	POSITION pos = m_ipfilter.GetFirstSelectedItemPosition();
	while (pos)
	{
		int iItem = m_ipfilter.GetNextSelectedItem(pos);
		if (!strData.IsEmpty())
			strData += _T("\r\n");

		strData.AppendFormat(_T("%-15s - %-15s  Hits=%-5s  %s"), 
				m_ipfilter.GetItemText(iItem, IPFILTER_COL_START),
				m_ipfilter.GetItemText(iItem, IPFILTER_COL_END),
				m_ipfilter.GetItemText(iItem, IPFILTER_COL_HITS),
				m_ipfilter.GetItemText(iItem, IPFILTER_COL_DESC));
		iSelected++;
	}

	if (!strData.IsEmpty())
	{
		if (iSelected > 1)
			strData += _T("\r\n");
		theApp.CopyTextToClipboard(strData);
	}
}
Example #6
0
// 通过本地数据类载入所有的终端信息
void CDlgAddTerm::LoadComputeInfo(void)
{
	for (INT_PTR ii = 0; ii < CLocalServer::GetInstance()->ComputerList.GetCount(); ii++)
	{
		CComputerInfo info = CLocalServer::GetInstance()->ComputerList.GetComputer(ii);

		CString str  = info.GetTerminalID();
		if (str.IsEmpty())
		{
			continue;
		}

		INT_PTR jj = 0;
		for (jj = 0; jj < m_SeatList->GetSize(); jj++)
		{
			CSeat * tSeat = m_SeatList->GetAt(jj);
			if (str == tSeat->GetTerminalID())
			{
				break;
			}
		}

		if (jj >= m_SeatList->GetSize())
		{
			m_cboTerminalID.AddString(str);

			str = info.GetComputerIP();
			if (!str.IsEmpty())
			{
				m_cboTerminalIP.AddString(str);
			}
		}
	}

}
Example #7
0
//发送json命令的基础函数
Document Device::sendApi(CString &type, Value &method, Value &params, Value &version)
{
	CString actionurl = findActionListUrl(type);
	if (!actionurl || actionurl.IsEmpty())
	{
		return NULL;
	}
	CString url = actionurl + "/" + type;

	Document requestJson;
	requestJson.SetObject();
	Document::AllocatorType& allocator = requestJson.GetAllocator();
	
	requestJson.AddMember("method", method, allocator);
	requestJson.AddMember("params", params, allocator);
	requestJson.AddMember("id", ++reqId, allocator);
	requestJson.AddMember("version", version, allocator);
	
	StringBuffer buffer;
	Writer<StringBuffer> writer(buffer);
	requestJson.Accept(writer);
	const char* output = buffer.GetString();

	CString response = HttpClient::post(url, CString(output));
	if (!response || response.IsEmpty())
	{
		return NULL;
	}

	Document responseJson;
	responseJson.Parse(response);
	return responseJson;
}
Example #8
0
CString CSZCommandLineEx::FormatEchoUsage(LPCWSTR lpCommandName, LPCWSTR lpSummary)
{
    CString strEchoUsage  = lpSummary;

    CString strSubCommand           = FormatSubCommand(lpCommandName);
    CString strCommandPresentation  = FormatCommandPresentation(lpCommandName);
    CString strCommandUsage         = FormatCommandUsage();

    strEchoUsage.Append(_T("\n\n"));
    
    if (!strSubCommand.IsEmpty())
    {
        strEchoUsage.Append(strSubCommand);
        if (!strCommandPresentation.IsEmpty())
        {
            strEchoUsage.Append(_T("\n\n"));
            strEchoUsage.Append(_T("    = Or =\n"));
        }
        strEchoUsage.Append(_T("\n"));
    }

    if (!strCommandPresentation.IsEmpty())
    {
        strEchoUsage.Append(strCommandPresentation);
        strEchoUsage.Append(_T("\n\n"));
        strEchoUsage.Append(strCommandUsage);
        strEchoUsage.Append(_T("\n\n"));
    }

    return strEchoUsage;
}
Example #9
0
void CHistoryCombo::SaveHistory()
{
    if (m_sSection.IsEmpty())
        return;

    //add the current item to the history
    CString sCurItem;
    GetWindowText(sCurItem);
    if (m_bTrim)
        sCurItem.Trim();
    if (!sCurItem.IsEmpty()&&(sCurItem.GetLength() < MAX_PATH))
        AddString(sCurItem, 0);
    //save history to registry/inifile
    int nMax = min(GetCount(), m_nMaxHistoryItems + 1);
    for (int n = 0; n < nMax; n++)
    {
        CString sKey;
        sKey.Format(L"%s\\%s%d", (LPCTSTR)m_sSection, (LPCTSTR)m_sKeyPrefix, n);
        CRegString regkey(sKey);
        regkey = m_arEntries.GetAt(n);
    }
    //remove items exceeding the max number of history items
    for (int n = nMax; ; n++)
    {
        CString sKey;
        sKey.Format(L"%s\\%s%d", (LPCTSTR)m_sSection, (LPCTSTR)m_sKeyPrefix, n);
        CRegString regkey = CRegString(sKey);
        CString sText = regkey;
        if (sText.IsEmpty())
            break;
        regkey.removeValue(); // remove entry
    }
}
Example #10
0
// 从XML设置是否发送指定的DUI消息的属性
HRESULT CControlBase::OnAttributeSendDuiMsg(const CString& strValue, BOOL bLoading)
{
	if (strValue.IsEmpty()) return E_FAIL;

	// 解析需要发送的DUI消息列表
	CStringArray asDuiMsg;
	CString strDuiMsg = strValue;
	int nPos = -1;
	while((nPos = strDuiMsg.Find(_T("|"))) != -1)
	{
		CString strTemp = strDuiMsg.Left(nPos);
		strDuiMsg.Delete(0, nPos+1);
		asDuiMsg.Add(strTemp);
	}
	if(!strDuiMsg.IsEmpty())
	{
		asDuiMsg.Add(strDuiMsg);
	}

	for(int i=0; i<asDuiMsg.GetSize(); i++)
	{
		OnControlSetDuiMsg(asDuiMsg[i]);
	}

	return bLoading?S_FALSE:S_OK;
}
bool COrbitSupplier::retrieveDownloadFilePath(const TOrbitDownload& tOrbitDownload, CString& sDownloadFilePath) const
{
	
	sDownloadFilePath = tOrbitDownload.sPath;
	sDownloadFilePath.Replace("/", "\\");
	if (sDownloadFilePath.IsEmpty()) {
		
		return false;
	}

	if (sDownloadFilePath.Right(1) != "\\") {
		sDownloadFilePath += "\\";
	}

	CString sDownloadFileName = tOrbitDownload.sFile;
	if (!tOrbitDownload.bIsComplete) {
		sDownloadFileName += ".ob!"; 
	}

	if (sDownloadFileName.IsEmpty()) {
		
		return false;
	}

	sDownloadFilePath += sDownloadFileName;
	if (GetFileAttributes(sDownloadFilePath) == (DWORD)(-1)) {
		
		return false;
	}

	return true;
}
Example #12
0
void CXMLElement::AddRecursiveWords(CString& strWords) const
{
	for ( POSITION pos = GetAttributeIterator() ; pos ; )
	{
		CXMLAttribute* pAttribute = GetNextAttribute( pos );
		CString strText = pAttribute->GetName();

		if ( strText.Find( ':' ) >= 0 ) continue;
		if ( strText.CompareNoCase( _T("SHA1") ) == 0 ) continue;	// NOTE: PeerProject/Shareaza Specific

		if ( ! strWords.IsEmpty() ) strWords += ' ';
		strWords += pAttribute->GetValue();
	}

	for ( POSITION pos = GetElementIterator() ; pos ; )
	{
		GetNextElement( pos )->AddRecursiveWords( strWords );
	}

	if ( ! m_sValue.IsEmpty() )
	{
		if ( ! strWords.IsEmpty() )
			strWords += ' ';
		strWords += m_sValue;
	}
}
Example #13
0
CString CFileBackup::BuildBackupPath(const CString& sFile, const CString& sFolder, BOOL bTimeStamp, const CString& sExt)
{
	CString sBackup(sFile);
	sBackup.TrimRight();

	// handle folder
	if (!sFolder.IsEmpty())
	{
		CString sDrive, sPath, sFName, sExt;
		FileMisc::SplitPath(sFile, &sDrive, &sPath, &sFName, &sExt);

		if (::PathIsRelative(sFolder))
		{
			sPath += sFolder;
			FileMisc::MakePath(sBackup, sDrive, sPath, sFName, sExt);
		}
		else
		{
			FileMisc::MakePath(sBackup, NULL, sFolder, sFName, sExt);
		}
	}

	// add timestamp before existing file extension
	CString sFExt;
	FileMisc::SplitPath(sBackup, NULL, NULL, NULL, &sFExt);

	if (bTimeStamp)
	{
		// use ISO date and 24 hour time so that backups can be sorted
		// by name in date order
		CString sDate = COleDateTime::GetCurrentTime().Format(_T("%Y-%m-%d_%H-%M-%S"));
		sFExt = _T(".") + sDate + sFExt;
	}

	// add extension before existing file extension
	if (sExt.IsEmpty())
	{
		// only add a default extension if not copying to another folder or not adding timestamp
		// else we'd overwrite the existing file which wouldn't achieve much
		if (sFolder.IsEmpty() && !bTimeStamp)
		{
			sFExt = _T(".bak") + sFExt;
		}
	}
	else
	{
		if (sExt.Find('.') == -1)
		{
			sFExt = '.' + sExt + sFExt;
		}
		else
		{
			sFExt = sExt + sFExt;
		}
	}

	FileMisc::ReplaceExtension(sBackup, sFExt);

	return sBackup;
}
Example #14
0
bool MainDlg::getSet()
{
	CString sAtr;
	m_AtrEdit.GetWindowTextA(sAtr);
	m_SymbolEdit.GetWindowTextA(sSymbol);//获得Symbol的值
	CString sTimer,sLooAtr,sStopAtr;
	m_TimerCombo.GetWindowTextA(sTimer);
	m_LooAtrCombo.GetWindowTextA(sLooAtr);
	m_StopAtrCombo.GetWindowTextA(sStopAtr);
	nTimer=atoi(sTimer.GetBuffer(sTimer.GetLength()));//获得nTimer的值
	nLooAtr=atoi(sLooAtr.GetBuffer(sLooAtr.GetLength()));//获得looAtr的值
	nStopAtr=atoi(sStopAtr.GetBuffer(sStopAtr.GetLength()));//获得stopAtr的值
	if(sSymbol.IsEmpty())
	{
		this->SendMyMessage("Set Symbol");
		return false;
	}
	if(sAtr.IsEmpty())
	{
		this->SendMyMessage("Set ATR");
		return false;
	}
	else
	{
		fAtr=(float)atof(sAtr.GetBuffer(sAtr.GetLength()));//获得Atr的值
	}
	return true;
}
Example #15
0
int CuDlgMain::GetInstallationParam(int nSchema)
{
	int nInstallation = -1;
	CRect r1, r2, re;
	CComboBoxEx* pComboDatabase = (nSchema == 1)? &m_cComboDatabase1: &m_cComboDatabase2;
	CEdit*       pEditFile  = (nSchema == 1)? &m_cEditFile1: &m_cEditFile2;
	if (pEditFile->IsWindowVisible())
	{
		CString strFile;
		pEditFile->GetWindowText(strFile);
		strFile.TrimLeft();
		strFile.TrimRight();
		if (strFile.IsEmpty())
			return -1;
		if (_taccess(strFile, 0) == -1)
			return -1;
		nInstallation = IsInstallationFile(strFile);
	}
	else
	{
		int nSel = pComboDatabase->GetCurSel();
		if (nSel != CB_ERR)
		{
			CaDatabase* pDatabase = (CaDatabase*)pComboDatabase->GetItemDataPtr(nSel);
			if (pDatabase)
			{
				CString strDb = pDatabase->GetItem();
				nInstallation = strDb.IsEmpty()? 1: 0;
			}
		}
	}
	return nInstallation;
}
void CContextMenuItemDlg::generateTitle()
{
	if ( !titleEdited_ ) {	
		ServerProfile sp = imageServerSelector_->serverProfile();
		CString title;
		title.Format(TR("Загрузить на %s"), (LPCTSTR)sp.serverName());
		CString additional;
		if ( !sp.profileName().IsEmpty()) {
			additional+= sp.profileName();
		}
		if ( !sp.folderId().empty() && !sp.folderTitle().empty() ) {
			if ( !additional.IsEmpty() ) {
				additional += _T(", ");
			}
			CString temp;
			temp.Format(TR("папка \"%s\""), (LPCTSTR) Utf8ToWCstring(sp.folderTitle()) );
			additional+= temp;
		}
		if ( !additional.IsEmpty() ) {
			title += _T(" (") + additional + _T(")");
		}

		SetDlgItemText(IDC_MENUITEMTITLEEDIT, title);
	}
}
Example #17
0
bool CBrowseRefsDlg::PickRefForCombo(CComboBoxEx* pComboBox, int pickRef_Kind)
{
	CString origRef;
	pComboBox->GetLBText(pComboBox->GetCurSel(), origRef);
	CString resultRef = PickRef(false,origRef,pickRef_Kind);
	if(resultRef.IsEmpty())
		return false;
	if(wcsncmp(resultRef,L"refs/",5)==0)
		resultRef = resultRef.Mid(5);
//	if(wcsncmp(resultRef,L"heads/",6)==0)
//		resultRef = resultRef.Mid(6);

	//Find closest match of choice in combobox
	int ixFound = -1;
	int matchLength = 0;
	CString comboRefName;
	for(int i = 0; i < pComboBox->GetCount(); ++i)
	{
		pComboBox->GetLBText(i, comboRefName);
		if(comboRefName.Find(L'/') < 0 && !comboRefName.IsEmpty())
			comboRefName.Insert(0,L"heads/"); // If combo contains single level ref name, it is usualy from 'heads/'
		if(matchLength < comboRefName.GetLength() && resultRef.Right(comboRefName.GetLength()) == comboRefName)
		{
			matchLength = comboRefName.GetLength();
			ixFound = i;
		}
	}
	if(ixFound >= 0)
		pComboBox->SetCurSel(ixFound);
	else
		ASSERT(FALSE);//No match found. So either pickRef_Kind is wrong or the combobox does not contain the ref specified in the picker (which it should unless the repo has changed before creating the CBrowseRef dialog)

	return true;
}
Example #18
0
void CPullFetchDlg::OnCbnSelchangeRemote()
{
	CString remote = m_Remote.GetString();
	if (remote.IsEmpty() || remote == CString(MAKEINTRESOURCE(IDS_PROC_PUSHFETCH_ALLREMOTES)))
	{
		GetDlgItem(IDC_STATIC_TAGOPT)->SetWindowText(_T(""));
		GetDlgItem(IDC_STATIC_PRUNE)->SetWindowText(_T(""));
		return;
	}

	CString key;
	key.Format(_T("remote.%s.tagopt"), (LPCTSTR)remote);
	CString tagopt = g_Git.GetConfigValue(key);
	if (tagopt == "--no-tags")
		tagopt.LoadString(IDS_NONE);
	else if (tagopt == "--tags")
		tagopt.LoadString(IDS_ALL);
	else
		tagopt.LoadString(IDS_FETCH_REACHABLE);
	CString value;
	value.Format(_T("%s: %s"), (LPCTSTR)CString(MAKEINTRESOURCE(IDS_DEFAULT)), (LPCTSTR)tagopt);
	GetDlgItem(IDC_STATIC_TAGOPT)->SetWindowText(value);

	key.Format(_T("remote.%s.prune"), (LPCTSTR)remote);
	CString prune = g_Git.GetConfigValue(key);
	if (prune.IsEmpty())
		prune = g_Git.GetConfigValue(_T("fetch.prune"));
	if (!prune.IsEmpty())
	{
		value.Format(_T("%s: %s"), (LPCTSTR)CString(MAKEINTRESOURCE(IDS_DEFAULT)), (LPCTSTR)prune);
		GetDlgItem(IDC_STATIC_PRUNE)->SetWindowText(value);
	}
	else
		GetDlgItem(IDC_STATIC_PRUNE)->SetWindowText(_T(""));
}
Example #19
0
void CKademliaWnd::UpdateControlsState()
{
	CString strLabel;
	if (Kademlia::CKademlia::IsConnected())
		strLabel = GetResString(IDS_MAIN_BTN_DISCONNECT);
	else if (Kademlia::CKademlia::IsRunning())
		strLabel = GetResString(IDS_MAIN_BTN_CANCEL);
	else
		strLabel = GetResString(IDS_MAIN_BTN_CONNECT);
	strLabel.Remove(_T('&'));
	GetDlgItem(IDC_KADCONNECT)->SetWindowText(strLabel);

	CString strBootstrapIP;
	GetDlgItemText(IDC_BOOTSTRAPIP, strBootstrapIP);
	CString strBootstrapPort;
	GetDlgItemText(IDC_BOOTSTRAPPORT, strBootstrapPort);
	CString strBootstrapUrl;
	GetDlgItemText(IDC_BOOTSTRAPURL, strBootstrapUrl);

	GetDlgItem(IDC_BOOTSTRAPBUTTON)->EnableWindow(
		!Kademlia::CKademlia::IsConnected()
		&& (  (IsDlgButtonChecked(IDC_RADIP)>0 && !strBootstrapIP.IsEmpty()
				&& (strBootstrapIP.Find(_T(':')) != -1 || !strBootstrapPort.IsEmpty()))
		    || IsDlgButtonChecked(IDC_RADCLIENTS) != 0
			|| (IsDlgButtonChecked(IDC_RADNODESURL) != 0 && !strBootstrapUrl.IsEmpty() ))
			);
}
Example #20
0
CString CHistoryCombo::LoadHistory(LPCTSTR lpszSection, LPCTSTR lpszKeyPrefix)
{
    if (lpszSection == NULL || lpszKeyPrefix == NULL || *lpszSection == '\0')
        return L"";

    m_sSection = lpszSection;
    m_sKeyPrefix = lpszKeyPrefix;

    int n = 0;
    CString sText;
    do
    {
        //keys are of form <lpszKeyPrefix><entrynumber>
        CString sKey;
        sKey.Format(L"%s\\%s%d", (LPCTSTR)m_sSection, (LPCTSTR)m_sKeyPrefix, n++);
        sText = CRegString(sKey);
        if (!sText.IsEmpty())
            AddString(sText);
    } while (!sText.IsEmpty() && n < m_nMaxHistoryItems);

    SetCurSel(-1);

    ModifyStyleEx(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE, 0);

    // need to resize the control for correct display
    CRect rect;
    GetWindowRect(rect);
    GetParent()->ScreenToClient(rect);
    MoveWindow(rect.left, rect.top, rect.Width(), 100);

    return sText;
}
Example #21
0
// Check the registry to see if we have recorded the
// column widths lastused for the p4Object pane's list view.
void CP4ListBrowse::RestoreSavedWidths(int *width, int numcols)
{
    CRegKeyEx key;

    CString theKey = sRegKey + m_SubKey;
    if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, theKey, KEY_READ))
    {
        CString result = key.QueryValueString(sRegValue_ColumnWidths);
        CString sortCols = key.QueryValueString(sRegValue_SortColumns);
        if(!result.IsEmpty())
        {
            //		things can go wrong with the registry setting of the
            //		widths. Use the defaults if the entry is all zeroes.
            //
            if ( result != _T("0,0,0,0,0,0,0,0,0,0") )
                for(int i=0; i< numcols; i++)
                    width[i]= GetPositiveNumber(result);
        }
        if(!sortCols.IsEmpty())
        {
            for(int i=0; i< MAX_SORT_COLUMNS; i++)
            {
                m_SortColumns[i]= GetANumber(sortCols);
                if(!i && !m_SortColumns[i])
                    m_SortColumns[i] = 1;
            }
            m_LastSortColumn= abs(m_SortColumns[0]) - 1; // SortColumns are signed & 1-relative
            m_SortAscending = m_SortColumns[0] >= 0 ? TRUE : FALSE;
        }
    }
}
Example #22
0
int CParseString::ParseRev2(CString& item1, CString& item2, CString separ)
{
    InitRev(separ);
    GetPrevWord(item2);
    GetHead(item1);
    return (!item1.IsEmpty()) + (!item2.IsEmpty());
}
Example #23
0
int CParseString::Parse2(CString& item1, CString& item2, CString separ)
{
    Init(separ);
    GetNextWord(item1);
    GetTail(item2);
    return (!item1.IsEmpty()) + (!item2.IsEmpty());
}
void CCeWatchDlg::OnPasteItems ()
{
    if (m_bHistoryFocus)
    {
        m_HistoryListCtrl.Paste();
        return;
    }

    HGLOBAL memoryHandle;
    LPCTSTR memoryBlock;
    CString strNames;

    if (!::OpenClipboard (m_hWnd))
        return;

    memoryHandle = ::GetClipboardData (CF_TEXT);
    if (memoryHandle == NULL)
    {
        ::CloseClipboard ();
        return;
    };

    memoryBlock = (LPCTSTR)::GlobalLock (memoryHandle);
    if (memoryBlock == NULL)
    {
        ::CloseClipboard ();
        return;
    };

    strNames = memoryBlock;

    ::GlobalUnlock (memoryHandle);
    ::CloseClipboard ();

    while (!strNames.IsEmpty ())
    {
        int iPos;
        CString strName;
        CCeWatchElement *pInsertedElement=NULL;

        iPos = strNames.Find (_T ('\n'));
        if (iPos == -1)
        {
            strName = strNames;
            strNames = _T ("");
        }
        else
        {
            strName = strNames.Left (iPos);
            strNames = strNames.Mid (iPos + 1);
        };

        strName.TrimLeft ();
        strName.TrimRight ();

        if (!strName.IsEmpty ())
            m_VarList.InsertExpressionWithStructInfo(strName, pInsertedElement);
    };
}
Example #25
0
int CTrivia::ContainsStringExact(CString strLine, CString strSubString, BOOL bCase, BOOL bExactMatch)
{
	
    if(strLine.IsEmpty()) return FALSE;
	if(strSubString.IsEmpty()) return TRUE;
	int nReturn = -1;
	BOOL bFound = FALSE;
	if(!bCase){

		strLine.MakeLower();
		strSubString.MakeLower();
	}
	if(bExactMatch){

		if(strLine == strSubString){

			return 0;
		}
		else{

			return -1;
		}
	}

	CString strSearch = strSubString;
	strSearch.Remove('*');
	
	int nIndex = -1;
	BOOL bFront, bEnd;

	if((nIndex = strLine.Find(strSearch, 0)) >= 0){

		//Check if there is a space or ( at front and end of searched item
		bEnd = (nIndex + strSearch.GetLength() >= strLine.GetLength() ? TRUE : strLine.GetAt(strSearch.GetLength() + nIndex) == ' ');
		bFront = (nIndex > 0 ? strLine.GetAt(nIndex-1) == ' ' : TRUE);

		if((strSubString.GetAt(0) == '*') && (strSubString.GetAt(strSubString.GetLength()-1) == '*')){

			bFound = TRUE;
		}
		else if((strSubString.GetAt(0) == '*') && (strSubString.GetAt(strSubString.GetLength()-1) != '*')){

			bFound = bEnd;
		}
		else if((strSubString.GetAt(0) != '*') && (strSubString.GetAt(strSubString.GetLength()-1) == '*')){

			bFound = bFront;
		}
		else{

			bFound = bFront && bEnd;
		}
		if(bFound){
			
			nReturn = nIndex;
		}
	}
	return nReturn;
}
Example #26
0
VOID CommandLine::AppendSwitchArg(const CString & strSwitchName, const CString & strSwitchValue)
{
	ATLASSERT(!strSwitchName.IsEmpty());
	ATLASSERT(!strSwitchValue.IsEmpty());

	m_mapSwitchValues[strSwitchName] = strSwitchValue;
	m_bCmdLineChange = TRUE;
}
void CinematicTrigger::SendReplyMessage(int nReply)
{
	if (m_nCurMessage >= MAX_CT_MESSAGES) return;

    ILTCommon* pCommon = g_pLTServer->Common();
	if (!pCommon) return;

	CString	csTarget;
	CString csMsg;
	ConParse parse;

    char* pMsg = g_pLTServer->GetStringData(m_hstrRepliesTarget[m_nCurMessage]);
	if(!pMsg) return;

	parse.Init(pMsg);

    int i;
    for(i=0;i<nReply;i++)
	{
		if(pCommon->Parse(&parse) == LT_OK)
		{
			if(i == (nReply - 1))
			{
				if (parse.m_nArgs > 0 && parse.m_Args[0])
				{
					csTarget = parse.m_Args[0];
				}
				break;
			}
		}
	}

    pMsg = g_pLTServer->GetStringData(m_hstrRepliesMsg[m_nCurMessage]);
	if(!pMsg) return;

	parse.Init(pMsg);

	for(i=0;i<nReply;i++)
	{
		if(pCommon->Parse(&parse) == LT_OK)
		{
			if(i == (nReply - 1))
			{
				if (parse.m_nArgs > 0 && parse.m_Args[0])
				{
					csMsg = parse.m_Args[0];
				}
				break;
			}
		}
	}

	if (!csTarget.IsEmpty() && !csMsg.IsEmpty())
	{
		SendTriggerMsgToObjects(this, (char *)(LPCSTR)csTarget, (char *)(LPCSTR)csMsg);
	}
}
Example #28
0
// 添加行
int CDuiGridCtrl::InsertRow(int nRow, CString strId, int nImageIndex, Color clrText, CString strImage,
							 int nRightImageIndex, CString strRightImage, int nCheck)
{
	GridRowInfo rowInfo;
	rowInfo.strId = strId;
	rowInfo.nCheck = nCheck;
	rowInfo.nImageIndex = nImageIndex;
	rowInfo.sizeImage.SetSize(0, 0);
	rowInfo.nRightImageIndex = nRightImageIndex;
	rowInfo.sizeRightImage.SetSize(0, 0);
	rowInfo.bRowColor = FALSE;
	rowInfo.clrText = clrText;
	rowInfo.nHoverItem = -1;
	if(clrText.GetValue() != Color(0, 0, 0, 0).GetValue())
	{
		rowInfo.bRowColor = TRUE;
	}

	// 左边图片
	if(!strImage.IsEmpty())
	{
		// 使用行数据指定的图片
		if(DuiSystem::Instance()->LoadImageFile(strImage, m_bImageUseECM, rowInfo.pImage))
		{
			rowInfo.sizeImage.SetSize(rowInfo.pImage->GetWidth() / 1, rowInfo.pImage->GetHeight());
		}
	}else
	{
		// 使用索引图片
		rowInfo.pImage = NULL;
		if((rowInfo.nImageIndex != -1) && (m_pImage != NULL) && (m_pImage->GetLastStatus() == Ok))
		{
			rowInfo.sizeImage.SetSize(m_sizeImage.cx, m_sizeImage.cy);
		}
	}

	// 右边图片
	if(!strRightImage.IsEmpty())
	{
		// 使用行数据指定的图片
		if(DuiSystem::Instance()->LoadImageFile(strRightImage, m_bImageUseECM, rowInfo.pRightImage))
		{
			rowInfo.sizeRightImage.SetSize(rowInfo.pRightImage->GetWidth() / 1, rowInfo.pRightImage->GetHeight());
		}
	}else
	{
		// 使用索引图片
		rowInfo.pRightImage = NULL;
		if((rowInfo.nRightImageIndex != -1) && (m_pImage != NULL) && (m_pImage->GetLastStatus() == Ok))
		{
			rowInfo.sizeRightImage.SetSize(m_sizeImage.cx, m_sizeImage.cy);
		}
	}

	return InsertRow(nRow, rowInfo);
}
Example #29
0
void CGitRefCompareList::OnContextMenuList(CWnd * /*pWnd*/, CPoint point)
{
	int selIndex = GetSelectionMark();
	if (selIndex < 0 || (size_t)selIndex >= m_RefList.size())
		return;

	CString refName = m_RefList[selIndex].fullName;
	CString oldHash = m_RefList[selIndex].oldHash;
	CString newHash = m_RefList[selIndex].newHash;
	CIconMenu popup;
	popup.CreatePopupMenu();
	CString logStr;
	if (!oldHash.IsEmpty())
	{
		logStr.Format(IDS_SHOWLOG_OF, (LPCTSTR)oldHash);
		popup.AppendMenuIcon(IDGITRCL_OLDLOG, logStr, IDI_LOG);
	}
	if (!newHash.IsEmpty() && oldHash != newHash)
	{
		logStr.Format(IDS_SHOWLOG_OF, (LPCTSTR)newHash);
		popup.AppendMenuIcon(IDGITRCL_NEWLOG, logStr, IDI_LOG);
	}
	if (!oldHash.IsEmpty() && !newHash.IsEmpty() && oldHash != newHash)
		popup.AppendMenuIcon(IDGITRCL_COMPARE, IDS_LOG_POPUP_COMPAREWITHPREVIOUS, IDI_DIFF);
	popup.AppendMenuIcon(IDGITRCL_REFLOG, IDS_MENUREFLOG, IDI_LOG);

	int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this, 0);
	AfxGetApp()->DoWaitCursor(1);
	switch (cmd)
	{
		case IDGITRCL_OLDLOG:
		case IDGITRCL_NEWLOG:
		{
			CString sCmd;
			sCmd.Format(_T("/command:log /path:\"%s\" /endrev:\"%s\""), (LPCTSTR)g_Git.m_CurrentDir, cmd == IDGITRCL_OLDLOG ? (LPCTSTR)oldHash : (LPCTSTR)newHash);
			CAppUtils::RunTortoiseGitProc(sCmd);
			break;
		}
		case IDGITRCL_COMPARE:
		{
			CString sCmd;
			sCmd.Format(_T("/command:showcompare /path:\"%s\" /revision1:\"%s\" /revision2:\"%s\""), (LPCTSTR)g_Git.m_CurrentDir, (LPCTSTR)oldHash, (LPCTSTR)newHash);
			CAppUtils::RunTortoiseGitProc(sCmd);
			break;
		}
		case IDGITRCL_REFLOG:
		{
			CString sCmd;
			sCmd.Format(_T("/command:reflog /path:\"%s\" /ref:\"%s\""), (LPCTSTR)g_Git.m_CurrentDir, (LPCTSTR)refName);
			CAppUtils::RunTortoiseGitProc(sCmd);
			break;
		}
	}
	AfxGetApp()->DoWaitCursor(-1);
}
void COutputDialog::UpdateFilterGrid()
{

	CWnd* pList = GetDlgItem(IDC_LIST_FILTER);
	CWnd* pFilterOpt = GetDlgItem(IDC_EDIT_FILTER_OPTION_STRING);
	CWnd* pFilterStatic = GetDlgItem(IDC_STATIC_FILTER_1);
	if(NULL == pList || NULL == pFilterOpt || NULL == pFilterStatic) return;

	// 등록 리스트 가져와서
	ATPLUGIN_ARGUMENT_ARRAY aPluginArgs;
	(MAINAPP)->m_cMultiPlugin.GetPluginArgs(aPluginArgs);

	// 리스트뷰 전체 삭제
	ListView_DeleteAllItems(pList->m_hWnd);

	// 재등록
	TCHAR szBuffer[1024];
	LVITEM lvItem;
	ZeroMemory(&lvItem, sizeof(lvItem));
	lvItem.mask=LVIF_TEXT;
	lvItem.pszText=szBuffer;
	CString strFilterOpt = _T("");
	for(size_t i=0; i< aPluginArgs.size(); i++)
	{
		lvItem.iItem=i;
		lvItem.iSubItem=0;
		lstrcpyn(szBuffer, aPluginArgs[i].strPluginName.c_str(), 1024);
		ListView_InsertItem(pList->m_hWnd, &lvItem);

		lstrcpyn(szBuffer, aPluginArgs[i].strOption.c_str(), 4096);
		ListView_SetItemText(pList->m_hWnd, i, 1, szBuffer);

		if(strFilterOpt.IsEmpty())
		{
			strFilterOpt = CString(_T("/f:")) + aPluginArgs[i].strPluginName.c_str()
						 + _T("{") + aPluginArgs[i].strOption.c_str() + _T("}");
		}
		else
		{
			strFilterOpt += CString(_T(",")) + aPluginArgs[i].strPluginName.c_str()
				+ _T("{") + aPluginArgs[i].strOption.c_str() + _T("}");
		}
	}

	::EnableWindow(pList->m_hWnd, TRUE);

	pFilterOpt->SetWindowText(strFilterOpt);
	BOOL bEnable = strFilterOpt.IsEmpty() ? FALSE : TRUE;
	::EnableWindow(pFilterOpt->m_hWnd, bEnable);
	::EnableWindow(pFilterStatic->m_hWnd, bEnable);		

	OnNMClickListFilter(NULL, NULL);

	return;
}