-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚡️ Enhance and fix FTDI Eve Touch UI file select (#22651)
- Loading branch information
1 parent
d336a4d
commit d1db17c
Showing
9 changed files
with
209 additions
and
113 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/arrows.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/************** | ||
* arrows.cpp * | ||
**************/ | ||
|
||
/**************************************************************************** | ||
* Written By Marcio Teixeira 2021 - SynDaver 3D * | ||
* * | ||
* This program is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* To view a copy of the GNU General Public License, go to the following * | ||
* location: <https://www.gnu.org/licenses/>. * | ||
****************************************************************************/ | ||
|
||
#include "ftdi_extended.h" | ||
|
||
#if ENABLED(FTDI_EXTENDED) | ||
|
||
#define COORD(X,Y) cx + s*(swapXY ? Y : (flipX ? -X : X)), cy + s*(swapXY ? (flipX ? -X : X) : Y) | ||
|
||
namespace FTDI { | ||
|
||
void drawArrow(int x, int y, int w, int h, Direction direction) { | ||
const bool swapXY = direction == UP || direction == DOWN; | ||
const bool flipX = direction == UP || direction == LEFT; | ||
const int s = min(w,h); | ||
const int cx = (x + w/2)*16; | ||
const int cy = (y + h/2)*16; | ||
|
||
CommandProcessor cmd; | ||
cmd.cmd(SAVE_CONTEXT()) | ||
.cmd(LINE_WIDTH(s/2)) | ||
.cmd(BEGIN(LINES)) | ||
.cmd(VERTEX2F(COORD( 5, 0))) | ||
.cmd(VERTEX2F(COORD( 2,-2))) | ||
.cmd(VERTEX2F(COORD( 5, 0))) | ||
.cmd(VERTEX2F(COORD( 2, 2))) | ||
.cmd(VERTEX2F(COORD( 5, 0))) | ||
.cmd(VERTEX2F(COORD(-5, 0))) | ||
.cmd(RESTORE_CONTEXT()); | ||
} | ||
|
||
} // namespace FTDI | ||
|
||
#endif // FTDI_EXTENDED |
28 changes: 28 additions & 0 deletions
28
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/arrows.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/************ | ||
* arrows.h * | ||
************/ | ||
|
||
/**************************************************************************** | ||
* Written By Marcio Teixeira 2021 - SynDaver 3D * | ||
* * | ||
* This program is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* To view a copy of the GNU General Public License, go to the following * | ||
* location: <https://www.gnu.org/licenses/>. * | ||
****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
namespace FTDI { | ||
enum Direction {UP, DOWN, LEFT, RIGHT}; | ||
|
||
void drawArrow(int x, int y, int w, int h, Direction direction); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.