piethernet

git-svn-id: svn://db.shs.com.ru/pip@38 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2015-03-20 14:05:31 +00:00
parent 94b4870d94
commit f89764d6bc
20 changed files with 283 additions and 42 deletions

View File

@@ -1,9 +1,12 @@
#include "pip.h"
#include "ccm_kbd.h"
TileProgress * tp;
void key_event(PIKbdListener::KeyEvent e, void*) {
PICodeInfo::EnumInfo * ei = PICodeInfo::enumsInfo->value("PIKbdListener::SpecialKey");
if (!ei) return;
if (e.key == '-') {tp->value -= 1.; return;}
if (e.key == '+') {tp->value += 1.; return;}
piCout << PICoutManipulators::NewLine << "modifiers" << e.modifiers;
piForeachC (PICodeInfo::EnumeratorInfo & i, ei->members)
if (i.value == e.key) {
@@ -21,7 +24,7 @@ public:
delete t->parentTile();
}
EVENT_HANDLER1(void, eventKey, PIKbdListener::KeyEvent, e) {
piCout << "key" << e.key;
//piCout << "key" << e.key;
}
};
@@ -112,15 +115,13 @@ public:
};
int main (int argc, char * argv[]) {
int cc = PIString(argv[1]).toInt();
/*int cc = PIString(argv[1]).toInt();
piCout << "Deque";
Test<PIDeque<int> > testd(cc);
/*piCout << PICoutManipulators::NewLine << "Vector";
Test<PIVector<int> > testv(cc);*/
return 0;*/
return 0;
/*if (!(argc == 3 || argc == 4)) {
piCout << "UDPFileTransfer";
piCout << "USE: piptest [src_ip_port] [dst_ip_port] {filename}";
@@ -140,12 +141,13 @@ int main (int argc, char * argv[]) {
} else {
piCout << "wait for receiving";
}*/
Catcher catcher;
PIScreen screen(false, key_event);
CONNECTU(&screen, tileEvent, &catcher, event)
CONNECTU(&screen, keyPressed, &catcher, eventKey)
screen.enableExitCapture(PIKbdListener::F10);
//screen.start();
screen.start();
float cx = 0, cy = 0, vx = 1., vy = 0.3, t = 0.;
PITimeMeasurer tm;
Color col = Red;
@@ -220,14 +222,13 @@ int main (int argc, char * argv[]) {
tile2->size_policy = PIScreenTypes::Preferred;
tile->addTile(tile2);
tile2 = new TileButtons("butt0");
/*tile2 = new TileButtons("butt0");
tile2->back_format.color_back = Transparent;
tile->addTile(tile2);
((TileButtons*)tile2)->content << TileButtons::Button("first", CellFormat(Green, Transparent));
((TileButtons*)tile2)->content << TileButtons::Button("sec", CellFormat(Green, Red));
((TileButtons*)tile2)->content << TileButtons::Button("3", CellFormat(Green, Transparent));
((TileButtons*)tile2)->direction = PIScreenTypes::Horizontal;
//((TileButtons*)tile)->alignment = Center;
tile2 = new TileButtons("butt1");
tile2->back_format.color_back = Transparent;
@@ -236,11 +237,52 @@ int main (int argc, char * argv[]) {
((TileButtons*)tile2)->content << TileButtons::Button("sec2", CellFormat(Green, Red));
((TileButtons*)tile2)->content << TileButtons::Button("333", CellFormat(Green, Transparent));
((TileButtons*)tile2)->direction = PIScreenTypes::Horizontal;
//((TileButtons*)tile)->alignment = Center;
((TileButtons*)tile)->back_format.color_back = Yellow;
tile2 = new TileButtons("butt2");
tile2->back_format.color_back = Transparent;
tile->addTile(tile2);
((TileButtons*)tile2)->content << TileButtons::Button("fF", CellFormat(Green, Transparent));
((TileButtons*)tile2)->content << TileButtons::Button("sec2", CellFormat(Green, Red));
((TileButtons*)tile2)->content << TileButtons::Button("333", CellFormat(Green, Transparent));
((TileButtons*)tile2)->direction = PIScreenTypes::Vertical;*/
tile2 = new TileButton("butt0");
tile2->back_format.color_back = Transparent;
tile->addTile(tile2);
((TileButton*)tile2)->text = "first";
tile2 = new TileButton("butt1");
tile2->back_format.color_back = Transparent;
tile->addTile(tile2);
((TileButton*)tile2)->text = "sec2";
tile2 = new TileCheck("check0");
tile2->back_format.color_back = Transparent;
tile->addTile(tile2);
((TileCheck*)tile2)->text = "check";
tile2 = new TileCheck("check1");
tile2->back_format.color_back = Transparent;
tile->addTile(tile2);
((TileCheck*)tile2)->text = "ch";
((TileCheck*)tile2)->toggled = true;
tile2 = new TileButton("butt2");
tile2->back_format.color_back = Transparent;
tile->addTile(tile2);
((TileButton*)tile2)->text = "F";
tp = new TileProgress("butt2");
//tile2->back_format.color_back = Transparent;
tp->maximum = 200;
tp->prefix = "prog: ";
tp->suffix = " bytes";
tile->addTile(tp);
((TileButton*)tile)->back_format.color_back = Yellow;
tile->setMargins(2, 2, 1, 1);
tile->spacing = 1;
tile->direction = PIScreenTypes::Horizontal;
screen.setDialogTile(tile);
//screen.rootTile()->hide();