void LayerGroupsCreate::OnNewGroup() { InputDlg input; input.m_prompt = "Name of Layer Group"; if (input.DoModal() != IDOK) return; if (doc->FindLayerGroup(input.m_input)) { ErrorMessage(input.m_input, "Group Name alredy exists!"); return; } LayerGroupStruct *group = doc->AddLayerGroup(input.m_input); int index = InsertItemIntoList(&m_list, group->name, TRUE); GroupOrLayer *d = new GroupOrLayer; d->IsAGroup = TRUE; d->group = group; m_list.SetItemData(index, (LPARAM)d); HTREEITEM root = m_tree.InsertItem(group->name, 1, 1); d = new GroupOrLayer; d->IsAGroup = TRUE; d->group = group; m_tree.SetItemData(root, (DWORD)d); }
void FieldManagerDlg::OnBnClickedAddBtn() { InputDlg dlg; if( dlg.DoModal() != IDOK ) return; // 注意m_lastSel的更新问题 if( m_fieldListBox.GetCount() == 0 ) setLastSelIndex( 0 ); if( !isValidField( dlg.m_str ) ) { CString msg; msg.Format( _T( "非法的字段\n[%s]" ), dlg.m_str ); MessageBox( msg ); return; } if( isFieldExistInListBox( dlg.m_str ) ) { CString msg; msg.Format( _T( "字段[%s]已存在!" ), dlg.m_str ); MessageBox( msg ); return; } // 添加字段到listbox中 int index = m_fieldListBox.AddString( dlg.m_str ); if( index != LB_ERR ) { m_fieldListBox.SetCurSel( index ); // ***创建新的字段信息,并记录*** m_infoes.append( new FieldInfo() ); // 切换selection, 保存上次selection所在位置的字段信息 updateFieldInfo(); } }
void NamedViewDlg::OnSave() { InputDlg dlg; dlg.m_prompt = "Enter Name for this View"; if (dlg.DoModal() != IDOK) return; CString viewName = dlg.m_input; CNamedView *view = ((CCEtoODBView*)activeView)->saveView(viewName); m_listLB.SetItemDataPtr(m_listLB.AddString(viewName), view); //CNamedView *view = new CNamedView; //view->name = dlg.m_input; //m_listLB.SetItemDataPtr(m_listLB.AddString(view->name), view); //view->scaleNum = ((CCEtoODBView*)activeView)->ScaleNum; //view->scaleDenom = ((CCEtoODBView*)activeView)->ScaleDenom; //view->scrollX = ((CCEtoODBView*)activeView)->GetXPos(); //view->scrollY = ((CCEtoODBView*)activeView)->GetYPos(); //// store layers here //if ((view->layerdata = (CViewLayerData *)calloc(doc->getMaxLayerIndex(), sizeof(CViewLayerData))) != NULL) //{ // view->layercnt = doc->getMaxLayerIndex(); // for (int i=0;i<doc->getMaxLayerIndex();i++) // { // if (doc->LayerArray[i] == NULL) continue; // view->layerdata[i].color = doc->LayerArray[i]->color; // view->layerdata[i].show = doc->LayerArray[i]->visible; // } //} //doc->NamedViewList.AddTail(view); }
void CLayerTypeDlg::OnBnClickedRename() { int curSel = m_layerSets.GetCurSel(); // Not an actual selection if (curSel < 0) return; // Can't change first three: Standard, Top, and Bottom. if (curSel < 3) { ErrorMessage("This colorset cannot be renamed!", "Color Set", MB_OK); return; } // Proceed with change. CString oldName; m_layerSets.GetLBText(curSel, oldName); InputDlg dlg; dlg.m_prompt = "Enter new color set name."; dlg.m_input = oldName; if (dlg.DoModal() == IDOK) { pDoc->CustomLayersetNames[curSel - MAX_STANDARD_COLORSETS] = dlg.m_input; m_layerSets.InsertString(curSel, dlg.m_input); m_layerSets.DeleteString(curSel+1); m_layerSets.SetCurSel(curSel); // Update grid column title with new name, if we can find the old name int colIndx = -1; if (m_layerTypeGrid.GetColFromName(oldName, &colIndx) == UG_SUCCESS) { m_layerTypeGrid.QuickSetText(colIndx, -1, dlg.m_input); m_layerTypeGrid.RedrawAll(); } } }