Beispiel #1
0
static
void
initMainWindow(HWND hwnd)
{
	// append version number to title
	CString titleFormat = getString(IDS_TITLE);
	setWindowText(hwnd, CStringUtil::format(titleFormat.c_str(), kApplication, kVersion));

	// load configuration
	bool configLoaded =
		loadConfig(ARG->m_config, s_configTime, s_userConfig);
	if (configLoaded) {
		s_lastConfig = ARG->m_config;
	}

	// get settings from registry
	bool isServer = configLoaded;
	int debugLevel = s_defaultDebug;
	CString server;
	HKEY key = CArchMiscWindows::openKey(HKEY_CURRENT_USER, getSettingsPath());
	if (key != NULL) {
		if (isServer && CArchMiscWindows::hasValue(key, "isServer")) {
			isServer = (CArchMiscWindows::readValueInt(key, "isServer") != 0);
		}
		if (CArchMiscWindows::hasValue(key, "debug")) {
			debugLevel = static_cast<int>(
								CArchMiscWindows::readValueInt(key, "debug"));
			if (debugLevel < 0) {
				debugLevel = 0;
			}
			else if (debugLevel > kDEBUG2) {
				debugLevel = kDEBUG2;
			}
		}
		server = CArchMiscWindows::readValueString(key, "server");
		CArchMiscWindows::closeKey(key);
	}

	// choose client/server radio buttons
	HWND child;
	child = getItem(hwnd, IDC_MAIN_CLIENT_RADIO);
	setItemChecked(child, !isServer);
	child = getItem(hwnd, IDC_MAIN_SERVER_RADIO);
	setItemChecked(child, isServer);

	// set server name
	child = getItem(hwnd, IDC_MAIN_CLIENT_SERVER_NAME_EDIT);
	setWindowText(child, server);

	// debug level
	child = getItem(hwnd, IDC_MAIN_DEBUG);
	for (unsigned int i = 0; i < sizeof(s_debugName) /
								sizeof(s_debugName[0]); ++i) {
		SendMessage(child, CB_ADDSTRING, 0, (LPARAM)s_debugName[i][0]);
	}
	SendMessage(child, CB_SETCURSEL, debugLevel, 0);

	// update controls
	enableMainWindowControls(hwnd);
}
Beispiel #2
0
void
CInfo::init(HWND hwnd)
{
	// collect info
	CString version    =
		CStringUtil::format(getString(IDS_TITLE).c_str(), kApplication, kVersion);
	CString hostname   = ARCH->getHostName();
	CString address    = ARCH->addrToString(ARCH->nameToAddr(hostname));
	CString userConfig = ARCH->getUserDirectory();
	if (!userConfig.empty()) {
		userConfig = ARCH->concatPath(userConfig, CONFIG_NAME);
	}
	CString sysConfig  = ARCH->getSystemDirectory();
	if (!sysConfig.empty()) {
		sysConfig = ARCH->concatPath(sysConfig, CONFIG_NAME);
	}

	// set info
	HWND child;
	child = getItem(hwnd, IDC_INFO_VERSION);
	setWindowText(child, version);
	child = getItem(hwnd, IDC_INFO_HOSTNAME);
	setWindowText(child, hostname);
	child = getItem(hwnd, IDC_INFO_IP_ADDRESS);
	setWindowText(child, address);
	child = getItem(hwnd, IDC_INFO_USER_CONFIG);
	setWindowText(child, userConfig);
	child = getItem(hwnd, IDC_INFO_SYS_CONFIG);
	setWindowText(child, sysConfig);

	// focus on okay button
	SetFocus(getItem(hwnd, IDOK));
}
Beispiel #3
0
static void updateDialog(struct colorDialog *c, HWND whichChanged)
{
	double r, g, b;
	uint8_t rb, gb, bb, ab;
	WCHAR *str;
	WCHAR hexbuf[16];		// more than enough

	c->updating = TRUE;

	updateDouble(c->editH, c->h, whichChanged);
	updateDouble(c->editS, c->s, whichChanged);
	updateDouble(c->editV, c->v, whichChanged);

	hsv2RGB(c->h, c->s, c->v, &r, &g, &b);

	updateDouble(c->editRDouble, r, whichChanged);
	updateDouble(c->editGDouble, g, whichChanged);
	updateDouble(c->editBDouble, b, whichChanged);
	updateDouble(c->editADouble, c->a, whichChanged);

	rb = (uint8_t) (r * 255);
	gb = (uint8_t) (g * 255);
	bb = (uint8_t) (b * 255);
	ab = (uint8_t) (c->a * 255);

	if (whichChanged != c->editRInt) {
		str = itoutf16(rb);
		setWindowText(c->editRInt, str);
		uiFree(str);
	}
	if (whichChanged != c->editGInt) {
		str = itoutf16(gb);
		setWindowText(c->editGInt, str);
		uiFree(str);
	}
	if (whichChanged != c->editBInt) {
		str = itoutf16(bb);
		setWindowText(c->editBInt, str);
		uiFree(str);
	}
	if (whichChanged != c->editAInt) {
		str = itoutf16(ab);
		setWindowText(c->editAInt, str);
		uiFree(str);
	}

	if (whichChanged != c->editHex) {
		rgba2Hex(rb, gb, bb, ab, hexbuf);
		setWindowText(c->editHex, hexbuf);
	}

	// TODO TRUE?
	invalidateRect(c->svChooser, NULL, TRUE);
	invalidateRect(c->hSlider, NULL, TRUE);
	invalidateRect(c->preview, NULL, TRUE);
	invalidateRect(c->opacitySlider, NULL, TRUE);

	c->updating = FALSE;
}
void CMakeAviDlg::updateWindowState() {
  if(!UpdateData()) {
    return;
  }
  const UINT totalFrameCount = (UINT)m_nameArray.size();
  UINT usedFrameCount = 0;
  if(totalFrameCount == 0) {
    setWindowText(this, IDC_STATICTOTALLENGTH, EMPTYSTRING);
  } else {
    usedFrameCount = totalFrameCount / m_useEvery;
    setWindowText(this, IDC_STATICTOTALLENGTH, format(_T("Total length:%.1lf sec"), (double)usedFrameCount / m_framePerSecond));
  }
  setWindowText(this, IDC_STATICIMAGECOUNT    , format(_T("%d"), m_nameArray.size()));
  setWindowText(this, IDC_STATICUSEDIMAGECOUNT, format(_T("%d"), usedFrameCount    ));
  GetDlgItem(IDC_BUTTONMAKEAVI)->EnableWindow(usedFrameCount>0);
}
Beispiel #5
0
void TpresetAutoloadDlgBase::init(void)
{
    translate();
    const char_t *capt = tr->translate(m_hwnd, dialogId, 0, NULL);
    if (capt && capt[0]) {
        setWindowText(m_hwnd, capt);
    }
    char_t presetname[MAX_PATH];
    deciD->getActivePresetName(presetname, countof(presetname));
    setText(IDC_LBL_AUTOLOAD, _(IDC_LBL_AUTOLOAD, _l("Preset '%s' will be autoloaded ...")), presetname);

    itemsw = new TitemsWindow(deci, m_hwnd, items);
    CRect ir = getChildRect(IDC_PLC_AUTOLOAD_ITEMS);
    SetWindowPos(itemsw->m_hwnd, GetDlgItem(m_hwnd, IDC_PLC_AUTOLOAD_ITEMS), ir.left, ir.top, ir.Width(), ir.Height(), 0);
    unsigned int cnt = deciD->getPresetAutoloadItemsCount2();
    items.resize(cnt);
    for (unsigned int i = 0; i < cnt; i++) {
        deciD->getPresetAutoloadItemInfo(i, &items[i].name, &items[i].hint, &items[i].allowWildcard, &items[i].is, &items[i].isVal, items[i].val, sizeof(items[i].val), &items[i].isList, &items[i].isHelp);
    }
    itemsw->showItems();
    setCheck(IDC_RBT_PRESETAUTOLOAD_OR  , deci->getParam2(IDFF_presetAutoloadLogic) == 0);
    setCheck(IDC_RBT_PRESETAUTOLOAD_AND , deci->getParam2(IDFF_presetAutoloadLogic) != 0);

    static const int idScreenSize[] = {IDC_CHB_PRESETAUTOLOAD_SCREEN_SIZE, IDC_ED_PRESETAUTOLOAD_SIZE_SCREEN_XMIN, IDC_ED_PRESETAUTOLOAD_SIZE_SCREEN_XMAX, IDC_BT_PRESETAUTOLOAD_SIZE_SCREEN_COMP, IDC_ED_PRESETAUTOLOAD_SIZE_SCREEN_YMIN, IDC_ED_PRESETAUTOLOAD_SIZE_SCREEN_YMAX, IDC_LBL_PRESETAUTOLOAD_SCREEN_WIDTH, IDC_LBL_PRESETAUTOLOAD_SCREEN_HEIGHT, 0};
    enable(1, idScreenSize);
    setCheck(IDC_CHB_PRESETAUTOLOAD_SCREEN_SIZE    , deci->getParam2(IDFF_presetAutoloadScreenSize));
    SetDlgItemInt(m_hwnd, IDC_ED_PRESETAUTOLOAD_SIZE_SCREEN_XMIN, deci->getParam2(IDFF_presetAutoloadScreenSizeXmin), FALSE);
    SetDlgItemInt(m_hwnd, IDC_ED_PRESETAUTOLOAD_SIZE_SCREEN_XMAX, deci->getParam2(IDFF_presetAutoloadScreenSizeXmax), FALSE);
    cond2dlg();
    SetDlgItemInt(m_hwnd, IDC_ED_PRESETAUTOLOAD_SIZE_SCREEN_YMIN, deci->getParam2(IDFF_presetAutoloadScreenSizeYmin), FALSE);
    SetDlgItemInt(m_hwnd, IDC_ED_PRESETAUTOLOAD_SIZE_SCREEN_YMAX, deci->getParam2(IDFF_presetAutoloadScreenSizeYmax), FALSE);
}
BOOL CExpressionTreeDlg::OnInitDialog() {
  __super::OnInitDialog();

  m_treeCtrl.substituteControl(this, IDC_TREE_EXPRESSION);

  m_layoutManager.OnInitDialog(this);
  m_layoutManager.addControl(IDC_TREE_EXPRESSION  , RELATIVE_SIZE );
  m_layoutManager.addControl(IDCLOSE              , RELATIVE_X_POS);
  m_layoutManager.addControl(IDC_CHECKEXTENDEDINFO, RELATIVE_X_POS);
  m_layoutManager.addControl(IDC_LIST_SYMBOLTABLE , RELATIVE_Y_POS | RELATIVE_WIDTH);

  m_treeCtrl.showTree(m_node, m_extendedInfo);

  const String treeFormName = m_expr.getTreeFormName();
  const String stateName    = m_expr.getStateName();
  const int    nodeCount    = m_expr.getNodeCount();

  String title = getWindowText(this);
  title += format(_T(" - %s form - state %s. %d nodes")
                 ,treeFormName.cstr()
                 ,stateName.cstr()
                 ,nodeCount
                 );
  setWindowText(this, title);

  CListBox *lb = (CListBox*)GetDlgItem(IDC_LIST_SYMBOLTABLE);
  const ExpressionVariableArray variables = m_expr.getSymbolTable().getAllVariables();
  for(size_t i = 0; i < variables.size(); i++) {
    const ExpressionVariableWithValue &v = variables[i];
    lb->InsertString(-1, v.toString().cstr());
  }
  return TRUE;
}
BOOL Editor::OCommand(ULONG msg, MPARAM mp1, MPARAM mp2)
{
 switch(msg)
  {
   case WM_SIZE:
     WinSetWindowPos(textfield->hwnd, HWND_TOP, 0, 0, 
                     SHORT1FROMMP(mp2),  SHORT2FROMMP(mp2), 
                     SWP_MOVE | SWP_SIZE);
     textfield->setFocus();
     break; 


   case WM_COMMAND:
     switch(SHORT1FROMMP(mp1))
      {
       case EDITOR_QUIT:
        WinSendMsg(hwnd, WM_CLOSE, NULL, NULL);
        break;

       case EDITOR_LOAD:
        textfield->loadFile();
        setWindowText(textfield->openedFile);
        break;

       case EDITOR_SAVE:
        textfield->saveFileThr.run();
        break;

       case EDITOR_SAVEAS:
        textfield->saveFileAs(); 
        setWindowText(textfield->openedFile);
        break; 
      }
     break;

   case WM_CLOSE:
     forceQuit();
     break; 

   default:
     return(OFrame::OCommand(msg, mp1, mp2));
  }
 return(TRUE);
#ifdef __BCPLUSPLUS__
  #pragma warn -par
#endif
}
void CFunction2DSurfaceDlg::enableTimeFields() {
  const BOOL enable = IsDlgButtonChecked(IDC_CHECK_INCLUDETIME);
  GetDlgItem(IDC_STATIC_TIMEINTERVAL)->EnableWindow(enable);
  GetDlgItem(IDC_EDIT_TIMEFROM      )->EnableWindow(enable);
  GetDlgItem(IDC_EDIT_TIMETO        )->EnableWindow(enable);
  GetDlgItem(IDC_EDIT_FRAMECOUNT    )->EnableWindow(enable);
  setWindowText(this, IDC_STATIC_FUNCTION, enable ? _T("&z = F(t,x,y) =") : _T("&z = F(x,y) ="));
}
Beispiel #9
0
void
CScreensLinks::updateLinkIntervalControls(HWND hwnd, const CEdgeLink& link)
{
	HWND child;

	// src interval
	child = getItem(hwnd, IDC_SCREENS_SRC_START);
	setWindowText(child, formatIntervalValue(link.m_srcInterval.first));
	child = getItem(hwnd, IDC_SCREENS_SRC_END);
	setWindowText(child, formatIntervalValue(link.m_srcInterval.second));

	// dst interval
	child = getItem(hwnd, IDC_SCREENS_DST_START);
	setWindowText(child, formatIntervalValue(link.m_dstInterval.first));
	child = getItem(hwnd, IDC_SCREENS_DST_END);
	setWindowText(child, formatIntervalValue(link.m_dstInterval.second));
}
Beispiel #10
0
void setWindowText(CWnd *wnd, int id, const String &str) {
  CWnd *ctrl = wnd->GetDlgItem(id);
  if(ctrl == NULL) {
    showWarning(_T("No dlgItem %d in window"), id);
    return;
  }
  setWindowText(ctrl, str);
}
Beispiel #11
0
void uiWindowsSetWindowText(HWND hwnd, const char *text)
{
	WCHAR *wtext;

	wtext = toUTF16(text);
	setWindowText(hwnd, wtext);
	uiFree(wtext);
}
Beispiel #12
0
void ViewerWindow::showWindow()
{
	show();

	StringStorage windowName = formatWindowName();
	setWindowText(&windowName);
	m_dsktWnd.setWindowText(&windowName);

}
Beispiel #13
0
static void updateDouble(HWND hwnd, double d, HWND whichChanged)
{
	WCHAR *str;

	if (whichChanged == hwnd)
		return;
	str = ftoutf16(d);
	setWindowText(hwnd, str);
	uiFree(str);
}
Beispiel #14
0
static void setWindowText(HWND dialog, UINT field, CFDictionaryRef dictionary, CFStringRef key, UINT& total)
{
    CFNumberRef countNum = static_cast<CFNumberRef>(CFDictionaryGetValue(dictionary, key));
    if (!countNum)
        return;

    int count = 0;
    CFNumberGetValue(countNum, kCFNumberIntType, &count);

    setWindowText(dialog, field, static_cast<UINT>(count));
    total += count;
}
void TconfPageBase::translate(void)
{
    HWND hed=GetDlgItem(m_hwnd,IDC_ED_HELP);
    if (hed) {
        setWindowText(hed,_l(""));
    }
    Twindow::translate();

    if (hed && GetWindowTextLength(hed)==0) {
        loadHelpStr(dialogId);
        SendMessage(hed,EM_SETMODIFY,0,0);
    }
}
void TconfPageBase::createWindow(void)
{
    m_hwnd=createDialog(dialogId,hwndParent);
    assert(m_hwnd);
    ShowWindow(m_hwnd,SW_HIDE);
    setWindowText(m_hwnd,dialogName());
    translate();
    if (tr->translateMode && dialogId!=IDD_ABOUT) {
        HWND hed=GetDlgItem(m_hwnd,IDC_ED_HELP);
        if (hed) {
            SendMessage(hed,EM_SETREADONLY,FALSE,0);
            SetWindowLong(hed,GWL_STYLE,GetWindowLong(hed,GWL_STYLE)|ES_WANTRETURN);
        }
    }
}
void CDisplayDetailsDlg::updateState ()
{
	UpdateQuality (LandscapeQualityInt, LandscapeQualityValue);
	UpdateQuality (FXQualityInt, FXQualityValue);
	UpdateQuality (CharacterQualityInt, CharacterQualityValue);

	// If control has bad range, reset
	int		rMin, rMax;
	TextureQuality.GetRange(rMin, rMax);
	if(rMin!=0 || rMax!=MaxTextureQuality)
		TextureQuality.SetRange(0, MaxTextureQuality);
	
	// update texture quality text
	static const char *textureString[QUALITY_TEXTURE_STEP] = { "uiConfigTexturePoor", "uiConfigTextureNormal", "uiConfigTextureSuper"};
	setWindowText(TextureQualityValue, (WCHAR*)NLMISC::CI18N::get (textureString[TextureQualityInt]).c_str());
}
BOOL CDirectionDlg::OnInitDialog() {
  __super::OnInitDialog();
  int selectedButton = IDCANCEL;

  switch(m_dir) {
  case S : selectedButton = IDC_BUTTONS ; break;
  case E : selectedButton = IDC_BUTTONE ; break;
  case N : selectedButton = IDC_BUTTONN ; break;
  case W : selectedButton = IDC_BUTTONW ; break;
  }

  GetDlgItem(selectedButton)->SetFocus();
  setWindowText(this, IDC_STATICMSG, format(_T("Is start direction %s Ok?"), directionName[m_dir]));
  setWindowPosition(this, CPoint(700,100));
  return FALSE;
}
Beispiel #19
0
static void setWindowText(HWND dialog, UINT field, IPropertyBagPtr statistics, const _bstr_t& key)
{
    VARIANT var;
    ::VariantInit(&var);
    V_VT(&var) = VT_UI8;
    if (FAILED(statistics->Read(key, &var, 0))) {
        ::VariantClear(&var);
        return;
    }

    unsigned long long value = V_UI8(&var);
    String valueStr = WTF::String::number(value);

    setWindowText(dialog, field, _bstr_t(valueStr.utf8().data()));
    ::VariantClear(&var);
}
void setControlText(int id, CWnd *wnd) {
  const String title = getWindowText(wnd);
  if(title.length() > 0 && title[0] == '{') {
    String newTitle = loadString(id);
    wnd->SetWindowText(newTitle.cstr());
  }

  for(CWnd *child = wnd->GetWindow(GW_CHILD); child; child = child->GetNextWindow()) {
//    id = child->GetDlgCtrlID();
    const String text = getWindowText(child);
    if(text.length() > 0 && text[0] == '{') {
      const String label = loadString(child->GetDlgCtrlID());
      if(label.length() > 0) {
        setWindowText(child, label);
      }
    }
  }
}
Beispiel #21
0
void CSoundDlg::updateState ()
{
	FModCtrl.EnableWindow (SoundOn);
	ForceSoundSoftCtrl.EnableWindow (SoundOn);
	EAXCtrl.EnableWindow (SoundOn);
	SoundQuality.EnableWindow (SoundOn);
	TextSB.EnableWindow (SoundOn);
	TextEAX.EnableWindow (SoundOn);
	TextFMod.EnableWindow (SoundOn);
	TextForceSoundSoft.EnableWindow (SoundOn);
	SoundQualityValue.EnableWindow (SoundOn);

	// Yoyo: temporary avoid FMod ctrl, since always FMod....
	TextFMod.ShowWindow(SW_HIDE);
	FModCtrl.ShowWindow(SW_HIDE);

	ucstring str = NLMISC::toString (getAsNumSoundBuffer()) + " " + NLMISC::CI18N::get ("uiConfigTracks");
	setWindowText(SoundQualityValue, (WCHAR*)str.c_str());
}
Beispiel #22
0
INT_PTR TdlgInputString::msgProc(UINT uMsg,WPARAM wParam,LPARAM lParam)
{
    switch (uMsg) {
        case WM_INITDIALOG:
            setWindowText(m_hwnd,capt);
            setDlgItemText(m_hwnd,IDC_LBL_INPUTSTRING,query);
            setDlgItemText(m_hwnd,IDC_ED_INPUTSTRING,str);
            edLimitText(IDC_ED_INPUTSTRING,len-1);
            break;
        case WM_COMMAND:
            switch (LOWORD(wParam)) {
                case IDOK:
                    GetDlgItemText(m_hwnd,IDC_ED_INPUTSTRING,str,int(len));
                case IDCANCEL:
                    EndDialog(m_hwnd,LOWORD(wParam));
                    return TRUE;
            }
    };
    return TdlgWindow::msgProc(uMsg,wParam,lParam);
}
Beispiel #23
0
void TcompatibilityList::init(void)
{
    resizeDialog();
    translate();
    const char_t *capt, *exp;
    if (IDFF_target == IDFF_whitelist) {
        capt = tr->translate(m_hwnd, IDD_DIRECTSHOWCONTROL, IDC_CHB_COMPATIBILITYLIST, NULL);
        exp = tr->translate(m_hwnd, dialogId, IDC_TXT_COMPATIBILITYLIST, NULL);
    } else {
        capt = tr->translate(m_hwnd, IDD_DIRECTSHOWCONTROL, IDC_CHB_BLACKLIST, NULL);
        exp = _(-IDD_COMPATIBILITY, _l("List the names of executable files which are incompatible with ffdshow or which you don't want to use ffdshow, one for each line."));
    }
    if (capt && capt[0]) {
        setWindowText(m_hwnd, capt);
    }
    if (exp && exp[0]) {
        setText(IDC_TXT_COMPATIBILITYLIST, exp);
    }
    edLimitText(IDC_ED_COMPATIBILITYLIST, MAX_COMPATIBILITYLIST_LENGTH);
    cfg2dlg(NULL);
}
Beispiel #24
0
INT_PTR CALLBACK dialogProcHistory(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
	switch (message)
	{
	default:
	{}	break;

	case WM_CLOSE:
	{
		DestroyWindow(hwnd);
	}	return true;

	case WM_INITDIALOG:
	{
		SendMessageW(hwnd, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(
			LoadIconW(GetModuleHandle(nullptr), MAKEINTRESOURCEW(ICON_DEFAULT))));

		centerWindowOnScreen(hwnd);

		auto params = reinterpret_cast<HistoryDialogCreateParams*>(lparam);
		auto data = params->database->findEntry(params->uniqueId);

		if (data)
		{
			auto guard = params->database->transformGuard(*data);
			setWindowText(GetDlgItem(hwnd, DIALOG_HISTORY_EDIT_HISTORY), makeHistoryString(*data));
		}
		else
		{
			showMessageBox("Error", "Unable to find database entry.");
			PostMessageW(hwnd, WM_CLOSE, 0, 0);
		}
	}	return true;
	}

	return false;
}
Beispiel #25
0
static void updateStatistics(HWND dialog)
{
    if (!gWinLauncher)
        return;

    IWebCoreStatisticsPtr webCoreStatistics = gWinLauncher->statistics();
    if (!webCoreStatistics)
        return;

    IPropertyBagPtr statistics;
    HRESULT hr = webCoreStatistics->memoryStatistics(&statistics.GetInterfacePtr());
    if (FAILED(hr))
        return;

    // FastMalloc.
    setWindowText(dialog, IDC_RESERVED_VM, statistics, "FastMallocReservedVMBytes");
    setWindowText(dialog, IDC_COMMITTED_VM, statistics, "FastMallocCommittedVMBytes");
    setWindowText(dialog, IDC_FREE_LIST_BYTES, statistics, "FastMallocFreeListBytes");

    // WebCore Cache.
#if USE(CF)
    IWebCachePtr webCache = gWinLauncher->webCache();

    int dictCount = 6;
    IPropertyBag* cacheDict[6] = { 0 };
    if (FAILED(webCache->statistics(&dictCount, cacheDict)))
        return;

    COMPtr<CFDictionaryPropertyBag> counts, sizes, liveSizes, decodedSizes, purgableSizes;
    counts.adoptRef(reinterpret_cast<CFDictionaryPropertyBag*>(cacheDict[0]));
    sizes.adoptRef(reinterpret_cast<CFDictionaryPropertyBag*>(cacheDict[1]));
    liveSizes.adoptRef(reinterpret_cast<CFDictionaryPropertyBag*>(cacheDict[2]));
    decodedSizes.adoptRef(reinterpret_cast<CFDictionaryPropertyBag*>(cacheDict[3]));
    purgableSizes.adoptRef(reinterpret_cast<CFDictionaryPropertyBag*>(cacheDict[4]));

    static CFStringRef imagesKey = CFSTR("images");
    static CFStringRef stylesheetsKey = CFSTR("style sheets");
    static CFStringRef xslKey = CFSTR("xsl");
    static CFStringRef scriptsKey = CFSTR("scripts");

    if (counts) {
        UINT totalObjects = 0;
        setWindowText(dialog, IDC_IMAGES_OBJECT_COUNT, counts->dictionary(), imagesKey, totalObjects);
        setWindowText(dialog, IDC_CSS_OBJECT_COUNT, counts->dictionary(), stylesheetsKey, totalObjects);
        setWindowText(dialog, IDC_XSL_OBJECT_COUNT, counts->dictionary(), xslKey, totalObjects);
        setWindowText(dialog, IDC_JSC_OBJECT_COUNT, counts->dictionary(), scriptsKey, totalObjects);
        setWindowText(dialog, IDC_TOTAL_OBJECT_COUNT, totalObjects);
    }

    if (sizes) {
        UINT totalBytes = 0;
        setWindowText(dialog, IDC_IMAGES_BYTES, sizes->dictionary(), imagesKey, totalBytes);
        setWindowText(dialog, IDC_CSS_BYTES, sizes->dictionary(), stylesheetsKey, totalBytes);
        setWindowText(dialog, IDC_XSL_BYTES, sizes->dictionary(), xslKey, totalBytes);
        setWindowText(dialog, IDC_JSC_BYTES, sizes->dictionary(), scriptsKey, totalBytes);
        setWindowText(dialog, IDC_TOTAL_BYTES, totalBytes);
    }

    if (liveSizes) {
        UINT totalLiveBytes = 0;
        setWindowText(dialog, IDC_IMAGES_LIVE_COUNT, liveSizes->dictionary(), imagesKey, totalLiveBytes);
        setWindowText(dialog, IDC_CSS_LIVE_COUNT, liveSizes->dictionary(), stylesheetsKey, totalLiveBytes);
        setWindowText(dialog, IDC_XSL_LIVE_COUNT, liveSizes->dictionary(), xslKey, totalLiveBytes);
        setWindowText(dialog, IDC_JSC_LIVE_COUNT, liveSizes->dictionary(), scriptsKey, totalLiveBytes);
        setWindowText(dialog, IDC_TOTAL_LIVE_COUNT, totalLiveBytes);
    }

    if (decodedSizes) {
        UINT totalDecoded = 0;
        setWindowText(dialog, IDC_IMAGES_DECODED_COUNT, decodedSizes->dictionary(), imagesKey, totalDecoded);
        setWindowText(dialog, IDC_CSS_DECODED_COUNT, decodedSizes->dictionary(), stylesheetsKey, totalDecoded);
        setWindowText(dialog, IDC_XSL_DECODED_COUNT, decodedSizes->dictionary(), xslKey, totalDecoded);
        setWindowText(dialog, IDC_JSC_DECODED_COUNT, decodedSizes->dictionary(), scriptsKey, totalDecoded);
        setWindowText(dialog, IDC_TOTAL_DECODED, totalDecoded);
    }

    if (purgableSizes) {
        UINT totalPurgable = 0;
        setWindowText(dialog, IDC_IMAGES_PURGEABLE_COUNT, purgableSizes->dictionary(), imagesKey, totalPurgable);
        setWindowText(dialog, IDC_CSS_PURGEABLE_COUNT, purgableSizes->dictionary(), stylesheetsKey, totalPurgable);
        setWindowText(dialog, IDC_XSL_PURGEABLE_COUNT, purgableSizes->dictionary(), xslKey, totalPurgable);
        setWindowText(dialog, IDC_JSC_PURGEABLE_COUNT, purgableSizes->dictionary(), scriptsKey, totalPurgable);
        setWindowText(dialog, IDC_TOTAL_PURGEABLE, totalPurgable);
    }
#endif

    // JavaScript Heap.
    setWindowText(dialog, IDC_JSC_HEAP_SIZE, statistics, "JavaScriptHeapSize");
    setWindowText(dialog, IDC_JSC_HEAP_FREE, statistics, "JavaScriptFreeSize");

    UINT count;
    if (SUCCEEDED(webCoreStatistics->javaScriptObjectsCount(&count)))
        setWindowText(dialog, IDC_TOTAL_JSC_HEAP_OBJECTS, count);
    if (SUCCEEDED(webCoreStatistics->javaScriptGlobalObjectsCount(&count)))
        setWindowText(dialog, IDC_GLOBAL_JSC_HEAP_OBJECTS, count);
    if (SUCCEEDED(webCoreStatistics->javaScriptProtectedObjectsCount(&count)))
        setWindowText(dialog, IDC_PROTECTED_JSC_HEAP_OBJECTS, count);

    // Font and Glyph Caches.
    if (SUCCEEDED(webCoreStatistics->cachedFontDataCount(&count)))
        setWindowText(dialog, IDC_TOTAL_FONT_OBJECTS, count);
    if (SUCCEEDED(webCoreStatistics->cachedFontDataInactiveCount(&count)))
        setWindowText(dialog, IDC_INACTIVE_FONT_OBJECTS, count);
    if (SUCCEEDED(webCoreStatistics->glyphPageCount(&count)))
        setWindowText(dialog, IDC_GLYPH_PAGES, count);

    // Site Icon Database.
    if (SUCCEEDED(webCoreStatistics->iconPageURLMappingCount(&count)))
        setWindowText(dialog, IDC_PAGE_URL_MAPPINGS, count);
    if (SUCCEEDED(webCoreStatistics->iconRetainedPageURLCount(&count)))
        setWindowText(dialog, IDC_RETAINED_PAGE_URLS, count);
    if (SUCCEEDED(webCoreStatistics->iconRecordCount(&count)))
        setWindowText(dialog, IDC_SITE_ICON_RECORDS, count);
    if (SUCCEEDED(webCoreStatistics->iconsWithDataCount(&count)))
        setWindowText(dialog, IDC_SITE_ICONS_WITH_DATA, count);
}
Beispiel #26
0
static void setWindowText(HWND dialog, UINT field, UINT value)
{
    String valueStr = WTF::String::number(value);

    setWindowText(dialog, field, _bstr_t(valueStr.utf8().data()));
}
Beispiel #27
0
void TpresetAutoloadDlgBase::TitemsWindow::showItems(void)
{
    THWNDs hwnds;
    getChildWindows(m_hwnd, hwnds);
    for (THWNDs::const_iterator h = hwnds.begin(); h != hwnds.end(); h++) {
        DestroyWindow(*h);
    }
    int y = 0;
    HFONT fnt = (HFONT)SendMessage(m_hwnd, WM_GETFONT, 0, 0);
    CRect pr;
    GetWindowRect(m_hwnd, &pr);
    int prdlgdx = 170; //TODO: compute
    int id = 0;
    int sbrWidth = GetSystemMetrics(SM_CXVSCROLL) + 4;
    for (Titems::const_iterator i = items.begin(); i != items.end(); i++, id++) {
        CRect r(CPoint(0, y), CSize(prdlgdx, 10));
        MapDialogRect(m_hwnd, &r);
        HWND hchb = CreateWindow(_l("BUTTON"), _(-IDD_PRESET_AUTOLOAD_ITEMS, i->name), WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | WS_TABSTOP, r.left, r.top, r.Width() - sbrWidth, r.Height(), m_hwnd, HMENU(1000 + 10 * id + 1), hi, 0);
        SendMessage(hchb, WM_SETFONT, WPARAM(fnt), TRUE);
        setCheck(1000 + 10 * id + 1, i->is);
        y += 11;
        if (i->isVal) {
            static const int dxbt1 = 10;
            int dxbt = (i->isList ? dxbt1 : 0) + (i->isHelp ? dxbt1 : 0);
            r = CRect(CPoint(0, y), CSize(prdlgdx - dxbt, 12));
            MapDialogRect(m_hwnd, &r);
            HWND hed = CreateWindowEx(WS_EX_CLIENTEDGE, _l("EDIT"), NULL, WS_CHILD | WS_VISIBLE | ES_LEFT | ES_AUTOHSCROLL | WS_TABSTOP, r.left, r.top, r.Width() - sbrWidth, r.Height(), m_hwnd, HMENU(1000 + 10 * id + 2), hi, 0);
            SendMessage(hed, WM_SETFONT, WPARAM(fnt), TRUE);
            SendMessage(hed, EM_SETLIMITTEXT, 255, 0);
            setWindowText(hed, i->val);
            if (i->hint && i->hint[0]) {
                addHint(1000 + 10 * id + 2, i->hint);
            }
            int btx = prdlgdx - dxbt;
            if (i->isList) {
                r = CRect(CPoint(btx, y), CSize(10, 12));
                MapDialogRect(m_hwnd, &r);
                btx += dxbt1;
                HWND hbt = CreateWindow(_l("BUTTON"), _l("6"), WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | WS_TABSTOP, r.left - sbrWidth, r.top, r.Width(), r.Height(), m_hwnd, HMENU(1000 + 10 * id + 3), hi, 0);
                SendMessage(hbt, WM_SETFONT, WPARAM(arrowsFont), TRUE);
            }
            if (i->isHelp) {
                r = CRect(CPoint(btx, y), CSize(10, 12));
                MapDialogRect(m_hwnd, &r);
                HWND hbt = CreateWindow(_l("BUTTON"), _l("?"), WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | WS_TABSTOP, r.left - sbrWidth, r.top, r.Width(), r.Height(), m_hwnd, HMENU(1000 + 10 * id + 4), hi, 0);
                SendMessage(hbt, WM_SETFONT, WPARAM(fnt), TRUE);
            }
            y += 14;
        }
    }
    SCROLLINFO si;
    si.cbSize = sizeof(si);
    si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
    si.nMin = 0;
    CRect r(0, 0, 0, y);
    MapDialogRect(m_hwnd, &r);
    si.nMax = r.Height();
    si.nPage = pr.Height();
    si.nPos = 0;
    SetScrollInfo(m_hwnd, SB_VERT, &si, TRUE);
}
void UpdateQuality (int quality, HWND hwnd)
{
	static const char *qualityString[QUALITY_STEP] = { "uiConfigPoor", "uiConfigMedium", "uiConfigNormal", "uiConfigSuper"};
	setWindowText(hwnd, (WCHAR*)NLMISC::CI18N::get (qualityString[quality]).c_str());
}
BOOL AP_Win32Dialog_Styles::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	XAP_Win32App * app = static_cast<XAP_Win32App *> (m_pApp);
	UT_return_val_if_fail (app,0);
	
	const XAP_StringSet * pSS = m_pApp->getStringSet();
	
	WCHAR szTemp[20];
	GetWindowTextW(hWnd, szTemp, 20 );	
			
	m_hDlg=hWnd;

	// Regular dialog box
	if( lstrcmpW(szTemp, L"Styles") == 0 )
	{	
		setDialogTitle (pSS->getValue(AP_STRING_ID_DLG_Styles_StylesTitle));

		// localize controls
		_DS(STYLES_TOP_TEXT_LIST, DLG_Styles_List);
		_DS(STYLES_TOP_TEXT_PARAGRAPH_PREVIEW, DLG_Styles_ParaPrev);
		_DS(STYLES_TOP_TEXT_CHARACTER_PREVIEW, DLG_Styles_CharPrev);
		_DS(STYLES_TOP_TEXT_DESCRIPTION, DLG_Styles_Description);
		_DS(STYLES_TOP_BUTTON_DELETE, DLG_Styles_Delete);
		_DS(STYLES_TOP_BUTTON_MODIFY, DLG_Styles_Modify);
		_DS(STYLES_TOP_BUTTON_NEW, DLG_Styles_New);
		_DS(STYLES_TOP_TEXT_AVAILABLE, DLG_Styles_Available);	// "Available Styles" GROUPBOX
		_DSX(STYLES_TOP_BUTTON_APPLY, DLG_Apply);
		_DSX(STYLES_TOP_BUTTON_CLOSE, DLG_Close);


		// Set the list combo.

		_win32Dialog.addItemToCombo(AP_RID_DIALOG_STYLES_TOP_COMBO_LIST, 
									pSS->getValue (AP_STRING_ID_DLG_Styles_LBL_InUse));
		_win32Dialog.addItemToCombo(AP_RID_DIALOG_STYLES_TOP_COMBO_LIST, 
									pSS->getValue(AP_STRING_ID_DLG_Styles_LBL_All));
		_win32Dialog.addItemToCombo(AP_RID_DIALOG_STYLES_TOP_COMBO_LIST,
									pSS->getValue(AP_STRING_ID_DLG_Styles_LBL_UserDefined));
		_win32Dialog.selectComboItem(AP_RID_DIALOG_STYLES_TOP_COMBO_LIST, (int)m_whichType);
	

		// Create a preview windows.

		HWND hwndChild = GetDlgItem(hWnd, AP_RID_DIALOG_STYLES_TOP_TEXT_PARAGRAPH_PREVIEW);

		m_pParaPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp),
														  hwndChild,
														  0);
		UT_uint32 w,h;
		m_pParaPreviewWidget->getWindowSize(&w,&h);
		_createParaPreviewFromGC(m_pParaPreviewWidget->getGraphics(), w, h);
		m_pParaPreviewWidget->setPreview(m_pParaPreview);

		hwndChild = GetDlgItem(hWnd, AP_RID_DIALOG_STYLES_TOP_TEXT_CHARACTER_PREVIEW);

		m_pCharPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp),
														  hwndChild,
														  0);
		m_pCharPreviewWidget->getWindowSize(&w,&h);
		_createCharPreviewFromGC(m_pCharPreviewWidget->getGraphics(), w, h);
		m_pCharPreviewWidget->setPreview(m_pCharPreview);

		_populateWindowData();
	}
	// This is either the new or Modify sub dialog of styles
	else  
	{
		_win32DialogNewModify.setHandle(hWnd);

		// Localize the controls Labels etc...
		setWindowText(hWnd, pSS->getValue( (m_bisNewStyle) ? 
                                           AP_STRING_ID_DLG_Styles_NewTitle :
                                           AP_STRING_ID_DLG_Styles_ModifyTitle ));
		
		#define _DS(c,s)  setDlgItemText(hWnd, AP_RID_DIALOG_##c,pSS->getValue(AP_STRING_ID_##s))
		#define _DSX(c,s) setDlgItemText(hWnd, AP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s))
		_DS(STYLES_NEWMODIFY_LBL_NAME,			DLG_Styles_ModifyName);
		_DS(STYLES_NEWMODIFY_LBL_BASEDON,		DLG_Styles_ModifyBasedOn);
		_DS(STYLES_NEWMODIFY_LBL_TYPE,			DLG_Styles_ModifyType);
		_DS(STYLES_NEWMODIFY_LBL_FOLLOWPARA,	DLG_Styles_ModifyFollowing);
		_DS(STYLES_NEWMODIFY_LBL_REMOVE,		DLG_Styles_RemoveLab);
		_DS(STYLES_NEWMODIFY_GBX_PREVIEW,		DLG_Styles_ModifyPreview);
		_DS(STYLES_NEWMODIFY_GBX_DESC,			DLG_Styles_ModifyDescription);
		_DS(STYLES_NEWMODIFY_BTN_REMOVE,		DLG_Styles_RemoveButton);
		_DS(STYLES_NEWMODIFY_BTN_SHORTCUT,		DLG_Styles_ModifyShortCut);
		_DSX(STYLES_NEWMODIFY_BTN_OK,			DLG_OK);
		_DSX(STYLES_NEWMODIFY_BTN_CANCEL,		DLG_Cancel);
		#undef _DSX
		#undef _DS
		
		
		// Changes basic controls based upon either New or Modify Dialog
		_win32DialogNewModify.showControl( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_TYPE , 
                                           (m_bisNewStyle) ? SW_HIDE : SW_SHOW );
		_win32DialogNewModify.showControl( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE , 
                                           (m_bisNewStyle) ? SW_SHOW : SW_HIDE );
		// Initialize the controls with appropriate data

		size_t nStyles = getDoc()->getStyleCount();
		const char * name = NULL;
		const char * pLocalised = NULL;
		const PD_Style * pcStyle = NULL;
		int nIndex;
		UT_Win32LocaleString str;	
		UT_UTF8String utf8;

		UT_GenericVector<PD_Style*> * pStyles = NULL;
		getDoc()->enumStyles(pStyles);
		UT_return_val_if_fail( pStyles, FALSE );
		
		for (UT_uint32 i = 0; i < nStyles; i++)
		{
    		pcStyle = pStyles->getNthItem(i);
			UT_return_val_if_fail( pcStyle, FALSE );
			name = pcStyle->getName();
			
   			pt_PieceTable::s_getLocalisedStyleName(name, utf8);			
			pLocalised = utf8.utf8_str();
			
			nIndex = _win32DialogNewModify.addItemToCombo(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, pLocalised);				
			_win32DialogNewModify.setComboDataItem(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, 
				nIndex, i);				
			
			nIndex = _win32DialogNewModify.addItemToCombo(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, pLocalised);				
			_win32DialogNewModify.setComboDataItem(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, 
				nIndex, i);				
		}

		delete pStyles;
		
		// Strings (not styles names)
		const char*	pDefCurrent = pSS->getValue(AP_STRING_ID_DLG_Styles_DefCurrent);
		const char*	pDefNone = pSS->getValue(AP_STRING_ID_DLG_Styles_DefNone);
		
		nIndex = _win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, 
                                              pDefCurrent );
		_win32DialogNewModify.setComboDataItem(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA,
			nIndex, (DWORD)-1);

		nIndex = _win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, 
                                              pDefNone);
		_win32DialogNewModify.setComboDataItem(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON,
			nIndex, (DWORD)-1);
		
		if( m_bisNewStyle )
		{	
			
			const char* p = pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyParagraph);
			
			_win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE,
                                                  p );
                                                  
			p = pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyCharacter);
                                                  
			_win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE,
                                                  p);			                         
                                                  
			// Set the Default syltes: none, default current
			UT_sint32 result;
			str.fromUTF8(pSS->getValue(AP_STRING_ID_DLG_Styles_DefNone));
			result = SendDlgItemMessageW(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, CB_FINDSTRING, -1,
										(LPARAM) str.c_str());
			_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, result );
			
			str.fromUTF8(pSS->getValue(AP_STRING_ID_DLG_Styles_DefCurrent));
			result = SendDlgItemMessageW(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, CB_FINDSTRING, -1,
										(LPARAM) str.c_str());
			_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, result );
			
			str.fromUTF8(pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyParagraph));
			result = SendDlgItemMessageW(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE, CB_FINDSTRING, -1,
										(LPARAM) str.c_str());
			_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE, result );

			eventBasedOn();
			eventFollowedBy();
			eventStyleType();
			fillVecFromCurrentPoint();			
		}
		else
		{
			const char * szCurrentStyle = NULL;
			const char * szBasedOn = NULL;
			const char * szFollowedBy = NULL;
			const char * pLocalised = NULL;
			PD_Style * pStyle = NULL;
			PD_Style * pBasedOnStyle = NULL;
			PD_Style * pFollowedByStyle = NULL;
			
			szCurrentStyle = m_selectedStyle.c_str();
			
			pt_PieceTable::s_getLocalisedStyleName(szCurrentStyle, utf8);						
			pLocalised = utf8.utf8_str();
		
			_win32DialogNewModify.setControlText( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_NAME,
                                                  pLocalised);
                                                  
			if(szCurrentStyle)
				getDoc()->getStyle(szCurrentStyle,&pStyle);
				
			if(!pStyle)
			{
				XAP_Frame * pFrame = getFrame();
				pFrame->showMessageBox( pSS->getValue(AP_STRING_ID_DLG_Styles_ErrNoStyle),
										XAP_Dialog_MessageBox::b_O,
										XAP_Dialog_MessageBox::a_OK);                                        
				m_answer = AP_Dialog_Styles::a_CANCEL;
				return false;
			}
			//
			// Valid style get the Based On and followed by values
			//
		    pBasedOnStyle = pStyle->getBasedOn();
			pFollowedByStyle = pStyle->getFollowedBy();
			
			size_t nStyles = getDoc()->getStyleCount();
			const char * name = NULL;
			const PD_Style * pcStyle = NULL;
			UT_GenericVector<PD_Style*> * pStyles = NULL;
			getDoc()->enumStyles(pStyles);
			UT_return_val_if_fail( pStyles, FALSE );
	
			for (UT_uint32 i = 0; i < nStyles; i++)
			{
				pcStyle = pStyles->getNthItem(i);
				UT_return_val_if_fail( pcStyle, FALSE );
				name = pcStyle->getName();

				if(pBasedOnStyle && pcStyle == pBasedOnStyle)
				{
					szBasedOn = name;
				}
				if(pFollowedByStyle && pcStyle == pFollowedByStyle)
				{
					szFollowedBy = name;
				}
			}

			delete pStyles;
			
			if(pBasedOnStyle != NULL)
			{

				pt_PieceTable::s_getLocalisedStyleName(szBasedOn, utf8);
				pLocalised = utf8.utf8_str();
				str = AP_Win32App::s_fromUTF8ToWinLocale(pLocalised);
				
				UT_uint32 result = SendDlgItemMessageW(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, CB_FINDSTRING, -1,
										(LPARAM)str.c_str());
										
				_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, result );
			}
			else
			{
				// Not a style name
				str.fromUTF8(pSS->getValue(AP_STRING_ID_DLG_Styles_DefNone));
				UT_uint32 result = SendDlgItemMessageW(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, CB_FINDSTRING, -1,
										(LPARAM) str.c_str());
										
				_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, result );
			}

			if(pFollowedByStyle != NULL)
			{
				pt_PieceTable::s_getLocalisedStyleName(szFollowedBy, utf8);		
				pLocalised = utf8.utf8_str();
				str = AP_Win32App::s_fromUTF8ToWinLocale(pLocalised);
				
				UT_uint32 result = SendDlgItemMessageW(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, CB_FINDSTRING, -1,
										(LPARAM)str.c_str());
				_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, result );
			}
			else
			{
				pt_PieceTable::s_getLocalisedStyleName(pSS->getValue(AP_STRING_ID_DLG_Styles_DefCurrent), utf8);		
				pLocalised = utf8.utf8_str();
				str = AP_Win32App::s_fromUTF8ToWinLocale(pLocalised);
				
				UT_uint32 result = SendDlgItemMessageW(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, CB_FINDSTRING, -1,
										(LPARAM) str.c_str());
				_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, result );
			}
			
			if(strstr(getAttsVal("type"),"P") != 0)
			{
				_win32DialogNewModify.setControlText( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_TYPE, 
                                                      pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyParagraph) );
			}
			else
			{
				_win32DialogNewModify.setControlText( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_TYPE, 
                                                      pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyCharacter) );
			}

			// Disable for editing top controls in Modify Dialog
			_win32DialogNewModify.enableControl( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_NAME, false );
			_win32DialogNewModify.enableControl( AP_RID_DIALOG_STYLES_NEWMODIFY_EBX_TYPE, false ); 

			fillVecWithProps(szCurrentStyle,true);
		}

		// Generate the Preview class
		HWND hwndChild = GetDlgItem( hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CTL_PREVIEW );

		m_pAbiPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp),
														  hwndChild,
														  0);
		UT_uint32 w,h;
		m_pAbiPreviewWidget->getWindowSize(&w,&h);
		_createAbiPreviewFromGC(m_pAbiPreviewWidget->getGraphics(), w, h);
		_populateAbiPreview(m_bisNewStyle);
		m_pAbiPreviewWidget->setPreview(m_pAbiPreview);

		rebuildDeleteProps();
		_populatePreviews(true);

	}
	
	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
	return 1;							// 1 == we did not call SetFocus()
}
Beispiel #30
0
void
CGlobalOptions::init(HWND hwnd)
{
	HWND child;
	char buffer[30];

	// reset options
	sprintf(buffer, "%d", m_delayTime);
	child = getItem(hwnd, IDC_GLOBAL_DELAY_CHECK);
	setItemChecked(child, false);
	child = getItem(hwnd, IDC_GLOBAL_DELAY_TIME);
	setWindowText(child, buffer);
	sprintf(buffer, "%d", m_twoTapTime);
	child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_CHECK);
	setItemChecked(child, false);
	child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_TIME);
	setWindowText(child, buffer);
	sprintf(buffer, "%d", m_heartbeatTime);
	child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_CHECK);
	setItemChecked(child, false);
	child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_TIME);
	setWindowText(child, buffer);
	child = getItem(hwnd, IDC_GLOBAL_SCREENSAVER_SYNC);
	setItemChecked(child, true);
	child = getItem(hwnd, IDC_GLOBAL_RELATIVE_MOVES);
	setItemChecked(child, false);
	child = getItem(hwnd, IDC_GLOBAL_LEAVE_FOREGROUND);
	setItemChecked(child, false);

	// get the global options
	const CConfig::CScreenOptions* options = m_config->getOptions("");
	if (options != NULL) {
		for (CConfig::CScreenOptions::const_iterator index = options->begin();
										index != options->end(); ++index) {
			const OptionID id       = index->first;
			const OptionValue value = index->second;
			if (id == kOptionScreenSwitchDelay) {
				if (value > 0) {
					sprintf(buffer, "%d", value);
					child = getItem(hwnd, IDC_GLOBAL_DELAY_CHECK);
					setItemChecked(child, true);
					child = getItem(hwnd, IDC_GLOBAL_DELAY_TIME);
					setWindowText(child, buffer);
				}
			}
			else if (id == kOptionScreenSwitchTwoTap) {
				if (value > 0) {
					sprintf(buffer, "%d", value);
					child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_CHECK);
					setItemChecked(child, true);
					child = getItem(hwnd, IDC_GLOBAL_TWO_TAP_TIME);
					setWindowText(child, buffer);
				}
			}
			else if (id == kOptionHeartbeat) {
				if (value > 0) {
					sprintf(buffer, "%d", value);
					child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_CHECK);
					setItemChecked(child, true);
					child = getItem(hwnd, IDC_GLOBAL_HEARTBEAT_TIME);
					setWindowText(child, buffer);
				}
			}
			else if (id == kOptionScreenSaverSync) {
				child = getItem(hwnd, IDC_GLOBAL_SCREENSAVER_SYNC);
				setItemChecked(child, (value != 0));
			}
			else if (id == kOptionRelativeMouseMoves) {
				child = getItem(hwnd, IDC_GLOBAL_RELATIVE_MOVES);
				setItemChecked(child, (value != 0));
			}
			else if (id == kOptionWin32KeepForeground) {
				child = getItem(hwnd, IDC_GLOBAL_LEAVE_FOREGROUND);
				setItemChecked(child, (value != 0));
			}
		}
	}
}