Example #1
0
int main (int   argc, char *argv[]){
 
  ViewHandle * MainViewHandle = View_Initialize(NULL);
	
  /*gtk_init(&argc, &argv);  */
	gtk_init(NULL, NULL);
  GtkWidget *window           = drawMain(MainViewHandle);  
  GtkWidget *menubar          = drawMenuBar(MainViewHandle);
  GtkWidget *vbox             = gtk_vbox_new(FALSE, 0);
  GtkWidget *hbox             = gtk_hbox_new(FALSE, 0);    
  GtkWidget *scrollWinImage   = drawImageWindow(MainViewHandle);
  GtkWidget *scrollWinText    = drawTextWindow(MainViewHandle);
  /*GtkWidget *rotateWindow     = */drawRotateWindow(MainViewHandle);
  /*GtkWidget *cropWindow       = */drawCropWindow(MainViewHandle);
  /*GtkWidget *filterWindow     = */drawColorFilterWindow(MainViewHandle);
  /*GtkWidget *ocrWindow        = */drawOCRWindow(MainViewHandle);
  /*GtkWidget *aboutWindow      = */drawAboutWindow(MainViewHandle);

  gtk_container_add(GTK_CONTAINER(window), vbox);
  gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 3);
  gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(hbox), scrollWinImage, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(hbox), scrollWinText, TRUE, TRUE, 0);
          
  /* show the window*/
  gtk_widget_show_all(window); 
  
  gtk_main(); 
  
  
  
  return 0;
}
void SystemCinderApp::setup()
{
	//create configuration object to parse program information
	Configuration* configuration = new Configuration(XML_FILE_PATH);
	// get what kind of Display we will be using and assign it to our attribute mDisplayType
	mDisplayType = configuration->GetDisplayID();

	/*FBO where we will be rendering our scene */
	gl::Fbo::Format format;
	mFbo = gl::Fbo::create(FBO_HEIGHT, FBO_WIDTH, format.depthTexture());
	// Load corresponding shaders, place in assets and use something like this:
	/*
	try{
		mMappingShader = gl::GlslProg(
			loadFile("path/shaders/mappingShader.glsl"),
			loadFile ("path/shaders/mappingShader.glsl");
	}catch(...){
		console() << "Cant load/compile shader"<<endl;

	*/
	WindowRef mMainWindow = getWindow();
	// dektop monitor window goes in index 0
	mProjectors[0] = mMainWindow;
	/*If the hardware sphere was selected, we create the corresponding windows*/
	if (mDisplayType == 3){

		/*Determine how many Displays/Monitors are connected to the system*/
		/*I only have one but once we use the projectors m Display should contain a reference to all the displays connected to the system */
		mDisplays = ci::Display::getDisplays();

		int i = 1;
		/* open a window for every projector, if we have 2 projectors we will have 3 windows in total (1 desktop monitor, 1 for projector1 and 1 for projector2*/
		/* As this is the defult window we set its size in prepareSettings(App::Settings* settings) at top of this file */
		for (i; i <= configuration->GetNumberOfProjectors(); i++){
			mProjectors[i] = createWindow(Window::Format().size(configuration->GetWidthProjectors(), configuration->GetHeightProjectors()));
			/* .display sets each window to a monitor but becuase now I only have one monitor all widnows will display to the same monitor */
			//mProjectors[i] = createWindow(Window::Format().display(mDisplays[i]).size(configuration->GetWidthProjectors(), configuration->GetHeightProjectors()));
		}
		/*connect each window with it's draw method where we will generate and send the corresponding texture from the FBO.
		You will need to create a method for every projector we add to the system*/
		/* build a generate draw for each projector*/
		mProjectors[0]->getSignalDraw().connect([this] { drawMain(); });
		mProjectors[1]->getSignalDraw().connect([this] { drawFirst(); });
		mProjectors[2]->getSignalDraw().connect([this] { drawSecond(); });
		//mProjectors[3]->getSignalDraw().connect([this] { drawThird(); });



	/*Else virtualSphere or VirtualCube where determined in configuration we call the VirtualDisplayConstructor*/
	}else {
		mVirtualDisplay = new VirtualDisplay(mDisplayType);
		mProjectors[0]->getSignalDraw().connect([this] { drawSimulator(); });

	}

	setupScene();

	gl::enableDepthRead();
	gl::enableDepthWrite();
}
Example #3
0
void drawDirectory()
{
    CreateDirs();

    Menu_Loop();

    drawMain();
}
Example #4
0
void		Menu::draw()
{
  if (this->which == 0)
    drawMain();
  else if (this->which == 1)
    drawNew();
  else if (this->which == 2)
    drawLoad();
  else if (this->which == 3)
    drawPlayer();
}
void drawHelp(){
   
   drawMain();
   
   attron(COLOR_PAIR(1));   
   mvwprintw(win, 4,1,"**RF24Gateway NCurses Help Menu**");
   wprintw(win," Controls:\n");
   wprintw(win," ARROW_UP/DOWN: Scroll up/down in supported menus\n");
   wprintw(win," ARROW_LEFT/RIGHT: Scroll between supported menus\n");
   wprintw(win," 'c' key: Open IP configuration menu\n");
   wprintw(win," 'w' key: Increase frame-rate of display\n");
   wprintw(win," 's' key: Decrease frame-rate of display\n");
   wprintw(win," 'a' key: Display active IP connections\n");
   wprintw(win," 'h' key: Display this menu\n");
   
   timeout(30000);
   getch();
   timeout(0);
   
   drawMain();
   
}
	void ZoomPanElement::draw(ApplicationData appData, Graphics graphics) const
	{
		Graphics mainGraphics(graphics);
		RectangleD frame = getFrame();
		if(isClippedToFrame())
		{
			mainGraphics.clip(frame);
		}
		drawBackground(appData, mainGraphics);
		drawMain(appData, mainGraphics);
		graphics.translate(frame.x, frame.y);
		drawElements(appData, graphics);
	}
