Sample editor back working.
This commit is contained in:
parent
722bda2801
commit
7ad237edc1
10 changed files with 59 additions and 36 deletions
|
@ -29,18 +29,22 @@ void MediaTool::initializeViews()
|
||||||
auto textEditor = TextEditorView::Create();
|
auto textEditor = TextEditorView::Create();
|
||||||
auto path = mMainApplication->getCommandLineArgs()->getLaunchPath();
|
auto path = mMainApplication->getCommandLineArgs()->getLaunchPath();
|
||||||
path /= "out.txt";
|
path /= "out.txt";
|
||||||
|
textEditor->setName("TextEditor");
|
||||||
textEditor->GetController()->SetSavePath(path);
|
textEditor->GetController()->SetSavePath(path);
|
||||||
textEditor->GetController()->SetLoadPath(path);
|
textEditor->GetController()->SetLoadPath(path);
|
||||||
textEditor->Initialize();
|
textEditor->Initialize();
|
||||||
tabbedPanel->addPanel(std::move(textEditor), "Text Editor");
|
tabbedPanel->addPanel(std::move(textEditor), "Text Editor");
|
||||||
|
|
||||||
auto audioEditor = AudioEditorView::Create();
|
auto audioEditor = AudioEditorView::Create();
|
||||||
tabbedPanel->addPanel(std::move(audioEditor), "Audio Editor");
|
audioEditor->setName("audioEditor");
|
||||||
|
tabbedPanel->addPanel(std::move(audioEditor), "audio Editor");
|
||||||
|
|
||||||
auto imageEditor = ImageEditorView::Create();
|
auto imageEditor = ImageEditorView::Create();
|
||||||
|
imageEditor->setName("imageEditor");
|
||||||
tabbedPanel->addPanel(std::move(imageEditor), "Image Editor");
|
tabbedPanel->addPanel(std::move(imageEditor), "Image Editor");
|
||||||
|
|
||||||
auto webClient = WebClientView::Create();
|
auto webClient = WebClientView::Create();
|
||||||
|
webClient->setName("webClient");
|
||||||
tabbedPanel->addPanel(std::move(webClient), "Web Client");
|
tabbedPanel->addPanel(std::move(webClient), "Web Client");
|
||||||
|
|
||||||
auto topBar = TopBar::Create();
|
auto topBar = TopBar::Create();
|
||||||
|
@ -51,20 +55,5 @@ void MediaTool::initializeViews()
|
||||||
horizontal_spacer->addWidgetWithScale(std::move(tabbedPanel), 20);
|
horizontal_spacer->addWidgetWithScale(std::move(tabbedPanel), 20);
|
||||||
horizontal_spacer->addWidgetWithScale(std::move(statusBar), 1);
|
horizontal_spacer->addWidgetWithScale(std::move(statusBar), 1);
|
||||||
|
|
||||||
/*
|
|
||||||
auto button = Button::Create();
|
|
||||||
button->setLabel("Click!");
|
|
||||||
button->setBounds(100, 200);
|
|
||||||
button->setBackgroundColor(Color(255, 0, 255, 1));
|
|
||||||
|
|
||||||
auto background_widget = Widget::Create();
|
|
||||||
background_widget->setName("BackgroundWidget");
|
|
||||||
background_widget->setBackgroundColor(Color(0, 255, 255, 1));
|
|
||||||
|
|
||||||
auto horizontal_spacer = HorizontalSpacer::Create();
|
|
||||||
horizontal_spacer->addWidgetWithScale(std::move(button), 1);
|
|
||||||
horizontal_spacer->addWidgetWithScale(std::move(background_widget), 1);
|
|
||||||
*/
|
|
||||||
|
|
||||||
mainWindow->setWidget(std::move(horizontal_spacer));
|
mainWindow->setWidget(std::move(horizontal_spacer));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
AudioEditorView::AudioEditorView()
|
AudioEditorView::AudioEditorView()
|
||||||
{
|
{
|
||||||
auto label = Label::Create();
|
auto label = Label::Create();
|
||||||
label->setLabel("Audio Editor");
|
label->setLabel("audio Editor");
|
||||||
label->setBackgroundColor(Color(200, 189, 160));
|
label->setBackgroundColor(Color(200, 189, 160));
|
||||||
label->setMargin(1);
|
label->setMargin(1);
|
||||||
addWidget(std::move(label));
|
addWidget(std::move(label));
|
||||||
|
|
|
@ -78,6 +78,11 @@ void Button::updateLabel(const PaintEvent* event)
|
||||||
mRootNode->addChild(mTextNode.get());
|
mRootNode->addChild(mTextNode.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mTransformDirty)
|
||||||
|
{
|
||||||
|
mTextNode->setLocation(middle);
|
||||||
|
}
|
||||||
|
|
||||||
if (mMaterialDirty)
|
if (mMaterialDirty)
|
||||||
{
|
{
|
||||||
mTextNode->setFillColor(mBackgroundColor);
|
mTextNode->setFillColor(mBackgroundColor);
|
||||||
|
@ -88,4 +93,9 @@ void Button::updateLabel(const PaintEvent* event)
|
||||||
mTextNode->setContent(mLabel);
|
mTextNode->setContent(mLabel);
|
||||||
mContentDirty = false;
|
mContentDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mVisibilityDirty)
|
||||||
|
{
|
||||||
|
mTextNode->setIsVisible(mVisible);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ Label::Label()
|
||||||
: Widget(),
|
: Widget(),
|
||||||
mLabel()
|
mLabel()
|
||||||
{
|
{
|
||||||
|
mName = "Label";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Label> Label::Create()
|
std::unique_ptr<Label> Label::Create()
|
||||||
|
@ -52,9 +52,19 @@ void Label::updateLabel(const PaintEvent* event)
|
||||||
mTextNode->setFillColor(mBackgroundColor);
|
mTextNode->setFillColor(mBackgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mTransformDirty)
|
||||||
|
{
|
||||||
|
mTextNode->setLocation(middle);
|
||||||
|
}
|
||||||
|
|
||||||
if (mContentDirty)
|
if (mContentDirty)
|
||||||
{
|
{
|
||||||
mTextNode->setContent(mLabel);
|
mTextNode->setContent(mLabel);
|
||||||
mContentDirty = false;
|
mContentDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mVisibilityDirty)
|
||||||
|
{
|
||||||
|
mTextNode->setIsVisible(mVisible);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "StackWidget.h"
|
#include "StackWidget.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
StackWidget::StackWidget()
|
StackWidget::StackWidget()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -130,13 +130,14 @@ void Widget::setVisible(bool visible)
|
||||||
if (mVisible != visible)
|
if (mVisible != visible)
|
||||||
{
|
{
|
||||||
mVisibilityDirty = true;
|
mVisibilityDirty = true;
|
||||||
}
|
|
||||||
mVisible = visible;
|
mVisible = visible;
|
||||||
|
|
||||||
for (auto& child : mChildren)
|
for (auto& child : mChildren)
|
||||||
{
|
{
|
||||||
child->setVisible(mVisible);
|
child->setVisible(mVisible);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Widget::isDirty() const
|
bool Widget::isDirty() const
|
||||||
|
@ -174,10 +175,15 @@ void Widget::onPaintEvent(const PaintEvent* event)
|
||||||
|
|
||||||
if (isDirty())
|
if (isDirty())
|
||||||
{
|
{
|
||||||
mRootNode->setName(mName);
|
mRootNode->setName(mName + "_RootNode");
|
||||||
|
|
||||||
doPaint(event);
|
doPaint(event);
|
||||||
|
|
||||||
|
if (mVisibilityDirty)
|
||||||
|
{
|
||||||
|
mRootNode->setIsVisible(mVisible);
|
||||||
|
}
|
||||||
|
|
||||||
mTransformDirty = false;
|
mTransformDirty = false;
|
||||||
mMaterialDirty = false;
|
mMaterialDirty = false;
|
||||||
mVisibilityDirty = false;
|
mVisibilityDirty = false;
|
||||||
|
@ -203,7 +209,6 @@ void Widget::updateChildLocations()
|
||||||
{
|
{
|
||||||
child->setBounds(mSize.mWidth, mSize.mHeight);
|
child->setBounds(mSize.mWidth, mSize.mHeight);
|
||||||
child->setLocation(mLocation);
|
child->setLocation(mLocation);
|
||||||
child->setVisible(mVisible);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,11 @@ public:
|
||||||
mName = name;
|
mName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& getName()
|
||||||
|
{
|
||||||
|
return mName;
|
||||||
|
}
|
||||||
|
|
||||||
bool needsUpdate() const;
|
bool needsUpdate() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -134,7 +139,7 @@ protected:
|
||||||
unsigned mBorderThickness{0};
|
unsigned mBorderThickness{0};
|
||||||
Color mBackgroundColor;
|
Color mBackgroundColor;
|
||||||
Color mBorderColor;
|
Color mBorderColor;
|
||||||
bool mVisible{false};
|
bool mVisible{true};
|
||||||
|
|
||||||
std::unique_ptr<RectangleNode> mBackgroundNode;
|
std::unique_ptr<RectangleNode> mBackgroundNode;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
class FontsManager;
|
class FontsManager;
|
||||||
|
|
||||||
class AbstractVisualNode
|
class AbstractVisualNode
|
||||||
|
@ -54,6 +56,7 @@ public:
|
||||||
|
|
||||||
void setIsVisible(bool isVisible)
|
void setIsVisible(bool isVisible)
|
||||||
{
|
{
|
||||||
|
//std::cout << "Setting " << mName << " visibility to " << isVisible << std::endl;
|
||||||
mIsVisible = isVisible;
|
mIsVisible = isVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +80,15 @@ public:
|
||||||
return mIsVisible;
|
return mIsVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setLocation(const DiscretePoint& loc)
|
||||||
|
{
|
||||||
|
if (mLocation != loc)
|
||||||
|
{
|
||||||
|
mTransformIsDirty = true;
|
||||||
|
mLocation = loc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DiscretePoint mLocation;
|
DiscretePoint mLocation;
|
||||||
std::unique_ptr<SceneItem> mSceneItem;
|
std::unique_ptr<SceneItem> mSceneItem;
|
||||||
|
|
|
@ -52,15 +52,6 @@ void RectangleNode::setHeight(unsigned height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RectangleNode::setLocation(const DiscretePoint& loc)
|
|
||||||
{
|
|
||||||
if (mLocation != loc)
|
|
||||||
{
|
|
||||||
mTransformIsDirty = true;
|
|
||||||
mLocation = loc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RectangleNode::update(FontsManager* fontsManager)
|
void RectangleNode::update(FontsManager* fontsManager)
|
||||||
{
|
{
|
||||||
if (!mSceneItem || mGeometryIsDirty)
|
if (!mSceneItem || mGeometryIsDirty)
|
||||||
|
|
|
@ -17,7 +17,6 @@ public:
|
||||||
|
|
||||||
void setWidth(unsigned width);
|
void setWidth(unsigned width);
|
||||||
void setHeight(unsigned height);
|
void setHeight(unsigned height);
|
||||||
void setLocation(const DiscretePoint& loc);
|
|
||||||
|
|
||||||
void update(FontsManager* fontsManager) override;
|
void update(FontsManager* fontsManager) override;
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue