-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SeqView And Update Scroller item num
- Loading branch information
1 parent
9048e9c
commit 1d92d2c
Showing
12 changed files
with
179 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#include "SeqView.h" | ||
#include "../lookAndFeel/LookAndFeelFactory.h" | ||
#include "../Utils.h" | ||
|
||
SeqView::SeqView() | ||
: FlowComponent(TRANS("Track")) { | ||
/** Look And Feel */ | ||
this->setLookAndFeel( | ||
LookAndFeelFactory::getInstance()->forSeq()); | ||
|
||
/** Scroller */ | ||
this->hScroller = std::make_unique<Scroller>(false, | ||
[this] { return this->getViewWidth(); }, | ||
[this] { return this->getTimeLength(); }, | ||
[this] { return this->getTimeWidthLimit(); }, | ||
[this](int pos, int itemSize) { this->updateHPos(pos, itemSize); }, | ||
Scroller::PaintPreviewFunc{}, | ||
Scroller::PaintItemPreviewFunc{}); | ||
this->addAndMakeVisible(this->hScroller.get()); | ||
|
||
this->vScroller = std::make_unique<Scroller>(true, | ||
[this] { return this->getViewHeight(); }, | ||
[this] { return (double)this->getTrackNum(); }, | ||
[this] { return this->getTrackHeightLimit(); }, | ||
[this](int pos, int itemSize) { this->updateVPos(pos, itemSize); }, | ||
Scroller::PaintPreviewFunc{}, | ||
Scroller::PaintItemPreviewFunc{}); | ||
this->addAndMakeVisible(this->vScroller.get()); | ||
} | ||
|
||
void SeqView::resized() { | ||
/** Size */ | ||
auto screenSize = utils::getScreenSize(this); | ||
int scrollerHeight = screenSize.getHeight() * 0.0275; | ||
int scrollerWidth = screenSize.getWidth() * 0.015; | ||
int rulerHeight = screenSize.getHeight() * 0.025; | ||
int headWidth = screenSize.getWidth() * 0.1; | ||
|
||
/** Scroller */ | ||
juce::Rectangle<int> hScrollerRect( | ||
headWidth, this->getHeight() - scrollerHeight, | ||
this->getWidth() - headWidth - scrollerWidth, scrollerHeight); | ||
this->hScroller->setBounds(hScrollerRect); | ||
juce::Rectangle<int> vScrollerRect( | ||
this->getWidth() - scrollerWidth, rulerHeight, | ||
scrollerWidth, this->getHeight() - rulerHeight - scrollerHeight); | ||
this->vScroller->setBounds(vScrollerRect); | ||
|
||
/** Update View Pos */ | ||
this->hScroller->update(); | ||
this->vScroller->update(); | ||
} | ||
|
||
int SeqView::getViewWidth() const { | ||
return this->hScroller->getWidth(); | ||
} | ||
|
||
double SeqView::getTimeLength() const { | ||
/** TODO */ | ||
return 0; | ||
} | ||
|
||
std::tuple<int, int> SeqView::getTimeWidthLimit() const { | ||
auto screenSize = utils::getScreenSize(this); | ||
return { (int)(screenSize.getWidth() * 0.02), (int)(screenSize.getWidth() * 0.2) }; | ||
} | ||
|
||
void SeqView::updateHPos(int pos, int itemSize) { | ||
/** TODO */ | ||
} | ||
|
||
int SeqView::getViewHeight() const { | ||
return this->vScroller->getHeight(); | ||
} | ||
|
||
int SeqView::getTrackNum() const { | ||
/** TODO */ | ||
return 0; | ||
} | ||
|
||
std::tuple<int, int> SeqView::getTrackHeightLimit() const { | ||
auto screenSize = utils::getScreenSize(this); | ||
return { (int)(screenSize.getHeight() * 0.025), (int)(screenSize.getWidth() * 0.4) }; | ||
} | ||
|
||
void SeqView::updateVPos(int pos, int itemSize) { | ||
/** TODO */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
#include <JuceHeader.h> | ||
#include <FlowUI.h> | ||
#include "Scroller.h" | ||
|
||
class SeqView final | ||
: public flowUI::FlowComponent, | ||
public juce::DragAndDropContainer { | ||
public: | ||
SeqView(); | ||
|
||
void resized() override; | ||
|
||
private: | ||
std::unique_ptr<Scroller> hScroller = nullptr; | ||
std::unique_ptr<Scroller> vScroller = nullptr; | ||
|
||
int getViewWidth() const; | ||
double getTimeLength() const; | ||
std::tuple<int, int> getTimeWidthLimit() const; | ||
|
||
void updateHPos(int pos, int itemSize); | ||
|
||
int getViewHeight() const; | ||
int getTrackNum() const; | ||
std::tuple<int, int> getTrackHeightLimit() const; | ||
|
||
void updateVPos(int pos, int itemSize); | ||
|
||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SeqView) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "SeqLookAndFeel.h" | ||
#include "../misc/ColorMap.h" | ||
|
||
SeqLookAndFeel::SeqLookAndFeel() | ||
: MainLookAndFeel() { | ||
/** Background */ | ||
this->setColour(juce::ResizableWindow::ColourIds::backgroundColourId, | ||
ColorMap::getInstance()->get("ThemeColorB1")); | ||
|
||
/** Track */ | ||
this->setColour(juce::Label::ColourIds::backgroundColourId, | ||
ColorMap::getInstance()->get("ThemeColorB2"));/**< Track Background */ | ||
this->setColour(juce::Label::ColourIds::textColourId, | ||
ColorMap::getInstance()->get("ThemeColorB10"));/**< Item Name Light */ | ||
this->setColour(juce::Label::ColourIds::outlineColourId, | ||
ColorMap::getInstance()->get("ThemeColorB1"));/**< Track Outline */ | ||
this->setColour(juce::Label::ColourIds::backgroundWhenEditingColourId, | ||
ColorMap::getInstance()->get("ThemeColorB2")); | ||
this->setColour(juce::Label::ColourIds::textWhenEditingColourId, | ||
ColorMap::getInstance()->get("ThemeColorB0"));/**< Item Name Dark */ | ||
this->setColour(juce::Label::ColourIds::outlineWhenEditingColourId, | ||
ColorMap::getInstance()->get("ThemeColorA2"));/**< Track Hovered Outline */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <JuceHeader.h> | ||
#include "MainLookAndFeel.h" | ||
|
||
class SeqLookAndFeel : public MainLookAndFeel { | ||
public: | ||
SeqLookAndFeel(); | ||
|
||
private: | ||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SeqLookAndFeel) | ||
}; |