Skip to content

Commit 0c7928a

Browse files
committed
Added empty background for rich edit box
Signed-off-by: 邓佳佳 <2894220@gmail.com>
1 parent e51adf3 commit 0c7928a

6 files changed

Lines changed: 38 additions & 25 deletions

File tree

327 Bytes
Loading

bin/themes/default/main_form/log_file_item.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Window>
3-
<ListContainerElement class="listitem" name="log_file_item" padding="8,8,8,8" height="auto">
3+
<ListContainerElement class="listitem" name="log_file_item" padding="8,8,8,8" height="auto">
44
<BubbledEvent type="mouseenter" receiver="./open_file ./open_folder ./clear ./delete" applyattribute="visible=&quot;true&quot;" />
55
<BubbledEvent type="mouseleave" receiver="./open_file ./open_folder ./clear ./delete" applyattribute="visible=&quot;false&quot;" />
66
<VBox width="stretch" height="auto" mouse="false">

bin/themes/default/main_form/main_form.xml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Window size="1280,720" mininfo="1280,720" caption="0,0,0,35" >
3-
<VBox bkcolor="bk_wnd_lightcolor">
4-
<!-- 标题栏 -->
5-
<HBox height="35" width="stretch" padding="8,0,8" bkcolor="darkcolor">
3+
<VBox bkcolor="bk_wnd_lightcolor">
4+
<!-- 标题栏 -->
5+
<HBox height="35" width="stretch" padding="8,0,8" bkcolor="darkcolor">
66
<Control width="auto" height="auto" valign="center" bkimage="logo.png" margin="0,0,5"/>
7-
<Label text="Logs Monitor - Tail for Windows" normaltextcolor="white" valign="center"/>
8-
<Control width="stretch"/>
9-
<Button class="btn_wnd_min" name="btn_wnd_min" valign="center"/>
10-
<Button class="btn_wnd_max" name="btn_wnd_max" valign="center"/>
11-
<Button class="btn_wnd_restore" name="btn_wnd_restore" valign="center" visible="false"/>
12-
<Button class="btn_wnd_close" name="btn_close" valign="center"/>
13-
</HBox>
7+
<Label text="Logs Monitor - Tail for Windows" normaltextcolor="white" valign="center"/>
8+
<Control width="stretch"/>
9+
<Button class="btn_wnd_min" name="btn_wnd_min" valign="center"/>
10+
<Button class="btn_wnd_max" name="btn_wnd_max" valign="center"/>
11+
<Button class="btn_wnd_restore" name="btn_wnd_restore" valign="center" visible="false"/>
12+
<Button class="btn_wnd_close" name="btn_close" valign="center"/>
13+
</HBox>
1414
<HBox padding="8,8,8,8">
1515
<!-- 日志列表 -->
1616
<Box name="box_side_bar" width="260" fadeinoutxfromleft="true">
@@ -21,17 +21,17 @@
2121
hotimage="../public/button/icon_hover.png"
2222
pushedimage="../public/button/icon_pushed.png"
2323
disabledimage="new_file_normal.png" />
24-
<Button name="btn_refresh_all" width="24" height="24" valign="center" tooltiptext="清空所有监控的日志文件" margin="0,0,5"
24+
<Button name="btn_refresh_all" width="24" height="24" valign="center" tooltiptext="清空所有监控的日志文件" margin="0,0,5"
2525
forenormalimage="refresh_all_normal.png"
2626
hotimage="../public/button/icon_hover.png"
2727
pushedimage="../public/button/icon_pushed.png"
2828
disabledimage="refresh_all_normal.png" />
29-
<Button name="btn_remove_all" width="24" height="24" valign="center" tooltiptext="从列表中移除所有监控的日志文件" margin="0,0,5"
29+
<Button name="btn_remove_all" width="24" height="24" valign="center" tooltiptext="从列表中移除所有监控的日志文件" margin="0,0,5"
3030
forenormalimage="remove_all_normal.png"
3131
hotimage="../public/button/icon_hover.png"
3232
pushedimage="../public/button/icon_pushed.png"
3333
disabledimage="remove_all_normal.png" />
34-
<Button name="btn_settings" width="24" height="24" valign="center" tooltiptext="打开工具设置" visible="false" margin="0,0,5"
34+
<Button name="btn_settings" width="24" height="24" valign="center" tooltiptext="打开工具设置" visible="false" margin="0,0,5"
3535
forenormalimage="settings_normal.png"
3636
hotimage="../public/button/icon_hover.png"
3737
pushedimage="../public/button/icon_pushed.png"
@@ -53,8 +53,14 @@
5353
<Control />
5454
</VBox>
5555
<!-- 日志内容 -->
56-
<HBox name="box_container" bkcolor="bk_gray">
57-
</HBox>
56+
<Box name="box_container" bkcolor="bk_gray">
57+
<Box name="empty_background">
58+
<HBox width="auto" height="auto" valign="center" halign="center">
59+
<Control width="auto" height="auto" valign="center" bkimage="empty.png" margin="0,0,15" />
60+
<Label font="2" valign="center" normaltextcolor="gray" text="还没有添加任何要监控的日志文件" />
61+
</HBox>
62+
</Box>
63+
</Box>
5864
</HBox>
59-
</VBox>
65+
</VBox>
6066
</Window>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Window>
3-
<RichEdit class="prompt" name="log_edit" bkcolor="bk_gray" width="stretch" height="stretch" font="1" multiline="true" vscrollbar="true" hscrollbar="true" autovscroll="true" readonly="true"
3+
<RichEdit class="prompt" name="log_edit" bkcolor="bk_gray" width="stretch" height="stretch" font="1" multiline="true" vscrollbar="true" hscrollbar="true" autovscroll="true" readonly="true"
44
normaltextcolor="darkcolor" padding="5,5,5,5" wantreturnmsg="true" rich="true"/>
55
</Window>

