/*------------------------------------------------------------------------- * アイテムを作成する * ---------------------------------------------------------------------------*/ private ListViewItem create_item(SeaRoutes.Voyage i, bool is_draw_show_flag) { GvoWorldInfo.Info info1 = m_db.World.FindInfo_WithoutSea(transform.ToPoint(i.MapPoint1st)); string _1st_name = (info1 != null)? info1.Name: ""; GvoWorldInfo.Info info2 = m_db.World.FindInfo_WithoutSea(transform.ToPoint(i.MapPointLast)); string last_name = (info2 != null)? info2.Name: ""; string show_str = (i.IsEnableDraw)? "表示": "非表示"; if (!is_draw_show_flag) { show_str = "---"; } ListViewItem item = new ListViewItem(show_str, 0); item.UseItemStyleForSubItems = false; item.Tag = i; // item.ToolTipText = i.TooltipString; item.SubItems.Add(_1st_name + "(" + i.GamePoint1stStr + ")"); item.SubItems.Add(last_name + "(" + i.GamePointLastString + ")"); item.SubItems.Add(i.MaxDaysString); item.SubItems.Add(i.DateTimeString); if (is_draw_show_flag) { item.SubItems[0].ForeColor = (i.IsEnableDraw)? Color.Blue: Color.Red; } return(item); }
/*------------------------------------------------------------------------- * 項目の設定 * ---------------------------------------------------------------------------*/ private void set_item(list_view_db view, RetrieveVirtualItemEventArgs e) { SeaRoutes.Voyage ii = get_route(view.db, e.ItemIndex); if (ii == null) { ListViewItem item = new ListViewItem("---", 0); item.SubItems.Add("---"); item.SubItems.Add("---"); item.SubItems.Add("---"); item.SubItems.Add("---"); e.Item = item; } else { e.Item = create_item(ii, view != m_view3); } }
/*------------------------------------------------------------------------- * 航路一覧が選択された * sub * ---------------------------------------------------------------------------*/ private void selected_index_changed(list_view_db view) { if (m_disable_update_select) { return; } // 選択状態をリセットする m_db.SeaRoute.ResetSelectFlag(); if (view.view.SelectedIndices.Count < 1) { return; } // 最初の項目をセンタリングする SeaRoutes.Voyage i = get_route(view.db, view.view.SelectedIndices[0]); if (i != null) { if (i.GamePoint1st.X < 0) { return; } if (i.GamePoint1st.Y < 0) { return; } m_lib.setting.centering_gpos = i.GamePoint1st; m_lib.setting.req_centering_gpos.Request(); } // 選択状態にする foreach (int index in view.view.SelectedIndices) { SeaRoutes.Voyage ii = get_route(view.db, index); if (ii == null) { continue; } ii.IsSelected = true; } }
/*------------------------------------------------------------------------- * 表示、非表示 * sub * ---------------------------------------------------------------------------*/ private void set_draw_flag(list_view_db view, bool is_show) { // 選択状態をリセットする m_db.SeaRoute.ResetSelectFlag(); if (view.view.SelectedIndices.Count < 1) { return; } m_disable_update_select = true; foreach (int index in view.view.SelectedIndices) { SeaRoutes.Voyage ii = get_route(view.db, index); if (ii == null) { continue; } ii.IsEnableDraw = is_show; } m_disable_update_select = false; }
/*------------------------------------------------------------------------- * 選択されている航路図リストを得る * リストがないときはnullを返す * ---------------------------------------------------------------------------*/ private List <SeaRoutes.Voyage> get_selected_routes_list(list_view_db view) { if (view.view.SelectedIndices.Count < 1) { return(null); } List <SeaRoutes.Voyage> list = new List <SeaRoutes.Voyage>(); foreach (int index in view.view.SelectedIndices) { SeaRoutes.Voyage ii = get_route(view.db, index); if (ii == null) { continue; } list.Add(ii); } if (list.Count <= 0) { return(null); } return(list); }