Example #7
0
void drawOptions(void)
{
	switch (show)
	{
		case SHOW_MAIN:
			drawMain();
			break;
			
		case SHOW_CONTROLS:
			drawControls();
			break;
	}
}
void drawCfg(bool isConf){

	if(isConf){drawMain();}
	nocbreak();
	echo();
	timeout(30000);
	
	sleep(1);
	wattron(win,COLOR_PAIR(1));
	mvwprintw(win,5,1, isConf ? "IP Configuration\n" : "**Interface Not Configured:**\n");
	wattroff(win,COLOR_PAIR(1));
	mvwprintw(win,6,1,"Enter IP Address: \n");
	refresh();
	
	char ip[20],mask[20];
	mvgetstr(6,19,ip);
	
	mvwprintw(win,7,1,"Enter Subnet Mask: \n");
	refresh();
	
	mvgetstr(7,20,mask);
	
	if(strlen(ip) >= 6 && strlen(mask) >= 7){
	  gw.setIP(ip,mask);
	}else{
	  mvwprintw(win,8,1,"Unable to set IP/Subnet \n");
	  refresh();
	  sleep(3);
	}

	timeout(0);
    cbreak();
	noecho();

    drawMain();
}
int main() {	
  
  gw.begin();
  
  //uint8_t nodeID = 22;
  //gw.begin(nodeID,3,RF24_2MBPS);
  
  //uint16_t address = 0;
  //gw.begin(address,3,RF24_2MBPS);
  
  /** Setup NCurses**/
  /*******************************/ 
  win = initscr();
  cbreak(); 
  noecho();
  getmaxyx(win,maxX,maxY);
  
  start_color();
  curs_set(0);   
  init_pair(1, COLOR_GREEN, COLOR_BLACK);
  init_pair(2, COLOR_RED, COLOR_BLACK);
  
  /** Setup Pads**/
  /*******************************/
  devPad = newpad(11,40);  
  meshPad = newpad(11,50);  
  rf24Pad = newpad(11,40);  
  connPad = newpad(21,150);
  cfgPad = newpad(10,40);
  
  scrollok(meshPad,true);
  scrollok(connPad,true);
  scrollok(rf24Pad,true);
  timeout(0);
  
  drawMain();


  
/******************************************************************/ 
/***********************LOOP***************************************/  
 while(1){
	
	//delayMicroseconds(5000);
	//delay(1);
	/**
	* The gateway handles all IP traffic (marked as EXTERNAL_DATA_TYPE) and passes it to the associated network interface
	* RF24Network user payloads are loaded into the user cache		
	*/
    gw.update();
  
  /** Read RF24Network Payloads (Do nothing with them currently) **/
  /*******************************/
	if( network.available() ){
	  RF24NetworkHeader header;
	  size_t size = network.peek(header);
	  uint8_t buf[size];

         if(header.type == 1){
	  struct timeStruct{
	   uint8_t hr;
	   uint8_t min;
	  }myTime;

	  time_t mTime;
	  time(&mTime);
	  struct tm* tm = localtime(&mTime);

          myTime.hr = tm->tm_hour;
          myTime.min = tm->tm_min;
         RF24NetworkHeader hdr(header.from_node,1); 
         network.write(hdr,&myTime,sizeof(myTime));

   	}
          network.read(header,&buf,size);
	}

  

  /** Mesh address/id printout **/
  /*******************************/
    if(millis() - meshInfoTimer > updateRate){

	  getmaxyx(win,maxX,maxY);

	  // Draw the pads on screen
      drawDevPad();
	  prefresh(devPad,0,0, 4,1, 15,25);
	  
      drawMeshPad(); 
	  wscrl(meshPad,meshScroll);
	  prefresh(meshPad,0,0, 4,26, 15,47);
	  
	  drawRF24Pad();
	  prefresh(rf24Pad,0,0, 4,51, 15, 73);
	  
	  if(showConnPad){
	    drawConnPad();
	    wscrl(connPad,connScroll);
	    prefresh(connPad,0,0, 15,1, maxX-1,maxY-2);
      }
	} //MeshInfo Timer
   
   
   
  /** Handle keyboard input **/
  /*******************************/
	int myChar;
	if ( (myChar = getch()) == '\033') {
	  getch();
	  switch(getch()){
	    case 'A': if(padSelection == 0){meshScroll++;}else if(padSelection == 1){connScroll++;} break;
		case 'B': if(padSelection == 0){meshScroll--;}else if(padSelection == 1){connScroll--;} break;
		case 'C': padSelection++; padSelection= std::min(padSelection,1); break; //right
		case 'D': padSelection--; padSelection= std::max(padSelection,0); break; //left
	  }
	  meshScroll = std::max(meshScroll,0);
	  connScroll = std::max(connScroll,0);
	  meshInfoTimer = 0;
	}else
    if(myChar > -1){
	  switch(myChar){
	    // a: En/Disable display of active connections
	    case 'a' : showConnPad = !showConnPad; if(!showConnPad){ wclear(connPad); prefresh(connPad,0,0, 15,1, maxX-1,maxY-2); drawMain();} break;
		// w: Increase frame-rate of curses display
		case 'w' : if(updateRate > 100){updateRate-=100;} mvwprintw(win,2,27,"Refresh Rate: %.1f fps",1000.0/updateRate); refresh(); break;
		// s: Decrease frame-rate of curses display
		case 's' : updateRate+=100; mvwprintw(win,2,27,"Refresh Rate: %.1f fps   \t",1000.0/updateRate); refresh(); break;
		// c: Display IP configuration menu
		case 'c' : drawCfg(1); break;
		// h: Display help menu
		case 'h' : drawHelp(); break;
		case 'x' : clear(); endwin(); return 0; break;
	  }

	
	}
    delay(2);
 }//while 1


 //delwin(meshPad);
 //delwin(connPad);
 clear();
 endwin();
 return 0;
 
}//main