src/gui/main_form/main_form.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void MainForm::InitWindow()
7373
box_side_bar_ = dynamic_cast<Box*>(FindControl(L"box_side_bar"));
7474
list_logs_ = dynamic_cast<ListBox*>(FindControl(L"list_logs"));
7575
rich_edit_ = dynamic_cast<RichEdit*>(FindControl(L"log_edit"));
76-
box_container_ = dynamic_cast<HBox*>(FindControl(L"box_container"));
76+
box_container_ = dynamic_cast<Box*>(FindControl(L"box_container"));
7777

7878
btn_hide_loglist_ = dynamic_cast<Button*>(FindControl(L"btn_hide_loglist"));
7979
btn_show_loglist_ = dynamic_cast<Button*>(FindControl(L"btn_show_loglist"));
@@ -181,11 +181,18 @@ bool MainForm::OnClicked(EventArgs* msg)
181181
}
182182
else if (name == L"btn_refresh_all")
183183
{
184-
for (auto capture_file_info : capture_file_list_)
185-
{
186-
capture_file_info.second->file_instance_->ClearFile();
187-
capture_file_info.second->rich_edit_->SetText(L"");
188-
}
184+
auto closure = [this](MsgBoxRet ret) {
185+
if (ret == MB_YES)
186+
{
187+
for (auto capture_file_info : capture_file_list_)
188+
{
189+
capture_file_info.second->file_instance_->ClearFile();
190+
capture_file_info.second->rich_edit_->SetText(L"");
191+
}
192+
}
193+
};
194+
ShowMsgBox(GetHWND(), closure, L"你确定要清空所有监控文件吗?", false,
195+
L"提示", false, L"确定", false, L"取消", false);
189196
}
190197
else if (name == L"btn_remove_all")
191198
{

src/gui/main_form/main_form.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class MainForm : public nim_comp::WindowEx
5353
RichEdit* rich_edit_;
5454
Button* btn_hide_loglist_;
5555
Button* btn_show_loglist_;
56-
HBox* box_container_;
56+
Box* box_container_;
5757
Box* box_side_bar_;
5858

5959
CaptureFileList capture_file_list_;

0 commit comments

Comments
 (0)