int CALLBACK input_box::wnd_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
{
	WORD uid;
	int ret = TRUE;
	switch(msg)
	{
	case WM_DESTROY:
		{
			::PostQuitMessage(0);
		}
		break;
	case WM_CREATE:
		{
			pfc::string8 lang_text;
			m_hedit = ::CreateWindowEx(0,_T("Static"),m_prompt.c_str(),WS_CHILD | WS_VISIBLE,5,5,275,70,hwnd,(HMENU)1000,m_hinst,0);
			m_hbtnok = uCreateWindowEx(0, "Button", load_lang(IDS_OK, lang_text), WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 285, 5, 65, 20, hwnd, (HMENU)IDOK, m_hinst, NULL);
			m_hbtncancel = uCreateWindowEx(0,"Button",load_lang(IDS_CANCEL, lang_text),WS_CHILD | WS_VISIBLE,285,30,65,20,hwnd,(HMENU)IDCANCEL,m_hinst,0);
			m_hedit = ::CreateWindowEx(WS_EX_CLIENTEDGE,_T("Edit"),m_defval.c_str(),m_editstyle,5,80,350,20,hwnd,(HMENU)2000,m_hinst,0);
			
			HFONT hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
			::DeleteObject(hfont);
			::SendDlgItemMessage(hwnd,1000,WM_SETFONT,(WPARAM)hfont,0);
			::SendDlgItemMessage(hwnd,2000,WM_SETFONT,(WPARAM)hfont,0);
			::SendDlgItemMessage(hwnd,IDOK,WM_SETFONT,(WPARAM)hfont,0);
			::SendDlgItemMessage(hwnd,IDCANCEL,WM_SETFONT,(WPARAM)hfont,0);
			::DeleteObject(hfont);
		}
		break;
	case WM_KEYDOWN:
		if (wp == VK_RETURN)
			::SendMessage(hwnd,WM_COMMAND,IDOK,0);
		break;
	case WM_SETFOCUS:
		::SetFocus(m_hedit);
		break;
	case WM_COMMAND:
		uid = LOWORD(wp);
		switch(uid)
		{
		case IDOK:
			::GetDlgItemText(hwnd,2000,m_buff,2048);
		case IDCANCEL:
			::DestroyWindow(hwnd);
			::UnregisterClass(_T("wsh_plus_inputbox_class"),m_hinst);
			break;
		};
	default:
		ret = FALSE;
		break;
	}
	return ret;
}
void CDialogPref::OnButtonExportBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl)
{
    pfc::string8_fast filename, lang_filetype, lang_saveas;

    if (uGetOpenFileName(m_hWnd, load_lang(IDS_CONF_IMPORT_FILETYPE, lang_filetype), 0, "cfg", load_lang(IDS_IMPORT_SAVE_AS, lang_saveas), NULL, filename, TRUE))
        g_sci_prop_sets.export_to_file(filename);
}
void CDialogPref::OnButtonImportBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl)
{
    pfc::string8_fast filename, lang_filetype, lang_import;

    if (uGetOpenFileName(m_hWnd, load_lang(IDS_CONF_IMPORT_FILETYPE, lang_filetype), 0, "cfg", load_lang(IDS_IMPORT_IMPORT, lang_import), NULL, filename, FALSE))
        g_sci_prop_sets.import_from_file(filename);

    LoadProps();
}
Exemplo n.º 4
0
CWizardInfo::CWizardInfo()
{
	m_bEVCCompa = false;
	m_nOrientType = 1;
	m_nStringType = 0;
	m_bUseString = true;
	m_bOrientAware = false;
	m_bFullScreen = false;
	m_bCreateViewClass = true;
	m_nMenuType = 0;
	m_bEnableScroll = false;
	m_bEnableZoom = false;

	bEnableActiveX = false;
	bCppFiles = false;
	bHostActiveX = false;
	bStatusBar = false;
	bVS2005 = false;
	bVCExpress = false;
	nAppType = 0;
	nViewType = 0;
	bVS60 = true;
	bVS2002 = false;
	bVS2003 = false;
	bVS2008 = false;
	bVS2005 = false;
	bUseView = true;
	nSDKType	= 2;

	templatePath = GetModulePath(_Module.m_hInst)+_T("\\templates");
	cfgPath = GetModulePath(NULL)+_T("\\setup.ini");
	cfgApp = _T("WTLMobileAppWizard");
//	ar_view.push_back(view_type("Generic Window","WTL_VIEWTYPE_GENERIC"));
//	ar_view.push_back(view_type("Form (Dialog Based)","WTL_VIEWTYPE_FORM","CDialogImpl"));
//	ar_view.push_back(view_type("ListBox","WTL_VIEWTYPE_LISTBOX","CListBox","WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT"));
//	ar_view.push_back(view_type("Edit","WTL_VIEWTYPE_EDIT","CEdit","WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL"));

	ar_view.push_back("Generic Window");
	ar_view.push_back("Form (Dialog Based)");
	ar_view.push_back("Property Sheet");
	ar_view.push_back("ListBox");
	ar_view.push_back("Edit");
	ar_view.push_back("List View");
	ar_view.push_back("Tree View");
	ar_view.push_back("HTML Browse Control");
	ar_view.push_back("InkX Control");
	ar_view.push_back("RichInk control");

	ar_app.push_back("WTL_APPTYPE_SDI");
	ar_app.push_back("WTL_APPTYPE_DLG");

	ar_lang.push_back(_T("1033"));
	nAppLang = 0;
	load_lang();
}
Exemplo n.º 5
0
void lang_init()
{
    int i, j, n = 0;

    load_lang(LANG_ES, "es");
    load_lang(LANG_CA, "ca");
    load_lang(LANG_EN_US, "en_us");
    load_lang(LANG_GA, "ga");
    load_lang(LANG_IT, "it");
    load_lang(LANG_JA_JIS, "ja_jis");
    load_lang(LANG_JA_EUC, "ja_euc");
    load_lang(LANG_JA_SJIS, "ja_sjis");
    load_lang(LANG_PT, "pt");
    load_lang(LANG_TR, "tr");

    for (i = 0; i < NUM_LANGS; i++) {
	if (langtexts[langorder[i]] != NULL) {
	    langnames[langorder[i]] = langtexts[langorder[i]][LANG_NAME];
	    langlist[n++] = langorder[i];
	    for (j = 0; j < NUM_STRINGS; j++) {
		if (!langtexts[langorder[i]][j]) {
		    langtexts[langorder[i]][j] =
				langtexts[langorder[DEF_LANGUAGE]][j];
		}
		if (!langtexts[langorder[i]][j]) {
		    langtexts[langorder[i]][j] =
				langtexts[langorder[LANG_EN_US]][j];
		}
	    }
	}
    }
    while (n < NUM_LANGS)
	langlist[n++] = -1;

    if (!langtexts[DEF_LANGUAGE])
	fatal("Unable to load default language");
    for (i = 0; i < NUM_LANGS; i++) {
	if (!langtexts[i])
	    langtexts[i] = langtexts[DEF_LANGUAGE];
    }
}
BOOL CDialogPref::OnInitDialog(HWND hwndFocus, LPARAM lParam)
{
    // Check "Safe mode"
    uButton_SetCheck(m_hWnd, IDC_CHECK_SAFE_MODE, g_cfg_safe_mode);
    DoDataExchange();

    // Enable Visual Style
    if (helpers::is_vista())
        SetWindowTheme(m_props.m_hWnd, L"explorer", NULL);

    // Show Grid lines (XP only)
    m_props.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | (helpers::is_vista() ? LVS_EX_DOUBLEBUFFER : LVS_EX_GRIDLINES));
    pfc::string8 lang_col;
    m_props.AddColumn(pfc::stringcvt::string_wide_from_utf8(load_lang(IDS_UI_PROPERTY_NAME, lang_col)), 0);
    m_props.SetColumnWidth(0, 140);
    m_props.AddColumn(pfc::stringcvt::string_wide_from_utf8(load_lang(IDS_UI_PROPERTY_VALUE, lang_col)), 1);
    m_props.SetColumnWidth(1, 260);
    LoadProps();

    return TRUE; // set focus to default control
}
STDMETHODIMP FbPlaylistMangerTemplate::CreatePlaylist(UINT playlistIndex, BSTR name, UINT * outPlaylistIndex)
{
    TRACK_FUNCTION();

    if (!name) return E_INVALIDARG;
    if (!outPlaylistIndex) return E_POINTER;

	static_api_ptr_t<playlist_manager> api;

    if (*name)
    {
        pfc::stringcvt::string_utf8_from_wide uname(name);

        *outPlaylistIndex = api->create_playlist(uname, uname.length(), playlistIndex);
    }
    else
    {
		pfc::string8 new_playlist_text;
		load_lang(IDS_NEW_PLAYLIST_NAME, new_playlist_text);
		if (api->find_playlist(new_playlist_text,pfc_infinite) == pfc_infinite) {
			*outPlaylistIndex = api->create_playlist(new_playlist_text,pfc_infinite, playlistIndex);
		}
		else{
			for(t_size walk = 2; ; walk++) {
				pfc::string_fixed_t<64> namebuffer;
				namebuffer << new_playlist_text << " (" << walk << ")";
				if (api->find_playlist(namebuffer,pfc_infinite) == pfc_infinite) {
					*outPlaylistIndex = api->create_playlist(namebuffer,pfc_infinite,playlistIndex);
					break;
				}
			}
		}
    }

    return S_OK;
}
Exemplo n.º 8
0
int
#ifdef _METAPACK
webifpage_main
#else
main
#endif
(int argc, char **argv)
{
	FILE *f;
	int i, done;
	char line[LINE_BUF], *tmp, *arg;
	char szLangBuffer[LANG_TYPE_MAX];
	char *lang = NULL;
	char *proc = "/usr/bin/haserl";
	const char *langfmt = "/usr/lib/webif/lang/%s/%s.txt";

	memset(ltable, 0, HASH_MAX * sizeof(lstr *));
	if ((f = fopen("/etc/config/webif", "r")) != NULL) {

		while (!feof(f) && (lang == NULL)) {
			fgets(line, LINE_BUF - 1, f);
			lang=extract_lang(line, szLangBuffer, LANG_TYPE_MAX);
		}
		fclose(f);

		if (lang != NULL) {
			sprintf(buf, langfmt, lang, "common");
			load_lang(buf);
		}
	}

	/*
	 * command line options for this parser are stored in argv[1] only.
	 * filename to be processed is in argv[2]
	 */
	done = 0;
	i = 1;
	while (!done) {
		if (argv[1] == NULL) {
			done = 1;
		} else if (strncmp(argv[1], "-e", 2) == 0) {
			argv[1] = strchr(argv[1], ' ');
			argv[1]++;
			if (argv[1] != NULL) {
				arg = argv[1];
				if ((tmp = strchr(argv[1], ' ')) != NULL) {
					*tmp = 0;
					argv[1] = &tmp[1];
				} else {
					argv[1] = NULL;
					i++;
				}
				system(arg);
			}
		} else if (strncmp(argv[1], "-p", 2) == 0) {
			argv[1] = strchr(argv[1], ' ');
			argv[1]++;
			if (argv[1] != NULL) {
				arg = argv[1];
				if ((tmp = strchr(argv[1], ' ')) != NULL) {
					*tmp = 0;
					argv[1] = &tmp[1];
				} else {
					argv[1] = NULL;
					i++;
				}
				proc = strdup(arg);
			}
		} else {
			done = 1;
		}
	}

	strcpy(line, proc);
	while (argv[i]) {
		sprintf(line + strlen(line), " %s", argv[i++]);
	}

	/*
	 * Load standalone translation file
	 */
	if (lang != NULL) {
		if ((arg = strdup(line)) != NULL) {
			if ((tmp = strrchr(arg, '.')) != NULL)
				*tmp = 0;

			if ((tmp = strrchr(arg, '/')) != NULL)
				tmp++;
			else {
				if ((tmp = strrchr(arg, ' ')) != NULL)
					tmp++;
				else
					tmp = arg;
			}

			sprintf(buf2, langfmt, lang, tmp);
			load_lang(buf2);
			free(arg);
		}
	}

	f = popen(line, "r");

	while (!feof(f) && (fgets(buf, LINE_BUF - 1, f)) != NULL) {
		fprintf(stdout, "%s", translate_line(buf));
		fflush(stdout);
	}

	return 0;
}
Exemplo n.º 9
0
int load_config(const char *path, hash_map < string, module_info * >*modules, list < module_info * >*clients) {
    char module[1024] = { 0, };
    char line[1024] = { 0, };
    char indicator = '=';
    module_info *cur_mod = NULL;

    FILE *file = fopen(path, "r");

    if(file == NULL) {
        ALOGE("%s open failed\n", path);
        return CONFIG_NOT_FOUND_ERR;
    }

    modules->clear();
    clients->clear();

    ALOGD("Loading config: %s\n", path);

    while(fgets(line, sizeof(line), file) != NULL) {
        char name[1024] = { 0, }, value[1024] = {
        0,};

        if(line[0] == '#')
            continue;

        if(line[0] == '[') {
            parse_module(line, module, sizeof(module));
            cur_mod = new module_info(module);
            // add module into global list
            (*modules)[(string) module] = cur_mod;
            clients->push_back(cur_mod);
            ALOGD("[%s]\n", module);
            continue;
        }

        if(module[0] != '\0') {
            parse_value(line, indicator, name, sizeof(name), value, sizeof(value));
            char *pname = trim(name);
            char *pvalue = trim(value);

            if(*pname != '\0' && *pvalue != '\0') {

                /*Initial language */
                if(!strcmp(pname, KEY_STR_LANGUAGE)) {
                    load_lang(pvalue);
                }

                /*initial font size */
                if(!strcmp(pname, KEY_FONTSIZE)) {
                    set_font_size(pvalue);
                }

                cur_mod->config_list[(string) pname] = (string) pvalue;
                ALOGI("[%s] %s:%s \n", module, pname, pvalue);
            }
        }
    }

    fclose(file);
    return CONFIG_SUCCESS;
}