Example #1
0
struct qt_cb_data * AppendNode(struct qt_cb_data **head,char *ref_, char *init_val_,char *value_,char *name_,char *meta_info_){
    /*
    1. allocate memory
    2. adjust the values
    3. adjust pointers
    4. return pointers to this node
    */
    //fprintf(stdout,"\n ==> , head = %s, name = %s, meta = %s",(*head) != 0 ? (*head)->name : "null",name_,meta_info_);
    static int i = -1;
    i++;
    struct qt_cb_data *newnode = AllocateMemoryForQtkCBNode();
    if( newnode != 0){
        newnode->ref = s_dupstr(ref_);
        newnode->name = s_dupstr(name_);
        newnode->value = s_dupstr(value_);
        newnode->init_val = s_dupstr(init_val_);
        newnode->meta_info = s_dupstr(meta_info_);
        struct qt_cb_data *temp = (*head);
        if( (*head) == 0){
            // no node in the system
            (*head) = newnode;
        }
        else
        {
            while( temp->next != 0){
                temp = temp->next;
            }
            temp->next = newnode;
            newnode->prev = temp;
        }
    }
    return newnode;
}
Example #2
0
int qt_f_ButtonHandler(sXformsNode *head,xmlNode *node,struct sCbData **CallBackData,xmlDoc * modelDocPtr, CallBackInterfaceFunction func)
{
    static int btnctr = 0;
    head->meta_info = (char *)"1";
    xmlNode *item = CreateItemNode(node,0,itoa(row++),int2str[0]);
    Create1WidgetNodeWithStringProp(item,sAppendString("Btn_",itoa(btnctr)), "QPushButton","text", head->name);
    //struct sCbData *btn =  AppendNode(CallBackData,"REFERENCE", "NULL","NULL",sAppendString("Btn_",int2str[btnctr]),"QPushButton");
   struct sCbData *btnref  = AppendNode(CallBackData,"0","0","0",sAppendString("Btn_",itoa(btnctr)),"QPushButton",modelDocPtr,func);
	 for(sXformsNode * temp = head;temp;temp=temp->prev)
    {
        if( !strcmp(temp->type,"xf:input") || !strcmp(temp->type,"xf:textarea") )
        {
            // find it's name and index and reference
            for( int i = 0; i < lindex ;i++)
            {
              if( !strcmp(temp->name,ActualName[i]))
              {
              	 sXformsNodeAttr *attr = getAttrFromList(temp,"ref");
              	 sXformsNodeAttr *attr2 = getAttrFromList(temp,"readonly");
              	 if(attr && !attr2)
              	 {
              	    AppendNode(&btnref->nextref,s_dupstr(attr->meta_info),s_dupstr(attr->private_data),(char *)0,s_dupstr(InputName[i]),"QLineEdit",modelDocPtr,func);
              	 }
              	 else
              	 {
              	    AppendNode(&btnref->nextref,int2str[0],int2str[0],int2str[0],s_dupstr(InputName[i]),"QLineEdit",modelDocPtr,func);
              	 }
              }
            }
        }
    }
    lindex = 0;
    InputCountStart = inputctr;
    btnctr++;
}
Example #3
0
int qt_f_CheckBoxList(sXformsNode *head,xmlNode *node,struct sCbData **CallBackData,xmlDoc * modelDocPtr, CallBackInterfaceFunction func)
{
    static int checkboxctr = 0;
    head->meta_info = (char *)"1"; 
    sXformsNode *temp;
    sXformsNode *xfchoices = SearchSubTreeForNodes(head,(char *)"xf:choices",(sXformsNodeAttr *)0,0,0);
    if( xfchoices ){
			xfchoices->meta_info = (char *)"1";
			int ctr = 0;
			for( temp=xfchoices->child; temp != 0; ctr++,row++, temp=temp->next){
			    xmlNode *item = CreateItemNode(node,0,itoa(row),int2str[0]);
			    temp->meta_info = strdup(int2str[1]);
			    char *checkname = sAppendString("CheckBox_",itoa(checkboxctr));
          Create1WidgetNodeWithStringProp(item,checkname,"QCheckBox","text",temp->name);
          //AppendNode(CallBackData,"NULL-REFERENCE", "NULL-INITVAL","NULL-VAL",sAppendString("CheckBox_",int2str[checkboxctr++]),"QCheckBox");
              sXformsNodeAttr *attr = getAttrFromList(temp,"ref");
          	 if(attr)
          	 {
          	    AppendNode(CallBackData,s_dupstr(attr->meta_info),s_dupstr(attr->private_data),(char *)0,checkname,"QCheckBox",modelDocPtr,func);
          	 }
          	 else
          	 {
          	    AppendNode(CallBackData,int2str[0],int2str[0],int2str[0],checkname,"QCheckBox",modelDocPtr,func);
          	 }
			}
    }
    row++;
}
Example #4
0
int qt_f_LabelHandler(sXformsNode *head,xmlNode *node,struct sCbData **CallBackData,xmlDoc * modelDocPtr, CallBackInterfaceFunction func)
{
    static int labelctr = 0;
    char *labelname = sAppendString("Label_",itoa(labelctr++));
    head->meta_info = (char *)"1";
    xmlNode *item = CreateItemNode(node,0,itoa(row++),int2str[0]);
    Create1WidgetNodeWithStringProp(item,labelname, "QLabel","text", "NULL"); 
    sXformsNodeAttr *attr = getAttrFromList(head,"ref");
  	 if(attr)
  	 {
  	    AppendNode(CallBackData,s_dupstr(attr->meta_info),s_dupstr(attr->private_data),(char *)0,labelname,"QLabel",modelDocPtr,func);
  	 }
  	 else
  	 {
  	    AppendNode(CallBackData,int2str[0],int2str[0],int2str[0],labelname,"QLabel",modelDocPtr,func);
  	 }
}
Example #5
0
int qt_f_Select1Handler(sXformsNode *head,xmlNode *node,struct sCbData **CallBackData,xmlDoc * modelDocPtr, CallBackInterfaceFunction func)
{
    static int ddctr = 0;
    head->meta_info = strdup("1");
    
    xmlNode *lblitem = CreateItemNode(node,0,itoa(row),int2str[0]);
    Create1WidgetNodeWithStringProp(lblitem,sAppendString("Label_",sAppendString("DDlbl_",itoa(ddctr))), "QLabel","text", head->name); 
    
    xmlNode *dditem = CreateItemNode(node,0,itoa(row),int2str[2]);
    xmlNode *dd = Create1WidgetNode(dditem,sAppendString("DD_",itoa(ddctr)),"QComboBox",0,0,0,0);
    //AppendNode(CallBackData,"NULL-REFERENCE", "NULL-INITVAL","NULL-VAL",sAppendString("DD_",int2str[ddctr]),"QComboBox");
    xmlNode *dd_prop = CreateNumberProperty(dd,"currentIndex",head->value);
    sXformsNodeAttr *attr = getAttrFromList(head,"ref");
    sCbData * d = NULL;
          	 if(attr)
          	 {
          	    d = AppendNode(CallBackData,s_dupstr(attr->meta_info),s_dupstr(attr->private_data),s_dupstr(head->value),sAppendString("DD_",itoa(ddctr)),"QComboBox",modelDocPtr,func);
          	 }
          	 else
          	 {
          	    AppendNode(CallBackData,int2str[0],int2str[0],int2str[0],sAppendString("DD_",itoa(ddctr)),"QComboBox",modelDocPtr,func);
          	 }
    sXformsNode *temp;
    sXformsNode *xfchoices = SearchSubTreeForNodes(head,(char *)"xf:choices",(sXformsNodeAttr *)0,0,0);
    if( xfchoices ){
        xfchoices->meta_info = strdup("1");
        struct sCbValue * v = NULL;
        for( temp=xfchoices->child; temp != 0; temp=temp->next){
          temp->meta_info = strdup(int2str[1]);
          xmlNode *choice = CreateItemNode(dd,0,0,0);
          CreateStringProperty(choice,"text", temp->name);

          if(temp == xfchoices->child)
            v = d->values = (sCbValue*) calloc(sizeof(sCbValue),1);
          else
          {
            v->next = (sCbValue*) calloc(sizeof(sCbValue),1);
            v = v->next;
          }
	  v->ui_string = temp->name;
          v->value = temp->value;
        }
    }
    ddctr++;
    row++;
}
Example #6
0
int qt_f_RadioButtonList(sXformsNode *head,xmlNode *node,struct sCbData **CallBackData,xmlDoc * modelDocPtr, CallBackInterfaceFunction func)
{
    static int radioctr = 0;
    head->meta_info = strdup("1");
  
    xmlNode *lblitem = CreateItemNode(node,0,itoa(row),int2str[0]);
    Create1WidgetNodeWithStringProp(lblitem,sAppendString("DDlbl_",itoa(radioctr)), "QLabel","text", head->name); 
    xmlNode *radioitem = CreateItemNode(node,0,itoa(row),int2str[2]);
    char *proptype[] = {"string","bool","bool"};
    char *propname[] = {"title","checkable","checked"};
    char *propval[] = {(char *)0,"false","false"};
    xmlNode *QGroupBox = Create1WidgetNode(radioitem,sAppendString("QGroupBox_",itoa(radioctr)), "QGroupBox",propname,proptype,propval,3);    
    sXformsNode *temp;
    sXformsNode *xfchoices = SearchSubTreeForNodes(head,(char *)"xf:choices",(sXformsNodeAttr *)0,0,0);
    if( xfchoices ){
			xfchoices->meta_info = (char *)"1";
			int ctr = 0;
			for( temp=xfchoices->child; temp != 0; ctr++, temp=temp->next){
			    char buffer[5];
			    sprintf(buffer,"%d",5 + 80*ctr);
			    temp->meta_info = strdup(int2str[1]);
			    char *radioname = sAppendString("radio_",itoa(ctr));
			    xmlNode *radio = Create1WidgetNode(QGroupBox,radioname,"QRadioButton",0,0,0,0);
			    //AppendNode(CallBackData,"NULL-REFERENCE", "NULL-INITVAL","NULL-VAL",sAppendString("radio_",int2str[ctr]),"QRadioButton");
			       sXformsNodeAttr *attr = getAttrFromList(temp,"ref");
          	 if(attr)
          	 {
          	    AppendNode(CallBackData,s_dupstr(attr->meta_info),s_dupstr(attr->private_data),(char *)0,radioname,"QRadioButton",modelDocPtr,func);
          	 }
          	 else
          	 {
          	    AppendNode(CallBackData,int2str[0],int2str[0],int2str[0],radioname,"QRadioButton",modelDocPtr,func);
          	 }
          Create1GeometryProp(radio,buffer,"0","108", "26"); 
          CreateStringProperty(radio,"text",temp->name);
			}
    }
    radioctr++;
    row++;
}
Example #7
0
int qt_f_RangeHandler(sXformsNode *head,xmlNode *node,struct sCbData **CallBackData,xmlDoc * modelDocPtr, CallBackInterfaceFunction func)
{
    fprintf(stdout,"\n[%s][%d] HEAD = %s:%s \t\t NODE = %s",__func__,__LINE__,head->name, head->type,node->name);
    static int sliderctr = 0;
    xmlNode *lblitem = CreateItemNode(node,0,itoa(row++),int2str[0]);
    Create1WidgetNodeWithStringProp(lblitem,sAppendString("LabelSlider_",itoa(sliderctr++)), "QLabel","text", head->name); 
    xmlNode *item = CreateItemNode(node,0,itoa(row++),int2str[0]);
    char *proptype[] = {"number","number","enum","enum","number"};
    char *propval[] = {"100","50","Qt::Horizontal","QSlider::TicksBothSides","5"};
    char *propname[] = {"maximum","value","orientation","tickPosition","tickInterval"};
    Create1WidgetNode(item,sAppendString("Slider_",itoa(sliderctr)),"QSlider",propname,proptype,propval,5);
    //AppendNode(CallBackData,"REFERENCE", "NULL","NULL",sAppendString("Slider_",int2str[sliderctr]),"QSlider");
     sXformsNodeAttr *attr = getAttrFromList(head,"ref");
  	 if(attr)
  	 {
  	    AppendNode(CallBackData,s_dupstr(attr->meta_info),s_dupstr(attr->private_data),(char *)0,sAppendString("Slider_",itoa(sliderctr)),"QSlider",modelDocPtr,func);
  	 }
  	 else
  	 {
  	    AppendNode(CallBackData,int2str[0],int2str[0],int2str[0],sAppendString("Slider_",itoa(sliderctr)),"QSlider",modelDocPtr,func);
  	 }
    sliderctr++;
    row++;
}
Example #8
0
int qt_f_InputHandler(sXformsNode *head,xmlNode *node,struct sCbData **CallBackData,xmlDoc * modelDocPtr, CallBackInterfaceFunction func)
{
    
    head->meta_info = (char *)"1";
    char *name = sAppendString("Input_",itoa(inputctr));
    xmlNode *lblitem = CreateItemNode(node,0,itoa(row),int2str[0]);
    Create1WidgetNodeWithStringProp(lblitem,sAppendString("Inputlbl_",itoa(inputctr)), "QLabel","text", head->name); 
    xmlNode *inputitem = CreateItemNode(node,0,itoa(row),int2str[2]);
    xmlNode *InputWidget = Create1WidgetNode(inputitem,name,"QLineEdit",0,0,0,0); 
    ActualName[lindex] = head->name;
    InputName[lindex] = name;
    lindex++;
    //AppendNode(&btn->nextref,"REFERENCE", "NULL","NULL",name,"QLineEdit");
    sXformsNodeAttr *attr = getAttrFromList(head,"ref");
    sXformsNodeAttr * attr_read_only = getAttrFromList(head,"readonly");
    if(attr_read_only)
		{
		  Create1PropertyNode(InputWidget,"readOnly","bool","true");
		  if(attr)
  	 {
  	    AppendNode(CallBackData,s_dupstr(attr->meta_info),"READONLY",(char *)0,s_dupstr(name),"Fl_Input",modelDocPtr,func);
  	 }
  	 else
  	 {
  	    AppendNode(CallBackData,int2str[0],"READONLY",int2str[0],s_dupstr(name),"Fl_Input",modelDocPtr,func);
  	 }
		}
		else
		{
		  if(attr)
  	 {
  	    AppendNode(CallBackData,s_dupstr(attr->meta_info),s_dupstr(attr->private_data),(char *)0,s_dupstr(name),"Fl_Input",modelDocPtr,func);
  	 }
  	 else
  	 {
  	    AppendNode(CallBackData,int2str[0],int2str[0],int2str[0],s_dupstr(name),"Fl_Input",modelDocPtr,func);
  	 }
		}
    row++;
    inputctr++;
}