← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2571: Save and restore "View as text" windows

 

------------------------------------------------------------
revno: 2571
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2011-06-27 18:02:40 +0200
message:
  Save and restore "View as text" windows
modified:
  changelog.txt
  win32/MainWindow.cpp
  win32/TextFrame.cpp
  win32/TextFrame.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	2011-06-12 22:41:02 +0000
+++ changelog.txt	2011-06-27 16:02:40 +0000
@@ -31,6 +31,7 @@
 * Remove the license page from the installer
 * Update OpenSSL to version 1.0.0d
 * [L#189241] Store crash reports in a CrashLog.txt file (poy)
+* Save and restore "View as text" windows (poy)
 
 -- 0.782 2011-03-05 --
 * Prevent a remote crash triggered via malformed user commands (poy)

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2011-06-25 17:05:55 +0000
+++ win32/MainWindow.cpp	2011-06-27 16:02:40 +0000
@@ -1558,5 +1558,6 @@
 	compare_id(NotepadFrame);
 	compare_id(SystemFrame);
 	compare_id(StatsFrame);
+	compare_id(TextFrame);
 #undef compare_id
 }

=== modified file 'win32/TextFrame.cpp'
--- win32/TextFrame.cpp	2011-03-15 19:52:17 +0000
+++ win32/TextFrame.cpp	2011-06-27 16:02:40 +0000
@@ -22,8 +22,9 @@
 
 #include <dcpp/File.h>
 #include <dcpp/Text.h>
+#include <dcpp/WindowInfo.h>
 
-const string TextFrame::id = "TextPad";
+const string TextFrame::id = "Text";
 const string& TextFrame::getId() const { return id; }
 
 static const size_t MAX_TEXT_LEN = 64*1024;
@@ -32,9 +33,23 @@
 	new TextFrame(parent, fileName);
 }
 
+WindowParams TextFrame::getWindowParams() const {
+	WindowParams ret;
+	ret["Path"] = WindowParam(fileName, WindowParam::FLAG_IDENTIFIES);
+	return ret;
+}
+
+void TextFrame::parseWindowParams(TabViewPtr parent, const WindowParams& params) {
+	auto path = params.find("Path");
+	if(path != params.end()) {
+		openWindow(parent, path->second);
+	}
+}
+
 TextFrame::TextFrame(TabViewPtr parent, const string& fileName) :
-	BaseType(parent, Text::toT(Util::getFileName(fileName))),
-	pad(0)
+BaseType(parent, Text::toT(Util::getFileName(fileName))),
+pad(0),
+fileName(fileName)
 {
 	TextBox::Seed cs = WinUtil::Seeds::textBox;
 	cs.style |= WS_VSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL | ES_READONLY;

=== modified file 'win32/TextFrame.h'
--- win32/TextFrame.h	2011-01-09 14:54:10 +0000
+++ win32/TextFrame.h	2011-06-27 16:02:40 +0000
@@ -30,6 +30,9 @@
 
 	static void openWindow(TabViewPtr parent, const string& fileName);
 
+	WindowParams getWindowParams() const;
+	static void parseWindowParams(TabViewPtr parent, const WindowParams& params);
+
 	enum Status {
 		STATUS_STATUS,
 		STATUS_LAST
@@ -39,11 +42,12 @@
 	friend class MDIChildFrame<TextFrame>;
 
 	TextFrame(TabViewPtr parent, const string& fileName);
-	TextBoxPtr pad;
-
 	virtual ~TextFrame() { }
 
 	void layout();
+
+	TextBoxPtr pad;
+	const string fileName;
 };
 
 #endif