Merge continued

git-svn-id: svn://ultimatepp.org/upp/trunk@10263 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-10-04 08:34:39 +00:00
parent adf46bd64e
commit 2e4b276e07
3860 changed files with 1161787 additions and 438 deletions

View file

@ -0,0 +1,2 @@
BINARY(default_layout_bin, "defaultlayout.dat")

View file

@ -0,0 +1,21 @@
LAYOUT(DockingToolsLayout, 164, 264)
ITEM(SliderCtrl, dv___0, HSizePosZ(52, 4).BottomPosZ(32, 24))
ITEM(EditInt, dv___1, HSizePosZ(76, 2).TopPosZ(28, 19))
ITEM(Label, dv___2, SetLabel(t_("Slider 2:")).LeftPosZ(4, 45).BottomPosZ(9, 19))
ITEM(Label, dv___3, SetLabel(t_("Slider 1:")).LeftPosZ(4, 45).BottomPosZ(33, 19))
ITEM(Label, dv___4, SetLabel(t_("LineEdit:")).LeftPosZ(4, 69).TopPosZ(48, 19))
ITEM(Label, dv___5, SetLabel(t_("EditInt:")).LeftPosZ(4, 69).TopPosZ(28, 19))
ITEM(DropDate, dv___6, HSizePosZ(76, 2).TopPosZ(4, 19))
ITEM(Label, dv___7, SetLabel(t_("DropDate:")).LeftPosZ(4, 69).TopPosZ(4, 19))
ITEM(SliderCtrl, dv___8, HSizePosZ(52, 4).BottomPosZ(4, 24))
ITEM(LineEdit, dv___9, HSizePosZ(4, 4).VSizePosZ(68, 56))
END_LAYOUT
LAYOUT(DockingOptionsLayout, 124, 100)
ITEM(Label, dv___0, SetLabel(t_(" Allow Docking:")).HSizePosZ(0, 20).TopPosZ(0, 19))
ITEM(Option, dockright, SetLabel(t_("Right")).HSizePosZ(16, 4).TopPosZ(60, 16))
ITEM(Option, dockbottom, SetLabel(t_("Bottom")).HSizePosZ(16, 4).TopPosZ(80, 16))
ITEM(Option, dockleft, SetLabel(t_("Left")).HSizePosZ(16, 4).TopPosZ(20, 16))
ITEM(Option, docktop, SetLabel(t_("Top")).HSizePosZ(16, 4).TopPosZ(40, 16))
END_LAYOUT

View file

@ -0,0 +1,15 @@
description "Example showing advanced Docking features inc. Serialization, by James Thomas";
uses
CtrlLib,
Docking;
file
main.cpp,
DockingExample.lay,
DefaultLayout.brc,
app.tpp;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,4 @@
TOPIC("userguide$en-us")
#include "userguide$en-us.tpp"
END_TOPIC

View file

