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.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2006-02-18 22:55:58 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file base_grid.cpp
|
|
|
|
/// @brief Base for subtitle grid in main UI
|
|
|
|
/// @ingroup main_ui
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#ifndef AGI_PRE
|
2010-05-26 09:17:34 +02:00
|
|
|
#include <algorithm>
|
2010-06-27 05:24:03 +02:00
|
|
|
#include <iterator>
|
2010-08-03 00:14:11 +02:00
|
|
|
|
|
|
|
#include <wx/dcclient.h>
|
|
|
|
#include <wx/dcmemory.h>
|
2009-07-27 01:24:21 +02:00
|
|
|
#include <wx/sizer.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
#endif
|
|
|
|
|
2010-07-20 05:11:11 +02:00
|
|
|
#include "base_grid.h"
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
#include "ass_dialogue.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "ass_file.h"
|
2006-02-18 22:55:58 +01:00
|
|
|
#include "ass_style.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "audio_display.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "compat.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "frame_main.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "main.h"
|
2006-02-18 22:55:58 +01:00
|
|
|
#include "subs_edit_box.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "utils.h"
|
2007-01-21 18:01:22 +01:00
|
|
|
#include "video_box.h"
|
|
|
|
#include "video_context.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "video_slider.h"
|
2006-02-18 22:55:58 +01:00
|
|
|
|
2010-06-28 09:13:03 +02:00
|
|
|
template<class S1, class S2, class D>
|
|
|
|
static inline void set_difference(const S1 &src1, const S2 &src2, D &dst) {
|
|
|
|
std::set_difference(
|
|
|
|
src1.begin(), src1.end(), src2.begin(), src2.end(),
|
|
|
|
std::inserter(dst, dst.begin()));
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Constructor
|
|
|
|
/// @param parent
|
|
|
|
/// @param id
|
|
|
|
/// @param pos
|
|
|
|
/// @param size
|
|
|
|
/// @param style
|
|
|
|
/// @param name
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
BaseGrid::BaseGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
|
|
|
: wxWindow(parent, id, pos, size, style, name)
|
2010-07-08 06:29:04 +02:00
|
|
|
, context(VideoContext::Get())
|
2006-02-18 22:55:58 +01:00
|
|
|
{
|
|
|
|
// Misc variables
|
|
|
|
lastRow = -1;
|
|
|
|
yPos = 0;
|
2006-02-22 03:25:45 +01:00
|
|
|
extendRow = -1;
|
2006-02-18 22:55:58 +01:00
|
|
|
bmp = NULL;
|
2006-02-18 23:44:12 +01:00
|
|
|
holding = false;
|
2008-11-25 03:07:07 +01:00
|
|
|
byFrame = false;
|
2009-07-27 23:11:39 +02:00
|
|
|
lineHeight = 1; // non-zero to avoid div by 0
|
2010-06-26 13:32:16 +02:00
|
|
|
active_line = 0;
|
2006-02-18 22:55:58 +01:00
|
|
|
|
2010-06-26 17:40:10 +02:00
|
|
|
batch_level = 0;
|
|
|
|
batch_active_line_changed = false;
|
|
|
|
|
2007-01-04 00:29:03 +01:00
|
|
|
// Set scrollbar
|
|
|
|
scrollBar = new wxScrollBar(this,GRID_SCROLLBAR,wxDefaultPosition,wxDefaultSize,wxSB_VERTICAL);
|
|
|
|
scrollBar->SetScrollbar(0,10,100,10);
|
|
|
|
|
2009-07-27 01:24:21 +02:00
|
|
|
wxBoxSizer *scrollbarpositioner = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
scrollbarpositioner->AddStretchSpacer();
|
|
|
|
scrollbarpositioner->Add(scrollBar, 0, wxEXPAND, 0);
|
|
|
|
|
|
|
|
SetSizerAndFit(scrollbarpositioner);
|
|
|
|
|
2007-01-04 00:29:03 +01:00
|
|
|
// Set style
|
|
|
|
UpdateStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Destructor
|
|
|
|
///
|
2007-01-04 00:29:03 +01:00
|
|
|
BaseGrid::~BaseGrid() {
|
2010-06-26 09:26:27 +02:00
|
|
|
ClearMaps();
|
2007-01-04 00:29:03 +01:00
|
|
|
delete bmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Update style
|
|
|
|
///
|
2007-01-04 00:29:03 +01:00
|
|
|
void BaseGrid::UpdateStyle() {
|
2006-02-18 22:55:58 +01:00
|
|
|
// Set font
|
2010-05-21 03:13:36 +02:00
|
|
|
wxString fontname = lagi_wxString(OPT_GET("Subtitle/Grid/Font Face")->GetString());
|
2006-02-20 22:32:58 +01:00
|
|
|
if (fontname.IsEmpty()) fontname = _T("Tahoma");
|
2006-02-18 22:55:58 +01:00
|
|
|
font.SetFaceName(fontname);
|
2010-05-21 03:13:36 +02:00
|
|
|
font.SetPointSize(OPT_GET("Subtitle/Grid/Font Size")->GetInt());
|
2006-02-18 22:55:58 +01:00
|
|
|
font.SetWeight(wxFONTWEIGHT_NORMAL);
|
|
|
|
|
|
|
|
// Set line height
|
|
|
|
{
|
|
|
|
wxClientDC dc(this);
|
|
|
|
dc.SetFont(font);
|
|
|
|
int fw,fh;
|
|
|
|
dc.GetTextExtent(_T("#TWFfgGhH"), &fw, &fh, NULL, NULL, &font);
|
|
|
|
lineHeight = fh+4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set column widths
|
2010-05-21 03:13:36 +02:00
|
|
|
std::vector<bool> column_array;
|
|
|
|
OPT_GET("Subtitle/Grid/Column")->GetListBool(column_array);
|
2010-06-22 02:03:22 +02:00
|
|
|
assert(column_array.size() == columns);
|
|
|
|
for (int i=0;i<columns;i++) showCol[i] = column_array[i];
|
2006-02-18 22:55:58 +01:00
|
|
|
SetColumnWidths();
|
|
|
|
|
2007-01-04 00:29:03 +01:00
|
|
|
// Update
|
|
|
|
AdjustScrollbar();
|
|
|
|
Refresh();
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Clears grid
|
|
|
|
///
|
2010-06-26 09:26:27 +02:00
|
|
|
void BaseGrid::ClearMaps() {
|
|
|
|
Selection old_selection(selection);
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
|
2010-06-26 09:26:27 +02:00
|
|
|
index_line_map.clear();
|
|
|
|
line_index_map.clear();
|
|
|
|
selection.clear();
|
2006-02-22 06:30:09 +01:00
|
|
|
yPos = 0;
|
|
|
|
AdjustScrollbar();
|
2010-06-26 09:26:27 +02:00
|
|
|
|
|
|
|
AnnounceSelectedSetChanged(Selection(), old_selection);
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
2010-07-13 07:29:08 +02:00
|
|
|
/// @brief Update maps
|
|
|
|
///
|
|
|
|
void BaseGrid::UpdateMaps(bool preserve_selected_rows) {
|
|
|
|
BeginBatch();
|
|
|
|
int active_row = line_index_map[active_line];
|
|
|
|
|
|
|
|
std::vector<int> sel_rows;
|
|
|
|
if (preserve_selected_rows) {
|
|
|
|
sel_rows.reserve(selection.size());
|
|
|
|
std::transform(selection.begin(), selection.end(), std::back_inserter(sel_rows),
|
|
|
|
std::bind1st(std::mem_fun(&BaseGrid::GetDialogueIndex), this));
|
|
|
|
}
|
|
|
|
|
|
|
|
index_line_map.clear();
|
|
|
|
line_index_map.clear();
|
|
|
|
|
|
|
|
for (entryIter cur=AssFile::top->Line.begin();cur != AssFile::top->Line.end();cur++) {
|
|
|
|
AssDialogue *curdiag = dynamic_cast<AssDialogue*>(*cur);
|
|
|
|
if (curdiag) {
|
|
|
|
line_index_map[curdiag] = (int)index_line_map.size();
|
|
|
|
index_line_map.push_back(curdiag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (preserve_selected_rows) {
|
|
|
|
Selection sel;
|
|
|
|
|
|
|
|
// If the file shrank enough that no selected rows are left, select the
|
|
|
|
// last row
|
|
|
|
if (sel_rows.empty()) {
|
|
|
|
sel_rows.push_back(index_line_map.size() - 1);
|
|
|
|
}
|
|
|
|
else if (sel_rows[0] >= (int)index_line_map.size()) {
|
|
|
|
sel_rows[0] = index_line_map.size() - 1;
|
|
|
|
}
|
|
|
|
for (size_t i = 0; i < sel_rows.size(); i++) {
|
|
|
|
if (sel_rows[i] >= (int)index_line_map.size()) break;
|
|
|
|
sel.insert(index_line_map[sel_rows[i]]);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetSelectedSet(sel);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Selection lines;
|
|
|
|
std::copy(index_line_map.begin(), index_line_map.end(), std::inserter(lines, lines.begin()));
|
|
|
|
Selection new_sel;
|
|
|
|
// Remove lines which no longer exist from the selection
|
|
|
|
set_intersection(selection.begin(), selection.end(),
|
|
|
|
lines.begin(), lines.end(),
|
|
|
|
std::inserter(new_sel, new_sel.begin()));
|
|
|
|
|
|
|
|
SetSelectedSet(new_sel);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The active line may have ceased to exist; pick a new one if so
|
|
|
|
if (line_index_map.find(active_line) == line_index_map.end()) {
|
|
|
|
if (active_row < (int)index_line_map.size()) {
|
|
|
|
SetActiveLine(index_line_map[active_row]);
|
|
|
|
}
|
|
|
|
else if (preserve_selected_rows && !selection.empty()) {
|
|
|
|
SetActiveLine(index_line_map[sel_rows[0]]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
SetActiveLine(index_line_map.back());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selection.empty() && active_line) {
|
|
|
|
Selection sel;
|
|
|
|
sel.insert(active_line);
|
|
|
|
SetSelectedSet(sel);
|
|
|
|
}
|
|
|
|
|
|
|
|
EndBatch();
|
|
|
|
|
|
|
|
Refresh(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Begin batch
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
void BaseGrid::BeginBatch() {
|
|
|
|
//Freeze();
|
2010-06-26 17:40:10 +02:00
|
|
|
|
|
|
|
++batch_level;
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief End batch
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
void BaseGrid::EndBatch() {
|
2010-06-26 17:40:10 +02:00
|
|
|
--batch_level;
|
|
|
|
assert(batch_level >= 0);
|
|
|
|
if (batch_level == 0) {
|
|
|
|
if (batch_active_line_changed)
|
|
|
|
AnnounceActiveLineChanged(active_line);
|
|
|
|
batch_active_line_changed = false;
|
|
|
|
if (!batch_selection_added.empty() || !batch_selection_removed.empty())
|
|
|
|
AnnounceSelectedSetChanged(batch_selection_added, batch_selection_removed);
|
|
|
|
batch_selection_added.clear();
|
|
|
|
batch_selection_removed.clear();
|
|
|
|
}
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
//Thaw();
|
2006-02-19 04:10:03 +01:00
|
|
|
AdjustScrollbar();
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Makes cell visible
|
|
|
|
/// @param row
|
|
|
|
/// @param col
|
|
|
|
/// @param center
|
|
|
|
///
|
2006-02-22 03:25:45 +01:00
|
|
|
void BaseGrid::MakeCellVisible(int row, int col,bool center) {
|
2009-04-26 03:02:23 +02:00
|
|
|
// Update last row selection
|
|
|
|
lastRow = row;
|
|
|
|
|
2006-02-19 00:00:09 +01:00
|
|
|
// Get size
|
|
|
|
int w = 0;
|
|
|
|
int h = 0;
|
|
|
|
GetClientSize(&w,&h);
|
2006-02-22 03:25:45 +01:00
|
|
|
bool forceCenter = !center;
|
2006-02-19 00:00:09 +01:00
|
|
|
|
|
|
|
// Get min and max visible
|
|
|
|
int minVis = yPos+1;
|
|
|
|
int maxVis = yPos+h/lineHeight-3;
|
|
|
|
|
|
|
|
// Make visible
|
|
|
|
if (forceCenter || row < minVis || row > maxVis) {
|
2006-02-22 03:25:45 +01:00
|
|
|
if (center) {
|
|
|
|
ScrollTo(row - h/lineHeight/2 + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
if (row < minVis) ScrollTo(row - 1);
|
|
|
|
if (row > maxVis) ScrollTo(row - h/lineHeight + 3);
|
|
|
|
}
|
2006-02-19 00:00:09 +01:00
|
|
|
}
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Select a row
|
|
|
|
/// @param row
|
|
|
|
/// @param addToSelected
|
|
|
|
/// @param select
|
|
|
|
///
|
2006-02-22 06:30:09 +01:00
|
|
|
void BaseGrid::SelectRow(int row, bool addToSelected, bool select) {
|
2010-06-26 09:26:27 +02:00
|
|
|
if (row < 0 || (size_t)row >= index_line_map.size()) return;
|
|
|
|
|
|
|
|
AssDialogue *line = index_line_map[row];
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
|
|
|
|
if (!addToSelected) {
|
2010-06-28 09:13:03 +02:00
|
|
|
Selection sel;
|
|
|
|
if (select) sel.insert(line);
|
|
|
|
SetSelectedSet(sel);
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
}
|
2010-05-26 09:17:34 +02:00
|
|
|
|
2010-06-26 09:26:27 +02:00
|
|
|
else if (select && selection.find(line) == selection.end()) {
|
|
|
|
selection.insert(line);
|
|
|
|
|
|
|
|
Selection added;
|
|
|
|
added.insert(line);
|
|
|
|
|
|
|
|
AnnounceSelectedSetChanged(added, Selection());
|
2010-06-27 06:54:58 +02:00
|
|
|
|
|
|
|
int w = 0;
|
|
|
|
int h = 0;
|
|
|
|
GetClientSize(&w,&h);
|
|
|
|
RefreshRect(wxRect(0,(row+1-yPos)*lineHeight,w,lineHeight),false);
|
2010-06-26 09:26:27 +02:00
|
|
|
}
|
2010-05-26 09:17:39 +02:00
|
|
|
|
2010-06-26 09:26:27 +02:00
|
|
|
else if (!select && selection.find(line) != selection.end()) {
|
|
|
|
selection.erase(line);
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
|
2010-06-26 09:26:27 +02:00
|
|
|
Selection removed;
|
|
|
|
removed.insert(line);
|
|
|
|
|
|
|
|
AnnounceSelectedSetChanged(Selection(), removed);
|
2010-06-27 06:54:58 +02:00
|
|
|
|
|
|
|
int w = 0;
|
|
|
|
int h = 0;
|
|
|
|
GetClientSize(&w,&h);
|
|
|
|
RefreshRect(wxRect(0,(row+1-yPos)*lineHeight,w,lineHeight),false);
|
2006-02-22 06:30:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Selects visible lines
|
|
|
|
///
|
2006-02-22 06:30:09 +01:00
|
|
|
void BaseGrid::SelectVisible() {
|
2010-06-28 09:13:03 +02:00
|
|
|
Selection new_selection;
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
|
2006-02-22 06:30:09 +01:00
|
|
|
int rows = GetRows();
|
|
|
|
bool selectedOne = false;
|
|
|
|
for (int i=0;i<rows;i++) {
|
2010-06-28 09:13:03 +02:00
|
|
|
AssDialogue *diag = GetDialogue(i);
|
|
|
|
if (IsDisplayed(diag)) {
|
2006-02-22 06:30:09 +01:00
|
|
|
if (!selectedOne) {
|
|
|
|
MakeCellVisible(i,0);
|
|
|
|
selectedOne = true;
|
|
|
|
}
|
2010-06-28 09:13:03 +02:00
|
|
|
new_selection.insert(diag);
|
2006-02-22 06:30:09 +01:00
|
|
|
}
|
|
|
|
}
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
|
2010-06-28 09:13:03 +02:00
|
|
|
SetSelectedSet(new_selection);
|
2006-02-22 06:30:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Unselects all cells
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
void BaseGrid::ClearSelection() {
|
2010-06-26 09:26:27 +02:00
|
|
|
Selection old_selection(selection.begin(), selection.end());
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
|
2010-06-26 09:26:27 +02:00
|
|
|
selection.clear();
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
|
2010-06-26 09:26:27 +02:00
|
|
|
AnnounceSelectedSetChanged(Selection(), old_selection);
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Is cell in selection?
|
|
|
|
/// @param row
|
|
|
|
/// @param col
|
|
|
|
/// @return
|
|
|
|
///
|
2010-05-26 09:17:34 +02:00
|
|
|
bool BaseGrid::IsInSelection(int row, int) const {
|
2010-06-26 09:26:27 +02:00
|
|
|
if ((size_t)row >= index_line_map.size() || row < 0) return false;
|
|
|
|
|
|
|
|
return selection.find(index_line_map[row]) != selection.end();
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Number of selected rows
|
|
|
|
/// @return
|
|
|
|
///
|
2010-05-26 09:17:34 +02:00
|
|
|
int BaseGrid::GetNumberSelection() const {
|
2010-06-26 09:26:27 +02:00
|
|
|
return selection.size();
|
2006-02-19 02:16:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-06-26 09:26:27 +02:00
|
|
|
/// @brief Gets first selected row index
|
|
|
|
/// @return Row index of first selected row, -1 if no selection
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
///
|
2010-05-26 09:17:34 +02:00
|
|
|
int BaseGrid::GetFirstSelRow() const {
|
2010-06-26 09:26:27 +02:00
|
|
|
Selection::const_iterator it = selection.begin();
|
|
|
|
|
|
|
|
if (it == selection.end()) return -1;
|
|
|
|
|
|
|
|
int index = GetDialogueIndex(*it);
|
|
|
|
|
|
|
|
for (; it != selection.end(); ++it) {
|
|
|
|
int other_index = GetDialogueIndex(*it);
|
|
|
|
if (other_index < index) index = other_index;
|
|
|
|
}
|
|
|
|
|
|
|
|
return index;
|
2006-02-22 05:59:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Gets last selected row from first block selection
|
|
|
|
/// @return
|
|
|
|
///
|
2010-05-26 09:17:34 +02:00
|
|
|
int BaseGrid::GetLastSelRow() const {
|
2009-04-26 03:02:23 +02:00
|
|
|
int frow = GetFirstSelRow();
|
|
|
|
while (IsInSelection(frow)) {
|
|
|
|
frow++;
|
|
|
|
}
|
|
|
|
return frow-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Gets all selected rows
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
/// @param[out] cont Is the selection contiguous, i.e. free from holes
|
|
|
|
/// @return Array with indices of selected lines
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
///
|
2010-05-26 09:17:34 +02:00
|
|
|
wxArrayInt BaseGrid::GetSelection(bool *cont) const {
|
2006-02-22 05:59:39 +01:00
|
|
|
int last = -1;
|
|
|
|
bool continuous = true;
|
2010-06-26 09:26:27 +02:00
|
|
|
|
|
|
|
std::set<int> sel_row_indices;
|
|
|
|
|
|
|
|
for (Selection::const_iterator it = selection.begin(); it != selection.end(); ++it) {
|
|
|
|
sel_row_indices.insert(GetDialogueIndex(*it));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Iterating the int set yields a sorted list
|
|
|
|
wxArrayInt res;
|
|
|
|
for (std::set<int>::iterator it = sel_row_indices.begin(); it != sel_row_indices.end(); ++it) {
|
|
|
|
res.Add(*it);
|
|
|
|
if (last != -1 && *it != last+1) continuous = false;
|
|
|
|
last = *it;
|
2006-02-22 05:59:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (cont) *cont = continuous;
|
2010-06-26 09:26:27 +02:00
|
|
|
return res;
|
2006-02-22 05:59:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Get number of rows
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
int BaseGrid::GetRows() const {
|
2010-06-26 09:26:27 +02:00
|
|
|
return index_line_map.size();
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
// Event table
|
|
|
|
BEGIN_EVENT_TABLE(BaseGrid,wxWindow)
|
|
|
|
EVT_PAINT(BaseGrid::OnPaint)
|
|
|
|
EVT_SIZE(BaseGrid::OnSize)
|
|
|
|
EVT_COMMAND_SCROLL(GRID_SCROLLBAR,BaseGrid::OnScroll)
|
|
|
|
EVT_MOUSE_EVENTS(BaseGrid::OnMouseEvent)
|
2006-02-22 03:25:45 +01:00
|
|
|
EVT_KEY_DOWN(BaseGrid::OnKeyPress)
|
2006-02-18 22:55:58 +01:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Paint event
|
|
|
|
/// @param event
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
void BaseGrid::OnPaint (wxPaintEvent &event) {
|
|
|
|
// Prepare
|
|
|
|
wxPaintDC dc(this);
|
|
|
|
bool direct = false;
|
|
|
|
|
|
|
|
if (direct) {
|
|
|
|
DrawImage(dc);
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
// Get size and pos
|
|
|
|
int w = 0;
|
|
|
|
int h = 0;
|
|
|
|
GetClientSize(&w,&h);
|
2007-04-08 08:01:41 +02:00
|
|
|
w -= scrollBar->GetSize().GetWidth();
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
// Prepare bitmap
|
|
|
|
if (bmp) {
|
|
|
|
if (bmp->GetWidth() < w || bmp->GetHeight() < h) {
|
|
|
|
delete bmp;
|
|
|
|
bmp = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!bmp) bmp = new wxBitmap(w,h);
|
|
|
|
|
|
|
|
// Draw bitmap
|
|
|
|
wxMemoryDC bmpDC;
|
|
|
|
bmpDC.SelectObject(*bmp);
|
|
|
|
DrawImage(bmpDC);
|
|
|
|
dc.Blit(0,0,w,h,&bmpDC,0,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Draw image
|
|
|
|
/// @param dc
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
void BaseGrid::DrawImage(wxDC &dc) {
|
|
|
|
// Get size and pos
|
|
|
|
int w = 0;
|
|
|
|
int h = 0;
|
|
|
|
GetClientSize(&w,&h);
|
2007-04-08 08:01:41 +02:00
|
|
|
w -= scrollBar->GetSize().GetWidth();
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
// Set font
|
|
|
|
dc.SetFont(font);
|
|
|
|
|
|
|
|
// Clear background
|
2010-05-21 03:13:36 +02:00
|
|
|
dc.SetBackground(wxBrush(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Background/Background")->GetColour())));
|
2006-02-18 22:55:58 +01:00
|
|
|
dc.Clear();
|
|
|
|
|
|
|
|
// Draw labels
|
|
|
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
2010-05-21 03:13:36 +02:00
|
|
|
dc.SetBrush(wxBrush(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Left Column")->GetColour())));
|
2006-02-18 22:55:58 +01:00
|
|
|
dc.DrawRectangle(0,lineHeight,colWidth[0],h-lineHeight);
|
|
|
|
|
|
|
|
// Visible lines
|
|
|
|
int drawPerScreen = h/lineHeight + 1;
|
|
|
|
int nDraw = MID(0,drawPerScreen,GetRows()-yPos);
|
|
|
|
int maxH = (nDraw+1) * lineHeight;
|
|
|
|
|
|
|
|
// Row colors
|
|
|
|
std::vector<wxBrush> rowColors;
|
2006-02-20 23:54:23 +01:00
|
|
|
std::vector<wxColor> foreColors;
|
2010-05-21 03:13:36 +02:00
|
|
|
rowColors.push_back(wxBrush(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Background/Background")->GetColour()))); // 0 = Standard
|
|
|
|
foreColors.push_back(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Standard")->GetColour()));
|
|
|
|
rowColors.push_back(wxBrush(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Header")->GetColour()))); // 1 = Header
|
|
|
|
foreColors.push_back(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Standard")->GetColour()));
|
|
|
|
rowColors.push_back(wxBrush(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Background/Selection")->GetColour()))); // 2 = Selected
|
|
|
|
foreColors.push_back(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Selection")->GetColour()));
|
|
|
|
rowColors.push_back(wxBrush(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Background/Comment")->GetColour()))); // 3 = Commented
|
|
|
|
foreColors.push_back(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Selection")->GetColour()));
|
|
|
|
rowColors.push_back(wxBrush(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Background/Inframe")->GetColour()))); // 4 = Video Highlighted
|
|
|
|
foreColors.push_back(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Selection")->GetColour()));
|
|
|
|
rowColors.push_back(wxBrush(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Background/Selected Comment")->GetColour()))); // 5 = Commented & selected
|
|
|
|
foreColors.push_back(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Selection")->GetColour()));
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
// First grid row
|
|
|
|
bool drawGrid = true;
|
|
|
|
if (drawGrid) {
|
2010-05-21 03:13:36 +02:00
|
|
|
dc.SetPen(wxPen(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Lines")->GetColour())));
|
2006-02-18 22:55:58 +01:00
|
|
|
dc.DrawLine(0,0,w,0);
|
|
|
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw rows
|
|
|
|
int dx = 0;
|
|
|
|
int dy = 0;
|
|
|
|
int curColor = 0;
|
|
|
|
AssDialogue *curDiag;
|
|
|
|
for (int i=0;i<nDraw+1;i++) {
|
|
|
|
// Prepare
|
|
|
|
int curRow = i+yPos-1;
|
2006-06-08 23:03:05 +02:00
|
|
|
curDiag = (curRow>=0) ? GetDialogue(curRow) : NULL;
|
2006-02-18 22:55:58 +01:00
|
|
|
dx = 0;
|
|
|
|
dy = i*lineHeight;
|
|
|
|
|
2006-02-20 23:54:23 +01:00
|
|
|
// Check for collisions
|
|
|
|
bool collides = false;
|
|
|
|
if (curDiag) {
|
2010-06-26 13:32:16 +02:00
|
|
|
AssDialogue *sel = GetActiveLine();
|
2006-02-20 23:54:23 +01:00
|
|
|
if (sel && sel != curDiag) {
|
|
|
|
if (curDiag->CollidesWith(sel)) collides = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
// Text array
|
|
|
|
wxArrayString strings;
|
|
|
|
|
|
|
|
// Header
|
|
|
|
if (i == 0) {
|
|
|
|
strings.Add(_("#"));
|
|
|
|
strings.Add(_("L"));
|
|
|
|
strings.Add(_("Start"));
|
|
|
|
strings.Add(_("End"));
|
|
|
|
strings.Add(_("Style"));
|
|
|
|
strings.Add(_("Actor"));
|
|
|
|
strings.Add(_("Effect"));
|
|
|
|
strings.Add(_("Left"));
|
|
|
|
strings.Add(_("Right"));
|
|
|
|
strings.Add(_("Vert"));
|
|
|
|
strings.Add(_("Text"));
|
|
|
|
curColor = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Lines
|
|
|
|
else if (curDiag) {
|
|
|
|
// Set fields
|
|
|
|
strings.Add(wxString::Format(_T("%i"),curRow+1));
|
|
|
|
strings.Add(wxString::Format(_T("%i"),curDiag->Layer));
|
2006-02-19 01:54:35 +01:00
|
|
|
if (byFrame) {
|
2010-07-08 06:29:04 +02:00
|
|
|
strings.Add(wxString::Format(_T("%i"),context->FrameAtTime(curDiag->Start.GetMS(),agi::vfr::START)));
|
|
|
|
strings.Add(wxString::Format(_T("%i"),context->FrameAtTime(curDiag->End.GetMS(),agi::vfr::END)));
|
2006-02-19 01:54:35 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
strings.Add(curDiag->Start.GetASSFormated());
|
|
|
|
strings.Add(curDiag->End.GetASSFormated());
|
|
|
|
}
|
2006-02-18 22:55:58 +01:00
|
|
|
strings.Add(curDiag->Style);
|
|
|
|
strings.Add(curDiag->Actor);
|
|
|
|
strings.Add(curDiag->Effect);
|
2007-01-05 19:27:15 +01:00
|
|
|
strings.Add(curDiag->GetMarginString(0));
|
2006-02-18 22:55:58 +01:00
|
|
|
strings.Add(curDiag->GetMarginString(1));
|
|
|
|
strings.Add(curDiag->GetMarginString(2));
|
|
|
|
|
|
|
|
// Set text
|
2010-05-21 03:13:36 +02:00
|
|
|
int mode = OPT_GET("Subtitle/Grid/Hide Overrides")->GetInt();
|
2006-02-18 22:55:58 +01:00
|
|
|
wxString value = _T("");
|
|
|
|
|
2006-02-20 23:54:23 +01:00
|
|
|
// Hidden overrides
|
2006-02-18 22:55:58 +01:00
|
|
|
if (mode == 1 || mode == 2) {
|
2010-05-21 03:13:36 +02:00
|
|
|
wxString replaceWith = lagi_wxString(OPT_GET("Subtitle/Grid/Hide Overrides Char")->GetString());
|
2006-07-09 00:33:21 +02:00
|
|
|
int textlen = curDiag->Text.Length();
|
|
|
|
int depth = 0;
|
|
|
|
wxChar curChar;
|
2010-06-11 04:24:59 +02:00
|
|
|
for (int j=0;j<textlen;j++) {
|
|
|
|
curChar = curDiag->Text[j];
|
2006-07-09 00:33:21 +02:00
|
|
|
if (curChar == _T('{')) depth = 1;
|
|
|
|
else if (curChar == _T('}')) {
|
|
|
|
depth--;
|
|
|
|
if (depth == 0 && mode == 1) value += replaceWith;
|
2010-06-11 04:24:59 +02:00
|
|
|
else if (depth < 0) depth = 0;
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
2006-07-09 00:33:21 +02:00
|
|
|
else if (depth != 1) value += curChar;
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show overrides
|
|
|
|
else value = curDiag->Text;
|
|
|
|
|
|
|
|
// Cap length and set text
|
2006-02-19 01:54:35 +01:00
|
|
|
if (value.Length() > 512) value = value.Left(512) + _T("...");
|
2006-02-18 22:55:58 +01:00
|
|
|
strings.Add(value);
|
|
|
|
|
|
|
|
// Set color
|
|
|
|
curColor = 0;
|
2006-02-21 00:12:08 +01:00
|
|
|
bool inSel = IsInSelection(curRow,0);
|
|
|
|
if (inSel && curDiag->Comment) curColor = 5;
|
|
|
|
else if (inSel) curColor = 2;
|
2006-02-19 01:54:35 +01:00
|
|
|
else if (curDiag->Comment) curColor = 3;
|
2010-05-21 03:13:36 +02:00
|
|
|
else if (OPT_GET("Subtitle/Grid/Highlight Subtitles in Frame")->GetBool() && IsDisplayed(curDiag)) curColor = 4;
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
for (int j=0;j<11;j++) strings.Add(_T("?"));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw row background color
|
|
|
|
if (curColor) {
|
|
|
|
dc.SetBrush(rowColors[curColor]);
|
|
|
|
dc.DrawRectangle((curColor == 1) ? 0 : colWidth[0],i*lineHeight+1,w,lineHeight);
|
|
|
|
}
|
|
|
|
|
2006-02-20 23:54:23 +01:00
|
|
|
// Set text color
|
2010-05-21 03:13:36 +02:00
|
|
|
if (collides) dc.SetTextForeground(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Collision")->GetColour()));
|
2006-02-20 23:54:23 +01:00
|
|
|
else {
|
|
|
|
dc.SetTextForeground(foreColors[curColor]);
|
|
|
|
}
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
// Draw text
|
|
|
|
wxRect cur;
|
|
|
|
bool isCenter;
|
|
|
|
for (int j=0;j<11;j++) {
|
2006-06-27 07:13:41 +02:00
|
|
|
// Check width
|
|
|
|
if (colWidth[j] == 0) continue;
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
// Is center?
|
|
|
|
isCenter = !(j == 4 || j == 5 || j == 6 || j == 10);
|
|
|
|
|
|
|
|
// Calculate clipping
|
|
|
|
cur = wxRect(dx+4,dy,colWidth[j]-6,lineHeight);
|
|
|
|
|
|
|
|
// Set clipping
|
|
|
|
dc.DestroyClippingRegion();
|
|
|
|
dc.SetClippingRegion(cur);
|
|
|
|
|
|
|
|
// Draw
|
|
|
|
dc.DrawLabel(strings[j],cur,isCenter ? wxALIGN_CENTER : (wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT));
|
|
|
|
dx += colWidth[j];
|
|
|
|
}
|
2006-02-20 23:54:23 +01:00
|
|
|
//if (collides) dc.SetPen(wxPen(wxColour(255,0,0)));
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
// Draw grid
|
|
|
|
dc.DestroyClippingRegion();
|
|
|
|
if (drawGrid) {
|
2010-05-21 03:13:36 +02:00
|
|
|
dc.SetPen(wxPen(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Lines")->GetColour())));
|
2006-02-18 22:55:58 +01:00
|
|
|
dc.DrawLine(0,dy+lineHeight,w,dy+lineHeight);
|
|
|
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw grid columns
|
|
|
|
dx = 0;
|
|
|
|
if (drawGrid) {
|
2010-05-21 03:13:36 +02:00
|
|
|
dc.SetPen(wxPen(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Lines")->GetColour())));
|
2006-02-18 22:55:58 +01:00
|
|
|
for (int i=0;i<10;i++) {
|
|
|
|
dx += colWidth[i];
|
|
|
|
dc.DrawLine(dx,0,dx,maxH);
|
|
|
|
}
|
|
|
|
dc.DrawLine(0,0,0,maxH);
|
2007-04-08 08:01:41 +02:00
|
|
|
dc.DrawLine(w-1,0,w-1,maxH);
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Draw currently active line border
|
2010-06-26 13:32:16 +02:00
|
|
|
if (GetActiveLine()) {
|
|
|
|
dc.SetPen(wxPen(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Active Border")->GetColour())));
|
|
|
|
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
|
|
|
dy = (line_index_map[GetActiveLine()]+1-yPos) * lineHeight;
|
|
|
|
dc.DrawRectangle(0,dy,w,lineHeight+1);
|
|
|
|
}
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief On size
|
|
|
|
/// @param event
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
void BaseGrid::OnSize(wxSizeEvent &event) {
|
|
|
|
AdjustScrollbar();
|
|
|
|
SetColumnWidths();
|
|
|
|
Refresh(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief On scroll
|
|
|
|
/// @param event
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
void BaseGrid::OnScroll(wxScrollEvent &event) {
|
|
|
|
int newPos = event.GetPosition();
|
|
|
|
if (yPos != newPos) {
|
|
|
|
yPos = newPos;
|
|
|
|
Refresh(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Mouse events
|
|
|
|
/// @param event
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
void BaseGrid::OnMouseEvent(wxMouseEvent &event) {
|
|
|
|
// Window size
|
|
|
|
int w,h;
|
|
|
|
GetClientSize(&w,&h);
|
|
|
|
|
|
|
|
// Modifiers
|
|
|
|
bool shift = event.m_shiftDown;
|
|
|
|
bool alt = event.m_altDown;
|
2007-09-22 00:56:44 +02:00
|
|
|
#ifdef __APPLE__
|
|
|
|
bool ctrl = event.m_metaDown;
|
|
|
|
#else
|
2006-02-18 22:55:58 +01:00
|
|
|
bool ctrl = event.m_controlDown;
|
2007-09-22 00:56:44 +02:00
|
|
|
#endif
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
// Row that mouse is over
|
2006-02-18 23:44:12 +01:00
|
|
|
bool click = event.ButtonDown(wxMOUSE_BTN_LEFT);
|
2006-03-01 05:32:00 +01:00
|
|
|
bool dclick = event.LeftDClick();
|
2006-02-18 22:55:58 +01:00
|
|
|
int row = event.GetY()/lineHeight + yPos - 1;
|
2006-06-27 07:13:41 +02:00
|
|
|
bool headerClick = row < yPos;
|
2006-02-18 23:44:12 +01:00
|
|
|
if (holding && !click) {
|
|
|
|
row = MID(0,row,GetRows()-1);
|
|
|
|
}
|
2010-06-26 13:32:16 +02:00
|
|
|
AssDialogue *dlg = GetDialogue(row);
|
|
|
|
if (!dlg) row = 0;
|
2006-02-18 22:55:58 +01:00
|
|
|
|
2006-02-22 03:25:45 +01:00
|
|
|
// Get focus
|
|
|
|
if (event.ButtonDown()) {
|
2010-05-21 03:13:36 +02:00
|
|
|
if (OPT_GET("Subtitle/Grid/Focus Allow")->GetBool()) {
|
2006-02-22 03:25:45 +01:00
|
|
|
SetFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-18 23:44:12 +01:00
|
|
|
// Click type
|
2006-06-21 01:32:01 +02:00
|
|
|
bool startedHolding = false;
|
2010-06-26 13:32:16 +02:00
|
|
|
if (click && !holding && dlg!=0) {
|
2006-02-18 23:44:12 +01:00
|
|
|
holding = true;
|
2006-06-21 01:32:01 +02:00
|
|
|
startedHolding = true;
|
2006-02-18 23:44:12 +01:00
|
|
|
CaptureMouse();
|
|
|
|
}
|
|
|
|
if (!event.ButtonIsDown(wxMOUSE_BTN_LEFT) && holding) {
|
|
|
|
holding = false;
|
|
|
|
ReleaseMouse();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Scroll to keep visible
|
|
|
|
if (holding) {
|
|
|
|
// Find direction
|
|
|
|
int minVis = yPos+1;
|
|
|
|
int maxVis = yPos+h/lineHeight-3;
|
|
|
|
int delta = 0;
|
|
|
|
if (row < minVis) delta = -1;
|
|
|
|
if (row > maxVis) delta = +1;
|
|
|
|
|
|
|
|
// Scroll
|
2006-06-21 01:32:01 +02:00
|
|
|
if (delta) {
|
|
|
|
ScrollTo(yPos+delta*3);
|
|
|
|
if (startedHolding) {
|
|
|
|
holding = false;
|
|
|
|
ReleaseMouse();
|
|
|
|
}
|
|
|
|
}
|
2006-02-18 23:44:12 +01:00
|
|
|
}
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
// Click
|
2010-06-26 13:32:16 +02:00
|
|
|
if ((click || holding || dclick) && dlg!=0) {
|
2006-02-22 03:25:45 +01:00
|
|
|
// Disable extending
|
|
|
|
extendRow = -1;
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
// Toggle selected
|
2006-02-22 00:27:34 +01:00
|
|
|
if (click && ctrl && !shift && !alt) {
|
2010-06-27 06:55:19 +02:00
|
|
|
bool isSel = IsInSelection(row,0);
|
|
|
|
if (isSel && selection.size() == 1) return;
|
|
|
|
SelectRow(row,true,!isSel);
|
2010-06-27 06:55:14 +02:00
|
|
|
if (dlg == GetActiveLine()) {
|
|
|
|
SetActiveLine(GetDialogue(GetFirstSelRow()));
|
|
|
|
}
|
2006-02-19 02:16:15 +01:00
|
|
|
parentFrame->UpdateToolbar();
|
2010-06-27 06:55:03 +02:00
|
|
|
lastRow = row;
|
2006-02-18 23:09:03 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Normal click
|
2006-03-01 05:32:00 +01:00
|
|
|
if ((click || dclick) && !shift && !ctrl && !alt) {
|
2010-06-26 13:32:16 +02:00
|
|
|
SetActiveLine(dlg);
|
2010-07-08 06:29:04 +02:00
|
|
|
if (dclick) context->JumpToTime(dlg->Start.GetMS());
|
2006-02-18 23:09:03 +01:00
|
|
|
SelectRow(row,false);
|
2006-02-19 02:16:15 +01:00
|
|
|
parentFrame->UpdateToolbar();
|
2006-02-18 23:09:03 +01:00
|
|
|
lastRow = row;
|
|
|
|
return;
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
2010-06-28 09:12:36 +02:00
|
|
|
// Keep selection
|
|
|
|
if (click && !shift && !ctrl && alt) {
|
|
|
|
SetActiveLine(dlg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
// Block select
|
2010-06-27 06:55:08 +02:00
|
|
|
if ((click && shift && !alt) || (holding && !ctrl && !alt && !shift)) {
|
2006-02-18 22:55:58 +01:00
|
|
|
if (lastRow != -1) {
|
|
|
|
// Set boundaries
|
|
|
|
int i1 = row;
|
|
|
|
int i2 = lastRow;
|
|
|
|
if (i1 > i2) {
|
2010-06-26 13:32:16 +02:00
|
|
|
std::swap(i1, i2);
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Toggle each
|
2010-06-26 13:32:16 +02:00
|
|
|
Selection newsel;
|
2010-06-27 06:55:08 +02:00
|
|
|
if (ctrl) newsel = selection;
|
2006-02-18 22:55:58 +01:00
|
|
|
for (int i=i1;i<=i2;i++) {
|
2010-06-26 13:32:16 +02:00
|
|
|
newsel.insert(GetDialogue(i));
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
2010-06-26 13:32:16 +02:00
|
|
|
SetSelectedSet(newsel);
|
|
|
|
|
2006-02-19 02:16:15 +01:00
|
|
|
parentFrame->UpdateToolbar();
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
2006-02-18 23:09:03 +01:00
|
|
|
return;
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Popup
|
|
|
|
if (event.ButtonDown(wxMOUSE_BTN_RIGHT)) {
|
2006-06-27 07:13:41 +02:00
|
|
|
OnPopupMenu(headerClick);
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Mouse wheel
|
|
|
|
if (event.GetWheelRotation() != 0) {
|
|
|
|
int step = 3 * event.GetWheelRotation() / event.GetWheelDelta();
|
2006-02-19 04:10:03 +01:00
|
|
|
ScrollTo(yPos - step);
|
2006-02-18 22:55:58 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Scroll to
|
|
|
|
/// @param y
|
|
|
|
///
|
2006-02-19 04:10:03 +01:00
|
|
|
void BaseGrid::ScrollTo(int y) {
|
|
|
|
int w,h;
|
|
|
|
GetClientSize(&w,&h);
|
|
|
|
int nextY = MID(0,y,GetRows()+2 - h/lineHeight);
|
|
|
|
if (yPos != nextY) {
|
|
|
|
yPos = nextY;
|
|
|
|
if (scrollBar->IsEnabled()) scrollBar->SetThumbPosition(yPos);
|
|
|
|
Refresh(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Adjust scrollbar
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
void BaseGrid::AdjustScrollbar() {
|
|
|
|
int w,h,sw,sh;
|
|
|
|
GetClientSize(&w,&h);
|
2006-02-19 04:10:03 +01:00
|
|
|
int drawPerScreen = h/lineHeight;
|
|
|
|
int rows = GetRows();
|
|
|
|
bool barToEnable = drawPerScreen < rows+2;
|
|
|
|
|
2006-02-22 07:08:35 +01:00
|
|
|
yPos = MID(0,yPos,rows - drawPerScreen);
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
scrollBar->Freeze();
|
|
|
|
scrollBar->GetSize(&sw,&sh);
|
2006-02-19 01:54:35 +01:00
|
|
|
scrollBar->SetSize(w-sw,0,sw,h);
|
2006-02-18 22:55:58 +01:00
|
|
|
|
2010-08-03 22:21:13 +02:00
|
|
|
if (barToEnable != scrollBar->IsEnabled()) scrollBar->Enable(barToEnable);
|
|
|
|
if (barToEnable) {
|
2006-02-19 04:10:03 +01:00
|
|
|
scrollBar->SetScrollbar(yPos,drawPerScreen,rows+2,drawPerScreen-2,true);
|
|
|
|
}
|
2006-02-18 22:55:58 +01:00
|
|
|
scrollBar->Thaw();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Set column widths
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-18 22:55:58 +01:00
|
|
|
void BaseGrid::SetColumnWidths() {
|
2009-07-27 01:24:21 +02:00
|
|
|
if (!IsShownOnScreen()) return;
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
// Width/height
|
|
|
|
int w = 0;
|
|
|
|
int h = 0;
|
|
|
|
GetClientSize(&w,&h);
|
|
|
|
|
|
|
|
// DC for text extents test
|
|
|
|
wxClientDC dc(this);
|
|
|
|
dc.SetFont(font);
|
|
|
|
int fw,fh;
|
|
|
|
//dc.GetTextExtent(_T("#TWFfgGhH"), &fw, &fh, NULL, NULL, &font);
|
|
|
|
|
|
|
|
// O(1) widths
|
|
|
|
dc.GetTextExtent(_T("0000"), &fw, &fh, NULL, NULL, &font);
|
|
|
|
int marginLen = fw + 10;
|
|
|
|
dc.GetTextExtent(wxString::Format(_T("%i"),GetRows()), &fw, &fh, NULL, NULL, &font);
|
|
|
|
int labelLen = fw + 10;
|
|
|
|
int startLen = 0;
|
|
|
|
int endLen = 0;
|
|
|
|
if (!byFrame) {
|
|
|
|
AssTime time;
|
|
|
|
dc.GetTextExtent(time.GetASSFormated(), &fw, &fh, NULL, NULL, &font);
|
2006-02-22 06:30:09 +01:00
|
|
|
startLen = fw + 10;
|
|
|
|
endLen = fw + 10;
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// O(n) widths
|
2007-07-03 03:48:04 +02:00
|
|
|
bool showMargin[3];
|
|
|
|
showMargin[0] = showMargin[1] = showMargin[2] = false;
|
|
|
|
bool showLayer = false;
|
2006-12-30 19:19:54 +01:00
|
|
|
int styleLen = 0;
|
2006-02-18 22:55:58 +01:00
|
|
|
int actorLen = 0;
|
|
|
|
int effectLen = 0;
|
2006-02-22 06:30:09 +01:00
|
|
|
int maxLayer = 0;
|
|
|
|
int maxStart = 0;
|
|
|
|
int maxEnd = 0;
|
2006-02-18 22:55:58 +01:00
|
|
|
AssDialogue *curDiag;
|
|
|
|
for (int i=0;i<GetRows();i++) {
|
|
|
|
curDiag = GetDialogue(i);
|
|
|
|
if (curDiag) {
|
|
|
|
// Layer
|
2007-07-03 03:48:04 +02:00
|
|
|
if (curDiag->Layer > maxLayer) {
|
|
|
|
maxLayer = curDiag->Layer;
|
|
|
|
showLayer = true;
|
|
|
|
}
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
// Actor
|
2006-02-22 06:30:09 +01:00
|
|
|
if (!curDiag->Actor.IsEmpty()) {
|
|
|
|
dc.GetTextExtent(curDiag->Actor, &fw, &fh, NULL, NULL, &font);
|
|
|
|
if (fw > actorLen) actorLen = fw;
|
|
|
|
}
|
2006-02-18 22:55:58 +01:00
|
|
|
|
2006-12-30 19:19:54 +01:00
|
|
|
// Style
|
|
|
|
if (!curDiag->Style.IsEmpty()) {
|
|
|
|
dc.GetTextExtent(curDiag->Style, &fw, &fh, NULL, NULL, &font);
|
|
|
|
if (fw > styleLen) styleLen = fw;
|
|
|
|
}
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
// Effect
|
2006-02-22 06:30:09 +01:00
|
|
|
if (!curDiag->Effect.IsEmpty()) {
|
|
|
|
dc.GetTextExtent(curDiag->Effect, &fw, &fh, NULL, NULL, &font);
|
|
|
|
if (fw > effectLen) effectLen = fw;
|
|
|
|
}
|
2006-02-18 22:55:58 +01:00
|
|
|
|
2007-07-03 03:48:04 +02:00
|
|
|
// Margins
|
|
|
|
for (int j=0;j<3;j++) {
|
|
|
|
if (curDiag->Margin[j] != 0) showMargin[j] = true;
|
|
|
|
}
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
// Times
|
|
|
|
if (byFrame) {
|
2010-07-08 06:29:04 +02:00
|
|
|
int tmp = context->FrameAtTime(curDiag->Start.GetMS(),agi::vfr::START);
|
2006-02-22 06:30:09 +01:00
|
|
|
if (tmp > maxStart) maxStart = tmp;
|
2010-07-08 06:29:04 +02:00
|
|
|
tmp = context->FrameAtTime(curDiag->End.GetMS(),agi::vfr::END);
|
2006-02-22 06:30:09 +01:00
|
|
|
if (tmp > maxEnd) maxEnd = tmp;
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-02-22 06:30:09 +01:00
|
|
|
|
|
|
|
// Finish layer
|
|
|
|
dc.GetTextExtent(wxString::Format(_T("%i"),maxLayer), &fw, &fh, NULL, NULL, &font);
|
|
|
|
int layerLen = fw + 10;
|
|
|
|
|
|
|
|
// Finish times
|
|
|
|
if (byFrame) {
|
|
|
|
dc.GetTextExtent(wxString::Format(_T("%i"),maxStart), &fw, &fh, NULL, NULL, &font);
|
|
|
|
startLen = fw + 10;
|
|
|
|
dc.GetTextExtent(wxString::Format(_T("%i"),maxEnd), &fw, &fh, NULL, NULL, &font);
|
|
|
|
endLen = fw + 10;
|
|
|
|
}
|
|
|
|
|
2006-12-30 19:19:54 +01:00
|
|
|
// Finish actor/effect/style
|
|
|
|
if (actorLen) actorLen += 10;
|
|
|
|
if (effectLen) effectLen += 10;
|
|
|
|
if (styleLen) styleLen += 10;
|
2006-02-18 22:55:58 +01:00
|
|
|
|
|
|
|
// Set column widths
|
|
|
|
colWidth[0] = labelLen;
|
2007-07-03 03:48:04 +02:00
|
|
|
colWidth[1] = showLayer ? layerLen : 0;
|
2006-02-18 22:55:58 +01:00
|
|
|
colWidth[2] = startLen;
|
|
|
|
colWidth[3] = endLen;
|
|
|
|
colWidth[4] = styleLen;
|
|
|
|
colWidth[5] = actorLen;
|
|
|
|
colWidth[6] = effectLen;
|
2007-07-03 03:48:04 +02:00
|
|
|
for (int i=0;i<3;i++) colWidth[i+7] = showMargin[i] ? marginLen : 0;
|
2006-02-18 22:55:58 +01:00
|
|
|
|
2006-06-27 07:13:41 +02:00
|
|
|
// Hide columns
|
2010-06-22 02:03:22 +02:00
|
|
|
for (int i=0;i<columns;i++) {
|
|
|
|
if (!showCol[i]) colWidth[i] = 0;
|
2006-06-27 07:13:41 +02:00
|
|
|
}
|
|
|
|
|
2006-02-18 22:55:58 +01:00
|
|
|
// Set size of last
|
|
|
|
int total = 0;
|
|
|
|
for (int i=0;i<10;i++) total+= colWidth[i];
|
|
|
|
colWidth[10] = w-total;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-06-26 09:26:27 +02:00
|
|
|
/// @brief Get dialogue by index
|
|
|
|
/// @param n Index to look up
|
|
|
|
/// @return Subtitle dialogue line for index, or 0 if invalid index
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
///
|
2010-05-26 09:17:34 +02:00
|
|
|
AssDialogue *BaseGrid::GetDialogue(int n) const {
|
2010-06-26 09:26:27 +02:00
|
|
|
if (n < 0 || n >= (int)index_line_map.size()) return 0;
|
|
|
|
return index_line_map[n];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// @brief Get index by dialogue line
|
|
|
|
/// @param diag Dialogue line to look up
|
|
|
|
/// @return Subtitle index for object, or -1 if unknown subtitle
|
|
|
|
int BaseGrid::GetDialogueIndex(AssDialogue *diag) const {
|
|
|
|
std::map<AssDialogue*,int>::const_iterator it = line_index_map.find(diag);
|
|
|
|
if (it != line_index_map.end()) return it->second;
|
|
|
|
else return -1;
|
2006-02-18 22:55:58 +01:00
|
|
|
}
|
2006-02-19 01:54:35 +01:00
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Check if line is being displayed
|
|
|
|
/// @param line
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-19 01:54:35 +01:00
|
|
|
bool BaseGrid::IsDisplayed(AssDialogue *line) {
|
2010-05-26 09:17:34 +02:00
|
|
|
VideoContext* con = VideoContext::Get();
|
|
|
|
if (!con->IsLoaded()) return false;
|
2010-07-20 05:11:11 +02:00
|
|
|
int frame = con->GetFrameN();
|
|
|
|
return
|
|
|
|
con->FrameAtTime(line->Start.GetMS(),agi::vfr::START) <= frame &&
|
|
|
|
con->FrameAtTime(line->End.GetMS(),agi::vfr::END) >= frame;
|
2006-02-19 01:54:35 +01:00
|
|
|
}
|
2006-02-21 03:01:42 +01:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @brief Key press
|
|
|
|
/// @param event
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-22 03:25:45 +01:00
|
|
|
void BaseGrid::OnKeyPress(wxKeyEvent &event) {
|
2006-02-22 04:38:23 +01:00
|
|
|
// Get size
|
|
|
|
int w,h;
|
|
|
|
GetClientSize(&w,&h);
|
|
|
|
|
|
|
|
// Get scan code
|
2007-01-22 20:31:49 +01:00
|
|
|
int key = event.GetKeyCode();
|
2007-09-22 00:56:44 +02:00
|
|
|
#ifdef __APPLE__
|
|
|
|
bool ctrl = event.m_metaDown;
|
|
|
|
#else
|
2006-02-22 21:20:45 +01:00
|
|
|
bool ctrl = event.m_controlDown;
|
2007-09-22 00:56:44 +02:00
|
|
|
#endif
|
2006-02-22 21:20:45 +01:00
|
|
|
bool alt = event.m_altDown;
|
|
|
|
bool shift = event.m_shiftDown;
|
2006-02-22 03:25:45 +01:00
|
|
|
|
|
|
|
// Left/right, forward to seek bar if video is loaded
|
|
|
|
if (key == WXK_LEFT || key == WXK_RIGHT) {
|
2010-07-08 06:29:04 +02:00
|
|
|
if (context->IsLoaded()) {
|
2007-01-21 18:01:22 +01:00
|
|
|
parentFrame->videoBox->videoSlider->SetFocus();
|
2009-06-12 01:30:33 +02:00
|
|
|
parentFrame->videoBox->videoSlider->GetEventHandler()->ProcessEvent(event);
|
2006-02-22 03:25:45 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
event.Skip();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-02-22 21:20:45 +01:00
|
|
|
// Select all
|
|
|
|
if (key == 'A' && ctrl && !alt && !shift) {
|
|
|
|
int rows = GetRows();
|
|
|
|
for (int i=0;i<rows;i++) SelectRow(i,true);
|
|
|
|
}
|
|
|
|
|
2006-02-22 03:25:45 +01:00
|
|
|
// Up/down
|
|
|
|
int dir = 0;
|
2006-02-22 04:38:23 +01:00
|
|
|
int step = 1;
|
2006-02-22 03:25:45 +01:00
|
|
|
if (key == WXK_UP) dir = -1;
|
|
|
|
if (key == WXK_DOWN) dir = 1;
|
2007-01-22 20:31:49 +01:00
|
|
|
if (key == WXK_PAGEUP) {
|
2006-02-22 04:38:23 +01:00
|
|
|
dir = -1;
|
|
|
|
step = h/lineHeight - 2;
|
|
|
|
}
|
2007-01-22 20:31:49 +01:00
|
|
|
if (key == WXK_PAGEDOWN) {
|
2006-02-22 04:38:23 +01:00
|
|
|
dir = 1;
|
|
|
|
step = h/lineHeight - 2;
|
|
|
|
}
|
|
|
|
if (key == WXK_HOME) {
|
|
|
|
dir = -1;
|
|
|
|
step = GetRows();
|
|
|
|
}
|
|
|
|
if (key == WXK_END) {
|
|
|
|
dir = 1;
|
|
|
|
step = GetRows();
|
|
|
|
}
|
2006-02-22 03:25:45 +01:00
|
|
|
|
|
|
|
// Moving
|
|
|
|
if (dir) {
|
|
|
|
// Move selection
|
|
|
|
if (!ctrl && !shift && !alt) {
|
2006-02-22 04:38:23 +01:00
|
|
|
// Move to extent first
|
2010-06-26 13:32:16 +02:00
|
|
|
int curLine = GetDialogueIndex(GetActiveLine());
|
2006-02-22 04:38:23 +01:00
|
|
|
if (extendRow != -1) {
|
|
|
|
curLine = extendRow;
|
|
|
|
extendRow = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int next = MID(0,curLine+dir*step,GetRows()-1);
|
2010-06-26 13:32:16 +02:00
|
|
|
SetActiveLine(GetDialogue(next));
|
2006-02-22 03:25:45 +01:00
|
|
|
SelectRow(next);
|
|
|
|
MakeCellVisible(next,0,false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Move active only
|
|
|
|
if (alt && !shift && !ctrl) {
|
2006-02-22 04:38:23 +01:00
|
|
|
extendRow = -1;
|
2010-06-26 13:32:16 +02:00
|
|
|
int next = MID(0,GetDialogueIndex(GetActiveLine())+dir*step,GetRows()-1);
|
|
|
|
SetActiveLine(GetDialogue(next));
|
2006-02-22 03:25:45 +01:00
|
|
|
Refresh(false);
|
|
|
|
MakeCellVisible(next,0,false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-02-22 04:38:23 +01:00
|
|
|
// Shift-selection
|
2006-02-22 03:25:45 +01:00
|
|
|
if (shift && !ctrl && !alt) {
|
2006-02-22 04:38:23 +01:00
|
|
|
// Find end
|
2010-06-26 13:32:16 +02:00
|
|
|
if (extendRow == -1) GetDialogueIndex(GetActiveLine());
|
2006-02-22 04:38:23 +01:00
|
|
|
extendRow = MID(0,extendRow+dir*step,GetRows()-1);
|
|
|
|
|
|
|
|
// Set range
|
2010-06-26 13:32:16 +02:00
|
|
|
int i1 = GetDialogueIndex(GetActiveLine());
|
2006-02-22 04:38:23 +01:00
|
|
|
int i2 = extendRow;
|
|
|
|
if (i2 < i1) {
|
2010-06-26 13:32:16 +02:00
|
|
|
std::swap(i1, i2);
|
2006-02-22 03:25:45 +01:00
|
|
|
}
|
|
|
|
|
2006-02-22 04:38:23 +01:00
|
|
|
// Select range
|
2010-06-26 13:32:16 +02:00
|
|
|
Selection newsel;
|
2006-02-22 04:38:23 +01:00
|
|
|
for (int i=i1;i<=i2;i++) {
|
2010-06-26 13:32:16 +02:00
|
|
|
newsel.insert(GetDialogue(i));
|
2006-02-22 03:25:45 +01:00
|
|
|
}
|
2010-06-26 13:32:16 +02:00
|
|
|
SetSelectedSet(newsel);
|
2006-02-22 03:25:45 +01:00
|
|
|
|
|
|
|
MakeCellVisible(extendRow,0,false);
|
2006-03-05 05:31:09 +01:00
|
|
|
return;
|
2006-02-22 03:25:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-05 05:31:09 +01:00
|
|
|
// Other events, send to audio display
|
2010-07-08 06:29:04 +02:00
|
|
|
if (context->audio->loaded) {
|
|
|
|
context->audio->GetEventHandler()->ProcessEvent(event);
|
2006-03-05 05:31:09 +01:00
|
|
|
}
|
|
|
|
else event.Skip();
|
2006-02-22 03:25:45 +01:00
|
|
|
}
|
2006-02-22 05:59:39 +01:00
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Sets display by frame or not
|
|
|
|
/// @param state
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-22 05:59:39 +01:00
|
|
|
void BaseGrid::SetByFrame (bool state) {
|
|
|
|
// Check if it's already the same
|
|
|
|
if (byFrame == state) return;
|
|
|
|
byFrame = state;
|
|
|
|
SetColumnWidths();
|
|
|
|
Refresh(false);
|
|
|
|
}
|
|
|
|
|
2006-02-22 07:08:35 +01:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Generates an array covering inclusive range
|
|
|
|
/// @param n1
|
|
|
|
/// @param n2
|
|
|
|
///
|
2010-05-26 09:17:34 +02:00
|
|
|
wxArrayInt BaseGrid::GetRangeArray(int n1,int n2) const {
|
2006-02-22 07:08:35 +01:00
|
|
|
// Swap if in wrong order
|
|
|
|
if (n2 < n1) {
|
|
|
|
int aux = n1;
|
|
|
|
n1 = n2;
|
|
|
|
n2 = aux;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Generate array
|
|
|
|
wxArrayInt target;
|
|
|
|
for (int i=n1;i<=n2;i++) {
|
|
|
|
target.Add(i);
|
|
|
|
}
|
|
|
|
return target;
|
|
|
|
}
|
2009-07-29 07:43:02 +02:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
Remove the SelectionChangeSubscriber mechanism from the grid and implement some basic selection change notification through SelectionController.
Change SelectionListener interface so it receives the set of lines added and removed from selection, instead of just the complete new selection.
Update VisualTool<> to use SelectionListener to receive selection change notifications.
This change (temporarily, I hope) breaks feature selection in visual drag mode, when changing selection via the grid. This is caused by the grid selection change first clearing the entire selection, which sends a separate notification about selection clear. This causes the last visual feature to be deselected, and then the visual tool base reselects the active line, causing a new notification for selection to be sent. The active line happens to be the newly clicked line, and the selection notification enters during the externalChange guard being set, and is then ignored for feature update purposes. When control returns to the original SelectRow call in the grid, the line to be selected has already been selected and then nothing happens.
The best fix is to avoid two notifications being required to deselect all then reselect one line in the first place, so making the grid selection handling saner is the best fix.
Originally committed to SVN as r4602.
2010-06-26 06:38:02 +02:00
|
|
|
|
|
|
|
// SelectionController
|
|
|
|
|
|
|
|
|
2010-06-26 09:26:27 +02:00
|
|
|
void BaseGrid::SetSelectedSet(const Selection &new_selection) {
|
2010-06-28 09:13:03 +02:00
|
|
|
Selection inserted;
|
|
|
|
Selection removed;
|
|
|
|
set_difference(new_selection, selection, inserted);
|
|
|
|
set_difference(selection, new_selection, removed);
|
2010-06-26 09:26:27 +02:00
|
|
|
selection = new_selection;
|
2010-06-28 09:13:03 +02:00
|
|
|
AnnounceSelectedSetChanged(inserted, removed);
|
2010-06-26 13:32:16 +02:00
|
|
|
Refresh(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BaseGrid::SetActiveLine(AssDialogue *new_line) {
|
|
|
|
if (new_line != active_line) {
|
|
|
|
assert(new_line == 0 || line_index_map.find(new_line) != line_index_map.end());
|
|
|
|
active_line = new_line;
|
|
|
|
AnnounceActiveLineChanged(active_line);
|
|
|
|
Refresh(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BaseGrid::PrevLine() {
|
|
|
|
int cur_line_i = GetDialogueIndex(GetActiveLine());
|
|
|
|
AssDialogue *prev_line = GetDialogue(cur_line_i-1);
|
|
|
|
if (prev_line) {
|
|
|
|
SetActiveLine(prev_line);
|
|
|
|
Selection newsel;
|
|
|
|
newsel.insert(prev_line);
|
|
|
|
SetSelectedSet(newsel);
|
|
|
|
MakeCellVisible(cur_line_i-1, 0, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BaseGrid::NextLine() {
|
|
|
|
int cur_line_i = GetDialogueIndex(GetActiveLine());
|
|
|
|
AssDialogue *next_line = GetDialogue(cur_line_i+1);
|
|
|
|
if (next_line) {
|
|
|
|
SetActiveLine(next_line);
|
|
|
|
Selection newsel;
|
|
|
|
newsel.insert(next_line);
|
|
|
|
SetSelectedSet(newsel);
|
|
|
|
MakeCellVisible(cur_line_i+1, 0, false);
|
|
|
|
}
|
2010-06-26 09:26:27 +02:00
|
|
|
}
|
|
|
|
|
2010-06-26 17:40:10 +02:00
|
|
|
|
|
|
|
void BaseGrid::AnnounceActiveLineChanged(AssDialogue *new_line) {
|
|
|
|
if (batch_level > 0)
|
|
|
|
batch_active_line_changed = true;
|
|
|
|
else
|
2010-06-27 05:24:03 +02:00
|
|
|
BaseSelectionController<AssDialogue>::AnnounceActiveLineChanged(new_line);
|
2010-06-26 17:40:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void BaseGrid::AnnounceSelectedSetChanged(const Selection &lines_added, const Selection &lines_removed) {
|
|
|
|
if (batch_level > 0) {
|
|
|
|
// Remove all previously added lines that are now removed
|
2010-06-27 05:24:03 +02:00
|
|
|
Selection temp;
|
2010-06-28 09:13:03 +02:00
|
|
|
set_difference(batch_selection_added, lines_removed, temp);
|
2010-06-27 05:24:03 +02:00
|
|
|
std::swap(temp, batch_selection_added);
|
|
|
|
temp.clear();
|
|
|
|
|
2010-06-26 17:40:10 +02:00
|
|
|
// Remove all previously removed lines that are now added
|
2010-06-28 09:13:03 +02:00
|
|
|
set_difference(batch_selection_removed, lines_added, temp);
|
2010-06-27 05:24:03 +02:00
|
|
|
std::swap(temp, batch_selection_removed);
|
|
|
|
|
2010-06-26 17:40:10 +02:00
|
|
|
// Add new stuff to batch sets
|
|
|
|
batch_selection_added.insert(lines_added.begin(), lines_added.end());
|
|
|
|
batch_selection_removed.insert(lines_removed.begin(), lines_removed.end());
|
|
|
|
}
|
|
|
|
else {
|
2010-06-27 05:24:03 +02:00
|
|
|
BaseSelectionController<AssDialogue>::AnnounceSelectedSetChanged(lines_added, lines_removed);
|
2010-06-26 17:40:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|