fix(ui): use icon glyph for plus actions
This commit is contained in:
@@ -301,7 +301,7 @@ bool sidebar_section_header(const char* label, int count, const char* add_toolti
|
|||||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.43f, 0.90f, 0.51f, 1.0f));
|
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.43f, 0.90f, 0.51f, 1.0f));
|
||||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.25f, 0.72f, 0.35f, 1.0f));
|
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.25f, 0.72f, 0.35f, 1.0f));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {ui(5.0f), ui(1.0f)});
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {ui(5.0f), ui(1.0f)});
|
||||||
if (ImGui::SmallButton(ICON_FA_PLUS "##add")) {
|
if (ImGui::SmallButton(ICON_FA_CIRCLE_PLUS "##add")) {
|
||||||
const std::string section = label;
|
const std::string section = label;
|
||||||
if (section.find("LOCAL") != std::string::npos) {
|
if (section.find("LOCAL") != std::string::npos) {
|
||||||
g_git_target.clear();
|
g_git_target.clear();
|
||||||
@@ -692,7 +692,7 @@ void draw_commit_table() {
|
|||||||
draw->AddCircle(center, ui(6), IM_COL32(23, 181, 204, 220), 12, ui(1.5f));
|
draw->AddCircle(center, ui(6), IM_COL32(23, 181, 204, 220), 12, ui(1.5f));
|
||||||
ImGui::Dummy({0, ui(20)});
|
ImGui::Dummy({0, ui(20)});
|
||||||
ImGui::TableSetColumnIndex(2);
|
ImGui::TableSetColumnIndex(2);
|
||||||
const std::string change_count = std::string(ICON_FA_PLUS " ") +
|
const std::string change_count = std::string(ICON_FA_CIRCLE_PLUS " ") +
|
||||||
std::to_string(repo().working_files.size());
|
std::to_string(repo().working_files.size());
|
||||||
const float count_width = ImGui::CalcTextSize(change_count.c_str()).x;
|
const float count_width = ImGui::CalcTextSize(change_count.c_str()).x;
|
||||||
ImGui::SetNextItemWidth(std::max(ui(90.0f), ImGui::GetContentRegionAvail().x - count_width - ui(12.0f)));
|
ImGui::SetNextItemWidth(std::max(ui(90.0f), ImGui::GetContentRegionAvail().x - count_width - ui(12.0f)));
|
||||||
@@ -762,7 +762,7 @@ void draw_commit_table() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* change_icon(FileChangeKind kind) {
|
const char* change_icon(FileChangeKind kind) {
|
||||||
if (kind == FileChangeKind::added) return ICON_FA_PLUS;
|
if (kind == FileChangeKind::added) return ICON_FA_CIRCLE_PLUS;
|
||||||
if (kind == FileChangeKind::deleted) return ICON_FA_MINUS;
|
if (kind == FileChangeKind::deleted) return ICON_FA_MINUS;
|
||||||
if (kind == FileChangeKind::renamed) return ICON_FA_ARROW_RIGHT_ARROW_LEFT;
|
if (kind == FileChangeKind::renamed) return ICON_FA_ARROW_RIGHT_ARROW_LEFT;
|
||||||
return ICON_FA_PEN;
|
return ICON_FA_PEN;
|
||||||
@@ -788,7 +788,7 @@ void draw_file_row(const std::string& path, FileChangeKind kind, int id,
|
|||||||
draw->AddText({minimum.x + ui(20.0f), y}, IM_COL32(174, 179, 187, 255), path.c_str());
|
draw->AddText({minimum.x + ui(20.0f), y}, IM_COL32(174, 179, 187, 255), path.c_str());
|
||||||
const std::string& git_path = action_path.empty() ? path : action_path;
|
const std::string& git_path = action_path.empty() ? path : action_path;
|
||||||
if (ImGui::BeginPopupContextItem()) {
|
if (ImGui::BeginPopupContextItem()) {
|
||||||
if (working_file && !staged && ImGui::MenuItem(ICON_FA_PLUS " Stage file"))
|
if (working_file && !staged && ImGui::MenuItem(ICON_FA_CIRCLE_PLUS " Stage file"))
|
||||||
g_git_manager->stageFile(repo(), git_path, g_notice);
|
g_git_manager->stageFile(repo(), git_path, g_notice);
|
||||||
if (working_file && staged && ImGui::MenuItem(ICON_FA_MINUS " Unstage file"))
|
if (working_file && staged && ImGui::MenuItem(ICON_FA_MINUS " Unstage file"))
|
||||||
g_git_manager->unstageFile(repo(), git_path, g_notice);
|
g_git_manager->unstageFile(repo(), git_path, g_notice);
|
||||||
@@ -1073,7 +1073,7 @@ void draw_commit_details() {
|
|||||||
else ++modified;
|
else ++modified;
|
||||||
}
|
}
|
||||||
if (modified) ImGui::TextColored(change_color(FileChangeKind::modified), ICON_FA_PEN " %d modified", modified);
|
if (modified) ImGui::TextColored(change_color(FileChangeKind::modified), ICON_FA_PEN " %d modified", modified);
|
||||||
if (added) { if (modified) ImGui::SameLine(); ImGui::TextColored(change_color(FileChangeKind::added), ICON_FA_PLUS " %d added", added); }
|
if (added) { if (modified) ImGui::SameLine(); ImGui::TextColored(change_color(FileChangeKind::added), ICON_FA_CIRCLE_PLUS " %d added", added); }
|
||||||
if (deleted) { if (modified || added) ImGui::SameLine(); ImGui::TextColored(change_color(FileChangeKind::deleted), ICON_FA_MINUS " %d deleted", deleted); }
|
if (deleted) { if (modified || added) ImGui::SameLine(); ImGui::TextColored(change_color(FileChangeKind::deleted), ICON_FA_MINUS " %d deleted", deleted); }
|
||||||
draw_file_toolbar(true);
|
draw_file_toolbar(true);
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
@@ -1587,11 +1587,11 @@ void draw_app() {
|
|||||||
const bool add_hovered = ImGui::IsItemHovered();
|
const bool add_hovered = ImGui::IsItemHovered();
|
||||||
ImDrawList* tab_draw = ImGui::GetWindowDrawList();
|
ImDrawList* tab_draw = ImGui::GetWindowDrawList();
|
||||||
if (add_hovered) tab_draw->AddRectFilled(add_minimum, add_maximum, IM_COL32(51, 55, 63, 255));
|
if (add_hovered) tab_draw->AddRectFilled(add_minimum, add_maximum, IM_COL32(51, 55, 63, 255));
|
||||||
const ImVec2 add_icon_size = ImGui::CalcTextSize(ICON_FA_PLUS);
|
const ImVec2 add_icon_size = ImGui::CalcTextSize(ICON_FA_CIRCLE_PLUS);
|
||||||
tab_draw->AddText({
|
tab_draw->AddText({
|
||||||
add_minimum.x + (add_maximum.x - add_minimum.x - add_icon_size.x) * 0.5f,
|
add_minimum.x + (add_maximum.x - add_minimum.x - add_icon_size.x) * 0.5f,
|
||||||
add_minimum.y + (add_maximum.y - add_minimum.y - add_icon_size.y) * 0.5f,
|
add_minimum.y + (add_maximum.y - add_minimum.y - add_icon_size.y) * 0.5f,
|
||||||
}, IM_COL32(214, 221, 231, 255), ICON_FA_PLUS);
|
}, IM_COL32(214, 221, 231, 255), ICON_FA_CIRCLE_PLUS);
|
||||||
if (add_hovered) ImGui::SetTooltip("New tab");
|
if (add_hovered) ImGui::SetTooltip("New tab");
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
g_tab_to_select = nullptr;
|
g_tab_to_select = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user