Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxLHy0424 committed Oct 21, 2024
1 parent 7013a4a commit 003cc19
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ auto main(const int argc,const char *const args[])->int{
ui.add(" (!) 参数错误.\n");
#endif
}
ui.add(" < 退出 ",Mod::exit,WCC_RED)
ui.add(" < 退出 ",Mod::exit,COLOR_RED)
.add(" > 关于 ",Mod::info)
#ifdef _THE_NEXT_MAJOR_UPDATE_
.add(" > 配置 ",Mod::OpConfig('e'))
Expand Down
8 changes: 4 additions & 4 deletions src/mod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace Mod{
inline auto info(Data){
UI ui;
ui.add(" [ 关 于 ]\n\n")
.add(" < 返回 ",Mod::exit,WCC_RED)
.add(" < 返回 ",Mod::exit,COLOR_RED)
.add("\n[名称]\n")
.add(" " INFO_NAME)
.add("\n[版本]\n")
Expand Down Expand Up @@ -194,7 +194,7 @@ namespace Mod{
configFile.close();
return true;
}};
auto reRead{[&](Data){
auto reload{[&](Data){
read();
return false;
}};
Expand All @@ -206,8 +206,8 @@ namespace Mod{
UI ui;
ui.add(" [ 配 置 ]\n\n")
.add(" (i) 部分更改将在下次启动时生效.\n 可通过 <RuleExe> 与 <RuleSvc> 自定义规则.\n")
.add(" < 格式化保存并返回 ",std::move(save),WCC_RED)
.add(" > 重新读取配置文件 ",std::move(reRead))
.add(" < 格式化保存并返回 ",std::move(save),COLOR_RED)
.add(" > 重新读取配置文件 ",std::move(reload))
.add(" > 打开配置文件 ",std::move(openConfigFile))
.add("\n[半透明窗口]\n")
.add(" > 启用 ",[](Data){config.wndAlpha=true;return false;})
Expand Down
24 changes: 12 additions & 12 deletions src/ui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#define MOUSE_CLICK_DOUBLE DOUBLE_CLICK
#define MOUSE_MOVE MOUSE_MOVED
#define MOUSE_WHEEL MOUSE_WHEELED
#define WCC_WHITE 0x07
#define WCC_BLUE 0x09
#define WCC_RED 0x0c
#define COLOR_WHITE 0x07
#define COLOR_BLUE 0x09
#define COLOR_RED 0x0c
class UI;
struct Data final{
const DWORD stateButton,stateCtrlKey,flagEvent;
Expand All @@ -30,15 +30,15 @@ class UI final{
COORD position;
callback function;
inline explicit Item():
text{},colorDef{WCC_WHITE},colorHighlight{WCC_BLUE},
colorLast{WCC_WHITE},position{},function{}{}
text{},colorDef{COLOR_WHITE},colorHighlight{COLOR_BLUE},
colorLast{COLOR_WHITE},position{},function{}{}
inline explicit Item(
const char *const text,
const short colorDef,
const short colorHighlight,
const callback function
):text{text},colorDef{colorDef},colorHighlight{colorHighlight},
colorLast{WCC_WHITE},position{},function{function}{}
colorLast{COLOR_WHITE},position{},function{function}{}
inline ~Item(){}
inline auto setColor(const char mod){
switch(mod){
Expand Down Expand Up @@ -187,8 +187,8 @@ class UI final{
inline auto &add(
const char *const text,
const callback function=nullptr,
const short colorHighlight=WCC_BLUE,
const short colorDef=WCC_WHITE
const short colorHighlight=COLOR_BLUE,
const short colorDef=COLOR_WHITE
){
item.emplace_back(Item(text,colorDef,(function==nullptr)?(colorDef):(colorHighlight),function));
return *this;
Expand All @@ -197,8 +197,8 @@ class UI final{
const size_t index,
const char *const text,
const callback function=nullptr,
const short colorHighlight=WCC_BLUE,
const short colorDef=WCC_WHITE
const short colorHighlight=COLOR_BLUE,
const short colorDef=COLOR_WHITE
){
item.emplace(item.begin()+index,Item(text,colorDef,(function==nullptr)?(colorDef):(colorHighlight),function));
return *this;
Expand All @@ -207,8 +207,8 @@ class UI final{
const size_t index,
const char *const text,
const callback function=nullptr,
const short colorHighlight=WCC_BLUE,
const short colorDef=WCC_WHITE
const short colorHighlight=COLOR_BLUE,
const short colorDef=COLOR_WHITE
){
item.at(index)=Item(text,colorDef,(function==nullptr)?(colorDef):(colorHighlight),function);
return *this;
Expand Down

0 comments on commit 003cc19

Please sign in to comment.