void EnumDataKey(int nTabLevel, ISpDataKey *pSpDataKey) {
    HRESULT hr = S_OK;
    
    // enumerate subkeys recursively
    for (ULONG k = 0; ; k++) {
        LPWSTR key = nullptr;
        hr = pSpDataKey->EnumKeys(k, &key);
        if (SPERR_NO_MORE_ITEMS == hr) {
            // done
            break;
        } else if (FAILED(hr)) {
            ERR(L"ISpDataKey::EnumKeys failed: hr = 0x%08x", hr);
            continue;
        }
        CoTaskMemFreeOnExit fKey(key);
        
        Tab(nTabLevel);
        LOG(L"%s", key);
        
        ISpDataKey *pSubKey = nullptr;
        hr = pSpDataKey->OpenKey(key, &pSubKey);
        if (FAILED(hr)) {
            ERR(L"ISpDataKey::OpenKeys failed: hr = 0x%08x", hr);
            continue;
        }
        ReleaseOnExit rSubKey(pSubKey);
        
        EnumDataKey(nTabLevel + 1, pSubKey);
    }
    
    // enumerate values
    for (ULONG v = 0; ; v++) {
        LPWSTR val = nullptr;
        hr = pSpDataKey->EnumValues(v, &val);
        if (SPERR_NO_MORE_ITEMS == hr) {
            // done
            break;
        } else if (FAILED(hr)) {
            ERR(L"ISpDataKey::EnumKeys failed: hr = 0x%08x", hr);
            continue;
        }
        CoTaskMemFreeOnExit fVal(val);
        
        // how do we know whether it's a string or a DWORD?
        LPWSTR data = nullptr;
        hr = pSpDataKey->GetStringValue(val, &data);
        if (FAILED(hr)) {
            ERR(L"ISpDataKey::GetStringValue failed: hr = 0x%08x", hr);
            continue;
        }
        CoTaskMemFreeOnExit fData(data);
        
        Tab(nTabLevel);
        if (0 == wcscmp(val, L"")) {
            LOG(L"(default) = %s", data);
        } else {
            LOG(L"%s = %s", val, data);
        }
    }
}
std::string NUnitCSharpTestPrettyPrinter::Format(const std::vector<std::vector<std::string>>& x, const std::vector<std::string>& fx, const unsigned int& precisionDigits, const std::string& funcName)
{
    std::stringstream ss;
    if (x[0].size() != fx.size())
        throw std::invalid_argument("x and fx have different sizes");
    for (size_t i = 0; i < x[0].size(); ++i)
    {
        ss << "[TestCase(";
        //ss = x.Aggregate(ss, (current, t) => current + (t[i] + ","));
        ss << fx[i] << ")]\n";
    }
    ss << "void " << funcName << "Test(";
    for (size_t argIdx = 0; argIdx < x.size(); ++argIdx)
    {
        ss << "double x" << argIdx << ",";
    }
    ss << " double fx)\n";
    ss << "{\n";
    ss << Tab() << "var prec = 1.0e-" << precisionDigits << ";\n";
    ss << Tab() << "var f = " << funcName << "(";
    for (size_t argIdx = 0; argIdx < x.size(); ++argIdx )
    {
        ss << "x" << argIdx;
        if (argIdx < x.size()- 1) ss << ",";
    }
    ss << ");\n";
    ss << Tab() << "Assert.AreEqual(fx,f,prec);\n";
    ss << "}";
    return ss.str();
}
示例#3
0
void cSkinSTTNGDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Selectable)
{
  int y = y3 + Roundness + Index * lineHeight;
  tColor ColorFg, ColorBg;
  if (Current) {
     ColorFg = Theme.Color(clrMenuItemCurrentFg);
     ColorBg = Theme.Color(clrMenuItemCurrentBg);
     osd->DrawEllipse  (x1, y - Roundness,  x2 - 1, y - 1, frameColor, -3);
     osd->DrawRectangle(x1, y,              x2 - 1, y + lineHeight - 1, frameColor);
     osd->DrawEllipse  (x1, y + lineHeight, x2 - 1, y + lineHeight + Roundness - 1, frameColor, -2);
     osd->DrawRectangle(x3, y,              x4 - 1, y + lineHeight - 1, ColorBg);
     currentIndex = Index;
     }
  else {
     ColorFg = Theme.Color(Selectable ? clrMenuItemSelectable : clrMenuItemNonSelectable);
     ColorBg = Theme.Color(clrBackground);
     if (currentIndex == Index) {
        osd->DrawRectangle(x1, y - Roundness,  x2 - 1, y + lineHeight + Roundness - 1, Theme.Color(clrBackground));
        osd->DrawRectangle(x3, y,              x4 - 1, y + lineHeight - 1, Theme.Color(clrBackground));
        }
     }
  const cFont *font = cFont::GetFont(fontOsd);
  for (int i = 0; i < MaxTabs; i++) {
      const char *s = GetTabbedText(Text, i);
      if (s) {
         int xt = x3 + 5 + Tab(i);
         osd->DrawText(xt, y, s, ColorFg, ColorBg, font, x4 - xt);
         }
      if (!Tab(i + 1))
         break;
      }
  SetEditableWidth(x4 - x3 - 5 - Tab(1));
}
示例#4
0
// Writes section ends to XML.
void TrackGen::EndSection()
{
	_tabCount--;
	_line = Tab();
	_line.append("</section>\n");
	_output.write(_line.c_str(), _line.size());
}
示例#5
0
void DBWorker::removeTab(int tabId)
{
#ifdef DEBUG_LOGS
    qDebug() << "tab id:" << tabId;
#endif

    QSqlQuery query = prepare("DELETE FROM tab WHERE tab_id = ?;");
    query.bindValue(0, tabId);
    execute(query);

    // Remove links that are only related to this tab
    query = prepare("DELETE FROM link WHERE link_id IN "
                    "(SELECT DISTINCT link_id FROM tab_history WHERE tab_id = ? "
                    "AND link_id NOT IN (SELECT link_id FROM tab_history WHERE tab_id != ? "
                    "UNION SELECT link_id FROM history))");
    query.bindValue(0, tabId);
    query.bindValue(1, tabId);

    // Remove history
    query = prepare("DELETE FROM tab_history WHERE tab_id = ?;");
    query.bindValue(0, tabId);
    execute(query);

    // Check last tab closed
    if (!tabCount()) {
        emit tabAvailable(Tab(-1, Link(), -1, -1));
    }
}
示例#6
0
static void WriteField(CARDINAL position, BOOLEAN allowSpace, 
                       CARDINAL *i)
{
  CARDINAL spaces;
  BOOLEAN  quoted = FALSE;
  /*Get to right position*/
  Tab(position);
  while ((!quoted && (!TermCheck(currentLinePointer[*i]) ||
    (allowSpace && (currentLinePointer[*i] == Space)))) ||
    (quoted && (currentLinePointer[*i] != CR))) {
    if (currentLinePointer[*i] == Space) {
      spaces = 0;
      while (currentLinePointer[*i + spaces] == Space) spaces++;

      if ((currentLinePointer[*i + spaces] == CR) || (!quoted && (currentLinePointer[*i + spaces] == CommentSymbol)))
       {
        i += spaces;
        return;
      }; /* if */
      do PutCh(currentLinePointer[(*i)++]);
      while (currentLinePointer[*i] == Space);
    } else {
      PutCh(currentLinePointer[*i]);
      if (currentLinePointer[*i] == Quotes) quoted = !quoted;
      (*i)++;
    }; /* if */
  }; /* while */
  while (currentLinePointer[*i] == Space) (*i)++;
} /* End WriteField */
void DeclarativeTabModel::tabsAvailable(QList<Tab> tabs)
{
    beginResetModel();
    int oldCount = count();
    m_tabs.clear();
    m_tabs = tabs;

    if (m_tabs.count() > 0) {
        loadTabOrder();
        qSort(m_tabs.begin(), m_tabs.end(), DeclarativeTabModel::tabSort);
        m_activeTab = m_tabs.at(0);
        m_tabs.removeAt(0);
    } else {
        m_activeTab = Tab();
        emit tabsCleared();
    }

    endResetModel();

    if (count() != oldCount) {
        emit countChanged();
    }

    int maxTabId = DBManager::instance()->getMaxTabId();
    if (m_nextTabId != maxTabId + 1) {
        m_nextTabId = maxTabId + 1;
        emit nextTabIdChanged();
    }

    // Startup should be synced to this.
    if (!m_loaded) {
        m_loaded = true;
        emit loadedChanged();
    }
}
示例#8
0
文件: main.cpp 项目: RickSaada/blog
HRESULT DisplayVolume(IAudioVolumeLevel *pVolume, int iTabLevel) {
    HRESULT hr = S_OK;
    UINT nChannels = 0;

    hr = pVolume->GetChannelCount(&nChannels);
    if (FAILED(hr)) {
        LOG(L"GetChannelCount failed: hr = %08x", hr);
        return hr;
    }

    for (UINT n = 0; n < nChannels; n++) {
        float fMinLevelDB, fMaxLevelDB, fStepping, fLevelDB;

        hr = pVolume->GetLevelRange(n, &fMinLevelDB, &fMaxLevelDB, &fStepping);
        if (FAILED(hr)) {
            LOG(L"GetLevelRange failed: hr = 0x%08x", hr);
            return hr;
        }

        hr = pVolume->GetLevel(n, &fLevelDB);
        if (FAILED(hr)) {
            LOG(L"GetLevel failed: hr = 0x%08x", hr);
            return hr;
        }

        Tab(iTabLevel);
        LOG(
            L"Channel %u volume, %g dB to %g dB in steps of %g dB: %g dB",
            n, fMinLevelDB, fMaxLevelDB, fStepping, fLevelDB
        );
    }

    return S_OK;
}
void CSkinManager::RefreshAllSkins(bool bReload)
{
	Combo()->Refresh();
	MainFrame()->Refresh();
	FavorBar()->Refresh();
	MenuBar()->Refresh();
	Tab()->Refresh();
	Category()->Refresh();
	Toolbar()->Refresh();
	HelpButton()->Refresh();
	LoadButton()->Refresh();
	LoginButton()->Refresh();
	SepButton()->Refresh();
	SettingButton()->Refresh();
	BigButton()->Refresh();
	SSLLockButton()->Refresh();
	StatusBar()->Refresh();
	Tooltip()->Refresh();
	MenuButton()->Refresh();
	LogoButton()->Refresh();
	Common()->Refresh(bReload);

	BackButton()->Refresh();
	ForwardButton()->Refresh();
	RefreshButton()->Refresh();

	CoolMenuSkin()->Refresh();
}
示例#10
0
Wt::WWidget *Navigation::tabWidget()
{
  Wt::WTemplate *result = new TopicTemplate("navigation-tabWidget");

  result->bindWidget("Tab", Tab());

  return result;
}
示例#11
0
void ListWordValue(CARDINAL w)
{
  if (printState && ((1 << ListPC) & listStatus)) {
    if (linePosition >= TextStart) PutLine();
    Tab(CodeStart);
    PutHexCardinal(w);
    PutCh(Space);
  }; /* if */
} /* End ListWordValue */
示例#12
0
void ListByteValue(char b)
{
  if (printState && ((1 << ListPC) & listStatus)) {
    if (linePosition >= TextStart) PutLine();
    Tab(CodeStart);
    PutHexCh(b / 0x10);
    PutHexCh(b % 0x10);
    PutCh(Space);
  }; /* if */
} /* End ListByteValue */
示例#13
0
// Writes section headers to XML.
void TrackGen::AddSection(std::string name)
{
	std::stringstream s;
	_line = Tab();
	_line.append("<section name=\"");
	_line.append(name);
	_line.append("\">\n");
	_output.write(_line.c_str(), _line.size());
	_tabCount++;
}
示例#14
0
// Writes string values to XML.
void TrackGen::Attstr(std::string name, std::string val)
{
	_line = Tab();
	_line.append("<attstr name=\"");
	_line.append(name);
	_line.append("\" val=\"");
	_line.append(val);
	_line.append("\" />\n");
	_output.write(_line.c_str(), _line.size());
}
示例#15
0
void AscentAPDlg::Update (double simt)
{
	if (DlgHandle()) {
		static char title[64] = "Atlantis Ascent Autopilot | MET ";
		strcpy (title+32, MetStr (ap->met)); 
		SetWindowText (DlgHandle(), title);
		for (int i = 0; i < TabCount(); i++)
			Tab(i)->Update (simt);
	}
}
示例#16
0
文件: main.cpp 项目: RickSaada/blog
HRESULT DisplayKsJackDescription(IKsJackDescription *pKsJackDescription, int iTabLevel) {
    HRESULT hr = S_OK;

    UINT count = 0;
    hr = pKsJackDescription->GetJackCount(&count);
    if (FAILED(hr)) {
        LOG(L"GetJackCount failed: hr = 0x%08x", hr);
        return hr;
    }

    Tab(iTabLevel);
    LOG(L"Jacks: %u", count);
    
    for (UINT i = 0; i < count; i++) {
        KSJACK_DESCRIPTION desc = {};
        hr = pKsJackDescription->GetJackDescription(0, &desc);
        if (FAILED(hr)) {
            LOG(L"GetJackDescription failed: hr = 0x%08x", hr);
            return hr;
        }
        
        Tab(iTabLevel + 1);
        LOG(L"-- Jack %u --", i + 1);
        Tab(iTabLevel + 2);
        LOG(L"ChannelMapping: 0x%x", desc.ChannelMapping);
        Tab(iTabLevel + 2);
        LOG(
            L"Color: 0x%06x (red = %d, green = %d, blue = %d)",
            desc.Color,
                (desc.Color >> 16) & 0xff,
                (desc.Color >> 8) & 0xff,
                (desc.Color >> 0) & 0xff
        );
        Tab(iTabLevel + 2);
        LOG(L"Connection Type: %d (%s)", desc.ConnectionType, StringFromConnectionType(desc.ConnectionType));
        Tab(iTabLevel + 2);
        LOG(L"Geometric Location: %d (%s)", desc.GeoLocation, StringFromGeoLocation(desc.GeoLocation));
        Tab(iTabLevel + 2);
        LOG(L"General Location: %d (%s)", desc.GenLocation, StringFromGenLocation(desc.GenLocation));
        Tab(iTabLevel + 2);
        LOG(L"Port Connection: %d (%s)", desc.PortConnection, StringFromPortConnection(desc.PortConnection));
        Tab(iTabLevel + 2);
        LOG(L"IsConnected: %s", desc.IsConnected ? L"Yes" : L"No");
    }

    return S_OK;
}
示例#17
0
void HeaderCtrl::ShowTab(int i, bool show) {
	Column& cm = Tab(i);
	if(cm.visible == show) return;
	cm.visible = show;
	if(mode == PROPORTIONAL)
		InvalidateDistribution();
	ReCompute();
	Refresh();
	WhenLayout();
	SbTotal();
}
示例#18
0
文件: package.cpp 项目: hyln9/nV
var Ctx(const wstring &x)
{
	std::pair<tab_t::rep_t::iterator,bool> iter =
		CTab(Contexts).insert(
		tab_t::rep_t::value_type(x,var()));
	if(iter.second)
	{
		ContextName[iter.first->second = Tab()]
		= iter.first->first.c_str();
	}
	return iter.first->second;
}
示例#19
0
static void WriteComment(CARDINAL *i)
{
  CARDINAL tempPosition,
           length;
  if (currentLinePointer[*i] != CommentSymbol)
   {

    /*This is the silly line format case*/
    while (currentLinePointer[*i] != CR) PutCh(currentLinePointer[(*i)++]);
    PutLine();
  } else {
    if (linePosition <= TextStart) tempPosition = TextStart;
    else {
      tempPosition = CommentStart;
      PutCh(Space);
    }; /* if */
    Tab(tempPosition);
    if (linePosition > CommentStart) {
      length = 0;
      while (currentLinePointer[*i + length] != CR) length++;
      if ((linePosition + length > maxCols) &&
        (tempPosition + length <= maxCols)) {
        PutLine();
        Tab(CommentStart);
      }; /* if */
    }; /* if */
    do {
      while (linePosition < maxCols) {
        if (currentLinePointer[*i] == CR) break;
        PutCh(currentLinePointer[(*i)++]);
      }; /* while */
      if (linePosition < maxCols) break;
        /* The previous break was meant to leave the loop */
      PutLine();
      Tab(tempPosition);
    } while (1);
  }; /* if */
} /* End WriteComment */
示例#20
0
void cSkinCursesDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Selectable)
{
  int y = 2 + Index;
  int ColorFg, ColorBg;
  if (Current) {
     ColorFg = clrBlack;
     ColorBg = clrCyan;
     }
  else {
     ColorFg = Selectable ? clrWhite : clrCyan;
     ColorBg = clrBackground;
     }
  for (int i = 0; i < MaxTabs; i++) {
      const char *s = GetTabbedText(Text, i);
      if (s) {
         int xt = Tab(i) / AvgCharWidth();// Tab() is in "pixel" - see also skins.c!!!
         osd->DrawText(xt, y, s, ColorFg, ColorBg, &Font, ScOsdWidth - 2 - xt);
         }
      if (!Tab(i + 1))
         break;
      }
  SetEditableWidth(ScOsdWidth - 2 - Tab(1) / AvgCharWidth()); // Tab() is in "pixel" - see also skins.c!!!
}
示例#21
0
Tab DBWorker::getTabData(int tabId, int historyId)
{
    int hId = historyId;
    if (historyId == 0) {
        QSqlQuery query = prepare("SELECT tab_history_id FROM tab WHERE tab_id = ?;");
        query.bindValue(0, tabId);
        if (execute(query)) {
            if (query.first()) {
                hId = query.value(0).toInt();
            }
        } else {
            return Tab();
        }
    }

    Link link = getLinkFromTabHistory(hId);
    int nextId = getNextLinkIdFromTabHistory(hId);
    int previousId = getPreviousLinkIdFromTabHistory(hId);
#ifdef DEBUG_LOGS
    qDebug() << tabId << historyId << "next link id:" << nextId << "previous link id:" << previousId << link.linkId()<< link.title() << link.url();
#endif
    return Tab(tabId, link, nextId, previousId);
}
示例#22
0
// Writes number values to XML.
void TrackGen::AttnumInt(std::string name, std::string unit, float val)
{
	_line = Tab();
	_line.append("<attnum name=\"");
	_line.append(name);
	_line.append("\" unit=\"");
	_line.append(unit);
	_line.append("\" val=\"");
	std::stringstream s;
	s << val;
	_line.append(s.str());
	_line.append("\" />\n");
	_output.write(_line.c_str(), _line.size());
}
示例#23
0
void cSkinClassicDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Selectable)
{
  int y = y2 + Index * lineHeight;
  tColor ColorFg, ColorBg;
  if (Current) {
     ColorFg = Theme.Color(clrMenuItemCurrentFg);
     ColorBg = Theme.Color(clrMenuItemCurrentBg);
     }
  else {
     ColorFg = Theme.Color(Selectable ? clrMenuItemSelectable : clrMenuItemNonSelectable);
     ColorBg = Theme.Color(clrBackground);
     }
  const cFont *font = cFont::GetFont(fontOsd);
  for (int i = 0; i < MaxTabs; i++) {
      const char *s = GetTabbedText(Text, i);
      if (s) {
         int xt = x0 + Tab(i);
         osd->DrawText(xt, y, s, ColorFg, ColorBg, font, x2 - xt);
         }
      if (!Tab(i + 1))
         break;
      }
  SetEditableWidth(x2 - x0 - Tab(1));
}
示例#24
0
文件: main.cpp 项目: RickSaada/blog
HRESULT DisplayMute(IAudioMute *pMute, int iTabLevel) {
    HRESULT hr = S_OK;
    BOOL bMuted = FALSE;

    hr = pMute->GetMute(&bMuted);
    if (FAILED(hr)) {
        LOG(L"GetMute failed: hr = 0x%08x", hr);
        return hr;
    }

    Tab(iTabLevel);
    LOG(L"Mute node: %s", bMuted ? L"MUTED" : L"NOT MUTED");

    return S_OK;
}
示例#25
0
void ListStringValue(Name string)
{
 CARDINAL i ;

 if (printState && ((1 << ListPC) & listStatus))
  {
   for (i = 1; (i <= string.length); i++)
    {
     if (linePosition >= (MaxLineLength - 4))
      PutLine() ;
     Tab(CodeStart) ;
     EscapeWriteCh(string.key[i - 1]) ;
    }
  }
} /* End ListStringValue */
示例#26
0
	std::wostream& MeshDesc::out_formatted(std::wostream& stream)
	{
		stream << Tab() << typeid(*this).name() << std::endl;
		Tab::Inc();
		stream << Tab() << "Vertex count: " << m_vertices.size() << std::endl;
		stream << Tab() << "Normals count: " << m_normals.size() << std::endl;
		stream << Tab() << "Face count: " << m_faces.size() << std::endl;
		stream << Tab() << "Bone weights count: " << m_bone_weights.size() << std::endl;
		stream << Tab() << "Texture coords: " << m_tex_coords.size() << std::endl;
		for (auto texture_set : m_tex_coords)
			stream << Tab() << "Texture vertex count: " << texture_set.second.size() << std::endl;
		stream << Tab::Dec() << typeid(*this).name();
		return stream;
	}
示例#27
0
void DBWorker::removeAllTabs()
{
    QSqlQuery query = prepare("DELETE FROM tab;");
    execute(query);

    // Remove links that are not stored in history
    query = prepare("DELETE FROM link WHERE link_id IN "
                    "(SELECT DISTINCT link_id FROM tab_history "
                    "WHERE link_id NOT IN (SELECT link_id FROM history))");
    execute(query);

    // Remove history
    query = prepare("DELETE FROM tab_history;");
    execute(query);

    emit tabAvailable(Tab(-1, Link(), -1, -1));
}
// Prints a string that doesn't contain line breaks
void DimensionsStream::PrintLine(const std::string & Line)
{
	std::string::size_type Start = 0, End;
	do
	{
		End = Line.find_first_of('\t', Start);

		auto Length = ((std::string::npos != End) ? End : Line.length()) - Start;
		PrintSegment(Line.substr(Start, Length));
		if (std::string::npos != End)
		{
			Tab();
		}

		Start = End + 1;
	}
	while (std::string::npos != End);
}
示例#29
0
void DBWorker::getAllTabs()
{
    QList<Tab> tabList;
    QSqlQuery query = prepare("SELECT tab.tab_id, link.url, link.title, link.thumb_path "
                              "FROM tab "
                              "INNER JOIN tab_history ON tab_history.id = tab.tab_history_id "
                              "INNER JOIN link ON tab_history.link_id = link.link_id;");
    if (!execute(query)) {
        return;
    }

    while (query.next()) {
        tabList.append(Tab(query.value(0).toInt(),
                           query.value(1).toString(),
                           query.value(2).toString(),
                           query.value(3).toString()));
    }
    emit tabsAvailable(tabList);
}
示例#30
0
void PrintLine(void)
{
  CARDINAL i = 0;
  if (!linePrinted) {
    if (TextStart >= maxCols) {
      /*This is the silly line format case*/
      if (linePosition > TextStart) PutLine();
      else Tab(TextStart);
      while (currentLinePointer[i] != CR) PutCh(currentLinePointer[i++]);
    } else {
      /*This is the sensible case*/
      if ((linePosition > TextStart) && (currentLinePointer[i] != Space))
        PutLine();
      do {

        if ((currentLinePointer[i] == CommentSymbol) || (OpcodeStart >= maxCols))
         break;
        /*Write out the label*/
        WriteField(TextStart, FALSE, &i);

        if ((currentLinePointer[i] == CR) || (currentLinePointer[i] == CommentSymbol) || (OperandStart >= maxCols))
         break ;

        /*We have an opcode*/
        if (linePosition >= OpcodeStart) PutLine();
        WriteField(OpcodeStart, FALSE, &i);

        if ((currentLinePointer[i] == CR) || (currentLinePointer[i] == CommentSymbol) || (CommentStart >= maxCols))
         break ;

        /*We have an operand*/
        if (linePosition >= OperandStart) PutLine();
        WriteField(OperandStart, TRUE, &i);
      } while (1);
      if (currentLinePointer[i] != CR) WriteComment(&i);
    }; /* if */
    PutLine();
  }; /* if */
  linePrinted = TRUE;
  linePosition = 0;
  if (PollEscape()) abortFlag = TRUE;
} /* End PrintLine */