backgen 0.62: fix pipet position, implement move image up/down on the canvas

git-svn-id: svn://kolibrios.org@7147 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-02-04 23:12:35 +00:00
parent e9755d2ab6
commit 0888784e2f
2 changed files with 38 additions and 5 deletions

View File

@ -17,7 +17,7 @@
// // // //
//===================================================// //===================================================//
#define T_TITLE "Background generator 0.6" #define T_TITLE "Background generator 0.62"
#define MAX_COLORS 10 #define MAX_COLORS 10
#define TOOLBAR_H 24+8 #define TOOLBAR_H 24+8
@ -109,6 +109,12 @@ void main()
case BTN_MOVE_RIGHT: case BTN_MOVE_RIGHT:
colors.move(DIRECTION_RIGHT); colors.move(DIRECTION_RIGHT);
break; break;
case BTN_MOVE_UP:
colors.move(DIRECTION_UP);
break;
case BTN_MOVE_DOWN:
colors.move(DIRECTION_DOWN);
break;
case CLOSE_BTN: case CLOSE_BTN:
ExitProcess(); ExitProcess();
case BTN_APPLY_BACKGROUND: case BTN_APPLY_BACKGROUND:
@ -169,8 +175,11 @@ void draw_window()
// DrawToolbarButton(BTN_SAVE, tx.inc(TB_ICON_PADDING), 5); // DrawToolbarButton(BTN_SAVE, tx.inc(TB_ICON_PADDING), 5);
DrawToolbarButton(BTN_MOVE_LEFT, tx.inc(TB_ICON_PADDING), 30); DrawToolbarButton(BTN_MOVE_LEFT, tx.inc(TB_ICON_PADDING), 30);
DrawToolbarButton(BTN_MOVE_RIGHT, tx.inc(TB_ICON_PADDING), 31); DrawToolbarButton(BTN_MOVE_RIGHT, tx.inc(TB_ICON_PADDING), 31);
// DrawToolbarButton(BTN_MOVE_UP, tx.inc(TB_ICON_PADDING), 32); DrawToolbarButton(BTN_MOVE_UP, tx.inc(TB_ICON_PADDING), 32);
// DrawToolbarButton(BTN_MOVE_DOWN, tx.inc(TB_ICON_PADDING), 33); DrawToolbarButton(BTN_MOVE_DOWN, tx.inc(TB_ICON_PADDING), 33);
DrawToolbarButton(BTN_PICK, tx.inc(TB_ICON_PADDING+8), 38);
// DrawToolbarButton(BTN_FLIP_HOR, tx.inc(TB_ICON_PADDING+8), 34); // DrawToolbarButton(BTN_FLIP_HOR, tx.inc(TB_ICON_PADDING+8), 34);
// DrawToolbarButton(BTN_FLIP_VER, tx.inc(TB_ICON_PADDING), 35); // DrawToolbarButton(BTN_FLIP_VER, tx.inc(TB_ICON_PADDING), 35);
// DrawToolbarButton(BTN_ROTATE_LEFT, tx.inc(TB_ICON_PADDING), 36); // DrawToolbarButton(BTN_ROTATE_LEFT, tx.inc(TB_ICON_PADDING), 36);
@ -185,7 +194,6 @@ void draw_window()
DrawColorsField(); DrawColorsField();
DrawStandartCaptButton(preview.x, 320, BTN_APPLY_BACKGROUND, "Fill background"); DrawStandartCaptButton(preview.x, 320, BTN_APPLY_BACKGROUND, "Fill background");
DrawStandartCaptButton(right_bar.x + 150, right_bar.y, BTN_PICK, "Pipette");
DrawRightBar(); DrawRightBar();
} }
@ -262,7 +270,7 @@ void EventPickActivate()
void EventPickColor() void EventPickColor()
{ {
active_color = GetPixelColorFromScreen(mouse.x + Form.left, mouse.y + Form.top); active_color = GetPixelColorFromScreen(mouse.x + Form.left + 5, mouse.y + Form.top + skin_height);
DrawActiveColor(NULL); DrawActiveColor(NULL);
if (mouse.down) && (mouse.key&MOUSE_LEFT) { if (mouse.down) && (mouse.key&MOUSE_LEFT) {
pick_active = false; pick_active = false;

View File

@ -109,6 +109,31 @@ void _colors::move(int direction)
set_color(r, 0, first_element_data); set_color(r, 0, first_element_data);
} }
} }
if (direction == DIRECTION_UP)
{
for (c = 0; c < columns; c++)
{
first_element_data = get_color(0, c);
for (r = 0; r < rows-1; r++) set_color(r, c, get_color(r+1, c));
set_color(rows-1, c, first_element_data);
}
}
if (direction == DIRECTION_DOWN)
{
for (c = 0; c < columns; c++)
{
first_element_data = get_color(rows-1, c);
for (r = rows-1; r > 0; r--) set_color(r, c, get_color(r-1, c));
set_color(0, c, first_element_data);
}
}
draw_all_cells(); draw_all_cells();
} }