2006-02-18 22:55:58 +01:00
|
|
|
// Copyright (c) 2006, Rodrigo Braz Monteiro
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// AEGISUB
|
|
|
|
//
|
|
|
|
// Website: http://aegisub.cellosoft.com
|
|
|
|
// Contact: mailto:zeratul@cellosoft.com
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
////////////
|
|
|
|
// Includes
|
2007-01-02 23:10:45 +01:00
|
|
|
#include <wx/wxprec.h>
|
2006-02-18 22:55:58 +01:00
|
|
|
#include <wx/grid.h>
|
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
//////////////
|
|
|
|
// Prototypes
|
|
|
|
class AssEntry;
|
|
|
|
class AssDialogue;
|
|
|
|
class SubsEditBox;
|
|
|
|
class FrameMain;
|
2006-02-19 01:54:35 +01:00
|
|
|
class VideoDisplay;
|
2006-02-18 22:55:58 +01:00
|
|
|
typedef std::list<AssEntry*>::iterator entryIter;
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////
|
|
|
|
// Base grid class
|
|
|
|
class BaseGrid : public wxWindow {
|
|
|
|
private:
|
|
|
|
int lineHeight;
|
|
|
|
int colWidth[16];
|
|
|
|
int lastRow;
|
2006-02-22 03:25:45 +01:00
|
|
|
int extendRow;
|
2006-02-18 23:09:03 +01:00
|
|
|
bool holding;
|
2006-02-18 22:55:58 +01:00
|
|
|
wxFont font;
|
|
|
|
wxScrollBar *scrollBar;
|
|
|
|
wxBitmap *bmp;
|
|
|
|
|
|
|
|
void OnPaint(wxPaintEvent &event);
|
|
|
|
void OnSize(wxSizeEvent &event);
|
|
|
|
void OnScroll(wxScrollEvent &event);
|
|
|
|
void OnMouseEvent(wxMouseEvent &event);
|
2006-02-22 03:25:45 +01:00
|
|
|
void OnKeyPress(wxKeyEvent &event);
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
void DrawImage(wxDC &dc);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
FrameMain *parentFrame;
|
2006-06-27 07:13:41 +02:00
|
|
|
bool showCol[16];
|
|
|
|
|
|
|
|
virtual void OnPopupMenu(bool alternate=false) {}
|
2006-02-19 04:10:03 +01:00
|
|
|
void AdjustScrollbar();
|
|
|
|
void ScrollTo(int y);
|
|
|
|
int yPos;
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
SubsEditBox *editBox;
|
2006-02-19 01:54:35 +01:00
|
|
|
VideoDisplay *video;
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
bool byFrame;
|
|
|
|
std::vector<entryIter> diagMap;
|
2006-02-21 03:01:42 +01:00
|
|
|
std::vector<AssDialogue *> diagPtrMap;
|
2006-02-18 22:55:58 +01:00
|
|
|
std::vector<bool> selMap;
|
|
|
|
|
2006-02-19 01:54:35 +01:00
|
|
|
void SetColumnWidths();
|
2006-02-18 22:55:58 +01:00
|
|
|
void BeginBatch();
|
|
|
|
void EndBatch();
|
2006-02-22 05:59:39 +01:00
|
|
|
void SetByFrame (bool state);
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
void SelectRow(int row, bool addToSelected = false, bool select=true);
|
|
|
|
void ClearSelection();
|
|
|
|
bool IsInSelection(int row, int col) const;
|
2006-02-19 01:54:35 +01:00
|
|
|
bool IsDisplayed(AssDialogue *line);
|
|
|
|
int GetNumberSelection();
|
2006-02-22 05:59:39 +01:00
|
|
|
int GetFirstSelRow();
|
2006-02-22 06:30:09 +01:00
|
|
|
void SelectVisible();
|
2006-02-22 05:59:39 +01:00
|
|
|
wxArrayInt GetSelection(bool *continuous=NULL);
|
2006-02-18 22:55:58 +01:00
|
|
|
|
2006-02-22 06:30:09 +01:00
|
|
|
void Clear();
|
2006-02-22 05:59:39 +01:00
|
|
|
void UpdateMaps();
|
2007-01-04 00:29:03 +01:00
|
|
|
void UpdateStyle();
|
2006-02-22 06:30:09 +01:00
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
int GetRows() const;
|
2006-02-22 07:08:35 +01:00
|
|
|
wxArrayInt GetRangeArray(int n1,int n2);
|
2006-02-22 05:59:39 +01:00
|
|
|
void MakeCellVisible(int row, int col,bool center=true);
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
AssDialogue *GetDialogue(int n);
|
|
|
|
|
|
|
|
BaseGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxWANTS_CHARS, const wxString& name = wxPanelNameStr);
|
|
|
|
~BaseGrid();
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///////
|
|
|
|
// IDs
|
|
|
|
enum {
|
|
|
|
GRID_SCROLLBAR = 1730
|
|
|
|
};
|