git-svn-id: svn://db.shs.com.ru/pip@247 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
51
main.cpp
51
main.cpp
@@ -6,7 +6,7 @@
|
||||
#include "piethernet.h"
|
||||
#include "piintrospection.h"
|
||||
#include "pifile.h"
|
||||
#include "pisingleapplication.h"
|
||||
#include "piterminal.h"
|
||||
|
||||
//struct MS {
|
||||
// //MS() {i = 0; f = 0.;}
|
||||
@@ -31,13 +31,58 @@ public:
|
||||
T dot(VC<N, T> a) {T res = T(); for (uint i=0; i<N; i++) res += v[i] * a.v[N - i - 1]; return res;}
|
||||
};
|
||||
|
||||
class TerminalTile: public PIScreenTile {
|
||||
public:
|
||||
TerminalTile(PITerminal * t = 0): term(t) {
|
||||
focus_flags = PIScreenTypes::CanHasFocus;
|
||||
}
|
||||
|
||||
private:
|
||||
void drawEvent(PIScreenDrawer * d) {
|
||||
//piCout << "draw" << visible;
|
||||
if (!term) return;
|
||||
PIVector<PIVector<PIScreenTypes::Cell> > c = term->content();
|
||||
d->fillRect(x, y, x + width, y + height, c);
|
||||
}
|
||||
bool keyEvent(PIKbdListener::KeyEvent key) {
|
||||
//piCout << "key";
|
||||
if (!term) return false;
|
||||
if (PITerminal::isSpecialKey(key.key)) term->write((PIKbdListener::SpecialKey)key.key, key.modifiers);
|
||||
else {
|
||||
PIByteArray ba;
|
||||
ba << PIChar(key.key).toConcole1Byte();
|
||||
term->write(ba);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void resizeEvent(int w, int h) {
|
||||
if (!term) return;
|
||||
term->resize(w, h);
|
||||
}
|
||||
|
||||
|
||||
PITerminal * term;
|
||||
};
|
||||
|
||||
int main (int argc, char * argv[]) {
|
||||
PISingleApplication sa("app");
|
||||
PIScreen screen;
|
||||
PITerminal term;
|
||||
TerminalTile tt(&term);
|
||||
screen.rootTile()->addTile(&tt);
|
||||
tt.setFocus();
|
||||
screen.enableExitCapture();
|
||||
term.initialize();
|
||||
piMSleep(100);
|
||||
term.write(PIString("pisd -h").toByteArray());
|
||||
screen.start();
|
||||
screen.waitForFinish();
|
||||
term.destroy();
|
||||
return 0;
|
||||
/*PISingleApplication sa("app");
|
||||
if (!sa.isFirst())
|
||||
sa.sendMessage(PIString("message to first").toByteArray());
|
||||
else
|
||||
piMSleep(5000);
|
||||
piMSleep(5000);*/
|
||||
//piCout << PIString(argv[1]).toInt();
|
||||
//sh.destroy();
|
||||
//proc.terminate();
|
||||
|
||||
Reference in New Issue
Block a user