linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05680
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2939: Make the menu bar hideable
------------------------------------------------------------
revno: 2939
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2012-06-03 19:22:16 +0200
message:
Make the menu bar hideable
modified:
changelog.txt
dcpp/SettingsManager.cpp
dcpp/SettingsManager.h
help/keyboard_commands.html
help/window_main.html
win32/MainWindow.cpp
win32/MainWindow.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2012-05-31 16:43:59 +0000
+++ changelog.txt 2012-06-03 17:22:16 +0000
@@ -1,9 +1,11 @@
* Revamp favorite hub settings (poy)
-* Reduce resource consumption when slots are full
-* [L#984330] Make PM windows more aware of the selected hub
-* [L#927821] Don't choke on hub addresses with spaces
+* Reduce resource consumption when slots are full (poy)
+* [L#984330] Make PM windows more aware of the selected hub (poy)
+* [L#927821] Don't choke on hub addresses with spaces (poy)
* Update OpenSSL to version 1.0.1c
-* Fix a mixup between IPs and hostnames leading to wrong search results
+* Fix a mixup between IPs and hostnames leading to wrong search results (poy)
+* Tweak help tooltips in the settings dialog (poy)
+* Make the menu bar hideable (poy)
-- 0.799 2012-05-05 --
* Add icons (iceman50)
=== modified file 'dcpp/SettingsManager.cpp'
--- dcpp/SettingsManager.cpp 2012-05-24 17:47:25 +0000
+++ dcpp/SettingsManager.cpp 2012-06-03 17:22:16 +0000
@@ -69,7 +69,7 @@
"MaxCompression", "NoAwayMsgToBots", "SkipZeroByte", "AdlsBreakOnFirst",
"HubUserCommands", "AutoSearchAutoMatch", "LogSystem",
"LogFilelistTransfers", "SendUnknownCommands", "MaxHashSpeed", "OpenUserCmdHelp",
- "GetUserCountry", "FavShowJoins", "LogStatusMessages", "ShowStatusbar",
+ "GetUserCountry", "FavShowJoins", "LogStatusMessages", "ShowMenuBar", "ShowStatusbar",
"ShowToolbar", "ShowTransferview", "PopunderPm", "PopunderFilelist", "MagnetAsk", "MagnetAction", "MagnetRegister",
"AddFinishedInstantly", "DontDLAlreadyShared", "UseCTRLForLineHistory",
"OpenNewWindow", "UDPPort", "HubLastLogLines", "PMLastLogLines",
@@ -225,6 +225,7 @@
setDefault(GET_USER_COUNTRY, true);
setDefault(FAV_SHOW_JOINS, false);
setDefault(LOG_STATUS_MESSAGES, false);
+ setDefault(SHOW_MENU_BAR, true);
setDefault(SHOW_TRANSFERVIEW, true);
setDefault(SHOW_STATUSBAR, true);
setDefault(SHOW_TOOLBAR, true);
=== modified file 'dcpp/SettingsManager.h'
--- dcpp/SettingsManager.h 2012-05-27 16:38:33 +0000
+++ dcpp/SettingsManager.h 2012-06-03 17:22:16 +0000
@@ -88,7 +88,7 @@
MAX_COMPRESSION, NO_AWAYMSG_TO_BOTS, SKIP_ZERO_BYTE, ADLS_BREAK_ON_FIRST,
HUB_USER_COMMANDS, AUTO_SEARCH_AUTO_MATCH, LOG_SYSTEM,
LOG_FILELIST_TRANSFERS, SEND_UNKNOWN_COMMANDS, MAX_HASH_SPEED, OPEN_USER_CMD_HELP,
- GET_USER_COUNTRY, FAV_SHOW_JOINS, LOG_STATUS_MESSAGES, SHOW_STATUSBAR,
+ GET_USER_COUNTRY, FAV_SHOW_JOINS, LOG_STATUS_MESSAGES, SHOW_MENU_BAR, SHOW_STATUSBAR,
SHOW_TOOLBAR, SHOW_TRANSFERVIEW, POPUNDER_PM, POPUNDER_FILELIST, MAGNET_ASK, MAGNET_ACTION, MAGNET_REGISTER,
ADD_FINISHED_INSTANTLY, DONT_DL_ALREADY_SHARED, USE_CTRL_FOR_LINE_HISTORY,
JOIN_OPEN_NEW_WINDOW, UDP_PORT, HUB_LAST_LOG_LINES, PM_LAST_LOG_LINES,
=== modified file 'help/keyboard_commands.html'
--- help/keyboard_commands.html 2012-03-11 16:36:44 +0000
+++ help/keyboard_commands.html 2012-06-03 17:22:16 +0000
@@ -20,6 +20,11 @@
<dt>Ctrl + W</dt>
<dt>Ctrl + F4</dt>
<dd>Close the current window.</dd>
+ <dt>Ctrl + 0</dt>
+ <dd>
+ Toggle the permanent visibility of the main menu bar. When it is hidden, the menu bar
+ can be temporarily brought back into view with standard Windows shortcuts (Alt, F10).
+ </dd>
<dt>Ctrl + 1</dt>
<dd>Enable or disable the toolbar.</dd>
<dt>Ctrl + 2</dt>
=== modified file 'help/window_main.html'
--- help/window_main.html 2012-03-11 16:36:44 +0000
+++ help/window_main.html 2012-06-03 17:22:16 +0000
@@ -112,6 +112,12 @@
<dd><div>Open the <placeholder><a href="dialog_indexing_progress.html">Indexing progess</a></placeholder> dialog.</div>
<div>It shows you the current state of file hashing operation and how much time there is left from it.</div></dd>
+ <dt>Menu bar</dt>
+ <dd>
+ Toggle the permanent visibility of the main menu bar. When it is hidden, the menu bar
+ can be temporarily brought back into view with standard Windows shortcuts (Alt, F10).
+ </dd>
+
<dt>Toolbar</dt>
<dd>Enable or disable the toolbar.</dd>
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp 2012-06-01 17:26:20 +0000
+++ win32/MainWindow.cpp 2012-06-03 17:22:16 +0000
@@ -132,6 +132,7 @@
initTransfers();
initTray();
+ addAccel(FCONTROL, '0', [this] { switchMenuBar(); });
addAccel(FCONTROL, '1', [this] { switchToolbar(); });
addAccel(FCONTROL, '2', [this] { switchTransfers(); });
addAccel(FCONTROL, '3', [this] { switchStatus(); });
@@ -339,6 +340,7 @@
[this] { StatsFrame::openWindow(getTabView()); }, WinUtil::menuIcon(IDI_NET_STATS));
viewMenu->appendItem(T_("Indexing progress"), [this] { handleHashProgress(); }, WinUtil::menuIcon(IDI_INDEXING));
viewMenu->appendSeparator();
+ viewIndexes["Menu"] = viewMenu->appendItem(T_("Menu bar\tCtrl+0"), [this] { switchMenuBar(); });
viewIndexes["Toolbar"] = viewMenu->appendItem(T_("Toolbar\tCtrl+1"), [this] { switchToolbar(); });
viewIndexes["Transfers"] = viewMenu->appendItem(T_("Transfer view\tCtrl+2"), [this] { switchTransfers(); });
viewIndexes["Status"] = viewMenu->appendItem(T_("Status bar\tCtrl+3"), [this] { switchStatus(); });
@@ -387,6 +389,28 @@
}
mainMenu->setMenu();
+
+ if(BOOLSETTING(SHOW_MENU_BAR)) {
+ viewMenu->checkItem(viewIndexes["Menu"], true);
+ } else {
+ ::SetMenu(handle(), nullptr);
+ }
+
+ /* when the menu bar is hidden, catch WM_ENTERMENULOOP & WM_EXITMENULOOP to determine when it
+ should be shown (such as when pressing Alt or F10).
+ idea from Notepad++ <http://notepad-plus-plus.org/>. */
+
+ auto updateMenuBar = [this](bool show) -> std::function<LRESULT (WPARAM, LPARAM)> {
+ return [=](WPARAM wParam, LPARAM) -> LRESULT {
+ if(!wParam && !BOOLSETTING(SHOW_MENU_BAR)) {
+ ::SetMenu(handle(), show ? mainMenu->handle() : nullptr);
+ }
+ return 0;
+ };
+ };
+
+ onRaw(updateMenuBar(true), dwt::Message(WM_ENTERMENULOOP));
+ onRaw(updateMenuBar(false), dwt::Message(WM_EXITMENULOOP));
}
void MainWindow::initToolbar() {
@@ -1522,6 +1546,12 @@
switchToolbar();
}
+void MainWindow::switchMenuBar() {
+ SettingsManager::getInstance()->set(SettingsManager::SHOW_MENU_BAR, !BOOLSETTING(SHOW_MENU_BAR));
+ ::SetMenu(handle(), BOOLSETTING(SHOW_MENU_BAR) ? mainMenu->handle() : nullptr);
+ viewMenu->checkItem(viewIndexes["Menu"], BOOLSETTING(SHOW_MENU_BAR));
+}
+
void MainWindow::switchToolbar() {
if(toolbar) {
rebar->remove(toolbar);
=== modified file 'win32/MainWindow.h'
--- win32/MainWindow.h 2012-06-01 17:26:20 +0000
+++ win32/MainWindow.h 2012-06-03 17:22:16 +0000
@@ -174,6 +174,7 @@
void handleToolbarCustomized();
bool handleToolbarContextMenu(const dwt::ScreenCoordinate& pt);
void handleToolbarSize(int size);
+ void switchMenuBar();
void switchToolbar();
void switchTransfers();
void switchStatus();