LRESULT CLayerOptionsDlg::OnChangeColorList(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { int index = SendDlgItemMessage(IDC_LAYER_COLORLIST, CB_GETCURSEL, 0, 0); if (index >= 0) { if (index < gNumLayerColors) { m_color = gLayerColors[index].color; ::InvalidateRect(GetDlgItem(IDC_LAYER_COLOR), NULL, TRUE); } else { CColorDialog dlg(m_color, CC_FULLOPEN | CC_RGBINIT); if (dlg.DoModal() == IDOK) { m_color = dlg.GetColor(); ::InvalidateRect(GetDlgItem(IDC_LAYER_COLOR), NULL, TRUE); SetColorIndex(); } } } return 0; }
void GPXRoute::Load(kGUIXMLItem *xml) { int i,nc; GPXRouteEntry *fe; kGUIXMLItem *flxml; flxml=xml->Locate("draw"); if(flxml) SetDraw(flxml->GetValueInt()?true:false); flxml=xml->Locate("color"); /* convert string to color index */ if(flxml) SetColorIndex(GPX::GetTableColorIndex(flxml->GetValueString())); nc=xml->GetNumChildren(); for(i=0;i<nc;++i) { flxml=xml->GetChild(i); if(!strcmp(flxml->GetName(),"wptname")) { fe=new GPXRouteEntry(); m_entries.SetEntry(m_numentries++,fe); fe->m_wptname.SetString(flxml->GetValue()); } } }
void GPXRoute::Save(kGUITableObj *table,kGUITickBoxObj *draw,kGUIComboBoxObj *color) { unsigned int e; unsigned int nr; kGUIObj *obj; GPXRow *row; GPXRouteEntry *re; /* delete old entries if there are any? */ for(e=0;e<m_numentries;++e) delete m_entries.GetEntry(e); SetDraw(draw->GetSelected()); SetColorIndex(color->GetSelection()); nr=table->GetNumChildren(0); /* number of valid entries */ m_numentries=nr; m_entries.Alloc(nr); for(e=0;e<nr;++e) { obj=table->GetChild(e); row=static_cast<GPXRow *>(obj); re=new GPXRouteEntry(); re->m_wptname.SetString(row->GetWptName()); m_entries.SetEntry(e,re); } }
LRESULT CNavigatorOptionsDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { HWND hWndList = GetDlgItem(IDC_NAV_COLORLIST); for (int i = 0; i < NCOLORS; i++) { ::SendMessage(hWndList, CB_ADDSTRING, 0, (LPARAM)Colors[i].name); } SetColorIndex(); return 1; // Let the system set the focus }
LRESULT CLayerOptionsDlg::OnColor(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { CColorDialog dlg(m_color, CC_FULLOPEN | CC_RGBINIT); if (dlg.DoModal() == IDOK) { m_color = dlg.GetColor(); ::InvalidateRect(GetDlgItem(IDC_LAYER_COLOR), NULL, TRUE); SetColorIndex(); } return 0; }
LRESULT CLayerOptionsDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (m_isLayer == 2 /*BST_INDETERMINATE*/) { CWindow wnd(GetDlgItem(IDC_LAYER_ISLAYER)); wnd.ModifyStyle(0, BS_AUTO3STATE); } CheckDlgButton(IDC_LAYER_ISLAYER, m_isLayer); HWND hWndList = GetDlgItem(IDC_LAYER_COLORLIST); for (int i = 0; i < gNumLayerColors; i++) { ::SendMessage(hWndList, CB_ADDSTRING, 0, (LPARAM)gLayerColors[i].name); } ::SendMessage(hWndList, CB_ADDSTRING, 0, (LPARAM)_T("Other")); SetColorIndex(); return 1; // Let the system set the focus }