コード例 #1
0
ファイル: controller.c プロジェクト: anymex/cndrvcups-lb
void InitWidgetProperty(const ConfigFile *configfile)
{
	FuncInfo *funclist = g_load_func;
	WidgetInformation *lib = NULL;
	SpecialInfo *special = NULL;
	if(configfile != NULL){
		special = configfile->special_list;
	}else{
		return;
	}

	while(funclist != NULL){
		ConnectSignals(funclist);
		funclist = funclist->next;
	}
	if(special != NULL){
		lib = widget_table;
		while(lib->widget_name != NULL){
			if(0 == strcmp(lib->widget_name, "dialog")){
				break;
			}
			lib++;
		}
		if(lib->widget_name != NULL){
			while(special != NULL){
				if(special->type == 1){
					lib->ConnectSignal(g_cngplp_xml, g_cngplp_data, (gpointer *)special);
				}
				special = special->next;
			}
		}
	}
}
コード例 #2
0
ファイル: controller.c プロジェクト: anymex/cndrvcups-lb
void ConnectSignals(const FuncInfo *func_list)
{
	const FuncInfo *func = func_list;
	WidgetInformation *lib = NULL;
	char *widget_type = NULL;
	WidgetInfo *widget = NULL;
	if(func != NULL){
		widget = func->widget_list;
	}else{
		return;
	}

	while(widget != NULL){
		widget_type = widget->type;
		lib = widget_table;
		if(widget_type != NULL){
			while(lib->widget_name != NULL){
				if(0 == strcmp(widget->type, lib->widget_name)){
					if(lib->ConnectSignal != NULL){
						lib->ConnectSignal(g_cngplp_xml, g_cngplp_data, (gpointer *)widget);
						break;
					}
				}
				lib++;
			}
		}
		widget = widget->next;
	}
}
コード例 #3
0
ファイル: controller.c プロジェクト: anymex/cndrvcups-lb
void InitWidgetStatus(ConfigFile *config_file)
{
	FuncInfo *func = g_load_func;
	WidgetInfo *widget = NULL;
	WidgetInformation *lib = NULL;

	while(func != NULL){
		widget = func->widget_list;
		while(widget != NULL){
			char *widget_type = widget->type;
			lib = widget_table;
			if(widget_type != NULL){
				while(lib->widget_name != NULL){
					if(strcmp(widget_type, lib->widget_name) == 0){
						if(lib->InitWidget != NULL){
							lib->InitWidget(g_cngplp_xml, g_cngplp_data, (gpointer *)widget);
						}
						if(widget->func != NULL){
							lib->SpecialFunction(g_cngplp_data, widget->name);
						}
						break;
					}
					lib++;
				}
			}
			widget = widget->next;
		}
		func = func->next;
	}
}
コード例 #4
0
ファイル: widgets.c プロジェクト: Magister/cndrvcups-capt
void DealIDFunctions(const FuncInfo* func, int id)
{
	const char *key;
	KeyInfo *key_info = NULL;
	FuncInfo *findfunc = NULL;
	FuncInfo *curr = NULL;
	WidgetInfo* widget_info = NULL;

	if((ID_CNZFOLDING == id) || (ID_CNCFOLDING == id) || (ID_CNHALFFOLDING == id) || (ID_CNACCORDIONZFOLDING == id) || (ID_CNDOUBLEPARALLELFOLDING == id)){
		id = ID_CNFOLDSETTING;
	}
	if((ID_CNCFOLDSETTING == id) || (ID_CNHALFFOLDSETTING == id) || (ID_CNACCORDIONZFOLDSETTING == id) || (ID_CNDOUBLEPARALLELFOLDSETTING == id)){
		id = ID_CNFOLDDETAIL;
	}
	if((ID_CNVFOLDING == id) || (ID_CNVFOLDINGTRIMMING == id) || (ID_CNSADDLESTITCH == id) || (ID_CNTRIMMING == id)){
		id = ID_CNSADDLESETTING;
	}
	if((ID_DUPLEX == id) || (ID_BOOKLET == id)){
		id = ID_CNPRINTSTYLE;
	}
	if(ID_BOOKLET_DLG == id){
		return;
	}
	key = GetModStringID(id);

	if(key == NULL){
		return;
	}
	while(func != NULL){
		key_info = func->func_id;
		while(key_info != NULL){
			if(key_info->name != NULL){
				if(strcmp(key, key_info->name) == 0){
					if(findfunc == NULL){
						findfunc = (FuncInfo *)malloc(sizeof(FuncInfo));
						if(findfunc == NULL){
							return;
						}
						memset(findfunc, 0, sizeof(FuncInfo));
						memcpy(findfunc, func, sizeof(FuncInfo));
						curr = findfunc;
						curr->next = NULL;
					}else{
						if(curr != NULL){
							while(curr->next != NULL){
								curr = curr->next;
							}
						}
						if(curr != NULL){
							curr->next = (FuncInfo *)malloc(sizeof(FuncInfo));
						}
						if(curr->next == NULL){
							return;
						}
						memset(curr->next, 0, sizeof(FuncInfo));
						memcpy(curr->next, func, sizeof(FuncInfo));
						curr->next->next = NULL;
					}
				}
			}
			key_info = key_info->next;
		}
		func = func->next;
	}
	if(findfunc == NULL){
		return;
	}
	if(findfunc->next == NULL){
		widget_info = findfunc->widget_list;
		while(widget_info != NULL){
			if(widget_info->type != NULL){
				if(strcmp(widget_info->type, "combo") == 0){
					UpdateCpcaComboWidget(id, widget_info->name);
				}else if(strcmp(widget_info->type, "checkbutton") == 0){
					SetCpcaWidgetSensitive(id, widget_info->name);
				}else if(strcmp(widget_info->type, "radiobutton") == 0){
					int disable = GetCurrDisable(id, NULL);
					if(disable != -1){
						disable = (disable > 0) ? 0 : 1;
						SetWidgetSensitive(widget_info->name, disable);
					}
				}else if(strcmp(widget_info->type, "spinbutton") == 0){
					SetSpinButtonValue(widget_info);
				}else if(strcmp(widget_info->type, "entry") == 0){
					SetEntryText(widget_info);
				}else if(strcmp(widget_info->type, "textview") == 0){
					SetTextview(widget_info);
				}
			}
			if(widget_info->func != NULL){
				WidgetInformation *lib = g_widget_table;
				while(lib->widget_name != NULL){
					if(strcmp(widget_info->type, lib->widget_name) == 0){
						lib->SpecialFunction(g_cngplp_data, widget_info->name);
						break;
					}
					lib++;
				}
			}
			widget_info = widget_info->next;
		}
		if(findfunc->conflict_list != NULL){
			UpdateFunctionWidget(findfunc->conflict_list);
		}
		MemFree(findfunc);
	}else{
		while(findfunc != NULL){
			widget_info = findfunc->widget_list;
			char *plist;
			char *list = GetOptionList(g_cngplp_data, id);
			int disable = 0;
			plist = strstr(list, findfunc->func_id->value);
			if(plist != NULL){
				char *ptr;
				ptr = strchr(plist, '<');
				if(ptr != NULL){
					ptr++;
					disable = atoi(ptr);
				}
			}
			MemFree(list);
			disable = (disable > 0) ? 0 : 1;
			SetWidgetSensitive(widget_info->name, disable);
			if(findfunc->conflict_list != NULL){
				UpdateFunctionWidget(findfunc->conflict_list);
			}
			curr = findfunc;
			findfunc = findfunc->next;
			MemFree(curr);
		}
	}
	return;
}