table ahead
This commit is contained in:
parent
492a583723
commit
120f037fe1
|
@ -111,40 +111,51 @@ internal class Write : ITab {
|
||||||
var lineHeight = ImGui.CalcTextSize("A").Y;
|
var lineHeight = ImGui.CalcTextSize("A").Y;
|
||||||
var imageHeight = lineHeight * 4;
|
var imageHeight = lineHeight * 4;
|
||||||
|
|
||||||
var glyphImage = this.GlyphImages[this._glyph];
|
|
||||||
ImGui.Image(glyphImage.ImGuiHandle, new Vector2(imageHeight));
|
|
||||||
|
|
||||||
var actualText = string.Empty;
|
var actualText = string.Empty;
|
||||||
if (this._part1 != -1) {
|
|
||||||
var preview = new StringBuilder();
|
|
||||||
|
|
||||||
var template1 = pack.Templates[this._part1];
|
if (ImGui.BeginTable("##message-preview", 2)) {
|
||||||
var word1 = this._word1 == (-1, -1) ? placeholder : pack.Words[this._word1.Item1].Words[this._word1.Item2];
|
ImGui.TableSetupColumn("##image", ImGuiTableColumnFlags.WidthFixed);
|
||||||
preview.Append(string.Format(template1, word1));
|
ImGui.TableSetupColumn("##message", ImGuiTableColumnFlags.WidthStretch);
|
||||||
|
ImGui.TableNextRow();
|
||||||
|
|
||||||
if (this._conj != -1) {
|
if (ImGui.TableSetColumnIndex(0)) {
|
||||||
var conj = pack.Conjunctions[this._conj];
|
var glyphImage = this.GlyphImages[this._glyph];
|
||||||
var isPunc = conj.Length == 1 && char.IsPunctuation(conj[0]);
|
ImGui.Image(glyphImage.ImGuiHandle, new Vector2(imageHeight));
|
||||||
if (isPunc) {
|
|
||||||
preview.Append(conj);
|
|
||||||
preview.Append('\n');
|
|
||||||
} else {
|
|
||||||
preview.Append('\n');
|
|
||||||
preview.Append(conj);
|
|
||||||
preview.Append(' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._part2 != -1) {
|
|
||||||
var template2 = pack.Templates[this._part2];
|
|
||||||
var word2 = this._word2 == (-1, -1) ? placeholder : pack.Words[this._word2.Item1].Words[this._word2.Item2];
|
|
||||||
preview.Append(string.Format(template2, word2));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actualText = preview.ToString();
|
if (ImGui.TableSetColumnIndex(1) && this._part1 != -1) {
|
||||||
var actualSize = ImGui.CalcTextSize(actualText);
|
var preview = new StringBuilder();
|
||||||
ImGui.SameLine(0, imageHeight / 2 - actualSize.Y / 2);
|
|
||||||
ImGui.TextUnformatted(actualText);
|
var template1 = pack.Templates[this._part1];
|
||||||
|
var word1 = this._word1 == (-1, -1) ? placeholder : pack.Words[this._word1.Item1].Words[this._word1.Item2];
|
||||||
|
preview.Append(string.Format(template1, word1));
|
||||||
|
|
||||||
|
if (this._conj != -1) {
|
||||||
|
var conj = pack.Conjunctions[this._conj];
|
||||||
|
var isPunc = conj.Length == 1 && char.IsPunctuation(conj[0]);
|
||||||
|
if (isPunc) {
|
||||||
|
preview.Append(conj);
|
||||||
|
preview.Append('\n');
|
||||||
|
} else {
|
||||||
|
preview.Append('\n');
|
||||||
|
preview.Append(conj);
|
||||||
|
preview.Append(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._part2 != -1) {
|
||||||
|
var template2 = pack.Templates[this._part2];
|
||||||
|
var word2 = this._word2 == (-1, -1) ? placeholder : pack.Words[this._word2.Item1].Words[this._word2.Item2];
|
||||||
|
preview.Append(string.Format(template2, word2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
actualText = preview.ToString();
|
||||||
|
var actualSize = ImGui.CalcTextSize(actualText);
|
||||||
|
ImGui.Dummy(new Vector2(1, imageHeight / 2 - actualSize.Y / 2));
|
||||||
|
ImGui.TextUnformatted(actualText);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user