/// <summary>セルの編集可能 /// </summary> /// <param name="sender">イベントの発生したオブジェクト</param> /// <param name="e">発生したイベント</param> private void BodyTable_CellEnter (object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 1) { if (Editable && e.RowIndex >= 0) { BodyTable.BeginEdit(true); } } }
/// <summary>ダブルクリック時の処理 /// </summary> /// <param name="sender">イベントの発生したオブジェクト</param> /// <param name="e">発生したイベント</param> private void BodyTable_CellMouseDoubleClick (object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex >= 0) { CMember member = this.Members[e.RowIndex]; switch (e.ColumnIndex) { case 0: // メンバーの修正 TimeTableManager.UI.FMemberDialog dialogM = new TimeTableManager.UI.FMemberDialog(); dialogM.Member = member; if (dialogM.ShowDialog(this.MainForm) == DialogResult.OK) { Refresh(); } break; case 1: // シフトの修正 PatternWrapper wrapper = Member2PatternWrapper[member]; CPattern pattern = wrapper.Pattern; if (pattern != null && !pattern.BuiltIn) { TimeTableManager.UI.FPatternDialog dialogP = new TimeTableManager.UI.FPatternDialog(); dialogP.Pattern = pattern; if (dialogP.ShowDialog(this.MainForm) == DialogResult.OK) { Refresh(); } } break; case 2: // コメントの追加・修正 if (Dates.Count == 1 && Editable) { BodyTable.CurrentCell = BodyTable[e.ColumnIndex, e.RowIndex]; BodyTable.BeginEdit(true); } break; } } else { } }
/// <summary>マウスダウン時ステータスを更新する /// </summary> /// <param name="sender">イベントの発生したオブジェクト</param> /// <param name="e">発生したイベント</param> private void BodyTable_CellMouseDown (object sender, DataGridViewCellMouseEventArgs e) { this.BarLabelStatus = EnumBarLabelStatus.None; CurrentRowIndex = e.RowIndex; if (this.TimeTable != null && CurrentRowIndex >= 0 && e.ColumnIndex == 2 && Editable) { CMember member = this.Members[CurrentRowIndex]; PatternWrapper wrapper = Member2PatternWrapper[member]; Rectangle CellBounds1 = BodyTable.GetCellDisplayRectangle(e.ColumnIndex, CurrentRowIndex, false); if (wrapper.Pattern != null && (!wrapper.Pattern.BuiltIn || wrapper.Pattern == CPattern.MULTI)) { Rectangle CellBounds2 = new Rectangle(new Point(0, 0), CellBounds1.Size); RectangleF rect = GetPattern2Rect(CellBounds2, wrapper); if (rect.Top < e.Y && e.Y < rect.Bottom) { if (rect.X - SplitBuffer < e.X && e.X < rect.X + SplitBuffer) { // 左端 this.BarLabelStatus = EnumBarLabelStatus.StartMoving; } else if (rect.Right - SplitBuffer < e.X && e.X < rect.Right + SplitBuffer) { // 右端 this.BarLabelStatus = EnumBarLabelStatus.EndMoving; } else if (rect.X < e.X && e.X < rect.Right) { // 内部 this.BarLabelStatus = EnumBarLabelStatus.AllMoving; } } } else { this.BarLabelStatus = EnumBarLabelStatus.Creating; } StartPoint = e.Location; MovingPoint = e.Location; } }
/// <summary>マウスカーソルをどうする? /// </summary> /// <param name="sender">イベントの発生したオブジェクト</param> /// <param name="e">発生したイベント</param> private void BodyTable_CellMouseMove (object sender, DataGridViewCellMouseEventArgs e) { if (this.TimeTable != null && e.RowIndex >= 0 && e.ColumnIndex == 2 && Editable) { CMember member = this.Members[e.RowIndex]; PatternWrapper wrapper = Member2PatternWrapper[member]; if (wrapper.Pattern != null && (!wrapper.Pattern.BuiltIn || wrapper.Pattern == CPattern.MULTI) && BarLabelStatus == EnumBarLabelStatus.None) { Rectangle CellBounds1 = BodyTable.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false); Rectangle CellBounds2 = new Rectangle(new Point(0, 0), CellBounds1.Size); RectangleF rect = GetPattern2Rect(CellBounds2, wrapper); if (rect.Top < e.Y && e.Y < rect.Bottom) { if (rect.X - SplitBuffer < e.X && e.X < rect.X + SplitBuffer) { // 左端 this.Cursor = Cursors.VSplit; } else if (rect.Right - SplitBuffer < e.X && e.X < rect.Right + SplitBuffer) { // 右端 this.Cursor = Cursors.VSplit; } else if (rect.X < e.X && e.X < rect.Right) { // 内部 this.Cursor = Cursors.Hand; } else { this.Cursor = Cursors.Default; } } } if (BarLabelStatus != EnumBarLabelStatus.None) { MovingPoint = e.Location; BodyTable.Refresh(); } } }
/// <summary>スケジュールが編集されたとき、表示範囲内なら表示を更新する /// </summary> /// <param name="sender">イベントの発生したオブジェクト</param> /// <param name="e">発生したイベント</param> void timeTable_OnScheduleEdited (object sender, EScheduleEditedEventArgs e) { if (StartDate <= e.Schedule.Date.Date && e.Schedule.Date.Date <= EndDate) { // SetUpMember2Pattern(e.Schedule.Member); // BodyTable.Refresh(); // Refresh(); } }
/// <summary>マウスがあがったとき、バーチャートを更新する /// </summary> /// <param name="sender">イベントの発生したオブジェクト</param> /// <param name="e">発生したイベント</param> private void BodyTable_CellMouseUp (object sender, DataGridViewCellMouseEventArgs e) { EnumBarLabelStatus CurrentStatus = BarLabelStatus; BarLabelStatus = EnumBarLabelStatus.None; if (CurrentStatus != EnumBarLabelStatus.None && e.RowIndex >= 0) { // Rectangle CellBounds1 = BodyTable.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false); // float MovingSpan0 = e.X - StartPoint.X; float MovingSpan1 = (e.X > StartPoint.X ? MovingSpan0 : -MovingSpan0); TimeSpan Span = GetXSpan2TimeSpan(CellBounds1.Width, StartPoint.X, e.X); if ((Span > TimeSpan.Zero ? Span.TotalHours > Half : Span.TotalHours < -Half)) { Rectangle CellBounds2 = new Rectangle(new Point(0, 0), CellBounds1.Size); CMember member = this.Members[e.RowIndex]; PatternWrapper wrapper; TimeSpan SpanStart = TimeSpan.Zero, SpanEnd = TimeSpan.Zero, SpanRest = TimeSpan.Zero; switch (CurrentStatus) { case EnumBarLabelStatus.StartMoving: wrapper = this.Member2PatternWrapper[member]; SpanStart = GetX2TimeSpan(CellBounds1.Width, e.X, TableStart); SpanEnd = wrapper.EndTime; SpanRest = wrapper.Pattern.Rest; break; case EnumBarLabelStatus.EndMoving: wrapper = this.Member2PatternWrapper[member]; SpanStart = wrapper.StartTime; SpanEnd = GetX2TimeSpan(CellBounds1.Width, e.X, TableStart); SpanRest = wrapper.Pattern.Rest; break; case EnumBarLabelStatus.AllMoving: wrapper = this.Member2PatternWrapper[member]; SpanStart = wrapper.StartTime + Span; SpanEnd = wrapper.EndTime + Span; SpanRest = wrapper.Pattern.Rest; break; case EnumBarLabelStatus.Creating: SpanStart = GetX2TimeSpan(CellBounds1.Width, StartPoint.X, TableStart); SpanEnd = GetX2TimeSpan(CellBounds1.Width, e.X, TableStart); break; } if (SpanStart > SpanEnd) { // スワップ TimeSpan Swap = SpanStart; SpanStart = SpanEnd; SpanEnd = Swap; } // CreatePattern(member, SpanStart, SpanEnd, TimeSpan.Zero); } } BodyTable.Refresh(); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); foreach (FileIndexBase fileIndex in _fileIndices) { fileIndex.Close(); } _fileIndices = null; _bodyConverter = null; _table = null; _bodyTable = null; _hues = null; }
/// <summary>コメントの追加・修正 /// </summary> /// <param name="sender">イベントの発生したオブジェクト</param> /// <param name="e">発生したイベント</param> private void TsmiComment_Click (object sender, EventArgs e) { if (Dates.Count == 1 && Editable) { //Member member = this.Members[this.CurrentRowIndex]; //DateTime date = dates[0]; //Schedule schedule = this.TimeTable[date][member]; //string comment = schedule.Notes; //comment = InputBox.Show(MainForm, comment); //if (!comment.Equals(schedule.Notes)) { // schedule.Notes = comment; // BodyTable.Refresh(); //} BodyTable.CurrentCell = BodyTable[2, CurrentRowIndex]; BodyTable.BeginEdit(true); } }
public override void Initialize() { base.Initialize(); InstallLocation install = Install; _fileIndices = new[] { install.CreateFileIndex("anim.idx", "anim.mul"), install.CreateFileIndex("anim2.idx", "anim2.mul"), install.CreateFileIndex("anim3.idx", "anim3.mul"), install.CreateFileIndex("anim4.idx", "anim4.mul"), install.CreateFileIndex("anim5.idx", "anim5.mul") }; _bodyTable = new BodyTable(install.GetPath("body.def")); _bodyConverter = new BodyConverter(install.GetPath("bodyconv.def")); _hues = new Hues(install); }
/// <summary>自動設定された /// </summary> /// <param name="sender">イベントの発生したオブジェクト</param> /// <param name="e">発生したイベント</param> void mainForm_OnTimeTableAutoEdited (object sender, TimeTableManager.UI.TimeTableAutoEditedEventArgs e) { SetUpValidMembers(); SetUpValidPatterns(); BodyTable.Refresh(); }