Example #1
0
void UserInterface::blitAddressQueueList(	vector<string>* AddressQueueListItems)	//OK Dec 6
{
	ReloadItems(						//A helper macro to implement the body of UserInterface::blitROBList()
				AddressQueueListItems,	//1 In vector:				AddressQueueListItems
				addressQueueItems,		//2	WidgetList to refresh:	_interfaceWidgetItems.addressQueueItems
				addressQueueItemsCount,
				addressQueue		);	//3 Widget to blit to:		_interfaceWidgets.addressQueue

				/*library bug. Remove items  if list shrank*/
				while(_interfaceWidgetItemCount.addressQueueItemsCount > loop)
					{
						_interfaceWidgetItemCount.addressQueueItemsCount--;
						deleteCDKScrollItem(_interfaceWidgets.addressQueue,
											_interfaceWidgetItemCount.addressQueueItemsCount);
					}
					_interfaceWidgetItemCount.addressQueueItemsCount = loop;
					/*re-set list items to new list*/
				_interfaceWidgetItems.addressQueueItems = charROBListItems;
				if(_interfaceWidgetItems.addressQueueItems == NULL)
					return;
				setCDKScrollItems (	_interfaceWidgets.addressQueue,
									(char**)_interfaceWidgetItems.addressQueueItems,
									loop,
									true								);



//TODO blit all on clock
#ifdef DEBUG
	drawCDKScroll (_interfaceWidgets.addressQueue,		//Draw this window
					true						);	//Draw with a box around it
#endif
}
Example #2
0
void UserInterface::blitROBList(vector<string>* ROBListItems)
{
	int 						loop = 0;
	const char* 				charROBListItems[ROBListItems->size()];
	vector<string>::iterator 	listit;

	for(listit =ROBListItems->begin(); listit != ROBListItems->end(); listit++)	//Iterate over each string
	{
		charROBListItems[loop] = convert(*listit);
		loop++;
	}

	_interfaceWidgetItems.ROBListItems = charROBListItems;		//Set the items list.
	if(_interfaceWidgetItems.ROBListItems == NULL)
		return;

	setCDKScrollItems (	_interfaceWidgets.ROBList,				//Nuke the old content and refresh
						(char**)_interfaceWidgetItems.ROBListItems,
						ROBListItems->size(),
						true								);

//TODO blit all on clock
#ifdef DEBUG
	drawCDKScroll (_interfaceWidgets.ROBList,		//Draw this window
					true						);	//Draw with a box around it
#endif
//DOUBT I DOUBT THAT THE LIST ITEMS WILL STAY IN SCOPE OUTSIDE OF THIS FUNCTION

}
Example #3
0
/*
 * This sets certain attributes of the scrolling list.
 */
void setCDKScroll (CDKSCROLL *scrollp,
		   CDK_CSTRING2 list,
		   int listSize,
		   boolean numbers,
		   chtype highlight,
		   boolean Box)
{
   setCDKScrollItems (scrollp, list, listSize, numbers);
   setCDKScrollHighlight (scrollp, highlight);
   setCDKScrollBox (scrollp, Box);
}
Example #4
0
File: fselect.c Project: dyne/MuSE
/*
 * This sets the current directory of the file selector.
 */
int setCDKFselectDirectory (CDKFSELECT *fselect, char *directory)
{
   /* Declare local variables. */
   CDKENTRY *fentry	= fselect->entryField;
   CDKSCROLL *fscroll	= fselect->scrollField;
   int ret;

   /*
    * If the directory supplied is the same as what is already
    * there, return.
    */
   if (fselect->pwd == directory)
   {
      return 1;
   }

   /* Try to chdir into the given directory. */
   ret = chdir (directory);
   if (ret != 0)
   {
      return 0;
   }

   setPWD(fselect);

   /* Set the contents of the entry field. */
   setCDKEntryValue (fentry, fselect->pwd);
   drawCDKEntry (fentry, ObjOf(fentry)->box);

   /* Get the directory contents. */
   if (setCDKFselectDirContents (fselect) == 0)
   {
      return 0;
   }

   /* Set the values in the scrolling list. */
   setCDKScrollItems (fscroll, fselect->dirContents,
			fselect->fileCounter,
			FALSE);
   return 1;
}
Example #5
0
File: fselect.c Project: dyne/MuSE
/*
 * This function sets the information inside the file selector.
 */
