1 /*$
2  Copyright (C) 2013-2020 Azel.
3 
4  This file is part of AzPainter.
5 
6  AzPainter is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  AzPainter is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 $*/
19 
20 /************************************
21  * レイヤリスト
22  ************************************/
23 
24 #ifndef LAYERLIST_H
25 #define LAYERLIST_H
26 
27 typedef struct _LayerList LayerList;
28 typedef struct _LayerItem LayerItem;
29 typedef struct _TileImage TileImage;
30 typedef struct _mPopupProgress mPopupProgress;
31 
32 
33 
34 LayerList *LayerList_new();
35 void LayerList_free(LayerList *p);
36 
37 void LayerList_clear(LayerList *p);
38 
39 /* add, etc */
40 
41 LayerItem *LayerList_addLayer(LayerList *p,LayerItem *insert);
42 LayerItem *LayerList_addLayer_image(LayerList *p,LayerItem *insert,int coltype);
43 LayerItem *LayerList_addLayer_pos(LayerList *p,int parent,int pos);
44 LayerItem *LayerList_addLayer_newimage(LayerList *p,int coltype);
45 
46 LayerItem *LayerList_dupLayer(LayerList *p,LayerItem *src);
47 LayerItem *LayerList_deleteLayer(LayerList *p,LayerItem *item);
48 
49 mBool LayerList_addLayers_onRoot(LayerList *p,int num);
50 
51 /* 取得 */
52 
53 int LayerList_getNum(LayerList *p);
54 int LayerList_getNormalLayerNum(LayerList *p);
55 
56 int LayerList_getItemPos(LayerList *p,LayerItem *item);
57 void LayerList_getItemPos_forParent(LayerList *p,LayerItem *item,int *parent,int *relno);
58 
59 LayerItem *LayerList_getItem_top(LayerList *p);
60 LayerItem *LayerList_getItem_byPos_topdown(LayerList *p,int pos);
61 LayerItem *LayerList_getItem_bottomVisibleImage(LayerList *p);
62 LayerItem *LayerList_getItem_bottomNormal(LayerList *p);
63 void LayerList_getItems_fromPos(LayerList *p,LayerItem **dst,int parent,int pos);
64 LayerItem *LayerList_getItem_topPixelLayer(LayerList *p,int x,int y);
65 
66 int LayerList_getScrollInfo(LayerList *p,int *ret_maxdepth);
67 
68 /* フラグ */
69 
70 mBool LayerList_haveCheckedLayer(LayerList *p);
71 void LayerList_setVisible_all(LayerList *p,mBool on);
72 void LayerList_showRevChecked(LayerList *p,mRect *rcimg);
73 void LayerList_showRevImage(LayerList *p,mRect *rcimg);
74 void LayerList_allFlagsOff(LayerList *p,uint32_t flags);
75 void LayerList_closeAllFolders(LayerList *p,LayerItem *curitem);
76 
77 /* 描画関連 */
78 
79 TileImage *LayerList_getMaskImage(LayerList *p,LayerItem *current);
80 LayerItem *LayerList_setLink_combineMulti(LayerList *p,int target,LayerItem *current);
81 LayerItem *LayerList_setLink_movetool(LayerList *p,LayerItem *item);
82 LayerItem *LayerList_setLink_filltool(LayerList *p,LayerItem *current,mBool disable_ref);
83 LayerItem *LayerList_setLink_checked(LayerList *p);
84 
85 /* アイテム移動 */
86 
87 mBool LayerList_moveitem_updown(LayerList *p,LayerItem *item,mBool bUp);
88 void LayerList_moveitem(LayerList *p,LayerItem *src,LayerItem *dst,mBool infolder);
89 void LayerList_moveitem_forLoad_topdown(LayerList *p,LayerItem *src,LayerItem *parent);
90 mBool LayerList_moveitem_forUndo(LayerList *p,int *val,mRect *rcupdate);
91 int16_t *LayerList_moveitem_checkedToFolder(LayerList *p,LayerItem *dst,int *pnum,mRect *rcupdate);
92 mBool LayerList_moveitem_multi_forUndo(LayerList *p,int num,int16_t *buf,mRect *rcupdate,mBool redo);
93 
94 /* ほか */
95 
96 void LayerList_setItemName_curlayernum(LayerList *p,LayerItem *item);
97 void LayerList_setItemName_ascii(LayerList *p,LayerItem *item,const char *name);
98 void LayerList_setItemName_utf8(LayerList *p,LayerItem *item,const char *name);
99 
100 void LayerList_moveOffset_rel_all(LayerList *p,int movx,int movy);
101 
102 /* file */
103 
104 LayerItem *LayerList_addLayer_apdv3(LayerList *p,LayerItem *insert,
105 	const char *filename,mPopupProgress *prog);
106 
107 #endif
108