mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 14:42:44 +00:00
Remove commented code in context_bar.cpp to select dots freehand algorithm
This commit is contained in:
parent
aa28f6d65c
commit
c29fd79796
@ -809,147 +809,6 @@ private:
|
||||
bool m_lockChange;
|
||||
};
|
||||
|
||||
#if 0 // TODO for v1.1 to avoid changing the UI
|
||||
|
||||
class ContextBar::FreehandAlgorithmField : public Button
|
||||
, public IButtonIcon
|
||||
{
|
||||
public:
|
||||
FreehandAlgorithmField()
|
||||
: Button("")
|
||||
, m_popupWindow(NULL)
|
||||
, m_tooltipManager(NULL) {
|
||||
setup_mini_look(this);
|
||||
setIconInterface(this);
|
||||
}
|
||||
|
||||
~FreehandAlgorithmField() {
|
||||
closePopup();
|
||||
setIconInterface(NULL);
|
||||
}
|
||||
|
||||
void setupTooltips(TooltipManager* tooltipManager) {
|
||||
m_tooltipManager = tooltipManager;
|
||||
}
|
||||
|
||||
void setFreehandAlgorithm(FreehandAlgorithm algo) {
|
||||
SkinTheme* theme = SkinTheme::instance();
|
||||
SkinPartPtr part = theme->parts.freehandAlgoDefault();
|
||||
m_freehandAlgo = algo;
|
||||
switch (m_freehandAlgo) {
|
||||
case kDefaultFreehandAlgorithm:
|
||||
part = theme->parts.freehandAlgoDefault();
|
||||
break;
|
||||
case kPixelPerfectFreehandAlgorithm:
|
||||
part = theme->parts.freehandAlgoPixelPerfect();
|
||||
break;
|
||||
case kDotsFreehandAlgorithm:
|
||||
part = theme->parts.freehandAlgoDots();
|
||||
break;
|
||||
}
|
||||
m_bitmap = part;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
// IButtonIcon implementation
|
||||
void destroy() override {
|
||||
// Do nothing, BrushTypeField is added as a widget in the
|
||||
// ContextBar, so it will be destroyed together with the
|
||||
// ContextBar.
|
||||
}
|
||||
|
||||
gfx::Size getSize() override {
|
||||
return m_bitmap->getSize();
|
||||
}
|
||||
|
||||
she::Surface* getNormalIcon() override {
|
||||
return m_bitmap->getBitmap(0);
|
||||
}
|
||||
|
||||
she::Surface* getSelectedIcon() override {
|
||||
return m_bitmap->getBitmap(0);
|
||||
}
|
||||
|
||||
she::Surface* getDisabledIcon() override {
|
||||
return m_bitmap->getBitmap(0);
|
||||
}
|
||||
|
||||
int getIconAlign() override {
|
||||
return CENTER | MIDDLE;
|
||||
}
|
||||
|
||||
protected:
|
||||
void onClick(Event& ev) override {
|
||||
Button::onClick(ev);
|
||||
|
||||
if (!m_popupWindow || !m_popupWindow->isVisible())
|
||||
openPopup();
|
||||
else
|
||||
closePopup();
|
||||
}
|
||||
|
||||
void onPreferredSize(PreferredSizeEvent& ev) override {
|
||||
ev.setPreferredSize(Size(16, 18)*guiscale());
|
||||
}
|
||||
|
||||
private:
|
||||
void openPopup() {
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
|
||||
Border border = Border(2, 2, 2, 3)*guiscale();
|
||||
Rect rc = getBounds();
|
||||
rc.y += rc.h;
|
||||
rc.w *= 3;
|
||||
m_popupWindow = new PopupWindow("", PopupWindow::kCloseOnClickInOtherWindow);
|
||||
m_popupWindow->setAutoRemap(false);
|
||||
m_popupWindow->setBorder(border);
|
||||
m_popupWindow->setBounds(rc + border);
|
||||
|
||||
Region rgn(m_popupWindow->getBounds().createUnion(getBounds()));
|
||||
m_popupWindow->setHotRegion(rgn);
|
||||
m_freehandAlgoButton = new ButtonSet(3);
|
||||
m_freehandAlgoButton->addItem(theme->parts.freehandAlgoDefault());
|
||||
m_freehandAlgoButton->addItem(theme->parts.freehandAlgoPixelPerfect());
|
||||
m_freehandAlgoButton->addItem(theme->parts.freehandAlgoDots());
|
||||
m_freehandAlgoButton->setSelectedItem((int)m_freehandAlgo);
|
||||
m_freehandAlgoButton->ItemChange.connect(&FreehandAlgorithmField::onFreehandAlgoChange, this);
|
||||
m_freehandAlgoButton->setTransparent(true);
|
||||
m_freehandAlgoButton->setBgColor(gfx::ColorNone);
|
||||
|
||||
m_tooltipManager->addTooltipFor(at(0), "Normal trace", TOP);
|
||||
m_tooltipManager->addTooltipFor(at(1), "Pixel-perfect trace", TOP);
|
||||
m_tooltipManager->addTooltipFor(at(2), "Dots", TOP);
|
||||
|
||||
m_popupWindow->addChild(m_freehandAlgoButton);
|
||||
m_popupWindow->openWindow();
|
||||
}
|
||||
|
||||
void closePopup() {
|
||||
if (m_popupWindow) {
|
||||
m_popupWindow->closeWindow(NULL);
|
||||
delete m_popupWindow;
|
||||
m_popupWindow = NULL;
|
||||
m_freehandAlgoButton = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void onFreehandAlgoChange() {
|
||||
setFreehandAlgorithm(
|
||||
(FreehandAlgorithm)m_freehandAlgoButton->getSelectedItem());
|
||||
|
||||
Tool* tool = App::instance()->activeTool();
|
||||
Preferences::instance().tool(tool).freehandAlgorithm(m_freehandAlgo);
|
||||
}
|
||||
|
||||
SkinPartPtr m_bitmap;
|
||||
FreehandAlgorithm m_freehandAlgo;
|
||||
PopupWindow* m_popupWindow;
|
||||
ButtonSet* m_freehandAlgoButton;
|
||||
TooltipManager* m_tooltipManager;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
class ContextBar::FreehandAlgorithmField : public CheckBox
|
||||
{
|
||||
public:
|
||||
@ -989,8 +848,6 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
class ContextBar::SelectionModeField : public ButtonSet
|
||||
{
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user