From fd728e90d57d5bb9cc31b47287b26efdf9c4e766 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Mon, 20 Feb 2006 22:54:23 +0000 Subject: [PATCH] Rows colliding with the currently active one will now be highlighted in grid Originally committed to SVN as r86. --- core/base_grid.cpp | 30 +++++++++++++++++++++++------- core/changelog.txt | 1 + core/subs_grid.cpp | 4 ---- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/core/base_grid.cpp b/core/base_grid.cpp index f7fe6b6f7..95d918ba7 100644 --- a/core/base_grid.cpp +++ b/core/base_grid.cpp @@ -281,17 +281,17 @@ void BaseGrid::DrawImage(wxDC &dc) { // Row colors std::vector rowColors; - std::vector foreColors; + std::vector foreColors; rowColors.push_back(wxBrush(wxColour(255,255,255))); // 0 = Standard - foreColors.push_back(wxBrush(wxColour(0,0,0))); + foreColors.push_back(wxColour(0,0,0)); rowColors.push_back(wxBrush(wxColour(165,207,231))); // 1 = Header - foreColors.push_back(wxBrush(wxColour(0,0,0))); + foreColors.push_back(wxColour(0,0,0)); rowColors.push_back(wxBrush(Options.AsColour(_T("Grid selection background")))); // 2 = Selected - foreColors.push_back(wxBrush(Options.AsColour(_T("Grid selection foreground")))); + foreColors.push_back(Options.AsColour(_T("Grid selection foreground"))); rowColors.push_back(wxBrush(Options.AsColour(_T("Grid comment background")))); // 3 = Commented - foreColors.push_back(wxBrush(Options.AsColour(_T("Grid selection foreground")))); + foreColors.push_back(Options.AsColour(_T("Grid selection foreground"))); rowColors.push_back(wxBrush(Options.AsColour(_T("Grid inframe background")))); // 4 = Video Highlighted - foreColors.push_back(wxBrush(Options.AsColour(_T("Grid selection foreground")))); + foreColors.push_back(Options.AsColour(_T("Grid selection foreground"))); // First grid row bool drawGrid = true; @@ -313,6 +313,15 @@ void BaseGrid::DrawImage(wxDC &dc) { dx = 0; dy = i*lineHeight; + // Check for collisions + bool collides = false; + if (curDiag) { + AssDialogue *sel = GetDialogue(editBox->linen); + if (sel && sel != curDiag) { + if (curDiag->CollidesWith(sel)) collides = true; + } + } + // Text array wxArrayString strings; @@ -356,7 +365,7 @@ void BaseGrid::DrawImage(wxDC &dc) { int mode = Options.AsInt(_T("Grid Hide Overrides")); wxString value = _T(""); - // Hid overrides + // Hidden overrides if (mode == 1 || mode == 2) { wxString replaceWith = Options.AsText(_T("Grid hide overrides char")); curDiag->ParseASSTags(); @@ -399,6 +408,12 @@ void BaseGrid::DrawImage(wxDC &dc) { dc.DrawRectangle((curColor == 1) ? 0 : colWidth[0],i*lineHeight+1,w,lineHeight); } + // Set text color + if (collides) dc.SetTextForeground(wxColour(255,0,0)); + else { + dc.SetTextForeground(foreColors[curColor]); + } + // Draw text wxRect cur; bool isCenter; @@ -417,6 +432,7 @@ void BaseGrid::DrawImage(wxDC &dc) { dc.DrawLabel(strings[j],cur,isCenter ? wxALIGN_CENTER : (wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT)); dx += colWidth[j]; } + //if (collides) dc.SetPen(wxPen(wxColour(255,0,0))); // Draw grid dc.DestroyClippingRegion(); diff --git a/core/changelog.txt b/core/changelog.txt index a3b7c7da8..fd4cd6e78 100644 --- a/core/changelog.txt +++ b/core/changelog.txt @@ -34,6 +34,7 @@ Please visit http://aegisub.net to download latest version - Alt+Left/Right on the video seek bar will now seek by increments of 10 frames (increment is customizeable in config.dat) (AMZ) - Added a simple audio resync method for video playback (AMZ) - Audio timing will now apply to all selected lines, as well as active line (AMZ) +- Rows colliding with the currently active one will now be highlighted in grid (AMZ) = 1.09 beta - 2006.01.16 =========================== diff --git a/core/subs_grid.cpp b/core/subs_grid.cpp index 07e13f698..6e804eee7 100644 --- a/core/subs_grid.cpp +++ b/core/subs_grid.cpp @@ -106,10 +106,6 @@ SubtitlesGrid::SubtitlesGrid(FrameMain* parentFr, wxWindow *parent, wxWindowID i int w,h; dc.GetTextExtent(_T("#TWFfgGhH"), &w, &h, NULL, NULL, &font); RowHeight = h+4; - - // Set up - //SetSelectionBackground(Options.AsColour(_T("Grid selection background"))); - //SetSelectionForeground(Options.AsColour(_T("Grid selection foreground"))); }