@ -0,0 +1,11 @@
TITLE("User Guide")
COMPRESSED
120,156,133,87,107,115,219,198,21,253,43,219,145,91,217,50,197,236,19,88,144,95,226,202,173,157,76,26,103,18,123,60,25,141,38,92,146,75,18,49,8,176,88,64,140,154,212,191,61,231,238,2,212,195,31,34,137,18,185,184,175,115,238,185,23,208,181,100,207,158,241,9,63,227,127,241,53,123,237,55,174,175,186,155,235,74,90,59,47,133,144,124,238,68,62,127,87,204,63,127,254,60,21,154,219,57,5,19,8,38,184,86,66,10,156,113,45,115,97,10,94,24,43,44,87,185,150,38,231,102,118,112,173,219,223,92,59,171,230,23,63,102,240,146,19,115,166,132,18,92,100,82,195,138,43,46,181,144,70,88,171,69,110,172,42,178,108,182,114,135,174,108,234,155,235,37,249,105,184,41,184,241,220,102,90,192,73,27,169,114,163,225,172,53,202,83,72,156,103,121,62,235,202,174,242,55,215,37,213,141,106,175,168,74,61,201,206,80,157,204,225,169,165,206,180,178,82,9,43,101,86,40,93,104,148,45,228,172,236,60,138,92,106,57,119,120,145,155,65,62,109,180,80,96,68,231,
70,193,44,199,95,205,11,33,145,212,114,99,144,207,255,54,210,180,4,65,68,18,249,102,72,41,115,67,30,86,91,161,114,43,181,204,36,138,224,57,128,82,5,102,182,246,97,5,95,37,197,188,67,89,243,171,175,205,92,192,57,159,228,103,146,23,92,102,121,129,164,40,24,152,85,81,8,101,145,84,11,195,133,154,173,154,53,112,46,165,225,42,102,180,104,69,134,200,145,22,147,9,20,45,149,69,202,92,40,133,223,70,219,124,22,60,53,163,107,218,155,235,139,175,159,243,41,159,74,99,94,144,123,1,119,171,180,82,58,43,180,224,10,105,16,67,19,103,25,71,59,133,145,118,182,116,1,57,59,28,229,137,89,65,106,2,247,202,26,133,212,25,126,161,175,0,168,192,143,44,180,85,202,242,217,170,114,33,12,36,17,65,23,4,82,136,137,16,103,57,113,107,148,212,5,145,163,36,72,150,153,41,4,88,54,153,230,114,214,250,255,246,101,235,247,190,6,205,37,228,49,31,91,52,104,17,197,36,41,202,137,144,16,163,201,50,78,124,25,8,66,42,3,194,185,176,
26,21,225,27,109,238,6,53,46,239,49,168,137,80,103,133,212,10,149,20,90,131,1,4,16,133,16,130,91,124,3,25,120,137,250,16,131,176,134,244,201,93,79,132,62,203,33,99,116,170,208,148,190,80,196,159,4,253,50,227,6,125,144,201,93,18,235,242,25,120,23,210,210,43,50,47,204,68,96,30,80,162,48,6,184,21,168,150,22,216,13,184,87,81,226,34,183,179,239,253,49,188,118,157,31,4,115,113,245,44,41,77,100,19,145,157,113,242,55,182,64,3,133,38,254,148,214,133,44,148,50,178,48,42,227,224,49,164,129,38,103,26,169,56,142,167,32,249,68,228,24,46,96,53,6,232,163,27,144,231,130,74,145,182,200,136,133,33,200,226,178,42,107,170,3,202,152,39,49,92,92,189,20,34,167,64,22,67,99,109,198,85,1,50,192,1,55,80,58,22,130,69,163,209,103,137,49,160,141,176,250,228,182,126,113,57,76,107,44,129,20,104,148,177,164,91,120,162,116,20,129,56,5,231,25,78,172,197,52,205,182,238,240,72,128,146,79,36,135,138,176,127,12,134,18,185,
32,63,94,208,46,193,102,64,7,176,138,10,147,20,184,184,172,125,232,252,26,205,55,60,194,150,98,34,5,184,131,254,140,177,90,103,168,23,185,115,90,77,212,66,12,176,201,213,236,7,135,121,249,253,151,255,255,253,95,223,95,126,248,137,93,7,53,103,31,130,111,217,155,190,92,251,127,220,92,7,62,103,233,207,197,47,236,159,46,148,43,246,177,172,215,205,145,189,110,86,159,202,122,59,216,92,254,241,190,97,251,230,214,51,199,142,201,32,148,251,67,117,199,118,77,181,102,248,92,179,110,231,89,229,55,29,236,250,224,217,178,239,186,166,102,248,41,187,197,121,96,145,49,182,116,45,115,53,60,90,183,197,5,214,244,221,148,189,10,236,174,233,83,124,156,185,182,233,97,66,71,199,178,170,88,240,158,237,202,186,67,140,157,235,88,231,113,22,47,238,124,235,99,218,161,164,104,189,65,132,114,51,36,109,125,229,49,250,235,41,251,184,243,53,219,185,219,199,14,49,66,140,229,234,142,114,255,218,135,110,244,138,150,143,192,80,229,48,74,85,85,13,60,234,174,97,
135,202,173,252,244,196,212,127,92,125,199,154,120,15,8,192,2,202,110,93,89,185,37,161,191,99,190,68,212,150,245,1,228,62,44,37,101,8,19,214,180,172,45,183,59,136,117,85,149,177,7,196,225,137,246,123,26,97,216,185,229,244,105,23,223,187,229,242,97,227,190,217,68,128,145,240,83,20,48,221,198,236,43,172,39,188,109,54,192,214,196,202,6,11,242,89,57,36,94,71,200,14,80,216,176,132,61,229,5,244,24,32,184,189,103,135,38,148,132,119,202,222,213,171,68,104,164,218,177,197,57,108,151,126,61,132,93,156,147,19,113,130,87,104,224,186,233,219,152,246,68,216,72,214,44,33,40,113,211,152,191,19,115,246,16,7,37,142,175,123,50,54,233,224,97,178,241,36,164,134,37,249,18,142,45,4,118,152,50,72,26,251,57,137,154,218,81,37,96,49,67,212,65,146,155,91,62,169,36,74,137,172,182,212,156,33,92,172,0,185,38,143,152,163,10,210,101,232,228,49,195,83,246,243,96,56,72,98,180,119,168,245,84,57,76,203,219,114,221,227,240,46,118,156,20,131,
153,27,195,2,79,83,71,219,41,123,123,26,197,171,247,63,126,71,214,63,189,253,230,223,239,41,245,106,215,52,97,212,232,9,8,57,16,132,123,159,227,19,104,196,7,82,55,199,52,161,49,146,171,183,126,24,175,177,239,163,24,200,188,42,67,247,133,40,223,80,177,79,84,185,29,206,88,25,152,175,169,229,235,132,153,166,44,113,20,34,63,75,15,44,91,87,151,255,131,5,70,8,153,202,150,225,25,164,220,214,80,227,58,69,10,236,57,57,250,91,32,184,55,143,3,58,92,79,174,24,61,223,190,64,247,241,22,83,94,98,179,98,250,239,8,219,186,129,1,170,41,73,49,221,46,90,211,30,100,24,105,108,253,246,11,88,15,47,158,160,81,91,195,174,233,209,12,84,30,231,158,154,191,90,249,16,190,8,201,54,109,179,63,41,128,225,105,161,167,198,221,47,207,184,131,28,248,77,140,76,128,251,224,235,245,176,22,118,131,202,221,225,128,101,225,82,47,2,6,21,235,3,18,191,223,222,176,73,139,253,171,55,137,140,174,197,86,109,30,108,237,129,105,176,179,102,
27,148,176,106,61,226,213,219,175,214,216,134,244,102,160,49,110,40,50,192,228,208,233,216,169,165,239,142,30,220,39,171,56,93,131,86,220,105,248,195,160,218,56,93,227,45,224,68,117,90,181,177,99,167,185,73,186,59,70,54,171,242,83,188,63,224,250,146,236,30,79,240,48,243,145,207,113,38,199,81,28,83,157,98,47,206,95,85,21,150,81,218,4,39,154,62,142,165,124,231,224,138,27,14,137,121,100,41,110,229,248,110,24,133,64,43,110,72,91,37,135,9,82,172,170,126,253,100,185,143,204,133,38,237,148,177,174,22,79,18,85,227,226,220,239,17,3,171,120,202,78,213,60,232,94,73,179,118,244,237,166,199,13,14,125,233,105,133,86,97,132,159,116,85,251,161,117,244,225,208,54,91,60,47,238,105,207,67,125,109,27,91,49,54,43,178,68,15,226,83,246,45,245,34,164,109,189,78,255,61,13,104,216,115,196,74,120,124,98,47,70,246,191,249,85,223,145,174,95,196,81,141,0,168,143,180,59,224,215,62,82,99,232,92,219,133,199,147,195,222,82,186,77,95,255,109,
248,252,170,239,118,77,59,99,223,226,102,18,48,153,205,30,123,237,249,226,124,223,254,138,61,67,13,248,80,117,229,30,252,44,94,46,94,18,198,126,31,94,12,206,55,127,2,27,50,82,91,

