Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions WeaselUI/WeaselPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ WeaselPanel::WeaselPanel(weasel::UI& ui)
m_ctx(ui.ctx()),
m_octx(ui.octx()),
m_status(ui.status()),
m_ostatus(ui.ostatus()),
m_style(ui.style()),
m_ostyle(ui.ostyle()),
m_candidateCount(0),
Expand Down Expand Up @@ -130,19 +131,11 @@ void WeaselPanel::_CreateLayout() {

// 更新界面
void WeaselPanel::Refresh() {
bool should_show_icon =
(m_status.ascii_mode || !m_status.composing || !m_ctx.aux.empty());
m_candidateCount = (BYTE)m_ctx.cinfo.candies.size();
// check if to hide candidates window
// show tips status, two kind of situation: 1) only aux strings, don't care
// icon status; 2)only icon(ascii mode switching)
bool show_tips =
(!m_ctx.aux.empty() && m_ctx.cinfo.empty() && m_ctx.preedit.empty()) ||
(m_ctx.empty() && should_show_icon);
// show schema menu status: schema_id == L".default"
bool ascii_mode_changed = (m_status.ascii_mode != m_ostatus.ascii_mode);
bool show_tips = !m_ctx.aux.empty() || ascii_mode_changed;
bool show_schema_menu = m_status.schema_id == L".default";
bool margin_negative =
(DPI_SCALE(m_style.margin_x) < 0 || DPI_SCALE(m_style.margin_y) < 0);
bool margin_negative = (m_style.margin_x < 0 || m_style.margin_y < 0);
// when to hide_cadidates?
// 1. margin_negative, and not in show tips mode( ascii switching / half-full
// switching / simp-trad switching / error tips), and not in schema menu
Expand All @@ -168,6 +161,7 @@ void WeaselPanel::Refresh() {
RedrawWindow();
}
}
m_ostatus = m_status;
}

void WeaselPanel::_InitFontRes(bool forced) {
Expand Down
1 change: 1 addition & 0 deletions WeaselUI/WeaselPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class WeaselPanel
weasel::Context& m_ctx;
weasel::Context& m_octx;
weasel::Status& m_status;
weasel::Status& m_ostatus;
weasel::UIStyle& m_style;
weasel::UIStyle& m_ostyle;

Expand Down
2 changes: 2 additions & 0 deletions include/WeaselUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class UI {
Context& ctx() { return ctx_; }
Context& octx() { return octx_; }
Status& status() { return status_; }
Status& ostatus() { return ostatus_; }
UIStyle& style() { return style_; }
UIStyle& ostyle() { return ostyle_; }
PDWR pdwr() { return pDWR; }
Expand All @@ -85,6 +86,7 @@ class UI {
Context ctx_;
Context octx_;
Status status_;
Status ostatus_;
UIStyle style_;
UIStyle ostyle_;
std::function<void(size_t* const, size_t* const, bool* const, bool* const)>
Expand Down
Loading