void anthy_mark_borders(struct splitter_context *sc, int from, int to) { struct lattice_info* info = alloc_lattice_info(sc, to); trans_info_array = anthy_file_dic_get_section("trans_info"); build_graph(info, from, to); choose_path(info, to); release_lattice_info(info); }
BOOL EditClientsDialog::event_command(int control_id, int notify_code) { if(control_id == IDCANCEL) { end(0); return TRUE; } else if(control_id == IDOK) { end(1); return TRUE; } else if(notify_code == LBN_SELCHANGE && control_id == ID_LB_CLIENTS) selection_changed(); else if(notify_code == BN_CLICKED) switch(control_id) { case ID_BT_DELETECLIENT: { int i = m_list_box->get_current_selection(); if(i >= 0 && static_cast<size_t>(i) < m_clients.size()) { m_clients.erase(m_clients.begin() + i); m_list_box->delete_string(i); // There is no longer a selection EnableWindow(GetDlgItem(m_hwnd, ID_BT_DELETECLIENT), FALSE); EnableWindow(GetDlgItem(m_hwnd, ID_BT_SAVECLIENT), FALSE); } return TRUE; } case ID_BT_SAVECLIENT: { int i = m_list_box->get_current_selection(); if(i >= 0 && static_cast<size_t>(i) < m_clients.size()) { EditBoxWrapper name_box(m_hwnd, ID_EB_CLIENTNAME); string name; name_box.get_text(name); m_clients[i].m_name = name; m_clients[i].m_path = m_path; // Name may change, so update the list box m_list_box->set_string(i, name.c_str()); // set_string() deselects, so select it again. m_list_box->set_current_selection(i); } return TRUE; } case ID_BT_ADDCLIENT: { EditBoxWrapper name_box(m_hwnd, ID_EB_CLIENTNAME); string name; name_box.get_text(name); if(name.length() == 0 || m_path.length() == 0) MessageBox(m_hwnd, "You must enter a name and select a path", "Error", MB_OK | MB_ICONINFORMATION); else { m_clients.push_back(ClientItem(name.c_str(), m_path.c_str())); int i = m_list_box->add_string(name.c_str()); if(i != -1) { m_list_box->set_current_selection(i); selection_changed(); } } return TRUE; } case ID_BT_CHOOSEPATH: choose_path(); return TRUE; } return FALSE; }