Beispiel #1
0
CString weightToString(int weight)
    {
     switch(weight)
        { /* tmWeight */
#define FWCASE(x) case x: return CString(_T(#x))
         FWCASE(FW_DONTCARE);
         FWCASE(FW_THIN);
         FWCASE(FW_EXTRALIGHT);
         FWCASE(FW_LIGHT);
         FWCASE(FW_NORMAL);
         FWCASE(FW_MEDIUM);
         FWCASE(FW_SEMIBOLD);
         FWCASE(FW_BOLD);
         FWCASE(FW_EXTRABOLD);
         FWCASE(FW_HEAVY);
#undef FWCASE
        } /* tmWeight */

     int low = (weight / 100) * 100;
     int high = low / 100;

     if(FW_DONTCARE <= low && low <= FW_BLACK &&
        FW_DONTCARE <= high && high <= FW_BLACK)
           { /* make range */
            CString s;
            s.Format(_T("%s..%s"), weightToString(low), weightToString(high));
            return s;
           } /* make range */

     return _T("");
    }
Beispiel #2
0
//-------------------------------------------------------------------------
SetupDialog::SetupDialog(MainWindow *parent) 
 : QDialog(parent), mMainWindow(parent)
{
	setupUi(this);

	QObject::connect (fDefaultButton, SIGNAL(clicked()), this, SLOT(reset()));
	QObject::connect (fSysDistBox, SIGNAL(valueChanged(int)), this, SLOT(setup()));
	QObject::connect (fMaxDistBox, SIGNAL(valueChanged(int)), this, SLOT(setup()));
	QObject::connect (fSpringBox, SIGNAL(valueChanged(int)), this, SLOT(setup()));
	QObject::connect (fForceBox, SIGNAL(valueChanged(int)), this, SLOT(setup()));
	QObject::connect (fSysDistrMenu, SIGNAL(currentIndexChanged(int)), this, SLOT(setup()));
	QObject::connect (fOPFcheckBox, SIGNAL(clicked()), this, SLOT(setup()));
	QObject::connect (fNSpacingcheckBox, SIGNAL(clicked()), this, SLOT(setup()));
    QObject::connect (fResizePage2Music, SIGNAL(clicked()), this, SLOT(setup()));
	QObject::connect (fColorButton, SIGNAL(clicked()) , this, SLOT(changeColor()));
	
	QObject::connect (fMapping, SIGNAL(clicked()), this, SLOT(setup()));
	QObject::connect (fRawMapping, SIGNAL(clicked()), this, SLOT(setup()));
	QObject::connect (fBoundingBoxes, SIGNAL(clicked()), this, SLOT(setup()));
	QObject::connect (fPageBB, SIGNAL(clicked()), this, SLOT(setup()));
	QObject::connect (fSystemBB, SIGNAL(clicked()), this, SLOT(setup()));
	QObject::connect (fSystemSliceBB, SIGNAL(clicked()), this, SLOT(setup()));
	QObject::connect (fStaffBB, SIGNAL(clicked()), this, SLOT(setup()));
	QObject::connect (fMeasureBB, SIGNAL(clicked()), this, SLOT(setup()));
	QObject::connect (fEventBB, SIGNAL(clicked()), this, SLOT(setup()));

	QObject::connect (fVoiceNumEdit, SIGNAL(valueChanged(int)), this, SLOT(voiceStaffSetup(int)));
	QObject::connect (fStaffNumEdit, SIGNAL(valueChanged(int)), this, SLOT(voiceStaffSetup(int)));
	QObject::connect (fShowAllStaffsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(voiceStaffSetup(int)));
	QObject::connect (fShowAllVoicesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(voiceStaffSetup(int)));

	mSavedSettings = mMainWindow->getEngineSettings();
	mSavedBBMap = mMainWindow->getBBMap();
	mSavedShowMapping = mMainWindow->getShowMapping();
	mSavedRawMapping = mMainWindow->getRawMapping();
	mSavedShowBoxes = mMainWindow->getShowBoxes();
	mSavedVoiceNum = mMainWindow->getVoiceNum();
	mSavedStaffNum = mMainWindow->getStaffNum();
	scoreColorChanged( mMainWindow->getScoreColor() );
	set (mSavedSettings, mSavedBBMap, mSavedShowMapping, mSavedRawMapping, mSavedShowBoxes, mSavedVoiceNum, mSavedStaffNum);

	mFontColorMap[ GuidoHighlighter::VOICE_SEPARATOR_ELT ]	= fVoiceSeparatorColorButton;
	mFontColorMap[ GuidoHighlighter::SCORE_SEPARATOR_ELT ]	= fScoreSeparatorColorButton;
	mFontColorMap[ GuidoHighlighter::DURATION_ELT ]			= fDurationsColorButton;
	mFontColorMap[ GuidoHighlighter::NOTE_ELT ]				= fNotesColorButton;
	mFontColorMap[ GuidoHighlighter::TAG_PARAM_ELT ]		= fTagsParametersColorButton;
	mFontColorMap[ GuidoHighlighter::TAG_ELT ]				= fTagsColorButton;
	mFontColorMap[ GuidoHighlighter::COMMENT_ELT ]			= fCommentsColorButton;
						
	mFontWeightMap[ GuidoHighlighter::VOICE_SEPARATOR_ELT ]	= fVoiceSeparatorWeight;
	mFontWeightMap[ GuidoHighlighter::SCORE_SEPARATOR_ELT ]	= fScoreSeparatorWeight;
	mFontWeightMap[ GuidoHighlighter::DURATION_ELT ]		= fDurationsWeight;
	mFontWeightMap[ GuidoHighlighter::NOTE_ELT ]			= fNotesWeight;
	mFontWeightMap[ GuidoHighlighter::TAG_PARAM_ELT ]		= fTagsParametersWeight;
	mFontWeightMap[ GuidoHighlighter::TAG_ELT ]				= fTagsWeight;
	mFontWeightMap[ GuidoHighlighter::COMMENT_ELT ]			= fCommentsWeight;

	fTabWidget->setCurrentIndex(0);

	for ( int i = 0 ; i < GuidoHighlighter::SIZE ; i++ )
	{
		// Set widgets properties with syntax-element id
		mFontColorMap[ i ]->setProperty( SYNTAX_ELT_ID , i );
		mFontWeightMap[ i ]->setProperty( SYNTAX_ELT_ID , i );
		
		// Set the color of the font-color button
		QColor c = mMainWindow->getHighlighter()->color( i );
		QPixmap pixmap(30 , 30);
		pixmap.fill( c );
		mFontColorMap[ i ]->setIcon( QIcon(pixmap) );
		mFontColorMap[ i ]->setProperty( BUTTON_COLOR , c );
				
		// Adds font-weight items in the combobox
		for ( int w = 0 ; w <= QFont::Black ; w++ )
		{
			QString weightString = weightToString( w );
			if ( weightString.size() )
				mFontWeightMap[i]->addItem( weightString , w );
		}
		// Set the current combobox item
		QFont::Weight weight = (QFont::Weight)mMainWindow->getHighlighter()->weight( i );
		mFontWeightMap[i]->setCurrentIndex( mFontWeightMap[i]->findData( weight ) );
		
		// Connect the font widgets to their methods
		connect( mFontColorMap[i] , SIGNAL(clicked()) , this , SLOT(fontColorButtonClicked()) );
		connect( mFontWeightMap[i] , SIGNAL(currentIndexChanged(int)) , this , SLOT(fontWeightChanged(int)) );

		mSavedColors[i] = c;
		mSavedWeights[i]= int(weight);
	}

	if (!mColorDialog) {
		mColorDialog = new QColorDialog( this );
		mColorDialog->setWindowTitle("Choose score color");
		mColorDialog->setOption (QColorDialog::NoButtons);
	}
	
	QSettings settings;
    QPoint pos = settings.value(SETUP_DIALOG_POS_SETTING, QPoint(300, 300)).toPoint();
    QSize winSize = settings.value(SETUP_DIALOG_SIZE_SETTING, sizeHint() ).toSize();
    resize(winSize);
    move(pos);
}
Beispiel #3
0
QString weightToString(int weight) { return weightToString( QFont::Weight(weight) ); }
Beispiel #4
0
HTREEITEM loadTextMetrics(TEXTMETRIC * tm, CTreeCtrl * tc )
    {
     HTREEITEM ti;
     CString s;
     if(tm->tmPitchAndFamily & TMPF_TRUETYPE)
        ti = tc->InsertItem(_T("NEWTEXTMETRIC"));
     else
        ti = tc->InsertItem(_T("TEXTMETRIC"));

     s.Format(_T("tmHeight: %d"), tm->tmHeight);
     tc->InsertItem(s, ti);

     s.Format(_T("tmAscent: %d"), tm->tmAscent);
     tc->InsertItem(s, ti);

     s.Format(_T("tmDescent: %d"), tm->tmDescent);
     tc->InsertItem(s, ti);
      
     s.Format(_T("tmInternalLeading: %d"), tm->tmInternalLeading);
     tc->InsertItem(s, ti);

     s.Format(_T("tmExternalLeading: %d"), tm->tmExternalLeading);
     tc->InsertItem(s, ti);

     s.Format(_T("tmAveCharWidth: %d"), tm->tmAveCharWidth);
     tc->InsertItem(s, ti);

     s.Format(_T("tmMaxCharWidth: %d"), tm->tmMaxCharWidth);
     tc->InsertItem(s, ti);

     s.Format(_T("tmWeight: %d"), tm->tmWeight);
     HTREEITEM wt = tc->InsertItem(s, ti);

     s = weightToString(tm->tmWeight);
     if(!s.IsEmpty())                                          // REQ #037
        tc->InsertItem(s, wt);

     s.Format(_T("tmOverhang: %d"), tm->tmOverhang);
     tc->InsertItem(s, ti);

     s.Format(_T("tmDigitizedAspectX: %d"), tm->tmDigitizedAspectX);
     tc->InsertItem(s, ti);

     s.Format(_T("tmDigitizedAspectY: %d"), tm->tmDigitizedAspectY);
     tc->InsertItem(s, ti);

     s.Format(_T("tmFirstChar: %d"), tm->tmFirstChar);
     tc->InsertItem(s, ti);

     s.Format(_T("tmLastChar: %d"), tm->tmLastChar);
     tc->InsertItem(s, ti);

     s.Format(_T("tmDefaultChar: %d"), tm->tmDefaultChar);
     tc->InsertItem(s, ti);

     s.Format(_T("tmBreakChar: %d"), tm->tmBreakChar);
     tc->InsertItem(s, ti);

     s.Format(_T("tmItalic: %d"), tm->tmItalic);
     tc->InsertItem(s, ti);

     s.Format(_T("tmUnderlined: %d"), tm->tmUnderlined);
     tc->InsertItem(s, ti);

     s.Format(_T("tmStruckOut: %d"), tm->tmStruckOut);
     tc->InsertItem(s, ti);

     s.Format(_T("tmPitchAndFamily: 0x%02x"), tm->tmPitchAndFamily);
     HTREEITEM paf = tc->InsertItem(s, ti);
     insertPitchAndFamily(tm->tmPitchAndFamily, tc, paf);

     s.Format(_T("tmCharSet: %d"), tm->tmCharSet);
     tc->InsertItem(s, ti);

     if(tm->tmPitchAndFamily & TMPF_TRUETYPE)
        { /* newtextmetric */
         LPNEWTEXTMETRIC ntm = (LPNEWTEXTMETRIC)tm;
      
         s.Format(_T("ntmFlags 0x%02x"), ntm->ntmFlags);
         HTREEITEM flags = tc->InsertItem(s, ti);

         addFlagVal(tc, flags, ntm->ntmFlags, 0x01, IDS_NTM_ITALIC);
         addFlagVal(tc, flags, ntm->ntmFlags, 0x02, IDS_NTM_UNDERSCORE);
         addFlagVal(tc, flags, ntm->ntmFlags, 0x04, IDS_NTM_NEGATIVE);
         addFlagVal(tc, flags, ntm->ntmFlags, 0x08, IDS_NTM_OUTLINE);
         addFlagVal(tc, flags, ntm->ntmFlags, 0x10, IDS_NTM_STRIKEOUT);
         addFlagVal(tc, flags, ntm->ntmFlags, 0x20, IDS_NTM_BOLD);
          
         s.Format(_T("ntmSizeEM %d"), ntm->ntmSizeEM);
         tc->InsertItem(s, ti);

         s.Format(_T("ntmCellHeight %d"), ntm->ntmCellHeight);
         tc->InsertItem(s, ti);

         s.Format(_T("ntmAvgWIdth %d"), ntm->ntmAvgWidth);
         tc->InsertItem(s, ti);
        } /* newtextmetric */
     
     return ti;
    }
