scrot_selection.h (scrot-1.6.tar.bz2) | : | scrot_selection.h (scrot-1.7.tar.bz2) | ||
---|---|---|---|---|
/* scrot_selection.h | /* scrot_selection.h | |||
Copyright 2020-2021 Daniel T. Borelli <daltomi@disroot.org> | Copyright 2020-2021 Daniel T. Borelli <danieltborelli@gmail.com> | |||
Copyright 2021 Martin C <martincation@protonmail.com> | Copyright 2021 Martin C <martincation@protonmail.com> | |||
Copyright 2021 Peter Wu <peterwu@hotmail.com> | ||||
Permission is hereby granted, free of charge, to any person obtaining a copy | Permission is hereby granted, free of charge, to any person obtaining a copy | |||
of this software and associated documentation files (the "Software"), to | of this software and associated documentation files (the "Software"), to | |||
deal in the Software without restriction, including without limitation the | deal in the Software without restriction, including without limitation the | |||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |||
sell copies of the Software, and to permit persons to whom the Software is | sell copies of the Software, and to permit persons to whom the Software is | |||
furnished to do so, subject to the following conditions: | furnished to do so, subject to the following conditions: | |||
The above copyright notice and this permission notice shall be included in | The above copyright notice and this permission notice shall be included in | |||
all copies of the Software and its documentation and acknowledgment shall be | all copies of the Software and its documentation and acknowledgment shall be | |||
skipping to change at line 32 | skipping to change at line 33 | |||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
*/ | */ | |||
/* | /* | |||
This file is part of the scrot project. | This file is part of the scrot project. | |||
Part of the code comes from the main.c file and maintains its authorship. | Part of the code comes from the main.c file and maintains its authorship. | |||
*/ | */ | |||
#ifndef SCROT_SELECTION_H | #pragma once | |||
#define SCROT_SELECTION_H | ||||
#include <X11/Xresource.h> | ||||
#include <X11/extensions/Xfixes.h> | ||||
#include <X11/extensions/shape.h> | ||||
#include <X11/keysym.h> | ||||
#include <X11/cursorfont.h> | ||||
#include <Imlib2.h> | ||||
#include <stdbool.h> | ||||
#include <assert.h> | #include <assert.h> | |||
#define LINE_MODE_CLASSIC "classic" | /* S: string, L: len */ | |||
#define LINE_MODE_CLASSIC_LEN 7 | #define LINE_MODE_S_CLASSIC "classic" | |||
#define LINE_MODE_EDGE "edge" | #define LINE_MODE_L_CLASSIC 7 | |||
#define LINE_MODE_EDGE_LEN 4 | #define LINE_MODE_S_EDGE "edge" | |||
#define LINE_MODE_L_EDGE 4 | ||||
#define SELECTION_MODE_S_CAPTURE "capture" | ||||
#define SELECTION_MODE_L_CAPTURE 7 | ||||
#define SELECTION_MODE_S_HIDE "hide" | ||||
#define SELECTION_MODE_L_HIDE 4 | ||||
#define SELECTION_MODE_S_HOLE "hole" | ||||
#define SELECTION_MODE_L_HOLE 4 | ||||
#define SELECTION_MODE_S_BLUR "blur" | ||||
#define SELECTION_MODE_L_BLUR 4 | ||||
enum { | ||||
SELECTION_MODE_SEPARATOR = ',', | ||||
SELECTION_MODE_CAPTURE = (1 << 1), | ||||
SELECTION_MODE_HIDE = (1 << 2), | ||||
SELECTION_MODE_HOLE = (1 << 3), | ||||
SELECTION_MODE_BLUR = (1 << 4), | ||||
SELECTION_MODE_ANY = (SELECTION_MODE_CAPTURE | SELECTION_MODE_HIDE | SELECTI | ||||
ON_MODE_HOLE | SELECTION_MODE_BLUR), | ||||
SELECTION_MODE_NOT_CAPTURE = (SELECTION_MODE_ANY & ~SELECTION_MODE_CAPTURE), | ||||
SELECTION_MODE_NEED_PARAM = (SELECTION_MODE_HIDE | SELECTION_MODE_BLUR), | ||||
SELECTION_MODE_NOT_NEED_PARAM = (~SELECTION_MODE_NEED_PARAM), | ||||
SELECTION_MODE_BLUR_MIN= 1, | ||||
SELECTION_MODE_BLUR_MAX= 30, | ||||
SELECTION_MODE_BLUR_DEFAULT = 18, | ||||
SELECTION_OPACITY_MIN = 0, | ||||
SELECTION_OPACITY_MAX = 255, | ||||
SELECTION_OPACITY_DEFAULT = 100, | ||||
SELECTION_EDGE_OPACITY_MIN = 10, | ||||
SELECTION_EDGE_OPACITY_MAX = 100, | ||||
}; | ||||
struct selection_rect_t { | struct SelectionRect { | |||
int x, y, w, h; | int x, y, w, h; | |||
}; | }; | |||
struct selection_classic_t; | typedef struct SelectionMode { | |||
struct selection_edge_t; | unsigned int mode; | |||
int paramNum; | ||||
struct selection_t { | char* paramStr; | |||
Cursor cur_cross, cur_angle_nw, cur_angle_ne, cur_angle_sw, cur_angle_se; | } SelectionMode; | |||
struct selection_rect_t rect; | struct SelectionClassic; | |||
struct selection_classic_t* classic; | struct SelectionEdge; | |||
struct selection_edge_t* edge; | ||||
struct Selection { | ||||
Cursor curCross, curAngleNW, curAngleNE, curAngleSW, curAngleSE; | ||||
struct SelectionRect rect; | ||||
struct SelectionClassic* classic; | ||||
struct SelectionEdge* edge; | ||||
void (*create)(void); | void (*create)(void); | |||
void (*destroy)(void); | void (*destroy)(void); | |||
void (*draw)(void); | void (*draw)(void); | |||
void (*motion_draw)(int x0, int y0, int x1, int y1); | void (*motionDraw)(int, int, int, int); | |||
}; | }; | |||
void scrot_selection_create(void); | void scrotSelectionCreate(void); | |||
void scrot_selection_destroy(void); | void scrotSelectionDestroy(void); | |||
void scrot_selection_draw(void); | void scrotSelectionDraw(void); | |||
void scrot_selection_motion_draw(int x0, int y0, int x1, int y1); | void scrotSelectionMotionDraw(int, int, int, int); | |||
struct selection_rect_t* scrot_selection_get_rect(void); | struct SelectionRect* scrotSelectionGetRect(void); | |||
void scrotSelectionGetLineColor(XColor*); | ||||
#endif | Status scrotSelectionCreateNamedColor(char const*, XColor*); | |||
void scrotSelectionSetDefaultColorLine(void); | ||||
bool scrotSelectionGetUserSel(struct SelectionRect*); | ||||
Imlib_Image scrotSelectionSelectMode(void); | ||||
End of changes. 9 change blocks. | ||||
18 lines changed or deleted | 61 lines changed or added |