Exemple #1
0
void MSTableColumn::updateFont(Font oldfid_) 
{
  MSWidget::updateFont(oldfid_);
  if (table()!=0)
   {
     MSBoolean wasFrozen=table()->frozen();
     table()->freeze();
     if (headingFont()==oldfid_) headingFont(font());
     fontStruct((XFontStruct *)server()->fontStruct(font()));
     table()->calculateRowHeight();
     table()->adjustNumVisible();
     if (wasFrozen==MSFalse) table()->unfreeze();
   }
}
Exemple #2
0
void MSTableColumn::headingFont(Font fid_) 
{ 
  if (headingFont()!=fid_)
   {
     _headingFont=fid_;
     updateHeading();
   }
}
Exemple #3
0
void
TabsView::showTab( TabsItem *tab )
{
    if( tab )
    {
        QString tabText = tab->getTabData();
        if( tabText.length() > 0 )
        {
            tabText.replace( "\n", "<br></br>", Qt::CaseInsensitive );

            QFont tabFont( "monospace");
            tabFont.setStyleHint( QFont::Courier );
            tabFont.setStyleStrategy( QFont::PreferAntialias );
            tabFont.setWeight( QFont::Normal );
            tabFont.setPointSize( QFont().pointSize() );

            QFont headingFont( "sans-serif" );
            headingFont.setPointSize( tabFont.pointSize() + 2 );
            headingFont.setStyleHint( QFont::SansSerif );
            headingFont.setStyleStrategy( QFont::PreferAntialias );
            headingFont.setWeight( QFont::Black );
            QString linkColor = The::paletteHandler()->palette().link().color().name();
            QString textColor = The::paletteHandler()->palette().text().color().name();
            int headingWeight = 600;

            QString htmlData = "<html>";
                    htmlData += "<body style=\"font-family:'" + tabFont.family() + "';";
                    htmlData += "font-size:" + QString::number( tabFont.pointSize() ) + "pt;";
                    htmlData += "font-weight:" + QString::number( tabFont.weight() ) + ";";
                    htmlData += "color:" + textColor + ";\">";

                    // tab heading + tab source
                    htmlData += "<p><span style=\"font-family:'" + headingFont.family() + "';";
                    htmlData += "font-size:" + QString::number( headingFont.pointSize() ) + "pt;";
                    htmlData += "font-weight:" + QString::number( headingWeight ) + ";\">";
                    htmlData += tab->getTabTitle();
                    htmlData += " (" + i18n( "tab provided from: " ) + "<a href=\"" + tab->getTabUrl() + "\">";
                    htmlData += "<span style=\"text-decoration: underline; color:" + linkColor + ";\">";
                    htmlData += tab->getTabSource() + "</a>";
                    htmlData += ")</span></p>";

                    // tab data
                    htmlData += tabText + "</body></html>";

            // backup current scrollbar position
            QScrollBar *vbar = m_tabTextBrowser->nativeWidget()->verticalScrollBar();
            int scrollPosition = vbar->isVisible() ? vbar->value() : vbar->minimum();

            m_tabTextBrowser->nativeWidget()->setHtml( htmlData );

            // re-apply scrollbar position
            vbar->setSliderPosition( scrollPosition );
        }
    }
}
Exemple #4
0
void MSTableColumn::init(void)
{
  _style=0;
  _breakStyle=reportTable()->breakStyle();
  _headingStyle=reportTable()->headingStyle();
  _breakOffset=reportTable()->breakOffset();
  _breakLeading=reportTable()->breakLeading();
  _fgGrayScale=reportTable()->fgGrayScale();
  _bgGrayScale=reportTable()->bgGrayScale();
  _breakFgGrayScale=reportTable()->fgGrayScale();
  _breakBgGrayScale=reportTable()->bgGrayScale();
  _headingFgGrayScale=reportTable()->headingFgGrayScale();
  _headingBgGrayScale=reportTable()->headingBgGrayScale();
  _headingForeground=0;
  _suppressDuplicate=MSFalse;
  _breakOn=MSFalse;
  _pageBreakOn=MSFalse;
  _breakProcessOn=MSTrue;
  _breakProcessMode=MSP::Total;
  _column=reportTable()->columnList()->count();
  _breakFgPixel=ULONG_MAX;
  _breakBgPixel=ULONG_MAX;
  _valueQuoted=MSTrue;

  _owner=table();
  if (owner()!=0)
   {
     _bg=owner()->background();
     _fg=owner()->foreground();
     _fontID=owner()->font();
   }
  sensitive(MSTrue);
  _resizable=MSTrue;
  _columnWidth=MSTableColumnDefaultColumnWidth;
  _columnAlignment=MSRight;
  _clipMode=MSNoClipping;
  _editWidth=MSTableColumnDefaultEditWidth;
  _cycleMode=MSForeground;
  headingForeground(reportTable()->headingForeground());
  if (table()!=0)
   {
     _headingFont=table()->headingFont();
     _headingAlignment=table()->headingAlignment();
     fontStruct((XFontStruct *)server()->fontStruct(font()));
     if (font()!=headingFont()) headingFontStruct((XFontStruct *)server()->fontStruct(headingFont()));
     else headingFontStruct((XFontStruct *)fontStruct());
     createGCs();
     childCreateNotify();
   }
  else reportTable()->addColumn(this);
}
void PAccountDialog::LayoutGUI(void) {
	font_height fh;
	BFont headingFont(be_bold_font);
	headingFont.GetHeight(&fh);
	float headingFontHeight = fh.ascent + fh.descent + fh.leading;
	float inset = ceilf(be_plain_font->Size() * 0.7f);

	BRect frame = Bounds();

	// Account Name
	fAccountName->ResizeToPreferred();
	fAccountName->MoveTo(frame.left + inset, frame.top + inset);
	BRect frameAccountName = fAccountName->Frame();
	
	// Account Name Divider
	BRect frameAccountNameDivider = fAccountNameDivider->Frame();
	fAccountNameDivider->MoveTo(frameAccountNameDivider.left + inset, frameAccountName.bottom + inset);
	fAccountNameDivider->ResizeTo(frameAccountNameDivider.Width() - (inset * 2), frameAccountNameDivider.Height());
	frameAccountNameDivider = fAccountNameDivider->Frame();
	
	// OK Button
	fOKButton->ResizeToPreferred();
	BRect frameOKButton = fOKButton->Frame();
	fOKButton->MoveTo(frame.right - frameOKButton.Width(), frame.bottom - frameOKButton.Height());
	frameOKButton = fOKButton->Frame();
	
	// Cancel Button
	fCancelButton->ResizeToPreferred();
	BRect frameCancelButton = fCancelButton->Frame();
	fCancelButton->MoveTo(frameOKButton.left - inset - frameCancelButton.Width(), frame.bottom - frameCancelButton.Height());
	frameCancelButton = fCancelButton->Frame();

	// Protocol View
	fProtocolControl->ResizeToPreferred();
	BRect frameProtocolControl = fProtocolControl->Frame();
	fProtocolControl->MoveTo(frame.left, frameAccountNameDivider.bottom + inset);
//	fProtocolControl->ResizeTo(frame.right, frameOKButton.bottom - inset - (frameAccountNameDivider.bottom + inset));
	frameProtocolControl = fProtocolControl->Frame();
}
Exemple #6
0
MSAttrValueList& MSTableColumn::get(MSAttrValueList& avList_)
{
  MSStringVector aBoolVector("MSFalse\nMSTrue");
  avList_<<MSAttrValue("tag",tag().symbolName(),MSAttrValue::Control|MSAttrValue::String);
  avList_<<MSAttrValue("heading",MSAttrValue::stringVectorToString(heading()),MSAttrValue::String);
  avList_<<MSAttrValue("headingForeground",server()->colorName(headingForeground()),MSAttrValue::Color);
  avList_<<MSAttrValue("headingFont",server()->fontName(headingFont()),MSAttrValue::Font);
  MSStringVector alignmentVector("MSNone\nMSCenter\nMSTop\nMSBottom\nMSLeft\nMSRight");
  avList_<<MSAttrValue("headingAlignment",MSAttrValue::alignmentToString(headingAlignment()),
                       alignmentVector, MSAttrValue::List);
  avList_<<MSAttrValue("cycleColors",MSAttrValue::colorVectorToString(cycleColors(),server()),
                       MSAttrValue::Color|MSAttrValue::List|MSAttrValue::StringVector);
  const char *value;
  switch (cycleColorMode())
  {
  case MSBackground:   value="MSBackground";   break;
  case MSReverseVideo: value="MSReverseVideo"; break;
  case MSForeground:
  default:             value="MSForeground";   break;
  }
  avList_<<MSAttrValue("cycleColorMode",value, MSStringVector("MSBackground\nMSForeground\nMSReverseVideo"));
  switch (columnAlignment())
   {
   case MSCenter:  value="MSCenter"; break;
   case MSLeft:    value="MSLeft";   break;
   case MSRight:
   default:        value="MSRight";  break;
   }
  avList_<<MSAttrValue("columnAlignment",value,MSStringVector("MSLeft\nMSRight\nMSCenter"));
  MSStringVector clipModeVector("MSNoClipping\nMSClipStars");
  if(clipMode()==MSClipStars) value="MSClipStars";
  else value="MSNoClipping";
  avList_<<MSAttrValue("clipMode",value,clipModeVector);
  avList_<<MSAttrValue("columnWidth",MSString(columnWidth()));
  avList_<<MSAttrValue("editWidth",MSString(editWidth()));
  avList_<<MSAttrValue("resizable",resizable()==MSTrue?"MSTrue":"MSFalse",aBoolVector);
  avList_<<MSAttrValue("format",format().asString(),format().formats(),MSAttrValue::String);

  avList_<<MSAttrValue("breakOn",breakOn()==MSTrue?"MSTrue":"MSFalse",aBoolVector);
  
  MSStringVector modes="MSP::Total\nMSP::Minimum\nMSP::Maximum\nMSP::Average";
  MSUnsignedLongVector modeValues;
  modeValues.append(MSP::Total);
  modeValues.append(MSP::Minimum);
  modeValues.append(MSP::Maximum);
  modeValues.append(MSP::Average);

  MSString result=MSAttrValue::enumToString(breakProcessMode(),modes,modeValues,modes(0),MSTrue);
  
  avList_<<MSAttrValue("breakProcessMode",result,modes);
  avList_<<MSAttrValue("breakProcessOn",breakProcessOn()==MSTrue?"MSTrue":"MSFalse",aBoolVector);
  avList_<<MSAttrValue("breakBg",server()->colorName(breakBgPixel()),MSAttrValue::Color);
  avList_<<MSAttrValue("breakFg",server()->colorName(breakFgPixel()),MSAttrValue::Color);
//  avList_<<MSAttrValue("breakFont",server()->fontName(breakFont()),MSAttrValue::Font);
  avList_<<MSAttrValue("suppressDuplicate",suppressDuplicate()==MSTrue?"MSTrue":"MSFalse",aBoolVector);

  avList_<<MSAttrValue("columnresize","",MSAttrValue::Callback);
  avList_<<MSAttrValue("valueQuoted",valueQuoted()==MSTrue?"MSTrue":"MSFalse",aBoolVector);
  avList_<<MSAttrValue("choices",MSAttrValue::stringVectorToString(choices()),MSAttrValue::StringVector);
  return MSWidget::get(avList_);
}
Exemple #7
0
void MSTableColumn::set(MSAttrValueList& avList_)
{
  MSWidget::set(avList_);
  MSIndexVector index;
  for (unsigned i=0;i<avList_.length();i++)
   {
     if (avList_[i].attribute()=="breakOn")
      {
       breakOn(avList_[i].value().asBoolean());
       index<<i;
      }
     else if (avList_[i].attribute()=="suppressDuplicate")
      {
       suppressDuplicate(avList_[i].value().asBoolean());
       index<<i;
      }
/*     else if (avList_[i].attribute()=="breakFont")
      {
	breakFont(avList_[i].value());
	index<<i;
      }
      */
     else if (avList_[i].attribute()=="breakFg")
      {
	if(avList_[i].value().length()!=0) breakFg(avList_[i].value());
	index<<i;
      }
     else if (avList_[i].attribute()=="breakBg")
      {
  	if(avList_[i].value().length()!=0) breakBg(avList_[i].value());
	index<<i;
      }
     else if (avList_[i].attribute()=="breakProcessOn")
      {
	breakProcessOn(avList_[i].value().asBoolean());
	index<<i;
      }
     else if (avList_[i].attribute()=="breakProcessMode")
      {
       MSStringVector modes="MSP::Total\nMSP::Minimum\nMSP::Maximum\nMSP::Average";
       MSUnsignedLongVector modeValues;
       modeValues.append(MSP::Total);
       modeValues.append(MSP::Minimum); 
       modeValues.append(MSP::Maximum);
       modeValues.append(MSP::Average);

       unsigned long mode=MSAttrValue::stringToEnum(avList_[i].value(),modes,modeValues,MSP::Total,MSTrue);
       breakProcessMode((MSP::BreakProcessMode)mode);
       index<<i;
      }
     else if (avList_[i].attribute()=="heading")
      {
	heading(MSAttrValue::stringToStringVector(avList_[i].value()));
	index<<i;
      }
     else if (avList_[i].attribute()=="headingForeground")
      {
	headingForeground(avList_[i].value());
	index<<i;
      }
     else if (avList_[i].attribute()=="headingFont")
      {
	headingFont(avList_[i].value());
	index<<i;
      }
     else if (avList_[i].attribute()=="headingAlignment")
      {
	headingAlignment(MSAttrValue::stringToAlignment(avList_[i].value()));
	index<<i;
      }
     else if (avList_[i].attribute()=="cycleColors")
      {
        cycleColors(MSAttrValue::stringToStringVector(avList_[i].value()));
	index<<i;
      }
     else if (avList_[i].attribute()=="cycleColorMode")
      {
	if (avList_[i].value()=="MSBackground") cycleColorMode(MSBackground);
	else if (avList_[i].value()=="MSReverseVideo") cycleColorMode(MSReverseVideo);
	else cycleColorMode(MSForeground);
	index<<i;
      }
     else if (avList_[i].attribute()=="clipMode")
      {
	if (avList_[i].value()=="MSClipStars") clipMode(MSClipStars);
	else clipMode(MSNoClipping);
	index<<i;
      }
     else if (avList_[i].attribute()=="columnAlignment")
      {
	if (avList_[i].value()=="MSRight") columnAlignment(MSRight);
	else if (avList_[i].value()=="MSLeft") columnAlignment(MSLeft);
	else columnAlignment(MSCenter);
	index<<i;
      }
     else if (avList_[i].attribute()=="columnWidth")
      {
	columnWidth(avList_[i].value().asInt());
	index<<i;
      }
     else if (avList_[i].attribute()=="editWidth")
      {
	editWidth(avList_[i].value().asInt());
	index<<i;
      }
     else if (avList_[i].attribute()=="resizable")
      {
	resizable(avList_[i].value().asBoolean());
	index<<i;
      }
     else if (avList_[i].attribute()=="format")
      {
	format(MSFormat(avList_[i].value()));
	index<<i;
      }
     else if(avList_[i].attribute()=="tag")
      {
        if(avList_[i].value().length()==0) tag(MSSymbol::nullSymbol());
        else tag(MSSymbol(avList_[i].value()));
        index<<i;
      }
     else if (avList_[i].attribute()=="valueQuoted")
      {
        valueQuoted(avList_[i].value().asBoolean());
        index<<i;
      }
     else if (avList_[i].attribute()=="choices")
      {
        choices(MSAttrValue::stringToStringVector(avList_[i].value()));
        index<<i;
      }
   }
  avList_.remove(index);
}
Exemple #8
0
void MSTableColumn::headingFont(const char *fid_) 
{ headingFont(server()->fontID(fid_)); }