mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
bazaar: Fixing for C++11
git-svn-id: svn://ultimatepp.org/upp/trunk@9133 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
53776ade9a
commit
9cdfa99a04
9 changed files with 15 additions and 163 deletions
|
|
@ -27,6 +27,10 @@ inline bool operator==(const Ctrl::LogPos& x, const Value& v) { return RichVal
|
|||
inline bool operator!=(const Value& v, const Ctrl::LogPos& x) { return RichValue<Ctrl::LogPos>::Extract(v) != x; }
|
||||
inline bool operator!=(const Ctrl::LogPos& x, const Value& v) { return RichValue<Ctrl::LogPos>::Extract(v) != x; }
|
||||
|
||||
inline int SgnCompare(const Ctrl::LogPos&, const Ctrl::LogPos&) { return 0; }
|
||||
|
||||
inline int PolyCompare(const Ctrl::LogPos&, const Value&) { return 0; }
|
||||
|
||||
template<> String AsString(const Ctrl::LogPos& pos);
|
||||
|
||||
template<> Stream& operator%(Stream& s, Ctrl::LogPos& pos);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
description "Bazaar: Rss 2.0 multi-channel feed creation example using Rss class. Author: İsmail YILMAZ (Oblivion)";
|
||||
description "Bazaar: Rss 2.0 multi-channel feed creation example using Rss class. Author: İsmail YILMAZ (Oblivion)\377";
|
||||
|
||||
uses
|
||||
CtrlLib,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ void RSSExample::ComposeRss()
|
|||
));
|
||||
|
||||
for(int i = 1; i < 5; i++) {
|
||||
RssTag cat = RssCategory(Format("Item %d has a category", i));
|
||||
channel1
|
||||
.Item(
|
||||
RssItem(
|
||||
|
|
@ -44,7 +45,7 @@ void RSSExample::ComposeRss()
|
|||
Format("Item %d has an author", i), // Item author
|
||||
NULL, // Item comment
|
||||
NULL, // Item publication date
|
||||
(i < 3 ? &RssCategory(Format("Item %d has a category", i)) : NULL) // Item category
|
||||
(i < 3 ? &cat : NULL) // Item category
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
description "Bazaar: Rss 2.0 parser/composer class. Author: İsmail YILMAZ, (Oblivion)";
|
||||
description "Bazaar: Rss 2.0 parser/composer class. Author: İsmail YILMAZ, (Oblivion)\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
|
@ -8,6 +8,3 @@ file
|
|||
Rss.cpp charset "UTF-8",
|
||||
Changelog.txt charset "UTF-8";
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
description "Simple SVG viewer (PainterSvg demo)";
|
||||
|
||||
uses
|
||||
CtrlLib,
|
||||
plugin\tif,
|
||||
plugin\jpg,
|
||||
plugin\gif,
|
||||
PainterSvg;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef _SvgView_icpp_init_stub
|
||||
#define _SvgView_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "plugin\tif/init"
|
||||
#include "plugin\jpg/init"
|
||||
#include "plugin\gif/init"
|
||||
#include "PainterSvg/init"
|
||||
#endif
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <PainterSvg/PainterSvg.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
class SvgView : public TopWindow {
|
||||
public:
|
||||
virtual bool Key(dword key, int);
|
||||
|
||||
private:
|
||||
ImageCtrl img;
|
||||
FileList files;
|
||||
Splitter splitter;
|
||||
String dir;
|
||||
FrameTop<Button> dirup;
|
||||
|
||||
void Load(const char *filename);
|
||||
void Enter();
|
||||
void DoDir();
|
||||
void DirUp();
|
||||
|
||||
public:
|
||||
typedef SvgView CLASSNAME;
|
||||
|
||||
void Serialize(Stream& s);
|
||||
void LoadDir(const char *d);
|
||||
void LoadDir() { LoadDir(dir); }
|
||||
|
||||
SvgView();
|
||||
};
|
||||
|
||||
void SvgView::Load(const char *filename)
|
||||
{
|
||||
img.SetImage(Null);
|
||||
ImageBuffer ib(GetSize());
|
||||
BufferPainter sw(ib);
|
||||
try {
|
||||
ParseSVG(sw, LoadFileBOM(filename));
|
||||
}
|
||||
catch(XmlError) {};
|
||||
img.SetImage(ib);
|
||||
}
|
||||
|
||||
void SvgView::LoadDir(const char *d)
|
||||
{
|
||||
files.Clear();
|
||||
dir = d;
|
||||
Title(dir);
|
||||
::Load(files, dir, "*.*");
|
||||
SortByExt(files);
|
||||
}
|
||||
|
||||
void SvgView::DirUp()
|
||||
{
|
||||
String n = DirectoryUp(dir);
|
||||
LoadDir(dir);
|
||||
files.FindSetCursor(n);
|
||||
}
|
||||
|
||||
void SvgView::Enter()
|
||||
{
|
||||
if(!files.IsCursor()) {
|
||||
Title(dir);
|
||||
return;
|
||||
}
|
||||
const FileList::File& f = files.Get(files.GetCursor());
|
||||
if(f.name == "..") {
|
||||
Title(dir);
|
||||
return;
|
||||
}
|
||||
String p = AppendFileName(dir, f.name);
|
||||
Title(p);
|
||||
if(!f.isdir)
|
||||
Load(p);
|
||||
}
|
||||
|
||||
void SvgView::DoDir()
|
||||
{
|
||||
if(!files.IsCursor())
|
||||
return;
|
||||
const FileList::File& f = files.Get(files.GetCursor());
|
||||
if(!f.isdir)
|
||||
return;
|
||||
LoadDir(AppendFileName(dir, f.name));
|
||||
}
|
||||
|
||||
bool SvgView::Key(dword key, int)
|
||||
{
|
||||
if(key == K_ENTER) {
|
||||
DoDir();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SvgView::Serialize(Stream& s)
|
||||
{
|
||||
int version = 0;
|
||||
s / version;
|
||||
SerializePlacement(s);
|
||||
s % files;
|
||||
s % dir;
|
||||
s % splitter;
|
||||
}
|
||||
|
||||
SvgView::SvgView()
|
||||
{
|
||||
splitter.Horz(files, img);
|
||||
splitter.SetPos(2700);
|
||||
Add(splitter.SizePos());
|
||||
|
||||
files.WhenEnterItem = THISBACK(Enter);
|
||||
files.WhenLeftDouble = THISBACK(DoDir);
|
||||
dirup.Height(max(CtrlImg::DirUp().GetSize().cy, Draw::GetStdFontCy() + 6));
|
||||
dirup.SetImage(CtrlImg::DirUp());
|
||||
dirup.NormalStyle();
|
||||
dirup <<= THISBACK(DirUp);
|
||||
files.AddFrame(dirup);
|
||||
|
||||
Sizeable().Zoomable();
|
||||
|
||||
dir = GetCurrentDirectory();
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
SvgView x;
|
||||
LoadFromFile(x);
|
||||
x.LoadDir();
|
||||
x.Run();
|
||||
StoreToFile(x);
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ public:
|
|||
Vector<Value> vv;
|
||||
for(int i = 0; i < GetCount(); i++)
|
||||
vv << Get(i, 0);
|
||||
return ValueArray(vv);
|
||||
return ValueArray(pick(vv));
|
||||
}
|
||||
virtual void SetData(const Value& v)
|
||||
{
|
||||
|
|
@ -254,7 +254,7 @@ public:
|
|||
{
|
||||
k << Get(i, 0); vv << Get(i, 1);
|
||||
}
|
||||
return ValueMap(k, vv);
|
||||
return ValueMap(k, pick(vv));
|
||||
}
|
||||
|
||||
virtual void SetData(const Value& v)
|
||||
|
|
|
|||
5
bazaar/ValueCtrlTest/init
Normal file
5
bazaar/ValueCtrlTest/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _ValueCtrlTest_icpp_init_stub
|
||||
#define _ValueCtrlTest_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "ValueCtrl/init"
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue