New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement new timeline with collapsed/hidden tags #4409
base: beta
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 25 out of 48. Check the log or trigger a new build to see more.
@@ -52,10 +51,10 @@ void NewFrameTagCommand::onExecute(Context* context) | |||
frame_t from = reader.frame(); | |||
frame_t to = reader.frame(); | |||
|
|||
auto range = App::instance()->timeline()->range(); | |||
view::RealRange range = context->range(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'range' of type 'view::RealRange' (aka 'view::Range') can be declared 'const' [misc-const-correctness]
view::RealRange range = context->range(); | |
view::RealRange const range = context->range(); |
|
||
void CollapseTagCommand::onLoadParams(const Params& params) | ||
{ | ||
std::string id = params.get("id"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'id' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]
std::string id = params.get("id"); | |
std::string const id = params.get("id"); |
bool CollapseTagCommand::onChecked(Context* ctx) | ||
{ | ||
const ContextReader reader(ctx); | ||
auto tag = this->tag(ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'auto tag' can be declared as 'auto *tag' [readability-qualified-auto]
auto tag = this->tag(ctx); | |
auto *tag = this->tag(ctx); |
{ | ||
const ContextReader reader(ctx); | ||
auto tag = this->tag(ctx); | ||
return (tag && tag->isCollapsed()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: implicit conversion 'Tag *' -> bool [readability-implicit-bool-conversion]
return (tag && tag->isCollapsed()); | |
return ((tag != nullptr) && tag->isCollapsed()); |
|
||
void CollapseTagCommand::onExecute(Context* ctx) | ||
{ | ||
auto tag = this->tag(ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'auto tag' can be declared as 'auto *tag' [readability-qualified-auto]
auto tag = this->tag(ctx); | |
auto *tag = this->tag(ctx); |
frameBoxWidth()); | ||
} | ||
|
||
view::col_t Timeline::getFrameInXPos(const int x) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'getFrameInXPos' can be made static [readability-convert-member-functions-to-static]
view::col_t Timeline::getFrameInXPos(const int x) const | |
view::col_t Timeline::getFrameInXPos(const int x) |
src/app/ui/timeline/timeline.h:349:
- col_t getFrameInXPos(const int x) const;
+ static col_t getFrameInXPos(const int x) ;
int x = 0; | ||
for (; f<nframes; f=col_t(f+1)) { | ||
int duration = m_adapter->frameDuration(f); | ||
int w = frameBoxWidth(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'w' of type 'int' can be declared 'const' [misc-const-correctness]
int w = frameBoxWidth(); | |
int const w = frameBoxWidth(); |
int Timeline::calcTagVisibleToFrame(Tag* tag) const | ||
// Returns the last frame where the frame tag (or tag label) is | ||
// visible in the timeline. | ||
view::col_t Timeline::calcTagVisibleToFrame(Tag* tag) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'calcTagVisibleToFrame' can be made static [readability-convert-member-functions-to-static]
view::col_t Timeline::calcTagVisibleToFrame(Tag* tag) const | |
view::col_t Timeline::calcTagVisibleToFrame(Tag* tag) |
src/app/ui/timeline/timeline.h:407:
- col_t calcTagVisibleToFrame(Tag* tag) const;
+ static col_t calcTagVisibleToFrame(Tag* tag) ;
@@ -260,16 +290,16 @@ namespace app { | |||
void handleRangeMouseDown(const ui::Message* msg, | |||
const Range::Type rangeType, | |||
doc::Layer* fromLayer, | |||
const doc::frame_t fromFrame); | |||
const col_t fromFrame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'fromFrame' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const col_t fromFrame); | |
col_t fromFrame); |
|
||
void handleRangeMouseMove(doc::Layer* fromLayer, | ||
const doc::frame_t fromFrame); | ||
const col_t fromFrame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'fromFrame' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const col_t fromFrame); | |
col_t fromFrame); |
* Moved app::DocRange to view::Range * Moved range_utils to view/cels.cpp * Moved layer_utils to view/layers.cpp * Created more functions in app::Site to access selected cels (they use the functions from view/cels.h)
…prite#3904) - Now we have a view::RealRange (with real frames, fr_t) and a view::VirtualRange (with virtual frames, columns, col_t). The timeline uses a virtual range internally and makes the conversion to a real range when it's appropiated (e.g. to execute an old DocRange operation using ranges with real frames). - Added Context::range() to access to the real selected range instead of accessing directly to the timeline. In this way commands that were using the DocRange can access to the real range using the context, instead of the timeline's virtual range. - Added a new ShowTagTimelineAdapter that can show just one tag in the timeline filtering out/hiding all other frames/tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
@@ -289,13 +320,13 @@ namespace app { | |||
const bool is_disabled = false); | |||
void drawTop(ui::Graphics* g); | |||
void drawHeader(ui::Graphics* g); | |||
void drawHeaderFrame(ui::Graphics* g, const frame_t frame); | |||
void drawHeaderFrame(ui::Graphics* g, const col_t col); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'col' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
void drawHeaderFrame(ui::Graphics* g, const col_t col); | |
void drawHeaderFrame(ui::Graphics* g, col_t col); |
void drawLayer(ui::Graphics* g, const layer_t layerIdx); | ||
void drawCel(ui::Graphics* g, | ||
const layer_t layerIdx, const frame_t frame, | ||
const layer_t layerIdx, const col_t col, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'layerIdx' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const layer_t layerIdx, const col_t col, | |
layer_t layerIdx, const col_t col, |
void drawLayer(ui::Graphics* g, const layer_t layerIdx); | ||
void drawCel(ui::Graphics* g, | ||
const layer_t layerIdx, const frame_t frame, | ||
const layer_t layerIdx, const col_t col, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'col' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const layer_t layerIdx, const col_t col, | |
const layer_t layerIdx, col_t col, |
const Cel* cel, const DrawCelData* data); | ||
void drawCelLinkDecorators(ui::Graphics* g, const gfx::Rect& bounds, | ||
const Cel* cel, const frame_t frame, | ||
const Cel* cel, const col_t col, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'col' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const Cel* cel, const col_t col, | |
const Cel* cel, col_t col, |
@@ -314,10 +345,14 @@ | |||
gfx::Rect getPartBounds(const Hit& hit) const; | |||
gfx::Rect getRangeBounds(const Range& range) const; | |||
gfx::Rect getRangeClipBounds(const Range& range) const; | |||
int getFrameXPos(const col_t frame) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'frame' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
int getFrameXPos(const col_t frame) const; | |
int getFrameXPos(col_t frame) const; |
@@ -64,7 +67,7 @@ namespace app { | |||
void cut(ContextWriter& context); | |||
void copy(const ContextReader& context); | |||
void copyMerged(const ContextReader& context); | |||
void copyRange(const ContextReader& context, const DocRange& range); | |||
void copyRange(const ContextReader& context, const view::Range& range); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: function 'app::Clipboard::copyRange' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
void copyRange(const ContextReader& context, const view::Range& range);
^
Additional context
src/app/util/clipboard.cpp:399: the definition seen here
void Clipboard::copyRange(const ContextReader& reader, const DocRange& range)
^
src/app/util/clipboard.h:69: differing parameters are named here: ('context'), in definition: ('reader')
void copyRange(const ContextReader& context, const view::Range& range);
^
@@ -1161,7 +1161,8 @@ void AsepriteDecoder::readTagsChunk(doc::Tags* tags) | |||
} | |||
|
|||
int repeat = read16(); // Number of times we repeat this tag | |||
read16(); // 6 reserved bytes | |||
int flags = read8(); // Flags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'flags' of type 'int' can be declared 'const' [misc-const-correctness]
int flags = read8(); // Flags | |
int const flags = read8(); // Flags |
CelList CelsRange::toList() | ||
{ | ||
CelList list; | ||
int n = size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'n' of type 'int' can be declared 'const' [misc-const-correctness]
int n = size(); | |
int const n = size(); |
else | ||
return kNoCol; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: do not use 'else' after 'return' [readability-else-after-return]
else | |
return kNoCol; | |
return kNoCol; |
if (range.enabled()) { | ||
doc::SelectedFrames frames; | ||
for (auto frame : realRange.selectedFrames()) { | ||
col_t col = adapter->toColFrame(fr_t(frame)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'col' of type 'col_t' can be declared 'const' [misc-const-correctness]
col_t col = adapter->toColFrame(fr_t(frame)); | |
col_t const col = adapter->toColFrame(fr_t(frame)); |
First progress for #3904 and #920
One commit ("Add support for variable frame width in Timeline") comes from #3583 and we're not sure if it will be finally required.