command palette show shortcuts (for actions)
This commit is contained in:
parent
29526d47fb
commit
639e7d11b0
|
|
@ -25,6 +25,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "../ta-log.h"
|
#include "../ta-log.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
struct MatchScore {
|
struct MatchScore {
|
||||||
size_t charsBeforeNeedle=0;
|
size_t charsBeforeNeedle=0;
|
||||||
|
|
@ -268,6 +269,10 @@ void FurnaceGUI::drawPalette() {
|
||||||
navigated=true;
|
navigated=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int columnCount=curPaletteType==CMDPAL_TYPE_MAIN ? 2 : 1;
|
||||||
|
if (ImGui::BeginTable("##commandPaletteTable",columnCount,ImGuiTableFlags_SizingStretchProp)) {
|
||||||
|
// ImGui::TableSetupColumn("##action",ImGuiTableColumnFlags_WidthStretch);
|
||||||
|
// ImGui::TableSetupColumn("##shortcut");
|
||||||
for (int i=0; i<(int)paletteSearchResults.size(); i++) {
|
for (int i=0; i<(int)paletteSearchResults.size(); i++) {
|
||||||
bool current=(i==curPaletteChoice);
|
bool current=(i==curPaletteChoice);
|
||||||
int id=paletteSearchResults[i].id;
|
int id=paletteSearchResults[i].id;
|
||||||
|
|
@ -299,6 +304,9 @@ void FurnaceGUI::drawPalette() {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
|
||||||
ImGui::PushID(s.c_str());
|
ImGui::PushID(s.c_str());
|
||||||
bool selectable=ImGui::Selectable("##paletteSearchItem",current,ImGuiSelectableFlags_SpanAllColumns|ImGuiSelectableFlags_AllowOverlap);
|
bool selectable=ImGui::Selectable("##paletteSearchItem",current,ImGuiSelectableFlags_SpanAllColumns|ImGuiSelectableFlags_AllowOverlap);
|
||||||
const char* str=s.c_str();
|
const char* str=s.c_str();
|
||||||
|
|
@ -313,13 +321,23 @@ void FurnaceGUI::drawPalette() {
|
||||||
}
|
}
|
||||||
ImGui::SameLine(0.0f,0.0f);
|
ImGui::SameLine(0.0f,0.0f);
|
||||||
ImGui::Text("%.*s", (int)(s.length()-chCursor), str+chCursor);
|
ImGui::Text("%.*s", (int)(s.length()-chCursor), str+chCursor);
|
||||||
|
|
||||||
|
if (curPaletteType==CMDPAL_TYPE_MAIN) {
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TextColored(uiColors[GUI_COLOR_TEXT_DISABLED], "%s", getKeyName(actionKeys[paletteSearchResults[i].id], true).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
if (selectable) {
|
if (selectable) {
|
||||||
curPaletteChoice=i;
|
curPaletteChoice=i;
|
||||||
accepted=true;
|
accepted=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
|
||||||
if ((navigated || paletteFirstFrame) && current) ImGui::SetScrollHereY();
|
if ((navigated || paletteFirstFrame) && current) ImGui::SetScrollHereY();
|
||||||
}
|
}
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue