// 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()); } }
void CDBSchemaTableView::OnGridTblSelChanged(NMHDR *pNotifyStruct, LRESULT* pResult) { CCellRange range = GridTab.GetSelectedCellRange(); if(range.IsValid() && range.GetMinRow() >= GRIDHEADERROWCOUNT) { ShowColumnsOfTable(range.GetMinRow() - GRIDHEADERROWCOUNT); } }
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; }
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 }
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(); }
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(); }
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(); }