Right-clicking on the header of the subtitles grid will now bring up a popup menu that allows you to disable columns.

Originally committed to SVN as r430.
This commit is contained in:
Rodrigo Braz Monteiro 2006-06-27 05:13:41 +00:00
parent a43aea6dc7
commit c68c13c59a
6 changed files with 66 additions and 6 deletions

View file

@ -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];

View file

@ -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;

View file

@ -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 ===========================

View file

@ -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);

View file

@ -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;i<strings.Count();i++) {
menu.Append(MENU_SHOW_COL + i,strings[i],_T(""),wxITEM_CHECK)->Check(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) {

View file

@ -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
};