void setCDKFselect (CDKFSELECT *fselect, char *directory, chtype fieldAttrib, chtype filler, chtype highlight, char *dirAttribute, char *fileAttribute, char *linkAttribute, char *sockAttribute, boolean Box GCC_UNUSED)
{
   /* Declare local variables. */
   CDKSCROLL *fscroll	= fselect->scrollField;
   CDKENTRY *fentry	= fselect->entryField;
   char *tempDir	= 0;
   char *mesg[10], newDirectory[2000], temp[100];
   int ret;

   /* Keep the info sent to us. */
   fselect->fieldAttribute	= fieldAttrib;
   fselect->fillerCharacter	= filler;
   fselect->highlight		= highlight;
   strcpy (newDirectory, directory);

   /* Set the attributes of the entry field/scrolling list. */
   setCDKEntryFillerChar (fentry, filler);
   setCDKScrollHighlight (fscroll, highlight);

   /* Only do the directory stuff if the directory is not null. */
   if (directory != 0)
   {
      /* Try to expand the directory if it starts with a ~ */
      if (directory[0] == '~')
      {
	 tempDir = expandFilename (directory);
	 if (tempDir != 0)
	 {
	    strcpy (newDirectory, tempDir);
	    freeChar (tempDir);
	 }
      }

      /* Change directories. */
      ret = chdir (newDirectory);
      if (ret != 0)
      {
	 /* Beep at them. */
	 Beep();

	 /* Couldn't get into the directory, pop up a little message. */
	 sprintf (temp, "<C>Could not change into %s", newDirectory);
	 mesg[0] = copyChar (temp);

#ifdef HAVE_STRERROR
	 sprintf (temp, "<C></U>%s", strerror(errno));
	 mesg[1] = copyChar (temp);
#else
	 sprintf (temp, "<C></U>Unknown reason.");
	 mesg[1] = copyChar (temp);
#endif

	 mesg[2] = " ";
	 mesg[3] = "<C>Press Any Key To Continue.";

	 /* Pop Up a message. */
	 popupLabel (ScreenOf(fselect), mesg, 4);

	 /* Clean up some memory. */
	 freeCharList (mesg, 4);

	 /* Get out of here. */
	 eraseCDKFselect (fselect);
	 drawCDKFselect (fselect, ObjOf(fselect)->box);
	 return;
      }
   }

   /*
    * If the information coming in is the same as the information
    * that is already there, there is no need to destroy it.
    */
   if (fselect->pwd != directory)
   {
      setPWD(fselect);
   }
   if (fselect->fileAttribute != fileAttribute)
   {
      /* Remove the old pointer and set the new value. */
      freeChar (fselect->fileAttribute);
      fselect->fileAttribute = copyChar (fileAttribute);
   }
   if (fselect->dirAttribute != dirAttribute)
   {
      /* Remove the old pointer and set the new value. */
      freeChar (fselect->dirAttribute);
      fselect->dirAttribute = copyChar (dirAttribute);
   }
   if (fselect->linkAttribute != linkAttribute)
   {
      /* Remove the old pointer and set the new value. */
      freeChar (fselect->linkAttribute);
      fselect->linkAttribute = copyChar (linkAttribute);
   }
   if (fselect->sockAttribute != sockAttribute)
   {
      /* Remove the old pointer and set the new value. */
      freeChar (fselect->sockAttribute);
      fselect->sockAttribute = copyChar (sockAttribute);
   }

   /* Set the contents of the entry field. */
   setCDKEntryValue (fentry, fselect->pwd);
   drawCDKEntry (fentry, ObjOf(fentry)->box);

   /* Get the directory contents. */
   if (setCDKFselectDirContents (fselect) == 0)
   {
      Beep();
      return;
   }

   /* Set the values in the scrolling list. */
   setCDKScrollItems (fscroll,
			fselect->dirContents,
			fselect->fileCounter,
			FALSE);
}
Example #6
0
int main(int argc, char *argv[]){
    /* Read config file */
    clit_config *config = malloc(sizeof(clit_config));
    parse_config(config);
    printf("key:%s,secret:%s\n",config->key,config->secret);
    /* If no user info exists, intialize oauth process */
    init_oauth(config->key,config->secret);

    create_filters();

    home = malloc(sizeof(statuses));
    home->count = 0;

    setlocale(LC_ALL,"");
    CDKSCREEN *cdkscreen = 0;
    CDKSCROLL *home_scroll = 0;
    WINDOW *cursesWin = 0;
    char *title = "<C><\5>Home";
    char **home_items = 0;
    int selection,count;

    char *tmpfile = get_home();
    count = load_timeline(tmpfile,home);
    printf("count:%d\n",count);
    home_items = malloc(count*sizeof(char *));

    CDK_PARAMS params;
    CDKparseParams (argc, argv, &params, "cs:t:" CDK_CLI_PARAMS);

    cursesWin = initscr();
    cdkscreen = initCDKScreen(cursesWin);
    initCDKColor();

    status *p = home->head;
    for(int i=0;i<count;++i){
        if(p){
            home_items[i] = p->text;
            p = p->next;
        }
        else break;
    }
//    count = CDKgetDirectoryContents (".", &home_items);

    home_scroll = newCDKScroll(cdkscreen,
                               CDKparamValue (&params, 'X', CENTER),
                               CDKparamValue (&params, 'Y', CENTER),
                               CDKparsePosition(CDKparamString2(&params, 's', "RIGHT")),
                               CDKparamValue (&params, 'H', 0),
                               CDKparamValue (&params, 'W', 0),
                               CDKparamString2(&params, 't', title),
                               CDKparamNumber(&params, 'c') ? 0 : home_items,
                               CDKparamNumber(&params, 'c') ? 0 : count,
                               TRUE,
                               A_REVERSE,
                               CDKparamValue (&params, 'N', TRUE),
                               CDKparamValue (&params, 'S', FALSE));
    if(home_scroll == 0){
        destroyCDKScreen(cdkscreen);
        endCDK();
        exit(EXIT_FAILURE);
    }
    if (CDKparamNumber(&params, 'c')){
        setCDKScrollItems (home_scroll, home_items, count, TRUE);
    }
    selection = activateCDKScroll (home_scroll, 0);

    char ch = '\0';
    while((ch = getch()) != 'q'){
        switch(ch){
            case 'n':
                break;
        }
    }

    //CDKfreeStrings (home_items);
    destroyCDKScroll(home_scroll);
    destroyCDKScreen(cdkscreen);
    endCDK();
    exit(EXIT_SUCCESS);
}