341 lines
12 KiB
Plaintext
341 lines
12 KiB
Plaintext
collections {
|
|
group { name: "ephoto,image,cropper,base";
|
|
script {
|
|
public message(Msg_Type:type, id, ...) {
|
|
if ((type == MSG_INT_SET) && (id == 1)) {
|
|
new movetype, cox, coy, pox, poy, ix, iy, iw, ih, cx, cy, cw, ch;
|
|
|
|
movetype = getarg(2);
|
|
cox = getarg(3);
|
|
coy = getarg(4);
|
|
|
|
get_geometry(PART:"ephoto.swallow.image", ix, iy, iw, ih);
|
|
get_geometry(PART:"ephoto.swallow.cropper", cx, cy, cw, ch);
|
|
|
|
custom_state(PART:"ephoto.swallow.cropper", "default", 0.0);
|
|
if (movetype == 0) {
|
|
new ppox, ppoy;
|
|
get_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, pox, poy);
|
|
get_state_val(PART:"ephoto.swallow.cropper", STATE_REL2_OFFSET, ppox, ppoy);
|
|
if (cx+cox < ix)
|
|
cox = ix-cx;
|
|
if (cx+cw+cox > ix+iw)
|
|
cox = (ix+iw)-(cx+cw);
|
|
if (cy+coy < iy)
|
|
coy = iy-cy;
|
|
if (cy+ch+coy > iy+ih)
|
|
coy = (iy+ih)-(cy+ch);
|
|
pox += cox;
|
|
poy += coy;
|
|
ppox += cox;
|
|
ppoy += coy;
|
|
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, pox, poy);
|
|
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL2_OFFSET, ppox, ppoy);
|
|
}
|
|
if (movetype == 1 || movetype == 2 || movetype == 8) {
|
|
get_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, pox, poy);
|
|
if (cx+cox < ix)
|
|
cox = ix-cx;
|
|
if (cy+coy < iy)
|
|
coy = iy-cy;
|
|
if (cw-cox < 20)
|
|
return;
|
|
if (ch-coy < 20)
|
|
return;
|
|
cox += pox;
|
|
coy += poy;
|
|
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, cox, coy);
|
|
}
|
|
if (movetype == 3) {
|
|
new ppox, ppoy;
|
|
get_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, pox, poy);
|
|
get_state_val(PART:"ephoto.swallow.cropper", STATE_REL2_OFFSET, ppox, ppoy);
|
|
if (cx+cw+cox > ix+iw)
|
|
cox = (ix+iw)-(cx+cw);
|
|
if (cy+coy < iy)
|
|
coy = iy-cy;
|
|
if (cw+cox < 20)
|
|
return;
|
|
if (ch-coy < 20)
|
|
return;
|
|
poy += coy;
|
|
ppox += cox;
|
|
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, pox, poy);
|
|
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL2_OFFSET, ppox, ppoy);
|
|
}
|
|
if (movetype == 4 || movetype == 5 || movetype == 6) {
|
|
get_state_val(PART:"ephoto.swallow.cropper", STATE_REL2_OFFSET, pox, poy);
|
|
if (cx+cw+cox > ix+iw)
|
|
cox = (ix+iw)-(cx+cw);
|
|
if (cy+ch+coy > iy+ih)
|
|
coy = (iy+ih)-(cy+ch);
|
|
if (cw+cox < 20)
|
|
return;
|
|
if (ch+coy < 20)
|
|
return;
|
|
cox += pox;
|
|
coy += poy;
|
|
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL2_OFFSET, cox, coy);
|
|
}
|
|
if (movetype == 7) {
|
|
new ppox, ppoy;
|
|
get_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, pox, poy);
|
|
get_state_val(PART:"ephoto.swallow.cropper", STATE_REL2_OFFSET, ppox, ppoy);
|
|
if (cx+cox < ix)
|
|
cox = ix-cx;
|
|
if (cy+ch+coy > iy+ih)
|
|
coy = (iy+ih)-(cy+ch);
|
|
if (cw-cox < 20)
|
|
return;
|
|
if (ch+coy < 20)
|
|
return;
|
|
pox += cox;
|
|
ppoy += coy;
|
|
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, pox, poy);
|
|
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL2_OFFSET, ppox, ppoy);
|
|
}
|
|
if (movetype == 9) {
|
|
get_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, pox, poy);
|
|
if (cx < ix)
|
|
pox += ix-cx;
|
|
if (cx+cw > ix+iw)
|
|
pox += (ix+iw)-(cx+cw);
|
|
if (cy < iy)
|
|
poy += iy-cy;
|
|
if (cy+ch > iy+ih)
|
|
poy += (iy+ih)-(cy+ch);
|
|
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, pox, poy);
|
|
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL2_OFFSET, pox, poy);
|
|
}
|
|
set_state(PART:"ephoto.swallow.cropper", "custom", 0.0);
|
|
}
|
|
}
|
|
}
|
|
parts {
|
|
part { name: "clipper";
|
|
type: RECT;
|
|
description { state: "default" 0.0;
|
|
}
|
|
}
|
|
part { name: "ephoto.swallow.image";
|
|
type: SWALLOW;
|
|
scale: 1;
|
|
mouse_events: 0;
|
|
clip_to: "clipper";
|
|
description { state: "default" 0.0;
|
|
}
|
|
}
|
|
part { name: "ephoto.swallow.cropper";
|
|
type: SWALLOW;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
clip_to: "clipper";
|
|
description { state: "default" 0.0;
|
|
min: 20 20;
|
|
rel1.to: "ephoto.swallow.image";
|
|
rel1.relative: 0.2 0.2;
|
|
rel2.to: "ephoto.swallow.image";
|
|
rel2.relative: 0.8 0.8;
|
|
}
|
|
}
|
|
part { name: "shader_top";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 0;
|
|
clip_to: "clipper";
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 200;
|
|
rel1.to: "clipper";
|
|
rel1.relative: 0.0 0.0;
|
|
rel2.to: "ephoto.swallow.cropper";
|
|
rel2.relative: 1.0 0.0;
|
|
}
|
|
}
|
|
part { name: "shader_left";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 0;
|
|
clip_to: "clipper";
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 200;
|
|
rel1.to: "shader_top";
|
|
rel1.relative: 0.0 1.0;
|
|
rel2.to: "ephoto.swallow.cropper";
|
|
rel2.relative: 0.0 1.0;
|
|
}
|
|
}
|
|
part { name: "shader_bottom";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 0;
|
|
clip_to: "clipper";
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 200;
|
|
rel1.to: "shader_left";
|
|
rel1.relative: 0.0 1.0;
|
|
rel2.to: "clipper";
|
|
rel2.relative: 1.0 1.0;
|
|
}
|
|
}
|
|
part { name: "shader_right";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 0;
|
|
clip_to: "clipper";
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 200;
|
|
rel1.to: "shader_top";
|
|
rel1.relative: 1.0 0.0;
|
|
rel2.to: "shader_bottom";
|
|
rel2.relative: 1.0 0.0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
group { name: "ephoto,image,cropper";
|
|
parts {
|
|
part { name: "cropper";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
description { state: "default" 0.0;
|
|
color: 255 255 255 0;
|
|
}
|
|
}
|
|
part { name: "dragger";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
description { state: "default" 0.0;
|
|
color: 255 255 255 0;
|
|
rel1.to: "cropper";
|
|
rel1.relative: 0.0 0.0;
|
|
rel2.to: "cropper";
|
|
rel2.relative: 1.0 1.0;
|
|
}
|
|
}
|
|
part { name: "handle2";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 255;
|
|
min: 10 10;
|
|
max: 99999 10;
|
|
align: 0 0;
|
|
rel1.to: "cropper";
|
|
rel1.relative: 0.0 0.0;
|
|
rel2.to: "cropper";
|
|
rel2.relative: 1.0 0.0;
|
|
}
|
|
}
|
|
part { name: "handle4";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 255;
|
|
min: 10 10;
|
|
max: 10 99999;
|
|
align: 1 1;
|
|
rel1.to: "cropper";
|
|
rel1.relative: 1.0 0.0;
|
|
rel2.to: "cropper";
|
|
rel2.relative: 1.0 1.0;
|
|
}
|
|
}
|
|
part { name: "handle6";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 255;
|
|
min: 10 10;
|
|
max: 99999 10;
|
|
align: 1 1;
|
|
rel1.to: "cropper";
|
|
rel1.relative: 0.0 1.0;
|
|
rel2.to: "cropper";
|
|
rel2.relative: 1.0 1.0;
|
|
}
|
|
}
|
|
part { name: "handle8";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 255;
|
|
min: 10 10;
|
|
max: 10 99999;
|
|
align: 0 0;
|
|
rel1.to: "cropper";
|
|
rel1.relative: 0.0 0.0;
|
|
rel2.to: "cropper";
|
|
rel2.relative: 0.0 1.0;
|
|
}
|
|
}
|
|
part { name: "handle1";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 255;
|
|
min: 10 10;
|
|
max: 99999 10;
|
|
align: 0 0;
|
|
rel1.to: "cropper";
|
|
rel1.relative: 0.0 0.0;
|
|
rel2.to: "cropper";
|
|
rel2.relative: 0.0 0.0;
|
|
}
|
|
}
|
|
part { name: "handle3";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 255;
|
|
min: 10 10;
|
|
max: 99999 10;
|
|
align: 1 0;
|
|
rel1.to: "cropper";
|
|
rel1.relative: 1.0 0.0;
|
|
rel2.to: "cropper";
|
|
rel2.relative: 1.0 0.0;
|
|
}
|
|
}
|
|
part { name: "handle5";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 255;
|
|
min: 10 10;
|
|
max: 99999 10;
|
|
align: 1 1;
|
|
rel1.to: "cropper";
|
|
rel1.relative: 1.0 1.0;
|
|
rel2.to: "cropper";
|
|
rel2.relative: 1.0 1.0;
|
|
}
|
|
}
|
|
part { name: "handle7";
|
|
type: RECT;
|
|
scale: 1;
|
|
mouse_events: 1;
|
|
description { state: "default" 0.0;
|
|
color: 0 0 0 255;
|
|
min: 10 10;
|
|
max: 99999 10;
|
|
align: 0 1;
|
|
rel1.to: "cropper";
|
|
rel1.relative: 0.0 1.0;
|
|
rel2.to: "cropper";
|
|
rel2.relative: 0.0 1.0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|