Fix bug showing frame # and opacity slider in StatusBar without an active document

This commit is contained in:
David Capello 2015-04-16 13:14:39 -03:00
parent 5a5a6fe4f6
commit aae3e69fda
2 changed files with 6 additions and 3 deletions

View File

@ -137,6 +137,7 @@ StatusBar* StatusBar::m_instance = NULL;
StatusBar::StatusBar()
: Widget(statusbar_type())
, m_color(app::Color::fromMask())
, m_hasDoc(false)
{
m_instance = this;
@ -331,7 +332,7 @@ void StatusBar::onResize(ResizeEvent& ev)
rc.x += rc.w - prefWidth - border.right() - toolBarWidth;
rc.w = prefWidth;
m_commandsBox->setVisible(true);
m_commandsBox->setVisible(true && m_hasDoc);
m_commandsBox->setBounds(rc);
}
else
@ -455,6 +456,7 @@ void StatusBar::updateFromDocument(Editor* editor)
try {
if (editor && editor->document()) {
const DocumentReader reader(editor->document(), 100);
m_hasDoc = true;
m_commandsBox->setVisible(true);
// Cel opacity
@ -473,11 +475,11 @@ void StatusBar::updateFromDocument(Editor* editor)
}
}
else {
m_hasDoc = false;
m_commandsBox->setVisible(false);
}
}
catch (LockedDocumentException&) {
// Disable all
catch (const LockedDocumentException&) {
m_slider->setEnabled(false);
}
}

View File

@ -83,6 +83,7 @@ namespace app {
ui::Slider* m_slider; // Opacity slider
ui::Entry* m_currentFrame; // Current frame and go to frame entry
ui::Button* m_newFrame; // Button to create a new frame
bool m_hasDoc;
// Tip window
class CustomizedTipWindow;