forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_brushes.h
59 lines (46 loc) · 1.53 KB
/
app_brushes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Aseprite
// Copyright (C) 2021 Igara Studio S.A.
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifndef APP_APP_BRUSHES_H_INCLUDED
#define APP_APP_BRUSHES_H_INCLUDED
#pragma once
#include "app/brush_slot.h"
#include "doc/brushes.h"
#include "obs/signal.h"
#include <string>
#include <vector>
namespace app {
class AppBrushes {
public:
// Number of slot (a range from 1 to AppBrushes::size() inclusive)
typedef int slot_id;
typedef std::vector<BrushSlot> BrushSlots;
AppBrushes();
~AppBrushes();
// Adds a new brush and returns the slot number where the brush
// is now available.
slot_id addBrushSlot(const BrushSlot& brush);
void removeBrushSlot(slot_id slot);
void removeAllBrushSlots();
bool hasBrushSlot(slot_id slot) const;
const doc::Brushes& getStandardBrushes() { return m_standard; }
BrushSlot getBrushSlot(slot_id slot) const;
void setBrushSlot(slot_id slot, const BrushSlot& brush);
const BrushSlots& getBrushSlots() const { return m_slots; }
void lockBrushSlot(slot_id slot);
void unlockBrushSlot(slot_id slot);
bool isBrushSlotLocked(slot_id slot) const;
obs::signal<void()> ItemsChange;
private:
void load(const std::string& filename);
void save(const std::string& filename) const;
static std::string userBrushesFilename();
doc::Brushes m_standard;
BrushSlots m_slots;
std::string m_userBrushesFilename;
};
} // namespace app
#endif