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