linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05521
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2900: fix focus issues & a setting dialog crash
------------------------------------------------------------
revno: 2900
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2012-04-16 00:19:38 +0200
message:
fix focus issues & a setting dialog crash
modified:
win32/DirectoryListingFrame.cpp
win32/HubFrame.cpp
win32/MDIChildFrame.h
win32/NotepadFrame.cpp
win32/PrivateFrame.cpp
win32/PublicHubsFrame.cpp
win32/QueueFrame.cpp
win32/SettingsDialog.cpp
--
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 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp 2012-04-07 18:05:24 +0000
+++ win32/DirectoryListingFrame.cpp 2012-04-15 22:19:38 +0000
@@ -455,9 +455,14 @@
auto finishLoad = [this] {
delete loader;
loader = 0;
+
setEnabled(true);
+
loading->close(true);
loading = 0;
+
+ files->setFocus();
+
layout();
updateTitle();
if(!error.empty()) {
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2012-04-01 22:05:58 +0000
+++ win32/HubFrame.cpp 2012-04-15 22:19:38 +0000
@@ -176,7 +176,7 @@
chat->onContextMenu([this](const dwt::ScreenCoordinate &sc) { return handleChatContextMenu(sc); });
message->setHelpId(IDH_HUB_MESSAGE);
- addWidget(message, true, false);
+ addWidget(message, ALWAYS_FOCUS, false);
message->onKeyDown([this](int c) { return handleMessageKeyDown(c); });
message->onSysKeyDown([this](int c) { return handleMessageKeyDown(c); });
message->onChar([this] (int c) { return handleMessageChar(c); });
@@ -212,10 +212,10 @@
filterOpts->setHelpId(IDH_HUB_FILTER);
filter.createColumnBox(filterOpts);
- addWidget(filter.column, false, false);
+ addWidget(filter.column, AUTO_FOCUS, false);
filter.createMethodBox(filterOpts);
- addWidget(filter.method, false, false);
+ addWidget(filter.method, AUTO_FOCUS, false);
hideFilterOpts(nullptr);
=== modified file 'win32/MDIChildFrame.h'
--- win32/MDIChildFrame.h 2012-02-04 17:18:19 +0000
+++ win32/MDIChildFrame.h 2012-04-15 22:19:38 +0000
@@ -90,19 +90,21 @@
/** Second close phase, perform any cleanup that depends only on the UI thread */
void postClosing() { }
+ enum FocusMethod { AUTO_FOCUS, ALWAYS_FOCUS, NO_FOCUS };
+
template<typename W>
- void addWidget(W* widget, bool alwaysFocus = false, bool autoTab = true, bool customColor = true) {
+ void addWidget(W* widget, FocusMethod focus = AUTO_FOCUS, bool autoTab = true, bool customColor = true) {
addDlgCodeMessage(widget, autoTab);
if(customColor)
addColor(widget);
- if(alwaysFocus || (lastFocus == NULL)) {
+ if(focus == ALWAYS_FOCUS || (focus == AUTO_FOCUS && !lastFocus)) {
lastFocus = widget->handle();
if(this->getVisible())
::SetFocus(lastFocus);
}
- if(alwaysFocus)
+ if(focus == ALWAYS_FOCUS)
alwaysSameFocus = true;
}
=== modified file 'win32/NotepadFrame.cpp'
--- win32/NotepadFrame.cpp 2012-01-13 20:55:20 +0000
+++ win32/NotepadFrame.cpp 2012-04-15 22:19:38 +0000
@@ -37,7 +37,7 @@
TextBox::Seed cs = WinUtil::Seeds::textBox;
cs.style |= WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_WANTRETURN;
pad = addChild(cs);
- addWidget(pad, false, false);
+ addWidget(pad, AUTO_FOCUS, false);
WinUtil::handleDblClicks(pad);
}
=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp 2012-03-03 19:33:45 +0000
+++ win32/PrivateFrame.cpp 2012-04-15 22:19:38 +0000
@@ -169,7 +169,7 @@
chat->onContextMenu([this](const dwt::ScreenCoordinate &sc) { return handleChatContextMenu(sc); });
message->setHelpId(IDH_PM_MESSAGE);
- addWidget(message, true);
+ addWidget(message, ALWAYS_FOCUS);
message->onKeyDown([this](int c) { return handleMessageKeyDown(c); });
message->onSysKeyDown([this](int c) { return handleMessageKeyDown(c); });
message->onChar([this](int c) { return handleMessageChar(c); });
=== modified file 'win32/PublicHubsFrame.cpp'
--- win32/PublicHubsFrame.cpp 2012-03-03 19:33:45 +0000
+++ win32/PublicHubsFrame.cpp 2012-04-15 22:19:38 +0000
@@ -112,7 +112,7 @@
seed.style |= WS_DISABLED | ES_MULTILINE | WS_VSCROLL | ES_READONLY;
seed.lines = 8;
blacklist = upper->addChild(seed);
- addWidget(blacklist);
+ addWidget(blacklist, NO_FOCUS);
}
{
=== modified file 'win32/QueueFrame.cpp'
--- win32/QueueFrame.cpp 2012-03-21 22:50:43 +0000
+++ win32/QueueFrame.cpp 2012-04-15 22:19:38 +0000
@@ -84,7 +84,7 @@
{
files = paned->addChild(WidgetFiles::Seed(WinUtil::Seeds::table));
- addWidget(files, true);
+ addWidget(files, ALWAYS_FOCUS);
files->setSmallImageList(WinUtil::fileImages);
WinUtil::makeColumns(files, filesColumns, COLUMN_LAST, SETTING(QUEUEFRAME_ORDER), SETTING(QUEUEFRAME_WIDTHS));
=== modified file 'win32/SettingsDialog.cpp'
--- win32/SettingsDialog.cpp 2012-03-03 19:33:45 +0000
+++ win32/SettingsDialog.cpp 2012-04-15 22:19:38 +0000
@@ -359,7 +359,9 @@
dwt::Point sz = getClientSize();
grid->resize(dwt::Rectangle(8, 8, sz.x - 16, sz.y - 16));
- currentPage->getParent()->layout();
+ if(currentPage) {
+ currentPage->getParent()->layout();
+ }
}
void SettingsDialog::helpImpl(unsigned& id) {