diff --git a/core/base_grid.cpp b/core/base_grid.cpp index 82707e55e..879a371e5 100644 --- a/core/base_grid.cpp +++ b/core/base_grid.cpp @@ -86,6 +86,7 @@ BaseGrid::BaseGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wx scrollBar->SetScrollbar(0,10,100,10); // Set column widths + for (int i=0;i<10;i++) showCol[i] = Options.AsBool(_T("Grid show column ") + IntegerToString(i)); SetColumnWidths(); } @@ -492,6 +493,9 @@ void BaseGrid::DrawImage(wxDC &dc) { wxRect cur; bool isCenter; for (int j=0;j<11;j++) { + // Check width + if (colWidth[j] == 0) continue; + // Is center? isCenter = !(j == 4 || j == 5 || j == 6 || j == 10); @@ -576,6 +580,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { bool click = event.ButtonDown(wxMOUSE_BTN_LEFT); bool dclick = event.LeftDClick(); int row = event.GetY()/lineHeight + yPos - 1; + bool headerClick = row < yPos; if (holding && !click) { row = MID(0,row,GetRows()-1); } @@ -676,7 +681,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { // Popup if (event.ButtonDown(wxMOUSE_BTN_RIGHT)) { - OnPopupMenu(); + OnPopupMenu(headerClick); } // Mouse wheel @@ -837,6 +842,11 @@ void BaseGrid::SetColumnWidths() { colWidth[8] = marginLen; colWidth[9] = marginLen; + // Hide columns + for (int i=0;i<10;i++) { + if (showCol[i] == false) colWidth[i] = 0; + } + // Set size of last int total = 0; for (int i=0;i<10;i++) total+= colWidth[i]; diff --git a/core/base_grid.h b/core/base_grid.h index c210a2ccd..b5c491c6f 100644 --- a/core/base_grid.h +++ b/core/base_grid.h @@ -78,7 +78,9 @@ private: protected: FrameMain *parentFrame; - virtual void OnPopupMenu() {} + bool showCol[16]; + + virtual void OnPopupMenu(bool alternate=false) {} void AdjustScrollbar(); void ScrollTo(int y); int yPos; diff --git a/core/changelog.txt b/core/changelog.txt index e20958155..421dc31c0 100644 --- a/core/changelog.txt +++ b/core/changelog.txt @@ -84,6 +84,7 @@ Please visit http://aegisub.net to download latest version - The manual has been extensively re-written and extended to include documentation about a lot of new (and some not so new) features. It's reasonably complete... for the moment. (TheFluff, Motoko-chan, AMZ, others) - Text edit boxes in the subtitle editing area will now revert to unmodified if you restore the original text. (AMZ) - Re-arranged the controls in the subtitle editing area. (AMZ) +- Right-clicking on the header of the subtitles grid will now bring up a popup menu that allows you to disable columns. (AMZ) = 1.09 beta - 2006.01.16 =========================== diff --git a/core/options.cpp b/core/options.cpp index 1d980aff7..039cbc8c2 100644 --- a/core/options.cpp +++ b/core/options.cpp @@ -147,12 +147,14 @@ void OptionsManager::LoadDefaults() { SetInt(_T("Grid hide overrides"),1); wchar_t temp = 0x2600; SetText(_T("Grid hide overrides char"),temp); + SetBool(_T("Grid allow focus"),true); + for (int i=0;i<10;i++) SetBool(_T("Grid show column ") + IntegerToString(i),true); + #if defined(__WINDOWS__) SetInt(_T("Grid font size"),8); #else SetInt(_T("Grid font size"),10); #endif - SetBool(_T("Grid allow focus"),true); SetBool(_T("Highlight subs in frame"),true); diff --git a/core/subs_grid.cpp b/core/subs_grid.cpp index b1659a488..d34ba39b7 100644 --- a/core/subs_grid.cpp +++ b/core/subs_grid.cpp @@ -82,6 +82,7 @@ BEGIN_EVENT_TABLE(SubtitlesGrid, BaseGrid) EVT_MENU(MENU_1_12_2_RECOMBINE,SubtitlesGrid::On1122Recombine) EVT_MENU(MENU_12_2_RECOMBINE,SubtitlesGrid::On122Recombine) EVT_MENU(MENU_1_12_RECOMBINE,SubtitlesGrid::On112Recombine) + EVT_MENU_RANGE(MENU_SHOW_COL,MENU_SHOW_COL+15,SubtitlesGrid::OnShowColMenu) END_EVENT_TABLE() @@ -107,7 +108,32 @@ SubtitlesGrid::~SubtitlesGrid() { ////////////// // Popup menu -void SubtitlesGrid::OnPopupMenu() { +void SubtitlesGrid::OnPopupMenu(bool alternate) { + // Alternate + if (alternate) { + // Prepare strings + wxArrayString strings; + strings.Add(_("Line Number")); + strings.Add(_("Layer")); + strings.Add(_("Start")); + strings.Add(_("End")); + strings.Add(_("Style")); + strings.Add(_("Actor")); + strings.Add(_("Effect")); + strings.Add(_("Left")); + strings.Add(_("Right")); + strings.Add(_("Vert")); + + // Create Menu + wxMenu menu; + for (size_t i=0;iCheck(showCol[i]); + } + PopupMenu(&menu); + + return; + } + // Get selections bool continuous; wxArrayInt selections = GetSelection(&continuous); @@ -177,6 +203,23 @@ void SubtitlesGrid::OnPopupMenu() { } +//////////////////////////////////// +// Process a show/hide column event +void SubtitlesGrid::OnShowColMenu(wxCommandEvent &event) { + // Set width + int item = event.GetId()-MENU_SHOW_COL; + showCol[item] = !showCol[item]; + + // Save options + Options.SetBool(_T("Grid show column ") + IntegerToString(item),showCol[item]); + Options.Save(); + + // Update + SetColumnWidths(); + Refresh(false); +} + + /////////////////////////// // Process keyboard events void SubtitlesGrid::OnKeyDown(wxKeyEvent &event) { diff --git a/core/subs_grid.h b/core/subs_grid.h index 0f3e46726..b696c63e2 100644 --- a/core/subs_grid.h +++ b/core/subs_grid.h @@ -68,7 +68,7 @@ class SubtitlesGrid: public BaseGrid { private: bool ready; - void OnPopupMenu(); + void OnPopupMenu(bool alternate=false); void OnKeyDown(wxKeyEvent &event); void OnSwap(wxCommandEvent &event); @@ -95,6 +95,7 @@ private: void On1122Recombine(wxCommandEvent &event); void On122Recombine(wxCommandEvent &event); void On112Recombine(wxCommandEvent &event); + void OnShowColMenu(wxCommandEvent &event); public: AssFile *ass; @@ -157,5 +158,6 @@ enum { MENU_SET_START_TO_VIDEO, MENU_SET_END_TO_VIDEO, MENU_SET_VIDEO_TO_START, - MENU_SET_VIDEO_TO_END + MENU_SET_VIDEO_TO_END, + MENU_SHOW_COL = 1250 };