Пример #1
0
// CDBSchemaTableView 消息处理程序
void CDBSchemaTableView::OnGridColSelChanged(NMHDR *pNotifyStruct, LRESULT* pResult)
{
	CCellRange range = GridCol.GetSelectedCellRange();

	//TTRACE(TEXT("Row Select - %d\r\n"), range.GetMinRow());

	if(!range.IsValid() || range.GetMinRow() < GRIDHEADERROWCOUNT)
	{
		return;
	}

	CDBModule&		module = GetDocument()->GetDBModule();
	CDBRecordAuto	rec;
	GridColViewer.GetCurRecord(&rec); 


	tstring strRelayTblID = rec.GetField(CDBColumnInfoRecord::RelyTbl);
	int relyTblID = -1;
	if(!strRelayTblID.empty())
	{
		relyTblID = boost::lexical_cast<int>(rec.GetField(CDBColumnInfoRecord::RelyTbl));
	}

	TTRACE(TEXT("依赖表 : %d\r\n"), relyTblID);
	if( relyTblID >= 0)
	{
		GridCol_RelyColStyle.SetTable(&GetDocument()->GetDBModule().Tables()[relyTblID]->GetSchema());
	}
}
Пример #2
0
void CResiduePane::OnSelectionChanged(NMHDR* pNMHDR, LRESULT* pResult)
{;
	NM_GRIDVIEW * pnmgv = (NM_GRIDVIEW *)pNMHDR;
	if (pnmgv!=NULL && m_residueGridCtrl !=NULL && m_residueGridCtrl->GetSelectedCount() > 0 )
	{
		if ( pnmgv->iRow >= 0 && pnmgv->iColumn >= 0 )	
		{
			 CGridCellBase* grid = m_residueGridCtrl->GetCell(pnmgv->iRow,pnmgv->iColumn);
			if(grid==NULL)
				return;
			m_pProteinVistaRenderer->m_pLastPickObjectInst = (CProteinObjectInst*)grid->GetData();
		}else
		{
		
			CCellRange	range = m_residueGridCtrl->GetSelectedCellRange();
			int row = range.GetMinRow();
			int col = range.GetMinCol();

			if ( row >= 0 && col >= 0 )
			{
				m_pProteinVistaRenderer->m_pLastPickObjectInst = (CProteinObjectInst*)m_residueGridCtrl->GetCell(row,col)->GetData();
				//m_pProteinVistaRenderer->m_pLastPickObjectInst->
			}
		}
		m_bSelectionChanged = TRUE;
	}
}
Пример #3
0
void CDBSchemaTableView::OnGridTblSelChanged(NMHDR *pNotifyStruct, LRESULT* pResult)
{
	CCellRange range = GridTab.GetSelectedCellRange();
	if(range.IsValid() && range.GetMinRow() >= GRIDHEADERROWCOUNT)
	{
		ShowColumnsOfTable(range.GetMinRow() - GRIDHEADERROWCOUNT);
	}
}
Пример #4
0
void CCompareListDlg::OnGridDoubleClick(NMHDR *pNotifyStruct, LRESULT* /*pResult*/)
{
	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;

	if (pItem->iRow < grid_.GetFixedRowCount())
		return;                         // Don't do anything for header rows

	CCellRange sel = grid_.GetSelectedCellRange();

	if (!sel.IsValid() || sel.GetMinRow() != sel.GetMaxRow())
		return;                        // Don't do anything for multiple selected rows

	if (phev_ != GetView() || phev_->pcv_ == NULL)
		return;                        // Don't do anything if there is no compare view

	int row = sel.GetMinRow();
	int id = (int)grid_.GetItemData(row, COL_ORIG_TYPE);
	if (id != 0)
	{
		AvoidableTaskDialog(id);
		return;
	}

	FILE_ADDRESS addr, len = 0;     // bytes to select
	CString ss;
	char cType = 'E';

	bool sync_saved = phev_->AutoSyncCompare();
	phev_->SetAutoSyncCompare(false);                               // since we set selection in both view we don't want this

	// We need the type of the difference in order to set the length correctly for insertions deletions
	ss = (CString)grid_.GetItemText(row, COL_ORIG_TYPE);
	if (!ss.IsEmpty()) cType = ss[0];                               // First char of type string (E,R,I,D)

	// Get length of difference
	ss = (CString)grid_.GetItemText(row, COL_LEN_HEX);
	ss.Replace(" ", "");
	len = ::_strtoi64(ss, NULL, 16);

	// Get location in compare file and move the selection
	ss = (CString)grid_.GetItemText(row, COL_COMP_HEX);
	ss.Replace(" ", "");
	addr = ::_strtoi64(ss, NULL, 16);
	phev_->pcv_->MoveToAddress(addr, addr + (cType == 'I' ? 0 : len));  // I (insertion) is a deletion in the compare file

	ss = (CString)grid_.GetItemText(row, COL_ORIG_HEX);
	ss.Replace(" ", "");
	addr = ::_strtoi64(ss, NULL, 16);
	phev_->MoveToAddress(addr, addr + (cType == 'D' ? 0 : len));    // for D (deletion) len is zero

	phev_->SetAutoSyncCompare(sync_saved);                          // restore sync setting
}
Пример #5
0
void CBookmarkDlg::OnGoTo() 
{
	CCellRange sel = grid_.GetSelectedCellRange();
	ASSERT(sel.IsValid() && sel.GetMinRow() == sel.GetMaxRow());

	int row = sel.GetMinRow();
	int index = grid_.GetItemData(row, COL_NAME + grid_.GetFixedColumnCount());

	CBookmarkList *pbl = theApp.GetBookmarkList();
	pbl->GoTo(index);

//	// Close the dialog
//	CDialog::OnOK();
}
Пример #6
0
void CBookmarkDlg::OnGridDoubleClick(NMHDR *pNotifyStruct, LRESULT* /*pResult*/)
{
	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
	TRACE("Left button click on row %d, col %d\n", pItem->iRow, pItem->iColumn);

	if (pItem->iRow < grid_.GetFixedRowCount())
		return;                         // Don't do anything for header rows

	CString ss = (CString)grid_.GetItemText(pItem->iRow, pItem->iColumn);
	GetDlgItem(IDC_BOOKMARK_NAME)->SetWindowText(ss);

	CCellRange sel = grid_.GetSelectedCellRange();
	if (sel.IsValid() && sel.GetMinRow() == sel.GetMaxRow())
		OnGoTo();
}
Пример #7
0
LRESULT CBookmarkDlg::OnKickIdle(WPARAM, LPARAM lCount)
{
	ASSERT(GetDlgItem(IDOK) != NULL);
	ASSERT(GetDlgItem(IDC_BOOKMARK_NAME) != NULL);
	ASSERT(GetDlgItem(IDC_BOOKMARK_ADD) != NULL);
	ASSERT(GetDlgItem(IDC_GRID_BL) != NULL);
	ASSERT(GetDlgItem(IDC_BOOKMARK_GOTO) != NULL);
	ASSERT(GetDlgItem(IDC_BOOKMARK_REMOVE) != NULL);
	ASSERT(GetDlgItem(IDC_BOOKMARKS_VALIDATE) != NULL);
	ASSERT(GetDlgItem(IDC_NET_RETAIN) != NULL);
	ASSERT(GetDlgItem(IDC_BOOKMARKS_HELP) != NULL);

	if (m_first)
	{
		m_first = false;
	}

	// If there are no views or no associated files disallow adding of bookmarks
	CHexEditView *pview = GetView();
	if (pview == NULL || pview->GetDocument()->pfile1_ == NULL)
	{
		GetDlgItem(IDC_BOOKMARK_NAME)->SetWindowText("");
		GetDlgItem(IDC_BOOKMARK_NAME)->EnableWindow(FALSE);
	}
	else
	{
		GetDlgItem(IDC_BOOKMARK_NAME)->EnableWindow(TRUE);
	}

	CString ss;
	GetDlgItem(IDC_BOOKMARK_NAME)->GetWindowText(ss);
	GetDlgItem(IDC_BOOKMARK_ADD)->EnableWindow(!ss.IsEmpty());

	CCellRange sel = grid_.GetSelectedCellRange();
	GetDlgItem(IDC_BOOKMARK_GOTO)->EnableWindow(sel.IsValid() && sel.GetMinRow() == sel.GetMaxRow());
	GetDlgItem(IDC_BOOKMARK_REMOVE)->EnableWindow(sel.IsValid());

	// Display context help for ctrl set up in OnHelpInfo
	if (help_hwnd_ != (HWND)0)
	{
		theApp.HtmlHelpWmHelp(help_hwnd_, id_pairs);
		help_hwnd_ = (HWND)0;
	}
	return FALSE;
}
Пример #8
0
void CBookmarkDlg::OnRemove() 
{
	CBookmarkList *pbl = theApp.GetBookmarkList();
	int fcc = grid_.GetFixedColumnCount();
	range_set<int> tt;                  // the grid rows to be removed
	CCellRange sel = grid_.GetSelectedCellRange();
	ASSERT(sel.IsValid());

	// Mark all selected rows for deletion
	for (int row = sel.GetMinRow(); row <= sel.GetMaxRow(); ++row)
		if (grid_.IsCellSelected(row, fcc))
		{
			int index = grid_.GetItemData(row, fcc + COL_NAME);

#if 0 // moved to pbl->RemoveBookmark()
			// Check for open document and remove from the local (doc) bookmarks as well
			CDocument *pdoc;
			if (theApp.m_pDocTemplate->MatchDocType(pbl->file_[index], pdoc) == 
				CDocTemplate::yesAlreadyOpen)
			{
				((CHexEditDoc *)pdoc)->RemoveBookmark(index);
			}
#endif

			// Remove from the bookmark list
			pbl->Remove(index);

			// Mark for deletion from the grid (see below)
			tt.insert(row);
		}

	// Now remove the rows from the display starting from the end
	range_set<int>::const_iterator pp;

	// Remove elements from the grid starting at end so that we don't muck up the row order
	for (pp = tt.end(); pp != tt.begin(); )
		grid_.DeleteRow(*(--pp));
	grid_.Refresh();
}
Пример #9
0
void CSListView::SendRequestQuote( BOOL bForced )
{
	static int nLastStart = -1;
	static int nLastCount = -1;

	BOOL bQuoteTipSended = FALSE;

	BOOL bInTrade = CSPTime::InTradeTime(CSPTime::GetCurrentTime().GetTime(),900);
	CView * pView = AfxGetStaticDoc()->GetActiveView();
	if( bForced )
	{
		CStockContainer stocks;
		CStockInfo	info;
		if( AfxGetStockContainer().GetStockInfo( STKLIB_CODE_MAIN, &info ) )
			stocks.Add(info);
		if( AfxGetStockContainer().GetStockInfo( STKLIB_CODE_MAINSZN, &info ) )
			stocks.Add(info);
		if( stocks.GetSize() > 0 )
			AfxGetStkReceiver().RequestStockData( CStock::dataReport, stocks.GetData(), stocks.GetSize(), 0, 0 );
	}
	if( bForced || pView == this )
	{
		CCellRange cr = m_Grid.GetVisibleNonFixedCellRange();
		int nStart = cr.GetMinRow() - 1;
		int nCount = cr.GetMaxRow() - cr.GetMinRow() + 1;
		CStockContainer & container = AfxGetSListStockContainer();
		container.Lock();
		if( nStart >= 0 && nCount > 0 && container.GetSize() > 0 && (bInTrade || bForced || nLastStart != nStart || nLastCount != nCount) )
		{
			nLastStart = nStart;
			nLastCount = nCount;
			AfxGetStkReceiver().RequestStockData( CStock::dataReport, container.GetData()+nStart, min(nCount,container.GetSize()-nStart), 0, 0 );
			bQuoteTipSended = (0 == nStart && nCount >= 9);
		}
		container.UnLock();
	}

	if( bInTrade )
	{
		// 预警系统所需股票行情刷新
		CAlarmCondContainer & conds = AfxGetProfile().GetAlarmCondContainer();
		CStockContainer stocks;
		stocks.SetSize( 0, conds.GetSize() + 5 );
		for( int i=0; i<conds.GetSize(); i++ )
		{
			ALARMCOND cond = conds.GetAt(i);
			CStockInfo info;
			if( AfxGetStockContainer().GetStockInfo( cond.m_szCode, &info ) )
				stocks.Add( info );
		}
		CStockInfo infoMain, infoMainSzn;
		if( AfxGetStockContainer().GetStockInfo( STKLIB_CODE_MAIN, &infoMain )
			&& AfxGetStockContainer().GetStockInfo( STKLIB_CODE_MAINSZN, &infoMainSzn ) )
		{
			stocks.Add( infoMain );
			stocks.Add( infoMainSzn );
		}

		//  行情QuoteTip 需要行情数据
		if( !bQuoteTipSended )
		{
			CStockContainer & container = AfxGetSListStockContainer();
			container.Lock();
			for( int i=0; i<9 && i<container.GetSize(); i++ )
				stocks.Add( container.ElementAt(i) );
			container.UnLock();
		}

		if( stocks.GetSize() > 0 )
			AfxGetStkReceiver().RequestStockData( CStock::dataReport, stocks.GetData(), stocks.GetSize(), 0, 0 );
	}
}