2015-12-15 17:12:11 -03:00
|
|
|
// Aseprite
|
2021-04-13 16:38:56 -03:00
|
|
|
// Copyright (C) 2021 Igara Studio S.A.
|
2016-09-13 15:02:00 -03:00
|
|
|
// Copyright (C) 2001-2016 David Capello
|
2015-12-15 17:12:11 -03:00
|
|
|
//
|
2016-08-26 17:02:58 -03:00
|
|
|
// This program is distributed under the terms of
|
|
|
|
// the End-User License Agreement for Aseprite.
|
2015-12-15 17:12:11 -03:00
|
|
|
|
|
|
|
#ifndef APP_APP_BRUSHES_H_INCLUDED
|
|
|
|
#define APP_APP_BRUSHES_H_INCLUDED
|
|
|
|
#pragma once
|
|
|
|
|
2015-12-16 17:27:04 -03:00
|
|
|
#include "app/brush_slot.h"
|
2015-12-15 17:12:11 -03:00
|
|
|
#include "doc/brushes.h"
|
2016-09-13 15:02:00 -03:00
|
|
|
#include "obs/signal.h"
|
2015-12-15 17:12:11 -03:00
|
|
|
|
2021-04-13 16:38:56 -03:00
|
|
|
#include <string>
|
2015-12-15 17:12:11 -03:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace app {
|
|
|
|
|
|
|
|
class AppBrushes {
|
|
|
|
public:
|
|
|
|
// Number of slot (a range from 1 to AppBrushes::size() inclusive)
|
|
|
|
typedef int slot_id;
|
2015-12-16 17:27:04 -03:00
|
|
|
typedef std::vector<BrushSlot> BrushSlots;
|
2015-12-15 17:12:11 -03:00
|
|
|
|
|
|
|
AppBrushes();
|
2015-12-22 10:55:15 -03:00
|
|
|
~AppBrushes();
|
2015-12-15 17:12:11 -03:00
|
|
|
|
|
|
|
// Adds a new brush and returns the slot number where the brush
|
|
|
|
// is now available.
|
2015-12-16 17:27:04 -03:00
|
|
|
slot_id addBrushSlot(const BrushSlot& brush);
|
|
|
|
void removeBrushSlot(slot_id slot);
|
|
|
|
void removeAllBrushSlots();
|
|
|
|
bool hasBrushSlot(slot_id slot) const;
|
2015-12-15 17:12:11 -03:00
|
|
|
const doc::Brushes& getStandardBrushes() { return m_standard; }
|
2015-12-16 17:27:04 -03:00
|
|
|
BrushSlot getBrushSlot(slot_id slot) const;
|
|
|
|
void setBrushSlot(slot_id slot, const BrushSlot& brush);
|
|
|
|
const BrushSlots& getBrushSlots() const { return m_slots; }
|
2015-12-15 17:12:11 -03:00
|
|
|
|
2015-12-16 17:27:04 -03:00
|
|
|
void lockBrushSlot(slot_id slot);
|
|
|
|
void unlockBrushSlot(slot_id slot);
|
|
|
|
bool isBrushSlotLocked(slot_id slot) const;
|
2015-12-15 17:12:11 -03:00
|
|
|
|
2016-09-13 15:02:00 -03:00
|
|
|
obs::signal<void()> ItemsChange;
|
2015-12-15 17:12:11 -03:00
|
|
|
|
|
|
|
private:
|
2015-12-22 10:55:15 -03:00
|
|
|
void load(const std::string& filename);
|
|
|
|
void save(const std::string& filename) const;
|
|
|
|
static std::string userBrushesFilename();
|
|
|
|
|
2015-12-15 17:12:11 -03:00
|
|
|
doc::Brushes m_standard;
|
|
|
|
BrushSlots m_slots;
|
2021-04-13 16:38:56 -03:00
|
|
|
std::string m_userBrushesFilename;
|
2015-12-15 17:12:11 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace app
|
|
|
|
|
|
|
|
#endif
|