View file

@ -0,0 +1,2 @@
{Mg}Layouts
ArrayCtrls TreeCtrlsìi_õ¶+

View file

@ -0,0 +1,2 @@
{Mg}Layouts
ArrayCtrls TreeCtrlsìi_õ¶+

View file

@ -0,0 +1,5 @@
#ifndef _DockingExample2_icpp_init_stub
#define _DockingExample2_icpp_init_stub
#include "CtrlLib/init"
#include "Docking/init"
#endif

View file

@ -0,0 +1,192 @@
#include <Docking/Docking.h>
/*
** This is an advanced example designed to show most of the available Docking features, and how
** might be used in a real world application.
**
** Features used:
** Serailization
** Including a default layout as binary data in the exe.
** Layout templates with DockableCtrls
** Dock Manager (Group/layout management)
** Standard Docking Menu
** Permitted/denied docking alignments per window
*/
#define LAYOUTFILE <DockingExample2/DockingExample.lay>
#include <CtrlCore/lay.h>
#define TOPICFILE <DockingExample2/app.tpp/all.i>
#include <Core/topic_group.h>
// This sets up our backup serialization data (see Upp documentation for how .brc files work)
#include <DockingExample2/DefaultLayout.brc>
/*
** Class declaration. Notice that we inherit from DockWindow (not TopWindow)
*/
class DockingExample : public DockWindow {
public:
typedef DockingExample CLASSNAME;
DockingExample();
virtual void Close();
private:
// Some DockableCtrls using Layout template
WithDockingToolsLayout<DockableCtrl> toolwindow;
WithDockingOptionsLayout<DockableCtrl> optionswindow;
// Some data ctrls (will be added with Dockable())
ArrayCtrl arrayctrl1, arrayctrl2;
TreeCtrl treectrl1, treectrl2;
Button button;
// A menu bar to hold our windows
MenuBar menu;
// Our initialization function
virtual void DockInit();
// MenuBar callback function
void MainMenu(Bar &bar);
// Option callback handler
void OnDockAllow(int align, Option *ctrl);
// Button callback handler
void OnUserGuide();
// Functions to put data in our ctrls (fluff)
void FillArray(ArrayCtrl &array);
void FillTree(TreeCtrl &tree);
};
/*
** Source
*/
DockingExample::DockingExample()
{
Title("DockingExample1 : Advanced Docking").Sizeable(true).Zoomable(true);
// Layout out windows
CtrlLayout(toolwindow, "Tools");
CtrlLayout(optionswindow, "Options");
// Add our MenuBar using the standard Docking menu
AddFrame(menu); // menu must be added before Set or it thinks it's a context menu
menu.Set(THISBACK(MainMenu));
// Set Option callbacks. The option ctrls will permit/deny docking in different directions
// for optionswindow only. The (int) is for the benefit of GCC
// You can also do this for the whole window (see DockWindow::AllowDockLeft() etc)
optionswindow.dockleft <<= THISBACK2(OnDockAllow, (int)DOCK_LEFT, &optionswindow.dockleft);
optionswindow.docktop <<= THISBACK2(OnDockAllow, (int)DOCK_TOP, &optionswindow.docktop);
optionswindow.dockright <<= THISBACK2(OnDockAllow, (int)DOCK_RIGHT, &optionswindow.dockright);
optionswindow.dockbottom <<= THISBACK2(OnDockAllow, (int)DOCK_BOTTOM, &optionswindow.dockbottom);
// Now we put some bogus data in our controls
FillArray(arrayctrl1);
FillTree(treectrl1);
FillArray(arrayctrl2);
FillTree(treectrl2);
// And add the User-Guide button
Add(button.SetLabel("User Guide").LeftPosZ(4, 100).TopPosZ(4, 23));
button <<= THISBACK(OnUserGuide);
}
void DockingExample::DockInit()
/* This is the docking initialisation function. It gets called after the window is opened,
** and it's here you should do your docking/serialization, if you do it in the contructor
** you get various problems (incorrect layout, floating windows not opening).
*/
{
// Because we are going to use Serialization and will always have a Layout available we
// don't need to Dock/Float windows manually. Instead we just Register them.
// First our windows. These don't need size hints as they were set already by CtrlLayout
Register(toolwindow.Icon(CtrlImg::copy()));
Register(optionswindow.Icon(CtrlImg::paste()));
// And now our data ctrls
Register(Dockable(arrayctrl1, "ArrayCtrl 1").SizeHint(Size(300, 200)));
Register(Dockable(treectrl1, "TreeCtrl 1").SizeHint(Size(300, 200)));
Register(Dockable(arrayctrl2, "ArrayCtrl 2").SizeHint(Size(300, 200)));
Register(Dockable(treectrl2, "TreeCtrl 2").SizeHint(Size(300, 200)));
// Now we're ready to Serialize. The first time you run this example there won't be a data
// file, but I have included serialized copy in the .EXE to use as Default
// Note that we use SerializeWindow, not Serialize.
FileIn in(GetDataFile("docklayout.dat"));
bool badfile = !in.IsOpen();
if (!badfile) {
SerializeWindow(in);
badfile = in.IsError();
}
// If the file didn't open or was corrupt, use default layout
if (badfile) {
MemStream in(default_layout_bin, default_layout_bin_length);
SerializeWindow(in);
badfile = in.IsError();
}
}
void DockingExample::Close()
{
// Save our current layout & settings
FileOut out(GetDataFile("docklayout.dat"));
if (out.IsOpen())
SerializeWindow(out);
TopWindow::Close();
}
void DockingExample::MainMenu(Bar &bar)
{
// Add a Windows menu.
// We're using a the standard DockWindow menu, though you can also roll your own.
bar.Add("Windows", Image(), THISBACK(DockWindowMenu));
}
void DockingExample::OnDockAllow(int align, Option *ctrl)
// Permit/deny docking in different directions
// for optionswindow only.
// You can also do this for the whole window (see DockWindow::AllowDockLeft() etc)
{
optionswindow.AllowDock(align, !(bool)~(*ctrl));
}
/*
** Everything after here is fluff
*/
void DockingExample::OnUserGuide()
{
HelpWindow help;
help.GoTo("topic://DockingExample2/app/userguide$en-us");
help.Run();
}
void DockingExample::FillArray(ArrayCtrl &array)
{
array.AddColumn("Number");
array.AddColumn("Roman numbers");
array.MultiSelect();
for(int i = 0; i < 200; i++)
array.Add(i, FormatIntRoman(i, true));
}
void DockingExample::FillTree(TreeCtrl &tree)
{
Vector<int> parent, parent2;
parent.Add(0);
tree.SetRoot(Image(), "The Tree");
for(int i = 1; i < 10000; i++) {
parent.Add(tree.Add(parent[rand() % parent.GetCount()], Image(),
FormatIntRoman(i, true)));
if((rand() & 3) == 0)
tree.Open(parent.Top());
}
tree.Open(0);
}
GUI_APP_MAIN
{
DockingExample().Run();
}