Beispiel #5
0
HTREEITEM loadLogFont(LOGFONT * lf, CTreeCtrl * tc, BOOL exlf)
    {
     CString s;
     
     HTREEITEM lfi;

#if 0
     if(exlf)
        lfi = tc->InsertItem(_T("EXTLOGFONT"));
     else
        lfi = tc->InsertItem(_T("LOGFONT"));
#else
     lfi = tc->InsertItem(_T("LOGFONT"));
#endif

     s.Format(_T("lfHeight %d"), lf->lfHeight);
     tc->InsertItem(s, lfi);

     s.Format(_T("lfWidth %d"), lf->lfWidth);
     tc->InsertItem(s, lfi);

     s.Format(_T("lfEscapement %d"), lf->lfEscapement);
     tc->InsertItem(s, lfi);
     
     s.Format(_T("lfOrientation %d"), lf->lfOrientation);
     tc->InsertItem(s, lfi);

     s.Format(_T("lfWeight %d"), lf->lfWeight);
     HTREEITEM wt = tc->InsertItem(s, lfi);
     s = weightToString(lf->lfWeight);
     if(!s.IsEmpty())                                               // REQ #037
        tc->InsertItem(s, wt);

     s.Format(_T("lfItalic %d"), lf->lfItalic);
     tc->InsertItem(s, lfi);

     s.Format(_T("lfUnderline %d"), lf->lfUnderline);
     tc->InsertItem(s, lfi);

     s.Format(_T("lfStrikeOut %d"), lf->lfStrikeOut);
     tc->InsertItem(s, lfi);

     s.Format(_T("lfCharSet %d"), lf->lfCharSet);
     HTREEITEM cs = tc->InsertItem(s, lfi);
        s = charsetToString(lf->lfCharSet);
        tc->InsertItem(s, cs);
        

     s.Format(_T("lfOutPrecision %d"), lf->lfOutPrecision);
     HTREEITEM op = tc->InsertItem(s, lfi);
        s = outprecisionToString(lf->lfOutPrecision);
        tc->InsertItem(s, op);

     s.Format(_T("lfClipPrecision %d"), lf->lfClipPrecision);
     HTREEITEM cp = tc->InsertItem(s, lfi);
         s = clipprecisionToString(lf->lfClipPrecision);
         tc->InsertItem(s, cp);

     s.Format(_T("lfQuality %d"), lf->lfQuality);
     HTREEITEM q = tc->InsertItem(s, lfi);
         s = qualityToString(lf->lfQuality);
         tc->InsertItem(s, q);

     s.Format(_T("lfPitchAndFamily 0x%02x"), lf->lfPitchAndFamily);
     HTREEITEM paf = tc->InsertItem(s, lfi);
     insertPitchAndFamily(lf->lfPitchAndFamily, tc, paf);

     s.Format(_T("lfFaceName \"%s\""), lf->lfFaceName);
     tc->InsertItem(s, lfi);

#if 0
     if(tt)
        { /* TrueType */
         LPEXTLOGFONT elf = (LPEXTLOGFONT)lf;
         
         s.Format(_T("elfFullName \"%s\""), elf->elfFullName);
         tc->InsertItem(s, lfi);

         s.Format(_T("elfStyle \"%s\""), elf->elfStyle);
         tc->InsertItem(s, lfi);

         s.Format(_T("elfVersion %d"), elf->elfVersion);
         tc->InsertItem(s, lfi);

         s.Format(_T("elfStyleSize %d"), elf->elfStyleSize);
         tc->InsertItem(s, lfi);

         s.Format(_T("elfMatch %d"), elf->elfMatch);
         tc->InsertItem(s, lfi);

         s.Format(_T("elfStyleSize %d"), elf->elfStyleSize);
         tc->InsertItem(s, lfi);

         s.Format(_T("elfVendorId %d = [0x%02x 0x%02x 0x%02x 0x%02x]"), 
                                elf->elfVendorId,
                                LOBYTE(LOWORD(elf->elfVendorId)),
                                HIBYTE(LOWORD(elf->elfVendorId)),
                                LOBYTE(HIWORD(elf->elfVendorId)),
                                HIBYTE(HIWORD(elf->elfVendorId)));
         tc->InsertItem(s, lfi);


         s.Format(_T("elfCulture %d"), elf->elfCulture);
         tc->InsertItem(s, lfi);
         
         HTREEITEM pi = tc->InsertItem(_T("elfPanose"), lfi);
         loadPanose(tc, pi, &elf->elfPanose);
        } /* TrueType */
#endif

     return lfi;
    }