mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Controls4U_Demo: Included changes in Controls4U.
git-svn-id: svn://ultimatepp.org/upp/trunk@3773 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
8ebd96d949
commit
a369e62194
9 changed files with 150 additions and 20 deletions
|
|
@ -51,14 +51,19 @@ public:
|
|||
void ChangeProperties();
|
||||
};
|
||||
|
||||
class Miscellaneous_Demo : public WithMiscellaneous<StaticRect> {
|
||||
class Functions4U_Demo : public WithFunctions4U<StaticRect> {
|
||||
public:
|
||||
typedef Miscellaneous_Demo CLASSNAME;
|
||||
Miscellaneous_Demo();
|
||||
typedef Functions4U_Demo CLASSNAME;
|
||||
Functions4U_Demo();
|
||||
void OnDiff();
|
||||
void OnPatch();
|
||||
};
|
||||
|
||||
class DrawingCanvas_Demo : public WithDrawingCanvas<StaticRect> {
|
||||
public:
|
||||
typedef DrawingCanvas_Demo CLASSNAME;
|
||||
DrawingCanvas_Demo();
|
||||
};
|
||||
|
||||
class Controls4U_Demo : public WithMain<TopWindow> {
|
||||
public:
|
||||
|
|
@ -70,8 +75,10 @@ public:
|
|||
StaticCtrlsTest_Demo staticCtrlsTest_Demo;
|
||||
StaticClock_Demo staticClock_Demo;
|
||||
Meter_Demo meter_Demo;
|
||||
JBControlsDemo jbcontrols_Demo;
|
||||
FileBrowser_Demo fileBrowser_Demo;
|
||||
Miscellaneous_Demo miscellaneous_Demo;
|
||||
Functions4U_Demo functions4U_Demo;
|
||||
DrawingCanvas_Demo drawingCanvas_Demo;
|
||||
#if defined(PLATFORM_WIN32)
|
||||
Firefox_Demo firefox_Demo;
|
||||
IExplorer_Demo iexplorer_Demo;
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ LAYOUT(FileBrowser, 424, 332)
|
|||
ITEM(Label, dv___3, SetLabel(t_("Selected:")).HSizePosZ(4, 372).BottomPosZ(5, 19))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Miscellaneous, 444, 268)
|
||||
LAYOUT(Functions4U, 444, 268)
|
||||
ITEM(LabelBox, dv___0, SetLabel(t_("Compare files")).LeftPosZ(4, 436).TopPosZ(4, 144))
|
||||
ITEM(Label, dv___1, SetLabel(t_("Get patch: It gets a \"Path\" file with the differences between \"Original\" and \"New\"\nApply patch: It gets the \"New\" file by applying to \"Original\" the differences in \"Patch\"\n\"Patch\" file may be much smaller than \"Original\" or \"New\" files as only contains the\ndifferences between them")).LeftPosZ(8, 424).TopPosZ(84, 56))
|
||||
ITEM(Label, dv___1, SetLabel(t_("Get patch: It gets a \"Patch\" file with the differences between \"Original\" and \"New\"\nApply patch: It gets the \"New\" file by applying to \"Original\" the differences in \"Patch\"\n\"Patch\" file may be much smaller than \"Original\" or \"New\" files as only contains the\ndifferences between them")).LeftPosZ(8, 424).TopPosZ(84, 56))
|
||||
ITEM(Label, dv___2, SetLabel(t_("New:")).LeftPosZ(8, 40).TopPosZ(40, 19))
|
||||
ITEM(Label, dv___3, SetLabel(t_("Patch:")).LeftPosZ(8, 40).TopPosZ(60, 19))
|
||||
ITEM(Label, dv___4, SetLabel(t_("Original:")).LeftPosZ(8, 40).TopPosZ(20, 19))
|
||||
|
|
@ -160,3 +160,10 @@ LAYOUT(StaticCtrls, 512, 416)
|
|||
ITEM(Label, dv___22, SetLabel(t_("PainterSvg")).SetAlign(ALIGN_CENTER).SetFont(StdFontZ(14).Bold()).LeftPosZ(276, 116).TopPosZ(304, 19))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(DrawingCanvas, 700, 596)
|
||||
ITEM(DrawingCanvas, drawingCanvas, HSizePosZ(540, 4).VSizePosZ(24, 4))
|
||||
ITEM(ImgCtrl, imgCtrl, LeftPosZ(4, 532).VSizePosZ(24, 4))
|
||||
ITEM(Label, dv___2, SetLabel(t_("DrawingCanvas")).LeftPosZ(540, 84).TopPosZ(4, 19))
|
||||
ITEM(Label, dv___3, SetLabel(t_("ImgCtrl")).LeftPosZ(4, 84).TopPosZ(4, 19))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,11 @@ file
|
|||
Controls4U_Demo.lay,
|
||||
Controls4U_Demo_win.lay,
|
||||
Controls4U_Demo.iml,
|
||||
Credits.txt;
|
||||
Credits.txt,
|
||||
JBControls readonly separator,
|
||||
JBControls.cpp,
|
||||
JBControlsDemo.h,
|
||||
JBControlsDemo.lay;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI MT",
|
||||
|
|
|
|||
58
bazaar/Controls4U_Demo/JBControls.cpp
Normal file
58
bazaar/Controls4U_Demo/JBControls.cpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#include "JBControlsDemo.h"
|
||||
|
||||
JBControlsDemo::JBControlsDemo()
|
||||
{
|
||||
CtrlLayout(*this);
|
||||
// PromptOK("Layout Ok");
|
||||
progress.Percent(true);
|
||||
progress.Set(~slider,100);
|
||||
// jbstar.Percent(true);
|
||||
// jbstar2.Percent(true);
|
||||
jbstar.Set(~slider,100);
|
||||
jbstar2.Set(~slider,100);
|
||||
jbstar.SetFontColor(Red);
|
||||
jbstar2.SetFontColor(Black);
|
||||
|
||||
jbstar.ShowVotes(true);
|
||||
jbstar2.ShowVotes(true);
|
||||
|
||||
jbstar.SetVotes(~slider2);
|
||||
jbstar2.SetVotes(~vslider);
|
||||
|
||||
// slider.SetValue(25);
|
||||
// slider2.SetValue(55);
|
||||
// vslider.SetValue(33);
|
||||
|
||||
slider <<= THISBACK(Slide);
|
||||
slider2 <<= THISBACK(Slide2);
|
||||
vslider <<= THISBACK(VSlide);
|
||||
novotes <<= THISBACK(NoVotes);
|
||||
}
|
||||
|
||||
void JBControlsDemo::NoVotes()
|
||||
{
|
||||
if (novotes.GetData()) jbstar2.SetVotes(-1);
|
||||
else jbstar2.SetVotes(~vslider);
|
||||
}
|
||||
|
||||
void JBControlsDemo::Slide()
|
||||
{
|
||||
meter.SetData(~slider);
|
||||
progress.Set(~slider,100);
|
||||
indic.SetData(~slider);
|
||||
jbstar.Set(~slider,100);
|
||||
jbstar2.Set(~slider,100);
|
||||
}
|
||||
|
||||
void JBControlsDemo::Slide2()
|
||||
{
|
||||
meter2.SetData(~slider2);
|
||||
jbstar.SetVotes(~slider2);
|
||||
}
|
||||
|
||||
void JBControlsDemo::VSlide()
|
||||
{
|
||||
vindic.SetData(~vslider);
|
||||
if (novotes.GetData()==false) jbstar2.SetVotes(~vslider);
|
||||
}
|
||||
|
||||
23
bazaar/Controls4U_Demo/JBControlsDemo.h
Normal file
23
bazaar/Controls4U_Demo/JBControlsDemo.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef _JBControlsDemo_JBControlsDemo_h
|
||||
#define _JBControlsDemo_JBControlsDemo_h
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <Controls4U/Controls4U.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define LAYOUTFILE <Controls4U_Demo/JBControlsDemo.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
class JBControlsDemo : public WithJBControlsDemoLayout<StaticRect> {
|
||||
public:
|
||||
typedef JBControlsDemo CLASSNAME;
|
||||
JBControlsDemo();
|
||||
void NoVotes();
|
||||
void Slide();
|
||||
void Slide2();
|
||||
void VSlide();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
14
bazaar/Controls4U_Demo/JBControlsDemo.lay
Normal file
14
bazaar/Controls4U_Demo/JBControlsDemo.lay
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
LAYOUT(JBControlsDemoLayout, 456, 432)
|
||||
ITEM(SliderCtrlX, slider, FillColor(Color(255, 85, 0)).SetThickness(3).SetThumbType(4).Jump(true).LeftPosZ(63, 330).TopPosZ(220, 52))
|
||||
ITEM(ProgressIndicator, progress, LeftPosZ(62, 331).TopPosZ(124, 24))
|
||||
ITEM(Meter, meter, SetAngleBegin(120).SetAngleEnd(60).LeftPosZ(64, 160).TopPosZ(12, 108))
|
||||
ITEM(SliderCtrlX, slider2, SetMaxi(150).SetMinorTicks(5).SetMajorTicksSize(40).SetMinorTicksSize(25).SetThumbType(2).Step(10).SetFrame(InsetFrame()).LeftPosZ(8, 340).TopPosZ(280, 48))
|
||||
ITEM(Meter, meter2, SetMax(150).SetPeak(120).SetStep(30).SetColorType(1).LeftPosZ(228, 162).TopPosZ(12, 108))
|
||||
ITEM(SliderCtrlX, indic, SetSliderType(1).FillColor(Color(56, 255, 200)).SetThickness(5).SetThumbType(0).SetFrame(OutsetFrame()).LeftPosZ(62, 332).TopPosZ(156, 52))
|
||||
ITEM(SliderCtrlX, vslider, SetInverted(true).FillColor(Yellow).LeftPosZ(8, 44).TopPosZ(12, 260))
|
||||
ITEM(SliderCtrlX, vindic, SetSliderType(1).FillColor(Color(200, 255, 56)).SetTickPosition(3).SetThickness(5).SetThumbType(0).LeftPosZ(404, 44).TopPosZ(12, 260))
|
||||
ITEM(StarIndicator, jbstar, LeftPosZ(78, 300).TopPosZ(336, 60))
|
||||
ITEM(StarIndicator, jbstar2, SetVotesHigh(80).SetVotesLow(15).LeftPosZ(174, 108).TopPosZ(404, 20))
|
||||
ITEM(Option, novotes, SetLabel(t_("Undefined number of votes")).LeftPosZ(288, 152).TopPosZ(408, 16))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
@ -5,4 +5,5 @@
|
|||
#include "plugin\gif/init"
|
||||
#include "plugin\jpg/init"
|
||||
#include "plugin\tif/init"
|
||||
#include "GridCtrl/init"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using namespace Upp;
|
|||
#if defined(PLATFORM_WIN32)
|
||||
#include "Controls4U_Demo_win.h"
|
||||
#endif
|
||||
#include "JBControlsDemo.h"
|
||||
#include "Controls4U_Demo.h"
|
||||
|
||||
#define IMAGEFILE <Controls4U_Demo/Controls4U_Demo.iml>
|
||||
|
|
@ -24,17 +25,21 @@ Controls4U_Demo::Controls4U_Demo() {
|
|||
tab.Add(iexplorer_Demo.SizePos(), "Internet Explorer ActiveX");
|
||||
#endif
|
||||
tab.Add(meter_Demo.SizePos(), "Meter & Knob");
|
||||
tab.Add(jbcontrols_Demo.SizePos(), "JBControls");
|
||||
tab.Add(staticClock_Demo.SizePos(), "StaticClock");
|
||||
tab.Add(editFileFolder_Demo.SizePos(), "StaticImage & EditFile/Folder");
|
||||
tab.Add(staticCtrls_Demo.SizePos(), "Static Controls");
|
||||
tab.Add(staticCtrlsTest_Demo.SizePos(), "Static Controls Test");
|
||||
tab.Add(miscellaneous_Demo.SizePos(), "Miscellaneous functions");
|
||||
tab.Add(drawingCanvas_Demo.SizePos(), "DrawingCanvas (experimental)");
|
||||
tab.Add(functions4U_Demo.SizePos(), "Functions4U samples");
|
||||
|
||||
tab.Set(tab.Find(meter_Demo)); // Select the last
|
||||
tab.Set(tab.Find(jbcontrols_Demo)); // Select the last
|
||||
//tab.Set(tab.Find(drawingCanvas_Demo)); // Select the last
|
||||
|
||||
timerOn = false;
|
||||
SetTimeCallback(-100, THISBACK(Timer));
|
||||
}
|
||||
|
||||
void Controls4U_Demo::Timer() {
|
||||
if (timerOn)
|
||||
return;
|
||||
|
|
@ -48,11 +53,7 @@ void Controls4U_Demo::Timer() {
|
|||
#endif
|
||||
}
|
||||
|
||||
//String GetTrashBinDirectory();
|
||||
|
||||
GUI_APP_MAIN {
|
||||
/*GetTrashBinDirectory();
|
||||
return;*/
|
||||
Controls4U_Demo().Run();
|
||||
}
|
||||
|
||||
|
|
@ -195,18 +196,19 @@ void FileBrowser_Demo::FileOpened() {
|
|||
void FileBrowser_Demo::ChangeProperties() {
|
||||
}
|
||||
|
||||
Miscellaneous_Demo::Miscellaneous_Demo() {
|
||||
Functions4U_Demo::Functions4U_Demo() {
|
||||
CtrlLayout(*this);
|
||||
|
||||
String myqtf;
|
||||
|
||||
QtfRichObject a = QtfEquation("(2/3)");
|
||||
QtfRichObject b = QtfEquation("integral(sqrt(cos(phi_ini^2)) + i^2 + 6, i = 1, 10)*dx = cos((27+x^2)^3.25)/(PI*R_0^2)");
|
||||
QtfRichObject a = QtfEquation("-sqrt(2/3)");
|
||||
QtfRichObject b = QtfEquation("integral(-sqrt(cos(phi_ini^2)) + i^2 + 6, i = 1, 10)*dx = cos((27+x^2)^3.25)/(PI*R_0^2)");
|
||||
QtfRichObject c = QtfEquation("delta_i = a+b*x+c*x^2+d*x^3");
|
||||
QtfRichObject d = QtfEquation("sqrt(cos(phi_ini^2))");
|
||||
QtfRichObject d = QtfEquation("sqrt(cos(p^2))");
|
||||
QtfRichObject e = QtfEquation("summation(a+b*x+c*x^2+d*x^3, x = h, h+1)*dx = SI_h");
|
||||
QtfRichObject f = QtfEquation("exp(-1/2*(b-r)/a*t)*r*a*(d*b*w^2*a+d*r*w^2*a-d*r*c+d*b*c+2*f1*w*a*c)/((2*w^2*a)^2+b^2-2*c*a-b*r)");
|
||||
|
||||
myqtf << "[ {{10000 [s0;= This feature is experimental]}}]&[R3 This are some formulas in QTF:&" << a << "&" << b << "&" << c << "&" << d << "&" << e;
|
||||
myqtf << "[R3 This are some formulas in QTF:&" << a << "&" << b << "&" << c << "&" << d << "&" << e << "&" << f;
|
||||
|
||||
equation.SetData(myqtf);
|
||||
|
||||
|
|
@ -214,12 +216,25 @@ Miscellaneous_Demo::Miscellaneous_Demo() {
|
|||
butPatch.WhenAction = THISBACK(OnPatch);
|
||||
}
|
||||
|
||||
void Miscellaneous_Demo::OnDiff() {
|
||||
void Functions4U_Demo::OnDiff() {
|
||||
if (!BSDiff(~editOriginal, ~editNew, ~editPatch))
|
||||
Exclamation(DeQtf(BsGetLastError()));
|
||||
}
|
||||
|
||||
void Miscellaneous_Demo::OnPatch() {
|
||||
void Functions4U_Demo::OnPatch() {
|
||||
if (!BSPatch(~editOriginal, ~editNew, ~editPatch))
|
||||
Exclamation(DeQtf(BsGetLastError()));
|
||||
}
|
||||
|
||||
|
||||
DrawingCanvas_Demo::DrawingCanvas_Demo() {
|
||||
CtrlLayout(*this);
|
||||
|
||||
imgCtrl.SetImage(Images::ClockImage());
|
||||
LoadSvg(drawingCanvas, AppendFileName(GetDesktopFolder(), "svg/demo.svg"));
|
||||
|
||||
LineElem &elem = static_cast<LineElem&>(drawingCanvas.elemList.elems.Add(new LineElem(100, 100, 200, 200)));
|
||||
elem.style.SetStrokeColor(Green()).SetStrokeWidth(3);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using namespace Upp;
|
|||
#if defined(PLATFORM_WIN32)
|
||||
|
||||
#include "Controls4U_Demo_win.h"
|
||||
#include "JBControlsDemo.h"
|
||||
#include "Controls4U_Demo.h"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue