Skip to content

Commit

Permalink
Add "Always on Top" button on toolbar, issue #280.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Apr 24, 2021
1 parent b14ed60 commit 7043ef7
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 5 deletions.
28 changes: 28 additions & 0 deletions License.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,31 @@ https://github.com/zwegner/faster-utf8-validator
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.


================================================================================

Visual Studio 2017 Image Library

https://www.microsoft.com/en-us/download/details.aspx?id=35825
http://download.microsoft.com/download/0/6/0/0607D8EA-9BB7-440B-A36A-A24EB8C9C67E/Visual%20Studio%202017%20Image%20Library%20EULA.RTF


================================================================================
Bootstrap Icons

https://github.com/twbs/icons
https://github.com/twbs/icons/blob/main/LICENSE.md



The MIT License (MIT)

Copyright (c) 2019-2020 The Bootstrap Authors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1 change: 1 addition & 0 deletions locale/de/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,7 @@ BEGIN
IDT_FILE_ADDTOFAV "Add to Favorites"
IDT_VIEW_TOGGLEFOLDS "Toggle Folds"
IDT_FILE_LAUNCH "Execute Document"
IDT_VIEW_ALWAYSONTOP "Always On Top"
END

STRINGTABLE
Expand Down
1 change: 1 addition & 0 deletions locale/it/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,7 @@ BEGIN
IDT_FILE_ADDTOFAV "Add to Favorites"
IDT_VIEW_TOGGLEFOLDS "Toggle Folds"
IDT_FILE_LAUNCH "Execute Document"
IDT_VIEW_ALWAYSONTOP "Always On Top"
END

STRINGTABLE
Expand Down
1 change: 1 addition & 0 deletions locale/ja/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,7 @@ BEGIN
IDT_FILE_ADDTOFAV "お気に入りに追加"
IDT_VIEW_TOGGLEFOLDS "折りたたみの切り替え"
IDT_FILE_LAUNCH "開いている文書を実行"
IDT_VIEW_ALWAYSONTOP "常に手前に表示"
END

STRINGTABLE
Expand Down
1 change: 1 addition & 0 deletions locale/ko/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,7 @@ BEGIN
IDT_FILE_ADDTOFAV "즐겨찾기에 추가"
IDT_VIEW_TOGGLEFOLDS "접기 전환"
IDT_FILE_LAUNCH "문서 실행"
IDT_VIEW_ALWAYSONTOP "항상 맨 위"
END

STRINGTABLE
Expand Down
1 change: 1 addition & 0 deletions locale/zh-Hans/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,7 @@ BEGIN
IDT_FILE_ADDTOFAV "添加到收藏夹"
IDT_VIEW_TOGGLEFOLDS "切换折叠"
IDT_FILE_LAUNCH "运行文件"
IDT_VIEW_ALWAYSONTOP "始终置顶"
END

STRINGTABLE
Expand Down
1 change: 1 addition & 0 deletions locale/zh-Hant/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,7 @@ BEGIN
IDT_FILE_ADDTOFAV "新增到我的最愛"
IDT_VIEW_TOGGLEFOLDS "切換折疊"
IDT_FILE_LAUNCH "執行檔案"
IDT_VIEW_ALWAYSONTOP "始終置頂"
END

STRINGTABLE
Expand Down
Binary file modified res/Toolbar.bmp
Binary file not shown.
4 changes: 2 additions & 2 deletions src/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -755,8 +755,8 @@ BOOL StatusSetTextID(HWND hwnd, UINT nPart, UINT uID);
int StatusCalcPaneWidth(HWND hwnd, LPCWSTR lpsz);

/**
* we only have 25 commands in toolbar
* max size = 25*(3 + 2) + 1 (each command with a separator)
* we only have 26 commands in toolbar
* max size = 26*(3 + 2) + 1 (each command with a separator)
*/
#define MAX_TOOLBAR_ITEM_COUNT_WITH_SEPARATOR 50
#define MAX_TOOLBAR_BUTTON_CONFIG_BUFFER_SIZE 160
Expand Down
6 changes: 6 additions & 0 deletions src/Notepad2.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ static TBBUTTON tbbMainWnd[] = {
{22, IDT_FILE_ADDTOFAV, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0, 0},
{23, IDT_VIEW_TOGGLEFOLDS, TBSTATE_ENABLED, BTNS_WHOLEDROPDOWN, {0}, 0, 0},
{24, IDT_FILE_LAUNCH, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0, 0},
{25, IDT_VIEW_ALWAYSONTOP, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0, 0},
};

WCHAR szIniFile[MAX_PATH] = L"";
Expand Down Expand Up @@ -4210,6 +4211,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) {
flagAlwaysOnTop = 0;
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
UpdateToolbar();
break;

case IDM_VIEW_MINTOTRAY:
Expand Down Expand Up @@ -4854,6 +4856,9 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) {
SendWMCommandOrBeep(hwnd, IDM_FILE_LAUNCH);
break;

case IDT_VIEW_ALWAYSONTOP:
SendWMCommandOrBeep(hwnd, IDM_VIEW_ALWAYSONTOP);
break;
}

return 0;
Expand Down Expand Up @@ -6863,6 +6868,7 @@ void UpdateToolbar(void) {
EnableTool(IDT_FILE_LAUNCH, i);

CheckTool(IDT_VIEW_WORDWRAP, fvCurFile.fWordWrap);
CheckTool(IDT_VIEW_ALWAYSONTOP, IsTopMost());
}

//=============================================================================
Expand Down
1 change: 1 addition & 0 deletions src/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,7 @@ BEGIN
IDT_FILE_ADDTOFAV "Add to Favorites"
IDT_VIEW_TOGGLEFOLDS "Toggle Folds"
IDT_FILE_LAUNCH "Execute Document"
IDT_VIEW_ALWAYSONTOP "Always On Top"
END

STRINGTABLE
Expand Down
1 change: 1 addition & 0 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@
#define IDT_FILE_ADDTOFAV 40722
#define IDT_VIEW_TOGGLEFOLDS 40723
#define IDT_FILE_LAUNCH 40724
#define IDT_VIEW_ALWAYSONTOP 40725

#define IDM_LANG_USER_DEFAULT 40900
#define IDM_LANG_ENGLISH_US 40901
Expand Down
5 changes: 3 additions & 2 deletions tools/ImageTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,10 @@ def make_notepad2_toolbar_bitmap():
'images/.png', # IDT_FILE_LAUNCH
], 'Toolbar.bmp')

make_matapath_toolbar_bitmap()
#make_matapath_toolbar_bitmap()
#make_notepad2_toolbar_bitmap()
convert_image('images/OpenFolder_16x.png', 'OpenFolder.bmp')
#convert_image('images/OpenFolder_16x.png', 'OpenFolder.bmp')
#concat_horizontal(['../res/Toolbar.bmp', 'images/pin-angle-16x.png'], 'Toolbar.bmp')

#split_horizontal('Toolbar.bmp', '16x40')

Expand Down
Binary file added tools/images/pin-angle-16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions tools/images/pin-angle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion tools/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ images:
Visual Studio Image Library 2017
https://www.microsoft.com/en-us/download/details.aspx?id=35825

file original
file original name
RedCrossMark TestCoveredFailing

Bootstrap Icons
https://github.com/twbs/icons
pin-angle.svg

0 comments on commit 7043ef7

Please sign in to comment.