mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Small refactor of text rect measurement. Add move/resize icons
This commit is contained in:
1 parent
f949bc8faf
commit
1ea93e2913
14 files changed
+65
-69
No files matched your search
@@ -528,7 +528,7 @@ void DrawBuffer::MeasureText(FontID font, std::string_view text, float *w, float
|
||||
if (h) *h = atlasfont->height * fontscaley * lines;
|
||||
}
|
||||
|
||||
void DrawBuffer::MeasureTextRect(FontID font_id, std::string_view text, const Bounds &bounds, float *w, float *h, int align) {
|
||||
void DrawBuffer::MeasureTextRect(FontID font_id, std::string_view text, float maxWidth, float *w, float *h, int align) {
|
||||
if (text.empty() || font_id.isInvalid()) {
|
||||
*w = 0.0f;
|
||||
*h = 0.0f;
|
||||
@@ -546,7 +546,7 @@ void DrawBuffer::MeasureTextRect(FontID font_id, std::string_view text, const Bo
|
||||
return;
|
||||
}
|
||||
std::string toMeasure = std::string(text);
|
||||
AtlasWordWrapper wrapper(*font, fontscalex, toMeasure, bounds.w, wrap);
|
||||
AtlasWordWrapper wrapper(*font, fontscalex, toMeasure, maxWidth, wrap);
|
||||
toMeasure = wrapper.Wrapped();
|
||||
MeasureText(font_id, toMeasure, w, h);
|
||||
} else {
|
||||
@@ -591,7 +591,7 @@ void DrawBuffer::DrawTextRect(FontID font, std::string_view text, float x, float
|
||||
}
|
||||
|
||||
float totalWidth, totalHeight;
|
||||
MeasureTextRect(font, toDraw, Bounds(x, y, w, h), &totalWidth, &totalHeight, align);
|
||||
MeasureTextRect(font, toDraw, w, &totalWidth, &totalHeight, align);
|
||||
|
||||
std::vector<std::string_view> lines;
|
||||
SplitString(toDraw, '\n', lines);
|
||||
|
||||
@@ -128,8 +128,7 @@ public:
|
||||
void DrawImage2GridH(ImageID atlas_image, float x1, float y1, float x2, Color color = COLOR(0xFFFFFF), float scale = 1.0);
|
||||
|
||||
void MeasureText(FontID font, std::string_view text, float *w, float *h);
|
||||
|
||||
void MeasureTextRect(FontID font, std::string_view text, const Bounds &bounds, float *w, float *h, int align = 0);
|
||||
void MeasureTextRect(FontID font, std::string_view text, float maxWidth, float *w, float *h, int align = 0);
|
||||
|
||||
void DrawTextRect(FontID font, std::string_view text, float x, float y, float w, float h, Color color = 0xFFFFFFFF, int align = 0);
|
||||
void DrawText(FontID font, std::string_view text, float x, float y, Color color = 0xFFFFFFFF, int align = 0);
|
||||
|
||||
@@ -148,15 +148,15 @@ void TextDrawer::MeasureString(std::string_view str, float *w, float *h) {
|
||||
*h = entry->height * fontScaleY_ * dpiScale_;
|
||||
}
|
||||
|
||||
void TextDrawer::MeasureStringRect(std::string_view str, const Bounds &bounds, float *w, float *h, int align) {
|
||||
void TextDrawer::MeasureStringRect(std::string_view str, float maxWidth, float *w, float *h, int align) {
|
||||
const int wrap = align & (FLAG_WRAP_TEXT | FLAG_ELLIPSIZE_TEXT);
|
||||
|
||||
float plainW, plainH;
|
||||
MeasureString(str, &plainW, &plainH);
|
||||
|
||||
if (wrap && plainW > bounds.w) {
|
||||
if (wrap && plainW > maxWidth) {
|
||||
std::string toMeasure = std::string(str);
|
||||
WrapString(toMeasure, toMeasure, bounds.w, wrap);
|
||||
WrapString(toMeasure, toMeasure, maxWidth, wrap);
|
||||
MeasureString(toMeasure, w, h);
|
||||
} else {
|
||||
*w = plainW;
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
void SetFontScale(float xscale, float yscale);
|
||||
void MeasureString(std::string_view str, float *w, float *h);
|
||||
void MeasureStringRect(std::string_view str, const Bounds &bounds, float *w, float *h, int align = ALIGN_TOPLEFT);
|
||||
void MeasureStringRect(std::string_view str, float maxWidth, float *w, float *h, int align = ALIGN_TOPLEFT);
|
||||
|
||||
void DrawString(DrawBuffer &target, std::string_view str, float x, float y, uint32_t color, int align = ALIGN_TOPLEFT);
|
||||
void DrawStringRect(DrawBuffer &target, std::string_view str, const Bounds &bounds, uint32_t color, int align);
|
||||
|
||||
@@ -229,16 +229,16 @@ void UIContext::MeasureText(const FontStyle &style, float scaleX, float scaleY,
|
||||
}
|
||||
}
|
||||
|
||||
void UIContext::MeasureTextRect(const FontStyle &style, float scaleX, float scaleY, std::string_view str, const Bounds &bounds, float *x, float *y, int align) const {
|
||||
void UIContext::MeasureTextRect(const FontStyle &style, float scaleX, float scaleY, std::string_view str, float maxWidth, float *x, float *y, int align) const {
|
||||
_dbg_assert_(str.data() != nullptr);
|
||||
if (!textDrawer_ || (align & FLAG_DYNAMIC_ASCII)) {
|
||||
float sizeFactor = (float)style.sizePts / 24.0f;
|
||||
Draw()->SetFontScale(scaleX * sizeFactor, scaleY * sizeFactor);
|
||||
Draw()->MeasureTextRect(AtlasFontFromStyle(style), str, bounds, x, y, align);
|
||||
Draw()->MeasureTextRect(AtlasFontFromStyle(style), str, maxWidth, x, y, align);
|
||||
} else {
|
||||
textDrawer_->SetOrCreateFont(style);
|
||||
textDrawer_->SetFontScale(scaleX, scaleY);
|
||||
textDrawer_->MeasureStringRect(str, bounds, x, y, align);
|
||||
textDrawer_->MeasureStringRect(str, maxWidth, x, y, align);
|
||||
textDrawer_->SetOrCreateFont(*fontStyle_);
|
||||
}
|
||||
}
|
||||
@@ -295,11 +295,11 @@ void UIContext::DrawTextRect(std::string_view str, const Bounds &bounds, uint32_
|
||||
|
||||
static constexpr float MIN_TEXT_SCALE = 0.7f;
|
||||
|
||||
float UIContext::CalculateTextScale(std::string_view str, float availWidth, float availHeight) const {
|
||||
float UIContext::CalculateTextScale(std::string_view str, float availWidth) const {
|
||||
float actualWidth, actualHeight;
|
||||
Bounds availBounds(0, 0, availWidth, availHeight);
|
||||
MeasureTextRect(theme->uiFont, 1.0f, 1.0f, str, availBounds, &actualWidth, &actualHeight, ALIGN_VCENTER);
|
||||
MeasureTextRect(theme->uiFont, 1.0f, 1.0f, str, availWidth, &actualWidth, &actualHeight, ALIGN_VCENTER);
|
||||
if (actualWidth > availWidth) {
|
||||
// TODO: Return feedback that wrapping was needed.
|
||||
return std::max(MIN_TEXT_SCALE, availWidth / actualWidth);
|
||||
}
|
||||
return 1.0f;
|
||||
@@ -312,7 +312,7 @@ void UIContext::DrawTextRectSqueeze(std::string_view str, const Bounds &bounds,
|
||||
}
|
||||
float origScaleX = fontScaleX_;
|
||||
float origScaleY = fontScaleY_;
|
||||
float scale = CalculateTextScale(str, bounds.w / origScaleX, bounds.h / origScaleY);
|
||||
float scale = CalculateTextScale(str, bounds.w / origScaleX);
|
||||
SetFontScale(scale * origScaleX, scale * origScaleY);
|
||||
Bounds textBounds(bounds.x, bounds.y, bounds.w, bounds.h);
|
||||
DrawTextRect(str, textBounds, color, align);
|
||||
|
||||
+2
-2
@@ -95,7 +95,7 @@ public:
|
||||
const FontStyle &GetFontStyle() { return *fontStyle_; }
|
||||
void SetFontScale(float scaleX, float scaleY);
|
||||
void MeasureText(const FontStyle &style, float scaleX, float scaleY, std::string_view str, float *x, float *y, int align = 0) const;
|
||||
void MeasureTextRect(const FontStyle &style, float scaleX, float scaleY, std::string_view str, const Bounds &bounds, float *x, float *y, int align = 0) const;
|
||||
void MeasureTextRect(const FontStyle &style, float scaleX, float scaleY, std::string_view str, float maxWidth, float *x, float *y, int align = 0) const;
|
||||
void DrawText(std::string_view str, float x, float y, uint32_t color, int align = 0);
|
||||
void DrawTextShadow(std::string_view str, float x, float y, uint32_t color, int align = 0);
|
||||
void DrawTextRect(std::string_view str, const Bounds &bounds, uint32_t color, int align = 0);
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
// Will squeeze the text into the bounds if needed.
|
||||
void DrawTextRectSqueeze(std::string_view str, const Bounds &bounds, uint32_t color, int align = 0);
|
||||
|
||||
float CalculateTextScale(std::string_view str, float availWidth, float availHeight) const;
|
||||
float CalculateTextScale(std::string_view str, float availWidth) const;
|
||||
|
||||
void FillRect(const UI::Drawable &drawable, const Bounds &bounds);
|
||||
void DrawRectDropShadow(const Bounds &bounds, float radius, float alpha, uint32_t color = 0);
|
||||
|
||||
@@ -821,10 +821,9 @@ void AbstractChoiceWithValueDisplay::GetContentDimensionsBySpec(const UIContext
|
||||
availWidth = 65535.0f;
|
||||
}
|
||||
float scale = CalculateValueScale(dc, valueText, availWidth);
|
||||
Bounds availBounds(0, 0, availWidth, vert.size);
|
||||
|
||||
float valueW, valueH;
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, scale, scale, valueText, availBounds, &valueW, &valueH, ALIGN_RIGHT | ALIGN_VCENTER | FLAG_WRAP_TEXT);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, scale, scale, valueText, availWidth, &valueW, &valueH, ALIGN_RIGHT | ALIGN_VCENTER | FLAG_WRAP_TEXT);
|
||||
valueW += paddingX;
|
||||
|
||||
// Give the choice itself less space to grow in, so it shrinks if needed.
|
||||
@@ -868,8 +867,7 @@ void AbstractChoiceWithValueDisplay::Draw(UIContext &dc) {
|
||||
float scale = CalculateValueScale(dc, valueText, availWidth);
|
||||
|
||||
float w, h;
|
||||
Bounds availBounds(0, 0, availWidth, bounds_.h);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, scale, scale, valueText, availBounds, &w, &h, ALIGN_RIGHT | ALIGN_VCENTER | FLAG_WRAP_TEXT);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, scale, scale, valueText, availWidth, &w, &h, ALIGN_RIGHT | ALIGN_VCENTER | FLAG_WRAP_TEXT);
|
||||
textPadding_.right = w + paddingX;
|
||||
|
||||
Choice::Draw(dc);
|
||||
@@ -899,8 +897,7 @@ void AbstractChoiceWithValueDisplay::Draw(UIContext &dc) {
|
||||
|
||||
float AbstractChoiceWithValueDisplay::CalculateValueScale(const UIContext &dc, std::string_view valueText, float availWidth) const {
|
||||
float actualWidth, actualHeight;
|
||||
Bounds availBounds(0, 0, availWidth, bounds_.h);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, 1.0f, 1.0f, valueText, availBounds, &actualWidth, &actualHeight);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, 1.0f, 1.0f, valueText, availWidth, &actualWidth, &actualHeight);
|
||||
if (actualWidth > availWidth) {
|
||||
return std::max(0.8f, availWidth / actualWidth);
|
||||
}
|
||||
|
||||
+22
-33
@@ -45,7 +45,7 @@ void MeasureBySpec(Size sz, float contentDim, MeasureSpec spec, float *measured)
|
||||
}
|
||||
}
|
||||
|
||||
static void ApplyBoundBySpec(float &bound, MeasureSpec spec) {
|
||||
void ApplyBoundBySpec(float &bound, MeasureSpec spec) {
|
||||
switch (spec.type) {
|
||||
case AT_MOST:
|
||||
bound = bound < spec.size ? bound : spec.size;
|
||||
@@ -485,10 +485,9 @@ void Choice::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz,
|
||||
}
|
||||
if (horiz.type != EXACTLY && layoutParams_->width > 0.0f && availWidth > layoutParams_->width)
|
||||
availWidth = layoutParams_->width;
|
||||
float scale = dc.CalculateTextScale(text_, availWidth, bounds_.h);
|
||||
Bounds availBounds(0, 0, availWidth, vert.size);
|
||||
float scale = dc.CalculateTextScale(text_, availWidth);
|
||||
float textW = 0.0f, textH = 0.0f;
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, scale, scale, text_, availBounds, &textW, &textH, FLAG_WRAP_TEXT);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, scale, scale, text_, availWidth, &textW, &textH, FLAG_WRAP_TEXT);
|
||||
totalH = std::max(totalH, textH);
|
||||
totalW += textW;
|
||||
if (image_.isValid()) {
|
||||
@@ -592,7 +591,7 @@ void InfoItem::Draw(UIContext &dc) {
|
||||
Bounds padBounds = bounds_.Expand(-paddingX, 0);
|
||||
|
||||
float leftWidth, leftHeight;
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, 1.0f, 1.0f, text_, padBounds, &leftWidth, &leftHeight, ALIGN_VCENTER);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, 1.0f, 1.0f, text_, padBounds.w, &leftWidth, &leftHeight, ALIGN_VCENTER);
|
||||
|
||||
dc.SetFontStyle(dc.GetTheme().uiFont);
|
||||
dc.DrawTextRect(text_, padBounds, style.fgColor, ALIGN_VCENTER);
|
||||
@@ -622,16 +621,13 @@ void ItemHeader::Draw(UIContext &dc) {
|
||||
}
|
||||
|
||||
void ItemHeader::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const {
|
||||
Bounds bounds(0, 0, layoutParams_->width, layoutParams_->height);
|
||||
if (bounds.w < 0) {
|
||||
float availWidth = layoutParams_->width;
|
||||
if (availWidth < 0) {
|
||||
// If there's no size, let's grow as big as we want.
|
||||
bounds.w = horiz.size == 0 ? MAX_ITEM_SIZE : horiz.size;
|
||||
availWidth = horiz.size == 0 ? MAX_ITEM_SIZE : horiz.size;
|
||||
}
|
||||
if (bounds.h < 0) {
|
||||
bounds.h = vert.size == 0 ? MAX_ITEM_SIZE : vert.size;
|
||||
}
|
||||
ApplyBoundsBySpec(bounds, horiz, vert);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFontSmall, 1.0f, 1.0f, text_, bounds, &w, &h, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
ApplyBoundBySpec(availWidth, horiz);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFontSmall, 1.0f, 1.0f, text_, availWidth, &w, &h, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
}
|
||||
|
||||
std::string ItemHeader::DescribeText() const {
|
||||
@@ -664,16 +660,13 @@ void CollapsibleHeader::Draw(UIContext &dc) {
|
||||
}
|
||||
|
||||
void CollapsibleHeader::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const {
|
||||
Bounds bounds(0, 0, layoutParams_->width, layoutParams_->height);
|
||||
if (bounds.w < 0) {
|
||||
float availWidth = layoutParams_->width;
|
||||
if (availWidth < 0) {
|
||||
// If there's no size, let's grow as big as we want.
|
||||
bounds.w = horiz.size == 0 ? MAX_ITEM_SIZE : horiz.size;
|
||||
availWidth = horiz.size == 0 ? MAX_ITEM_SIZE : horiz.size;
|
||||
}
|
||||
if (bounds.h < 0) {
|
||||
bounds.h = vert.size == 0 ? MAX_ITEM_SIZE : vert.size;
|
||||
}
|
||||
ApplyBoundsBySpec(bounds, horiz, vert);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFontSmall, 1.0f, 1.0f, text_, bounds, &w, &h, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
ApplyBoundBySpec(availWidth, horiz);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFontSmall, 1.0f, 1.0f, text_, availWidth, &w, &h, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
}
|
||||
|
||||
void CollapsibleHeader::GetContentDimensions(const UIContext &dc, float &w, float &h) const {
|
||||
@@ -859,11 +852,10 @@ void CheckBox::GetContentDimensions(const UIContext &dc, float &w, float &h) con
|
||||
}
|
||||
|
||||
if (!text_.empty()) {
|
||||
float scale = dc.CalculateTextScale(text_, availWidth, bounds_.h);
|
||||
float scale = dc.CalculateTextScale(text_, availWidth);
|
||||
|
||||
float actualWidth, actualHeight;
|
||||
Bounds availBounds(0, 0, availWidth, bounds_.h);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, scale, scale, text_, availBounds, &actualWidth, &actualHeight, ALIGN_VCENTER | FLAG_WRAP_TEXT);
|
||||
dc.MeasureTextRect(dc.GetTheme().uiFont, scale, scale, text_, availWidth, &actualWidth, &actualHeight, ALIGN_VCENTER | FLAG_WRAP_TEXT);
|
||||
h = std::max(actualHeight, ITEM_HEIGHT);
|
||||
} else {
|
||||
h = std::max(imageH, ITEM_HEIGHT);
|
||||
@@ -1093,22 +1085,19 @@ const FontStyle *TextView::GetTextStyle(const UIContext &dc, TextSize size) {
|
||||
}
|
||||
|
||||
void TextView::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const {
|
||||
Bounds bounds(0, 0, layoutParams_->width, layoutParams_->height);
|
||||
if (bounds.w < 0) {
|
||||
float availWidth = layoutParams_->width;
|
||||
if (availWidth < 0) {
|
||||
// If there's no size, let's grow as big as we want.
|
||||
bounds.w = horiz.size == 0 ? MAX_ITEM_SIZE : horiz.size;
|
||||
availWidth = horiz.size == 0 ? MAX_ITEM_SIZE : horiz.size;
|
||||
}
|
||||
if (bounds.h < 0) {
|
||||
bounds.h = vert.size == 0 ? MAX_ITEM_SIZE : vert.size;
|
||||
}
|
||||
ApplyBoundsBySpec(bounds, horiz, vert);
|
||||
ApplyBoundBySpec(availWidth, horiz);
|
||||
if (bullet_) {
|
||||
bounds.w -= bulletOffset;
|
||||
availWidth -= bulletOffset;
|
||||
}
|
||||
const FontStyle *style = GetTextStyle(dc, textSize_);
|
||||
float measuredW;
|
||||
float measuredH;
|
||||
dc.MeasureTextRect(*style, 1.0f, 1.0f, text_, bounds, &measuredW, &measuredH, textAlign_);
|
||||
dc.MeasureTextRect(*style, 1.0f, 1.0f, text_, availWidth, &measuredW, &measuredH, textAlign_);
|
||||
w = measuredW + pad_.horiz();
|
||||
h = measuredH + pad_.vert();
|
||||
if (bullet_) {
|
||||
|
||||
@@ -1178,6 +1178,7 @@ private:
|
||||
};
|
||||
|
||||
void MeasureBySpec(Size sz, float contentWidth, MeasureSpec spec, float *measured);
|
||||
void ApplyBoundBySpec(float &bound, MeasureSpec spec);
|
||||
void ApplyBoundsBySpec(Bounds &bounds, MeasureSpec horiz, MeasureSpec vert);
|
||||
|
||||
bool IsDPadKey(const KeyInput &key);
|
||||
|
||||
@@ -788,8 +788,7 @@ void PPGeMeasureText(float *w, float *h, std::string_view text, float scale, int
|
||||
int dtalign = (WrapType & PPGE_LINE_WRAP_WORD) ? FLAG_WRAP_TEXT : 0;
|
||||
if (WrapType & PPGE_LINE_USE_ELLIPSIS)
|
||||
dtalign |= FLAG_ELLIPSIZE_TEXT;
|
||||
Bounds b(0, 0, wrapWidth <= 0 ? 480.0f : wrapWidth, 272.0f);
|
||||
textDrawer->MeasureStringRect(s, b, &mw, &mh, dtalign);
|
||||
textDrawer->MeasureStringRect(s, wrapWidth <= 0 ? 480.0f : wrapWidth, &mw, &mh, dtalign);
|
||||
|
||||
if (w)
|
||||
*w = mw;
|
||||
@@ -1121,7 +1120,7 @@ void PPGeDrawTextWrapped(std::string_view text, float x, float y, float wrapWidt
|
||||
Bounds b(0, 0, wrapWidth <= 0 ? 480.0f - x : wrapWidth, wrapHeight);
|
||||
int tdalign = 0;
|
||||
textDrawer->SetFontScale(style.scale, style.scale);
|
||||
textDrawer->MeasureStringRect(s, b, &actualWidth, &actualHeight, tdalign | FLAG_WRAP_TEXT);
|
||||
textDrawer->MeasureStringRect(s, b.w, &actualWidth, &actualHeight, tdalign | FLAG_WRAP_TEXT);
|
||||
|
||||
// Check if we need to scale the text down to fit better.
|
||||
PPGeStyle adjustedStyle = style;
|
||||
@@ -1129,7 +1128,7 @@ void PPGeDrawTextWrapped(std::string_view text, float x, float y, float wrapWidt
|
||||
// Cheap way to get the line height.
|
||||
float oneLine, twoLines;
|
||||
textDrawer->MeasureString("|", &actualWidth, &oneLine);
|
||||
textDrawer->MeasureStringRect("|\n|", Bounds(0, 0, 480, 272), &actualWidth, &twoLines);
|
||||
textDrawer->MeasureStringRect("|\n|", 480, &actualWidth, &twoLines);
|
||||
|
||||
float lineHeight = twoLines - oneLine;
|
||||
if (actualHeight > wrapHeight * maxScaleDown) {
|
||||
|
||||
@@ -285,8 +285,8 @@ void DisplayLayoutScreen::CreateViews() {
|
||||
|
||||
mode_ = new ChoiceStrip(ORIENT_HORIZONTAL, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT));
|
||||
mode_->AddChoice(di->T("Inactive"));
|
||||
mode_->AddChoice(di->T("Move"));
|
||||
mode_->AddChoice(di->T("Resize"));
|
||||
mode_->AddChoice(di->T("Move")); // , ImageID("I_MOVE") (can't fit the icons here yet, especially not in portrait)
|
||||
mode_->AddChoice(di->T("Resize")); // , ImageID("I_RESIZE"));
|
||||
mode_->SetSelection(0, false);
|
||||
bottomControls->Add(mode_);
|
||||
|
||||
|
||||
@@ -655,8 +655,8 @@ void TouchControlLayoutScreen::CreateViews() {
|
||||
LinearLayout *leftColumn = leftColumnScroll->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(Margins(12.0f, 0.0f))));
|
||||
|
||||
mode_ = new ChoiceStrip(ORIENT_VERTICAL);
|
||||
mode_->AddChoice(di->T("Move"));
|
||||
mode_->AddChoice(di->T("Resize"));
|
||||
mode_->AddChoice(di->T("Move"), ImageID("I_MOVE"));
|
||||
mode_->AddChoice(di->T("Resize"), ImageID("I_RESIZE"));
|
||||
mode_->SetSelection(0, false);
|
||||
mode_->OnChoice.Handle(this, &TouchControlLayoutScreen::OnMode);
|
||||
|
||||
|
||||
@@ -169,6 +169,8 @@ static const ImageMeta imageIDs[] = {
|
||||
{"I_DEVICE_ROTATION_AUTO", false},
|
||||
{"I_DEVICE_ROTATION_LANDSCAPE", false},
|
||||
{"I_DEVICE_ROTATION_PORTRAIT", false},
|
||||
{"I_MOVE", false},
|
||||
{"I_RESIZE", false},
|
||||
};
|
||||
|
||||
static std::string PNGNameFromID(std::string_view id) {
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
inkscape:pagecheckerboard="true"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="px"
|
||||
inkscape:zoom="4.0000005"
|
||||
inkscape:cx="140.74998"
|
||||
inkscape:cy="572.37493"
|
||||
inkscape:zoom="5.656855"
|
||||
inkscape:cx="250.49255"
|
||||
inkscape:cy="560.11689"
|
||||
inkscape:window-width="3840"
|
||||
inkscape:window-height="2071"
|
||||
inkscape:window-x="-9"
|
||||
@@ -4417,7 +4417,16 @@
|
||||
class="st0"
|
||||
d="m 187.64684,-0.00670467 c -31.31297,0 -56.68624,25.38881767 -56.68624,56.70178667 V 455.31782 c 0,31.31197 25.37327,56.68624 56.68624,56.68624 h 167.64555 c 31.31197,0 56.70179,-25.37427 56.70179,-56.68624 V 56.695082 c 0,-31.312969 -25.38982,-56.70178667 -56.70179,-56.70178667 z M 189.40647,19.365499 H 347.472 c 32.17406,0 42.63128,22.427903 42.63128,41.636246 V 413.69712 c 0,17.6192 -11.53333,41.12318 -38.65112,41.12318 H 189.40647 c -19.02726,0 -38.54505,-18.22698 -38.54505,-41.12318 V 60.504224 c 0,-23.138502 13.18539,-41.138725 38.54505,-41.138725 z m 85.50526,448.219311 c 8.09399,0 14.66131,6.05813 14.66131,14.66131 0,8.10999 -6.56732,14.67685 -14.66131,14.67685 -8.09399,0 -14.67685,-6.56786 -14.67685,-14.67685 0,-8.094 6.58286,-14.66131 14.67685,-14.66131 z"
|
||||
sodipodi:nodetypes="sssssssssssssssssssssss" />
|
||||
</g></g></g><path
|
||||
</g></g><path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="m 67.075196,157.58281 -1.76127,1.76126 0.587085,0.58708 0.759054,-0.75904 v 3.03615 h -3.036106 l 0.759021,-0.75903 -0.587085,-0.58708 -1.761254,1.76124 1.761254,1.76126 0.587085,-0.5871 -0.759049,-0.75903 h 3.036134 v 3.03616 l -0.759054,-0.75902 -0.587085,0.58705 1.76127,1.76126 1.76121,-1.76126 -0.587051,-0.58705 -0.759027,0.75902 v -3.03616 h 3.036106 l -0.759082,0.75908 0.587107,0.58705 1.761265,-1.76126 -1.761265,-1.76123 -0.587107,0.58708 0.759027,0.75902 h -3.036051 v -3.03615 l 0.759027,0.75904 0.587051,-0.58708 z"
|
||||
fill="#080341"
|
||||
id="I_MOVE"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.553509" /><path
|
||||
id="I_RESIZE"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.645958"
|
||||
d="m 73.353766,158.91621 v 2.9068 h 0.968933 v -1.25315 l 1.513086,1.51308 0.685229,-0.68523 -1.513086,-1.51257 h 1.252637 v -0.96893 z m 5.412589,0 v 0.96893 h 1.252636 l -1.551843,1.55185 0.68523,0.68471 1.551843,-1.55184 v 1.25315 h 0.968933 v -2.9068 z m -2.896981,5.11803 -1.546675,1.54668 v -1.25264 h -0.968933 v 2.9068 h 2.906799 v -0.96893 h -1.252637 l 1.547193,-1.54668 z m 3.303674,0.0155 -0.685229,0.68523 1.531172,1.53117 h -1.252636 v 0.96893 h 2.906799 v -2.9068 h -0.968933 v 1.25264 z" /></g><path
|
||||
id="I_GEAR"
|
||||
style="fill:#ececec;fill-opacity:1;stroke-width:0.019487"
|
||||
class="st0"
|
||||
|
||||
|
Before Width: | Height: | Size: 231 KiB After Width: | Height: | Size: 232 KiB |
Reference in new issue
Block a user