Exemplo n.º 1
0
void CheckbuttonSpecialFunction(cngplpData* data, const char *widget_name)
{
	if(0 == strcmp(widget_name, "CreepUse_checkbutton")){
		char *opt = NULL, *opt1 = NULL;

		SetWidgetSensitive("hbox82", FALSE);
		opt = GetCurrOpt(data, ID_CNDISPLACEMENTCORRECTION, NULL);
		if(opt != NULL){
			if(0 == strcasecmp(opt, "Manual")){
				opt1 = GetCurrOpt(data, ID_CNCREEP, NULL);
				if(opt1 != NULL){
					if(0 == strcmp(opt1, "True")){
						SetWidgetSensitive("hbox82", TRUE);
					}
					memFree(opt1);
				}
			}
			memFree(opt);
		}
	}
	if((0 == strcmp(widget_name, "JobAccouting_checkbutton")) || (0 == strcmp(widget_name, "DisableJobAccountingBW_checkbutton"))){
		int user_id;
		gboolean active;
		gboolean active1;
		gboolean enable;

		user_id = GetCurrOptInt(ID_USERID, DEFAULT_USERID);
		enable = (user_id == 0) ? TRUE : FALSE;
		if(GetCurrOptInt(ID_SPECIAL_FUNC, 0) != 0){
			active = GetCurrOptInt(ID_JOBACCOUNT, 0);
			SetActiveCheckButton("JobAccouting_checkbutton", active);
			if(active != FALSE){
				active1 = GetCurrOptInt(ID_DISABLE_JOBACCOUNT_BW, 0);
				SetActiveCheckButton("DisableJobAccountingBW_checkbutton", active1);
			}else{
				UpdateDataInt(ID_DISABLE_JOBACCOUNT_BW, 0);
			}
			SetWidgetSensitive("DisableJobAccountingBW_checkbutton", active);
			SetWidgetSensitive("AllowPasswd_checkbutton", active);
			SetWidgetSensitive("JobAccount_button", active);
			if(FALSE == active){
				SetActiveCheckButton("DisableJobAccountingBW_checkbutton", active);
				SetActiveCheckButton("AllowPasswd_checkbutton", active);
			}
		}
		if(FALSE == enable){
			SetWidgetSensitive("JobAccouting_checkbutton", enable);
			SetWidgetSensitive("DisableJobAccountingBW_checkbutton", enable);
			SetWidgetSensitive("AllowPasswd_checkbutton", enable);
			SetWidgetSensitive("JobAccount_button", enable);
		}
	}
}
Exemplo n.º 2
0
static void InitResetUnitDlgWidgets(UIStatusWnd *wnd)
{
	GtkWidget *window = UI_DIALOG(wnd->resetunit_dlg)->window;

	int loop = 0;
	gboolean enable = FALSE;

	while(chk_tbl[loop].widgetname != NULL){
		if(wnd->resetunit_dlg->flag & chk_tbl[loop].flag){
			enable = FALSE;
		}else{
			enable = TRUE;
		}

		SetActiveCheckButton(window, chk_tbl[loop].widgetname, enable);

		if(loop >= startCasPos && loop <= startCasPos + 4){
			if(loop - startCasPos >= wnd->cas_num){
				SetWidgetSensitive(window, chk_tbl[loop].widgetname, FALSE);
				SetActiveCheckButton(window, chk_tbl[loop].widgetname, FALSE);
			}
		}

		loop++;
	}

	SetLabel(wnd);
}
Exemplo n.º 3
0
void ComboSpecialFunction(cngplpData *data, const char *widget_name)
{
    char *opt = NULL, *opt1 = NULL;
    if(0 == strcmp(widget_name, "SaddleSetting_combo")) {
        SetWidgetSensitive("TrimWidth_hbox", FALSE);
        opt = GetCurrOpt(data, ID_CNADJUSTTRIM, NULL);
        if(opt != NULL) {
            if(0 == strcasecmp(opt, "Manual")) {
                opt1 = GetCurrOpt(data, ID_CNTRIMMING, NULL);
                if(opt1 != NULL) {
                    if(0 == strcmp(opt1, "True")) {
                        SetWidgetSensitive("TrimWidth_hbox", TRUE);
                    }
                    memFree(opt1);
                }
            }
            memFree(opt);
        }

    }
}
Exemplo n.º 4
0
static void UpdateButtonEnable(const UIStatusWnd *const wnd, const int enable)
{
	if(wnd != NULL){
		GtkWidget *window = UI_DIALOG(wnd->toner_replacement_dlg)->window;

		SetWidgetSensitive(window, "TonerReplacementDlg_Cyan_button", enable);
		SetWidgetSensitive(window, "TonerReplacementDlg_Magenta_button", enable);
		SetWidgetSensitive(window, "TonerReplacementDlg_Yellow_button", enable);
		SetWidgetSensitive(window, "TonerReplacementDlg_Black_button", enable);
		SetWidgetSensitive(window, "TonerReplacementDlg_Finish_button", enable);

		if(enable == TRUE){
			if(wnd->toner_replacement_dlg->buttonEnableOld == FALSE){
				SetFocus(window, "TonerReplacementDlg_Cyan_button");
			}
		}else{
			if(wnd->toner_replacement_dlg->buttonEnableOld == TRUE){
				SetFocus(window, "TonerReplacementDlg_text");
			}
		}

		wnd->toner_replacement_dlg->buttonEnableOld = enable;
	}
}
Exemplo n.º 5
0
int SetCpcaWidgetSensitive(const int id, const char *widget_name)
{
	char *list;
	int disable;

	list = cngplpGetData(g_cngplp_data,id);
	if(list == NULL){
		return 0;
	}
	disable = GetCurrDisable(id, list);

	if(disable != -1){
		int active;
		disable = (disable > 0) ? 0 : 1;
		active = GetActive(id, list);
		if(active > -1){
			SetActiveCheckButton(widget_name, active);
		}
		SetWidgetSensitive(widget_name, disable);
	}
	free(list);
	return disable;
}
Exemplo n.º 6
0
static void InitSleepSettingDlgWidgets(UIStatusWnd *wnd, unsigned short use_sleep)
{
	GtkWidget *window = UI_DIALOG(wnd->sleeps_dlg)->window;
	GList *glist = NULL;
	char cur[32];
	int active = 0;
	int i = 0;
	int starttblidx = 0;

	memset(cur, 0, 32);

	if(use_sleep & SLEEPSDLG_NOT_USE_SLEEP){
		int value = use_sleep - SLEEPSDLG_NOT_USE_SLEEP;
		if(value < 0)
			strcpy(cur, "30");
		else
			snprintf(cur, 31, "%d", value);
	}else{
		snprintf(cur, 31, "%d", use_sleep);
		active = 1;
	}

	SetLabel(wnd);

	switch(wnd->nModel){
	case MODEL_LBP9100:
	case MODEL_LBP6000:
	case MODEL_LBP6200:
	case MODEL_LBP7010:
	case MODEL_LBP9200:
	case MODEL_LBP6020:
		starttblidx = 0;
		break;
	default:
		starttblidx = 1;
		break;
	}

	switch(wnd->nModel){
	case MODEL_LBP5300:
	case MODEL_LBP3500:
	case MODEL_LBP5100:
	case MODEL_LBP5050:
	case MODEL_LBP7200:
	case MODEL_LBP9100:
	case MODEL_LBP6000:
	case MODEL_LBP6200:
	case MODEL_LBP7010:
	case MODEL_LBP9200:
	case MODEL_LBP7210:
	case MODEL_LBP6310:
	case MODEL_LBP6340:
	case MODEL_LBP6020:
		for(i = starttblidx; SleepTimeTbl[i] != NULL; i++){
			glist = g_list_append(glist, SleepTimeTbl[i]);
		}
		break;
	default:
		for(i = 0; wnd->pSleepTimeList[i] != NULL; i++){
			glist = g_list_append(glist, wnd->pSleepTimeList[i]);
		}
	}

	SetGListToCombo(window, glist, "SleepSDlg_Time_combo", cur);
	g_list_free(glist);

	SetActiveCheckButton(window, "SleepSDlg_Use_checkbutton", active);
	SetWidgetSensitive(window, "hbox61", active);
}
Exemplo n.º 7
0
void UpdateSleepSettingDlgWidgets(UIStatusWnd *wnd, int use_sleep)
{
	GtkWidget *window = UI_DIALOG(wnd->sleeps_dlg)->window;
	SetWidgetSensitive(window, "hbox61", use_sleep);
}
Exemplo n.º 8
0
static int UpdateTimerFunc(UIStatusWnd *wnd)
{
	int ret = TRUE;
	int needQuit = TRUE;
	int doing = FALSE;
	int warningEnd = FALSE;
	int statusPossibleChange = ALERTSTAT_ERROR;
	int isReplaceMode = FALSE;
	int buttonEnable = FALSE;
	char *mainStatusString = NULL;
	char *subStatusString = NULL;

	if(wnd != NULL){
		GtkWidget *window = UI_DIALOG(wnd->toner_replacement_dlg)->window;

		if(wnd->toner_replacement_dlg->modeChangeRetCode != RET_NORMAL){
			warningEnd = TRUE;
		}else if((wnd->toner_replacement_dlg->isModeChangeThreadActive == FALSE) &&
					(wnd->toner_replacement_dlg->modeChangeRetCode == RET_NORMAL)){
			doing = TRUE;
		}

		if(doing == TRUE){
			statusPossibleChange = GetPossibleChangeValueAtAlertCode(wnd->pAlertCode);
			isReplaceMode = GetIsReplaceModeValueAtAlertCode(wnd->pAlertCode);
			if(statusPossibleChange != ALERTSTAT_ERROR){
				needQuit = FALSE;

				if(wnd->toner_replacement_dlg->isModeChanged == FALSE){
					if((statusPossibleChange == TRUE) && (isReplaceMode == TRUE)){
						wnd->toner_replacement_dlg->isModeChanged = TRUE;
						UpdateButtonEnable(wnd, TRUE);
					}
				}else{
					if(isReplaceMode != TRUE){
						needQuit = TRUE;
					}
				}
			}else{
				needQuit = TRUE;
			}

			if(needQuit == TRUE){
				HideTonerReplacementDlg(wnd);
				ret = FALSE;
			}else{
				mainStatusString = MessageStr[MAIN_MES_WAIT_MOMENT];

				if(!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenC")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerCloseC")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerC"))){
					mainStatusString = MessageStr[MAIN_MES_REPLACEABLE];
					subStatusString = MessageStr[SUB_MES_C];
					buttonEnable = TRUE;

				}else if(!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenM")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerCloseM")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerM"))){
					mainStatusString = MessageStr[MAIN_MES_REPLACEABLE];
					subStatusString = MessageStr[SUB_MES_M];
					buttonEnable = TRUE;

				}else if(!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenY")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerCloseY")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerY"))){
					mainStatusString = MessageStr[MAIN_MES_REPLACEABLE];
					subStatusString = MessageStr[SUB_MES_Y];
					buttonEnable = TRUE;

				}else if(!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenK")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerCloseK")) ||
					!(strcmp(wnd->pAlertCode, "CNReadyTonerK"))){
					mainStatusString = MessageStr[MAIN_MES_REPLACEABLE];
					subStatusString = MessageStr[SUB_MES_K];
					buttonEnable = TRUE;

				}else if(!(strcmp(wnd->pAlertCode, "CNRotateTonerOpen")) ||
					!(strcmp(wnd->pAlertCode, "CNRotateTonerClose"))){
					mainStatusString = MessageStr[MAIN_MES_ROTATING];
					subStatusString = MessageStr[SUB_MES_ROTATING];
					buttonEnable = FALSE;
				}

				SetTextToTextView(window, "TonerReplacementDlg_text", _(mainStatusString));
				SetTextToLabel(window, "TonerReplacementDlg_Replaceable_TonerColor_label", _(subStatusString));


				if(GetIsCoverOpenValueAtAlertCode(wnd->pAlertCode) == FALSE){
					UpdateButtonEnable(wnd, buttonEnable);
					if(wnd->toner_replacement_dlg->isCoverOpend == TRUE){
						UpdateJob(REQ_UPDATE_CONSUMABLESINFO_OF_TONERREPLACEMENT);
						wnd->toner_replacement_dlg->isCoverOpend = FALSE;
					}
				}else{
					wnd->toner_replacement_dlg->isCoverOpend = TRUE;
					if(!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenC")) ||
						!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenM")) ||
						!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenY")) ||
						!(strcmp(wnd->pAlertCode, "CNReadyTonerOpenK")) ||
						!(strcmp(wnd->pAlertCode, "CNRotateTonerOpen"))){
						SetWidgetSensitive(window, "TonerReplacementDlg_Cyan_button", FALSE);
						SetWidgetSensitive(window, "TonerReplacementDlg_Magenta_button", FALSE);
						SetWidgetSensitive(window, "TonerReplacementDlg_Yellow_button", FALSE);
						SetWidgetSensitive(window, "TonerReplacementDlg_Black_button", FALSE);
						SetWidgetSensitive(window, "TonerReplacementDlg_Finish_button", TRUE);
						if(wnd->toner_replacement_dlg->buttonEnableOld == TRUE){
							SetFocus(window, "TonerReplacementDlg_text");
						}
						wnd->toner_replacement_dlg->buttonEnableOld = FALSE;
					}
				}
			}
		}else{
			if(warningEnd == TRUE){
				ShowMsgDlg(wnd, MSG_TYPE_COMMUNICATION_ERR_GET);
				ret = FALSE;
			}
		}
	}else{
		HideTonerReplacementDlg(wnd);
		ret = FALSE;
	}
	return ret;
}
Exemplo n.º 9
0
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;
}
Exemplo n.º 10
0
void GetOptToGList(const int id, const char *widget_name)
{
	GList *glist = NULL;
	char *list, *plist, value[MAXSIZE], *pvalue, *curr = NULL;
	const char *text = NULL;
	char tmp[MAXSIZE];
	char *str;
	const char *cur;

	list = cngplpGetData(g_cngplp_data,id);
	if(list == NULL){
		return;
	}
	plist = list;
	pvalue = value;

	while(1){
		if(*plist == '\0'){
			int disable;
			*pvalue = '\0';
			memset(tmp, 0, MAXSIZE);
			disable = GetValue(id, value, tmp);
			if(disable  == 0){
				text = NameToText(id, tmp);
				if(text != NULL){
					glist = g_list_append(glist, (char*)text);
				}else{
					str = strdup(tmp);
					glist = g_list_append(glist, str);
				}
			}
			break;
		}
		if(*plist == ','){
			int disable;
			*pvalue = '\0';
			memset(tmp, 0, MAXSIZE);
			disable = GetValue(id, value, tmp);
			if(disable  == 0){
				text = NameToText(id, tmp);
				if(text != NULL){
					glist = g_list_append(glist, (char*)text);
				}else{
					str = strdup(tmp);
					glist = g_list_append(glist, str);
				}
			}
			plist++;
			pvalue = value;
		}
		if(*plist == ':'){
			*pvalue = '\0';
			cur = NameToText(id, value);
			if(cur != NULL){
				curr = strdup(cur);
			}else{
				curr = strdup(value);
			}
			plist++;
			pvalue = value;
		}
		*pvalue = *plist;
		pvalue++;
		plist++;
	}
	SetGListToCombo(widget_name, glist,curr);
	if(glist == NULL){
		SetWidgetSensitive(widget_name, FALSE);
	}else{
		g_list_free(glist);
	}
	free(curr);
	free(list);
	return;
}