478_uppsrc.diff

The diff file to apply for uppsrc directory (fourth version) - Sender Ghost, 05/25/2013 05:09 AM

Download (4.15 KB)

View differences:

uppsrc/ide/ide.lay 2013-05-23 13:47:34 +0400
627 627
	ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(328, 64).TopPosZ(60, 24))
628 628
END_LAYOUT
629 629

  
630
LAYOUT(QtfLayout, 964, 584)
631
	ITEM(DocEdit, text, LeftPosZ(4, 348).TopPosZ(28, 204))
632
	ITEM(RichTextCtrl, qtf, LeftPosZ(4, 348).VSizePosZ(236, 8))
633
	ITEM(RichTextView, help, HSizePosZ(356, 4).VSizePosZ(4, 8))
634
	ITEM(Button, editor, SetLabel(t_("Editor")).LeftPosZ(296, 56).TopPosZ(4, 20))
635
	ITEM(Button, clear, SetLabel(t_("Clear")).LeftPosZ(232, 56).TopPosZ(4, 20))
636
	ITEM(Button, copy, SetLabel(t_("Copy and close")).LeftPosZ(128, 100).TopPosZ(4, 20))
630
LAYOUT(QtfLayout, 356, 236)
631
	ITEM(DocEdit, text, HSizePosZ(0, 0).VSizePosZ(24, 0))
632
	ITEM(Button, editor, SetLabel(t_("Editor")).RightPosZ(0, 56).TopPosZ(0, 20))
633
	ITEM(Button, clear, SetLabel(t_("Clear")).RightPosZ(60, 56).TopPosZ(0, 20))
634
	ITEM(Button, copy, SetLabel(t_("Copy and close")).RightPosZ(120, 100).TopPosZ(0, 20))
637 635
END_LAYOUT
638 636

  
uppsrc/ide/Qtf.cpp 2013-05-25 06:58:45 +0400
5 5
	RegisterGlobalConfig("QTF-designer-editor");
6 6
}
7 7

  
8
class QtfDlg : public WithQtfLayout<TopWindow> {
8
class QtfDlg : public TopWindow {
9 9
	typedef QtfDlg CLASSNAME;
10 10

  
11 11
	void Text();
......
14 14
	void Editor();
15 15

  
16 16
public:
17
	Splitter leftSplit, mainSplit;
18
	WithQtfLayout<ParentCtrl> qtfText;
19
	RichTextCtrl qtf;
20
	RichTextView help;
21

  
17 22
	void Serialize(Stream& s);
18 23

  
19 24
	QtfDlg();
......
21 26

  
22 27
void QtfDlg::Text()
23 28
{
24
	qtf <<= ~text;
29
	qtf <<= ~qtfText.text;
25 30
}
26 31

  
27 32
void QtfDlg::Clear()
28 33
{
29
	text.Clear();
34
	qtfText.text.Clear();
30 35
	Text();
31 36
}
32 37

  
33 38
void QtfDlg::Copy()
34 39
{
35
	WriteClipboardText(~text);
40
	WriteClipboardText(~qtfText.text);
36 41
	Break();
37 42
}
38 43

  
......
60 65
{
61 66
	QtfDlgEditor dlg;
62 67
	LoadFromGlobal(dlg, "QTF-designer-editor");
63
	dlg.editor.SetQTF((String)~text);
68
	dlg.editor.SetQTF((String)~qtfText.text);
64 69
	dlg.Run();
65 70
	if(PromptYesNo("Use the text?")) {
66
		text <<= AsQTF(dlg.editor.Get(),
71
		qtfText.text <<= AsQTF(dlg.editor.Get(),
67 72
		               CHARSET_UTF8, QTF_BODY|QTF_NOSTYLES|QTF_NOCHARSET|QTF_NOLANG);
68 73
		Text();
69 74
	}
......
72 77

  
73 78
QtfDlg::QtfDlg()
74 79
{
75
	CtrlLayout(*this, "QTF designer");
76
	text <<= THISBACK(Text);
80
	Title("QTF designer");
81
	CtrlLayout(qtfText);
82
	qtfText.text <<= THISBACK(Text);
77 83
	qtf.SetFrame(ViewFrame());
78 84
	qtf.Background(SColorPaper);
79 85
	Sizeable().Zoomable();
80 86
	Rect r = GetWorkArea();
81 87
	SetRect(0, 0, r.GetWidth() - 100, r.GetHeight() - 200);
88
	SetMinSize(Size(min(640, r.GetWidth() - 100), min(480, r.GetHeight() - 200)));
82 89

  
83 90
	String path = AppendFileName(AppendFileName(PackageDirectory("RichText"), "srcdoc.tpp"), "QTF$en-us.tpp");
84 91
	if(FileExists(path))
85 92
		help.SetQTF(ReadTopic(LoadFile(path)).text);
86 93
	else
87 94
		help <<= "[= &&&QTF documentation not found";
88
	
89
	clear <<= THISBACK(Clear);
90
	copy <<= THISBACK(Copy);
91
	editor <<= THISBACK(Editor);
95

  
96
	qtfText.clear <<= THISBACK(Clear);
97
	qtfText.copy <<= THISBACK(Copy);
98
	qtfText.editor <<= THISBACK(Editor);
99

  
100
	leftSplit.Vert(qtfText, qtf).SetPos(4000);
101
	mainSplit.Horz(leftSplit, help).SetPos(3500);
102
	Add(mainSplit.HSizePosZ(4, 4).VSizePosZ(4, 4));
92 103
}
93 104

  
94 105
void QtfDlg::Serialize(Stream& s)
95 106
{
96
	int version = 0;
107
	int version = 1;
97 108
	s / version;
98
	s % text;
109
	s % qtfText.text;
99 110
	SerializePlacement(s);
111
	leftSplit.Serialize(s);
112
	mainSplit.Serialize(s);
100 113
	Text();
101 114
}
102 115

  
......
107 120
	int l,h;
108 121
	bool sel=editor.GetSelection(l,h);
109 122
	if(qtfsel && sel){
110
		dlg.text<<=(~editor).ToString().Mid(l,h-l);
111
		dlg.copy.SetLabel("Apply and close");
123
		dlg.qtfText.text<<=(~editor).ToString().Mid(l,h-l);
124
		dlg.qtfText.copy.SetLabel("Apply and close");
112 125
		dlg.Run();
113 126
		editor.Remove(l,h-l);
114
		editor.Insert(l,(~dlg.text).ToString());
127
		editor.Insert(l,(~dlg.qtfText.text).ToString());
115 128
	}
116 129
	else{
117
		dlg.copy.SetLabel("Copy and close");
130
		dlg.qtfText.copy.SetLabel("Copy and close");
118 131
		dlg.Run();
119 132
	}
120 133
	StoreToGlobal(dlg, "QTF-designer");