<commit_before>#include "KeysPanel.h"
#include "StagePanel.h"
#include "KeysScaleWidget.h"
#include "KeysContentWidget.h"

#include "dataset/KeyFrame.h"
#include "dataset/Layer.h"
#include "dataset/LayersMgr.h"
#include "dataset/DataMgr.h"
#include "message/messages.h"
#include "view/ViewMgr.h"

#include <ee/ViewlistPanel.h>

namespace eanim
{

KeysPanel::KeysPanel(wxWindow* parent)
	: wxScrolledWindow(parent)
	, m_layer(NULL)
{
	m_selected_row = m_selected_col = -1;

	InitLayout();

	RegistSubject(SetSelectedSJ::Instance());
}

void KeysPanel::GetSelectPos(int& row, int& col) const
{
	row = m_selected_row;
	col = m_selected_col;
}

void KeysPanel::OnNotify(int sj_id, void* ud)
{
	switch (sj_id)
	{
	case MSG_SET_CURR_FRAME:
		{
			SetSelectedSJ::Position* cf = (SetSelectedSJ::Position*)ud;
			if (cf->layer == -1 && cf->frame == -1) {
				m_selected_row = m_selected_col = -1;
				m_layer = NULL;
				ViewMgr::Instance()->viewlist->Clear();
				return;
			}

			int row = cf->layer == -1 ? m_selected_row : DataMgr::Instance()->GetLayers().Size() - 1 - cf->layer;
			int col = cf->frame == -1 ? m_selected_col : cf->frame;
			if (row == -1) {
				return;
			}
			if (row == m_selected_row && col == m_selected_col) {
				return;
			}

			if (row != m_selected_row) {
				m_selected_row = row;
				assert(cf->layer < DataMgr::Instance()->GetLayers().Size());
				m_layer = DataMgr::Instance()->GetLayers().GetLayer(cf->layer);
			}
			if (col != m_selected_col) {
				m_selected_col = col;
			}
		}
		break;
	}
}

void KeysPanel::InitLayout()
{
	SetScrollbars(1, 1, 20, 10, 0, 0);

	wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
	sizer->Add(new KeysScaleWidget(this), 1, wxEXPAND);
	sizer->Add(new KeysContentWidget(this), 99, wxEXPAND);

	wxBoxSizer* hori_sizer = new wxBoxSizer(wxHORIZONTAL);
	hori_sizer->AddSpacer(6000);	// todo
	sizer->Add(hori_sizer);

// 	wxBoxSizer* vert_sizer = new wxBoxSizer(wxVERTICAL);
// 	vert_sizer->AddSpacer(50);
// 	sizer->Add(vert_sizer);

	SetSizer(sizer);
}

} // eanim<commit_msg>[CHANGED] max frames<commit_after>#include "KeysPanel.h"
#include "StagePanel.h"
#include "KeysScaleWidget.h"
#include "KeysContentWidget.h"

#include "dataset/KeyFrame.h"
#include "dataset/Layer.h"
#include "dataset/LayersMgr.h"
#include "dataset/DataMgr.h"
#include "message/messages.h"
#include "view/ViewMgr.h"

#include <ee/ViewlistPanel.h>

namespace eanim
{

KeysPanel::KeysPanel(wxWindow* parent)
	: wxScrolledWindow(parent)
	, m_layer(NULL)
{
	m_selected_row = m_selected_col = -1;

	InitLayout();

	RegistSubject(SetSelectedSJ::Instance());
}

void KeysPanel::GetSelectPos(int& row, int& col) const
{
	row = m_selected_row;
	col = m_selected_col;
}

void KeysPanel::OnNotify(int sj_id, void* ud)
{
	switch (sj_id)
	{
	case MSG_SET_CURR_FRAME:
		{
			SetSelectedSJ::Position* cf = (SetSelectedSJ::Position*)ud;
			if (cf->layer == -1 && cf->frame == -1) {
				m_selected_row = m_selected_col = -1;
				m_layer = NULL;
				ViewMgr::Instance()->viewlist->Clear();
				return;
			}

			int row = cf->layer == -1 ? m_selected_row : DataMgr::Instance()->GetLayers().Size() - 1 - cf->layer;
			int col = cf->frame == -1 ? m_selected_col : cf->frame;
			if (row == -1) {
				return;
			}
			if (row == m_selected_row && col == m_selected_col) {
				return;
			}

			if (row != m_selected_row) {
				m_selected_row = row;
				assert(cf->layer < DataMgr::Instance()->GetLayers().Size());
				m_layer = DataMgr::Instance()->GetLayers().GetLayer(cf->layer);
			}
			if (col != m_selected_col) {
				m_selected_col = col;
			}
		}
		break;
	}
}

void KeysPanel::InitLayout()
{
	SetScrollbars(1, 1, 20, 10, 0, 0);

	wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
	sizer->Add(new KeysScaleWidget(this), 1, wxEXPAND);
	sizer->Add(new KeysContentWidget(this), 99, wxEXPAND);

	wxBoxSizer* hori_sizer = new wxBoxSizer(wxHORIZONTAL);
//	hori_sizer->AddSpacer(6000);	// todo
	hori_sizer->AddSpacer(1200);	// todo
	sizer->Add(hori_sizer);

// 	wxBoxSizer* vert_sizer = new wxBoxSizer(wxVERTICAL);
// 	vert_sizer->AddSpacer(50);
// 	sizer->Add(vert_sizer);

	SetSizer(sizer);
}

} // eanim
{'fraction_non_alphanumeric': 0.16719396446824045, 'fraction_numerical': 0.013141883669992699, 'mean_word_length': 4.229007633587786, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5821901', 'n_tokens_mistral': 1810, 'n_tokens_neox': 1639, 'n_words': 285}