------------------------------------------------------------ revno: 3148 committer: poy <p...@123gen.com> branch nick: trunk timestamp: Sat 2012-12-08 18:44:30 +0100 message: dwt: remove req on hosts to define texts added: dwt/src/Texts.cpp win32/dwtTexts.h renamed: win32/dwt_Texts.cpp => win32/dwtTexts.cpp modified: dwt/include/dwt/Texts.h dwt/test/SplitTest.cpp dwt/test/TableTest.cpp dwt/test/TreeTest.cpp win32/main.cpp win32/dwtTexts.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 'dwt/include/dwt/Texts.h' --- dwt/include/dwt/Texts.h 2012-01-13 20:55:20 +0000 +++ dwt/include/dwt/Texts.h 2012-12-08 17:44:30 +0000 @@ -32,19 +32,21 @@ #ifndef DWT_TEXTS_H #define DWT_TEXTS_H +#include <functional> + #include "tstring.h" namespace dwt { +/** Texts used throughout DWT. The host can override the getter by modifying the "get" variable. */ struct Texts { - /** Texts used by DWT that the calling application should define. */ enum Text { undo, cut, copy, paste, del, selAll, // text-box menu commands resize, // tooltip for splitters close // tooltip for closing an owner-drawn tab }; - static tstring get(Text text); + static std::function<tstring (Text)> get; }; } === added file 'dwt/src/Texts.cpp' --- dwt/src/Texts.cpp 1970-01-01 00:00:00 +0000 +++ dwt/src/Texts.cpp 2012-12-08 17:44:30 +0000 @@ -0,0 +1,57 @@ +/* + DC++ Widget Toolkit + + Copyright (c) 2007-2012, Jacek Sieka + + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the DWT nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <dwt/Texts.h> + +#include <dwt/WindowsHeaders.h> +#include <dwt/util/check.h> + +namespace dwt { + +decltype(Texts::get) Texts::get = [](Text text) -> tstring { + using namespace dwt; + + switch(text) { + case Texts::undo: return _T("&Undo\tCtrl+Z"); + case Texts::cut: return _T("Cu&t\tCtrl+X"); + case Texts::copy: return _T("&Copy\tCtrl+C"); + case Texts::paste: return _T("&Paste\tCtrl+V"); + case Texts::del: return _T("&Delete\tDel"); + case Texts::selAll: return _T("Select &All\tCtrl+A"); + case Texts::resize: return _T("Click and drag to resize"); + case Texts::close: return _T("Close"); + } + + dwtDebugFail("unknown dwt text"); + return tstring(); +}; + +} === modified file 'dwt/test/SplitTest.cpp' --- dwt/test/SplitTest.cpp 2012-06-29 19:05:29 +0000 +++ dwt/test/SplitTest.cpp 2012-12-08 17:44:30 +0000 @@ -1,11 +1,6 @@ #include <dwt/widgets/Window.h> #include <dwt/widgets/Label.h> #include <dwt/widgets/SplitterContainer.h> -#include <dwt/Texts.h> - -namespace dwt { -tstring Texts::get(Text text) { return _T("test"); } -} int dwtMain(dwt::Application& app) { === modified file 'dwt/test/TableTest.cpp' --- dwt/test/TableTest.cpp 2012-01-08 22:14:11 +0000 +++ dwt/test/TableTest.cpp 2012-12-08 17:44:30 +0000 @@ -1,10 +1,5 @@ #include <dwt/widgets/Window.h> #include <dwt/widgets/Table.h> -#include <dwt/Texts.h> - -namespace dwt { -tstring Texts::get(Text text) { return _T("test"); } -} using dwt::tstring; === modified file 'dwt/test/TreeTest.cpp' --- dwt/test/TreeTest.cpp 2012-07-11 17:13:42 +0000 +++ dwt/test/TreeTest.cpp 2012-12-08 17:44:30 +0000 @@ -1,13 +1,8 @@ #include <dwt/widgets/Window.h> #include <dwt/widgets/Tree.h> -#include <dwt/Texts.h> #include <iostream> -namespace dwt { -tstring Texts::get(Text text) { return _T("test"); } -} - using dwt::tstring; int dwtMain(dwt::Application& app) === renamed file 'win32/dwt_Texts.cpp' => 'win32/dwtTexts.cpp' --- win32/dwt_Texts.cpp 2012-01-13 20:55:20 +0000 +++ win32/dwtTexts.cpp 2012-12-08 17:44:30 +0000 @@ -17,27 +17,28 @@ */ #include "stdafx.h" +#include "dwtTexts.h" + +#include <dcpp/Text.h> #include <dwt/Texts.h> -#include <dcpp/Text.h> - -namespace dwt { - -tstring Texts::get(Text text) { - switch(text) { - case undo: return T_("&Undo\tCtrl+Z"); - case cut: return T_("Cu&t\tCtrl+X"); - case copy: return T_("&Copy\tCtrl+C"); - case paste: return T_("&Paste\tCtrl+V"); - case del: return T_("&Delete\tDel"); - case selAll: return T_("Select &All\tCtrl+A"); - case resize: return T_("Click and drag to resize"); - case close: return T_("Close"); - } - - assert(0); - return tstring(); -} - +void dwtTexts::init() { + dwt::Texts::get = [](dwt::Texts::Text text) -> tstring { + using namespace dwt; + + switch(text) { + case Texts::undo: return T_("&Undo\tCtrl+Z"); + case Texts::cut: return T_("Cu&t\tCtrl+X"); + case Texts::copy: return T_("&Copy\tCtrl+C"); + case Texts::paste: return T_("&Paste\tCtrl+V"); + case Texts::del: return T_("&Delete\tDel"); + case Texts::selAll: return T_("Select &All\tCtrl+A"); + case Texts::resize: return T_("Click and drag to resize"); + case Texts::close: return T_("Close"); + } + + dcassert(0); + return dcpp::tstring(); + }; } === added file 'win32/dwtTexts.h' --- win32/dwtTexts.h 1970-01-01 00:00:00 +0000 +++ win32/dwtTexts.h 2012-12-08 17:44:30 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail point com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef DCPLUSPLUS_WIN32_DWTTEXTS_H +#define DCPLUSPLUS_WIN32_DWTTEXTS_H + +struct dwtTexts { + static void init(); +}; + +#endif === modified file 'win32/main.cpp' --- win32/main.cpp 2012-11-14 19:53:25 +0000 +++ win32/main.cpp 2012-12-08 17:44:30 +0000 @@ -21,6 +21,7 @@ #include <exception> #include "CrashLogger.h" +#include "dwtTexts.h" #include "MainWindow.h" #include "PluginApiWin.h" #include "SingleInstance.h" @@ -150,6 +151,8 @@ SetProcessDefaultLayout(LAYOUT_RTL); } + dwtTexts::init(); + WinUtil::init(); MainWindow* wnd = new MainWindow;
_______________________________________________ Mailing list: https://launchpad.net/~linuxdcpp-team Post to : linuxdcpp-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~linuxdcpp-team More help : https://help.launchpad.net/ListHelp