mirror of https://github.com/odrling/Aegisub
Don't return a dummy icon when no icon is found for a command
The hotkey editor initially required this, but now that we've using fully custom renderers they're no longer needed, and the blank icons didn't work correctly on wxGTK. Originally committed to SVN as r6490.
This commit is contained in:
parent
113c85bda0
commit
ad7d7c2be3
|
@ -53,19 +53,8 @@ wxBitmap const& get(std::string const& name, const int size) {
|
|||
|
||||
LOG_W("icon/get") << "Icon not found: " << name << " " << size;
|
||||
|
||||
static wxBitmap empty16(16, 16, 1);
|
||||
static wxBitmap empty24(24, 24, 1);
|
||||
static bool initialized = false;
|
||||
|
||||
if (!initialized) {
|
||||
empty16.SetMask(new wxMask(empty16));
|
||||
empty24.SetMask(new wxMask(empty24));
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
if (size != 24)
|
||||
return empty16;
|
||||
return empty24;
|
||||
static wxBitmap bad;
|
||||
return bad;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -271,6 +271,7 @@ Interface_Colours::Interface_Colours(wxTreebook *book, Preferences *parent): Opt
|
|||
class CommandRenderer : public wxDataViewCustomRenderer {
|
||||
wxArrayString autocomplete;
|
||||
wxDataViewIconText value;
|
||||
static const int icon_width = 20;
|
||||
|
||||
public:
|
||||
CommandRenderer()
|
||||
|
@ -288,11 +289,8 @@ public:
|
|||
wxString text = iconText.GetText();
|
||||
|
||||
// adjust the label rect to take the width of the icon into account
|
||||
if (iconText.GetIcon().IsOk()) {
|
||||
int w = iconText.GetIcon().GetWidth() + 4;
|
||||
label_rect.x += w;
|
||||
label_rect.width -= w;
|
||||
}
|
||||
label_rect.x += icon_width;
|
||||
label_rect.width -= icon_width;
|
||||
|
||||
wxTextCtrl* ctrl = new wxTextCtrl(parent, -1, text, label_rect.GetPosition(), label_rect.GetSize(), wxTE_PROCESS_ENTER);
|
||||
ctrl->SetInsertionPointEnd();
|
||||
|
@ -307,15 +305,11 @@ public:
|
|||
}
|
||||
|
||||
bool Render(wxRect rect, wxDC *dc, int state) {
|
||||
int xoffset = 0;
|
||||
|
||||
wxIcon const& icon = value.GetIcon();
|
||||
if (icon.IsOk()) {
|
||||
if (icon.IsOk())
|
||||
dc->DrawIcon(icon, rect.x, rect.y + (rect.height - icon.GetHeight()) / 2);
|
||||
xoffset = icon.GetWidth() + 4;
|
||||
}
|
||||
|
||||
RenderText(value.GetText(), xoffset, rect, dc, state);
|
||||
RenderText(value.GetText(), icon_width, rect, dc, state);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -323,9 +317,7 @@ public:
|
|||
wxSize GetSize() const {
|
||||
if (!value.GetText().empty()) {
|
||||
wxSize size = GetTextExtent(value.GetText());
|
||||
|
||||
if (value.GetIcon().IsOk())
|
||||
size.x += value.GetIcon().GetWidth() + 4;
|
||||
size.x += icon_width;
|
||||
return size;
|
||||
}
|
||||
return wxSize(80,20);
|
||||
|
|
Loading…
Reference in New Issue